input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
How do I use reflection to get the nested property <p>I am writing a TwoWay Binding control for ASP.NET. I finally got things working. I'm rebinding using the following code:</p>
<pre><code>private void RebindData()
{
// return if the DataValue wasn't loaded from ViewState
if (DataValue == null)
retu... | <p>Why not use ASP.NET DataBinder that already supports this?</p>
|
Doctrine profiler does not catch queries <p>I think I must be missing something obvious here. I have Doctrine and Zend Framework set up together. In the bootstrap.php file I have the following - based on the Doctrine documentation for using the profiler:</p>
<pre><code>$profiler = new Doctrine_Connection_Profiler();
$... | <p>There are better approaches, but this may be a better starting point.</p>
<p>Assuming the connection and profiler are setup during bootstrap, there are several initial attempts to develop a Doctrine resource plugin see <a href="http://www.nabble.com/RFC%3A-ZendX_Doctrine-to23454552.html" rel="nofollow">http://www.n... |
PropertyGrid in Java Swing <p>Does Java Swing have a control similar to the PropertyGrid in .NET?</p>
<p>if so, which one is it? Or at least which one comes closest to it?</p>
<p>Thanks!</p>
| <p>There is not a built-in component for this, but there are several third-party projects. In particular, <a href="http://sourceforge.net/projects/beanexaminer/" rel="nofollow">Java-Bean-Examiner</a> (GPL) looks promising.</p>
<p><img src="http://sourceforge.net/dbimage.php?id=114043" alt="Java-Bean-Examiner" />
<img ... |
Piping Batch File output to a Python script <p>I'm trying to write a python script (in windows) that runs a batch file and will take the command line output of that batch file as input. The batch file runs processes that I don't have access to and gives output based on whether those processes are successful. I'd like t... | <pre><code>import subprocess
output= subprocess.Popen(
("c:\\bin\\batch.bat", "an_argument", "another_argument"),
stdout=subprocess.PIPE).stdout
for line in output:
# do your work here
output.close()
</code></pre>
<p>Note that it's preferable to start your batch file with "<code>@echo off</code>".</p>
|
Standard Thread safe .Net Dictionary <p><a href="http://msdn.microsoft.com/en-us/library/3fcwy8h6.aspx" rel="nofollow">MSDN</a> points out that mutating access to the .NET <code>Dictionary<K,V></code> type is not thread safe. Is there a standard thread safe version?</p>
<p><em>Note:</em> "No there is not" is a v... | <p>There isn't. Consider this code, where each method/property was thread safe</p>
<pre><code>if (!SFdict.Contains(key))
{
SFdict[key] = value;
}
</code></pre>
<p>athough each action could be threadsafe, the block of code has a race condition, b/c there are two method calls and two different critical sections. The... |
Cant find the Error in this Php piece of code <p>Im getting T_String error on this code, its saying more accuratly on the 2nd line ($form['com...) and i simply cant see why.</p>
<pre><code>function _maxlength_comment_type_form_alter(&$form, $form_state, $form_id) {
$form['comment']['comment_max_length'] = arra... | <p>It might be this part:</p>
<pre><code>'comment_max_length_'. $form['#node_type'] -> type
</code></pre>
<p>Try getting rid of the spaces around the arrow?</p>
<p><hr /></p>
<p>Edit - I don't believe the above is actually a problem with the code, though I'd still recommend removing the spaces as a matter of sty... |
Is there a better onchange? <p>I've got a textarea, and when it changes, I'd like a function to be called.</p>
<p>However, the standard onchange event fires after the focus leaves the textarea. What I really want is for the even to fire as soon as the user begins typing.</p>
<p>I could bind onkeypress, but that doesn... | <p>You could add a </p>
<pre><code>onkeyup="SomeFunction();"
</code></pre>
<p>Edit: Aah, too quick. I did not see the "on mouse paste".</p>
<p>Edit 2:</p>
<pre><code><script type="text/javascript">
var ival = "";
var checkup = window.setInterval("checkChange();", 100);
function checkChange() {
... |
What is a good Fax Server to use? <p>Any recommendation of a Fax server to use in Windows? Looking for good API support for incoming faxes. (Lots of them are good for outgoing). I want to route incoming faxes to email programmatically after the server gets the fax and set Whitelist of phone numbers to filter spam - all... | <p>The two best solutions I have found are <a href="http://www.hylafax.org/" rel="nofollow">hylafax.org</a> and jConnect. The advantages of hylafax are its 100% free and open source. Since you are posting here its highly likely that you are have the technical chops to get this going and if you do you will be well rewar... |
Mapping enum values to a drop down (combobox) list in ASP.NET <p>I have an ASP.NET page with a drop down (asp:DropDownList) control. I also have a defined ENUM</p>
<pre><code>Public Enum myEnumType As Integer
A
B
C
End Enum
</code></pre>
<p>I want to define the "value" property of each asp:ListItem with one of ... | <p>The code doesn't make much sense. Why do you use Enum in this case? It's the same like using constants. It looks like you can get away with hard coding values.</p>
<pre><code><asp:DropDownList ID="myCombo" runat="server">
<asp:ListItem Text="cat" Value="A" />
<asp:ListItem Text="dog" Value="B"... |
How to build a dynamic query with SubSonic <p>I need to build (and run) a query based on different of conditions. When I was building a literal SQL to run, this would mean concatenating strings to build the SQL dynamically.</p>
<p>How would I do it with SubSonic? If for example I need to add a WHERE clause in some cas... | <p>Here's an example with v2.1+ and BaseClass set to RepositoryRecord:</p>
<pre><code>var q = DB.Select().From<Product>();
if (someCondition)
q.Where(Product.ProductIdColumn).IsEqualTo(1);
if (order == "ASC")
q.OrderAsc(Product.Columns.ProductId)
else
q.OrderDesc(Product.Columns.ProductId)
var re... |
How to set up a multi-developer Biztalk environment? <p>If we have 3 developers working on the same Biztalk project what is the best way to set up our development environment?</p>
<p>We are using TFS to store the Biztalk project.</p>
<p>Should we use 1 sql server and 1 Biztalk server and then have 1 or more developer... | <p>You will <em>always</em> want to have each developer have a complete BizTalk installation on their own machines. Believe me, it doesn't work otherwise, as you'll just keep getting on each other while trying to deploy/test/debug changes.</p>
<p>That said, you will also want a centralized dev/test environment where y... |
How to setup authentication in Silverlight-Enabled WCF Web Service? <p>What is the best way to set up username and password authentication in a Silverlight-Enabled WCF web service? </p>
| <p>The best way for me has been forms authenication...using ASP.NET application services.</p>
<p>Basically you expose 3 *.svc files in your WCF service that handle authenication, roles, and profiles. There is no code behind because it's built into the .net assemblies. You will have to do some configuration in the .con... |
How do I split a log file with an offset value in unix? <p>I have a really big log file (9GB -- I know I need to fix that) on my box. I need to split into chunks so I can upload it to amazon S3 for backup. S3 has a max file size of 5GB. So I would like to split this into several chunks and then upload each one. </p>
<... | <p>One (convoluted) solution is to compress it first. A textual log file should easily go from 9G to well below 5G, then you delete the original, giving you 9G of free space.</p>
<p>Then you pipe that compressed file directly through <code>split</code> so as to not use up more disk space. What you'll end up with is a ... |
Free C Language IDEs? <p>Googling for "c ide -C++" produces too many results for C++, as well as unrelated results. These search terms seem too short to produce relevant results. Does anyone have a link to a free, Win32 C IDE that does step-through debugging like Visual Studio?</p>
| <p>Visual studio has an express edition that´s free.</p>
<p><a href="http://www.microsoft.com/express/default.aspx">http://www.microsoft.com/express/default.aspx</a></p>
<p>EDIT: VS does compile C and C++</p>
<blockquote>
<p>Microsoft Visual C++ is Microsoft's
implementation of the C and C++
compiler and ass... |
PLSQL - Drop all database objects of a user <p>I'm trying to use a procedure (no parameters) to drop all of the user-created database objects located within the schema from where the procedure is launched, but I'm really not sure on how to go about this. Here's what I have so far, but I think I'm going about this the w... | <pre><code>create or replace
FUNCTION DROP_ALL_SCHEMA_OBJECTS RETURN NUMBER AS
PRAGMA AUTONOMOUS_TRANSACTION;
cursor c_get_objects is
select object_type,'"'||object_name||'"'||decode(object_type,'TABLE' ,' cascade constraints',null) obj_name
from user_objects
where object_type in ('TABLE','VIEW','P... |
What are some good ways to set a path in a Multi-OS supported Python script <p>When writing a Python script that can be executed in different operating system environments (Windows/*nix), what are some good ways to set a path? In the example below I would like to have the logfiles stored in the logs folder under the cu... | <p>Definitely have a look at <code>os.path</code>. It contains many of the "safe" cross-OS path manipulation functions you need. For example, I've always done this in the scenario you're outlining:</p>
<pre><code>os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logs')
</code></pre>
<p>Also note that if you... |
Cool UI templateing VS Jquery Templating <p>i have read this article <a href="http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx" rel="nofollow">ScuttGu</a></p>
<p>for making use of User control to make Cl... | <p>OK Encosia's (Dave Ward) example uses the JQuery plug-in JTemplate to do its works.
ScottGu's utilizes more of the ASP.Net stack.</p>
<p>That said, ScottGu's sample lacks some fineness.</p>
<p>As for performance...I hate that question. Too many variables. But...</p>
<p>ScottGu's example will be moving more bits... |
Static Constants in C# <p>I have this code;</p>
<pre><code>using System;
namespace Rapido
{
class Constants
{
public static const string FrameworkName = "Rapido Framework";
}
}
</code></pre>
<p>Visual Studio tells me: <code>The constant 'Rapido.Constants.FrameworkName' cannot be marked static</... | <pre><code>public static class Constants
{
public const string FrameworkName = "Rapido Framework";
}
</code></pre>
|
Convert string to CLLocationCoordinate2D <p>I have an array with NSString's in it. Some of these are latitude and longitudes and I need to use this with the below code.</p>
<p>The latText and lonText are my strings that I am trying to use as co-ordinates....</p>
<pre><code> CLLocationCoordinate2D pinlocation=mapVi... | <pre><code>pinlocation.latitude = [latText doubleValue];
</code></pre>
|
How can I insert a record in join table of a many to many hibernate annotation? <p>I have many to many relationship between two table and generate new join table in hibernate
now how can I insert a record in join table by updatation of both table
say two table are tbluser and tbldomain</p>
<p>I have to insert record i... | <p>I suspect you may be falling at the first hurdle:</p>
<p>As has been previously stated, Hibernate will update the object that you call <code>update()</code> on and then cascade down to any subsequent objects that require updating, following the rules you specify in the <code>@Cascade</code> attribute.</p>
<p>The p... |
Mate Framework - Check data before making remote call <p>Until recently I have been using cairngorm as a framework for flex. However, in this latest project I have switched to Mate. It's` still confusing me a little as I kind of got used to leaving data in the model. I have a couple of components which rely on the same... | <p>Most things in Mate are indirect. You have managers that manage your data, and you set up injectors (which are bindings) between the managers and your views. The injectors make sure your views are synchronized with your managers. That way the views always have the latest data. Views don't get updated as a <em>direct... |
how to improve my code to make better video quality? <p>I am using the following code to leverage Windows Media Encoder to record screen. I am using Windows Vista, screen resolution 1024 Ã 768ï¼ 32-bit. My issue is, the video could be recorded successfully, but when I playback the recorded video, the quality of video... | <p>Video encoders use a certain kbit/second ratio to limit the size of the generated stream. The fewer kbits/sec the less detail you will get due to fewer coefficients from the DCT and bigger quantization values. In other words: the more kbits/sec you put into the video the more detail can be stored in the stream by th... |
Can I use Unicode to decode an HTTP request? <p>I understand that the default encoding of an HTTP Request is ISO 8859-1.</p>
<p>Am I able to use Unicode to decode an HTTP request given as a byte array?</p>
<p>If not, how would I decode such a request in C#?</p>
<p><strong>EDIT:</strong> I'm developing a server, not ... | <p>As you said the default encoding of an HTTP POST request is ISO-8859-1. Otherwise you have to look at the Content-Type header that might then look like <code>Content-Type: application/x-www-form-urlencoded; charset=UTF-8</code>. </p>
<p>Once you have read the posted data into a byte array you may decide to convert ... |
Can the DataDource of a BindingSource be a property from and object on the form <p>For example:
I have an Contact object on the form (see below). Can i set the datasource propery of the BindingSource to be the property Contact.Addresses.</p>
<p>The class AddressCollection implements BindingList so there is no issue bi... | <p>In short, yes you can. However, if you need to change the contact you may want to set the DataSource to the contact (or the list of contacts) and use the DataMember to "Addresses".</p>
<p>Here's a simplified example showing such binding. If I have missed your point, please clarify:</p>
<pre><code>using System;
usi... |
Kohana PHP question <p>I have a database with a table named <code>shoppingcarts</code>. this table has the following 3 columns:</p>
<pre><code>id, sessionid, date
</code></pre>
<p>I have a function (<code>AddProductToCart</code>) in my controller (<code>ShoppingCart</code>). Inside my function, I have this call:</p>
... | <p>You are looking for the property 'loaded'. <a href="http://docs.kohanaphp.com/libraries/orm#loaded" rel="nofollow">Docs</a></p>
<p>It would look something like this:</p>
<pre><code>$obj = ORM::factory('shoppingcart')->where('sessionID',session_id())->find();
if($obj->loaded == TRUE)
{
// user has a sho... |
Do I have to run the delegate of an UIScrollView in another thread to prevent performance problems during scrolling? <p>I'm going to do some sophisticated things in the delegate's methods during scrolling. I'll also implement the dynamic preloading of contents, so that it's theoretically possible to scroll through a fe... | <p>You can only use UI classes from the main thread. So what you should do is to compute as much as possible in a background thread (I believe you can load your images in a background thread too), and then use <code>performSelectorOnMainThread:withObject:waitUntilDone:</code> to manipulate UI classes on the main thread... |
Query on three tables with 1 condition <p>I have the following tables:</p>
<p><strong>tags</strong></p>
<p>id tag_name</p>
<p><strong>examples</strong></p>
<p>id category heading</p>
<p><strong>examples_tags</strong></p>
<p>id tag_id example_id</p>
<p>How can I retrieve the number of examples under each tag? (a ... | <p>This is a 3 table join, using the many-to-many table examples_tags in the middle between the tags and examples tables. You also have to group by every column that is not an aggregate in the select list.</p>
<pre><code>SELECT t.id, t.tag_name, COUNT( *) AS 'no_tags'
FROM tags t
JOIN examples_tags et
ON t.id = et... |
firefox proxy settings via command line <p>How do I change Firefox Proxy settings via command line on windows xp/2k?</p>
<p>Thanks</p>
| <p>The proxy setting is stored in the user's <code>prefs.js</code> file in their Firefox profile.</p>
<p>The path to the Firefox profile directory and the file is:</p>
<pre>%APPDATA%\Mozilla\Firefox\Profiles\7b9ja6xv.default\prefs.js</pre>
<p>where "<code>7b9ja6xv</code>" is a random string. However, the directory o... |
How is "0" result from readdir() not false in a while condition? <p>See also: <a href="http://stackoverflow.com/questions/844625/where-in-the-documentation-does-it-say-that-while-tests-readdir-for-definedness">Where in the documentation does it say that while tests readdir for definedness?</a>. (<em>Not a duplicate; j... | <p>It is magic. Specifically while magic (documented in <a href="http://perldoc.perl.org/perlsyn.html#Loop-Control" rel="nofollow"><code>perlsyn</code></a>, <a href="http://perldoc.perl.org/perlop.html#I%2fO-Operators" rel="nofollow"><code>perlop</code></a>, and probably other places I don't remember). Perl allows yo... |
Is it possible to make FileReference.upload() block (In ActionScript 3.0)? <p>I am working on a Flash file upload widget, and I want it to upload one file at a time. In my upload function, I currently have a <code>FileReferenceList</code>, and I am looping through it, calling <code>upload</code> on each one. However,... | <p>No, you can't generally do that with AS3, you have to manage the "asynchronous" requests through chaining.</p>
<p>I would usually have my list of files and upload one, catching the complete event and then do another. Same principle applies for downloading or retrieving files with URLLoader.</p>
|
WebKit or Gecko - which one is better for embedding in C++ app? <p>Which one would you choose and <strong>why</strong>?<br />
I'd like to hear opinions from people having <strong>experience</strong> with embedding a web browser engine in C++ application.<br />
I should stress I need all features of web browser engine <... | <p>There exists at least one project that has similar requirements and it embeds Gecko. That's <a href="https://github.com/aptana/Jaxer" rel="nofollow">Aptana's Jaxer</a>. As far as I know, they have had good success with this. This doesn't quite answer your question, but it does demonstrate that this is certainly d... |
How do i cause a qtabwidget instance to automatically resize when child tabs are added to it? <p>I am trying to get the QTabWidget automatically resized to fit the child tab when the child is added but have been unable to do so. I have created a form using Qt Designer and have inherited this using the single inheritanc... | <p>In designer, make sure you add a layout to your widget. Click on the widget's background so that way when you apply a layout, it applies to the whole widget. The trick is that the base (parent) widget that your form is built on needs a layout, and not just the items in the form.</p>
<p>Grid's are generally pretty e... |
Data Dictionary or ORM? <p>I am in the processes of replacing the framework for a fairly complex business web application. Our application runs on a LAMP platform and the new framework will be an extension of <a href="http://www.codeigniter.com" rel="nofollow">CodeIgniter.</a> In my research for framework design I de... | <p>I think your question would be more interesting if you were making an initial architectural decision rather than refactoring an existing application. I don't see a single assertion in your question that suggests a problem that designing in an ORM would address; but several it would create. If two major stakeholder g... |
Writing a __init__ function to be used in django model <p>I'm trying to write an <code>__init__</code> function for one of my models so that I can create an object by doing</p>
<pre><code>p = User('name','email')
</code></pre>
<p>When I write the model, I have </p>
<pre><code> def __init__(self, name, email, hous... | <p>Relying on Django's built-in functionality and passing named parameters would be the simplest way to go.</p>
<pre><code>p = User(name="Fred", email="fred@example.com")
</code></pre>
<p>But if you're set on saving some keystrokes, I'd suggest adding a static convenience method to the class instead of messing with t... |
What does a Software Architect do and what programs do they use? <p>I keep hearing about the "Architect" title in larger software corporations, and am interested to know what they do and how they get it done.</p>
<p>Is it their job to prepare visual diagrams outlining the functioning of the software? and what programs... | <p>If a person can build a shed without a blueprint, it doesn't mean they can, or should build a house without a blueprint.</p>
<p>Architects see what you need now, what you mean when you say what you need, and design a software strategy that will give you what you need today, and a home that you can grow into (and fr... |
Can I extend Function's prototype in ActionScript? <p>I am trying to incorporate prototype.js's <code>bind()</code> function into my Flash component. I found <a href="http://jordan.broughs.net/archives/2007/11/resurrecting-actionscripts-delegate-for-function-binding-in-as3" rel="nofollow">this article</a> by Jordan Br... | <p>You're extending the <code>Function</code> object's <code>prototype</code>. It doesn't belong in a class. It's not a method of your class. </p>
<p>The <code>Function</code> object is basically a built-in type, and its <code>prototype</code> is sort of its base class. By extending its <code>prototype</code> by addin... |
How to replace DOM element in place using Javascript? <p>I am looking to replace an element in the DOM. For example, there is an "A" element that I want to replace with a "SPAN" instead.</p>
<p>How would I go and do that?</p>
| <p>by using <a href="https://developer.mozilla.org/En/DOM%3aelement.replaceChild">replaceChild()</a>:</p>
<pre><code><html>
<head>
</head>
<body>
<div>
<a id="myAnchor" href="http://www.stackoverflow">StackOverflow</a>
</div>
<script type="text/JavaScript">... |
Pushing out a PDF file to IE from an ASP.NET 3.5 site <p>My application pushes out a PDF file to a popup (e.g. no menu/toolbar) browser window (in response to the user clicking a button). This works for every browser out there except for IE7. In IE7, all I get is a blank window. </p>
<p>Here is the server-side code... | <p>It turns out that the following statement causes IE to not display the PDF:</p>
<pre><code>context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
</code></pre>
<p>Not sure why.</p>
|
Store boolean value in SQLite <p>What is the type for a BOOL value in SQLite? I want to store in my table TRUE/FALSE values.</p>
<p>I could create a column of INTEGER and store in it values 0 or 1, but it won't be the best way to implement BOOL type.</p>
<p>Is there a way?</p>
<p>Thanks.</p>
| <p>There is no native boolean data type for SQLite. Per the <a href="http://www.sqlite.org/datatype3.html">Datatypes doc</a>:</p>
<blockquote>
<p>SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).</p>
</blockquote>
|
Fastest way to test internet connection <p>C# 2008 SP1</p>
<p>I am using this code to connect to our client website. This is for a softphone application. Before the user makes a call, the softphone has to test if there is an active Internet connection. </p>
<p>So, want I have done is used the httpWebRequest class to ... | <p>Try using P/Invoke to call <a href="http://msdn.microsoft.com/en-us/library/aa384702%28VS.85%29.aspx">InternetGetConnectedState</a>. That should tell you whether or not you have a connection configured. You can then try checking the specific connection to your service using <a href="http://msdn.microsoft.com/en-us... |
iPhone UIWebView local resources using Javascript and handling onorientationChange <p>I'm trying to server HTML Javascript and CSS content from an iPhone application's local resources, and I'm having trouble handling onOrientationChange events and including external Javascript.</p>
<p>I seem to be able to link in CSS ... | <p>The answer can be traced from the warning I was getting in XCode:</p>
<blockquote>
<p>warning: no rule to process file '$(PROJECT_DIR)/html/orientation.js' of type sourcecode.javascript for architecture i386</p>
</blockquote>
<p>XCode setup *.js javascript as some type of source code needed to be compiled in the... |
SqueakMap won't work in a fresh 3.10 dev image <p>I just downloaded a fresh Squeak-dev image from Damien Cassou, clicked on SqueakMap, and got the error that in SqueakMap>>categories, the objects instance variable is nil, but shouldn't be. I can't be the only one with that error, am I? What should I do?</p>
| <p>This fixes it:</p>
<pre><code>SMSqueakMap default loadUpdates
</code></pre>
<p>Easy, huh? </p>
|
Security error in cross domain iframe <p>I have a click tracker for a client. The tracker is nothing but a javascript snippet which writes an iframe(a different domain) into the page. </p>
<p>If I have a normal iframe I am able to track clicks more accuratley(I compare the data from another tracking solution) than whe... | <p>iframes should be sharing the same domain for example foo.com and subdomain.foo.com is not the same SSL wise.</p>
|
Entity framework execution <p>I am new to the entity framework and wondered, when the data is actually taken from the database. If I e.g. does:</p>
<pre><code>from order in orderQuery where order select car;
</code></pre>
<p>is the data then selected from the database, or is it first when I manipulate it like the cod... | <p>The entity framework works in lazy-load fashion, the databse is queried only when the data is actually needed.</p>
<p>So the query will only be executed on your second example.</p>
|
Sending messages to a Flash game with C# and AutoIt <p>I'm making a bot for a Flash game, and I've figured out how to import all the <a href="http://en.wikipedia.org/wiki/AutoIt" rel="nofollow">AutoIt</a> functions into my C# code.</p>
<pre><code>string title = "Minesweeper";
string full = auto.WinGetTitle(title,"");
... | <p>Something you may want to try to rule out window handle and variable handling issues. There should be no need to use WinGetTitle the "Minesweeper" window title should work fine. According to my AutoIt v3 Window Info tool in Windows 7 the title and class of Minesweeper window are both Minesweeper. So hard coding </p... |
Rule of thumb for amount of usage memory it takes to make a worker process recycle? <p>I've got a code base with lots of this:</p>
<pre><code>byte[] contents = FileUtils.FileToByteArray(FileOfGartantuanProportions);
</code></pre>
<p>I don't control my IIS server, so I can't see the system log or do instrumentation, I... | <p>With IIS6 in native mode you can configure the limits for each Application Pool.</p>
<p>With IIS5 it's configured using the element in machine.config as a percentage of total system memory - default is 60%.</p>
|
wxPython: Drawing a vector-based image from file <p>How can I draw a vector-based image from a file in wxPython? I know nothing of image formats for such a thing, so please recommend.</p>
| <p>You can do this with using cairo & librsvg python bindings. There is a small example <a href="http://www.daa.com.au/pipermail/pygtk/2007-April/013778.html" rel="nofollow">here</a>.</p>
|
PHP MYSQL Insert/Update <p>I have a simple table as below.</p>
<pre><code>CREATE TABLE `stats` (
`id` int(11) NOT NULL auto_increment,
`zones` varchar(100) default NULL,
`date` date default NULL,
`hits` int(100) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
</code... | <p>Declare the tuple <code>(zone, date)</code> as unique in your CREATE statement. This will make INSERT ... ON DUPLICATE UPDATE work as expected:</p>
<pre><code>CREATE TABLE `stats` (
`id` int(11) NOT NULL auto_increment,
`zone` varchar(100) default NULL,
`date` date default NULL,
`hits` int(100) default NULL... |
How to validate deployment packages created by msbuild? (preferably using mstest or nunit) <p>Our msbuild process creates a variety of zip packages for deployment (mostly web sites, but other things as well). We have a variety of recurring problems that keep sneaking back - files included that shouldn't be, missing res... | <p>What I've ended up doing is having a bunch of custom MS build tasks which spin up a virtual machine on Virtual Server, copy the MSI onto the machine, silently deploy it and then validate against it. I used <a href="http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx" rel="nofollow">PSExec</a> to start the ... |
What's better, isset or not? <p>Is there any speed difference between</p>
<pre><code>if (isset($_POST['var']))
</code></pre>
<p>or</p>
<pre><code>if ($_POST['var'])
</code></pre>
<p>And which is better or are they the same?</p>
| <p>It is a good practice to use <code>isset</code> for the following reasons:</p>
<ul>
<li>If <code>$_POST['var']</code> is an empty string or <code>"0"</code>, <code>isset</code> will still detect that the variable exists.</li>
<li>Not using isset will generate a notice.</li>
</ul>
|
why aren't more people using Grails? <p>I've been learning Groovy & Grails recently, and in terms of developer productivity it seems to be light years ahead of other Java solutions (Spring, Struts, EJB, JSF). If I search monster.ca, for either Groovy or Grails, 0 matches are returned, which suggest Grails isn't doi... | <p>There are probably more people using Grails than you think. Job boards show you what are the skills people are looking for. Grails is fairly new and there are not a lot of people experienced with it out on the job market.</p>
<p>Grails and in particular Groovy are very close to Java. A few quick lessons in Groovy a... |
Can't open silverlight application in visual studio <p>This is regarding
Visual Studio pro 2008 sp1, with resharper and testdriven installed.</p>
<p>I've just installed:
Microsoft Silverlight Projects 2008
Version 9.0.30729.146</p>
<p>I find I can't open a silverlight application due to a 'missing patch'. The error ... | <p>The useless error message should say "visual web developer" not installed. They don't check this crucial prerequisite during the tools install. And you can't install visual web developer after you have installed visual studio sp1. vs2008 has to be uninstalled, reinstalled, and sp1 applied. Then the silverlight tools... |
Web application background processes, newbie design question <p>I'm building my first web application after many years of desktop application development (I'm using Django/Python but maybe this is a completely generic question, I'm not sure). So please beware - this may be an ultra-newbie question... </p>
<p>One of m... | <p>There are two schools of thought on this (at least). </p>
<ol>
<li><p>Throw the work on a queue and have something else outside your web-stack handle it.</p></li>
<li><p>Throw the work on a queue and have something else in your web-stack handle it.</p></li>
</ol>
<p>In either case, you create work units in a queue... |
IIS7 automatically redirect to null (in IE) <p>I'm developing an ASP.NET web site with VB. My web site is work perfectly with Firefox. But, with IE, it's redirect automatically to <em>null</em>.</p>
<p>When I try</p>
<pre><code>http://localhost/mysite/Default.aspx
</code></pre>
<p>IE6/IE7 automatically redirect to<... | <p>Huh... that's strange. "null" isn't really a normal place for web traffic to get redirected. Can you think of anywhere in your code/IIS settings that might redirect to a page called "null" Also strange is the firefox/ie difference.</p>
<p>Does it have something to do with authentication? IE might have automatic... |
Should I go with Tomcat or a full Java EE container? <p>I need to design a web service layer on top of an existing application. Really, I'm most interested in WS-Security and JMS support, possibly JTA. </p>
<p>What is the best server to use for this? Would it be a wise decision to go with lightweight Tomcat (which ... | <p>Generally, unless you know that you're trying to use Java EE services particularly, you're better off with just Tomcat. The Java EE environment is very heavyweight; J2EE was designed with really big environments like eBay in mind. (I wrote Sun's first J2EE architecture course; I've been following these arguments f... |
Make Background of UIView a Gradient Without Sub Classing <p>Is there a way to make the background of a UIView a gradient without subclassing it? I'd rather not use an image file to accomplish this either. It just seems obtuse to have to subclass UIView just to draw a gradient for the background.</p>
| <p>You can use <code>+[UIColor colorWithPatternImage:]</code> to produce a patterned background. Example (bring your own CGGradient):</p>
<pre><code>// Allocate color space
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
// Allocate bitmap context
CGContextRef bitmapContext = CGBitmapContextCreate(NULL, 32... |
Generic guide to programming concepts? <p>I'm looking for a guide to the basic concepts of programming, that are explained in a good amount of depth.</p>
<p>By this I mean something that describes what:</p>
<ul>
<li>Object oriented programming is...</li>
<li>What compilers are, how they work, etc..</li>
<li>General d... | <p>Wikipedia will probably have good answers to the objective parts of your question(s), and will give you some idea of where there is controversy about the subjective parts.</p>
<p>And here are some "layman's terms" answers to the specific questions, like you also asked for, to get you started:</p>
<p><strong>What i... |
Strange "Collection was modified after the enumerator was instantiated" exception <p>Perhaps someone can point me in the correct direction, because I'm completely stumped on this.</p>
<p>I have a function that simply prints out a LinkedList of classes:</p>
<pre><code> LinkedList<Component> components = new L... | <p>I suspect the place to start looking will be at any places where you manipulate the list - i.e. insert/remove/re-assign items. My suspicion is that there will be a callback/even-handler somewhere that is getting fired asynchronously (perhaps as part of the XNA <em>paint</em> etc loops), and which is editing the list... |
How do I create two mutual producer/consumers with internal state in Haskell? <p>I've got an agent that takes in states and returns actions, while keeping an internal representation of the utility of state/action pairs. I've also got an environment that takes in actions and returns state/reward pairs.</p>
<p>I need to... | <p>You'll need to decide which of the agent and the environment sits "on top" - let's suppose for the rest of this answer that it's the environment on top calling into the agent since that generally makes most sense.</p>
<p>You can keep data representations of the Agent private using the module system - just export th... |
Turn Off Message Dispatch within A Handler <p>I am working on a Windows program which is completely single-threaded and has no protection to any data structure. However, the program use DirectShow API which open their own internal message-dispatching, IVideoWindow::put_Visible for example. So the event-handling functio... | <p>The question is a little unclear to me. Are you talking about an API that enters a modal message loop internally? Is this creating some sort of re-entrancy problem for you? If that's the case, then there are probably better ways to solve your problem. If an API is entering a modal loop, then there's doubtless a ... |
Is there a better way to get ClientID's into external JS files? <p>I know this has been asked before, but I've found a different way to get references to controls in external JS files but I'm not sure how this would go down in terms of overall speed.</p>
<p>My code is</p>
<pre><code>public static void GenerateClientI... | <p>Well, the method can only be used once in each page, so if you are calling it from a user control that means that you can never put two of those user controls on the same page.</p>
<p>You could store the control references in a list until the PreRender event, then put them all in a script tag in the page head. That... |
Is there a convenient function in objective-c / cocoa-touch to find a lowest number? <p>I have two numbers, and need to get returned the lower one. Is there any function I could use? Sure it's a easy task, I could do an if-statement. I just want to know.</p>
| <p>If you're using ints, use the <code>MIN()</code> macro:</p>
<pre><code>MIN(25, 50); //Returns 25
</code></pre>
<p>If you're comparing two <code>NSNumber</code>s, then use the <code>compare:</code> method:</p>
<pre><code>NSNumber *number, *secondNumber; //Assume 'number'=25, 'secondNumber'=50
NSComparisonResult re... |
Bind to a value defined in the Settings <p>In WPF, Can I use binding with values defined in Settings? If this is possible, please provide a sample.</p>
| <p>First, you need to add a custom XML namespace that will design the namespace where the settings are defined:</p>
<pre><code>xmlns:properties="clr-namespace:TestSettings.Properties"
</code></pre>
<p>Then, in your XAML file, access the default settings instance using the following syntax:</p>
<pre class="lang-xml p... |
What is the difference between my and our in Perl? <p>I know what <code>my</code> is in Perl. It defines a variable that exists only in the scope of the block in which it is defined. What does <code>our</code> do? How does <code>our</code> differ from <code>my</code>?</p>
| <p>Great question: How does <strong><em><code>our</code></em></strong> differ from <strong><em><code>my</code></em></strong> and what does <em><code>our</code></em> do?</p>
<p>In Summary: </p>
<p>Available since Perl 5, <strong><em><code>my</code></em></strong> is a way to declare: </p>
<ul>
<li>non-package variable... |
Why does Clang complain about all my autoreleased objects? <p>I have the following function:</p>
<pre><code>- (NSString *)urlEncodedValue {
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(
kCFAllocatorDefault,
(CFStringRef)self,
NULL,
CFSTR("?=&+/\r\n"),
... | <p>I've found the answer to my own question, posting it here if anyone else stumbles across the issue. I was using checker-0.198, checker-0.204 reports no such issue. Seems it was a temporary regression.</p>
|
Focus is not coming in javascript <p>I have a button in <code>aspx</code>. In its <code>onclientclick</code> I called a javascript function which is written in <code>JScript.js</code>.
Following is my javascript:</p>
<pre><code>function ChangeBG()
{
alert("hi");
}
</code></pre>
<p>I called this above function in b... | <p>Before <code>alert("hi");</code> put the stmt <code>debugger;</code></p>
<pre><code>ChangeBG()
{
debugger;
alert("hi");
}
</code></pre>
<p>Your control will come to debug when you are in debug mode. This problem occurs when javascript is in a separate js file.</p>
|
Emulating pass-by-value behaviour in python <p>I would like to emulate the pass-by-value behaviour in python. In other words, I would like to make absolutely sure that the function I write do not modify user supplied data. </p>
<p>One possible way is to use deep copy:</p>
<pre><code>from copy import deepcopy
def f(da... | <p>You can make a decorator and put the cloning behaviour in that. </p>
<pre><code>>>> def passbyval(func):
def new(*args):
cargs = [deepcopy(arg) for arg in args]
return func(*cargs)
return new
>>> @passbyval
def myfunc(a):
print a
>>> myfunc(20)
20
</code></pre>
<p>This is not the... |
Get the last modified date of a remote file <p>I would like to get the last modified date of a remote file by means of curl. Does anyone know how to do that? </p>
| <p>You could probably do something like this using <a href="http://php.net/manual/en/function.curl-getinfo.php"><code>curl_getinfo()</code></a>:</p>
<pre><code><?php
$curl = curl_init('http://www.example.com/filename.txt');
//don't fetch the actual page, you only want headers
curl_setopt($curl, CURLOPT_NOBODY, tru... |
Java negative int to hex and back fails <pre><code>public class Main3 {
public static void main(String[] args) {
Integer min = Integer.MIN_VALUE;
String minHex = Integer.toHexString(Integer.MIN_VALUE);
System.out.println(min + " " + minHex);
System.out.println(Integer.parseInt(minHex, 16));
... | <p>This is something that's always annoyed me. If you initialize an int with a hex literal, you can use the full range of positive values up to <code>0xFFFFFF</code>; anything larger than <code>0x7FFFFF</code> will really be a negative value. This is very handy for bit masking and other operations where you only care... |
c# HwndSourceHook with Windows.Forms <p>i found this code:</p>
<blockquote>
<pre><code> protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
if (hwndSource != null)
{
... | <p>If you are using WinForms, then it is just myForm.Handle</p>
<p>The HwndSource is for WPF.</p>
<p>So you can just do:</p>
<pre><code>viewerHandle = SetClipboardViewer(myForm.Handle);
</code></pre>
<p>Edit: AddHook is also a WPF method.</p>
<p>You need to use either:</p>
<pre><code>Application.AddMessageFilter(... |
Windows Media Encoder installation issue <p>I have a program written in C# and dependent on Windows Media Encoder 9 Series SDK. In order for my program to run on other target machines, I have to install the whole Windows Media Encoder on target machines. </p>
<p>My question is, I want to reduce the overhead of install... | <p>You could try reducing your dependencies to the <a href="http://msdn.microsoft.com/en-us/library/aa384477.aspx" rel="nofollow">WMF</a>. Many computers I've seen lately come with WME installed, though.</p>
|
PHP language (unit) tests <p>At the moment I am working (just for fun) on a kind of compiler that breaks <code>PHP</code>-code down to a source code for a low level <code>VM</code>.</p>
<p>As the type system and a lot of of the <code>PHP</code>-features are not that logical I need a much testscripts to verify that my ... | <p>If you are validating that your semantics behave as they would in the Zend implementation of PHP then I would recommend building an automated tool to generate grammar from the BNF of PHP itself. This way you would have alot of .php files expressing much of the semantics. Be sure to include alot of trace code in the ... |
Testing across multiple DBMS vendors <p>Take this query:</p>
<pre><code> SELECT *
FROM MyTable
WHERE MyColumn = 'SomeValue'
ORDER BY SomeFakeQualifier.MyColumn DESC
</code></pre>
<p>It seems that SqlServer just ignores the qualifier in this case. Should you add a <code>JOIN</code>, then it will consider it.<... | <p>Your solution here is really unit tests of your queries combined with <a href="http://www.martinfowler.com/articles/continuousIntegration.html" rel="nofollow">continuous integration</a>. You have queries in the form of JDBC code. It's easy enough to write unit tests to connect to your relevant databases and run the ... |
javascript to get paragraph of selected text in web page <p>After highlighting text, I would like to obtain the paragraph in which the selected text resides.</p>
<pre><code>var select = window._content.document.getSelection();
</code></pre>
<p>Any pointers please?</p>
| <p>This is actually rather hard to do because you have to consider six cases:</p>
<ol>
<li>The selection is not within a paragraph (easy);</li>
<li>The entire selection is within one paragraph (easy);</li>
<li>The entire selection crosses one or more sibling paragraphs (harder);</li>
<li>The selection starts or ends i... |
Math programming help for a gimble-based painting machine <p>I'm an artist involved with building various sorts of computer controlled machines. I've started prototyping a gimble-based XY painting machine and have realized that the maths needed are out of my reach. I'm a decent enough programmer but not strong in math-... | <p>Very nice machine you have made, I hope this works for you I believe it is correct.</p>
<p>The way I see it, is to get one angle is simple, but the other is slightly harder to visualise as we have tilted the axis which it turns upon.</p>
<p>I'm going to avoid using tan, as when programming this could result in a d... |
FluentNhibernate and SQLite <p>I can't get SQLite Driver working in my sessionfactory.</p>
<p>I downloaded SQLite 1.0.48 from <a href="http://sqlite.phxsoftware.com/">http://sqlite.phxsoftware.com/</a></p>
<p>I have added the references to System.Data.SQLite in my Tests project.</p>
<pre><code>public static IPersist... | <p>When I ran into this issue it was caused by running having my application's processor property set to anycpu and running on a 64bit system. To correct the issue I set my application processor property to x86.
I don't think the System.Data.SQLite.dll supports running under a x64 process.</p>
|
How to get the device type associated with a fd <p>i get a valid "fd" object from a caller. How can i find out what is the fd type - whether it is referring to a File, Socket, Device, etc?
Depending on the refered type, i need to execute specific functions, say if the fd is associated with a File, then i need to do a r... | <p>Well, in theory at least, you still do a read for a socket, and for a device, and for a pipe, and.... :-P</p>
<p>If you want more data from the socket, such as the socket addresses, you can just call the functions for doing that. It will simply fail for non-sockets, and it's up to you to decide how you want to deal... |
When will the 64-bit version of JDIC be available? <p>My Java program needs lots of memory to run, the 32-bit version of Java max out at 1.5 GB, my system has 4 GB of RAM, so I decided to run it under the 64-bit version of Java, and yet the JDIC won't work, which affects my program, so I wonder if anyone knows when the... | <p>Assuming you are running a 64-bit OS and a 64-bit JVM, you could try the latest version of Java 6u13 as I believe there is improve client side support for 64-bit applications.</p>
<p>Note: I wouldn't suggest you use more than 1/2 to 2/3 of your memory for Java's heap. You may also need more main memory to see a re... |
Background process in GAE <p>I am developing a website using Google App Engine and Django 1.0 (app-engine-patch)</p>
<p>A major part of my program has to run in the background and change local data and also post to a remote URL</p>
<p>Can someone suggest an effective way of doing this?</p>
| <p>Check out <a href="http://code.google.com/appengine/docs/python/taskqueue/" rel="nofollow">The Task Queue Python API</a>.</p>
|
Is there a way to diff files sentence-by-sentence instead of line-by-line? <p>Just trying to get diff to work better for certain kinds of documents. With LaTeX, for example, I might have a long paragraph that is strictly just one line, but I don't want to see that entire paragraph if just a sentence is changed. Particu... | <p><a href="http://www.gnu.org/software/wdiff/"><code>wdiff</code></a> will give you a word-by-word diff instead of line-by-line. I'm not aware of any sentence-by-sentence diff programs.</p>
|
Is there a function that returns the ASCII value of a character? (C++) <p>I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc...</p>
<p>On a similar note, what is the function that converts between hexadecimal, decimal, and binary numbers?</p>
| <pre><code>char c;
int ascii = (int) c;
s2.data[j]=(char)count;
</code></pre>
<p>A char <strong>is</strong> an integer, no need for conversion functions.</p>
<p>Maybe you are looking for functions that display integers as a string - using hex, binary or decimal representations?</p>
|
How to copy ref types (deepcopy)? <p>I have a constructor in a collection that accepts IEnumerable. I want to enumerate and create a new collection using the items, but not reference the same items. Items can be value and ref types:</p>
<pre><code>CustomCollection cc = new CustomCollection (IEnumerable<T> items)... | <p>If the classes in question supports serialization, you can serialize the collection to a temporary stream, and deserialize them back into a new collection.</p>
<p>Some classes supports ICloneable, but exactly what it does is left up to the programmer to decide. It might be a deep copy, it might not.</p>
<p>Of cour... |
I need some help with the Load function in JQuery <p>I currently have links w/ class="ajax" that I want to retrieve the element with id="test" from the file "data.html" in the same directory, and put that content into the id="content" div on my page:</p>
<pre><code><script>
$(document).ready(function(){
$("a... | <p>You have <code>/data</code> but the file is <code>/data.html</code>, assuming you're in the root. :)</p>
<p>I just tested what you have with this change and it works fine for me. I also recommend you get a tool like <a href="http://getfirebug.com/" rel="nofollow">Firebug</a> so you can easily see what your AJAX req... |
Regex - Match ( only ) words with mixed chars <p>i'm writing my anti spam/badwors filter and i need if is possible, </p>
<p>to match (detect) only words formed by mixed characters like: fr1&nd$ and not friends</p>
<p>is this possible with regex!?</p>
<p>best regards!</p>
| <p>Of course it's possible with regex! You're not asking to match nested parentheses! :P</p>
<p>But yes, this is the kind of thing regular expressions were built for. An example:</p>
<pre><code>/\S*[^\w\s]+\S*/
</code></pre>
<p>This will match all of the following:</p>
<pre><code>@ss
as$
a$s
@$s
a$$
@s$
@$$
</code>... |
How do you organise your code library? <p>I am interested to know how people organise their code libraries, particularly with respect to reusable components. I am talking in OO terms below but I am interested in how your organise libraries for other types of language also.</p>
<p>For example:</p>
<ul>
<li>Are you a s... | <p>It generally can be guide by <strong>deployment</strong> considerations:</p>
<p>How will you deploy (i.e. what will you copy on your production machine) ?</p>
<p>If what you are deploying are <strong>packaged</strong> components (i.e. dll, jar, war, ...), it is wise to organize the "code library" as a collection o... |
How do I represent a void pointer in a PyObjC selector? <p>I'm wanting to use an NSOpenPanel for an application I'm designing. Here's what I have so far:</p>
<pre><code>@objc.IBAction
def ShowOpenPanel_(self, sender):
self.panel = NSOpenPanel.openPanel()
self.panel.setCanChooseFiles_(False)
self.panel.set... | <p>I think you don't need to use <code>objc.selector</code> at all; try this instead:</p>
<pre><code>@objc.IBAction
def ShowOpenPanel_(self, sender):
self.panel = NSOpenPanel.openPanel()
self.panel.setCanChooseFiles_(False)
self.panel.setCanChooseDirectories_(True)
NSLog(u'Starting OpenPanel')
self... |
How to access the form's 'name' variable from PHP <p>I'm trying to create a BMI calculator. This should allow people to use either metric or imperial measurements.</p>
<p>I realise that I could use hidden tags to solve my problem, but this has bugged me before so I thought I'd ask: I can use <code>$_POST['variableName... | <p>To identify the submitted form, you can use:</p>
<ul>
<li>A hidden input field.</li>
<li>The name or value of the submit button.</li>
</ul>
<p>The name of the form is not sent to the server as part of the POST data.</p>
<p>You can use code ad followed</p>
<pre><code><form name="myform" method="post" action=""... |
Rails escaping quotation mark in link_to_function partial <p>I have a little piece of rails code which lets users enter a review. If one already is written it displays the current review with a link to edit it.</p>
<pre><code> <div id="text_area">
<% if @user_rating.review.blank? %>
... | <p>Found a solution which worked. I'm not really sure why it worked but it did.</p>
<p>A couple times up above I call a partial to render the text area and form where the user can edit their review, like this</p>
<pre><code><%= render :partial => "reviews/text_area" %>
</code></pre>
<p>All I had to do was ... |
Can I use Apple artwork in my iPhone app? <p>In my app, I want to give the user the opportunity to add some comments to a listed item.
Rather than showing a "add comments" button, I want to show a little icon.
Being lazy, but also, using the visual language of a Mac user, I would like to use the the icon of the TextEdi... | <p>I would absolutely stay away from this. Since apple runs the approval process for iPhone apps they might reject your app for infringing on what would probably be copyright or trademarked work.</p>
<p>From a visual perspective, I do not think the TextEdit icon would be best for an "add comments" icon. It seems too... |
How can I estimate a Web site build (refresh) when I don't know all of the site's features? <p>I know there are several estimating questions here, and I have read through most of them, but this one is slightly different. If you're doing a refresh on a Web site, it might include usability enhancements that increase the ... | <p>In your proposal, be fairly specific about what you saw on the current web site (how many pages/resources? are they low/med/high complex? What are the high level features you see already existing (i.e. search, security, AJAX, profiles, etc.) and what would you consider adding? Give ranges, rather than specific estim... |
Can the working directory be set in the project (.vcproj) file? <p>I have a script that generates a .sln file and a few .vcproj files for visual studio 2005. I need to set the WorkingDirectory option but its specified in the .user file. A file we cannot currently generate. I found the <a href="http://msdn.microsoft.c... | <p>After you change your settings, and close the sln you will get a user file named something like:</p>
<p><code>Project_Name.vcproj.Domain.user_name.user</code></p>
<p>Change it to:
<code>Project_Name.vcproj.user</code> and commit.</p>
<p>The next person who checks out the code will use this user file to create the... |
Setting global variable in Struts with Spring <p>What is the best approach to set servlet context variable in Struts? This variable is displayed on every single page in header tile and has to be loaded from DB. For that purpose there is Hibernate DAO and Spring Service which returns the requested value.</p>
<p>My curr... | <p>Look at the spring reference guide and the section (3.4) on bean scopes. You can have a bean that's maintained over the the life of the browser session, and set it up as a proxy session bean.</p>
<pre><code><!-- a HTTP Session-scoped bean exposed as a proxy -->
<bean id="userPreferences" class="com.foo.Us... |
Making a game trainer in C++? <p>Ok so i've messed with games before, but now i would like to make a trainer only problem is that there memory adresses changes every time i play it on a different computer or restart the game. Now i need to find a pointer but have no idea how.</p>
<p>So how do i find the pointer to the... | <ul>
<li>step 1. search through memory for the value you are looking to change, and store all match locations</li>
<li>step 2. do something in the game to change the value to a new value</li>
<li>step 3. check all of the match locations, one of them should have the new value in it.</li>
<li>step 4. write whatever you w... |
How to know when a XAML element is finished loading <p>I have a custom control I'm developing that has a collection of items. When adding an item to the collection you're meant to do:</p>
<pre><code>myCustomControl.BeginAddItems();
myCustomControl.Items.Add("a");
myCustomControl.Items.Add("b");
myCustomControl.I... | <p>You can use the <em>Loaded</em> event</p>
|
I made an upload script in PHP. How do I avoid overwriting files? <p>I've made an image upload script using the <code>move_uploaded_file</code> function. This function seems to overwrite any preexisting file with the new one. So, I need to check if the target location already has a file. If it does then I need to appen... | <p>When uploading files I will nearly always rename them. Typically there will be some kind of database record for that file. I use the ID of that to guarantee uniqueness of the file. Sometimes I'll even store what the client's original filename was in the database too but I'll never keep it or the temporary name becau... |
Is there a mod_python for Apache HTTP Server 2.2 and Python 2.6 or 3.0? <p>I poked around the <a href="http://www.modpython.org/" rel="nofollow">mod_python website</a> and I only found the files for Python 2.5 and earlier for Apache HTTP Server 2.2. I Googled around a little, without significant luck. Any suggestions?<... | <p>Use mod_wsgi.</p>
<p>mod_python has been stagnant for a while now. Most of the effort for python web apps has been going into mod_wsgi.</p>
|
How can you prevent Man in the Browser attacks? <p>Been reading up on MitB attacks and some things worry me about this.</p>
<p>From <a href="http://en.wikipedia.org/wiki/Man%5Fin%5Fthe%5FBrowser">WIKI</a>: </p>
<blockquote>
<p>The use of strong authentication tools simply creates an increased level of misplaced con... | <blockquote>
<p>Would an email count as a OOB Transaction?</p>
</blockquote>
<p>Given the prevalence of Web mail services like GMail, I would say No. Even if the target of such an attack <em>isn't</em> using Web mail, an attacker that has control of the target's browser could fire off a fake email, just as you sugg... |
target a specific page in iframe <p>I'm running the CMS indexhibit, indexhibit uses an iframe to load it's content.</p>
<p><a href="http://www.therussianfrostfarmers.com/" rel="nofollow">http://www.therussianfrostfarmers.com/</a></p>
<p>My homepage has WordPress loaded into this iframe, which works ok, i've got some ... | <p>You might not have to split the query string. You could just use PHP to get the value of that GET variable, for instance:</p>
<pre><code>$_GET["p"]
</code></pre>
<p>would equal 480 for the request <a href="http://www.therussianfrostfarmers.com/oldspeak/?p=480" rel="nofollow">http://www.therussianfrostfarmers.com/o... |
Is it ok to never delete from a MSMQ? <p>I have inherited an application that pulls messages out of an MSMQ does some processing to them and then adds some data to database depending on what is in the message. The messages are getting pushed into the Queue by a third party application I do not control.</p>
<p>I do not... | <p>Once a message has been processed, it is normal practice to remove it from a queue (transactionally or otherwise).</p>
|
Splitting Probabilities <p>I've the following code in PHP which works fine (returns more or less 10 results each time it runs):</p>
<pre><code>function GetAboutTenRandomNumbers()
{
$result = array();
for ($i = 0; $i < 240; $i++)
{
if (Chance(10, 240) === true)
{
$result[] = $i;
}
... | <p>Indeed you are!</p>
<p>In your second pass, you're giving it 60 values each pass, instead of 240, so you'll get about a quarter of the expected values in that pass. Run each to 240 and use a modulo 60 to get the range of values you're looking for in each loop.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.