Posts by André Ribeiro • 5,137 points
125 posts
-
2
votes1
answer98
viewsA: Excerpt post wordpress
This is not how this filter is used. First you should declare the function new_excerpt_length in the functions.php of your theme and then add as filter excerpt_length. function…
-
3
votes2
answers7339
viewsA: How to make button stick with another color when being clicked and selected
You can change the color by adding a class to the clicked element. In the example below, there is a class in css .sel which changes the element color to red. // uma função "helper" somente para não…
-
1
votes2
answers2031
viewsA: How can I compact directory except specific folder?
You can use the parameter --exclude of tar to compress everything but the specified directory/file. Example with bzip2 compression: tar jcvf arquivo.tar.bz2…
sshanswered André Ribeiro 5,137 -
10
votes2
answers448
viewsA: How to use class variable as default value in php functions?
What you are trying to do is not valid in PHP. According to the manual: The default value [of a function parameter] needs to be a constant expression, not (for example) a variable, a class member or…
phpanswered André Ribeiro 5,137 -
3
votes2
answers4895
viewsA: Dynamic select with Jquery
I don’t think this class-based scheme of yours is a good idea. Since I don’t know exactly what you’re doing I have no way to propose a better solution. Below is the code that works the way you…
jqueryanswered André Ribeiro 5,137 -
3
votes3
answers94
viewsA: Simple click on Jquery does not work
To show and hide by clicking on the element you can use the function .toggle(). If you only want to show the element without the option to hide when clicking again, you can use the function .show()…
jqueryanswered André Ribeiro 5,137 -
3
votes1
answer110
viewsA: Why does Bitmap get bigger when loading it from the res/drawable-mdpi folder?
The dimensions returned on Android are proportional to the dpi of the used apparatus. To check the original image size you can do as follows: BitmapFactory.Options opt = new BitmapFactory.Options();…
-
5
votes3
answers1446
viewsA: Specify fields I don’t want in Mysql
Another solution would simply omit the value of these two columns: SELECT *, NULL as senha, NULL as email FROM usuarios; The NULL there can be replaced any value you want to show by default in these…
-
0
votes1
answer78
viewsA: .htaccess URL redirection
You can do it like this: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?meusite.com$ RewriteRule . site2 [R=301,L] RewriteCond %{HTTP_HOST} ^(www.)?meusite2.com$ RewriteRule . site1 [R=301,L] Who…
phpanswered André Ribeiro 5,137 -
3
votes2
answers2204
viewsA: How to make SVG image fit the size of a DIV?
You can use svg as background and adjust with background-size to make the image size fit the element size. Example: #div1 { width: 100px; height: 150px; background-image:…
-
3
votes1
answer431
viewsA: Edittext with Webview URL when the page starts loading
You can set the URL in the method onPageStarted of WebViewClient: myWebView.setWebViewClient(new WebViewClient(){ public void onPageStarted(WebView view, String url, Bitmap favicon) {…
androidanswered André Ribeiro 5,137 -
4
votes1
answer1888
viewsA: Error creating platform with Cordova in Ubuntu (ANDROID_HOME is not set and "android")
You need to set the environment variable ANDROID_HOME with the path of Android SDK installation location. Edit the file .profile in your home directory: nano ~/.profile Add the following lines:…
-
3
votes2
answers2104
viewsA: How to put an image in front of a button?
Edit the structure. If the button comes afterward of input there’s no reason to put him before in HTML. <form action="newsletter.php" method="post" class="content-form clearfix"…
cssanswered André Ribeiro 5,137 -
3
votes1
answer133
viewsA: AJAX sends information to PHP but fails to insert only one data
The problem is that you are sending the parameters incorrectly in the ajax call. data: 'data='+dataString, In this line you end up generating a new data called data where the value ends up being…
-
1
votes2
answers550
viewsA: Check which page accessed previously and if positive display something
You can check if the referrer’s host is facebook.com. The function parse_url returns an array containing URL information. The index host of the array that is returned by the function will contain…
-
1
votes1
answer1281
viewsA: How to get the url of the parent page of an iframe without being in the same domain?
You can use the following: var parentURL = window != window.parent ? document.referrer : null; When your page loads into an iframe, window is different from window.parent. In that case,…
-
5
votes2
answers13898
viewsA: How to use jQuery Fadein and Fadeout effect in user warnings
You can do it like this: $(function(){ $("#aviso").fadeIn(700, function(){ window.setTimeout(function(){ $('#aviso').fadeOut(); }, 10000); }); }); <script…
-
1
votes2
answers19198
viewsA: Script /.bat to kill certain process on all users logged in to the computer
You can kill all processes with the name gdc.exe you can use the command taskkill: taskkill /f /im gdc.exe So that the taskkill end the processes by running under other users you accurate execute…
-
3
votes1
answer1028
viewsA: Problem with Uppercase and Lowercase in Angularjs
The problem is on the line: .filter(':contains("'+scope.filter+'")') The selector :contains jQuery distinguishes between upper and lower case letters (case sensitive). Function .filter() accepts as…
-
3
votes2
answers686
viewsA: Full Date Return Type
You can use the SimpleDateFormat: String dataFormatada = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(new Date()); To convert back to Date: Date data = new SimpleDateFormat("yyyy-MM-dd…
-
0
votes2
answers1245
viewsA: Insert CSV line break every N characters
You can use the following function which reproduces the functioning of the wordwrap of PHP. function wordwrap( str, width, brk, cut ) { brk = brk || '\n'; width = width || 75; cut = cut || false; if…
javascriptanswered André Ribeiro 5,137 -
2
votes1
answer60
viewsA: How to add an array with itself more data?
You cannot "add" arrays this way. To merge two or more arrays you must use the function array_merge. In your case it would look something like this: $smses = array_merge($smses,…
-
0
votes2
answers819
viewsA: How to check if the date inside Datetime is invalid?
I’ve had this same problem and used a very simple solution to check. When the DateTime is created with that null date, the method format returns -1 for the year. If it returns any value above 0, it…
-
4
votes3
answers612
viewsA: How to leave empty textbox after an Ajax request via Post?
You can add this to the callback success of your ajax request: $('#Pessoa,#Cep,#Endereco,#Numero,#Complemento,#Bairro,#Cidade,#UF').val(''); An ideal solution would be for you to place these fields…
-
1
votes1
answer1435
viewsA: Boostrap datepicker close-on-click event
To close the datepicker automatically when selecting the date you can use initialize the plugin with the option autoclose. $('#data').datepicker({ format: 'dd/mm/yyyy', language: 'pt-BR', autoclose:…
-
1
votes3
answers909
viewsA: Dropdown-menu Bootstrap with PHP
To get the value of the attribute data of li from your menu you can use the function .attr( attributeName ) Your code would look like this: $(document).on('click','#status li',function(){ $.ajax({…
-
1
votes2
answers589
viewsA: User friendly URL does not retrieve variable
The problem with your .htaccess is that in the rule RewriteRule ^/artista/([0-9]+)$ /artista.php?artista=$1 the ^/ at the beginning indicates that the path must start with /artista. As in your case…
-
2
votes2
answers1333
viewsA: How to query data from two related tables?
You have followed the right path in your query but are only selecting the city name of origin (c.nome_cidade). You can do it like this: SELECT d.nome, c1.nome_cidade AS origem, c2.nome_cidade AS…
-
1
votes3
answers322
viewsA: Put in array strings according to a regular expression
You can do it like this: var texto = "Eu quero comprar [qtdOvos] e [qtdFrutas] somando o total de [totalCompras]"; var arrayStrings = texto.match(/\[[A-Za-z0-9]+\]/gi); arrayStrings will contain…
-
2
votes2
answers237
viewsA: Aftnetworking with Token to download image
The problem is that you are sending the headers HTTP via the GET parameters. To set these headers you must use the method setValue:forHTTPHeaderField: of AFHTTPRequestSerializer You can do it like…
-
3
votes7
answers552
viewsA: What is the difference between these parameters (array) in these methods?
In function exemplo1 the array serves to indicate that the parameter $parameters must be an array. If the function is called with a parameter of another type PHP will generate a warning (Warning)…
-
1
votes2
answers2456
viewsA: How to call a sound when clicking the android button
I ran some tests here and found that mistake (error (-19,0)) happens when you create several instances of MediaPlayer and does not call release() in none of them. Add this after…
-
5
votes3
answers2210
viewsA: Remove First Word from String
You can do it like this: StringBuffer str = new StringBuffer("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); str.replace(0, str.indexOf(" ") + 1, ""); // = "ipsum dolor sit amet,…
-
8
votes2
answers6768
viewsA: Run something after inserting a certain number of characters in an Edittext?
You can limit through the property android:maxLength in the XML layout or by adding a InputFilter in the TextView/EditText. Examples: XML <TextView ... android:maxLength="5" /> Code TextView…
-
3
votes1
answer653
viewsA: How to hide a div with timeout in Angularjs?
You can do it like this: Add the directive ngHide in his div. <div id="loaderViwew" ng-hide="hideLoader"> ..... </div> In your controller you add the variable hideLoader initially with…
-
1
votes1
answer87
viewsA: Format result with concatenated field
You don’t need to use CONCAT to do this. It can be done like this: TIME_FORMAT(SEC_TO_TIME(TIMESTAMPDIFF(SECOND, Campo.expired, NOW())), '%H:%i') This will calculate the difference between dates in…
-
2
votes1
answer511
viewsA: Let centralized Bullets and right and left navigation arrows in slider
You can use the following: Here the Bullets are centralized by adjusting the properties left and right for 0 and margin for 0 auto. Using this method the width needs to be fixed. .flex-control-nav {…
-
3
votes1
answer68
viewsA: Generate CSS from inline css of DOM elements
The Dreamweaver has a tool for it. In Code View (View > Code), select the entire style attribute that contains the inline CSS to be converted. Right-click and select CSS Styles > Convert CSS…
cssanswered André Ribeiro 5,137 -
5
votes3
answers579
viewsA: How to join data from another table
You need to make a JOIN in your tables. Example: SELECT d.nome, c.nome_cidade AS cidade, s.nome_status AS status FROM dados d JOIN cidades c ON d.cidade = c.id JOIN status s ON d.status = s.id Will…
-
2
votes1
answer191
viewsA: How do I Redirect on the route if it is the first time it runs?
You can store an entry in localStorage as soon as the tutorial controller is loaded and in function app.run() Angular you check if this entry exists and, if nay exists, you redirect to the tutorial…
-
5
votes1
answer1427
viewsA: How to store values of a recursive function in an array?
The problem is that you are not passing the array as parameter or returning the value of the recursive call. You can do it like this: function minhaFuncao($contador, $lista = array()) { if($contador…
phpanswered André Ribeiro 5,137 -
1
votes2
answers323
viewsA: How to get server CPU load
You can also use the function sys_getloadavg(). This function returns an array containing 3 values that represent an average of the system load in the last 1, 5 and 15 minutes respectively.…
-
2
votes1
answer1177
viewsA: Place exceptions in the proxy by batch
Exceptions are in the item ProxyOverride which is a REG_SZ containing a semicolon-separated list of domains (;). You can add so: REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet…
-
2
votes3
answers2361
viewsA: Remove URL parameter with Javascript
If you do so it works: window.location = document.URL.replace('&a=editar',''); Remembering that the page will be reloaded.
-
1
votes1
answer148
viewsA: Minus In App Purchase (IAP) Swift Ad
The problem is that when ViewController() is called it creates a new class instance ViewController and when you try to access bannerAd the program breaks because bannerAd is nil. To be able to…
-
2
votes2
answers1104
viewsA: File Upload Multiple via ajax - PHP
The problem is that you create the FormData to send but as it does not add any of the files in it and your POST ends up going empty. See how you can do: var $jq = jQuery.noConflict();…
-
2
votes1
answer7122
viewsA: Sign documents with digital certificate using php or js
The library TCPDF can be used to add the certificate to the PDF. On their website there is a complete example creation and signature, but since you need to sign an existing PDF I suggest you take a…
-
3
votes1
answer188
viewsA: generate php image without saving to disk and send attachment
It is possible using the function AddStringAttachment. In your case it would look something like this: $mail = new PHPMailer(); // .... ob_clean(); // limpa qualquer coisa no buffer de saída…
phpanswered André Ribeiro 5,137 -
2
votes2
answers628
viewsA: Use validation function in different HTML fields
You can use a class to apply validation. In this case I used the class nif in the inputs. $('.nif').blur(function(){ var contribuinte = $.trim($(this).val()); var temErro=0; if (…
-
3
votes2
answers2804
viewsA: How to pass commands to a . exe via C#?
You can do it like this: First import the function SetForegroundWindow of user32.dll in your class: [DllImport("user32.dll")] static extern int SetForegroundWindow(IntPtr point); And to send the…