I have a general question about best practice in OO Delphi. Currently, I put try-finally blocks anywhere I create an object to free that object after usage (to avoid memory leaks). E.g.:
aObject := TObject.Create;
try
aOBject.AProcedure();
...
finally
aObject.Free;
end;
instead of:
aObject := TObject.Create;
aObject.AProcedure();
..…
I'm trying to check if a table already exists, however I can't get this working.
IF EXISTS (SELECT 1
FROM sysobjects
WHERE xtype='u' AND name='tablename')
SELECT 'table already exists.'
ELSE
BEGIN
CREATE TABLE Week_(
id INT(10)AUTO_INCREMENT PRIMARY KEY (id),
...
...)
…
Hi,
i'd like to just checkout the files without the .git files and the whole repository. It's because i'd like to manage a website (php & html) with git and i'm looking for an easy way to update the files in the htdocs folder from the repository, without having the repository public. (now it's in the home-dir and is accessed via ssh, but…
I'm trying to implement the flood fill algorithm. But glReadPixels() is returning float RGB values of a pixel which are slightly different from the actual value set by me, causing the algorithm to fail. Why is this happening?
Outputting returned RGB values to check.
#include<iostream>
#include<GL/glut.h>
using namespace std;
…
In my JSP page I am using post method while submitting the page.
So once I go from Page 1 to page 2. In Page 2, If I press F5 I am getting alert as
"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."
I knew this question is a bit…
I read the mails from my gmail account with the code following below.
import poplib
pop_conn = poplib.POP3_SSL('pop.gmail.com')
pop_conn.user('user') # result: '+OK send PASS'
pop_conn.pass_('password') # result: '+OK Welcome.'
print pop_conn.list()[1]
pop_conn.quit()
It shows me 1 message as expected.…
Hi. Could anyone advice a book (or any other source) that would thoroughly reveal internals of JVM memory management & garbage collection (optimization, work, circular references, pecularities, discussions for various JVM impls...)?
[What I've found so far are separate articles devoted to various aspects but no weighty…
Hi!
I've seen projects which use many screens each one for different layout and functionality.
I've seen projects with only one screen (like wizard workflow) where content is changed on user interaction (and this seems to be logical to use single screen in wizards).
But also I've seen projects (apps like game or…
It is better to explain my intention with code. So right now I have the following code:
class A, IInterfaceUsedByB
{
}
class B
{
void func(A someObject)
{
func2(someObject, 1);
func3(someObject, "string");
func4(someObject, new MyObject());
}
func2(A someObject, int val);
…
I'm working with MS Excel interop in C# and I don't understand how this particular line of code works:
var excel = new Microsoft.Office.Interop.Excel.Application();
where Microsoft.Office.Interop.Excel.Application is an INTERFACE defined as:
[Guid("000208D5-0000-0000-C000-000000000046")]…
My source:
public class MainActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
@Override
public boolean…
I am trying to retrieve app engine logs the only result I get is "# next_offset=None", below is my code:
internal string GetLogs()
{
string result = _connection.Get("/api/request_logs", GetPostParameters(null));
return result;
}
private Dictionary<string,…
Hi,
I have 54 excel files with three sheets each, each sheet has a different amount of data entries but they are set out in a identical format, and I need to import the data from those sheets into a single workbook using VBA.
Is there any way I can program it so I can build the loops to…
Group policy prevents several configuration settings on my Windows 7 / Vista machines. Since my domain account is a member of the local Administrators group on these boxes, is there still a way to override them locally?
For instance, GP prevents changing the power management option "Turn…
What is your advice on:
compensation of accumulated error in bulk math operations on collections of Money objects. How is this implemented in your production code? (things like variable rounding, etc...)
theory behind rounding in accountancy.
any literature on topic.
I currently read…
Content-Length header is missing when I try to download rar, exe, msi static files, though response for images contains Content-Length, but if I change rar extension to jpg it doesn't.
How do I solve this?
I have two different areas, and I have a route in one of those areas that is specific to that area, but I need to generate a link to that route using Html.RouteLink from another area (it's how you get over into the new area) but it won't work... It doesn't seem possible to use RouteLink…
Suppose I have two .h files: A.h and B.h.
Moreover, A.h includes B.h itself:
B.h - declares class B.
class B {
...
};
A.h - declares class A, which uses class B.
#include B.h
class A {
void SomeFunction(const B& b);
};
Now, I have some .cpp file, that uses both A and B…
I want to compare two strings using Java. First sting name i get from .mif file using GDAL in cp1251 encoding. Second kadname i get from jsp. To compare i do this:
if (attrValue instanceof String)
{
String string3 =
new…
I have a php script which takes a relative pathname via $_GET, reads that file and creates a thumbnail of it. I dont want the user to be able to read any file from the server. Only files from a certain directory should be allowed,…
I have a SQL Query:
SELECT documents.*, t_rights.rights, documents_list.docs
FROM documents
INNER JOIN t_rights on t_rights.num=documents.type_right
INNER JOIN documents_list on documents_list.num=documents.document1
WHERE…
As the question states, is it better if a student diversifies or explores when learning programming languages or should they focus only on 2-3 languages and really get to know them well?
Example of what I mean by…
Hi,
I have a general question about best practice in OO Delphi. Currently, I but a try finally block around everywhere, where I create an object, to free that object after usage (to avoid memory leaks). E.g.:
…