w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Creating new users relation isn't saved, what's wrong?
You have to save the $new_user object again: $new_user->save($con) Also you don't have to check for action_name in the save() method, you can check it the object is new or not. The Objectform has a method for that. <?php ... public function save($con = null) { $new_user = parent::save($con); if($this->isNew()) { $new_user->addGroupByName('Monitor'); $new_user->save($con); //this saves the group } return $new_user; } ...

Categories : Symfony2

Django notification email to users in ManyToMany relation
First of all, I think your many to many relationship should not have blank or null, since each observer would ideally be a user and not a None. This avoids trying to send emails to None users, which probably gives error. Second, I think you can just use recipients = instance.observers.all().distinct() instead of looping on the list (distinct() already considers only unique users) Third, I don't see why you really need a "distinct()": can a user be observer more than once? recipients = instance.observers.all() Fourth, In your code, you are looping trough instance.observers.all() with an "observer", which is already a User. Why do you append observer.user in recipients? I think appending observer should be enough. Finally, confirm that recipients is not empty. If you have tested no

Categories : Python

PGError: ERROR: column "email" of relation "users" already exists
I found the answer at Devise migration on existing model. What I did was to comment out this line in DeviseCreateUsers migration: "t.string :email, :null => false, :default => """

Categories : Ruby On Rails

Can I get NSError messages from my users?
If this is an option you can ask your users to install the System Console: https://itunes.apple.com/gb/app/system-console/id431158981?mt=8 This will allow them to send you their console logs.

Categories : IOS

heroku pushing for deployment, something went wrong with my database, relation "users" doesn't exist
Do this $ git push heroku $ heroku pg:reset SHARED_DATABASE --confirm <name-heroku-gave-to-your-app> $ heroku run rake db:migrate $ heroku run rake db:populate and then try this: $ heroku restart

Categories : Ruby On Rails

How do I toggle my website title when my users have unread messages from their friend?
You can do it using the setInterval function: var cont = 0; setInterval(function () { if (cont % 2) { var myText = 'Text 1'; } else { var myText = 'Another text'; } document.title = myText; cont++; },1000); http://jsfiddle.net/7bMjN/ I made use of jQuery but it is not needed.

Categories : Javascript

Wordpress: How do I make a login system with users having their own profile and be able to send messages to each other?
Most of that is straight out of the box with Wordpress. Care to expand a little bit and we can perhaps suggest some plugins or ways to extend? For example, are you trying to run a facebook style social site, shopping cart, reddit etc.. To clarify further: User can register and login Out of the box with Wordpress. To hide the fact that the system is running wordpress have a look at the front end logins which integrate directly with the theme you are currently using. Have a look at Theme My Login Users have own profile (profile picture and short info) Again, out of the box. Set "Anyone can register" to true on the Settings page of wp-admin and when a user signs up they'll be asked to fire in profile information (works well with Theme My Login). Users can send messages to eac

Categories : Wordpress

iOS app need to design a flexible and elegant way to pop surprise gift messages to users in different places within my app
Here is my answer, hopefully I understood the question correctly and this helps. Create a popup manager class and initiate where ever it needs to be created first(app delegate?) to keep track of the user progression, and have the popup manager class pop alert messages to let user know of the surprise you have for them.

Categories : IOS

How do I create a user login, password and ability to exchange messages between users in my iphone app
You can communicate between iOS devices using bluetooth or WiFi using gamekit/GKSessions. Short communications or messaging may work just fine. But username password without server sounds tricky. I do not know if there is any existing framework for this. However, if you are to maintain a network over a predetermined number of devices, you may create an user and share it over bluetooth. That will be a non-standard approach but might work.

Categories : IOS

Java Hibernate JPA Deleting OneToMany Relation And MapKeyJoinColumn Relation Object
I am assuming that before calling the removeProductPrice() you open a session and begin a transaction. In the removeProductPrice() method load the productPrice object to persistence context by doing a get(). Like, ProductPrice price = productPriceDao.get(price.getPriceId()); // Then your logic to delete. I suspect that the passed ProductPrice object to the removeProductPrice() method is not present in the persistence context of the session. Can you post the full stack trace which shows the exact line which is causing the exception .

Categories : Java

