w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Removing the logged in user's name from the list of users in django
Can you try something like that ? {% for likes in forum.likes.all %} {% if user != likes.user %} <li><a href="/get/{{likes.user}}">{{likes.get_full_name}}</a></li> {% endif %} {% endfor %}

Categories : Django

New to C#. How to use google-admin-sdk (add users, add user to group a.s.o.)?
This is fixed now! split the list().Execute() like this! Got help from @peleyal var listReq = service.Users.List(); listReq.Domain = domain; Users results = listReq.Execute();

Categories : C#

Create new users with the same group(s) as the user logged in
there are several way you could do this... I'd recommend adding the groups once validation for the other fields has taken place, and the user object has been saved; so you can override the save() function of the form and add them there: <?php class YourUserForm extends PluginsfGuardUserForm { /** * A class variable to store the current user * @var sfGuardUser */ protected $current_user; public function configure() { // Remove all widgets we don't want to show unset( $this['is_super_admin'], $this['updated_at'], $this['groups_list'], $this['permissions_list'], $this['last_login'], $this['created_at'], $this['salt'], $this['algorithm'] ); // save the currrent user for use later in the save function $t

Categories : Symfony2

Allow users to select user group from custom Joomla login form
The best solution for adding a custom field during the user registration process is probably using a plugin. You can use a commercial plugin that is available called Multi-Profiles Registration (demo here), that appears to be doing exactly what you want (I have never tested it). This will cost you some money and save you some time, but I will layout the alternative way, which is developing your own plugin. Lucky for you, there is an excellent tutorial here, which is actually a chapter form a book called Joomla! Programming (especially page 5 of the tutorial). Writing a plugin takes time and I will not go over all of the details. The main steps include: Create a plugin configuration file, that will include a list of groups to select from (form element). This is where you (or anyone us

Categories : PHP

Authenticate user from Perl against Windows local users
Ok, so I found a way to accomplish this. I'd still like to hear from you guys to see if there's a better method. Active State Perl includes a module called Win32::UserAuthentication, which is not documented (and is not on CPAN) and contains a warning about it not being maintained. However, it works over XS and returns a boolean when authenticating a local user. So far it works pretty well and fast for that part. For the checking of groups the user belongs to, I'm using this system command: net user $user | grep Administrators Which works pretty fast too and so far works for this purpose. NOTE: For anyone trying the command above, I only have grep because it's on my system path thanks to having Cygwin installed. If a better solution if proposed, I'll select it as best answer. Thank

Categories : Windows

Copy to clipboard through builtin windows function, not sefmade subroutine
For windows forms, you can use the clipboard class System.Windows.Forms.Clipboard Clipboard.SetText(YourText) More information: http://msdn.microsoft.com/en-us/library/637ys738.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

Categories : Vb.Net

Can I create a user in AWS IAM that only has rights to create users and place them in a specific Group?
Yes, you need to create an IAM user and then give it this iam policy. { "Statement": [ { "Sid": "Stmt1375475989975", "Action": [ "iam:AddUserToGroup", "iam:CreateUser" ], "Effect": "Allow", "Resource": "arn:aws:iam::152997954706:user/AMISTACK-02-WEB-User-WYEMFOJZ4BDP" } ] } arn:aws:iam::152997954706:user/AMISTACK-02-WEB-User-WYEMFOJZ4BDP is an example user ARN. You'll need to add in yours specific user's arn. An easy way to create policy files is to use: http://awspolicygen.s3.amazonaws.com/policygen.html

Categories : Amazon

How to model user/group membership with constraint of user and group must be same organization?
If you don't want to enforce this rule with procedural logic, then you can add organization to the primary key of Group and User. This would propagate Organization down to your membership intersection table. This allows you to use declarative referential integrity to impose this restriction. Personally, I would think twice about using DRI for this particular rule. It can be done, but the side-effects of the solution might be worse than the original problem.

Categories : SQL

How to add additional field to drupal organic group 'User and Group' relation?
I will probably deal with the same problem soon. I think a possible workaround is to use the relation module and the rules module. You could set up a rule to create a relation each time a user is assigned to a group, or something like that. Relations made by the relation module are fieldable. But it would be maybe better to add a field to the og user-group relation directly. Update: now that I tackled the issue, I have a different solution. We don't need to add new relations, the og_membership shipped standard with og is all that we need. This is how I did it. I created a new membership type from admin/config/group/group-membership. It's a fildable entity so I added the required fields: in your case it will be "description". Then I changed the used membership type per u

Categories : Drupal

Create a loop to generate a new "user" with own variable names if user makes number of users = 2, or 3, etc
instead of saying if == 1, do for (int i = 0; i < aStudentNumber; i++) { String aStudentName = getInput2(); String aStudentAnswer = getInput3(); int aScore = CalcScore(aStudentAnswer, aMemo); StudentInfo(aStudentName, aScore); } Now, if you want to store that data programmatically so you can access it later on, change your StudentInfo method to something like public static StudentInfo createStudentInfo(String bStudentName, int bScore){ ... return someObj; } where someObj is a an instance of a StudentInfo class (that you have to create) that actually holds all of the data you want to keep track of. Then, simply add that class to a list (inside your loop): ArrayList<StudentInfo> siList = new ArrayList<StudentInfo>(); for (int i = 0; i < aStudentNumbe

Categories : Java

Per group, find first N users with SUM(x) >= N
In order to find the users that meet your needs, you need the cumulative sum of the counts. The following query finds the occasions when a user first reaches 10 units. If the counts are never negative, then there is only one: select i.* from (select i.*, (select sum(items_count) from items i2 where i2.user = i.user and i2.category = i.category and i2.datetime <= i.datetime ) as cumsum from items i ) i where cumsum - items_count < 10 and cumsum >= 10 order by datetime; To get the first two, you need to use MySQL tricks for counting within a group. Here is an example that generally works: select i.* from (select i.*, if(@prevc = category, @rn := @rn + 1, @rn := 1) as rn, @

Categories : Mysql

Rails: Ignore specific gem on windows environment or create a :windows group
This can be done by specifying the platforms. Gems to be installed in Linux/Mac: platforms :ruby do gem 'railroady' end Gems to be installed in Windows: platforms :mingw do gem 'win32console' end To be sure about your Ruby installation in Windows, you can check out the RUBY_PLATFORM constant: ruby -e 'p RUBY_PLATFORM' Which in my case is "i386-mingw32".

Categories : Ruby On Rails

SQL Group By Number Of Users Within Range
You can use a CASE expression inside of your aggregate function which will get the result in columns: SELECT COUNT(case when amount >= 0 and amount <= 100 then users.id end) Amt0_100, COUNT(case when amount >= 101 and amount <= 200 then users.id end) Amt101_200, COUNT(case when amount >= 201 and amount <= 300 then users.id end) Amt201_300 FROM transactions LEFT JOIN users ON users.id = transactions.user_id; See SQL Fiddle with Demo You will notice that I altered the ranges from 0-100, 101-200, 201-300 otherwise you will have user ids being counted twice on the 100, 200 values. If you want the values in rows, then you can use: select count(u.id), CASE WHEN amount >=0 and amount <=100 THEN '0-100' WHEN amount >=101 and amount <=200

Categories : Mysql

How can I select the users which are belonging to group A?
I think you can use a INNER JOIN query SELECT p.name,p.sex FROM User p INNER JOIN fos_user_user_group b ON a.ID = b.user_id INNER JOIN fos_group c ON b.group_id = c.ID WHERE c.group_id = '1'

Categories : Mysql

Ion auth only show users in certain group
At first get groups logged user. $user_in_group = $this->ion_auth->get_users_groups(); // Return array groups And get user list that have same group with logged user $this->data['users'] = $this->ion_auth->users($user_in_group)->result(); // Pass groups array as params And users listed only have logged user group.

Categories : PHP

Add users to interest group via MailChimp API v2.0
Well, I figured it out. Although I could have sworn I'd already tried it this way... the groups have to be an array, even for a single group. My code now: $merge_vars = array( 'GROUPINGS'=> array( array( 'id' => 17385, 'groups' => array($post['listName']) ) ) ); $mc->lists->updateMember(self::$mainListID, $email, $merge_vars); Works perfectly.

Categories : PHP

Removing singleton dimension of scan capture group
Array#flatten may help foo = "bar = everybody bar = say bar = hey bar = ho" foo.scan(/^bar = (.*)$/).flatten #=> ["everybody", "say", "hey", "ho"]

Categories : Ruby

Check users in a security group in SQL Server
Accepted answer from DeanG is the preferred solution for getting this info within SQL Server You can use Active Directory tools for this. I like Active Directory Users and Computers that is part of the Remote Server Administration Tools. Follow the link to download and install the tools on Windows 7. Once installed, you can search for a specific group name: Then you can see group membership using the Members tab: If you don't want to use the AD browser packaged with RSA tools, there are several others available.

Categories : SQL

App pool identity, Users group and iis isolation
This question is also answered in the answer you linked to, by Kev. You should preferably set up your web root on a separate non-system drive. There you can remove the Users group from the top level and grant rights to the home folder of each site to the respective application pool identities only.

Categories : Security

Sql query how to get number of users group by city
If you want the distinct users for each city: select city, count(distinct username) TotalUsers from users group by city; See SQL Fiddle with Demo. The result is: | CITY | TOTALUSERS | ---------------------- | city1 | 2 | | city2 | 1 | | city3 | 1 |

Categories : SQL

'DOMAINDomain Users' group becomes 'SERVERNone' in Security Tab
it's clear. because you used a clone machine and joined it to the same domain as the source machine. so these machines had same SID。 you should sysprep the cloned machine before joining the domain;

Categories : Security

PowerShell Send Popup Message to users in group
As far as I understand. You can execute the script on a remote computer, but the user will not see the popup. This is because the remote process is not allowed to interact with the user Desktop. PS : have a look to this answer I think that on XP you can use NET SEND in upper versions you have MSG.EXE or third party WinSent.

Categories : Powershell

limit users in group chat of whatsapp by an android app
You can use Yowsup which is a Python library. You will need to setup a separate WhatsApp account that logs into the WhatsApp servers using this library. This account will need to be the "owner" of the groups and will need to manage adding and removing users from the chat. The code will also need to monitor the chat traffic to figure out who is talking. The code you develop does not need to run all the time. You will need to register listeners for a number of WhatsApp events. Some of your init code will look like this: class WhatsappClient: def __init__(self): atexit.register(self.exitfunction) connectionManager = YowsupConnectionManager() connectionManager.setAutoPong(True) self.signalsInterface = connectionManager.getSignalsInterface() self.methodsInterface = conne

Categories : Java

joomla user registered through CB is not assigned to k2 user group
I came across this when searching for a similar problem: gavick's facebook login didn't assign k2 usergroup. I suspect the solution is the same. Edit: /plugins/users/k2/k2.php replace in function "onLoginUser": // Get the user id $db = JFactory::getDBO(); $db->setQuery("SELECT id FROM #__users WHERE username = ".$db->Quote($user['username'])); $id = $db->loadResult(); with: // Get the user id $db = JFactory::getDBO(); $db->setQuery("SELECT id FROM #__users WHERE username = ".$db->Quote($user['username'])); $id = $db->loadResult(); $db->setQuery("SELECT username FROM #__users WHERE username = ".$db->Quote($user['username'])); $mytempusername = $db->loadResult(); And replace: $row->se

Categories : PHP

Linux command 'getent group' not returning users for some groups?
Can you please run: getent group|diff /etc/group - and show us the difference in its output, Since I have run this and I see no difference their both exactly the same getent will only return the master group name and not the sub groups a user belongs to: getent group adm adm:x:4:me,logcheck To get any instances of adm within getent try: getent group|grep adm

Categories : Linux

Drupal 7 Rules delay sending or group emails to users
You can combine several rules to make this happen. Add a rule when a user logged in, and mark his login date Get the list of users to send to using a View that take this login info into consideration Set another value for each user you send email to, so you won't send him another mail in the same day (for example) I am not saying it is a simple solution, but it can be done, it will work, and I believe all of it can be done just with Drupal/Rules knowledge. If you need further help, I will be happy to support as needed.

Categories : PHP

Authenticating users that inherit from the django user class or django.contrib.auth.models.User
Make sure your model is in an app that's in your installed apps list, the Auth_USER_MODEL is set as @alecxe mentioned, and that you ran sync db. If you ran sync db BEFORE you setup your new user model, you'll need to nuke the database and run it again now that your model is in place. This could explain why everything seems to be working but it's not.. From the docs: Changing AUTH_USER_MODEL has a big effect on your database structure. It changes the tables that are available, and it will affect the construction of foreign keys and many-to-many relationships. If you intend to set AUTH_USER_MODEL, you should set it before creating any migrations or running manage.py migrate for the first time. Changing this setting after you have tables created is not supported by makemigrations a

Categories : Python

Active Directory: find details of users in group without mass search
You could utilize an ANR search for some of those attributes For more information, see this article - the functionality has been there since 2000: http://support.microsoft.com/kb/243299 In order to search for other attributes not in the default set, you'd need to tweak the schema (which may not be suitable in your situation).

Categories : C#

Java Group Chat Application: Knowing if groups have users currently active
You could have an arraylist for every group that holds the names of every player in that group. Then you could easily get the names of people in the group and the number of people in it. so if you have a class named Group you could have something like: class Group { private ArrayList<String> users; // or instead of String if you have a User class use that public Group(Type par) { users = new ArrayList<String>(); } public static void addUser(String userName) { users.add(userName); updateUsers(); } public static void removeUser(String userName) { for(int i = 0; i < users.size(); i++) { if(users.get(i).equalsIgnoreCase(userName)) { users.remove(i); } } updateU

Categories : Java

MySQL query based on time range, group users, and sum values over a sliding window
Assumptions: one row per id/date the counts should be for id between date and date - 7 days "fruit" = "banana" the "date" column is actually a date (including year) and not just month/day then this SQL should do the trick: INSERT INTO B SELECT a1.id, a1.date, SUM( a2.banana ), SUM( a2.apples ) FROM (SELECT DISTINCT id, date FROM A WHERE date > NOW() - INTERVAL 7 DAY ) a1 JOIN A a2 ON a2.id = a1.id AND a2.date <= a1.date AND a2.date >= a1.date - INTERVAL 7 DAY GROUP BY a1.id, a1.date Some questions: Are the above assumptions correct? Does table A contain more fruits than just Bananas and Apples? If so, what does the real structure look like?

Categories : Mysql

Is it possible to use windows users for database login?
DB2 always uses the host systems security for identification and authentication. So if you run db2 on a windows server anyone logging in will need a userid and password which is valid in the servers domain. If they are logged in on the domain already they should not need to log in again. And believe it or not Microsofts SQLServer also uses the standard Microsoft Windows domain user ids :-)

Categories : Windows

How to connect to MS SQL Server database from ASP using windows authentication specifying a windows user
You've got at least 2 3 options here: Create an App Pool on your web server which runs as domain/usr and then assign your app to this app pool, and use integrated security. Your connection string will be Data Source=dbServer01;Initial Catalog=POS123;Integrated Security=SSPI; - i.e. drop the username and password - these are inherent in the AppPool's identity. or (assuming Mixed Mode security is enabled) ask your DBA's to create a new SQL User (just called usr) with the same permissions as domain/usr and then change your connection string to standard security, with User Id=usr If you enable impersonation (here and here), you can use the domain credential without changing the app pool identity. Note the point about securing cleartext passwords, and IME this typically also requires addition

Categories : Asp Net

Is there a way to programmatically insert a new user into a MyWSAT implementation (Windows Forms user registration)?
I can't speak about MyWSAT since I do not use it, however, here's what I do know... Since this is a SQL Server database, I would suggest using SQL Profiler when adding a user. See what comes out of the trace and go from there. With luck, maybe you can use one stored proc to create the user.

Categories : C#

Programmatically removing an Object from a Grid in Windows Metro
In the class header I've declared private: concurrency::reader_writer_lock myLock; And changed the implementation to: storyboard->Completed += ref new EventHandler<Object^> ([this,birthImage](Object^ sender, Object^ e) { unsigned int index; myLock.lock(); if (mainGrid->Children->IndexOf (myImage, &index)) { mainGrid->Children->RemoveAt (index); } myLock.unlock(); }); Notice the declaration of unsigned int index as a local variable to the lambda function.

Categories : C++

How to restrict the user to login on multiple windows on same browser with different user types
You are setting a variable in the user's session. You can just not allow the user to login again when this variable is set, since he'll be already logged in. Also, don't forget to call session_start(). i.e. you can put this at the very top of your login page: session_start(); if (isset($_SESSION['user'])) header("location:loggedin.php");

Categories : PHP

Windows Authentication - How to Deny Users using Code
If you want to authenticate by using information from a database, you would have to use forms authentication. The steps you have to take are: Build a Login-Webpage (login.aspx in this example) Put this in your web.config, to specify the login page and deny access for all users initially: Code: <authentication mode="Forms"> <!-- Login.aspx is the login page forms authentication should use. --> <forms loginUrl="Login.aspx" name=".ASPXFORMSAUTH" timeout="30" slidingExpiration="true" > </forms> </authentication> <authorization> <!-- deny all users access to ressources of this app, if not logged in. --> <deny users="?" /> </authorization> In your login page, in code behind, call this to let a user pass: Code: FormsAuthen

Categories : C#

Get current logged in Windows Users privilliges
Below snippet is working for me in Windows7. Can you please try it out. Thanks public static bool IsAdminUser() { bool isAdmin = false; AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); WindowsPrincipal principal = (WindowsPrincipal)System.Threading.Thread.CurrentPrincipal; WindowsIdentity identity = (WindowsIdentity)principal.Identity; isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator); return isAdmin; }

Categories : Windows

Detect users logging off in Windows service
WM_QUERYENDSESSION is sent to all top level windows on the desktop in the closing session. However since your service usually runs in a different session, you normally won't get the notification. Before Vista you could enable interaction with desktop to share the desktop with the user on session 0, but you won't get the message sent to you if the logging off happens in another session. After XP, you won't get messages from user sessions due to session 0 isolation. To notify your service of this message, you need to run an agent process in each session (that is, register to auto start when the user log in via start menu shortcut or registry) and listen to WM_QUERYENDSESSION (in .Net terms, run a message pump like Application.Run in Windows Forms and subscribe to SystemEvents.SessionEnding

Categories : C#

Is it possible to mklink a directory to different target for different users? (windows 7)
mklink cannot use environment variables, so the answer is "no, that's not possible". PS: I reviewed "subst", mountpoints and "net use", but none of them will suit your need. In fact, I'm unaware of any technique that will. Sorry :-(

Categories : Windows

Windows Phone 8 - Sharing data between users
There are many options and there is no best option. It all depends on your specific requirements. In general, you will need a client app that runs on the phone and then some sort of online web service where both parties can talk to and that service can handle pushing communication between connected clients. However, for a chat application SignalR comes to mind. It provides real-time web functionality. I think there is even a WP chat sample application on their website.

Categories : Networking



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.