Jump to content

Beesman

Member
  • Posts

    8
  • Joined

  • Last visited

Awards

This user doesn't have any awards

Profile Information

  • Gender
    Male
  • Location
    Czech Republic
  • Occupation
    Programmer / Consultant

System

  • CPU
    Intel Core i7 7700K
  • Motherboard
    Gigabyte Z270M-D3H
  • RAM
    Kingston 32GB DDR4 2666MHz
  • GPU
    GeForce GTX 1080
  • Case
    NZXT H440
  • Storage
    Samsung SSD 850 EVO 500GB + WD Blue 1TB
  • PSU
    Fractal Design Edison M 650W
  • Display(s)
    28" Samsung U28E590
  • Cooling
    Cooler Master Hyper 412S
  • Operating System
    Debian Jessie / Win10 Pro

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. make a sudoku solver improving the time it takes to solve them you will come out strong
  2. For java try looking into POI-HSSF(/+XSSF) i suspect that's the Apache API you are talking about anyways. Here is a quick guide with pretty much everything you would need for this: http://poi.apache.org/spreadsheet/quick-guide.html they also have some easy to understand examples in this svn: https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ Here is some more direct help so i am not the "here are links and learn" guy - it's a simple iteration and it's assuming things like you have your data in 1st sheet and you have your names in 1st two columns etc. but it should get you started. Don't forget to import what you need - if you use eclipse or net beans or some other thing cool cats use these days instead of vi it should tell you what is missing if anything: import javax.swing.table.*; import java.io.FileOutputStream; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; //the JTable part - create it with DefaultTableModel: DefaultTableModel nameTableModel = new DefaultTableModel(); model.addColumn("FirstName"); model.addColumn("LastName"); JTable table = new JTable(nameTableModel); //the Excel part InputStream inStr = new FileInputStream("C:/path_to_the_file/foo.xls"); Workbook wBook = WorkbookFactory.create(inStr); Sheet sheet = wBook.getSheetAt(0); //Get's the first sheet - you can also find it via the sheet name but this should be enough for that //and the iteration part filling the JTable with the excel table for (int i = 0; i <= sheet.getLastRowNum(); i++)//iterate all rows from the first one to the last - make i 1 if you have headers or w/e { Row row = sheet.getRow(i); Cell cell_firstName = row.getCell(0);//the first column cell in the row Cell cell_lastName = row.getCell(1);//the second column cell in the row string firstName = cell_firstName.getStringCellValue(); string secondName = cell_firstName.getStringCellValue(); //And here you just add them to your table or w/e DefaultTableModel nameTableModel = (DefaultTableModel) table.getModel(); nameTableModel.addRow(new Object[]{firstName, secondName}); } Good luck!
  3. There is no max rule actually - it's just badly worded 4th example. You should delete the: if(count>=2) break; I also didn't notice you checking if the moose already ate a snake. It's stated that moose can eat only one snake. Here is example of your code with the check in place and the class is Main. import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner ob=new Scanner(System.in); int t=ob.nextInt(); for (int i = 0; i <= t; i++) { String arr=new String(); arr=ob.next(); char char_arr[]=arr.toCharArray(); int count=0,count_s=0,count_m=0; for (int j = 1; j < char_arr.length; j++) { if(char_arr[j-1]=='s'&&char_arr[j]=='m') { char_arr[j-1]='*'; char_arr[j]='M'; count++; j++; } else if(char_arr[j-1]=='m'&&char_arr[j]=='s') { char_arr[j]='*'; char_arr[j-1]='M'; count++; } } for(int z=0;z<char_arr.length;z++) { if(char_arr[z]=='s') count_s++; else if(char_arr[z]=='m'||char_arr[z]=='M') count_m++; } if(count_m>count_s) System.out.println("mongooses"); else if(count_m<count_s) System.out.println("snakes"); else System.out.println("tie"); } } }
  4. I agree with the online/cloud approach. When handling the "server" part (even if you went with a Pi) is avoidable. You can make this with free hosting if you want to avoid any cost other than your dev time. To the notification part - there are free hosting sites with SMTP servers as well. To the app part - you could look into progressive web apps rather then creating apps (probably for iOS and Android) from scratch. The google intro to this is pretty nice: https://codelabs.developers.google.com/codelabs/your-first-pwapp/#0 It also handles mentioned push notifications if the faculty is willing to use it for this side as well.. The annoying part will be authentication - if your school would support you in this project, try to ask if they use AD or other LDAP authentication for their systems (if students log into anything they probably do) you could manage it via that to not hassle with registrations etc. - in that case your app could run itself basically without any regular maintenance but unexpected events.
  5. I hope i understood you correctly that want to play a sound once the character enters an area but only when he enters and your problem is it starts playing each frame he is in there. Well you can check if he is beyond the position each time but only set some play sound bool when the crossing happens. If you want to play the sound only if he just crossed and is in the area, there are many ways to do that. Simple example that crossed my mind is to control his being in the area for the last frame and the current one. fe. pseudo code example: bool isInArea51(Player player){...} //...function that returns if he is in - if it's just some x boundry probably just x => ??.. void playArea51ThemeSong(){...} //...function that plays the sound (probably in another threat bool wasInArea51 = false; //... //... //The block where your stuff you do each frame happens or the tick of the pawn or w/e { //... If( isInArea51(player) && !wasInArea51)//he is in but wasn't here last frame { playArea51ThemeSong();//probably in another threat dunno if unreals sound playing stuff handles this for you } //... wasInArea51 = isInArea51(player); } This will work for re-entering the area and will not loop if you stand directly on the threshold.
  6. I tried to get into it. When you need to be "mathy" it seems like such a good choise, I also avoid OOP when possible (When i see program with 30 classes and all of them are used once by creating one instance i puke inside) so the fact it's functional got me interested even more. Never needed to use it (never did anything when i felt that it would be faster in haskell instead of c++ for me) so i never got good at coding in Haskell but i love the idea and it's elegance in some codegolfing etc.
  7. First of all - I agree with what ZaTrox said - you will get 100 answers from 100 people so take mine with heap of salt (don't forget to delete the sand if you go for c++). To the answer: depends what you expect from your learning. If you need to just be able to code some little tools to help you sometimes go for Python - and I don't mean it in a way that Python is not powerful, ofc. you can do everything with it. It's for sure one of the easiest "get-into coding language". If you want to learn more languages in the future C++ will push you to learn a lot outside the scope other languages will require from you so you will understand many useful things just cause you will have to. And coming from C++ to some "modern" language is easier and you will get both perspectives. Coming from "modern" language to C++ can result in not understanding why you should do so many things to do what those languages provided you by default and often people will resent C++ without giving it a go or hate it if they are forced by work/school to code in it. If you will not stop with C++ it's best because you will be prepared to most things language can throw at you. As a side note - I would advice to be careful believing "C++ is widely used". It isn't - not in the sense you will get a job writing C++ - not unless you will go full programmer and get job in a firm that is making their own solutions and not writing on top of something and they are looking for backend programmer and they don't mind someone without 10+ years experience. The joke in the business always was that junior C++ position pays double the CEO but even tho it's junior position the prereq. is to work with 15 other languages for 20 years before applying. And it holds true still. If you are determined go for it, you will memleak, you will segfault, you will wonder why 1/5 != 1/5, you will hate * and & symbols for a while but you will come out strong.
×