Heroku Production Error: PG::Error: ERROR: relation "users" already exists error
I took a look at your code, and ran the database migrations on an empty database. Your migrations seem to be fine. However, this line in your error: PG::Error: ERROR: relation "users" already exists suggests that you might not be working from a fresh database. Assuming you don't have any data that's mission-critical stored in your database, your best bet is just to drop the database and start over. So, if you run: heroku pg:reset blog_production (assuming you're deploying in production mode) you'll have a fresh database. Then just do: heroku run rake db:migrate and you should be back on track.

Categories : Ruby On Rails

socat how to receive large amount of messages store these messages and acknowledge each message
Although this question is quite old now, this would have worked: socat tcp-listen:5678,reuseaddr,fork 'system:echo +OK!!open:recv.data,create,append' Source: Dual inter addresses

Categories : Misc

Regarding Akka message transfer performance: many small messages or less large messages?
For messages passed in Akka on the same machine, I don't think it matters a lot whether you use small message or an aggregation of messages as single message. The additional overhead of many calls versus having to loop while processing the aggregation is minimal I think. I would prefer using small messages because it keeps the system simpler. However, when sending messages over the network Akka is using HTTP and so there is the additional HTTP overhead costs for setting up a connection etc. Therefore you might choose here to aggregate some messages into a single message. However, this also depends on your use case. Buffering implies waiting for more until there are enough (or a timeout occured). If you cannot wait, e.g. because you need fast responses, then you still need to send each mes

Categories : Performance

Prevent p:messages component from showing messages which are already shown in p:message
i used the following JS function oncomplete of blur event and it works fine: function hideRequiredMessage(){ var ErrorMessagesSpans= document.getElementById("myform:messages").getElementsByClassName("ui-messages-error-summary"); if(ErrorMessagesSpans!=null && ErrorMessagesSpans.length > 0){ var ErrorMessageSpan=ErrorMessagesSpans[0]; if(ErrorMessageSpan.innerHTML==''){ //ErrorMessageSpan.className = ''; ErrorMessageSpan.parentNode.removeChild(ErrorMessageSpan); } } }

Categories : Validation

Django log messages not processing correctly. Messages to multiple files
You have two different loggers, named '' (the root logger) and 'auth'. The order in which your two statements appear: logger = logging.getLogger('') logger = logging.getLogger('auth') obviously makes a difference when you call logger.info(...) as in the two cases you will be calling the method on two different loggers. You might wish to change your code to root_logger = logging.getLogger('') logger = logging.getLogger('auth') and then call methods on either root_logger or logger as appropriate.

Categories : Python

Receiving messages from and sending messages to RabbitMq from WSO2 esb (v. 4.6.0)
This is because you have not set the content type and content Encoding when sending the message. Please make sure you set the contentType and contentEncoding in the builder. builder.contentType("text/xml"); builder.contentEncoding("utf-8");

Categories : Wso2

How to achieve complex messages using GWT i18n Messages interface
I Don't think it can be done, only for plural count and enums you can specify mutliple messages for the same method. In this case you need to create 3 methods and do the testing on the variants in your own code.

Categories : Gwt

Open iOS Messages app and go directly to the Inbox/Messages list
Unfortunately there are only two URL schemes for Messages, "sms:" , that opens the "New message" screen "sms:1-408-555-1212" , that opens the "New message" screen with the number provided As Apple developer documentation refers: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/iPhoneURLScheme_Reference.pdf [Link updated]

Categories : IOS

jms persistent messages and order of messages obtained
If you are consuming messages in parallel, then due to the nature of threading there can never be a guarantee that they will be completed in exactly the order they were sent in - only that they will be handed off to consumers in order. If there are only certain messages that absolutely, positively must be ordered (usually related to a transaction/account), you can use Message Groups feature to associate groups with consumers - a kind of sticky load balancing. Acknowledging messages by yourself is most definitely possible, but probably not needed. The MessageListenerContainer has a acknowledge attribute which if set to transacted will result in the message only being acknowledged as consumed once the MessageListener has completed executing, without an exception being thrown. No transaction

Categories : Spring

Global messages not displaying in
As there is no template attribute in ui:composition I assume the page is top level one. Then h:body is missing, here is an example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <h:head/> <h:body> <h:form ..... </h:body> </html>

Categories : JSF

How to make p:messages keep messages until errors are fixed
Set each ajax update tag with process="@form". I suspect the reason why a validation message is displayed for only a single component at a time is that each ajax request only processes a single component. As a result, only one component will ever fail validation at a single time and only one validation message will be queued. By setting each you'll ensure that each component in the form goes thru validation during processing and their respective validators will kick in.

Categories : Validation

How can we use app engine users API (java) with other google APIs to get users' profile pictures?
To get a user's profile picture from Google+ you need to use G+ API which requires using OAuth2. Here is a very simple example how you can get a person's profile info (including profile picture) : https://developers.google.com/+/api/latest/people/get?hl=en#examples Hope this will help you :)

Categories : Google App Engine

ActiveMQ stops sending messages to Queue Consumer in case of consumer not acknowledging messages
I had tried out lot of different configurations to resolve this issue by setting different activemq attributes like prefetch policy, maxpagesize etc. but none of them really helped. By referring to @Jake's comment I got to know about monitoring activemq using JMX via JConsole. This is a very handy tool to monitor and manage your activemq. Here are few article which you may find useful. 1. Monitoring activemq 2. Connecting activemq JMX using JConsole By monitoring the queue attributes I figured out that memoryLimit attribute had very low value assigned to it (just 1mb). Increasing the value of the attribute solved my issue. JMS started sending messages without waiting for acknowledgement. For testing purpose I had changed the value for memoryLimit in the conf/activemq.xml configuration

Categories : Java

Git "discrepancy": `git diff` does not take commit messages into consideration but SHA-1 generation takes commit messages while computing SHA-1
git diff is about the changes in actual content and not the meta data. Consider the use case where a commit was cherry picked from another branch. Many a times, you want to know if the same content is there in both the branches, and not if both branches have the same commit. That is where git diff comes into the picture. The commit hashes are of course for commits, and will take the metadata into consideration. The actual way to see difference in two branches IS git diff. If two branches have the same hash for their heads, they do have same content. But if they don't, they need not necessarily have different content. You might also look at git log -p command to see if it suites your purpose.

Categories : GIT

How to sort posts based on users interactions/most interested users
I deal with exactly the same problem and the approach is same as explained by @relentless Find all the associations of the current user Sort by number of likes However this looks very good in theory, but in practice in my case it required more time than the user was willing to wait. So what I did is that I limited the number of the database records (posts and events in your case) to some amount that can be processed in like 2 second time-frame. In my case this was 6 months in the past, but in your case you have to tune the timing and the load to best suit your needs.

Categories : PHP

How can I authenticate users on Ignite Openfire against my MongoDB instance that contains users?
I am pretty sure you will have to create your own AuthProvider since the built in DB provider is JDBC based (which I assume doesn't work with MongoDB, but that is an assumption). I haven't done it, but I would guess it isn't that hard to do. The interface is fairly simple.

Categories : Mongodb

Login system using physical postgres users not "logical" users
To achieve your goal all inserts, updates and deletes, need to leave a trail that is difficult, if not impossible for a standard user to change. you can create: 1) Two schemas: one for common tables, one for security stuff like login/pass(hash) table, user session log, change log table, etc. 2) Two users: one common user, that can only use dml on common schema (no ddl), one superuser. 3) Login function that will check provided user/pass against login/pass table and log successful/failed attempts into user session log (you need SECURITY DEFINER function) 4) Set of audit triggers on common schema tables that will check the user privileges and log any changes, made by the user (SECURITY DEFINER functions here too).

Categories : Security

populate a drop down menu with database users names, when a username is selected refresh showing users details
Use a form <form action="/yourpage" method="post"> <select> <option value="<?=$id; ?>"><?=$name; $></option> </select> <input type='submit'/> </form> In yourpage.php <?php if(isset($_POST)){ // load user data // or redirect with header() to preexisting page } // load view with user data ?>

Categories : PHP

How to ensure that JMS messages read within a rolled back session are processed after never-before-read messages?
I am not aware of feature in Sonic MQ which supports your requirements out-of-the-box, but there are other options: Use a second queue for failed messages. So failed messages are sent again on another queue. Processing could start, if the first queue is empty, for example. Resend the message on the same queue (with same or even with a lower priority) In both cases, after the message has been sent, there is a normal commit on the main queue. Related: Message processing with priorities. A quote from James Shek's answer: JMS Spec states: "JMS does not require that a provider strictly implement priority ordering of messages; however, it should do its best to deliver expedited messages ahead of normal messages."

Categories : Java

Rails user_path routing to users/index instead of users/id
Have you checked if @user has a value? user_path(@user) will go to /users/<@user.id> but if @user is nil, it will try to go /users/. Given you haven't created the index method and views yet, that will probably be why it fails. Thanks for the test code. Firstly your user is not in the database - change the .new to .create or add a @user.save. Secondly your params[:id] is not populated in the test code so the find will fail (add controller.params[:id] = @user.id to your test). (Thirdly you have a typo shoult instead of should in the last test.)

Categories : Ruby On Rails

how to integrate wordpress users with vbulletin users
You can give a try to obscureclouddon's mod, as an alternative to vbSSO. (an other link here) It seems to be a good choice, since it has features you need : WordPress->vB features: *Registration sync – new users created on WP are automatically created on vB vBulletin ->Wordpress features NEW *Registration sync – new users created on vB are automatically created on WP The bad things are : this modification is in beta stage free version has limited features, the pro version is, IMHO, expensive... (but it could worth the cost..)

Categories : PHP

Setup so users can follow(bookmark) other users
Think about it like Relationship is a join table between a many-to-many association (i.e. a user can follow many people and a user can be followed by many people). You shouldn't need Relationship routes. Remove resources :relationships, only: [:create, :destroy]. Also, make sure you've migrated in a Relationship table like: class CreateRelationships < ActiveRecord::Migration def self.up create_table :relationships do |t| t.integer "follower_id" t.integer "followed_id" end end def self.down drop_table :relationships end end and created a Relationship model like: class Relationship <ActiveRecord::Base belongs_to :follower, class_name: "User" belongs_to :followed, class_name: "User" end

Categories : Ruby On Rails

Should "/users" and "/users/" point to the same (RESTful) resource?
Technically they are not the same. But a request for /users will probably cause a redirect to /users/ which makes them semantically equal. In terms of JAX-RS @Path, they can both be used for the same path.

Categories : Http

how to make a relation from several objects/tables with a relation to common objects/tables
There are a few options Create a separate Settings table and have a nullable ForeignKey from all of your objects to the Settings table. If you choose this option, you should create an abstract base class that has a ForeignKey to the Settings table and inherit from that abstract base class. That way you don't have to add the ForeignKey every time you create a new model. Create a separate Settings table and use GenericForeignKeys from the Settings table to reference your object (Customer, Location, and Department). This has the advantage of not having an extra column in all of your tables that need settings. However, you can't do DB joins with GenericForeignKeys via the Django ORM's normal API. You'd have to use raw sql. Also, select_related doesn't work on GenericForeignKeys so you'd have

Categories : Django

Can't use users : Unknown database 'users'
you can try this in your phpmyadmin GRANT SELECT, INSERT, DELETE ON database TO username@'localhost' IDENTIFIED BY 'password'; then try to run your php code.

Categories : PHP

I want to set authenticated users' root to a nested resource, their dashboard, instead of the home#index page non-authenticated users use as root
Option 1: In your dashboards controller, change to: @user = current_user @dashboard = current_user.dashboard This will also prevent users from seeing other user's dashboards. Option 2: Now, if users can see other user's dashboard fine, then change your route: root :to => "dashboards#find", as: :authenticated_root and in your dashboards controller: def find redirect_to user_dashboard_path(current_user, current_user.dashboard) end

Categories : Ruby On Rails

SQL n:m relation
SELECT s.id AS studio_id, e.id AS equipment_id, se.id AS studio_equipment_id FROM studios AS s CROSS JOIN equipment AS e LEFT JOIN studio_equipment AS se ON se.studio_id = s.id AND se.equipment_id = e.id ;

Categories : Mysql

Get one to many relation data
Try left join instead of inner join. child tables might not have records assosiated with Customers.id =1. select a.name, b.job_date as JobDate, c.order_date as OrderDate from Customers a left join Jobs b on a.id = b.customer_id left join Orders c on a.id = c.customer_id where a.id = 1;

Categories : SQL

One to many relation different option
The second one is probably a bit more efficient, because it needs one join less than the first one. But it couples the many side (address) to the one side (person) by requiring a foreign key in the address table. That is in contradiction with the fact that the association is unidirectional (address doesn't know about its person in the object model). This is why the second one is the default for unidirectional one to many associations.

Categories : Java

how to map many to many relation in angularjs
There's nothing like class-level definition for such relation in Javascript (neither in AngularJS). Look at data-binding in AngularJS, I think that's what you're describing in comments. http://docs.angularjs.org/guide/dev_guide.templates.databinding

Categories : Angularjs

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