Posts by Ricardo • 1,216 points
29 posts
-
1
votes1
answer520
viewsQ: Access token or Sessions in Apis
I am developing an api and I have a question about how to manipulate the logged in user. The logged in user api and administration (add things, edit profile, photos, etc.) is developed in Rails in a…
-
0
votes1
answer70
viewsQ: Make condition within the surrender
I’m learning Ruby and I’m having a question about how to make a if inside the render to display the param only if he exists... Ex: if params[:field] puts 'field' => params[:field], end How do I…
-
3
votes1
answer341
viewsQ: What is the best way to add ENUM fields to the Rails 4 model?
I need to reference the field numbers status of the database, which are in the format ENUM, with the names of my model. What’s the best way to do that? models/item.Rb class Item <…
-
2
votes3
answers6522
viewsQ: How to access an EC2 instance after losing the Key Pair?
I lost my Key Pair from accessing an EC2 server, how do I recover it? Is there any way to generate a new Key Pair and add to an existing instance?
-
2
votes2
answers157
viewsA: Initializing the Redmine
Generate a hash for the secret token using rake: rake secret
-
1
votes3
answers1760
viewsA: Performance issues using UPDATE
You should have the bank do all this in a single query. Currently you are using foreach to run each line containing a query. Really, depending on the amount of executions can get slow and give end…
-
3
votes1
answer114
viewsA: How to add a link in the Redmine menu only for logged in users?
Do it like this: menu :top_menu, :my_link, {:controller => 'my_controller', :action => 'index'}, :caption => :my_caption, :if => Proc.new { User.current.logged? } Reference:…
-
4
votes4
answers3280
viewsA: Integer with 0 to the left is printed as another number
You can work with these numbers as string. Just add quotes: $mob_numbers= array("02345674", "12345675", "22345676", "32345677"); echo ($mob_numbers[0]);…
-
24
votes3
answers32219
viewsA: Fetch last 7 days data from current date
If you want to search from the current date, you do not need to enter any date variable. Mysql is smart :), and is able to account for when it is seven days in the past. Do so: SELECT * FROM tabela…
-
3
votes1
answer666
viewsA: Multi-step form, losing values of variables when page changes
To work on a form with multiple steps/screens, it is advisable that you use the sessions, in PHP you can use through the global variable $_SESSION. So you don’t need to each form keep sending and…
-
0
votes6
answers14122
viewsA: How to simulate a higher resolution screen to check the behavior of a website?
You can create a page with a iframe calling the page you want to test. Put in this iframe to width and height that you need. Maybe you have better ways, but then you can test. Maybe by working on…
-
1
votes2
answers592
viewsA: How to build friendly Urls, such as Facebook and Twitter.
Routes What you’re trying to do is what we call today routes (Routes). When you make use of some Framework, most of them already contain this functionality by default, making managing routes much…
-
1
votes2
answers176
viewsA: What better server side technology to serve information to cross-platform software?
Facebook uses various technologies to provide its various services. It is very difficult to stay here to mention here how each one works. But for sure, the world is heading towards using Restful to…
-
2
votes3
answers3112
viewsA: How to check if a file exists in several different folders?
Do so: So it is more friendly to add new folders, then put the IMG and image link where it is indicated. <?php // nome do arquivo $imagem = "foto.jpg"; // aqui você pode adicionar várias pastas…
-
0
votes2
answers24272
viewsQ: How to resolve "Cannot Modify header information - headers already sent by" error in PHP?
Because when we make use of the functions header() and setcookie() error occurs: Warning: Cannot Modify header information - headers already sent by (output Started at /teste.php:10) in /php test.…
-
2
votes3
answers554
viewsA: Get the structure of a table through a query
Do so: DESCRIBE tabela; Or so: SHOW CREATE TABLE tabela;
-
1
votes3
answers290
viewsA: Unmark a category x of all wordpress posts
Mass set Categories Has this plugin that adds and removes categories in bulk. It presents all posts at once, you will mark and uncheck the ones you want. There is also a idea for something similar…
-
7
votes3
answers6755
viewsA: How do I receive the $_GET value of a URL in Codeigniter
You can use the class: URI Class The URI Class provides functions that help you Retrieve information from your URI strings. If you use URI routing, you can also Retrieve information about the…
-
3
votes1
answer5564
viewsA: How to fill out forms automatically with PHP?
One option is to create a script, which sends a POST for the form in question that you are filling out every day. You can leave everything already filled and just run this script every day. But why…
-
13
votes6
answers5531
viewsA: Why use Javascript if there are so many other technologies to generate dynamic content?
Differences There is a difference between languages, each has its own point of reach and so can do specific things. For example in Javascript because it is a Client-Side language you could not make…
-
0
votes2
answers452
viewsA: How to make the return of a query (PDO) bring me an array already?
You need to use the Pdostatement::fetchAll Example: <?php $sth = $dbh->prepare("SELECT name, colour FROM fruit"); $sth->execute(); /* Fetch all of the remaining rows in the result set */…
-
1
votes4
answers4165
viewsA: How to pass parameters through the URL in Wordpress?
WP-Router What you need is to create specific routes, this plugin helps in this task. You can create your routes and then recover on some specific page, example: Whenever the user logs in…
-
3
votes1
answer2062
views -
3
votes1
answer280
viewsA: PHP Database error
The message indicates that access has been denied to the user root in localhost. This means that your host is correct, and you are getting there at the bank, but it is not recognizing as valid your…
-
0
votes3
answers408
viewsA: What is the best way to create PHP-related posts?
The best way is to create a list type field, where you can manually specify related posts, many plugins work exactly like this. Sometimes posts related by auto search return posts with little…
-
2
votes2
answers211
viewsQ: Doubt about inheritance in classes
How to do the if controller return TRUE or FALSE in accordance with the check() of the Validator? Currently it returns boolean to the validate();, but I wanted it to continue until the end of the…
-
0
votes3
answers465
viewsA: Hide image generated by Javascript
Your code is not complete. But try to make the change by CSS. .st_sharethis_custom{ background: url("imagem.jpg") no-repeat; padding:0px 16px 0 0; }
-
1
votes1
answer74
viewsQ: How to create routes, which accepts only allowed values?
How do I make :status accept only allowed values? # routes.rb get '/para_:status(/:opcao1)(/:opcao2)', to: 'search#index', :as => :search Currently :status accepts anything I submit. I wish…
-
2
votes1
answer1243
viewsQ: How to route with optional and ordered parameters in Rails 4?
How I make a route like this? site.com/clothing/men/T-Shirts_type/Nike_brand/100-500_price/Red,White,Blue_color/ site.com/clothing/woman/Nike_brand/100-500_price/Red,White,Blue_color/ It should…