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
| <requestHandler name="/broadQuery" class="solr.SearchHandler"> | |
| <lst name="defaults"> | |
| <str name="defType">edismax</str> <!-- The search parser to use. --> | |
| <str name="wt">xml</str> <!-- Output type. --> | |
| <str name="fl">auction_id title</str> <!-- The fields to list in the search response --> | |
| <str name="qf">Title^2 Feature</str> <!-- The fields (and their weightings) to search in.--> | |
| <str name="rows">100</str> <!-- The number of results to return. --> | |
| <str name="pf">Title^4 Feature^2</str> <!-- Phrase field (and their weightings). Fields to search for closely located matches. --> | |
| <str name="ps">0</str> <!-- Phrase slop. How many tokens apart must words be to be able to qualify as a phrase--> | |
| <str name="echoParams">all</str> <!-- Print the search settings in the search results. Just a handy feature --> |
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
| public class SimpleSolrSearch { | |
| private String solrUrl = "http://192.168.1.103:8983/solr/auctions"; | |
| private SolrServer server; | |
| public SimpleSolrSearch() { | |
| server = new HttpSolrServer(solrUrl); | |
| } | |
| public Collection<Integer> search(String searchTerms, String category, BigDecimal maxBidAmount) throws SolrServerException { | |
| SolrQuery query = new SolrQuery(); |
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
| """ | |
| A simple Python script to send messages to a sever over Bluetooth using | |
| Python sockets (with Python 3.3 or above). | |
| """ | |
| import socket | |
| serverMACAddress = '00:1f:e1:dd:08:3d' | |
| port = 3 | |
| s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) |
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
| """ | |
| A simple Python script to receive messages from a client over | |
| Bluetooth using Python sockets (with Python 3.3 or above). | |
| """ | |
| import socket | |
| hostMACAddress = '00:1f:e1:dd:08:3d' # The MAC address of a Bluetooth adapter on the server. The server might have multiple Bluetooth adapters. | |
| port = 3 # 3 is an arbitrary choice. However, it must match the port used by the client. | |
| backlog = 1 |
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
| # For the Server | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| s.bind(("192.168.1.17",50001)) # The Bluetooth MAC Address and RFCOMM port is replaced with an IP Address and a TCP port. | |
| # For the Client | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| s.connect(("192.168.1.17",50001)) |
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
| """ | |
| A simple Python script to receive messages from a client over | |
| Bluetooth using PyBluez (with Python 2). | |
| """ | |
| import bluetooth | |
| hostMACAddress = '00:1f:e1:dd:08:3d' # The MAC address of a Bluetooth adapter on the server. The server might have multiple Bluetooth adapters. | |
| port = 3 | |
| backlog = 1 |
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
| """ | |
| A simple Python script to send messages to a sever over Bluetooth | |
| using PyBluez (with Python 2). | |
| """ | |
| import bluetooth | |
| serverMACAddress = '00:1f:e1:dd:08:3d' | |
| port = 3 | |
| s = bluetooth.BluetoothSocket(bluetooth.RFCOMM) |
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
| public class Dragon implements Serializable { | |
| private static final long serialVersionUID = 1L; | |
| private double wingSpan; | |
| private String name; | |
| private SpeedCalculator speedCalculator = new SpeedCalculator(); | |
| public Dragon(double wingSpan, String name) { | |
| // Input checks. For example, insuring wing size is greater than zero. | |
| this.wingSpan = wingSpan; |
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
| public class Dragon implements Serializable { | |
| private static final long serialVersionUID = 1L; | |
| private double wingSpan; | |
| private String name; | |
| public Dragon(double wingSpan, String name) { | |
| // Input checks. For example, insuring wing size is greater than zero. | |
| this.wingSpan = wingSpan; | |
| this.name = name; |
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
| public Dragon(double wingSpan, double name, SpeedCalculator speedCalculator) { | |
| // There are no input checks this time! | |
| this.wingSpan = wingSpan; | |
| this.name = name; | |
| this.speedCalculator = speedCalculator; // This is new! | |
| } |