Posts by peterq • 990 points
33 posts
-
1
votes3
answers1761
viewsA: How to convert a String to Date on Swift
Simply put, you must do just that: let dateString = "2016-09-16T21:09:22.031-03:00" // Data de entrada let dateFormatter = NSDateFormatter() //Instância do date Formatter //Aqui você DEVE indicar…
-
1
votes1
answer157
viewsA: Change APP icon in IOS Runtime
Programmatically you can’t do that! You can automate your Build using Fastlane and write a script for you to publish to each client automatically. Check out their github:…
-
0
votes1
answer71
viewsA: Error post in Swift with still
FAILURE: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.} FAILURE This error means you are passing your…
-
1
votes2
answers81
viewsA: Swift: Fixed header on a Tableviewcontroller
Use a Uiviewcontroller instead of a Uitableviewcontroller. Create your screen with your view that you want to leave fixed and your tableview right below. In his Uiviewcontroller also inherit a…
-
1
votes4
answers22787
viewsA: Sum Javascript Array
Test this out here: If you add parseint() in test[i] solves your problem. var quant = document.getElementsByName("valor[]"); var teste = []; function somarValores(){ var soma = 0; for (var i=0;…
javascriptanswered peterq 990 -
0
votes0
answers279
viewsQ: How to test private functions?
I have a controller with some functions: angular.module('teste.controllers') .controller(TestCtrl, function($scope){ var vm = this; vm.funcTest = function(){ return 1 + 1; } function _testSoma2(){…
-
3
votes3
answers119
viewsA: How to remove a link from a string in Javascript?
var test = test.description.replace(/.*?:\/\//g, "");
-
7
votes3
answers119
viewsQ: How to remove a link from a string in Javascript?
How can I remove the link from a Javascript string? str = "hey olha isso http://google.com, legal né?" var test = str.description.replace(/.*?:///g, ""); Expected result: hey look at that, cool…
-
14
votes4
answers7972
viewsQ: How can I make a copy of an array without reference?
I would like to know how to make a copy of an array without reference. Example of what I would like to do: var a = [1,2,3,4]; var b = a; a[0] = 3; b[0] = "nao me copie!" console.log(a[0]) //mostrar…
-
3
votes2
answers891
viewsQ: How to change the class of a :after in Angularjs using ng-class?
I have a div with an after and would like to change the background color of that after dynamically via controller, however I am not succeeding in importing ng-class in parent div. <div…
-
2
votes2
answers88
viewsQ: How do I edit the width of a class using Angularjs?
I have an element with two classes: <div class="classe1 classe2"> </div> I want to increase the width of my class 2 style, what would be the right way to do this?…
-
1
votes3
answers10174
viewsQ: How to Add and remove items from a json easily?
I have a json similar to this [{id: 1, titulo: 'compra', valor: 50.00, data:'2014-10-23' },{id: 1, titulo: 'compra', valor: 60.00, data:'2014-10-24' } ] I have a function to add, which adds a new…
-
3
votes3
answers6238
viewsQ: How to change an item in a json
I have a JSON array like this: [{ id: 1, total: 50.00 }, { id: 2, total: 70.00 }] I would like to know how to add/change an item into a id only. As if in SQL. For example, in case I wanted to change…
-
0
votes1
answer953
viewsQ: How do I add an animation while loading a request?
I’d like to know how to use Interceptor in a $http request from my project. The animation you’d like to run while the request is being made is a loading done in css. Could someone explain to me…
-
0
votes1
answer35
viewsQ: Nsstring to Nsdictionary conversion always null
I am converting Nsstring to Nsdictionary but when I step inside a variable always returns null. what I am doing: NSDictionary *json = [NSJSONSerialization JSONObjectWithData: [body…
-
3
votes3
answers1008
viewsQ: How to improve my code (many If’s and Else’s)
I have a function to search a json locally and change the data of some Fields. however, I do not want to test if the field is with the status code and depending I change with the correct value for…
-
0
votes1
answer1275
viewsQ: Search for element in an array using array.foreach
I have a grid where on each line there is a button to delete the corresponding data. This grid is powered by a json but there is no id. I wonder how I could delete the selected object, being that…
-
3
votes2
answers311
viewsQ: How to check if it is a URL in input text?
How can I check whether what the user typed in an input text is a website?
-
3
votes2
answers4665
viewsQ: How to convert milliseconds to date
I would like to know how I can make a millisecond to date conversion within a field in a json. For example $http.get("http://teste").success(function (dados) { ng.locations = $.map(dados,…
-
0
votes1
answer618
viewsQ: How to Capture Usage Time of Apps Installed on Android
I wonder how I could capture the usage time of all apps installed on Android. There are some apps that do this in the Play Store. I have been doing several searches and found that there is a code…
-
2
votes4
answers864
viewsQ: How to set Background-image with SVG hosted elsewhere
I’m making a website that needs to pick up a svg from another site (www.teste.com.br/image.svg) and set it as the background. But I’m not getting it. go on like I’m doing: <html> <head>…
-
7
votes3
answers16195
viewsQ: How to replace src of an img tag?
I have an html page that shows an image for each day of the year. Images are organized in folders for example /img/o1/o1.jpg (for January 1) and so on. My html is simple I want you to take today’s…
-
3
votes1
answer444
viewsQ: How does Html5 cache work?
I have a webapp and I would like it to have a cache so that I don’t keep accessing it all the time. My webapp constitutes an index.html that parses on other websites. So every time the webapp opens…
-
0
votes1
answer449
viewsQ: How to take photo via services on android?
I need to develop an app to take photos without the user noticing, as in the anti-theft programs that exist today. I need the phone to open the camera app and take a picture when the phone or phone…
-
7
votes1
answer4778
viewsQ: How to read content from a Javascript site?
I would like to know how to read content from other web pages using javascript or some library only. For example, from a remote news site, in this case: www.terra.com.br. And I would like to create…
-
2
votes1
answer760
viewsA: Angularjs $http.get(localhost/test) does not work in Chrome
I found the answer! Look: Definition of explicit domains: (1, 2, 3 and 4) Javascript configuration: With jQuery/Zepto: function verificaCodigoTurma(codigo, retorno) { try { $.support.cors = true;…
-
2
votes1
answer760
viewsQ: Angularjs $http.get(localhost/test) does not work in Chrome
In my controller I have a $http.get(http://www.testesitelocal.com:18888/teste_json) that returns the values of the JSON test. I make this request on my local machine. In the Webview I made in Javafx…
-
2
votes2
answers1138
viewsQ: Netbeans - How to Generate a Jar with Dependencies without Maven
I have a project in Netbeans, but I only know Maven and have some project dependencies. If you build or even run Netbeans everything works smoothly, but I wanted to get the jar and test on other…
-
2
votes6
answers293
viewsA: How to visually indicate which fields are fillable?
You MUST place the editable fields with the white background and those blocked with gray background and the source a little clearer. only this already solves the problem, gives a highlight to what…
-
0
votes2
answers1588
viewsA: Grid with auto refresh html + Angularjs
Answering my own question! I did it this way: var app = angular.module("teste", []); app.controller("GridController", ['$scope', '$http', function (ng, $http) { //Crio uma flag 'local_data' var…
-
3
votes2
answers1588
viewsQ: Grid with auto refresh html + Angularjs
Well I have a grid and it needs to be ALWAYS updated because it contains information that needs to be updated dynamically. This grid is populated with a Rest flame that returns me a json. I need the…
-
1
votes2
answers969
viewsA: HTML Desktop app with Node.JS + Socket.IO
Why don’t you continue exactly as you are and run on top of a javafx webview? Like the phonegaps of life do! It will even run in coffee maker and with javafx java + javascript + webview.engine you…
-
2
votes1
answer368
viewsQ: Programmatically close jar
Currently I have a program JAVA(main), which from it calls another program JAVA (son)... this is OK.. but when I close the main program, I also want to close the son program. I’ve tried to:…