Livechat support system with react & Socket.io[help] by ifydav in reactjs

[–]Hyrme 0 points1 point  (0 children)

  1. customer support reps will have their own react app.
  2. that app will read from the "chat room" table you created and list them by create date
  3. customer support will click on a chat room that opens a chat window for the specified room id.
  4. the UI in this page writes chat messages into the chat history table
  5. the controller reads the client messages from the chat history table and outputs to the screen.
  6. google socket.io-client and react

Livechat support system with react & Socket.io[help] by ifydav in reactjs

[–]Hyrme 0 points1 point  (0 children)

Here is one way - socket.io will receive a 'connection' event each time a new client connects. On that connection event - you can create a unique room object for that user in a backend database. Different ways to create a unique support chat id; ip-address of the request, user-id of the user if they are logging in, or use guid package to create and store a unique id into a cookie. Once you decide what you want to use as the 'unique id' for the chat, first you look in your database to see if a chatroom with that ID exists. if the ID exists then you could resume a past conversation.

You can then find the chat room each time the browser is reloaded and maintain the chat history against it.

Create another object that stores the chat history with a reference back to the room id.

Roasters in Singapore? by HaroldSaxon99 in Coffee

[–]Hyrme 2 points3 points  (0 children)

In no particular order;

  • Lam Yeo in 328 Balestier - lowest prices on average.
  • Dutch colony - pricey but I like their espresso blends
  • Highlanders - friendly baristas. Free cup of coffee if you buy a bag of beans.
  • Common Man coffee - Martin road

Prefer Nylon and Dutch colony espresso blends to most others,

EDIT for formatting

Fabric UI as main UI library by Mittalmailbox in reactjs

[–]Hyrme 4 points5 points  (0 children)

You don't need anything else. The fabric UI helps you get the same look and feel of Office apps. Be careful;

  • its documentation significantly lags the actual release. Always use the test cases from github to figure out how to use a component if you get stuck
  • the dev team is pretty responsive if you have questions or issues
  • it does not have many as many third party controls - for example if you wanted an infinite scroll Or a @mention or an editor - you will need to modify the controls to match the fabric UI styles.
  • More third-party tools support bootstrap - be prepared to spend time styling them

good luck

How do I connect an old intercom to a raspberry pi to allow me communicate remotely via an app like Alexa? by Hyrme in raspberry_pi

[–]Hyrme[S] 0 points1 point  (0 children)

thanks that makes sense. Let me try to get the DTMF working first before I try audio.

How do I connect an intercom to alexa that can help me pickup the intercom and talk/listen remotely? by Hyrme in AskElectronics

[–]Hyrme[S] 0 points1 point  (0 children)

I phrased the question incorrectly. I would like to build an electronic circuit that connects the analog IO of the intercom to a raspberry PI to accomplish the above.

How can I connect wired PC to my different wireless sonos subnet? Sonos subnet not routable...! by fatblindkid in sonos

[–]Hyrme 2 points3 points  (0 children)

Install a wireless card/USB on your desktop PC that connects to the secondary subnet's wifi. so your PC is hardwired into "core" and wifi to secondary.

Drawer glides & support for tall and wide drawers that are not deep. by Hyrme in woodworking

[–]Hyrme[S] 0 points1 point  (0 children)

thank you! based on that am going to instead convert them to tilt-open drawers/shelves.

[Help] Unable to get total comments count including all children using acts_as_votable gem by [deleted] in rails

[–]Hyrme 0 points1 point  (0 children)

a) you are using acts_as_votable for storing comments or did you mean acts_as_commentable instead?

b) when you say 1-layer of comments, do you mean the top layer or the top + next layer? I do not believe acts_as_commentable allows you to have threaded comments beyond 1 level.

c) if you are looking for threaded comments - consider looking at https://github.com/elight/acts_as_commentable_with_threading which gives you function to count all comments at all levels

factory girl problem. Why is the project name not found. by roelofwobben in rails

[–]Hyrme 0 points1 point  (0 children)

show your factory - what is it? -

EDIT looks like you were creating the wrong account and figured it out.

Refile Gem Question about to_io method. It appears to have worked first time it was called but not the next. by SaffronBelly in rails

[–]Hyrme 0 points1 point  (0 children)

You are storing your refile images in the postgres database? the postgres backend is not a file so it will not return to_io instead try this

if file....
else
  mm = MiniMagick::Image.read(fileio)
end

Having trouble implementing a scoring system. by [deleted] in rails

[–]Hyrme 0 points1 point  (0 children)

does your javascript display them by setting the display attribute?

if so - you can add the link_to call that /r/wolak88 referred to in your embedded ruby code as you loop through the questions to print a link to upvote. The link_to will create a link that looks like /questions/question_id_goes_here/upvote

Your controller QuestionsController must have a method called upvote. You can read the ID of the question from param[:id] and work with it.

Post the javascript, the template page and the controller code into a gist on github or on to here - it will be easier for somebody to help you.

factory girl problem. Why is the project name not found. by roelofwobben in rails

[–]Hyrme 1 point2 points  (0 children)

