I'm trying to add users to the Door Access Control Device: "inBio 260"
I'm told I need to use the Push/Pull SDK to do that.
public bool AddUser(User u) {
return axCZKEM1.SSR_SetDeviceData(machineNumber, "user", u + "\r\n", "");
}
class User {
...
public override string ToString()
{
return
"CardNo=" + ID + "\t" +
"Pin=" + Pin + "\t" +
"Name=" + Name + "\t" +
"Password=" + Password + "\t" +
"StartTime=" + StartTime + "\t" +
"EndTime=" + EndTime;
}
}
public bool AddFingerprint(Fingerprint p)
{
return
IsPinValid(p.Pin) &&
p.Template != null &&
p.Template.Length > 100 &&
axCZKEM1.SSR_SetDeviceData(machineNumber, "templatev10", p + "\r\n", "");
}
}
class Fingerprint {
...
public override string ToString()
{
int size = Convert.FromBase64String(Template).Length;
return
"Size=" + size +
"\tPin=" + Pin +
"\tFingerID=" + FingerID +
"\tValid=1\tTemplate=" + Template +
"\tEndTag=" + EndTag;
}
}
I use "ZKAccess 3.5" to check and I find the users I added and everything seems fine.
But suddenly the machine will report 0 valid fingerprints. And the doors won't open.
Calling AddFingerprint to restore the lost fingerprint returns a false "true", i.e. nothing was added and the machine still has 0 fingerprints left.
Note: ZKAccess is limited to 2000 users, I added 2600+ users.
Update: ZKAccess has 2654 users in its database, clicking sync to device only restores the 900 users that where added using ZKAccess itself (foul play suspected).
Update: I confused push & pull sdk, they are not the same. PullSDK is free, push SDK is private to ZKTeco
ZKAccess3.5 deleted all data because the limit of the free version was exceeded.
EDIT: Just for anyone looking for an answer, Push sdk is a private sdk used only by ZKteco. Pull sdk how ever is free but has no documentation. I wrote a wrapper in C#: code
Related
I'm using this to compare the documents
if (XNode.DeepEquals(cachedDocument, document))
Let's do a little science here. I download my XML documents from an API, I'm basically checking the 2 documents to ensure the latest doesn't have any changed. Basically ensuring that its not had any changes since I last cached the API xml file.
XDocument document = null;
if (useCachedDocuments && File.Exists(postCacheDirectory + "/photos/page " + (i + 1) + ".xml"))
{
document = XDocument.Parse(postCacheDirectory + "/photos/page " + (i + 1) + ".xml");
}
else
{
document = XDocument.Load(GetApiLink(pageAddress, i * 50, true));
}
if (i == 1 && File.Exists(postCacheDirectory + "/photos/page 1.xml"))
{
var cachedDocument = XDocument.Load(postCacheDirectory + "/photos/page 1.xml");
if (XNode.DeepEquals(cachedDocument, document))
{
Logger.Warn("We can start to use cached documents now, wayyyy faster :D");
useCachedDocuments = true;
}
else
{
Logger.Warn("Sorry, no cache avalible here...");
}
}
The cached document is the exact same as I cached, I literally download it and save it. I know for certain theres been no changes yet DeepEquals fails??
It is possible to use this code from Unity samples:
//C#
Social.LoadAchievements (achievements => {
if (achievements.Length > 0) {
Debug.Log ("Got " + achievements.Length + " achievement instances");
string myAchievements = "My achievements:\n";
foreach (IAchievement achievement in achievements)
{
myAchievements += "\t" +
achievement.id + " " +
achievement.percentCompleted + " " +
achievement.completed + " " +
achievement.lastReportedDate + "\n";
}
Debug.Log (myAchievements);
}
else
Debug.Log ("No achievements returned");
});
and get Google Play achievements. Or it's works only for iOs devices and for Android I have to use some plugins?
This script as I understood works only for iOs devise not for Android.
Why don't use standard Unity Google plugin?
- Because they don't teach it to load achievements.
/// <summary>
/// Not implemented yet. Calls the callback with an empty list.
/// </summary>
public void LoadAchievements(Action<IAchievement[]> callback) {
Logger.w("PlayGamesPlatform.LoadAchievements is not implemented.");
if (callback != null) {
callback.Invoke(new IAchievement[0]);
}
}
Why not to use the official Google Play Services plugin for Unity?
Here's a Link to an official Google Developer web site, where you can find all the information you need to set it up correctly.
This plugin works on both Android and iOS Devices!
I was requested to add some searching functionality to an existing system for the collection of PDFs that we have. I know about searching PDFs and opening them with search parameters and in a test application I wrote, it works like a dream. When trying to convert it over to our existing application the PDF opens but without the search terms or the advanced find of Acrobat Reader popping up. Any help would be greatly appreciated!
Here is a snippet of the cs code :
case "PDF":
string searchTerms = SearchWordsTB.Text;
searchTerms = searchTerms.Replace(',', ' ');
launchStr = "OpenPDF('" + e.Row.Cells[9].Text.Replace("\\", "/") + "','" + HttpUtility.UrlEncode(e.Row.Cells[2].Text) + "','" + e.Row.Cells[0].Text + "','" + searchTerms + "')";
break;
We are creating the list of documents on the fly and PDF is one of the options. Assuming I am understanding this correctly, A DataGrid is created with all these clickable rows that will execute a Javascript function when clicked. The Javascript function OpenPDF is shown below:
function OpenPDF(url, filename, ID, searchTerms) {
if (searchTerms.length > 0) {
window.open('FileViewer.aspx?name=' + filename + '&ID=' + ID + '&url=' + url + '#search="' + searchTerms + '"', 'mywindow' + windowCnt, 'width=800,height=600,location=no,resizable=yes');
}
else {
window.open('FileViewer.aspx?name=' + filename + '&ID=' + ID + '&url=' + url, 'mywindow' + windowCnt, 'width=800,height=600,location=no,resizable=yes');
}
windowCnt++;
}
From following the debugging in the CS code, I know that I am properly stripping out the commas in the search terms so that shouldn't be the problem. What currently happens is the PDF file will open up just fine, but the search terms are not being used. I have tried following the debugger through the Javascript (which for me has always been spotty at best) but the breakpoint is never hit. It should also probably be noted that the Javascript function is kept in a separate Javascript File and is not inline in the aspx page. And yes, we are correctly referencing the Javascript file. I will be more than happy to update this post with any extra info that is requested. Thanks in advance for any help!
I was able to achieve the desired results by using the http encode on the launch string as shown below.
launchStr = "OpenFile('" + HttpUtility.UrlEncode(e.Row.Cells[9].Text.Replace("\\", "/") + "#search=\"" + searchTerms + "\"") + "','" + HttpUtility.UrlEncode(e.Row.Cells[2].Text) + "','" + e.Row.Cells[0].Text + "','" + e.Row.Cells[1].Text + "')";
I then used the function to just open the window with the PDF in it. The problem I had was that without the HTTP Encode, the URL was just cutting off the search parameters. I believe this is because the #search="blah" isn't normally recognized as part of a URL and was therefore truncated. If anyone has a better reason, I would love to hear it.
How can I get a list of Local Windows Users (Only the Users that appear in the windows Logon Screen)
I have tried many methods using Windows Principle library & WMI Select commands. I keep getting Administrator, Guest & some other bizarre accounts (VUSRNEIL-DELL, $HOMEGROUPUSER, ASPNET...etc.)
Neither of these 3 user accounts appear on the Logon screen. How can I Differentiate between these user types?
I am coding in C#
Just add a reference to System.Management in a Console Application and try this code:
using System;
using System.Management;
using System.Linq;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
ManagementObjectSearcher usersSearcher = new ManagementObjectSearcher(#"SELECT * FROM Win32_UserAccount");
ManagementObjectCollection users = usersSearcher.Get();
var localUsers = users.Cast<ManagementObject>().Where(
u => (bool)u["LocalAccount"] == true &&
(bool)u["Disabled"] == false &&
(bool)u["Lockout"] == false &&
int.Parse(u["SIDType"].ToString()) == 1 &&
u["Name"].ToString() != "HomeGroupUser$");
foreach (ManagementObject user in localUsers)
{
Console.WriteLine("Account Type: " + user["AccountType"].ToString());
Console.WriteLine("Caption: " + user["Caption"].ToString());
Console.WriteLine("Description: " + user["Description"].ToString());
Console.WriteLine("Disabled: " + user["Disabled"].ToString());
Console.WriteLine("Domain: " + user["Domain"].ToString());
Console.WriteLine("Full Name: " + user["FullName"].ToString());
Console.WriteLine("Local Account: " + user["LocalAccount"].ToString());
Console.WriteLine("Lockout: " + user["Lockout"].ToString());
Console.WriteLine("Name: " + user["Name"].ToString());
Console.WriteLine("Password Changeable: " + user["PasswordChangeable"].ToString());
Console.WriteLine("Password Expires: " + user["PasswordExpires"].ToString());
Console.WriteLine("Password Required: " + user["PasswordRequired"].ToString());
Console.WriteLine("SID: " + user["SID"].ToString());
Console.WriteLine("SID Type: " + user["SIDType"].ToString());
Console.WriteLine("Status: " + user["Status"].ToString());
}
Console.ReadKey();
}
}
}
If you're using WMI to query Win32_UserAccount you can display only items that meet following conditions:
Property AccountType has the UF_NORMAL_ACCOUNT flag.
Property Disabled is false.
Property Lockout is false.
Property LocalAccount is true.
Property SIDType is SidTypeUser.
If you can't use WMI (or you do not want to use it) then you have to do a little bit more work, basically you have to use NetGroupGetUsers function to enumerate all users. See this article on CodeProject for an example.
If you want to use a wrappered solution, NuGet has the "Continuous.Management" package - which is an open source project: https://github.com/jarzynam/continuous
This will give you a list of all user accounts, their domain, full name and SID.
wmic useraccount get domain,name,sid
I'm using the Facebook C# SDK. How can I get language of the user, so I can display all messages accordingly without forcing the user to choose his preferred language manually?
If you are developing a web app, then you can use Accept-Language Http header to detect the language
EDIT 1
For winforms application, you can use System.Globalization.CultureInfo.CurrentCulture.Name .
EDIT2
To get the locale using FB REST API :
dynamic fbResult = new Uri("https://graph.facebook.com/AngelaMerkel?access_token=AAABkECTD......").GetDynamicJsonObject();
Console.WriteLine(
fbResult.locale ?? "-" + " > " + //<----
fbResult.location.country + " " + //<----
fbResult.location.city + " " + //<----
fbResult.name + " " +
fbResult.gender + " " +
fbResult.link + " " +
fbResult.updated_time);
You can find info about my extension method GetDynamicJsonObject here