Posts by stderr • 30,356 points
651 posts
-
1
votes1
answer863
viewsA: Load listview lines from an Opendialog
The method LoadFromFile is not available on Listview, what you can do is upload the file information to a StringList and popular the Listview with TListItem. Take an example: procedure…
-
1
votes1
answer1015
viewsA: Problem handling text files with python
This is because the line is being read from the variable entrada, the correct one would be to obtain it from the variable linha. Your code should look like this: entrada = open('Pessoas2.txt', 'r')…
-
2
votes1
answer82
viewsA: Concatenate hierarchy
You can filter this information by class (title, article or chapter) and put them in a associative array. Use the function below instead of the function obterID: function retornarInfo($texto,…
-
5
votes1
answer6034
viewsA: Explode in PHP returns Undefined offset: 1
You are trying to access a value whose index is not available on array. The example you posted is functional: function extrai($string) { $peca1 = explode('id="', $string); $peca2 = explode('">',…
-
2
votes1
answer90
viewsA: Assembly error A2119
There are three errors. The first two errors are in the second line, model falt, stdcall, you should put the point . in front of the model, getting .model and use flat in place of falt. The last…
-
3
votes1
answer2375
viewsA: How to compile this code in Assembly on Windows?
To compile this code, you must use the compiler of MASM, nay NASM, sane assemblers distinguished. For your code to execute, make the following changes: Below the directive .model, use the directive…
-
3
votes1
answer1205
viewsA: How to make a batch file run a Console Application by passing parameter?
You can use the command start to run the file. @echo off start /b consoleApp.exe foo And to receive the arguments passed the application do: static void Main(string[] args) { foreach (string arg in…
-
1
votes1
answer792
viewsA: Transitions, Effects for Winforms . NET
It can be manipulating property Opacity of the form to obtain this effect. Below is a example: Public Sub fadeIn() For fade = 0.0 To 1.1 Step 0.1 Me.Opacity = fade Me.Refresh()…
-
1
votes1
answer280
viewsA: HTML Parser in Xamarin
According to Article Data Extraction in Mobile Apps, the Html Agility Pack can be used to do this. Htmlagilitypack allows you to parse HTML documents. Unlike of traditional XML parsers, it is able…
-
10
votes5
answers4587
viewsA: How to remove ddd from a number
One of the possible solutions is to use substr. $numero = 5198765432; $ddd_cliente = substr($numero, 0, 2); $numero_cliente = substr($numero, 2); echo "DDD: {$ddd_cliente} Número:…
-
1
votes1
answer455
viewsA: Rowcommand VB.Net
One of manners to do this is to use the property DataKeyNames of GridView. To use it, simply specify the name of the column(s) in DataKeyNames. <asp:GridView ID="gvLivros" runat="server"…
-
0
votes3
answers84
viewsA: String Replacement for Array
You can go through the array with the foreach and check if a value is found with the function strpos: $simbolos = array("’" => "apostrophe", "" => "apostrophe", "(" => "parentheses", ")"…
-
4
votes1
answer610
viewsA: Delete the last value in an array
You can also use the method pop() array = ["t", "e", "s", "t", "e", "_", "t", "e", "s", "t", "e"] p array array.pop() p "Deletando" p array # ["t", "e", "s", "t", "e", "_", "t", "e", "s", "t", "e"]…
-
3
votes5
answers1659
viewsA: Default parameters
PHP does not yet have named parameters, as there is in the Python, therefore, what can be done (in addition to the alternatives already mentioned) is to pass a array as a parameter for the function.…
-
3
votes1
answer343
viewsA: What parameters to use in the mysql_fetch_array
I just wanted to know what exactly I should put in the second parameter of mysql_fetch_array. The second argument is optional, indicating what type of array must be returned. The possible values…
-
3
votes3
answers1471
viewsA: Use Command Line with C#
Follows a variant of the code posted by Guilherme Nascimento: public void ExecutarComandoSSL(string arquivoCNF, string arquivoCSR) { using (System.Diagnostics.Process processo = new…
-
7
votes1
answer281
viewsA: Is it possible to use the "break" argument on a "switch" to interrupt a loop?
It is possible yes. According to documentation on the break: break accepts an optional numeric argument that tells it how many nested structures it should finish. Documentation on the continue:…
-
4
votes1
answer526
viewsA: Delphi 7 x64 record
Perhaps it is necessary to pass the value KEY_WOW64_64KEY in the builder. // Uses Registry; procedure inicializarPrograma(App, Caminho: string); const KEY_WOW64_64KEY = $0100; var Reg: TRegistry;…
-
4
votes1
answer245
viewsA: Error [Forbidden] when sending event in google calendar, googleCL API
The problem is that the Googlecl uses version 2 of Calendar Gdata API, that was discontinued in November 2014: Any Calendar Gdata API dependent service (v1, v2), such as o Google Calendar Connectors…
-
3
votes3
answers11278
viewsA: How to force a PDF to be displayed in the browser
As already mentioned by Ivan Nack, this will depend on the browser, there is how to manipulate the header Content-Disposition, but it will depend on how the browser will handle the file, as there is…
-
15
votes2
answers1806
viewsA: Why does a calculation with positive numbers give a negative result?
The operation 100 x 22118400 results in a value exceeding capacity (2³¹ -1 or 2147483647) that a whole of 32-bits can bear, which causes a Integer Overflow, an overflow. Normally the JVM does not…
-
4
votes1
answer437
viewsA: Urllib2, exception handling
You should treat this error in a block try...except, when the function urlopen cannot open a page, an exception HTTPError is launched (is a subclass of URLError), so to treat it do the following:…
-
4
votes2
answers2442
viewsA: Run a java Jar by Delphi
In addition to manners cited by Caputo, it is possible to use the function ShellExecuteEx to execute the jar, save to a file and upload it to a TStringList. Something like this: function…
-
2
votes1
answer479
viewsA: How to simulate a form action=POST with urllib2
You should not be able to log in because it is being declared the input type button, not the name. data =…
-
13
votes3
answers505
viewsA: What are the native exceptions of PHP?
As native exceptions sane: BadFunctionCallException Occurs when a callback refers to a function indefinite or if some arguments are missing. BadMethodCallException Occurs when a callback refers to a…
-
5
votes1
answer183
viewsA: Collect shared URL statistics on Facebook using Python
You can use the functions urllib.quote_plus to format the URL and urllib.urlopen to make the request and get the answer. To manipulate the JSON, use the method loads module json. import urllib, json…
-
12
votes2
answers1195
viewsA: Difference from #! in the first line of a Python script
The shebang #! /usr/bin/python when used will perform /usr/bin/python, while /usr/bin/env python will execute the Python according to the environment variable PATH that is, according to the system…
-
1
votes3
answers3638
viewsA: json_decode returns null
The json_decode fails because the value it receives contains characters Unicode, probably GOOD (Byte Therder MArk). One of the ways around this is to use the function utf8_encode before calling…
-
2
votes3
answers626
viewsA: How does php guarantee a single session_id?
To see how the identifier is generated, it is enough look at the code, basically it is based on MD5 by default, but can be SHA1 or another. Other ingredients: IP address of client - L298. Current…
-
6
votes1
answer567
viewsA: How to convert this code from Python version 2 to 3.4?
Some changes should be made to the code to work as expected in Python 3. In versions prior to Python 3 print was an instruction (statement), from Python 3, it is considered a function, and so some…
-
7
votes3
answers1055
viewsA: Is there any performance gain when using ternary operator instead of a conditional operator?
Both are equal, neither is better than the other, if there is any difference, she is insignificant, the only advantage of a ternary operation is readability and a code more clean. Using one or the…
-
1
votes1
answer121
views -
0
votes1
answer138
viewsA: Justify text with Textalignment on Windows Phone 8
As the message says, Justify is not supported on textBlock. According to this page of MSDN this value is not valid in Silverlight 3. Alternatively, control can be used RichTextBox.…
-
6
votes1
answer3700
viewsA: How to make a POST request in Python?
There are several ways to do this what you want, the most common are with the use of module functions urllib, httplib (in Python 3 is http.client) or requests. To page that you want to make the…
-
2
votes1
answer1502
viewsA: Wait to finish the thread before ending the program
In addition to the mode mentioned by Felipe Avelar using the method Thread.is_alive(), there is also the method Thread.join(). Both can be used together. When Thread.join() is called, says the…
-
3
votes1
answer442
viewsA: How to use acute accent inside a string in a bash script?
You may need to specify the version of Mozilla to be used, for example Mozilla/5.0. Here there are other options. The second example will look like this: #!/bin/bash echo 'iniciando program' wget -U…
-
1
votes1
answer5597
viewsA: How to remove a line from a text file
In function eventos_linkers where you have: menubar.add_cascade(label = link_options[1], command = lambda: delete_links(listbox, items, f, line, item)) Remove the lambda for he is not needed in this…
-
3
votes1
answer2920
viewsA: Regular expression in Delphi 7
For versions prior to XE, there are alternatives like Tregexpr that is free. Frequently asked questions Syntax Methods and properties In the latest versions of Delphi there are native stand, the…
-
1
votes1
answer171
viewsA: Write a php document inside a php block
The way you are delimiting the text may not be correct. You use quotation marks " to delimit the contents of the variable, but within it there are several quotation marks, so the text breaking. In…
-
1
votes3
answers1382
viewsA: How do I delete a file, which has quotes in the name, by CMD?
Windows does not recognize files that have special characters, so he understands that this is an invalid file. One way to remove these files is by running the chkdsk with the parameter /f. chkdsk o:…
-
4
votes2
answers1914
viewsA: Multiple JDK/JRE
According to this guide of Oracle is possible. The page also mentions: Several versions of JRE can be run in different browser sessions. However, several versions cannot be run in the same browser…
-
4
votes1
answer891
viewsA: How do I update C++ to C11 on Ubuntu 14.10?
In your specific situation there is nothing to be updated. As this your comment you use the version GCC 4.9.1, that supports the standard C11. According to the GCC Wiki: GCC 4.9 Changes: "ISO C11…
-
2
votes1
answer519
viewsA: Ping - store positive results in a list
One way to know this is to check the function return subprocess.call, is returned 0 if successful, or 1 should I fail. To save the results in a list you will have to create a array: lista = [] In…
-
4
votes5
answers1617
views -
2
votes1
answer1179
viewsA: Check if user exists
The command getent should work in this case. getent passwd <usuario> The command getent displays database entries supported by Service Switch, which are configured in the file…
-
2
votes2
answers949
viewsA: How to know the current state of the form?
To get or change the status of a form, use Form.WindowState. MessageBox.Show(WindowState.ToString()) ' Normal, Maximizado ou Minimizado ' Or if you need to perform an action in a given state, you…
-
3
votes2
answers151
viewsA: How to get IIS information via c#?
One of the probably possible ways to do this is through consultations by WMI. Some information can be seen on the page IIS WMI Provider. To work with the IIS and WMI, it is necessary to use the…
-
2
votes2
answers2951
viewsA: Copy file content to clipboard on Windows
For Windows you can use the module win32clipboard, if you prefer an alternative cross-Platform, the module pyperclip. Example of module usage win32clipboard (untested): import win32clipboard…
-
2
votes2
answers3087
viewsA: Accent problem, running at Windows Prompt
Since Python 3 there is no need to prefix the string with the character u, whichever string is already created using Unicode. You are specifying the encoding in the wrong way, the right is: # -*-…
-
2
votes1
answer130
viewsA: Check running of execCommand in firefox ('Copy' command)
Perhaps the mode you are using to verify the execution of a command is not the most appropriate. According to the page HTML Editing Apis, section Supported commands: Some commands will be supported…