This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun remove_duplicates (xs) = | |
case xs of | |
[]=>[] | |
| x::xs' => if List.exists (fn y=> x=y) xs' | |
then remove_duplicates (xs') | |
else x::remove_duplicates (xs') | |
val test_remove_duplicates = remove_duplicates ([3,3,3,3,5,5,5,5,6,6,6,6,7]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun max_case (xs) = | |
case xs of | |
[] => NONE | |
| x::xs' => let fun non_empty_max (ys) = | |
case ys of | |
[] => x | |
| y::ys' => let val tl_ans = non_empty_max (ys') | |
in | |
if y > tl_ans | |
then y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import com.electrotank.electroserver5.api.ConnectionResponse; | |
import com.electrotank.electroserver5.api.EsObject; | |
import com.electrotank.electroserver5.api.LoginRequest; | |
import com.electrotank.electroserver5.api.LoginResponse; | |
import com.electrotank.electroserver5.api.MessageType; | |
import com.electrotank.electroserver5.api.PluginMessageEvent; | |
import com.electrotank.electroserver5.api.PluginRequest; | |
import com.electrotank.electroserver5.connection.AvailableConnection; | |
import com.electrotank.electroserver5.connection.TransportType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Extension> | |
<Name>FunES</Name> | |
<EventHandlers> | |
<LoginHandlers> | |
<LoginHandler> | |
<Handle>Login</Handle> | |
<Type>Java</Type> | |
<Path>com.cgon.loginmodule.Login</Path> | |
</LoginHandler> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cgon.loginmodule; | |
import com.electrotank.electroserver5.extensions.BaseLoginEventHandler; | |
import com.electrotank.electroserver5.extensions.ChainAction; | |
import com.electrotank.electroserver5.extensions.LoginContext; | |
import com.electrotank.electroserver5.extensions.api.UserServerVariableResponse; | |
import com.electrotank.electroserver5.extensions.api.value.EsObject; | |
import com.electrotank.electroserver5.extensions.api.value.EsObjectRO; | |
public class Login extends BaseLoginEventHandler{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cgon.loginmodule; | |
import com.cgon.hqls.SelectHQLS; | |
import com.electrotank.electroserver5.extensions.BasePlugin; | |
import com.electrotank.electroserver5.extensions.api.value.EsObject; | |
import com.electrotank.electroserver5.extensions.api.value.EsObjectRO; | |
import game_db.entity.Userlogin; | |
import game_db.util.HibernateUtil; | |
import java.util.concurrent.Executor; | |
import org.hibernate.Session; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cgon.hqls; | |
import game_db.entity.Userlogin; | |
import java.util.List; | |
import org.hibernate.Query; | |
import org.hibernate.Session; | |
public class SelectHQLS { | |
public static Userlogin getUserByUname(String userName,Session session){ | |
Query q = session.createQuery("from Userlogin where email=:uEmail"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Extension> | |
<Name>FunES</Name> | |
<EventHandlers> | |
<LoginHandlers> | |
<LoginHandler> | |
<Handle>Login</Handle> | |
<Type>Java</Type> | |
<Path>com.cgon.loginmodule.Login</Path> | |
</LoginHandler> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cgon.executer; | |
import com.electrotank.electroserver5.extensions.BaseManagedObjectFactory; | |
import com.electrotank.electroserver5.extensions.api.value.EsObjectRO; | |
import java.util.concurrent.*; | |
import java.util.concurrent.atomic.AtomicInteger; | |
public class ExecutorServiceManagedObjectFactory extends BaseManagedObjectFactory { | |
private ExecutorService executor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> | |
<hibernate-configuration> | |
<session-factory> | |
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> | |
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> | |
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/game_db</property> | |
<property name="hibernate.connection.username">root</property> | |
<property name="hibernate.connection.password">!.Wlu9RrCA</property> | |
<!-- Use the C3P0 connection pool provider --> |