Daily Archives

Articles indexed Sunday November 10 2013

Page 11/15 | < Previous Page | 7 8 9 10 11 12 13 14 15  | Next Page >

  • GUI Freezes and Output to JTextField from user input

    - by user2929005
    I am having I hope only two issues currently. I have had help on this on a previous question that I have asked but now I am running into different issues. My current issues now is that I need to print out into a JTextField a sorted array. I do not have questions about how to sort the array I just would like help on how to get the array to print to the JTextField when the Bubble Sort button is pressed. Currently when I press the button it freezes. It freezes at this line. list.add(Integer.valueOf(input.nextInt())); please help Thank you. import java.awt.EventQueue; import javax.swing.*; import java.awt.event.*; import java.util.*; public class Sorting { private JFrame frame; private JTextArea inputArea; private JTextField outputArea; ArrayList<Integer> list = new ArrayList<Integer>(); Scanner input = new Scanner(System.in); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Sorting window = new Sorting(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Sorting() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Sorting"); frame.getContentPane().setLayout(null); JButton bubbleButton = new JButton("Bubble Sort"); bubbleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { list.add(Integer.valueOf(input.nextInt())); // for(int i = 0; i < list.size(); i++){ // // } } }); bubbleButton.setBounds(10, 211, 114, 23); frame.getContentPane().add(bubbleButton); JButton mergeButton = new JButton("Merge Sort"); mergeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); mergeButton.setBounds(305, 211, 114, 23); frame.getContentPane().add(mergeButton); JButton quickButton = new JButton("Quick Sort"); quickButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); quickButton.setBounds(163, 211, 114, 23); frame.getContentPane().add(quickButton); inputArea = new JTextArea(); inputArea.setBounds(10, 36, 414, 51); frame.getContentPane().add(inputArea); outputArea = new JTextField(); outputArea.setEditable(false); outputArea.setBounds(10, 98, 414, 59); frame.getContentPane().add(outputArea); outputArea.setColumns(10); JLabel label = new JLabel("Please Enter 5 Numbers"); label.setHorizontalAlignment(SwingConstants.CENTER); label.setBounds(10, 11, 414, 14); frame.getContentPane().add(label); } }

    Read the article

  • How to Object Array to List

    - by Peter Black
    (C#) I have 2 classes. 1 is called Employee. The other is my "main". I am trying to take a list and assign each value in list to an array of Employee object. //Inside "Main" class int counter = NameList.Count; Employee[] employee = new Employee[counter]; for (int i = 0; i <= counter; i++) { employee[i].Name = NameList[i]; employee[i].EmpNumber = EmpNumList[i]; employee[i].DateOfHire = DOHList[i]; employee[i].Salary = SalaryList[i]; employee[i].JobDescription = JobDescList[i]; employee[i].Department = DeptList[i]; } This returns the error: An unhandled exception of type 'System.NullReferenceException' occurred in Pgm4.exe Additional information: Object reference not set to an instance of an object. I think this means that I am not calling the list properly. Any help would be much appreciated. Thank you.

    Read the article

  • identity specification gap after several operations

    - by Babak.Abad
    I'm using identity specification for a table of sql server 2012. Let we have two Insert and then two Delete operation. After these operation primary key should start from 1, but it will start from 3. I'm worry about this problem causing no place for inserting new item after long time. Does "Sql-server 2012" fill these gaps by itself? If it is possible, please refer me a documentation ( for example from microsoft)

    Read the article

  • Binding data asp.net web forms C#

    - by user2372566
    I am developing a project in asp.net web forms. I have a little problem. Whent the page load, I load some data from the dabase and present it on the page. On the same page I have form where I can input some textobox and with the click on the button make update on the same data in the database whis is at the first time loaded on the same page? The date is update, I can see it in SQL SERVER, but on the web page not. Its still the old data presents. After I close my application and run it again, then the new data appears on the page.

    Read the article

  • How can I exclude words with apostrophes when reading into a table of strings?

    - by rearden
    ifstream fin; string temp; fin.open("engldict.txt"); if(fin.is_open()) { bool apos = false; while(!fin.eof()) { getline(fin, temp, '\n'); if(temp.length() > 2 && temp.length() < 7) { for(unsigned int i = 0; i < temp.length(); i++) { if(temp.c_str()[i] == '\'') apos = true; } if(!apos) dictionary.insert(temp); } } } This code gives me a runtime error: Unhandled exception at 0x00A50606 in Word Jumble.exe: 0xC0000005: Access violation reading location 0x00000014. and throws me a break point at: size_type size() const _NOEXCEPT { // return length of sequence return (this->_Mysize); } within the xstring header. This exception is thrown no matter what character I use, so long as it is present within the words I am reading in. I am aware that it is probably a super simple fix, but I just really need another set of eyes to see it. Thanks in advance.

    Read the article

  • C release dynamically allocated memory

    - by user1152463
    I have defined function, which returns multidimensional array. allocation for rows arr = (char **)malloc(size); allocation for columns (in loop) arr[i] = (char *)malloc(v); and returning type is char** Everything works fine, except freeing the memory. If I call free(arr[i]) and/or free(arr) on array returned by function, it crashes. Thanks for help EDIT:: allocating fuction pole = malloc(zaznamov); char ulica[52], t[52], datum[10]; float dan; int i = 0, v; *max = 0; while (!is_eof(f)) { get_record(t, ulica, &dan, datum, f); v = strlen(ulica) - 1; pole[i] = malloc(v); strcpy(pole[i], ulica); pole[i][v] = '\0'; if (v > *max) { *max = v; } i++; } return pole;` part of main where i am calling function pole = function(); releasing memory int i; for (i = 0; i < zaznamov; i++) { free(pole[i]); pole[i] = NULL; } free(pole); pole = NULL;

    Read the article

  • Perl - Compare two files and copy intire line to final.log

    - by user2977141
    I need perl script to compare line from file1 with file2 and copy to final file, something like this: File1.txt: ASPO01 ASPO02 ASPO03 File2.txt: ASPO01 2013-11-10 19hrs ASPO10 2013-11-09 24hrs ASPO02 2013-11-08 10hrs ASPO16 2013-11-05 9hrs ASPO17 2013-11-06 6hrs ASPO03 2013-11-07 15hrs ASPO18 2013-11-02 25hrs ... Search into File2 and copy to final file called final.log, like this: final.txt: ASPO01 2013-11-10 19hrs ASPO02 2013-11-08 10hrs ASPO03 2013-11-07 15hrs Thanks for all good friends can help me!!!

    Read the article

  • Get latest sql rows based on latest date and per user

    - by Umair
    I have the following table: RowId, UserId, Date 1, 1, 1/1/01 2, 1, 2/1/01 3, 2, 5/1/01 4, 1, 3/1/01 5, 2, 9/1/01 I want to get the latest records based on date and per UserId but as a part of the following query (due to a reason I cannot change this query as this is auto generated by a tool but I can write pass any thing starting with AND...): SELECT RowId, UserId, Date FROM MyTable WHERE 1 = 1 AND ( // everything which needs to be done goes here . . . ) I have tried similar query, but get an error: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

    Read the article

  • Show Div When Radio Checked

    - by maniootek
    I tried to use this code: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script> <style type="text/css"> div {display: none} </style> <script type="text/javascript"> $('.radio1').click(function () { $('.div1').show(); }); $('.radio2').click(function () { $('.div2').show(); }); </script> <label><input type="radio" name="group1" class="radio1"></label> <label><input type="radio" name="group1" class="radio2"></label> <div class="div1">Radio1 selected !</div> <div class="div2">Radio2 selected !</div> But when I check any radio then notthing happens. I tried with Fiddle: http://jsfiddle.net/Ac9c4/ and same no results Any idea?

    Read the article

  • The counter doesnt seem to increase when ever the edittext changes

    - by Mabulhuda
    Im using Edit-texts and i need when ever an edit-text is changed to increment a counter by one but the counter isnt working , I mean the app starts and everything but the counter doesnt seem to change please help here is the code public class Numersys extends Activity implements TextWatcher { EditText mark1 ,mark2, mark3,mark4,mark5,mark6 , hr1 ,hr2,hr3,hr4,hr5,hr6; EditText passed, currentavg; TextView tvnewavg ; Button calculate; double marks , curAVG , NewAVG ; String newCumAVG; int counter , hrs , curHr , NewHr; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.numersys); mark1=(EditText)findViewById(R.id.mark1n); mark2=(EditText)findViewById(R.id.mark2n); mark3=(EditText)findViewById(R.id.mark3n); mark4=(EditText)findViewById(R.id.mark4n); mark5=(EditText)findViewById(R.id.mark5n); mark6=(EditText)findViewById(R.id.mark6n); hr1=(EditText)findViewById(R.id.ethour1); hr2=(EditText)findViewById(R.id.ethour2); hr3=(EditText)findViewById(R.id.ethour3); hr4=(EditText)findViewById(R.id.ethour4); hr5=(EditText)findViewById(R.id.ethour5); hr6=(EditText)findViewById(R.id.ethour6); passed=(EditText)findViewById(R.id.etPassCn); currentavg=(EditText)findViewById(R.id.etCavgn); tvnewavg=(TextView)findViewById(R.id.tvcAVGn); mark1.addTextChangedListener(this); mark2.addTextChangedListener(this); mark3.addTextChangedListener(this); mark4.addTextChangedListener(this); mark5.addTextChangedListener(this); mark6.addTextChangedListener(this); calculate=(Button)findViewById(R.id.bAvgCalcn); @Override public void onClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()) { case 0: break; case 1: hrs=Integer.valueOf(hr1.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case 2: hrs=Integer.valueOf(hr1.getText().toString())+Integer.valueOf(hr2.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()) +Double.valueOf(mark2.getText().toString())*Integer.valueOf(hr2.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case 3: hrs=Integer.valueOf(hr1.getText().toString())+Integer.valueOf(hr2.getText().toString()) +Integer.valueOf(hr3.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()) +Double.valueOf(mark2.getText().toString())*Integer.valueOf(hr2.getText().toString()) +Double.valueOf(mark3.getText().toString())*Integer.valueOf(hr3.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case R.id.bAvgCalcn: newCumAVG=String.valueOf(NewAVG); tvnewavg.setText(newCumAVG); } } }); } @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub if(mark1.hasFocus()) { counter = counter+1; } if(mark2.hasFocus()) { counter = counter+1; } if(mark3.hasFocus()) { counter = counter+1; } if(mark4.hasFocus()) { counter = counter+1; } if(mark5.hasFocus()) { counter = counter+1; } if(mark6.hasFocus()) { counter = counter+1; } }

    Read the article

  • Script (AJAX or JS) does not work properly in IE8

    - by Uno Mein Ame
    I have a js/ajax script at http://worldcitiesdatabase.info/test1/ I just received a complaint that it does not work properly in IE8. Onchange seems to work, but then the next menu is not populated. Can you please help me figure it out? Thanks Not sure what the problematic part of the code is. Here is my guess: if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } newList=""; xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { newList = xmlhttp.responseText; m1.innerHTML=newList; m1.disabled=false; } if (menuname=="showCountry") { var c1=document.getElementById('showRegion'); if (c1.options.length==2) { if (c1.options[0].value=='NONE') { c1.remove(0); c1.value='0'; reloadmenu(c1); } } } } xmlhttp.open("GET",newFile+".php?q="+menuvalue,true); xmlhttp.send();

    Read the article

  • Store the day of the week and time

    - by bsiddiqui
    I have a two part question about storing day(s) of the week and time in a database. I'm using Rails 4.0, ruby 2.0.0, and postgres. I have certain events and those events have a schedule. For the event Skydiving for example, for example, I might have Tuesday and Wednesday and 3 pm. 1) Is there a way for me to store the the record for Tuesday and Wednesday in one row or do should I have two records? 2) What is the best way to store the day and time? Is there a way to store day of week and time (not datetime) or should these be separate columns? If they should be separate, how would you store day of week? I was thinking of storing them as integer values (0 for Sunday, 1 for Monday, etc) since that's how wday method for the Time class does it. Any suggestions would be super helpful. Thanks!

    Read the article

  • Application tried to present modally an active controller ios

    - by Matthew
    I was trying to set the ViewController with a parent view controller before it shows show that it can provide call backs, I done this using PrepareForSegue - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"newQuarter"]) { [segue.destinationViewController setParentViewController:self]; } } It crashed giving me the error message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller. So I tried using another method and set up a new view controller on the button touches up, - (IBAction) buttonClicked { NewViewController *newController = [[NewViewController alloc] init]; [newController setParentViewController:self]; [self presentViewController:newController animated:YES completion:nil]; } but with no luck it is still giving me the same error message, can anyone please advice? Thanks!

    Read the article

  • mappedBy reference an unknown target entity property - hibernate error

    - by tommy
    first, my classes: User package com.patpuc.model; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import com.patpuc.model.RolesMap; @Entity @Table(name = "users") public class User { @Id @Column(name = "USER_ID", unique = true, nullable = false) private int user_id; @Column(name = "NAME", nullable = false) private String name; @Column(name = "SURNAME", unique = true, nullable = false) private String surname; @Column(name = "USERNAME_U", unique = true, nullable = false) private String username_u; // zamiast username @Column(name = "PASSWORD", unique = true, nullable = false) private String password; @Column(name = "USER_DESCRIPTION", nullable = false) private String userDescription; @Column(name = "AUTHORITY", nullable = false) private String authority = "ROLE_USER"; @Column(name = "ENABLED", nullable = false) private int enabled; @OneToMany(mappedBy = "rUser") private List<RolesMap> rolesMap; public List<RolesMap> getRolesMap() { return rolesMap; } public void setRolesMap(List<RolesMap> rolesMap) { this.rolesMap = rolesMap; } /** * @return the user_id */ public int getUser_id() { return user_id; } /** * @param user_id * the user_id to set */ public void setUser_id(int user_id) { this.user_id = user_id; } /** * @return the name */ public String getName() { return name; } /** * @param name * the name to set */ public void setName(String name) { this.name = name; } /** * @return the surname */ public String getSurname() { return surname; } /** * @param surname * the surname to set */ public void setSurname(String surname) { this.surname = surname; } /** * @return the username_u */ public String getUsername_u() { return username_u; } /** * @param username_u * the username_u to set */ public void setUsername_u(String username_u) { this.username_u = username_u; } /** * @return the password */ public String getPassword() { return password; } /** * @param password * the password to set */ public void setPassword(String password) { this.password = password; } /** * @return the userDescription */ public String getUserDescription() { return userDescription; } /** * @param userDescription * the userDescription to set */ public void setUserDescription(String userDescription) { this.userDescription = userDescription; } /** * @return the authority */ public String getAuthority() { return authority; } /** * @param authority * the authority to set */ public void setAuthority(String authority) { this.authority = authority; } /** * @return the enabled */ public int getEnabled() { return enabled; } /** * @param enabled * the enabled to set */ public void setEnabled(int enabled) { this.enabled = enabled; } @Override public String toString() { StringBuffer strBuff = new StringBuffer(); strBuff.append("id : ").append(getUser_id()); strBuff.append(", name : ").append(getName()); strBuff.append(", surname : ").append(getSurname()); return strBuff.toString(); } } RolesMap.java package com.patpuc.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.patpuc.model.User; @Entity @Table(name = "roles_map") public class RolesMap { private int rm_id; private String username_a; private String username_l; //private String username_u; private String password; private int role_id; @ManyToOne @JoinColumn(name="username_u", nullable=false) private User rUser; public RolesMap(){ } /** * @return the user */ public User getUser() { return rUser; } /** * @param user the user to set */ public void setUser(User rUser) { this.rUser = rUser; } @Id @Column(name = "RM_ID", unique = true, nullable = false) public int getRmId() { return rm_id; } public void setRmId(int rm_id) { this.rm_id = rm_id; } @Column(name = "USERNAME_A", unique = true) public String getUsernameA() { return username_a; } public void setUsernameA(String username_a) { this.username_a = username_a; } @Column(name = "USERNAME_L", unique = true) public String getUsernameL() { return username_l; } public void setUsernameL(String username_l) { this.username_l = username_l; } @Column(name = "PASSWORD", unique = true, nullable = false) public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Column(name = "ROLE_ID", unique = true, nullable = false) public int getRoleId() { return role_id; } public void setRoleId(int role_id) { this.role_id = role_id; } } when i try run this on server i have exception like this: Error creating bean with name 'SessionFactory' defined in ServletContext resource [/WEB-INF/classes/baseBeans.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.patpuc.model.RolesMap.users in com.patpuc.model.User.rolesMap But i don't exaclu know what i'm doing wrong. Can somebody help me fix this problem?

    Read the article

  • Using Windows and MMSystem in Delphi

    - by Jose Martinez
    Hi I am making a program to open and close the cd reader in which I have thought to write data to CD, the problem is the basis of the problem, which use "uses Windows 'and' uses MMSystem" but the problem is that when I use both at the same time being "uses Windows, MMSystem" gives an error and the program does not compile, I am using Delphi 2010, the strange thing is that when I use only one either Windows or MMSystem works fine and compiles. The error when I try to compile is: 'Could not find program' The code in question is this: mciSendString ('Set cdaudio door open wait', nil, 0, handle); I have two things to ask you first is how I avoid the error when using the two (Windows and MMSystem) and the other question was if he could open the CD player without using MMSystem, bone using Windows API, but not where to start The source : program Project1; {$APPTYPE CONSOLE} uses SysUtils,Windows,MMSystem; procedure opencd; begin mciSendString('Set cdaudio door open wait', nil, 0, 0); end; begin try Writeln('test'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. Image :

    Read the article

  • Plotting andrews curves of subsets of a data frame on the same plot

    - by user2976477
    I have a data frame of 12 columns and I want to plot andrews curves in R of this data, basing the color of the curves on the 12th columns. Below are a few samples from the data (sorry the columns are not aligned with the numbers) Teacher_explaining Teacher_enthusiastic Teacher_material_interesting Material_stimulating Material_useful Clear_marking Marking_fair Feedback_prompt Feedback_clarifies Detailed_comments Notes Year 80 80 80 80 85 85 80 80 80 80 70 3 70 60 30 40 70 60 30 40 70 0 30 3 100 90 90 80 80 100 100 90 100 100 100 MSc 85 85 85 90 90 70 90 50 70 80 100 MSc 90 50 90 90 90 70 100 50 80 100 100 4 100 80 80 75 90 80 80 50 80 80 90 3 From this data I tried to plot andrews curves using the code below: install.packages("andrews") library(andrews) col <- as.numeric(factor(course[,12])) andrews(course[,1:12], clr = 12) However, the 12th column has three groups (3 types of responses) and I want to group two of them and then plot the andrews curve of the data, without editing my data frame in Excel. x <- subset(course, Year == "MSc" & "4") y <- subset(course, Year == "3") I tried the above code, but my argument for x don't work. "MSc", "3" and "4" are the groups in the 12th column, and I want to group MSc and 4 so that their Andrews curves have the same color. If you have any idea how to do this, please let me know.

    Read the article

  • Porting Perl to C++ `print "\x{2501}" x 12;`

    - by jippie
    I am porting a program from Perl to C++ as a learning objective. I arrived at a routine that draws a table with commands like the following: Perl: print "\x{2501}" x 12; And it draws 12 times a '?' ("box drawings heavy horizontal"). Now I figured out part of the problem already: Perl: \x{}, \x00 Hexadecimal escape sequence; C++: \unnnn To print a single Unicode character: C++: printf( "\u250f\n" ); But does C++ have a smart equivalent for the 'x' operator or would it come down to a for loop? UPDATE Let me include the full source code I am trying to compile with the proposed solution. The compiler does throw an errors: g++ -Wall -Werror project.cpp -o project project.cpp: In function ‘int main(int, char**)’: project.cpp:38:3: error: ‘string’ is not a member of ‘std’ project.cpp:38:15: error: expected ‘;’ before ‘s’ project.cpp:39:3: error: ‘cout’ is not a member of ‘std’ project.cpp:39:16: error: ‘s’ was not declared in this scope #include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <string.h> int main ( int argc, char *argv[] ) { if ( argc != 2 ) { fprintf( stderr , "usage: %s matrix\n", argv[0] ); exit( 2 ); } else { //std::string s(12, "\u250f" ); std::string s(12, "u" ); std::cout << s; } }

    Read the article

  • AMQP gem specifying a dead letter exchange

    - by JP.
    I've specified a queue on the RabbitMQ server called MyQueue. It is durable and has x-dead-letter-exchange set to MyQueue.DLX. (I also have an exchange called MyExchange bound to that queue, and another exchange called MyQueue.DLX, but I don't believe this is important to the question) If I use ruby's amqp gem to subscribe to those messages I would do it like this: # Doing this before and in a new thread has to do with how my code is structured # shown here in case it has a bearing on the question Thread.new do AMQP.start('amqp://guest:[email protected]:5672') end EventMachine.next_tick do channel = AMQP::Channel.new(AMQP.connection) queue = channel.queue("MyQueue", :durable => true, :'x-dead-letter-exchange' => "MyQueue.DLX") queue.subscribe(:ack => true) do |metadata, payload| p metadata p payload end end If I execute this code with the queues and exchanges already created and bound (as they need to be in my set up) then RabbitMQ throws the following error in its logs: =ERROR REPORT==== 19-Aug-2013::14:25:53 === connection <0.19654.2>, channel 2 - soft error: {amqp_error,precondition_failed, "inequivalent arg 'x-dead-letter-exchange'for queue 'MyQueue' in vhost '/': received none but current is the value 'MyQueue.DLX' of type 'longstr'", 'queue.declare'} Which seems to be saying that I haven't specified the same Dead Letter Exchange as the pre-existing queue - but I believe I have with the queue = ... line. Any ideas?

    Read the article

  • C# A simple Hangman game

    - by Radostin Angelov
    I'm trying to create a simple Hangman game and i have gotten so far, to make it read all words from a text file, but I don't know how to make the code work for every single word. I have another project, working with 3/4 words but with repeating nested if statements. I want to make it as shorter as possible. This is the code i have so far : using System; using System.Linq; class Program { static void Main() { string[] words = System.IO.File.ReadAllLines(@"C:\Users\ADMIN\Desktop\Letters\Letters.txt"); int LengthOfArray = words.Length; Random rnd = new Random(); int random = rnd.Next(1, 3); char[] letters = words[random].ToCharArray(); bool WordIsHidden = true; char hiddenChar = '_'; char GuessedLetter = hiddenChar; var retry = true; while (retry = true) { Console.WriteLine(letters); letters = GuessedLetter.ToString().ToCharArray(); for (int i = 1; i <= LengthOfArray; i++) { Console.Write("{0} ", GuessedLetter); } Console.WriteLine("Enter a letter!"); char letter = char.Parse(Console.ReadLine()); if (words[random].Contains<char>(letter)) { WordIsHidden = false; GuessedLetter = letter; Console.Write(letters); } else { if (WordIsHidden == true) { Console.Write("You guessed wrong!"); } } } } } Also I'm trying to make the game show each letter, the user has guessed on it's corresponding position, but now the letter is one line higher than the rest of the word and it's not in it's right position. Edited: Here is the result : cat ___Enter a letter! a __ aaaEnter a letter! t aa tttEnter a letter! IF anyone have a clue for where does this come from and how can I fix it, any help will be greatly appreciated.

    Read the article

  • IE textarea wrap bug?

    - by user2227033
    It seems that IE starting from IE7 to IE10 wraps text in the textarea control incorrectly when using \n (or \r\n - doesn't matter - results are the same). Is this a bug in IE or they treat the html standard differently than other browsers - who is right? I have defined: <textarea id="TextArea1" runat="server" style="width: 190px; height: 390px; white-space: normal; word-wrap: normal; overflow: scroll" ></textarea> When I try to add long string like "VeryLongStringEndingWithNewLine\n" by using JavaScript code (obj.value += text;) the text is shown in one line with scroll (this is ok) but added with an additional empty line (\r\n) - why? When I try to add short string like "Short\n" multiple times, again via JavaScript code the text is on the same line (should be on the separate lines because normal wrapping should be applied). Moreover when I do postback then all \r\n's are replaced with spaces (why?) and then text parsed correctly (assuming if I used spaces instead of crlf normal wraping with space only wraps when does not fit in the area). When using FF or Chrome same control behaves correctly - long lines are shown without an additional empty next line, short lines are on the different lines, no replacement with spaces when doing postback. I know I could probably use other options or white space characters, but I feel that above is not correct about IE. Any comments? Mindaugas

    Read the article

  • Why would you dual-run an app on Azure and AWS?

    - by Elton Stoneman
    Originally posted on: http://geekswithblogs.net/EltonStoneman/archive/2013/11/10/why-would-you-dual-run-an-app-on-azure-and-aws.aspxI had this question from a viewer of my Pluralsight course, Implementing the Reactive Manifesto with Azure and AWS, and thought I’d publish the response. So why would you dual-run your cloud app by hosting it on Azure and AWS? Sounds like a lot of extra development and management overhead. Well the most compelling reasons are reliability and portability. In 2012 I was working for a client who was making a big investment in the cloud, and at the end of the year we published their first external API for business partners. It was hosted in Azure and used some really nice features to route back into existing on-premise services. We were able to publish a clean, simple API to partners, and hide away the underlying complexity of the internal services while still leveraging them to do all the work. Two days after we went live, we were hit by the Azure SSL certificate expiry outage, and our API was unavailable for the best part of 3 days. Fortunately we had planned a gradual roll-out to partners, so the impact was minimal, but we’d been intending to ramp up quickly, and if the outage had happened a week or two later we would have been in a very bad place. Not least because our app could only run on Azure, we couldn’t package it up for another service without going back and reworking the code. More recently AWS had an issue with a networking device in one of their data centres which caused an outage that took the best part of a day to resolve. In both scenarios the SLAs are worthless, as you’ll get back a small percentage of your cloud expenditure, which is going to be negligible compared to your costs in dealing with the outage. And if your app is built specifically for AWS or Azure then if there’s an extended outage you can’t just deploy it onto a new set of kit from a different supplier. And the chances are pretty good there will be another extended outage, both for Microsoft and for Amazon. But the chances are small that it will happen to both at the same time. So my basic guidance has been: ignore the SLAs, go for better uptime by using two clouds. As soon as you need to scale beyond a single instance, start by scaling out to another cloud. Then scale out to different data centres in both clouds. Then you’ve got dual-cloud, quadruple-datacentre redundancy, so any more scaling you need can be left to the clouds to auto-scale themselves. By running in both clouds, you’ve made your app portable, so in the highly unlikely event that both AWS and Azure go down in multiple regions, you’ll have a deployment package which will let you spin up a new stack on yet another cloud, without having to rework your solution.

    Read the article

  • APress Deal of the Day 11/Nov/2013 - .Pro Visual Studio LightSwitch 2011 Development

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2013/11/10/apress-deal-of-the-day-11nov2013---.pro-visual-studio.aspx Today's $10 deal of the day from APress at http://www.apress.com/9781430240082 is Pro Visual Studio LightSwitch 2011 Development Pro Visual Studio LightSwitch 2011 Development shows users how to get the most from this innovative product by going beyond the "one-click-and-you're-done" mentality. Authors Tim Leung and Yann Duran cover this breakthrough product and discuss advanced topics for power users and developers.

    Read the article

  • innobackupex - after restoring - quit without updating PID file

    - by clarkk
    After restoring a backup the server can't start.. restoring # tar -izxf /var/www/bak/db/2013-11-10-1437_mysql.tar.gz -C /var/www/bak/db_import # innobackupex --use-memory=1G --apply-log /var/www/bak/db_import # service mysql stop # mv /var/lib/mysql /var/lib/mysql-old # mkdir /var/lib/mysql # innobackupex --copy-back /var/www/bak/db_import # chown -R mysql:mysql /var/lib/mysql # service mysql start error log 131110 21:24:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 2013-11-10 21:24:21 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2013-11-10 21:24:21 6194 [Warning] Using pre 5.5 semantics to load error messages from /opt/mysql/server-5.6/share/english/. 2013-11-10 21:24:21 6194 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters. 2013-11-10 21:24:21 6194 [Note] Plugin 'FEDERATED' is disabled. /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 2013-11-10 21:24:21 6194 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2013-11-10 21:24:21 6194 [Note] InnoDB: The InnoDB memory heap is disabled 2013-11-10 21:24:21 6194 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2013-11-10 21:24:21 6194 [Note] InnoDB: Compressed tables use zlib 1.2.3 2013-11-10 21:24:21 6194 [Note] InnoDB: Using Linux native AIO 2013-11-10 21:24:21 6194 [Note] InnoDB: Not using CPU crc32 instructions 2013-11-10 21:24:21 6194 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2013-11-10 21:24:21 6194 [Note] InnoDB: Completed initialization of buffer pool 2013-11-10 21:24:21 6194 [Note] InnoDB: Highest supported file format is Barracuda. 2013-11-10 21:24:22 6194 [Note] InnoDB: 128 rollback segment(s) are active. 2013-11-10 21:24:22 6194 [Note] InnoDB: Waiting for purge to start 2013-11-10 21:24:22 6194 [Note] InnoDB: 5.6.12 started; log sequence number 636992658 2013-11-10 21:24:22 6194 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 2013-11-10 21:24:22 6194 [Note] - '127.0.0.1' resolves to '127.0.0.1'; 2013-11-10 21:24:22 6194 [Note] Server socket created on IP: '127.0.0.1'. 2013-11-10 21:24:22 6194 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 131110 21:24:22 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended mysql_upgrade /opt/mysql/server-5.6/bin/mysql_upgrade -u root -pxxxxx -P 3308 Warning: Using a password on the command line interface can be insecure. Looking for 'mysql' as: /opt/mysql/server-5.6/bin/mysql Looking for 'mysqlcheck' as: /opt/mysql/server-5.6/bin/mysqlcheck FATAL ERROR: Upgrade failed

    Read the article

  • Attempting to set up xampp and zend server on the same machine

    - by umbregachoong
    I am attempting to set up the zend server and xampp on the same machine but I am running into problems. I came across documentation on the zend site that said you cannot do this. However the folks over at apachefriends said you can. I have since discovered that I can run some of the zendframework examples within xampp by downloading the zendframework2 library and the skeleton app from git and I am doing this right now. However, I would like to know how to set them both up without having any conflicts both for the apache2 server and phpmyadmin. (One of the frustrating things is trying to load phpmyadmin in the deployment dialog by using the zpk tool in Zend). What I did in trying to set up both servers on windows 7 is as follows: First I have tried to set up the httpd conf files separately for each server, xampp running on port 8082 , and zend running on port 8088. At the time xampp would work, but zend server would not. This is after setting up the virtual host files separately for each server. Question 1: Where are the zend server error logs? Earlier, I was able to get both of them running configuring the xampp server httpd-conf file alone, however, I experienced problems with phpmyadmin even after configuring phpmyadmin on xampp to work on a different port other than 3306. Second question here: how to set up the two mysql phpmyadmin instances so they do not conflict with each other? Here is the xampp virtual host section: ##ServerAdmin [email protected] DocumentRoot "C:/xampp/htdocs/" ServerName localhost 8082 ##ServerAlias www.dummy-host.example.com ##ErrorLog "logs/dummy-host.example.com-error.log" ##CustomLog "logs/dummy-host.example.com-access.log" common Here is the zend virtual host section: DocumentRoot "C:\Program Files (x86)\Zend\Apache2/htdocs" ServerName localhost:8088 </VirtualHost> I have looked at this httpd.apache.org/docs/2.2/vhosts/ and this http://survivethedeepend.com/zendframeworkbook/en/1.0/creating.a.local.domain.using.apache.virtual.hosts but I am obviously doing something wrong here. I also have the java sdk running on this machine with tomcat and apache and I have no conflicts- too bad this is not the case for zend server and xampp Thanks umbre gachoong

    Read the article

  • Consulting: Organizing site/environment documentation for customers?

    - by ewwhite
    Over time, I've taken on consulting and contract engineering work for various clients. More recently, customers are asking for certain types of documentation. These are small businesses and typically do not have dedicated technical staff. Within a single company, Wiki/Confluence/Sharepoint, etc. all make sense as a central repository for documentation and environment information. I struggle with finding a consistent method to deliver the following information to discrete customers. I'm shooting for a process that's more portable, secure and elegant than a simple spreadsheet or the dreaded binder full of outdated information. Important IP addresses, DHCP scope, etc. Network diagram (if needed). Administrative usernames and passwords and management URLs. Software license keys. Support contracts and warranty information. Vendor support contacts and instructions. I know there are other consultants here. Any suggestions or tips on maintaining documentation across multiple environments in a customer-friendly format? How do you do it?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15  | Next Page >