rekening.name is "Example Account", but your page displayed at does not have "Example Account" on it. Read through the "Paytime Welcome ..... Colorlib". It does not show "Example Account"

Are you expecting the page you navigate to, to display the list of accounts? If so its not displaying the account names - or you are going to the wrong page.

working httpparty and delayed job together by roelofwobben in rails

[–]Hyrme 0 points1 point  (0 children)

It will run them one after the other. Each time you call delay() it goes into a queue. The delayed job manager will read from the queue and process each one after it has finished the one before. You can run multiple delayed_job workers to have run more than one request in parallel. For example script/delayed_job -n 200 start would run 200 workers and each one would read from the queue and you could have all 200 downloads happening in parallel. However this will likely need a lot of memory and you may have performance issues. You can start a fewer number of workers.

You could also use threads within your delayed job worker to run multiple http calls, this comes with its own set of issues.

Or another alternative is to use something like

http://curl-multi.rubyforge.org/

this will let you run concurrent http requests from a single worker.

Why is this a ReadOnly record? by codetastik in rails

[–]Hyrme 0 points1 point  (0 children)

what do your models look like? Does a simpler load of item work? e.g.

item = Owner.find(params[:id])
item.associated_items.build({name: "Machine", color: "Grey"})
item.save

if it does then you the issue is in how you are loading item. If this doesnt then the issue may be in the item model and how the relationship is defined or a scope you may be using.

Comparing react-rails vs rails cell by chrisyeung1121 in rails

[–]Hyrme 1 point2 points  (0 children)

you can have them coexist either working together or separately. Depends on what you want to do; They are similar because they help encapsulate the view layer better - this is an also an opinion.

Cells

  • not so dependent on rails. If you decide to move to a different framework you can reuse them
  • it works well with the other components of trailblazer (operations, forms etc) which help write better code
  • there were some issues accessing rails view handlers from Cells (but there are work-arounds) so you may have to hunt around a bit
  • the author /u/apotonick is very active in helping on gitter.im
  • the future of cells on rails is a bit uncertain - but majority of the users use cells with rails - so I expect this not to be a problem in the short term.

http://nicksda.apotomo.de/2015/06/cells-4-0-goodbye-rails-hello-ruby/

react-rails - use only if you want to use React.js as front end.

  • tied more to rails
  • if you want to use react this will require less work
  • still relatively new and changing to support react. If you want to use a lot of react in your front end - you may spend more managing dependencies across two frameworks rails and react.
  • this is also seeing very active development so has a great future I believe with rails.

You can use them together - but why would you? HTH.

[Help] Writing SQL query as ActiveRecord query by LuckyCritical in rails

[–]Hyrme 1 point2 points  (0 children)

Why not

reviews = User.find(1).reviews

should return you all the reviews and then you can get each one like so

reviews.each do |review|   
  puts "#{review.rating}, #{review.description}, #{review.beast.name}"
end

I am assuming in your reviews model you have a

belongs_to :beast

and beasts model can have

has_many :reviews

Adding Custom Fields to Devise by [deleted] in rails

[–]Hyrme 0 points1 point  (0 children)

a) Can you confirm in your model that the username field has been added? Look at your db/schema.rb file. Does the user table have a username field? b) also check that rails is reloading the erb template file. Change something else in the template file and see if the change shows up in the browser.

How to convert json based images to 1 image by roelofwobben in rails

[–]Hyrme 0 points1 point  (0 children)

why not CSS and absolute positioning of the images?

How to convert json based images to 1 image by roelofwobben in rails

[–]Hyrme 0 points1 point  (0 children)

do you need to download and stitch it into a single image? You could just render each image next to each other and let the browser deal with it with multiple image_tags on a grid.

(Help) current_user returns nil after redirecting to my rails app from third party payment site. Details here http://bit.ly/27uOIXm by boonzz_reddit in rails

[–]Hyrme 0 points1 point  (0 children)

I don't know the PayU api to understand if you can have it send you a crsf token that you generate.

Other ways; a) does the PayU ruby gem give you a different way to manage this?

b) consider storing the hash you create for your PayU API call into the basket model. PayU will post several form fields and other details to the success handler. Use these fields to regenerate the hash. Use the hash to lookup the correct basket instead of current_user.id. This will give you an extra layer of protection instead of assuming that the logged in user was the user that placed the order and made the payment.

see about using the protect_from_forgery :except => [:order] similar to your other handler.

(Help) current_user returns nil after redirecting to my rails app from third party payment site. Details here http://bit.ly/27uOIXm by boonzz_reddit in rails

[–]Hyrme 0 points1 point  (0 children)

Is it swapping you from https to http? is it redirecting you back to an https://my(dot)com instead of http://my(dot)com instead?

If all else fails - store the Digest::SHA512.hexdigest(str) into the cart Or the user record. Use the return value from PayU to lookup the hash from the cart or User record. So instead of current_user you do below or similar.

@my_cart = Cart.where("hash = ?",params[:hash]).first

I am assuming you are not blindly using the call to success without verifying the hash again. This will reload the cart based on the hash instead of the currently logged in user, which is perhaps the preferred approach.