Posts by augustomen • 1,650 points
10 posts
-
1
votes1
answer127
viewsA: Mock a raw_input
It may be too late, but if anyone ever needs it, it is possible to mock built-in functions: >>> with mock.patch('__builtin__.raw_input', return_value='abc'): ... print raw_input('Entre com…
-
6
votes2
answers1269
viewsA: Parameter varchar in Store Procedure
You will need to mount an SQL dynamically, using campo as a variable: CREATE PROCEDURE nome_procedure(campo VARCHAR(15)) BEGIN SET @temp1 = CONCAT('SELECT id as id, ', campo, ' as value FROM tabela…
-
3
votes2
answers7019
viewsA: Tkinter focus a window ignoring the back?
His original proposal was simply to bring the window forward when it had already been opened. This is accomplished by the following code: #-*- coding:UTF-8 -*- from Tkinter import * class novo: def…
-
0
votes1
answer1266
viewsA: Help Tables python27
Would using a Treeview suit you? It’s not editable as a Datagrid, but you can achieve it in other ways. That code is amply post-based Tkinter Multi-column List Demo (suggest a visit): import Tkinter…
-
2
votes3
answers3271
viewsA: How to receive a vector, whose values are separated by spaces
If this is what you want, to receive a string with number and then convert them, use the following code: >>> s = "1 2 3 56 88" >>> map(int, s.split()) [1, 2, 3, 56, 88] Explaining:…
pythonanswered augustomen 1,650 -
1
votes1
answer788
viewsA: Row sorting in a table with SQL SERVER
Maybe I’m being too simplistic, but you can do this ordering with 2 updates conditional: DECLARE @idC BIGINT, @novaOrdem INT, @oldOrdem INT; SET @idC=1; SET @novaOrdem=4; --Obtém a Ordem do ID que…
-
3
votes3
answers3242
viewsA: How to get the last date of a day of the week in a given month in SQL Server?
I did a slightly different implementation of @utluiz: CREATE FUNCTION [dbo].[UltimoDiaSemana](@Data AS DATE, @DiaSemana AS INT) RETURNS DATE AS BEGIN DECLARE @UltimoDiaMes DATETIME DECLARE @DW INT…
-
64
votes11
answers8299
viewsQ: Should I write my program in English or Portuguese?
When I am writing programs, I usually write the names of variables in English (for example, fields, class_name, rec_number), for a number of reasons: Names in English don’t have accents, so there’s…
-
12
votes3
answers278
viewsQ: How to prevent Django from finding Ids in the template?
I’m using Django 1.4 with path (L10N) enabled, which causes the numeric values in the template to be formatted: 1.234,56. The problem is that every time I put one ID in the template, for example:…
-
52
votes10
answers34548
viewsA: What is the difference between the == and === Javascript operators?
According to the specification of Ecmascript, the triple === means "strict equality", ie only returns true if the operands are of the same type and value. To be more exact, the algorithm, in a…