Posts by water • 971 points
34 posts
-
1
votes0
answers71
viewsQ: How to open encrypted . zip files?
I am trying to open . zip files with password, using existing passwords in other file. txt. The code function that opens the file: package main import ( "bufio" "fmt" "os" "time"…
-
3
votes1
answer54
viewsA: How to open files with accent on name - Filenotfoundexception
You need to convert the String with the File name to UTF-8: byte[] isoBytes = strISO.getBytes("ISO-8859-1"); String ISOtoUTF = new String(isoBytes, "UTF-8"); Use in the code: public void ler(String…
-
1
votes1
answer54
viewsQ: How to open files with accent on name - Filenotfoundexception
The path to the files are in a String array. Some files have accented name and are generating FileNotFoundException /** * Realiza leitura dos dados de um arquivo. * @param s - string com endereco do…
-
7
votes1
answer1023
viewsQ: What is a Great Algorithm?
I’m taking classes from Introducing the Analysis of Complexity. I was told that an example of an optimal algorithm is the algorithm for finding the smallest value between elements of an array of…
-
5
votes3
answers177
viewsQ: Why does the this(6) command inside a constructor initialize the class array?
In the code: public class Lista{ int [] a; int n; public Lista(){ this(6); } public Lista(int i){ this.a = new int [i]; this.n = 0; } public static void main(String [] args){ Lista l = new Lista();…
-
2
votes1
answer109
viewsQ: Operation Logica in C
I’m trying to make a program to check if a certain word is a palindrome. I’m having trouble with a logical operation that isn’t returning what I expected. #include <stdio.h> #include…
-
1
votes1
answer88
viewsQ: split does not return array with the string elements
I’m having trouble using the method split, that is not returning me the array with the elements of the string. public class Teste{ public static void main (String[] args){ String s = "0.101110";…
-
1
votes2
answers3235
viewsQ: Format Localdate and pass as Parameter
I have a Method: private void tratarIFMandato(String [] d){ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); LocalDate dt1 = LocalDate.parse(d[0].trim(), formatter);…
-
0
votes1
answer1629
viewsQ: Generate random characters with the Random class
I was given the following code to help in the resolution of an exercise. Random gerador = new Random(); gerador.setSeed(4); System.out.println((char)(’a’ + (Math.abs(gerador.nextInt()) % 26))); I…
-
0
votes2
answers250
viewsQ: Run . java that imports another class in the terminal
I am trying to run my program on the terminal, as it matters another class I am using the command: javac -cp ./IO.jar MeuPrograma.java The program compiles the .class. However when running with:…
-
-1
votes2
answers162
viewsQ: Filter common elements in two Arrangements
How do I achieve a third arrangement with the intersection (common elements between the two arrangements) between two arrangements without repetition? int [] a = {1,2,3,4,5,6,7}; // arranjo 1 int []…
-
0
votes1
answer37
viewsQ: ERROR: Function to insert word in string
I wrote a function to receive a string, a character and a position . /** * Funcao para inserir um simbolo em certa posicao valida ENTRE outros * em dada cadeia de caracteres. * @param a - cadeia de…
-
2
votes2
answers134
viewsQ: Program completion condition in C!
I have a program in C where the output should be the average of the numbers typed and how many of these values were typed are larger than the average. the program receives up to 100 F values, where…
-
1
votes2
answers926
viewsQ: Recursive function to calculate the number of lowercase letters in a character string
I was able to do a function to return a given character at an X position of a string: public static char funcao (String texto, int indice){ if (indice == 0){ return texto.charAt(indice); } else {…
-
2
votes2
answers611
viewsQ: Java recursive function to calculate: e = 1 + 2/1 + 3/2 + 4/3 + 5/4 + ... + n/(n-1)
My code: /** * Funcao para calcular: e = 1 + 2/1 + 3/2 + 4/3 + 5/4 + ... + n/(n-1) * * @param termos - quantidade de termos do somatorio * * Teste: * para termos = 4 * soma = 1 + 2 + 1.5 + 1.33... *…
-
3
votes2
answers920
viewsQ: Recursiveness: Compute the sum of the first positive odd values starting at 5
I’m doing some exercises on and I stopped on this a few days ago. I got to the following code: /** * Funcao: Soma dos primeiros valores ímpares positivos começando em 5. * @param quantidade -…
-
1
votes1
answer2125
viewsQ: Table editing, Datefield field
In one of the Insert’s of my application, I have a field Datefield, At first there is no error when saving the dates in the Database (Sqlite3), i inform a date in format DD/MM/AAAA, and she is saved…
-
7
votes2
answers35240
viewsA: How to develop programs for Android through Python?
You can take a look at the framework Kivy, it is open source, developed in Python to program in Python, focused on modern applications, being cross-platform, multi-touch, open source, simple and…
-
1
votes1
answer1069
viewsQ: Automatic filling of fields
I’m developing a applying with Django (1.6.2) and Python 2.7 for learning, the application performs registration, searches and edits in DB, in one of the registrations I perform I would like to…
-
1
votes1
answer3634
viewsQ: Where to place the connection string with the database?
I have the form: Already created the database and table for registration, I am using wampserver and Mysql Workbench. My question is where to place the connection string: MySqlConnection conn = new…
-
2
votes1
answer360
viewsQ: Handling xml treat strings as if they were files
I’m getting a xml in the format of string in my Sponse. I want to manipulate this xml and generate a list of tags <item> xml returned by web service. Here’s the snippet of my code: if (op ==…
-
1
votes1
answer297
viewsA: Python - HTTP Digest authentication with urllib2
So far I’ve come up with the following answer: Creation of a password manager, causes the user and password to be used as authentication elements: oPass = urllib2.HTTPPasswordMgrWithDefaultRealm()…
-
2
votes1
answer297
viewsQ: Python - HTTP Digest authentication with urllib2
I needed to authenticate on a test server to consume a service on a webservice, I managed to make the authentication and generate xml with the following code based on a code of Soen operacao =…
-
4
votes1
answer1309
viewsQ: Django - Editing tables (Update)
In my application I have a function to search a person by name and edit data of a registered person... When I search and there is more than one person registered with that name (or even when there…
-
3
votes1
answer778
viewsQ: Django - How to distinguish which button was clicked?
In my application’s search template I have 3 tags <button>, one to search, the other to edit and the other to delete: <button class="btn btn-lg btn-primary" type="submit" id="buscar"…
-
3
votes1
answer146
viewsQ: Django - How does Developer @login_required work in views from another app?
I have a project in Django and only an application where I do registration, searches, login to the system, etc. I was reading an article about the creation of projects and saw that for the sake of…
-
1
votes2
answers8336
viewsQ: How to center the <th> header of an HTML table with css?
My table: <table id="tabela"> <th id="cabecalho" >Ação</th> <tr id = "linAcao" > <td><a href="#"><img src="Acao.jpg" title=""/></a></td>…
-
3
votes1
answer495
viewsQ: Django - How to treat Exception returned when I try to access a view protected by Developer @login_required?
When Exception occurs I want to redirect to a denied access template! The project in Github py views. # -*- coding: utf-8 -*- ## --------------------------- IMPORTS from django.shortcuts import…
-
2
votes2
answers3857
viewsQ: Django - How to redirect the user to the other pages of the application?
In the menu of the template I have a menu Dropdown with the links to the other pages of the app! In the menu of the home page of the application I have the links to the other pages of the…
-
2
votes1
answer119
viewsQ: Page display error - Django
At Django I’m developing a Library project! (I’m Beginner at Django, I’ve never worked with web development) Summarizing I have in the file models.py a model Library and a model Book, in the model…
-
2
votes1
answer1489
views -
3
votes1
answer802
viewsQ: How to link the Forms created in Django to the forms already created in the HTML template?
I started to see about forms in Django, only I had already created in templates of my project the forms with all inputs necessary. With the creation of forms in Django there is a way for me to link…
-
1
votes1
answer1397
viewsQ: How do I use Template Inheritance to inherit Style Sheets (css) in my Django project?
I have a base.html template and another library.html template that is inheriting base! I managed to inherit most of the base.html, but when I try to add another link tag in the Style block Django…
-
6
votes2
answers7033
views