Jump to content

Faab234

Coordinator
  • Content count

    4,350
  • Joined

  • Last visited

1 Follower

About Faab234

  • Rank
    Coordinator
  • Birthday January 28

Profile Information

  • Gender
    Male

Recent Profile Visitors

13,266 profile views
  1. I found it a pretty easy and powerful language, much much better than the Objective-C you had before. Proper static typing and lambdas are awesome! One thing that kinda irked me was that the language was constantly evolving, introducing breaking language changes. So you had to update your code to be compatible with the new version (although Xcode did most of the work) every few months, but this is becoming less of a problem as the language is getting more mature with Swift 3. One other thing that really frustrated me was that, while you can develop your whole application in Swift, you could not leverage most of Swift's new features (like generics) since UIKit and the Interface Builder in Xcode are still written in Objective-C. Trying to create a generic user interface component (read generic class) in Swift and using this component in the Interface Builder resulted in the compiler silently failing. Also, when creating complex expressions in Swift, due to the way typing works in Swift, the application would compile very slowly (with the compiler sometimes even failing). To solve this, you had to break this expression up into multiple ones. Although it is possible to run Swift on Android, there is currently no bridge to Java, so developing applications apart from maybe a simple hello world app, is not possible yet.
  2. Yes, I understand that and I won't punish you for that, but these posts will be removed if they do not comply with the sectional rules.
  3. This is the last time I am going to warn you. Please follow the sectional rules or your thread will be locked.
  4. I wouldn't really call Groovy and Kotlin functional programming languages. They allow for some functional programming (with its first-class functions), but so does JavaScript (which is not considered a functional programming language).
  5. Cool project! I see you are using Hibernate for persistence. Is there any reason why you don't let Hibernate create the schema directly on the database on runtime? This saves the user from having to fiddle with SQL (schemas). By the way, if you are interested in trying out PostgreSQL. It is a matter of changing the dialect and driver in your persistence settings and installing the PostgreSQL driver. I don't think he is denying that server-side rendering is not fast or efficient. Also, I recently saw a project that utilised server-side rendering using Sprint Boot and React. I am not sure if it is already possible for Angular 2 though.
  6. Please consider rule 4 of the sectional rules: Mentioning update your posts is not enough to make your posts acceptable. Please tell us what has changed and maybe why.
  7. Please consider rule 4 of the sectional rules: Mentioning update your posts is not enough to make your posts acceptable. Please tell us what has changed and maybe why.
  8. You should check if case 83093 gets reached when clicking the equipment tab. For example, add a debug statement and check whether it gets printed to the console: case 83093: System.out.println("FirstClickButton, ID: 83093"); c.getPA().showInterface(15106); //c.getEquipment().writeBonus(); break;
  9. In bash, the semicolon (";") character separates multiple commands, so what you are actually executing is "java -cp" and "./lib/*.jar org.perception.Server". The line will thus execute Java and the first jar file in the library directory, which isn't allowed and isn't what you want (the execution bit is probably not set). Instead, you probably want to execute Java with a classpath of "bin;./lib/*.jar". To do this, you have to put your classpath between quotes when passing it to the java executable, like this: java -cp "bin;./lib/*.jar" org.perception.ServerDoes that work?
  10. If I understand correctly, you don't understand why it stops counting. The while loop in your code will repeat until lastIndex equals -1, which is when there are no occurrences of the needle in the haystack anymore. Your for-loop doesn't work because it increases the count before searching for an occurrence in the haystack: [code] for (lastIndex = 0; lastIndex > -1; count++) { // increase amount of occurrences by doing count++ before finding one. lastIndex = haystack.indexOf(haystack, lastIndex); // try to find the needle, but it returns -1, which means no occurrences. if( lastIndex != -1) { lastIndex+=needle.length(); } } [/code] You could alternatively do something like this: [code] int index = 0; int count = 0; while ((index = haystack.indexOf(needle, index)) != -1) { count++; index += needle.length(); } [/code]
  11. What game are we exactly talking about? RuneScape?
  12. Requesting staff positions is disallowed in this board. [URL="http://www.runelocus.com/forums/showthread.php?57-RSPS-General-Discussion-Sectional-Rules"]Sectional Rules[/URL]
  13. [quote name='Dreadfear']How efficient would it be if i just used opcodes above 128 and in my decoder i had an if statement which checks if first opcode is bigger than 128? If first opcode is bigger then accept the buffer and make packet out of it. I tried the decoder code you gave me, it returns only opcode and empty payload. Can you please suggest me an rsps source which contains a proper way to do this?[/QUOTE] The pseudo-code I gave you wasn't supposed to be working as it assumes the client sends the length of the payload. I've updated the code of your client's encoder, so I expect it to be working now. [code] [MENTION=15855]Over[/MENTION]ride protected Object encode(ChannelHandlerContext channelHandlerContext, Channel channel, Object message) throws Exception { Packet p = (Packet) message; if (!p.isRaw()) { int pLength = p.getPayload().readableBytes() + 3;// +3 for opcode ChannelBuffer resp = ChannelBuffers.buffer(pLength); resp.writeByte(p.getOpcode()); resp.writeInt(p.getPayload().readableBytes()); resp.writeBytes(p.getPayload()); return resp; } return p.getPayload(); } [/code] As for the source, you can look at the network specifics of any source and see how packets are handled there.
  14. [quote name='Dreadfear']So i should map my opcodes to a specific sizes in server? And once i receive a packet, i read opcode and get specific size? I think this is how most people do here. Atleast thats what i got prom their sources. Super weird so i dont quite get it. Currently the decoder you gave me, does not return anything ( no sysouts ) Decoder: [code] [MENTION=15855]Over[/MENTION]ride protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { if (buffer.readableBytes() < 5) { return null; } buffer.markReaderIndex(); int opcode = buffer.readByte() & 0xFF; int length = buffer.readInt(); if (buffer.readableBytes() < length) { buffer.resetReaderIndex(); return null; } return new Packet(opcode, ChannelBuffers.wrappedBuffer(buffer)); } [/code] MessageReceived: [code] [MENTION=15855]Over[/MENTION]ride public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { if (e.getMessage() instanceof Packet) { Packet packet = (Packet) e.getMessage(); int length = packet.getPayload().readableBytes(); System.out.println("Opcode:"+ packet.getOpcode() + "Length:"+length + " Payload:"+ Arrays.toString(packet.getPayload().array())); engine.pushTask(new NewPacketTask(ctx, packet)); } } [/code] Client encoder: [code] [MENTION=15855]Over[/MENTION]ride protected Object encode(ChannelHandlerContext channelHandlerContext, Channel channel, Object message) throws Exception { Packet p = (Packet) message; if (!p.isRaw()) { int pLength = p.getPayload().readableBytes() + 3;// +3 for opcode ChannelBuffer resp = ChannelBuffers.buffer(pLength); resp.writeByte(p.getOpcode()); resp.writeBytes(p.getPayload()); return resp; } return p.getPayload(); } [/code] What i am trying to send: [code] write(111,"aa") [/code][/QUOTE] If you are creating your own protocol, you could say: [I]If I receive a packet with opcode 111, the size of the payload will be 200 bytes [/I]or [I]If I receive a packet with opcode 111, the next 4 bytes (int) will specify the length of the payload.[/I] You could also read until a special byte occurs (for example: a null character). It is up to you to define a protocol.
×