I am new to Java and MySQL, and I want to build my first app. So, I run into a few problems at the start. Two of them to be precise...
I want to make an app (for free), to support a local Board game club, and here is the catch.
The club wants to use Barcode scanner to read barcode in their member's membership cards. This should alter a field in their database, which is 'bit' type, corresponding to member being in the club, or not (with 1 being active, and 0 being away).
Other thing is, the member should be 'active' for the whole day, and his 'activity' should reset at the end of a day.
I was thinking of making it a session, but how do I make it expire at the exact time?
Now, I have looked for answers in other questions, but have found nothing of use...
I am here for further clarifications if needed...
Thank you in advance :)
The barcode scanner is, for the most part, just a keyboard replacement. Instead of typing the code by hand, the scanner will send the keystrokes for you. You don't really need to do anything about it.
I assume the barcode represents member ID. When your application reads a barcode, it should then do something like this: update members set active=1 where member_id = xxx, with xxx being the barcode.
At the end of the day, you want to check all members out. You'll do something like this: update members set active=0 where active=1. Depending on your situation, you can either make a button to run this action, or you can make a cron job/task schedule that will run at some fixed time.
Related
I'm making a project with java spring where i do specific searches to the content of some attributes from a user or ad group. Also i write some text input to specific attributes.
Now i want to go a little but futher ..
The idea is that i do an open search on a specific AD group of users. When in this group an attributes or something else from a user changes, then the AD must send a message to my java program or something to tell me "attention user x has changed".
If i know that, i can do a new search to look if the attributes has changed of that user.
I know that i can solve this to do every time a search on the timestamp of the users in this AD group .. But it is not the perfect solution. Because then i must do everytime searches to every timestamp. And if there are for example 5000 users in this group. And i start with user 1 and user 4000 has changed yeah .. then it wil take a minut or something until i know that user 4000 has changed.
So i want a real time search thing.
Can you help me with this ? Can you put me into a direction that i can search futher on the web to find a solution or something. Or is this just not possible ?
Thanks a lot
Active Directory does not have a push notification feature, so this is not possible to do. You will need to search periodically to find the accounts you want.
You can, however, change your criteria to only find the accounts you want. The whenChanged attributes has the date the account was last changed. You can make a query to ask for members of that group, which have recently changed.
For example:
(&(objectClass=User)(whenChanged>=20190108000000.0Z)(memberOf=CN=mygroup,OU=Groups,DC=domain,DC=com))
A description of the date format used with whenChanged is here.
The memberOf condition should match the distinguishedName of the group. If the group has other groups inside it and you want to find members of those too, then you can do a recursive search:
(&(objectClass=User)(whenChanged>=20190108000000.0Z)(memberOf:1.2.840.113556.1.4.1941:=CN=mygroup,OU=Groups,DC=domain,DC=com))
That crazy number is called LDAP_MATCHING_RULE_IN_CHAIN and described here.
Im working with nest API to build an Android app.
Im connecting multiple Thermostats to one nest account. Next, I add Thermostat listeners. I can print out everything i would like to about the thermostats (temp, label, target, etc) but i can not figure out how to dynamically respond only to a specific thermostat. Each thermostat gets an index number, but the order of index number is random. does anyone know how one would set the order of thermostats indexes?
for example, if thermostat in the living room is triggered, do something specific in the living room. but how would i know the corresponding index to each device?
Like joseph-evans mentioned the device_id is static to you as a developer and wont change unless the devices is completely deleted from the Nest account and re-paired. Other developers will see a different ID, but for your sake you can always uniquely identify the device by its device_id
I am trying to do a homework assignment where the application asks the user to input 10 strings, then displays them all, and finally ask the user to select 1 to display a second time. For extra credit, I'm using a HashMap (named shout) to store the data instead of an ArrayList.
My professor wants me to output the 10 strings using the shoutOutCannedMessage() method.
MY QUESTION: What is the shoutOutCannedMessage() method and how do I use it in this situation? Why can't I just do System.out.println(shout);, which worked completely fine when I tried it?
I cannot find anything online about this method in terms of a general description, cannot find it anywhere in our textbook, etc.
I tried shoutOutCannedMessage(shout); to no avail. I get the error message:
cannot find symbol
symbol: method shoutOutCannedMessage(HashMap<Integer,String>)
location: class ShoutBox
This is for an online class so we don't have lectures and it'd take 48 hours to get a response via email from the professor. I've been trying to watch thenewboston's video tutorials to guide me through this class and haven't found anything relevant to this assignment.
SECOND QUESTION: How do I then proceed to have a user select just one key from the HashMap to be displayed, using the shoutOutCannedMessage() method?
Thank you very much to anybody who offers assistance!
EXACT ASSIGNMENT INSTRUCTIONS:
You will create the ShoutBox class for your Virtual World. Your ShoutBox class will have a shoutOutCannedMessage() method that returns a String type. The shoutOutCannedMessage will use an Array or an ArrayList to store 10 messages of type String. For those of you that are more advanced with your Java skills, you could use a HashMap for the data structure. You can load this data structure with 10 messages of your choosing. For example, one message could be “I need Java!” You can initialize your Array or ArrayList with the messages or have the user enter the messages. The choice is yours. The shoutOutCannedMessage() will loop through the data structure to first display all canned messages and allow the user to select one. The shoutOutCannedMessage() will return the selected message String.
I think you are missing a key concept in this lesson. The instructor wants YOU to implement the shoutOutCannedMessage() method. Of course you can't find it anywhere online, etc. because your professor made up the name for this method. It is your homework to implement it and code the method. It should be easy enough as you are using the HashMap so each time the user enters in a string it'll be put into the Hash. Then just ask the user which one they want to repeat, by entering in an integer, and if you've coded things properly it will then output their selection.
I'm writing a terminal version of my Java application, and this is the first time I do this. I tried Scanner and Console, but as far as I investigated, these classes only allow me to receive user input after he/she finish inputting (no manipulating/filtering).
For example, I want the user inputs his age, but if he inputs a meaningless string, all I can do is validating the string and requesting him to input again. What I really want is only allow him to input integer, i.e when he press any key which is not a number, the character will not be displayed on console. Using Swing and JTextField I can do this easily with DocumentFilter, but with console only, I still haven't found a way.
Any help is appreciated. Thanks all.
Java has something called robot API which u can use to control keyboard mouse etc...
Not the recommended way :)
Since the console is not Java program (its a c program) you have limited way to interface with it, perhaps you can write native API to get more control over it. I have not tried it but if needed use this option.
I've been trying to figure out the answer to what I believe is a very simple question but have had no luck thus far. Unfortunately I'm not very well versed in html or java as of yet.
At my employment my team is faced with manually typing out a series of sentences that are always the same each time with the exception of one variable. These are required documentations and become rather monotonous and time consuming when manually entered each time. In addition to this- the computers are ancient and memory intensive scripts would be more bothersome than beneficial- even if it means more code I'm looking for the quickest, least intensive solution, that I can present to the whole team at once.
My objective is to create a series of forms and then have the variables inserted into pre-constructed sentences and copied as a whole to the clipboard all at once.
I can only create the forms successfully and have had no luck with either; A) posting the sentences with the variables into a text area so that it can be manually copied or B) the more preferred result of clicking a submit button to have it generate the pre-contructed sentences in the background unseen while including the variables and copying it all to the clipboard.
Essentially... I want something like this-
Name -----
Age-----
Gender-----
Job-----
SUBMIT
Upon clicking submit it would copy all the text below to the clipboard without displaying it-
Person of interest, $name, was recently added.
The person of interest works as a $job and has not recently undergone surgery.
$name is $gender and is currently $age.
I know this is possible although I have no idea how to actually achieve it. I thought at first I could just create the form data, attach it to a variable in php, echo the variable in sentences in a display:none environment then have it all copied with... no idea, maybe I was going to assign all of the echo'd sentences to yet another variable and then have the submit button copy the variable to the clipboard. Even just saying that is painfully inefficient. I need serious help on this guys =(
I guess you can use $_SESSION variable with random string placeholders for variables.
$_SESSION['message']="Person of interest, <<name>>, was recently added.\n...."
When the form is submitted, just replace the placeholders with actual values into it, like:
$_SESSION['message']=str_replace('<<name>>',$_POST['name'],$_SESSION['message']);
Then, whenever you have to use the statement, you can use it as,
<textarea id='message'><?php echo $_SESSION['message'] ?></textarea>