input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Reinstall development stack <p>I need to relocate my iPhone development stack to a different machine. What do I need to do in preparation and are there any gotchas?</p>
<p>Thanks! </p>
| <p>You need to export and transport your private keys, used for signing, from Keychain Access.</p>
<p>See page 10 in the "Program Portal User Guide" available from the "Program Portal", where you manage your certificates at apple.com</p>
|
sql server 2008 express/enterprise <p>I am logged with windows authentication and create an entry/user in the login table.</p>
<p>The new testuser has a sql-server authentication, but if a try to login local or remote, only fault 18456.</p>
<p>Is there any trick... this should be so simple as explained... but should ... | <p>i believe it's just that the SQL server authentication is disabled by default installation. go check your SQL server properties in management studio (right-click on the server in object explorer, then select 'properties'), select 'security' menu in the left panel. you have the 'server authentication' option on the t... |
Do you know of a Java library to access the native linux api? <p>Do you know of a Java library to access the native linux api?</p>
<p>I guess something like this must use JNI. So be it.</p>
| <p>Have a look at <a href="https://github.com/twall/jna" rel="nofollow">JNA.</a></p>
<p>Here is the summary of JNA from their home page.</p>
<blockquote>
<p>JNA provides Java programs easy access to native shared libraries (DLLs on Windows) without writing anything but Java codeâno JNI or native code is required.... |
wx's idle and UI update events in PyQt <p>wx (and wxPython) has two events I miss in PyQt: </p>
<ul>
<li><code>EVT_IDLE</code> that's being sent to a frame. It can be used to update the various widgets according to the application's state</li>
<li><code>EVT_UPDATE_UI</code> that's being sent to a widget when it has to... | <p>The use of EVT_UPDATE_UI in wxWidgets seems to highlight one of the fundamental differences in the way wxWidgets and Qt expect developers to handle events in their code.</p>
<p>With Qt, you connect signals and slots between widgets in the user interface, either handling "business logic" in each slot or delegating i... |
ie save onunload bug <p>I have a dynamic ajaxy app, and I save the state when the user closes the explorer window.
It works ok in all browsers but in IE there is problem. After I close twice the application tab, i can't connect anymore to the server.</p>
<p>My theory is that the connection to the server fail to compl... | <p>In IE if you use long-polling AJAX request, you have to close down the XHR connection on 'unload'. Otherwise it will be kept alive by browser, even if you navigate away from your site. These kept alive connections will then cause the hang, because your browser will hit the maximum open connection limit.</p>
<p>This... |
Is it possible to speed up a recursive file scan in PHP? <p>I've been trying to replicate <a href="http://www.gnu.org/software/findutils/">Gnu Find</a> ("find .") in PHP, but it seems impossible to get even close to its speed. The PHP implementations use at least twice the time of Find. Are there faster ways of doing... | <p>I'm not sure if the performance is better, but you could use a recursive directory iterator to make your code simpler... See <code>RecursiveDirectoryIterator</code> and <a href="http://uk.php.net/SplFileInfo" rel="nofollow">'SplFileInfo`</a>.</p>
<pre><code>$it = new RecursiveDirectoryIterator($from);
foreach ($it... |
What happened to my VS Team project bindings? <p>I'm new to using Team Explorer, I create a new project in source control using VSTS, then I see the plus signs, check marks etc.</p>
<p>Then I closed the project and reopened it, all the plus signs and check marks are gone as if the project is not under source control.<... | <p>It's probably been disconnected. Use the Source Code Control menu item on the File menu to reconnect to your TFS server.</p>
|
Should I sign a non-competition clause in freelance contract? <p>I'm trying to establish myself as an iPhone freelancer, and are currently negotiating with a startup about a bigger project. They have expressed that they want me to sign a non-competition agreement, so that I wouldn't be allowed to develop a similar prod... | <p>They're common. If you can get them to remove it, do so. It's never in your interest to have one. That said, they aren't terrible if they are narrowly scoped and of a reasonable time limit. You don't want one saying you cannot write any other iPhone apps. One saying you can't write the same sort of app is proba... |
How do I read / write gzipped files? <p>How do I read / write gzipped files in C++?</p>
<p>The <code>iostream</code> wrapper classes <a href="http://www-d0.fnal.gov/d0dist/dist/packages/lm%5Faccess/devel/lm%5Faccess/gzstream.hpp">here</a> look good, and here is a simple usage example:</p>
<pre><code>gz::igzstream in(... | <p>Consider using the Boost zip filters. According to them, it supports <code>bzip</code>, <code>gzip</code> and <code>zlib</code> format. </p>
<ul>
<li><a href="http://www.boost.org/doc/libs/1%5F38%5F0/libs/iostreams/doc/classes/zlib.html">boost zlib</a></li>
<li><a href="http://www.boost.org/doc/libs/1%5F38%5F0/libs... |
How to reuse an ostringstream? <p>I'd like to clear out and reuse an ostringstream (and the underlying buffer) so that my app doesn't have to do as many allocations. How do I reset the object to its initial state?</p>
| <p>I've used a sequence of clear and str in the past:</p>
<pre><code>// clear, because eof or other bits may be still set.
s.clear();
s.str("");
</code></pre>
<p>Which has done the thing for both input and output stringstreams. Alternatively, you can manually clear, then seek the appropriate sequence to the begin:</... |
Castle Windsor Cannot find my Service Type <p>Trying to make use of the Castle Windsor IoC. I have a very simple application. My interfaces exist in Test.Services namespace. I get the following exception when compiling:</p>
<p>"The type name Test.Services.IParse, Test.Services could not be located"</p>
<p>This is my ... | <p>Stupid question, but are you certain that the assembly containing the class you register gets actually copied to the output directory?</p>
|
OpenGL vertex layout <p>The problem goes like this: if I have a vertex structure defined with only the position (3 floats), with a total size of 12 bytes, things work perfectly. However, if I try to use unsigned bytes or shorts for the position components (3 or 6 bytes per vertex) it crashes with an access violation at... | <p>Looks like I had to use unsigned types.</p>
|
Sharepoint form layout in VB <p>OKay, I'm from a PHP background, but I've just been tasked with developing some custom Web Parts in SharePoint. I've figured out how to create and deploy a basic "Hello world" web part in VB. Okay so far.</p>
<p>What I'm stuck on is a really basic, stupid point - how the hell do I lay o... | <p>There are a number of ways to go about it. The easiest, if you really just want the controls to appear on different lines would be to add an ASP.net <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.literalcontrol.aspx" rel="nofollow">LiteralControl</a> with a BR tag between them.</p>
<p>Aside from tha... |
Are there any good tutorials on linking an iPhone app to a database? <p>I have built an iPhone app that needs to pull data from a server. First I need to figure out what kind of server I will need. I'm a bit familiar with MySQL but was wondering if anyone had better suggestions on a backend. My app will have two tables... | <p>Well if it's a remote server your thinking about then you should be looking into implementing some kind of service architecture like Web Services over SOAP or REST.</p>
<p>If the data stays on the iPhone than by all means use SQLite as it's fast and lightweight.</p>
<p>I would recommend starting with SQLite and lo... |
Tracking undisposed Disposable objects <p><strong>Is there a tool that can scan your code and determine which objects that implement IDisposable are not being disposed in a code base at compile time or runtime?</strong></p>
<p>I have possible areas in the code that are not disposing objects but it's hard to look back ... | <p>There is a lot of static analysis tooling, which can help here.</p>
<p>Both CodeRush/Refactor Pro and Resharper will, at code time, in Visual Studio, show you undisposed objects.</p>
<p>And FxCop, now packaged as part of Visual Studio Code Analysis can generate compile time warnings for undisposed locals and class... |
How do I capture the output of a command to a file descriptor in Bourne shell? <p>The standard way to capture command output in Bourne shell is to use the <code>$()</code> syntax:</p>
<pre><code>output=$(mycommand)
</code></pre>
<p>For commands that have a lot of output, however, this requires the shell allocate memo... | <pre><code>#!bash
ls | while read X
do
echo $X is a directory entry
done
</code></pre>
<p>Replace 'ls' with the command of your choice</p>
|
Algorithm to return the maximum possible sum of subsequences in a sequence <pre><code>int maxSumRec(const vector<int> &a, int left, int right){
if (left == right){
if (a[left] > 0){
return a[left];
}
else
return 0;
}
int center = (left... | <blockquote>
<ol>
<li>in the first if statement, why return 0 if a[left] < 0?</li>
</ol>
</blockquote>
<p>Because then the empty subsequence has the maximum sum, which is 0.</p>
|
Online mnesia recovery from network partition <p>Is it possible to recover from a network partition in an mnesia cluster without restarting any of the nodes involved? If so, how does one go about it?</p>
<p>I'm interested specifically in knowing:</p>
<ul>
<li>How this can be done with the standard OTP mnesia (v4.4.7)... | <p>After some experimentation I've discovered the following:</p>
<ul>
<li>Mnesia considered the network to be partitioned if between two nodes there is a node disconnect and a reconnect without an mnesia restart. </li>
<li>This is true even if no Mnesia read/write operations occur during the time of the disconnection.... |
Why aren't checkboxes/radiobuttons and options resetable if they were set by PHP? <p>Working with XHTML 1.1</p>
<p>I have this login page managed in php. It contains several checkboxes, radiobuttons and a dropdownlist.</p>
<p>There's a lot of formchecking behind it and if something doesn't check out, the page reloads... | <p>If you're using "View Source" and the script is setting aggressive <code>no-cache</code> headers, it's possible that you're not seeing the source code of what's being displayed. Try it in something that shows the live DOM, like Firebug or the DOM Inspector.</p>
|
Regex: Get Filename Without Extension in One Shot? <p>I want to get just the filename using regex, so I've been trying simple things like</p>
<pre><code>([^\.]*)
</code></pre>
<p>which of course work only if the filename has one extension. But if it is <code>adfadsfads.blah.txt</code> I just want <code>adfadsfads.bla... | <p>Try this:</p>
<pre><code>(.+?)(\.[^.]*$|$)
</code></pre>
<p>This will:</p>
<ul>
<li>Capture filenames that start with a dot (e.g. ".logs" is a file named ".logs", not a file extension), which is common in Unix.</li>
<li>Gets everything but the last dot: "foo.bar.jpeg" gets you "foo.bar".</li>
<li>Handles files wi... |
How can I compile Java code in Windows without installing the whole JDK? <p>Letâs say the runtime environment (version 1.6.0_01-b06) is already in place, but since I lack administrative privileges in this particular PC, the JDK canât be installed. So, is there any portable JDK or standalone Java compiler for Window... | <p>You might try taking the tools.jar file from the JDK (you would have to copy it over from another machine) and see if that worked.</p>
<p>javac is essentially a small exe that starts the VM with the specific class for the compiler.</p>
<p>Also, there is nothing (that I am aware of) about the JDK install that you c... |
LINQ for diffing sets <p>I have the following arrays:</p>
<pre><code>var original= new int[] { 2, 1, 3 };
var target = new int[] { 1, 3, 4 };
enum Operation {Added,Removed}
</code></pre>
<p>I would like to execute a LINQ query that would return the following: </p>
<pre><code>{{2,Removed},{4,Added}}
</code></pre>
<p... | <p>Perhaps a LINQ solution is not the best option in this case.</p>
<p>This will produce a dictionary with the result that you want.</p>
<pre><code>Dictionary<int, Operation> difference = new Dictionary<int,Operation>();
foreach (int value in original) {
difference.Add(value, Operation.Removed);
}
foreac... |
code to change file extension (up for review) <p>I am using the following piece of C code to change file extension.</p>
<p>{</p>
<pre><code> #define EVAL_MAX_LEN (300)
int nLen;
char szOut [EVAL_MAX_LEN] = {0};
char szPath [EVAL_MAX_LEN] = "/db/file/face.bmp";
// Get string length !!!
nLen = strlen (szPath);
... | <p>You should use <code>snprintf()</code> instead of <code>sprintf()</code> to avoid a potential buffer overflow. You can also use <a href="http://linux.die.net/man/3/strrchr" rel="nofollow"><code>strrchr(3)</code></a> to find the last period, instead of coding your own loop. However, two things to be careful of:</p>... |
converting char** to char* or char <p>I have a old program in which some library function is used and i dont have that library.</p>
<p>So I am writing that program using libraries of c++.
In that old code some function is there which is called like this</p>
<p>*string = newstrdup("Some string goes here");</p>
<p>the... | <p>The function is used to make a copy of c-strings. That's often needed to get a writable version of a string literal. They (string literals) are itself not writable, so such a function copies them into an allocated writable buffer. You can then pass them to functions that modify their argument given, like <code>strto... |
Refactoring fun: dealing with complicated state <p>Let's say we have a web app out there that is supposed to have a user fill out a form, and then it creates a ticket in the backend workflow engine. This form is going to continue to be the portal for the customer to view what's going on. Some forms go straight to ticke... | <p>I've been thinking about state machines alot lately and I found the following proposal very promising. I wish I could tell you it works really great but I have not gotten that far yet. I can tell you that it looks better than any solution I've tried to date. Here's the link.. <a href="http://www.eventhelix.com/Realt... |
cell editing in JTable <p>Im doin a project using JTable, i want to make my table cells editable. I used,
public boolean isCellEditable(int row, int column)
{ <br />
return true; <br />
}
My problem is, the cells are ediable but once after entering data into one cell and move on to the next, the previous data... | <p>Override setValueAt(Object value, int row, int col) method as well. It should store entered data, so getValueAt(int row, int col) method can return new value.
Something like this:</p>
<pre><code>private String[][] data;
public Object getValueAt(int row, int col) {
return data[row][col];
}
public void setValueAt... |
Application Build not loaded on device <p>When I tried to upload a build on device it give the following error.
Your mobile device has encountered an unexpected error <code>(0xE8000001)</code></p>
<p>I am unable to solve this problem. Can anyone tell me why this is happening?</p>
| <p>Anytime i get an unexpected error i hard reboot my device by holding down the home and lock buttons until the apple logo appears. No idea what causes it, but the reboot usually fixes it.</p>
|
Force TFS to use relative paths or update locations <p>I installed TFS 2008 Workgroup Edition a while back, and everything was running fine.</p>
<p>Recently I tried opening TFS to a couple of friends so that we can collaborate on a project. The Source Control portion is working correctly, but the Documents and Reports... | <p>Yeah, relative paths cannot be used due to the way that TFS works - it sends back the full URL's to the Sharepoint and Reporting Services servers to the client machine.</p>
<p>To update the URL's that are used for sharepoint and reporting services to match your fully qualified domain name you want to use TFSAdminUt... |
WebMethod response format <p>I recently saw a jQuery example where a POST was made to "Default.aspx/Test", where Test was a WebMethod in Default.aspx, and the content-type for the request was "application/json".</p>
<p>The reply from the WebMethod was in JSON. I always thought WebMethods returned SOAP responses, but i... | <p>It is a part of <code>ASP.NET AJAX</code>. See for example <a href="http://msdn.microsoft.com/en-us/library/bb515101.aspx" rel="nofollow">Using Web Services in ASP.NET AJAX</a>.
Part of the AJAX client architecture goes like this:</p>
<blockquote>
<p>Call Web services by using the HTTP POST verb. A POST request h... |
Does malloc() allocate a contiguous block of memory? <p>I have a piece of code written by a very old school programmer :-) . it goes something like this </p>
<pre><code>typedef struct ts_request
{
ts_request_buffer_header_def header;
char package[1];
} ts_request_def;
ts_request_buffer... | <p>To answer your numbered points.</p>
<ol>
<li>Yes.</li>
<li>All the bytes. Malloc/free doesn't know or care about the type of the object, just the size.</li>
<li>It is strictly speaking undefined behaviour, but a common trick supported by many implementations. See below for other alternatives.</li>
</ol>
<p>The lat... |
How can I store a GridView cell value to a session variable? <p>How would I store the value of a GridView's selected rows to a session variable?</p>
| <p>From the codebehind file you will want to use something like this to access the underlying data item (MyDataItem) from the selected row. </p>
<pre><code>MyDataItem item = (MyDataItem)GridView1.Rows[GridView1.SelectedIndex].DataItem;
Session["myItem"] = item;
</code></pre>
<p>Remember though, the gridview is alread... |
Spurious unblocking in boost thread <p>I came across this interesting paragraph in the <a href="http://www.boost.org/doc/libs/1%5F38%5F0/doc/html/thread/synchronization.html#thread.synchronization.condvar%5Fref">Boost thread documentation</a> today:</p>
<pre><code>void wait(boost::unique_lock<boost::mutex>& ... | <p><a href="http://www.justsoftwaresolutions.co.uk/threading/condition-variable-spurious-wakes.html">This article by Anthony Williams</a> is particularly detailed.</p>
<blockquote>
<p>Spurious wakes cannot be predicted:
they are essentially random from the
user's point of view. However, they
commonly occur whe... |
Update linked tables in MS Access Database with C# programatically <p>I have two Access 2003 databases (<code>fooDb</code> and <code>barDb</code>). There are four tables in <code>fooDb</code> that are linked to tables in <code>barDb</code>.</p>
<p>Two questions:</p>
<ul>
<li>How do I update the table contents (linked... | <p>Here is my solution to relinking DAO tables using C#.</p>
<p>My application uses a central MS Access database and 8 actual databases that are linked in.
The central database is stored locally to my C# app but the application allows for the 8 data databases to be located elsewhere. On startup, my C# app relinks DAO... |
What is the fastest way to read a large number of small files into memory? <p>I need to read ~50 files on every server start and place each text file's representation into memory. Each text file will have its own string (which is the best type to use for the string holder?).</p>
<p>What is the fastest way to read the ... | <p>A memory mapped file will be fastest... something like this:</p>
<pre><code> final File file;
final FileChannel channel;
final MappedByteBuffer buffer;
file = new File(fileName);
fin = new FileInputStream(file);
channel = fin.getChannel();
buffer = channel.map(Ma... |
Debug with an incompatible Visual Studio, but with .pdb <p>Okay, weird situation: I need to Debug a VSTO Office Addin. This was written in Visual Studio 2008 Professional and debugging is usually done by loading the Project, Attaching to Outlook.exe and setting breakpoints - works fine.</p>
<p>But I gave a situation w... | <p>WinDbg will be able to do this, but it's not exactly user-friendly.</p>
|
How to generate a treeview in html from flexible xml just in client side <p>Could anyone please give me an example in this? I have found many but they didn't match my requirement. </p>
<p>The treeview must have expand and collapse, the xml is flexible, which means I should test if a node is exist, and there are many m... | <p>You asked for examples... I can provide links to online samples :</p>
<ol>
<li><a href="http://www.treemenu.net/" rel="nofollow">TreeMenu</a></li>
<li><a href="http://destroydrop.com/javascripts/tree/" rel="nofollow">dTree</a></li>
<li><a href="http://www.blueshoes.org/en/javascript/tree/" rel="nofollow">BlueShoes ... |
What hashes are common hashes? used on the net and other programs? <p>I seen MD5 and SHA1 hashes on the net to verify files. What are common hashes used on the net and other programs? This is to verify a file not to hash a pw.</p>
| <p>I've used some hash functions from the following site before - they are usually pretty quick, and full code is given on the website, and a description of each of the functions and their strengths/weaknesses:</p>
<p><a href="http://www.partow.net/programming/hashfunctions/" rel="nofollow" title="http://www.partow.ne... |
How do I get repeatable CPU-bound benchmark runtimes on Windows? <p>We sometimes have to run some CPU-bound tests where we want to measure runtime. The tests last in the order of a minute. The problem is that from run to run the runtime varies by quite a lot (+/- 5%). We suspect that the variation is caused by activ... | <p>The usual approach is to perform lots of repetitions and then discard outliers. So, if the distractions such as the disk indexer only crops up once every hour or so, and you do 5 minutes runs repeated for 24 hours, you'll have plenty of results where nothing got in the way. It is a good idea to plot the probability ... |
C#: PointF() Array Initializer <p>I need to hard code an array of points in my C# program. The C-style initializer did not work.</p>
<pre><code>PointF[] points = new PointF{
/* what goes here? */
};
</code></pre>
<p>How is it done?</p>
| <p>Like this:</p>
<pre><code>PointF[] points = new PointF[]{
new PointF(0,0), new PointF(1,1)
};
</code></pre>
<p>In c# 3.0 you can write it even shorter:</p>
<pre><code>PointF[] points = {
new PointF(0,0), new PointF(1,1)
};
</code></pre>
<p><strong>update</strong> Guffa pointed out that I was to short wit... |
how do I backup logins and jobs from SQL server 2005? <p>Is there a script or function in sqlserver2005 that i can backup the jobs and login details of a server from the master database?</p>
| <p>Jobs are stored in the <a href="http://msdn.microsoft.com/en-us/library/ms187112.aspx" rel="nofollow">MSDB</a> database and logins in the <a href="http://msdn.microsoft.com/en-us/library/ms187837.aspx" rel="nofollow">Master</a> database.</p>
<p>You can backup these system databases as you would any other of your us... |
Best tools for Thick Client Penetration Testing <p>I am looking for Application Security Testing (Penetration Testing) of Thick Client Applications. I know of Echo Mirage and ITR as good tools to test these kinda applications. </p>
<p>Does anyone know of any other tools that do this?</p>
| <p>Echo Mirage is a greater starter on Thick Clients. Introduced to this by the (smart) bloke who wrote it. It works around dll injection. </p>
<p>What's the context? </p>
<p>It becomes extremely useful on a Thick Client which is leaking info it shouldn't (and using logic built into the client side). This was then u... |
Django Form Preview - Adding the User to the Form before save <pre><code>class RegistrationFormPreview(FormPreview):
preview_template = 'workshops/workshop_register_preview.html'
form_template = 'workshops/workshop_register_form.html'
def done(self, request, cleaned_data):
# Do something w... | <p>If the user can't be modified, I would say it shouldn't even be included in the form in the first place.</p>
<p>Either way, <a href="http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method">using the <code>commit</code> argument</a> to prevent the resulting object being saved immediately shoul... |
Excel Report Setting page setup options in C# <p>I am using the following approach to create a dynamic Excel Report from HTML in my ASP.NET Application. </p>
<p>While creating the excel report, I want to set the Page Setup options such that the report fits into one page. </p>
<p>This is the approach I'm using to crea... | <p>You might need to render using htmltextwriter as explained in</p>
<p><a href="http://forums.asp.net/p/1063850/1538066.aspx#1538066" rel="nofollow">http://forums.asp.net/p/1063850/1538066.aspx#1538066</a></p>
<p>and take the concept to get a solution.</p>
|
jQuery Popup Bubble/Tooltip <p>I'm trying to make a "bubble" that can popup when the <code>onmouseover</code> event is fired and will stay open as long as the mouse is over the item that threw the <code>onmouseover</code> event OR if the mouse is moved into the bubble. My bubble will need to have all manners of HTML an... | <p><a href="http://craigsworks.com/projects/qtip2/">Qtip is the best one I've seen.</a> It's MIT licensed, beautiful, has all the configuration you need. </p>
<p>My favorite lightweight option is <a href="https://github.com/jaz303/tipsy">tipsy</a>. Also MIT licensed. It inspired <a href="http://getbootstrap.com/javasc... |
What is the maximum size of a MySQL database in version 5 and up? <p>What is the maximum size of a MySQL database in version 5 and up?</p>
<p>I do not mean the maximum size of row or table, but the maximum size of the whole database.</p>
| <p>Two billion (2'000'000'000) tables and a max total of 64TB for InnoDB. MyISAM tables are files, so it's underlying OS file limit.</p>
|
Are there any reasons not to use Visual Studio 6 for C++? <p>Are there any reasons why I shouldn't use Visual Studio 6 for C++ development?</p>
<ul>
<li>Where can I find some resources why this would or wouldn't be a good idea?</li>
<li>Are there any lists of issues I would have with this?</li>
</ul>
| <p>I wouldn't say that Visual Studio 6 should "never" be used for C++ development. I would say that it should "no longer" be used for C++ development. Reasons:</p>
<ol>
<li>Microsoft's later compilers (particularly Visual Studio 2008) are much more compliant with the C++ specification.</li>
<li>Microsoft's later compi... |
How can i get tasks performed on a certain date? <p>How can i display the task details performed within a particular date when i click on said date in the calendar control.</p>
<p>Example:</p>
<ul>
<li>I click on Jan 5 in the calendar and then i get the task performed on that date.</li>
</ul>
<p>I am using C# and AS... | <p>store task with date in database. write select statement that has date parameter and return task on given parameter. Onclick event return data from executed procedure and display result.</p>
|
Are there any tools to aid with complex 'if' logic? <p>One of my personal programming demons has always been complex logic that needs to be controlled by if statements (or similiar). Not always necessarily that complex either, sometimes just a few states that needs to be accounted for.</p>
<p>Are there any tools or st... | <p>I'd recommend a basic course in <a href="http://en.wikipedia.org/wiki/Propositional_logic">propositional logic</a> for every aspiring programmer. At first, the notation and Greek letters may seem off-putting to the math-averse, but it is really one of the most powerful (and oft-neglected) tools in your skillset, and... |
Threading in a DLL where the DLL must return before child thread finishes <p>I am working on writing a wrapper DLL to interface a communication DLL for a yokogawa WT1600 power meter, to a PC based automation package. I got the communication part to work but I need to thread it so that a 50ms scan time of the automation... | <p>Any thread created (whether in a DLL or elsewhere) will not stop spontaneously. In particular, the function that created the thread may return. The new thread would still run even if the creator thread exited. That is, assuming it didn't hit the end of its entry function.</p>
<p>Windows threads return a DWORD when ... |
How do recommendation systems work? <p>I've always been curious as to how these systems work. For example, how do netflix or Amazon determine what recommendations to make based on past purchases and/or ratings? Are there any algorithms to read up on?</p>
<p>Just so there's no misperceptions here, there's no practica... | <p>At it's most basic, most recommendation systems work by saying one of two things.</p>
<p><strong>User-based recommendations:</strong><br />
If User A likes Items 1,2,3,4, and 5,<br />
And User B likes Items 1,2,3, and 4<br />
Then User B is quite likely to also like Item 5 </p>
<p><strong>Item-based recommendatio... |
Sqlite3 connect class for iPhone SDK <p>Is there any common sqlite3 connection class available for working with the iPhone SDK. I realize that it is quite easy to connect and run queries everytime, but to save up more time it would be a real help if we could use a class to handle all the sql directly.</p>
<p>I would i... | <p>Also take a look at <a href="http://code.google.com/p/sqlitepersistentobjects/" rel="nofollow">SQLitePersistentObjects</a>, which I use. The big advantage is that I for now don't have to worry about schemas and such. However, SQLitePO doesn't seem to be able to store objects into alternate tables, AFAIK. Otherwise i... |
Memory leak when using time in NHibernate SQL query <p>I use NHibernate in my ASP.NET application to connect to an MS SQL Server 2005 database. In some cases I need to write my own SQL queries. However, I noticed that the SQL server thread leaks about 50 KB of memory every time I execute the following piece of code:</p... | <p>You've added a query plan to the procedure cache, perhaps?</p>
<p>sqlservr.exe takes memory and does not release it unless it has to when other apps require it. Hence DB servers are standalone and not multi-purpose.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms178145%28SQL.90%29.aspx" rel="nofollow">F... |
SQL Reporting Services 2005 local time zone <p>We store our date/time information in UTC format on our SQL Server. </p>
<p>When using SQL Reporting Services, we'd like to display this data in the time zone of the client workstation, but it appears that using an expression like;</p>
<pre><code>System.TimeZone.Current... | <p>If your reports are standalone I can't see other option than add timezone report parameter. </p>
<p>But if you using reports inside web application, you can <a href="http://stackoverflow.com/questions/338482/can-you-determine-timezone-from-request-variables">Determine Timezone from Request Variables with JavaScrip... |
Can my requirements be met with JMX? <p>I am completely new to <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/" rel="nofollow">JMX</a>. I have a specific requirement and wanted to know if it is possible to accomplish within the scope of JMX. </p>
<h3>Requirements:</h3>
<p>I have a set ... | <p>You could use <a href="http://www.nagios.org" rel="nofollow">nagios</a> combined with <a href="http://www.nagiosexchange.org/cgi-bin/page.cgi?g=2338.html;d=1" rel="nofollow">check_jmx</a> to monitor (<a href="http://www.pnp4nagios.org/" rel="nofollow">create statistics</a>)
and may trigger a restart of a resource. (... |
Possible to dynamically add an asp:CheckBox control to a TableCell? <p>In my .NET application I need to add a checkbox to each row in a dynamically created asp:Table.
Is it possible to do that by dynamically creating an asp:CheckBox for each row and somehow put it inside a TableCell object? (In that case how?)</p>
<p>... | <p>in aspx:</p>
<pre><code><asp:Table id=T1 runat=server />
</code></pre>
<p>in cs:</p>
<pre><code>TableCell tc;
foreach(TableRow tr in T1.Rows)
{
tr.Cells.Add(tc = new TableCell());
((IParserAccessor)tc).AddParsedSubObject(new CheckBox());
}
</code></pre>
|
What are your experiences with NPanday? <p>Have you used <a href="http://npanday.codeplex.com/" rel="nofollow">NPanday</a> to integrate Visual Studio with <a href="http://maven.apache.org/" rel="nofollow">Apache Maven</a>? If so, did it work well? Would you use it again?</p>
<p>Edit: Less specifically, I suppose, the ... | <p>While some of the problems still exist, NPanday has made quite some progress since 1.1 - it has moved to <a href="http://incubator.apache.org/npanday/" rel="nofollow">Apache</a>, and <a href="http://startbigthinksmall.wordpress.com/2011/05/26/apache-npanday-1-4-0-incubating-released-net-for-maven/" rel="nofollow">1.... |
array length <pre><code>var a = [1,4,5];
var e = a.length--;
</code></pre>
<p>Here <code>e</code> variable will contain 5. But if I do:</p>
<pre><code>var e = a.length-=1;
</code></pre>
<p>Here <code>e</code> will contain 2 the number of elements array.
<br>So the first is a language 'tip' to simulate a pop() array ... | <pre><code>var a = [1, 4, 5];
var e = a.length--;
</code></pre>
<p>is the same as</p>
<pre><code>var a = [1, 4, 5];
var e = a.length;
a.length = a.length - 1;
</code></pre>
<p>whereas</p>
<pre><code> var a = [1, 4, 5];
var e = a.length -= 1;
</code></pre>
<p>is the same as</p>
<pre><code>var a = [1, 4, 5];
a.len... |
What is the impact of namespaces in c++ linkages compared to linkages in c? <p>What is the impact of namespaces in c++ linkages compared to linkages in c?</p>
<p>Is it possible to make a name that has internal linkage to external linkage just by using namespace.Similarly the other way around.</p>
| <p>In general, namespace name is prepended to any enclosed entity's name before the name is mangled and goes to the linker.</p>
<p>If you have two functions with the same signatures in different namespaces they link into one file just fine. If you have two classes with the same name and at least one method with the sa... |
LINQ and the Count extension method <p>I have a database table which could contain many records and I'd like to count the current total in the table. I was going to do a simple:</p>
<pre><code>DataContext.Table.Count(c => c.condition);
</code></pre>
<p>Until I realized the return type for <code>Count</code> is <co... | <p>Use LongCount(), same thing but with a 64 bit result.</p>
|
Get all images loaded into a dynamic text box in AS3 <p>I was able to smooth the loaded, rotated images in my textbox as discussed in <a href="http://stackoverflow.com/questions/624754/enable-smoothing-on-imported-rotated-image-in-dynamic-text-box-in-flash-as3">this question</a>. That solution requires that I know the ... | <p>You probably want to parse out the ids with a regular expression ?</p>
|
Is any source code available that has an Active X control hosted in WPF? <p>I am looking for some source code and a project to download and look at that has an Active X control hosting WPF. I can not find any source code anywhere on the net.</p>
<p>I can not add a WPF resource the usual way in an Active X control. ... | <p>Not sure if this is even possible. I would check out WPF browser applications. That may be a better solution for you given that if you are going to be running an active x control with WPF the user will need 1) Internet Explorer and 2) .net 3.0+ installed locally. A WPF Browser application will work with IE if the us... |
How can I detect if a string is empty of characters? <p>How do I determine if the string has any alpha character or not? </p>
<p>In other words, if the string has only spaces in it how do I treat it as an Empty string?</p>
| <p>Try:</p>
<pre><code>if the_string.replace(" ", "") == "":
the_string = ""
</code></pre>
<p>If your language supports it, using "trim", "strip" or "chomp" to remove leading/trailing whitespace could be good too...</p>
<p><strong>edit</strong>: Of course, regular expressions could solve this problem too: <code>... |
Handing dates in Zend_Form - changing to and from date formats <p><br />
I'm working on a Zend Framework (v1.7) application that calls for a few forms that users need to enter dates on. </p>
<p>The user is prompted to enter dates in the <strong>dd/mm/yyyy</strong> format, but the MySQL database wants the dates to be p... | <p>You can skip the reformatting if you use the according sql functions like <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function%5Fdate-format" rel="nofollow">DATE_FORMAT()</a> and <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function%5Fstr-to-date" rel=... |
SQL HELP - Conditional where clause based on a BIT variable - SQL Server <p>I need help writing a conditional where clause. here is my situation:</p>
<p>I have a bit value that determines what rows to return in a select statement. If the value is true, I need to return rows where the import_id column is not null, if f... | <p>Change the <code>AND</code> to <code>OR</code></p>
<pre><code>DECLARE @imported BIT
SELECT id, import_id, name FROM Foo WHERE
(@imported = 1 AND import_id IS NOT NULL)
OR (@imported = 0 AND import_is IS NULL)
</code></pre>
<h3>Decomposing your original statement</h3>
<p>you have essentially written</p>
... |
What is a better design? <p>I have a scenario at hand which has some design discussion going on. To break it down in simple words, think about a hierarchy as such
Company -----> Customer ------> Orders
(ignore the details of how the orders have products etc)
if I was to expose an API to work with this, what would be a ... | <p>I'd go with (A) but I'd be inclined to change...</p>
<pre><code>Dim comp As New Company
comp.GetInfo(123)
</code></pre>
<p>into...</p>
<pre><code>Dim comp As Company = Company.Get(123)
</code></pre>
<p>(so add a new shared method to the Company class to return a specific instance of Company)</p>
|
How do I make this class more reusable? (specific example inside) <p>I've got a method which currently takes an IList as a parameter, where UserBO is similar to the following:</p>
<pre><code>public class UserBO {
public string Username { get; set; }
public string Password { get; set; }
public string Pin { ... | <p>It's not clear <em>exactly</em> what you need to do with the strings after formatting. You could make the method take an <code>IEnumerable<string></code>, and then make the calling code:</p>
<pre><code>WriteUsers(users.Select(user => string.Format("{0}: {1}",
... |
How to run a NetBeans project in command prompt? <p>My professor asked us to create a Java program that would be able to run in command prompt but could also be opened using NetBeans.</p>
<p>The program is about using the different types of sorting (specifically Selection, Insertion, Exchange, Quick, and Heap sorting)... | <p>If you click build inside NetBeans, it should give you (in your compiler output) a message like, "To run this application from the command line without Ant, try:
java -jar yourPathToRun"</p>
|
How do I host PDF content on a webpage that also is capable of running javascript? ASP.Net solutions please <p>first question so be gentle with me and thanks in advance for your help!</p>
<p>I'm going to add quite a bit of context to explain why I'm asking the question I am and why I want to do what I want to do. Bea... | <blockquote>
<p>That worked in the sense that I got my modal dialog showing which was great and the PDF displayed (which was something at least) in a cosy little two inches at the top of the page</p>
</blockquote>
<p>Then give the iframe a bigger height. Either through the âheightâ attribute, if you can guess a ... |
Why all text boxes won't select? <p>I have a form with a Tab Control that has 18 pages. When I click on a tab it opens the page and select a textbox on that page (<code>txtTextbox1.Select()</code>). This works for the first 8 pages but not for the remaining 10 pages. Although on these pages I can mouse click on the tex... | <p>I'm curious about:</p>
<blockquote>
<p>The code for all my pages is the same except for the tab name and the control names.</p>
</blockquote>
<p>I'd guess that you created the first one from scratch and did a lot of copy/paste/edit to create each subsequent page. Am I right?</p>
<p>The first thing I'd check wou... |
In Java what should I use for a PriorityQueue that returns the greatest element first? <p>Java's <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/PriorityQueue.html" rel="nofollow">PriorityQueue</a> places the least element at the head of the list, however I need it to place the greatest element at the head. ... | <p>Pass a <a href="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html">Comparator</a> that inverts the natural order when you instantiate the <a href="http://java.sun.com/javase/6/docs/api/java/util/PriorityQueue.html">PriorityQueue</a>.</p>
<p>It would look something like this:</p>
<pre><code>public cla... |
Searching multiple tables with MySQL <p>I am writing a PHP/MySQL program and I would like to know how to search across multiple tables using MySQL.</p>
<p>Basically, I have a search box as in the top right of most sites, and when user's search something in that box, it needs to search in users.username, users.profile_... | <p>You can either write your procedure to query each of these tables individually, or you could create a relatively simple view that conglomerates all of the searchable columns of the important tables along with an indicator showing which table they're from. There's not really a magic way to search multiple tables othe... |
Host Page - User control communication ASP.NET <p>I have a number of user controls. The user controls can be used on different pages. The behavior of the user controls are different based on what page they are used on. </p>
<p>How can I set a parameter on the host page that ALL user controls have access to?</p>
| <p>Your description "The behavior of the user controls are different based on what page they are used on" indicates a design flaw. The Control Model in ASP.NET is designed around <a href="http://en.wikipedia.org/wiki/Encapsulation%5F%28computer%5Fscience%29" rel="nofollow">encapsulation</a> and <a href="http://en.wiki... |
Will creating a new folder break subversion? <p>I have a subversion repository, but there are some things that I don't want it to mess with. For example, SVN breaks mac resource files because unix doesn't know about the resource fork. </p>
<p>However, I still want some form of back-up/version control. I would like to ... | <p>I'd be incredibly nervous about doing this. </p>
<p>Whilst it may not actively break subversion immediately, subversion is going to assume that it has complete control of all the folders within the repository, and that it knows what they all are. If some tool, script or process performs some generic action across a... |
Zend Framework: strange url rewrite behavior <p>I am experiencing strange behavior with my Zend Framework application.</p>
<p>I run this url, hoping to get index controller run the 1234567890 action.</p>
<pre><code>http://hello.com/index/1234567890?test=http%3A%2F%2Fworld.com%2Findex.php
</code></pre>
<p>I however g... | <p>You didn't put much in the way you've tried to debug this so I wandered over to my own localhost and gave your url a shot. Low and behold mine does the same thing, I tried two different modrewrite methods:</p>
<pre><code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.p... |
Localizable User Controls <p>If I have a form that is localized and has User Controls that are localized, how I can I view the form and the controls in the language specified in the VS Properties?</p>
<p>Right now when I change the language, all my controls that are not part a user control adjust appropriately, but my... | <p>You have to localize each user control individually when designing it in the designer. Then you can set the property Localizable on the user control to true and choose your language. Unfortunately the surrounding Form does not escalate these two properties to its user controls when the Form is designed. That is a pr... |
drawImage in Java applet flickers in Safari <p>I'm having a flicker problem in a Java applet in Safari (Mac). However, it's not the usual double buffering problem.</p>
<p>I have isolated it down to one single <code>drawImage</code> call (no redundant repaint, no <code>clear</code> is called), which gives a white flick... | <p>You give very small information. That is difficult to answer.</p>
<p>Do you recreate the Image before you paint it? Then you can buffer it or use an media tracker.</p>
<p>If you use an old Java version then update it. The old versions for OSX are very buggy.</p>
|
sIFR 3.0 and sWmode <p>Previous versions of sIFR allowed users to enter "sWmode: 'transparent'" to avoid the common problem of Flash objects being overlayed on regular HTML objects on screen, no matter the z-index of either elements.</p>
<p>How do I replicate this behavior in sIFR 3.0?</p>
| <p>I think you just need to add: </p>
<pre><code>wmode: 'transparent'
</code></pre>
<p>in the object you send into sIFR.replace()</p>
|
WPF or WinForms for internal tools? <p>At my company we develop a number of tools for internal that range from simple utilities to full-blown editors. The priorities for these tools are stability, usability, and turn-around time (meaning how quickly new features can be added).</p>
<p>We've been using WinForms up until... | <p>Don't underestimate the learning curve. WPF can be really great to work with, and it can be a nightmare. I've seen WinForms only developers more helpless with WPF then with ASP.NET (even with very little knowledge of web development). While most developers were able to just start working with WinForms and ASP.NET wi... |
Flash 8 FileReference and file integrity check <p>Flash 8 FileReference API gives you the possibility to check periodically for the number of bytes being transmitted:</p>
<pre><code>listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: ... | <p>Just listen to the onComplete event to check whenever the file is properly uploaded.
If no error events have been thrown so far the file <em>should</em> be on the server.</p>
<p>If you don't want to trust FlashPlayer regarding the <em>integrety</em> of the posted file (e.g. your server failed moving it from the /tm... |
Asp.net Cookie Domain / Scope <p>I have a "cookie" handler / utility class that works quite well for me. It abstracts away a lot of the issues that I drive me crazy when dealing with cookies such as how to handle a response (write) operation followed by a request (read) operation on the same postback, how to handle enc... | <p>Set the <code>Path</code> property of the <code>Cookie</code> to either <code>/app1</code> or <code>/app2</code></p>
|
How can I get the path of a compiled resource? <p>I have included an executable in my project ( i.e. when you unfold the project in the Solution Explorer in VS2008, you see it along with all the other classes). This executable will need to be launched by my program. How can I retrieve its path programmatically?</p>
| <p>I've never done this before with executables... However, if it's an embedded resource, you can enumerate through the list of embedded resources in your application (or refer directly to it by name), when you find the one appropriate, write it to disk, and then execute it.</p>
<p>To extract:</p>
<pre><code>Assembly... |
Linq Fetch all controls (ordered) <p>Is there a way to fetch all the control using linq.</p>
<p>What I'll like to do is something like that (order the control by tab index) :</p>
<pre><code>foreach (Control control in this.Controls.OrderBy(c => c.TabIndex)
{
...
}
</code></pre>
<p>I use that kind of query whe... | <p><code>ControlCollection</code> only implements <code>IEnumerable</code>, not <code>IEnumerable<T></code>. That's easy to fix though - add a call to <code>Cast()</code>:</p>
<pre><code>foreach (Control control in Controls.Cast<Control>()
.OrderBy(c => c.TabIndex))
{... |
What's more expensive, comparison or assignment? <p>I've started reading <a href="http://www.cs.berkeley.edu/~vazirani/algorithms.html">Algorithms</a> and I keep wondering, when dealing with primitives of the same type, which is the more expensive operation, assignment or comparison? Does this vary a great deal between... | <p>What do you think?</p>
<p>At the lowest level one does two reads, the other does a read and a write.</p>
<p>But why should you really care? You shouldn't care about performance at this level. Optimize for <a href="http://en.wikipedia.org/wiki/Big%5FO%5Fnotation">Big-O</a></p>
|
Website Partitioning and URL space <p>My website is growing. I need to partition feature sets to different group of servers instead of having all features run on a single server copy. I have 8 identical servers in a Windows Network Load Balancing setup.</p>
<p>The problem is: I need to keep the URL space the same. Wha... | <p>There are indeed several solutions to implement load balancing:</p>
<ol>
<li>DNS Round-Robin</li>
<li>DNS Load Balancing (with lbnamed)</li>
<li>Proxy Round-Robin</li>
<li>Hardware/TCP Round-Robin</li>
</ol>
<p>I understood 1) and 2) are not an option here so... if you have money and <strong>really high performanc... |
Avoiding duplication in WPF (following DRY) <p>Consider the follow 2 XAML snippets (which are side-by-side in the file):</p>
<pre><code><Button
x:Name="BuyButton"
Margin="0,0,1,1"
IsEnabled="{Binding CanBuy}"
>
<StackPanel
DataContext="{Binding Product}">
<TextBlock
F... | <p>A ControlTemplate might work:</p>
<pre><code><ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}">
<StackPanel Height="Auto" Width="Auto">
<TextBlock Text="{TemplateBinding Content}" Foreground="Red"/>
<TextBlock Text="{TemplateBinding Tag}" Foreground="Red"/>
</... |
Does any Unix-like system ascribe meaning to the SUID bit on a directory? <p>As the title says, does any Unix-like system ascribe a meaning to the SUID bit on a <strong>directory</strong>, and if so, what does it mean?</p>
<p>The SVTX (saved text, or sticky) bit has a meaning - thou shalt not delete a file from this d... | <p>As a followup on Node's answer, I will post the following from the FreeBSD man page for mount(8):</p>
<pre><code> suiddir
A directory on the mounted file system will respond to
the SUID bit being set, by setting the owner of any new
files to be the same... |
rails : what's wrong with this multiple join with conditions on the associations? <p>Here are my models:</p>
<pre><code>class Deck < ActiveRecord::Base
belongs_to :game
has_many :deck_cards
end
class DeckCard < ActiveRecord::Base
belongs_to :card
belongs_to :deck
end
class Card < ActiveRecord::Base
... | <p>You need to complete your association with the Card model:</p>
<pre><code>class Card < ActiveRecord::Base
has_many :deck_cards
end
</code></pre>
<p><strong>EDIT 2</strong>: Try this:</p>
<pre><code> DeckCard.find :all, :joins => [:card, :deck], :conditions => ["decks.game_id = ? and cards.present = ?",... |
Object property "Previous Value" in Javascript <p>I'm just starting to get my mind around this whole Object Oriented thing, so bear with me.</p>
<p>So, I saw an example of an object function (for Javascript) where you assign a new value and that value gets assigned as that property's actual value. Example:</p>
<pre><... | <p>This will store it when you call <code>obj.newPrice(xxx);</code> - I don't think you can do it automatically when using <code>obj.price = xxx;</code></p>
<pre><code>function Meat (name, color, price) {
function newPrice (new_price) {
this.oldprice = this.price
this.price = new_price;
}
this... |
How do you get the default TFS Server from Team Explorer? <p>A call like this requires the server name or url:</p>
<pre><code>TeamFoundationServerFactory.GetServer("mytfsserver");
</code></pre>
<p>Likewise, I can use the following to get a list of available servers or server names:</p>
<pre><code>TeamFoundationServe... | <p>Not sure about default (which is simply the server Team Explorer was connected to the last time VS saved its configuration), but you can get the server with a mapping to the current folder.</p>
<pre><code>var wsp = Microsoft.TeamFoundation.VersionControl.Client.Workstation.GetLocalWorkspaceInfo(path)
var server = w... |
How to run an operation on a collection in Python and collect the results? <p>How to run an operation on a collection in Python and collect the results?</p>
<p>So if I have a list of 100 numbers, and I want to run a function like this for each of them:</p>
<pre><code>Operation ( originalElement, anotherVar ) # return... | <p><a href="http://docs.python.org/tutorial/datastructures.html#list-comprehensions" rel="nofollow">List comprehensions.</a> In Python they look something like:</p>
<pre><code>a = [f(x) for x in bar]
</code></pre>
<p>Where f(x) is some function and bar is a sequence.</p>
<p>You can define f(x) as a partially applie... |
What should I consider when selecting a language? <h3>Duplicate:</h3>
<blockquote>
<p><a href="http://stackoverflow.com/questions/550332/best-language-for-rapid-prototyping">Best Language for Rapid Prototyping?</a></p>
<p><a href="http://stackoverflow.com/questions/146840/which-language-should-students-start-wi... | <p>There are lots of questions on Stack Overflow along these lines:</p>
<ul>
<li><p><a href="http://stackoverflow.com/questions/145104/what-coding-languages-should-a-web-developer-know">What coding languages should a web developer know?</a></p></li>
<li><p><a href="http://stackoverflow.com/questions/146840/which-langu... |
Are there any studies on whether functional/declarative or imperative programming is easier to learn as a first language? <p>Not best to learn, but easiest to learn. Not easiest for programmers, but for non-programmers (as a first language). Not opinions or anecdotes, but are there any studies?</p>
<p>I think that f... | <p><a href="http://htdp.org/" rel="nofollow">Matthias Felleisen and his colleagues</a> have assembled some very convincing evidence that the easiest language to learn is a language that is <strong>designed for beginning programmers</strong> and has <strong>tool support aimed at beginning programmers</strong>. They hav... |
Java Swing Problem <p>I have a board with cards in which I have to find matches. I have two variables <code>buttonA</code> and <code>buttonB</code> to keep track of the squares clicked.</p>
<p>When they are equal I can remove them from the board by simply adding this code:</p>
<pre><code>cards[buttonA].setVisible(fal... | <p>You probably need to use:</p>
<pre><code>new ImageIcon(getClass().getResource("/path/to/myPic.png"));
</code></pre>
<p>Where this resource is on the <code>classpath</code>. (Remember if using an IDE you need to make sure that your PNG resources get copied over to the output directory. In IDEA for example, this is ... |
How can I hide elements which only contain hidden DIVs in jQuery? <p>I want to hide all blocks which only contain hidden DIVs (aside from a caption). All elements have to be selected via class names.</p>
<p>In detail, I want each "eventBlock" not to show up when all "groupBlocks" underneath are already hidden. The sam... | <p>This should work:</p>
<pre><code>var blocks = jQuery(".groupBlock");
if( blocks.size() == blocks.not(":visible").size() )
{
blocks.parents(".eventBlock").hide();
}
</code></pre>
<p>You can do something similar to hide the menu if all groupBlocks are hidden.</p>
|
error: X may be used uninitialized in this function in C <p>I am getting this error</p>
<pre><code>error: Access.Core may be used uninitialized in this function
</code></pre>
<p>And this is my code:</p>
<pre><code> static int FirstTime = 1;
MyStruct Access;
if (FirstTime) {
FirstTime = 0;
Access = Implement... | <p>Make <code>Access</code> like this (and remove <code>FirstTime</code> and the <code>if</code>):</p>
<pre><code>static MyStruct Access = Implementation(this_b);
</code></pre>
<p>The reason you get this warning is because static variables survive one function call. Their value is retained across all function calls (... |
Version control approaches in Scrum <p>Recently with my coworkers we were discussing how to organize the version control in a Scrum project. More specifically, the criteria for branches creation (per developer, per task, per Story, per Sprint?) and the methods of integration. </p>
<p>My opinion was that a useful way t... | <p>Keep branching protocol light-weight. In Scrum, if someone wants to branch the code to work on a specific feature, let them. Nobody should be afraid to branch. This is one of the benefits of DVCS - people branch when they want and aren't biased by team rules or standards.</p>
<p>For my money, it's a case-by-case ba... |
htaccess won't load images and css <p>I recently changed the directory to one of my websites and wrote a rule within the htaccess file to handle the redirect. However, the css and images fail to load now.</p>
<pre><code>Options -Indexes
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(\.*)$ http:/... | <p>Try this rule:</p>
<pre><code>RewriteRule !^temp_site/ /temp_site%{REQUEST_URI} [R=301,L]
</code></pre>
|
Can I stop 100% Width Text Boxes from extending beyond their containers? <p>Lets say I have a text box that I want to fill a whole line. I would give it a style like this:</p>
<pre><code>input.wide {display:block; width: 100%}
</code></pre>
<p>This causes problems because the width is based on the content of the text... | <blockquote>
<p>Is there any way to make a text box fill the width of its container without expanding beyond it?</p>
</blockquote>
<p>Yes: by using the CSS3 property âbox-sizing: border-boxâ, you can redefine what âwidthâ means to include the external padding and border.</p>
<p>Unfortunately because it's CS... |
JSF Tuning <p>Running into an issue where JSF is filling up our sessions. We had a system crash the other day. Sent the Heap to IBM for review and found that we had some sessions as large as 50M. They found JSF components in the session and some very large. </p>
<p>So, is there any tuning that can be done? Configur... | <p>JSF is a useful technology, but you can certainly hang yourself with it.</p>
<p>It sounds like, either you're inflating the size of the view state (by setting large values on components) or you're leaking references to components into other session state (which would be bad). Another potential culprit would be an e... |
tsql : how do I join this table? <p>I have the following sql statement: </p>
<pre><code>SELECT TOP (100) PERCENT inv.CompanyID,
cust.CustID AS ClientID,
cust.CustName AS CustomerName,
inv.InvcKey, inv.PrimarySperKey AS SperKey,
... | <p>Add <code>Inventory.LastUnitCost</code> to the <code>SELECT</code> list</p>
<p>and add this line to the end of the query:</p>
<pre><code>dbo.Inventory LEFT OUTER JOIN dbo.timItem ON dbo.timItem.itemkey = dbo.Inventory.itemkey
</code></pre>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.