input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
rotate text from a horizontal to a vertical position <p>Is it possible to rotate text from a horizontal position to a vertical on a single point without using something like flash? So I would read the same text normally by tilting my head.</p>
<p>I was thinking you can do this in jquery but couldn't find a plug in.</p... | <p>i used pure CSS and it worked very fine for me,here is the code:</p>
<pre><code><div style="-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); z-index:inherit; float:left">Not at all</div>
</code></pre>
|
Why does my jQuery alert show twice? <p>I am using jQuery. I have a problem when alerts the IDs of a list shows two times, instead of once.</p>
<p>The list:</p>
<pre><code><ul id="testnav">
<li> <a href="#">Page 1</a></li>
<li> <a href="#">Page2..</a>
&l... | <p>$("li").click() is applying the click event to all LIs on the page.</p>
<p>When you click</p>
<pre><code><li> <a href="#">Page2..</a>
<ul id="subnav">
<li id="content_1"><a href="#"> Page3</a></li>
</ul>
</li>
</code></pre>
<p>You're ... |
What's a good way to get started integrating ADFS with AzMan? <p>Does anyone know of any good screenscasts or documentation covering the integration Active Directory Federation Services (ADFS) with Authorization Manager (AzMan)?</p>
| <p>There are many links I would recommend, screencasts are always a good way to get started:</p>
<p><strong><em>Channel 9 Screencasts</em></strong>:</p>
<p><em>AzMan</em></p>
<p><a href="http://channel9.msdn.com/posts/donovanf/Demystified-Series-Getting-Started-with-AzMan/" rel="nofollow">Demystified Series: Getting... |
Add a link stylesheet dynamically in the <head> <p>How to add a link stylesheet reference to the head of a document ?</p>
<p>I've found this code but it's not working with all browsers, it crashes my IE7 :</p>
<pre><code>var ss = document.createElement("link");
ss.type = "text/css";
ss.rel = "stylesheet";
ss.href = "... | <p>Internet explorer will support innerHTML, though it adds reflow this would work:</p>
<pre><code>var headHTML = document.getElementsByTagName('head')[0].innerHTML;
headHTML += '<link type="text/css" rel="stylesheet" href="style.css">';
document.getElementsByTagName('head')[0].innerHTML = headHTML;
</code></... |
ASP.net: weird url parameter when implment meta refresh on header <p>I was trying to implement Rick's adding meta refresh via header on this <a href="http://www.west-wind.com/Weblog/posts/6841.aspx" rel="nofollow">article</a></p>
<p>For some reason my url look like this </p>
<p><a href="http://localhost/pickweb/" rel... | <p>Looks like you are using cookieless sessions:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa479314.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa479314.aspx</a></p>
|
PHP landmines in general <p>What surprises have other people found with writing PHP web applications? There's the well known and to be fixed issue with compile time class inheritance but I know of a couple others and wanted to try and build a list of the top gotcha's of the language.</p>
<p>Note: </p>
<p>I've held s... | <p>I'm not sure if this counts, but the need to compile PHP scripts is a huge performance issue. In any serious PHP project you need some kind of compiler cache like <a href="http://de.php.net/apc" rel="nofollow">APC</a>, <a href="http://eaccelerator.net/" rel="nofollow">eAccelerator</a>, <a href="http://www.php-accele... |
Database as fileformat <p>A niave beginners question about database design.<br />
I have an app managing some logger data eg. 1000s of sequential measurements of time, voltage, current, temperature. In addition each sequence run has meta data (date, location, etc).<br />
So I need a table for each set of measurements a... | <p>You'd have one table (Run) that stores date/time/location and an integer primary key (auto increment).</p>
<p>You'd have another table (Measurements) that stores time/voltage/current/temp, an integer primary key (auto increment), and a FK to Run (just a not-null integer column called RunID).</p>
<p>So 2 tables tot... |
C++ CLI cryptic function call <p>So I'm trying to call a function that is a manged wrapper around an OCX object. Having great difficulty. Function is;</p>
<pre><code>foo(System::Object ^% theBuffer)
</code></pre>
<p>where 'theBuffer' is an array of bytes. The template for the unmanaged OCX which 'foo' wraps is</p>
<... | <p>You can't convert a <code>VARIANT</code> to the buffer directly.</p>
<p>First you need to check what kind of object is stored in it by checking <code>theBuffer->vt</code>. The returned value will be of the type <code>VARTYPE </code>.</p>
|
What coding tricks have you used to avoid writing more sql? <p>This question was suggested by <a href="http://stackoverflow.com/users/5486/kyralessa">Kyralessa</a> in the <a href="http://stackoverflow.com/questions/488020/what-is-your-most-useful-sql-trick-to-avoid-writing-more-code">What is your most useful sql trick ... | <p>If you want to avoid writting SQL use an ORM such as nHibernate, or one of the Microsoft offerings Linq to SQL / Entity Framework</p>
<p>This is even better then using a generator since you won't need to rerun the generators, and if you use Fluent nHibernate you can enable Configuration via Convention and not even ... |
SmartPhone with a good SDK on Sprint PCS? <p>For as long as mobile phones have been running third-party applications, I've wanted to try my hand at writing some.</p>
<p>Now that it's coming time to replace my PalmOS-powered Treo 530, I'm looking to acquire a new phone that has a robust platform for third-party develop... | <p>For Sprint network, you are probably better off with BlackBerry or Windows Mobile device. Only these two have pretty robust SDKs. If this is not for personal/hobby project work and you intend to develop commercial apps for them then you should go for Sprint 3.3.2 SDK. It works for most sprint handsets including touc... |
Specify default filegroup for indices? <p>This is puzzling me - in SQL Server 2005/2008, I can specify the default file group which is then used for all data tables. I can also specify another filegroup for all BLOB type fields.</p>
<p>But I cannot figure out if and how I can specify a default filegroup for indices...... | <p>If there is a clustered index on a table, the data and the clustered index always reside in the same filegroup. You cannot place the base table and clustered index on separate Filegroups. This is because the clustered index is the actual table data.</p>
<p>You can of course place non-clustered indexes in a differen... |
Is there an equivalent to the iSeries OVRDBF command in SQL? <p>I have a requirement in a SQL environment that under specific circumstances, all references to table (or view) A in a procedure actually use table (or view) B. On the iSeries I would have used the OVRDBF command to override references to table A with tabl... | <p>Not sure which SQL environment support which options:</p>
<p>I believe DB2 has a CREATE ALIAS statement. Write the SQL over the alias. </p>
<p>Another possibility: run your queries over views: where you would do the OVRDBF, drop the view and rebuild it over the desired table.</p>
|
How do you return more than one DataTable from a method? <p>I have class which has a method that needs to return three DataTables. I thought I could use Generics but honestly I've never used them, so I'm trying figure it out. It may not be the right thing here.</p>
<p>I have in my class Employee:</p>
<pre><code>pub... | <p>You can add them all to a <a href="http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx" rel="nofollow">DataSet</a> and return that</p>
|
Language detection in PHP ( UTF-8 ) <p>What code snippets are out there for detecting the language of a chunk of UTF-8 text? I basically need to filter a large amount of spam that happens to be in Chinese and Arabic. There's a PECL extension for that, but I want to do this purely in PHP code. I guess I need to loop thr... | <p>Pipe your text through <a href="http://www.google.com/uds/samples/language/detect.html" rel="nofollow">Google's language detection</a>. You can do this via AJAX. Here is the <a href="http://code.google.com/apis/ajaxlanguage/documentation/" rel="nofollow">documentation/developer's guide</a>. For example:</p>
<pre... |
Computing the statistical mode <p>I'm currently trying to verify whether or not, given an unsorted array A of length N and an integer k, whether there exists some element that occurs n/k times or more.</p>
<p>My thinking for this problem was to compute the mode and then compare this to n/k. However, I don't know how t... | <p>Use a hash table to count the frequency of each value:</p>
<pre><code>uint[int] counts;
foreach(num; myArray) {
counts[num]++;
}
int mostFrequent;
uint maxCount = 0;
foreach(num, count; counts) {
if(count > maxCount) {
mostFrequent = num;
maxCount = count;
}
}
</code></pre>
|
gedit plugin development in python <p>Does anyone know where information about writing gedit plugins can be found ? I'm interested in writing them in Python. I know of <a href="http://live.gnome.org/Gedit/PythonPluginHowTo">Gedit/PythonPluginHowTo</a>
, but it isn't very good . Besides the code of writing a plugin tha... | <p>When I started working on my gedit plugin, I used the howto you gave a link to, also startign with <a href="http://www.russellbeattie.com/blog/my-first-gedit-plugin">this URL</a>. Then it was looking at other plugins code... I'm sorry to say that, but for me this topic is poorly documented and best and fastest way i... |
How can I "subtract" one table from another? <p>I have a master table <code>A</code>, with ~9 million rows. Another table <code>B</code> (same structure) has ~28K rows from table <code>A</code>. What would be the best way to remove all contents of <code>B</code> from table <code>A</code>?</p>
<p>The combination of all... | <p>If you have sufficient rights you can create a new table and rename that one to A. To create the new table you can use the following script:</p>
<pre><code>CREATE TABLE TEMP_A AS
SELECT *
FROM A
MINUS
SELECT *
FROM B
</code></pre>
<p>This should perform pretty good.</p>
|
Programmatic MSIL injection <p>Let's say I have a buggy application like this:</p>
<pre><code>using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("2 + 1 = {0}", Add(2, 1));
}
static int Add(int x, int y)... | <p>I guess the question I would ask is "how would you deploy the patch"? Somewhere, you have to deploy something to fix a bug that is already out in the wild. Why would recompiling the dll and releasing the fixed version really be an issue? My guess is that figuring out how to programatically inject MSIL is going to... |
Is there a CSS parser for C#? <p>My program need to parse css files into an in-memory object format. Any advice on how this should be done ?</p>
| <p>ExCSS (supports CSS2.1 and CSS3) on GitHub: <a href="https://github.com/TylerBrinks/ExCSS">https://github.com/TylerBrinks/ExCSS</a>.</p>
<p>Which is a newer version of the code project article: <a href="http://www.codeproject.com/KB/recipes/CSSParser.aspx">http://www.codeproject.com/KB/recipes/CSSParser.aspx</a></p... |
Interesting API Design/Pattern <p>I am re-designing part of our internal ORM tool, and I want to expose Field (a class that represents a field in the database, like CustomerFirstName) directly to the end-developer.</p>
<p>So that was easy enough to accomplish, however the API got a little ugly because this Field class... | <p>In the specific case of the isDirty property, you could just restrict the scope of the setters:</p>
<pre><code>public bool IsDirty
{
get
{
// logic here that the end-devs can use safely.
}
private set
{
// logic here that is only exposed to other ... |
Custom validation summary <p>I'm using the UpdateModel method for validation. How do I specify the text for the error messages as they appear in the validation summary?</p>
<p><hr /></p>
<p>Sorry, I wasn't entirely clear. When I call UpdateModel(), if there is parsing error, for example if a string value is specified... | <p><a href="http://schotime.net/blog/index.php/2009/03/05/validation-with-aspnet-mvc-xval-idataerrorinfo/" rel="nofollow">This tutorial</a> is a good example of the <code>IDataErrorInfo</code> technique - it makes adding validation parameters easy by adding them as attributes directly to the properties of the model cla... |
2-D (concurrent) HashMap: 2-property key type? hashmap of hashmaps? [update] <p>So I need a 2-dimensional <code>ConcurrentHashMap</code>.</p>
<p>It has to be as blazing fast as possible, as I'm going to be adding to and updating its values extremely frequently. It's in a multithreaded application, hence the choice to... | <p><code>ConcurrentHashMap</code> is quite large, so you probably don't want a collection of them.</p>
<p>Short lived objects are actually very fast to allocate. Are you going to have to create the <code>Integers</code> anyway?</p>
<p>You could intern the coordinate objects, but the cost for just a lookup would proba... |
How to effectively use DTO objects (Data Transfer Objects)? <p>What is the best way to implement DTOs?</p>
<p>My understanding is that they are one way to transfer data between objects. For example, in an ASP.Net app, you might use a DTO to send data from the code-behind to the business logic layer component.</p>
<p... | <p>I've used DTO's to:</p>
<ul>
<li>Pass data between the UI and service tier's of a standard 3-tier app.</li>
<li>Pass data as method parameters to encapsulate a large number (5+) of parameters.</li>
</ul>
<p>The 'one DTO to rule them all' approach could get messy, best bet is to go with specific DTO's for each feat... |
What's a good profiler for a CLI based multi-threaded PHP application? <p>I've written a batch processor that runs multiple threads (pcntl_fork) and I'm getting some weird results when child processes go defunct and don't seem to let go of their resources.</p>
<p>Is there a good code profiler, trace utility I can use ... | <p>The only profiler I know of is <a href="http://www.xdebug.org/" rel="nofollow">XDebug</a>. You can process the results with <a href="http://code.google.com/p/webgrind/" rel="nofollow">Webgrind</a> or KCachegrind.</p>
<p>It gives performance statistics about your written PHP code, so you should be able to figure out... |
How can you detect when the user clicks on the notification icon in Windows Mobile (.NET CF 3.5) <p>Surfing the net, I came across this:</p>
<p><a href="http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/msg/d202f6a36c5c4295?dmode=source&hl=en" rel="nofollow">this code</a> that shows... | <p>With this specific API, the key is in the SHNOTIFICATIONDATA's hwndSink member. When the notification is clicked, the hwnd you pass in here will get the click message. For this it's simplest to pass in a <a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.messagewindow(VS.80).aspx" rel="nofo... |
PHP XML Parsing <p>Which is the best way to parse an XML file in PHP ?</p>
<p><strong>First</strong><br/>
Using the DOM object </p>
<pre><code>//code
$dom = new DOMDocument();
$dom->load("xml.xml");
$root = $dom->getElementsByTagName("tag");
foreach($root as $tag)
{
$subChild = $root->getElementsByTagName("... | <p>It depends on the document you're passing, but XMLReader is usually the faster than both simplexml and DOM (<a href="http://blog.liip.ch/archive/2004/05/10/processing_large_xml_documents_with_php.html" rel="nofollow">http://blog.liip.ch/archive/2004/05/10/processing_large_xml_documents_with_php.html</a>). Personally... |
Special mouse events in a browser: wheel, right-click? <p>Google maps is an impressive display of what you can do with javascript and Ajaxy-goodness. Even my mouse scroll wheel and right-click works to provide specific functionality.</p>
<p>In the standard HTML spec, I don't see an "onmouserightclick" event or simila... | <p><strong><em>Mouse Wheel</em></strong>: <br> ol' no-jquery-or-prototype-library method: <a href="http://adomas.org/javascript-mouse-wheel/" rel="nofollow">here</a></p>
<p>Prototype method: <a href="http://www.ogonek.net/mousewheel/demo.html" rel="nofollow">Here</a></p>
<p>JQuery method: <a href="http://www.ogonek.n... |
What is the best way of formally expressing usability requirements? <p>I am writing a system requirements document and need to include non-functional requirements relating to the usability of the system, but am not sure of the best way to express this.</p>
<p>"The system shall be easy to use" seems a bit vague to me, ... | <p>Usually, we try to hash out an application-specific definition of 'easy to use'. For example, for our current project, easy to use means:</p>
<p>-All delays in the system longer than .5 seconds will produce a dialog box that says "Please wait."</p>
<p>-It is possible to reach any given system function from the ma... |
How to open a file for non-exclusive write access using .NET <p>Is it possible to open a file in .NET with non exclusive write access? If so, how? My hope is to have two or more processes write to the same file at the same time.</p>
<p><strong>Edit:</strong> Here is the context of this question: I am writing a simple ... | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.io.fileshare.aspx">FileShare</a> enumeration when opening the file using File.Open. Specifically, use FileShare.ReadWrite. </p>
|
How would a php or java client authenticate if I'm using WCF w/ forms auth? <p>I have a generic proof of concept WCF service that is using forms authentication to secure access. All works great when my client is .NET (vb code below)</p>
<pre><code>Dim client As SupplierServiceClient = New SupplierServiceClient()
clie... | <p>I managed to authenticate a PHP client, but not without some effort.
At first, I tried the following:</p>
<pre><code>$header = new stdClass;
$credentials = new stdClass;
$credentials->Username="myuser";
$credentials->Password="mypass";
$header->UsernameToken = $credentials;
$securityNamespace = "http://do... |
How to compile the generated AS <p>hope you can help me with this question.</p>
<p>So, I've been working for a while with Flex, and had the crazy idea to create pure AS project.</p>
<p>If I compile a Flex app with the -keep flag, the generated actionscript gets generated.</p>
<p>Do you guys know of a way to make it ... | <p>Generated ActionScript is really only provided for reference; it's not really intended to be repurposed in that sense. Indeed, if you even have any, you've most likely compiled your project already anyway (unless you got it from somewhere else), so one might ask why you'd want to compile the generated stuff rather ... |
EXCEL VBA CSV Date formatting issue <p>I am an Excel VBA newbie. My apologies if I am asking what seems to be an obvious question.
I have a CSV text file I am opening in an Excel worksheet. One row of the file contains date information formatted as "YY-MMM', (ie: 9-FEB, or 10-MAY). When the Excel spreadsheet opens the ... | <p>Just to answer a part of your question, here is the list of date formatting options (excluding time):</p>
<pre><code>d = day of month, e.g. 7
dd = zero-padded day of month, e.g. 07
ddd = abbreviated day name, e.g. Thu
dddd = full day name, e.g. Thursday
</code></pre>
<p>pretty much the same for month...</p>
<pre>... |
Open web.config from console application? <p>I have a console capplication that runs on the same computer that hosts a bunch of web.config files. I need the console application to open each web.config file and decrypt the connection string and then test if the connection string works.</p>
<p>The problem I am running ... | <p>Ok I got it... compiled and accessed this so i know it works... </p>
<pre><code> VirtualDirectoryMapping vdm = new VirtualDirectoryMapping(@"C:\test", true);
WebConfigurationFileMap wcfm = new WebConfigurationFileMap();
wcfm.VirtualDirectories.Add("/", vdm);
// Get the Web... |
How do I limit a user's permission in Sharepoint to a single survey <p>I have a user group set up in Sharepoint that has permission to access to a single site. I would like to restrict this groups access futher to a single survey within that site. Is there any way to set Sharepoint permissions to a more granular leve... | <p>You can give access to only specific lists, views or pages using the Limited Access Permission Level</p>
<p>Go into the list or view that you want to give people access to, go to Settings --> List Settings --> Permissions for this List</p>
<p>You can then give direct rights to users that do not have access to any ... |
Parsing XML from the National Weather Service SOAP Service in C# LINQ to XML <p>I'm a junior C# programmer that's trying to develop a library that will allow me to encapsulate the nasty details of parsing the XML returned from the NWS, and returning a collection representing the data.</p>
<p>My SOAP request would retu... | <p>This should be able to get the maximum temperatures for you, you would just have to change the where filter to get the minimums</p>
<pre><code> using System.Xml.Linq;
\\...
XDocument xmlDoc = XDocument.Load("YourXml.xml");
var maximums = from tempvalue in xmlDoc.Descendants("temperature").Elements("value")
... |
objective-c: determining if a regex matches a string <p>What's wrong with the following code?</p>
<pre><code>-(IBAction)numFieldDoneEditing{
NSPredicate * regexTest = [NSPredicate predicateWithFormat: @"SELF MATCHES '^\\d*\\.\\d{2}$'"];
NSString *text = [[NSString alloc] initWithFormat: @"%@", numberFi... | <p>For some reason, you have to escape your backslashes <em>twice</em> for the <code>\d</code> sequence in the regex specification:</p>
<pre><code>NSPredicate * regexTest = [NSPredicate predicateWithFormat: @"SELF MATCHES '^\\\\d*\\.\\\\d{2}$'"];
</code></pre>
<p>Some other problems with your code:</p>
<ul>
<li>You ... |
How do I enumerate and load resources in an iPhone app? <p>I'm trying to populate an NSArray with a collection of images in Resources. However, for maximum flexibility, I'm trying to avoid hard-coding the filenames or even how many files there are.</p>
<p>Normally, I'd do something like this example from the sample c... | <p>Here's a snippet that does just that from my iPhone app</p>
<pre><code>// Load item icons
paths = [[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:nil];
for (NSString *filename in paths) {
filename = [[filename componentsSeparatedByString:@"/"] lastObject];
if ([filename hasPrefix:@"ItemIcon"... |
print.css is printing very small text <p>My print.css pages are printing out very small, super reduced and the text is like 6 pt.:</p>
<pre><code>@charset "UTF-8";
/* CSS Document */
body {
background: white;
font-size: 12pt;
/* Change text colour to black (useful for light text on a dark background) */
.lig... | <p>As pt stands for points being 1/72th of an inch I would hazard a guess that it may be down to screen size, although in reality it could be any number of things. We'd really need more information.</p>
<p>Have you tried using em's instead? They're the best way of dealing with font sizes.</p>
|
Should I use Java's String.format() if performance is important? <p>We have to build Strings all the time for log output and so on. Over the JDK versions we have learned when to use <code>StringBuffer</code> (many appends, thread safe) and <code>StringBuilder</code> (many appends, non-thread-safe).</p>
<p>What's the a... | <p>I took <a href="http://stackoverflow.com/a/513705/1845976">hhafez</a> code and added a <strong>memory test</strong>:</p>
<pre><code>private static void test() {
Runtime runtime = Runtime.getRuntime();
long memory;
...
memory = runtime.freeMemory();
// for loop code
memory = memory-runtime.fr... |
Non-working alpha in Flash Player 6 [Given Up On] <p>I've got a flash project that due to requirements has to be backward compatible with flash 6. Everything works, except the first 6 (of 17) jpeg images that are loaded by <MovieClip>.loadMovie don't respond to changes to their alpha setting.</p>
<p>If I rearrange ... | <p>Are you waiting for all the images to load properly before you change their alpha?
You need to listen for the INIT event (not sure of the exact name in as2) for them to be available to your code.</p>
|
Offscreen rendering to a texture in a win32 service <p>I'm trying to write a C++ windows service that can render to a texture. I've got the code working as a regular console app, but when run as a service <code>wglGetProcAddress()</code> returns NULL.</p>
<p>Can anyone tell me if this is possible, and if so, what do I... | <p>You can get a fully capable software renderer by using Mesa3D.
Simply build Mesa3D and put the opengl32.dll built there alongside your application.
This should enable you to use OpenGL 2.1 and extensions.
We use this for testing Opengl applications in a Windows service.</p>
|
vbscript: test for existence of a column in a recordset <p>Bah, vbscript. </p>
<p>I'm trying to figure out how to get this statement to work: </p>
<pre><code>if (not rsObject("columnNameThatDoesntExist") is nothing) then
' do some stuff
end if
' else do nothin
</code></pre>
<p>Where rsObject is a RecordSet and colu... | <p>I am sure you have your reasons, but if you don't know what fields you are calling back from your database, you could always use On Error Resume Next and On Error Goto 0 to ignore the tossed error. Seems like a bad way to me, but it would work</p>
<pre><code>blnItWasntThere = True
On Error Resume Next
If (rsObject... |
Is there a way to access an iframe's window object from the canvas in FBJS? (facebook) <p>From the facebook canvas, I need to be able to access an iframe window. Normally you could do this with window.frames, but FJBS doesn't seem to allow access to the window object.</p>
<p>Has anyone figured out how to access windo... | <p>you could try this. Let me know how it works. </p>
<pre><code>var myIframe = document.getElementById('myIframeId');
// could retrieve window or document depending on the browser
// (if FBJS allows it!?)
var myIframeWin = myIframe.contentWindow || myIframe.contentDocument;
if( !myIframeWin.document ) { //we've fo... |
Delphi Prism / VS 2008: Switching from code to design with one key? <p>I've used several Versions of the Delphi IDE for many years. When I'm using Delphi Prism, I have to deal with Visual Studio - in my case especially VS 2008. </p>
<p>One of the most annoying things to me is that I have to right-click on my form to s... | <p>You can use default keys:</p>
<ul>
<li>From "Form Designer" - <kbd>F7</kbd></li>
<li>From Code To "Form Designer" - <kbd>Shift</kbd> + <kbd>F7</kbd></li>
</ul>
|
Some data changes in the database. How can I trigger some C# code doing some work upon these changes? <p>Suppose I have some application A with a database. Now I want to add another application B, which should keep track of the database changes of application A. Application B should do some calculations, when data has ... | <p>I would go with solution #1 (polling), because avoiding dependencies and direct connections between separate apps can help reduce complexity and problems.</p>
|
How can you work around the re-sending of the http referrer data on refresh in php? <p>I have a IN/OUT ratio hit counting system on my site. When a user is sent to my site, I grab the referrer, strip the domain, look up the domain and +1 to hits_in. Very simple. What I discovered thou is, if a user refreshes the page, ... | <p>I am not expert in this, but can't you just use sessions. temporarily store referred url into session, so if user clicks back than check if users session contains referral site. if it contains don't count.</p>
|
Do I understand Ajax correctly? <p>I'm been reading up on Ajax and would like to see from the stackoverflow community if I'm understanding everything correctly.</p>
<p>So the normal client server interaction is a user pulls up a web browser types in a url and a HTTP request is sent to the server requesting the page an... | <p>1) Nope. The XMLHttpRequest object does exactly what its name implies -- it initiates an HTTP request. This request can be in XML, or HTML, or PHP. At the end of the day, the browser doesn't care, because in an AJAX request, it doesn't parse the request -- you have to do it yourself. So it doesn't automatically rend... |
How can I avoid the bluish border when clicking a HyperlinkButton in Silverlight? <p>I have a Silverlight menu for my application with an image as the background. I use some empty HyperlinkButton at a specific position and size to simulate a real button on the image (think as a HTML image-map):</p>
<pre><code><Hype... | <p>I found the answer in other blog, just set IsTabStop="False" in the HyperLinkButton instance.</p>
|
Webforms App Layout Opinions? <p>I have a very simple webforms app that will allow field techs to order parts from the warehouse.<br />
Essentially it work like so:<br /></p>
<ol>
<li>User selects a category from a filter dropdown, which then binds items of that category to a gridview control<br />
<li>User finds an i... | <p>Probably because both your choices are fine - it comes down to personal preference. The shopping cart idea is well known. But sometimes it gets old if you have to keep going back and forth between the cart and the item selection.</p>
<p>What's wrong with the separate grid? -That way you keep the selection list sep... |
HTML document to PDF? <p>I've got an ASP.NET web page that is a dynamically generated report. For business reasons, this exact report needs to be produced as a PDF. What's the best way to do this? Setting the selected printer to Adobe PDF is not an option.</p>
<p>Learn to programmatically create PDFs from scratch? Is ... | <p><a href="http://code.google.com/p/wkhtmltopdf/" rel="nofollow">wkhtmltopdf</a> - I compiled it in Windows and it works great. It uses WebKit (Safari, Chrome, etc.) to render an HTML page into PDF, and it is free!</p>
|
Web server config - shttpd/Mongoose <p><a href="http://code.google.com/p/mongoose/" rel="nofollow">http://code.google.com/p/mongoose/</a><br />
<a href="http://shttpd.sourceforge.net/shttpd.1.txt" rel="nofollow">http://shttpd.sourceforge.net/shttpd.1.txt</a></p>
<p>Trying to configure the lightweight web server shttpd... | <p>Actually, with tiny C compiler (http://bellard.org/tcc/) it is very possible to run .c files as scripts. Just add <code>#!/usr/local/bin/tcc -run</code> at the first line of your C source.</p>
|
Parse filter expression using RegEx <p>I have a query filter written in human readable language. I need to parse it and convert to the SQL where clause. Examples are:</p>
<pre><code>CustomerName Starts With 'J'
</code></pre>
<p>becomes</p>
<pre><code>CustomerName LIKE 'J%'
</code></pre>
<p>and </p>
<pre><code>Cust... | <p>In the absence of other answers I'll chuck in my 2 cents:</p>
<p>It seems to me that you're actually creating a new language, albeit one that's very similar to an existing one. So I suspect there are many techniques from the field of computer language interpretation that could make this a simpler task.</p>
<p>The... |
In an Atom feed is it ok to change the "updated" field when an entry has its content changed? <p>If an Entry represents some file/resource that has changed - is it enough to change the updated field? I note that most feed readers won't show it as "new" as it has the same UUID? </p>
<p>rfc4287 says that I can change it... | <p>Well from looking at this, rf4287 says its fine to update a resource and its updated field. However, if you want feed readers to pick it up as a fresh item - you need to think of an Entry representing a change, not so much 1 to 1 with an underlying resource. </p>
|
How to validate numeric input C++ <p>I'd like to know how to limit an input value to signed decimals using <code>std::cin</code>.</p>
| <p>If the backing variable of the <code>cin</code> is a number, and the string provided is not a number, the return value is false, so you need a loop:</p>
<pre><code>int someVal;
while(!(cin >> someVal)) {
cin.reset();
cout << "Invalid value, try again.";
}
</code></pre>
|
How to leave URL parameters unescaped in ASP.NET MVC? <p>I've noticed the returnurl URL parameter on the Stackoverflow login/logout links are not escaped but when I try to add path as a parameter to a route it gets escaped.</p>
<p>So /login?returnurl=/questions/ask shows /login?returnurl=%2fquestions%2fask and it's ki... | <blockquote>
<p>How do I get it to not escape the
returnurl value</p>
</blockquote>
<p>How's about this?</p>
<pre><code>var url = Url.Action("Login", "Account", new {returnurl = Request.Path});
var unEncodedUrl = HttpUtility.UrlDecode(url);
Response.Write("<a href='" + unEncodedUrl + "'>...</a>");
</c... |
RegEx: HTML whitelist <p>Being weak on regular expressions, I've been working with them to improve. One concept I've been trying to do is to remove all HTML elements except for a list of allowed ones.</p>
<p>I've managed to do the reverse -- remove a specified list of elements:</p>
<pre><code><\/?(strong|em|a)[^&... | <p><a href="http://kore-nordmann.de/blog/do_NOT_parse_using_regexp.html" rel="nofollow">Do NOT try parsing with regular expressions</a></p>
<p>Instead use a <a href="http://grom.zeminvaders.net/html-sanitizer" rel="nofollow">real parser</a></p>
|
struts2 problem in action <p>I've started an application using struts 2.0.14 and web server is apache tomcat 6.0.
I am getting an error, please help me to solve this.</p>
<p>Application name: <strong>strutsTest</strong></p>
<p>Welcome page: <strong>EmpDetails.jsp</strong> in a package named â<strong>validTest</str... | <p>From your description, the validation part is excluded for your problem. In your struts.xml file, you may have configure the result as:</p>
<pre><code><action name="takeAction" ...>
<result>/simpleStruts2.0.14/thanks.jsp</result>
</action>
</code></pre>
<p>The result page: /s... |
Is there any way to determine how many characters will be written by sprintf? <p>I'm working in C++.</p>
<p>I want to write a potentially very long formatted string using sprintf (specifically a secure counted version like _snprintf_s, but the idea is the same). The approximate length is unknown at compile time so I'... | <p>The man page for <code>snprintf</code> says:</p>
<pre>
Return value
Upon successful return, these functions return the number of
characters printed (not including the trailing '\0' used to end
output to strings). The functions snprintf and vsnprintf do not
write more than size b... |
Is there a way to generate a DLL file from Visual Studio Express without explicitly creating a DLL project? <p>Is there a way to generate a DLL file from Visual Studio Express without explicitly creating a DLL project?</p>
<p>EDIT:
Maybe my thinking process has gone astray on me, but I am trying to setup NUnit, and th... | <p>Yes, you can change the Project Properties|Application|Output Type to either Windows Application, Console Application or Class Library, thus by selecting Class Library you will output a DLL.</p>
<p>I struggle to think why you'd want to do this though?</p>
|
Are Concurrent SQL inserts into the same table transactionally safe? <p>I have a simple table in MySql whose raison-d'être is to store logs.
The table has an autoincremented sequence and all the other columns has zero referential integrity to other tables. There are no unique keys or indexes on any columns. The column... | <p>You'll never lose data just because you do simultaneous inserts. If you use transactions you might "lose" some IDs - but no actual data. (Imagine that you start a transaction, insert a few rows and then do a rollback. InnoDB will have allocated the auto_increment IDs , but there are no rows with those IDs because... |
What copy protection technique do you use? <p>I'm thinking about adding some kind of copy protection to one of my tools. </p>
<ul>
<li>Do you have any experience with that?</li>
<li>Have you developed your own protection techniques or did you buy 3rd party software?</li>
<li>Do you think it is a viable method to incre... | <p>Whatever technique you use, your software will be copied. The actual aim of copy protection is to prevent honest customers from being tempted to be unfair.</p>
<p>The minimum copy protection technique is enough. The maximum is not worth the time spent.</p>
<p>Moreover, I've heard that some developers provide user ... |
DAM Solutions for full-length movies <p>Are there any DAM (Digital Asset Management) solutions in the market that can handle storage & classification of full length movies (10 GB and greater).
Have heard of solutions from EMC Documentum, Artesia, Oracle UCM and the like but not sure if they handle file sizes this ... | <p>I am going to go out on a a limb and say 'No'. There may be some custom ones around, but I have not seen anything that could handle videos of that size.</p>
<p>Personally, I have implemented the image portion of Oracle's DAM (still owned by Stellent at the time). I remember the tech being optimized for short stream... |
Why does GCC look at private constructors when matching functions? <p>I'm very busy write now debugging some code, so I can't cookup a complete example, but this basically describes my problem </p>
<pre><code>class Base{};
class MyX:public Base
{
...
};
class Derived:Base
{
...
};
template<class X>
class MyC... | <pre><code>MyClass<MyX>(x);
</code></pre>
<p>is parsed as </p>
<pre><code>MyClass<MyX> x;
</code></pre>
<p>But <code>MyClass<MyX></code> does not have a default constructor. Try giving it a name:</p>
<pre><code>MyClass<MyX> p(x);
</code></pre>
|
Selenium Grid + Maven 2 <p>Is there a good tutorial or does anyone have experience with setting this up ?
I have a Testsuite.html which launches my tests in one browser atm. This is done in the integration-test lifecycle by the maven selenium plugin. I want to run my tests on multiple browsers. I couldn't find any docu... | <p>Selenium Grid and maven are really not much different than Selenium and maven.</p>
<p>Grid is basically a drop-in replacement for selenium-rc. In our current setup we let the automated build system use Grid. It does this by simply changing the selenium-rc url (which is normally localhost:4444) to the grid's url.</p... |
Open Source license that requires giving credit in user's web site <p>I have this small code library that I'm considering releasing into Open Source. I want to release it under something similar to MIT License, i.e. no significant restrictions, however I would like to require that if you use my library on your servers,... | <p>Look here :</p>
<p><a href="http://www.opensource.org/licenses/category" rel="nofollow">http://www.opensource.org/licenses/category</a></p>
<p>and pleeeeeeeeeeease don't write your own!</p>
<p>From Aaron Digulla comment (Thank you Aaron):</p>
<p><em>It takes a lawyer a long time to write a license that will actu... |
AJAX.NET request handlers - set hidden field <p>I'm trying to set the value of a hiddenfield control in an AJAX initialize request handler. However on the server the hidden field control always contains the value for the previous postback. I presume the viewstate is being prepared / send before I set the hidden field i... | <p>Are you using update panels?</p>
<p>If you are then you need to make sure that the hidden field is inside the update panel that is being refreshed, otherwise the new value will not be sent to the browser.</p>
<p>Also, how are you creating the hidden field, if it's part of an update panel post back you should be us... |
How do you deploy a website to your webservers? <p>At my company we have a group of 8 web developers for our business web site (entirely written in PHP, but that shouldn't matter). Everyone in the group is working on different projects at the same time and whenever they're done with their task, they immediately deploy ... | <p>Cassy - you obviously have a long way to go before you'll get your source code management entirely in order, but it sounds like you are on your way!</p>
<p>Having individual sandboxes will definitely help on things. Next then make sure that the website is ALWAYS just a clean checkout of a particular revision, tag... |
DependancyProperty attach to a property of a property <p>I have a workflow with a property in it, declared like this:</p>
<pre><code>public Person userAccount {get;set;}
</code></pre>
<p>Person is a class with it's own properties (like Person.Name) and with WF I can bind to the userAccount property fine yet I can't s... | <p>No</p>
<p>i don't think that its possible to driectly bind to Memebers of Variables in Workflow</p>
<p>you will have to bind to entier class i.e. userAccount</p>
|
Does The Same Stylesheet Get Loaded Multiple Times On Different Pages? <p>I work on a large Intranet system - as it is an evolved system which started over ten years ago unfortunately the design of it isn't great and needs to be completely rewritten as it currently works by using frames.</p>
<p>The problem with the fr... | <p>Yes, browsers will load external scripts and stylesheets from cache for each frame, unless you deliberately break it by sending no-cache headers with those files.</p>
|
How to set up headers and libraries for Linux development <p>I recently set up, for a learning exercise, an Ubuntu desktop PC with KDE 4.2, installed Eclipse and started to look for information on how to develop for KDE. I know there's KDevelop and will probably have a look at that at some time in the future. Right now... | <p>make sure you have installed build-essential package. For more documentation available from the command line, install glibc-doc, manpages-dev, gcc-*-doc, libstdc++*-doc (replace '*' with suitable version numbers for your system)</p>
<p>EDIT:
I'm going to accept this one, but with a few extra bits.</p>
<p>Firstly, ... |
Backup/Restore Shared Services Provider on SharePoint MOSS <p>I'm having serious issues with backing up and restoring a shared services provider.</p>
<p>Using the Central Administration backup I run the backup to s:\</p>
<p>This completes fine.</p>
<p>I then from another SharePoint Server choose to restore a backup ... | <p>Hey I'm new here but just wanted to add my two cents.</p>
<p>I was having the same issue and found one of the above users was correct, the error was generated because a system account did not have access to the share.</p>
<p>On our server we got the same error. When we created our Sharepoint sites we selected the ... |
How do I align textPosition for a label? <p>I wonder if it is possible to set <code>textPosition()</code> for a <code>Label</code> that includes an <code>Image</code> and a text part so that the text is both TOP and LEFT. The problem I have now is that I need the text to be TOP but when that is selected the text is cen... | <p>Use two labels within a container to achieve that, one for the icon and another for the text. There are infinite number of configurations for things like that, the more support we add the more complex and slow label rendering becomes and its API becomes more convoluted. </p>
|
Use something else than JDBC over firewall <p><p>
I have simple server-client application that uses JDBC to connect to database and things works ok. Application does few simple things with JDBC connection (get data, insert new line and few others). <p>
Now, I would like to keep the same application but use it outside o... | <p>The normal approach would be to implement a web service, which can be pretty easy these days with Axis etc.</p>
<p>You really don't want to open direct JDBC to clients outside a firewall by tunnelling over HTTP... the server should <em>strictly</em> control what kind of interaction takes place with the database.</p... |
Preferred way of #! in shell scripts <p>I searched google but couldn't find an answer to this rather simple question. I have a python script that has the hash-bang (#!) on the first line:</p>
<pre><code>#!/usr/bin/python
</code></pre>
<p>However, what if this is run on a computer with python in /bin/python or /usr/lo... | <p>Use env.</p>
<pre><code>#!/usr/bin/env python
</code></pre>
<p>It's not bulletproof, but it covers more cases than /usr/bin/python.</p>
|
SQL query to select unreferenced rows <p>I'm having a brain-dead moment... I have two tables described by:</p>
<pre><code>CREATE TABLE table_a (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL
UNIQUE (name))
CREATE TABLE table_b (
id INT... | <pre><code>SELECT table_a.*
FROM table_a
LEFT JOIN table_b
ON table_a.id = table_b.a_key
WHERE table_b.id IS NULL
</code></pre>
|
Getting the most out of Resharper - good tutorials/screencasts <p>I've just installed Resharper, and I really don't know how to use it "correctly".
I noticed that there are some demos and documents at their website, but I'm wondering..</p>
<p>..how did you learn to use it efficiently? Are there any other good resource... | <p>There is a <a href="http://dimecasts.net/Casts/ByTag/ReSharper">series of screencasts</a> on the <a href="http://dimecasts.net/">Dime Casts</a> website which are quite good as an introduction.</p>
<p>There is also the <a href="http://blog.excastle.com/2007/01/31/blog-event-the-31-days-of-resharper/">31 days of Resh... |
Silverlight: Getting image (from OpenFileDialog) width/height <p>I've been using the BitmapImage.DownloadProgress event to wait until the image is loaded when creating a bitmap from a URI. That was I can use an event handler to check the Image.ActualWidth/ActualHeight after the download is complete. This works fine.</p... | <p>There is no event in BitmapImage to monitor the loading progress using a stream.</p>
<p>However, if you just need the image dimensions, you can add the image to the hierarchy and wait for the "Loaded" or "LayoutUpdated" event.</p>
|
How to escape phpdoc comment in phpdoc comment? <p>I would like to know how to escape phpdoc comments within a phpdoc comment.</p>
<p>For example, how would I have to write this:</p>
<pre><code>/**
* Some documentation...
*
* <code>
* /**
* * Example example phpdoc.
* */
* </code>
*/
</code></pr... | <p>According to <a href="http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial%5FphpDocumentor.howto.pkg.html#basics.desc">DocBlock Description details</a>, you can, as of 1.2.0rc1, write {@*} to write */.</p>
<p>For example:</p>
<pre><code>/**
* Simple DocBlock with a code example containing a... |
Places you can ask for quick code review? <p>Learning how to unit test in my own time though is providing me with further insight, I'd often would of liked to have someone there saying that I'm indeed going in the right direction with my tests.</p>
<p>Doing this by myself (and being the only developer at my company ac... | <p>As long as you don't post it like.</p>
<p><em>Is this okay?</em></p>
<pre><code>... 200 lines of code....
</code></pre>
<p>I think StackOverflow members would be happy to answer your unit-testing related questions.</p>
<p>Simply ask about your general setup and architecture, and maybe some small specific questio... |
Problem with C# serialization extension methods <p>I really like the extension method that TWith2Sugars posted <a href="http://stackoverflow.com/questions/271398/post-your-extension-goodies-for-c-net-codeplexcomextensionoverflow#271423">here</a>. I ran into an odd problem though. When I put this into a shared class l... | <p>Your understanding is wrong. What this error means is basically as follows: XML serializer cannot operate on class hierarchies unless you explicitly tell it what classes are there in the said hierarchy. Just add <code>XmlInclude</code> attribute for the type of each derived class to your base class and you're done.<... |
Why does Visual Studio want to check-out a File when opened? <p>Why does Visual Studio want to check-out a File when opened?</p>
<p>I just double click the file to open it and Visual Studio wants to check it out.
I did not make any changes to it. I just opened it. </p>
<p>i.e. In Solution Explorer I double click ctlE... | <p>This is not the default VS behavior. It's almost certainly a 3rd party plugin that is doing something on file open that is ending up in a check out request. What plugin's do you have installed?</p>
<p>There's also some designers that end up checking out files on accident when they are open. Do you have any desig... |
extending jquery on the main element object <p>I've seen some jquery code where people extend the main object like:</p>
<pre><code> $('someId').myCustomObject();
</code></pre>
<p>Is this possible or am I mistaken? (if yes, how?)</p>
| <p>Yes it's easily possible. The standard pattern for building extensions is:</p>
<pre><code>(function($) {
$.fn.myCustomObject = function(options) {
var defaults = { ... };
var opts = $.extend(defaults, options);
this.each(function(i) {
... // Act on each item, $(this).
... // Use opts.bl... |
Planning for efficiency early vs Premature optimization <p>I seem to notice two schools of thought emerging in regards to optimization:</p>
<ol>
<li><strong>Premature optimization is the root of all evil</strong>. You should only optimize when you've written the most readable and simplest thing possible. If after pr... | <p>Optimise at the design and architecture level early on. Micro-optimise at the implementation level later.</p>
<p>You need to be aware of the performance costs of design decisions you make which will be hard to change later. Implementation can often be tuned later on, which is why it's not worth doing it until you k... |
Relative Paths Not Working in Xcode C++ <p>There are numerous post over the net that detail how relative paths don't work in Xcode. I do have an Xcode template that I downloaded where the relative paths DO work, however I have not been able to figure out why nor replicate it in other projects.</p>
<p>Firstly, I am usi... | <p>Took me about 5 hours of Google and trying different things to FINALLY find the answer!</p>
<pre><code>#ifdef __APPLE__
#include "CoreFoundation/CoreFoundation.h"
#endif
// ----------------------------------------------------------------------------
// This makes relative paths work in C++ in Xcode by changing dir... |
How do I make Binding respect DependencyProperty value coercion? <p>I have a control with a DependencyProperty with a CoerceValueCallback.
This property is bound to a property on a model object.</p>
<p>When setting the control property to a value that causes coercion the Binding pushes the <strong>uncoerced</strong> v... | <p>I think that that's the whole idea of the coercion - correct value on the fly without triggering modification of any other dependencies. You can use the code below instead of native coercion mechanisms:</p>
<pre><code>OnPChanged(/* ... */)
{
// ...
var coercedP = CoerceP(P);
if (P != coercedP)
P... |
ASP.NET - AJAX - Partial followed by full postback problem <p>I've a page that has a series of web controls. One of these is a textbox with AutoPostBack turned off.</p>
<p>The way the page operates is that a button is clicked to save the form data. This button sits outside of the updatepanel.</p>
<p>So when I hit the... | <p>Don't mean to sound negative but these scenarios are what made me give up "by the book" ASP.net AJAX. Learning jQuery /w simplistic ASP.net forms /w NO postbacks has lead me to build more useful and cooler UI experiences than what I had to battle to get working with update panels etc.</p>
|
Is there a "canonical" name for a function combining min() and max()? <p>I find that I frequently end up writing a function that I always call "<code>clamp()</code>", that is kind of a combination of <code>min()</code> and <code>max()</code>. Is there a standard, "canonical" name for this function?</p>
<p>It always l... | <p><strong>clamp</strong> is a good name.</p>
<p>Let us make it the standard.</p>
|
Best practice for running SQL Server reporting services. Should I run on the database or web server? <p>I am configuring a new environment to run several intranet web applications. I have 2 servers, one will be the SQL Server 2008 server, and the other will be the IIS server. I also need to install SQL Server Reporti... | <p>Depends...</p>
<p>The reporting services rendering is fairly processor intensive so you need to keep that in mind. Typically if I'm designing a system with heavy load or throughput requirements I place the reporting services instance on its own server. The best practice is really dependent on the complexity of yo... |
How to delete object(s) from project when using deploy method? <p>When you delete an obsolete object from a project/solution, what's the best way to transfer this change into production? Does deploying have an option for this?</p>
<p>EDIT: This is a database project in Visual Studio 2008, deploying to SQL Server 2005.... | <p>I don't know of any automated way of deleting obsolete objects. We use a database diff and then write delete statements manually here. </p>
<p>If someone has a better solution I would love to hear it (we're on VS 2005, not 2008, but I imagine that wouldn't make too much difference)</p>
|
Spring - binding to an object rather than a String or primitive <p>Let's say I have the following command object:</p>
<pre><code>class BreakfastSelectCommand{
List<Breakfast> possibleBreakfasts;
Breakfast selectedBreakfast;
}
</code></pre>
<p>How can I have spring populate "selectedBreakfast" with a breakfast... | <p>The key to it all of this is the PropertyEditor.</p>
<p>You need to define a PropertyEditor for your Breakfast class and then configure the ServletDataBinder using registerCustomEditor in the initBinder method of your controller.</p>
<p>example:</p>
<pre><code>public class BreakfastPropertyEditor extends Property... |
What does the Visual Studio "Any CPU" target mean? <p>I have some confusion related to the .NET platform build options in Visual Studio 2008.</p>
<p>What is the "Any CPU" compilation target, and what sort of files does it generate? I examined the output executable of this "Any CPU" build and found that they are the x8... | <p>An AnyCPU assembly will JIT to 64 bit code when loaded into 64 bit process and 32 bit when loaded into a 32 bit process.</p>
<p>By limiting the CPU you would be saying there is something being used by the assembly (something likely unmanaged) that requires 32 bits or 64 bits.</p>
|
What is the difference between shelve and check in in TFS? <p>What is the concept of each?</p>
<p>When is it ok to shelve your changes instead of checking in?</p>
| <p>Shelved means the changes are set aside for <em>you</em> to work on later. </p>
<p>Checked in means that the changes are made available to the rest of the team, will be in the build and will eventually ship.</p>
<p>Very different. Think of shelving as a tool for context switching when you're not done with a task... |
PHP File Validation using If statements uploads <p>Hi I am quite new to php but i have been following some tutorials but they don't seem to work so I have tried to adapt them.
I have tested this code and it works to a point but theres something else I can't get my head around, the php file is not uploading (fine) but... | <p>The error probably is this if statement:</p>
<pre><code> if (!($uploaded_type =="image/jpeg"))
{
echo "JPEG<br>";$ok=1;
}
</code></pre>
<p>Because every time you upload an image that does not have a content type that equals "image/jpeg", $ok evaluates to 1, so everything gets written to the database... |
How do I get a reference to the underlying object in a bound DataGridViewComboBoxCell? <p>I don't know if my mind is not working today or if this is actually harder than I think it should be.</p>
<p>I've got a DataGridView with a DataGridViewComboBoxColumn bound to a generic IList of CustomObjects. Here's a rough cod... | <p>You could use an <code>IList</code> of <code>KeyValuePair</code>s of "Name" and your custom object. The idea is you need <code>ValueMember</code> to point to a reference of your object. I remember having similar issues for a while with <code>ComboBox</code>es.</p>
<p>Something like the following ought to do the tri... |
Java: Image as toggle button <p>How can I create in a Swing interface a toggle image button?
I have two images, imageon.jpg and imageoff.jpg,and I basically want a clickable element that toggles the images and fires an event.</p>
<p>Update: Is there a way to override the usual 'chrome' around the image? I would prefer... | <p>Load the images with <code>ImageIcon</code>. Create a <code>JToggleButton</code>. Then apply the icons with <code>AbstractButton.setIcon/setPressedIcon/setSelectedIcon</code>. Remove the border with <code>AbstractButton.setBorderPainted(false)</code>.</p>
|
MySql Union not getting executed in a view <p>I am trying to create a view for a UNION of 2 select statements that I have created.</p>
<p>The UNION is working fine when executed individually </p>
<p>But the problem is only the 1st part of the UNION is getting executed when I am executing it as a view.</p>
<p>The que... | <p>From <a href="http://dev.mysql.com/doc/refman/5.1/en/union.html" rel="nofollow">the union description:</a></p>
<blockquote>
<p>The column names from the first SELECT statement are used as the column names for the results returned. Selected columns listed in corresponding positions of each SELECT statement should ... |
Can multiple CPUs simultaneously write to the same RAM location? <p>Are machine word size (or smaller) writes serialized? Only one native opcode is needed to copy register content to RAM. </p>
| <p>Writing data to RAM is atomic. If two CPUs try to write to the same location at the same time, the memory controller will decide on some order for the writes. While one CPU is writing to memory, the other CPU will stall for as many cycles as necessary until the first write is completed; then it will overwrite its ... |
Show changesets since last "get latest version"? <p>Using Team Foundation Server and Visual Studio 2008, is there a way to highlight the submissions since my last "get latest version"? This would allow me to quickly identify what has been submitted since my last "pull" without having to remember which changeset I last... | <p>If you right-click the file in the <code>Solution Explorer</code> and select the <code>Compare</code> option, in the pop-up window set the <code>Target Version</code> as <code>Type</code>: <code>Latest Version</code>. </p>
<p>Click <code>OK</code> and your comparer tool will open up showing the differences beteween... |
How to print every element of an ARRAY in PL/SQL? <p>This is a pretty basic question, but here goes:</p>
<p>I have an array of VARCHAR2 strings in PL/SQL.</p>
<p>How can I print every element in that array?</p>
| <pre><code>for i in my_array.first..my_array.last loop
--print me
end loop;
</code></pre>
|
Find the classname of a UI control <p>I need a tool which tells the classname of the UI control on which my mouse pointer is. My GUI is in Swing. Does such a tool exist? </p>
| <p>You can get the current location of the mouse pointer by doing:</p>
<pre><code>Point location = MousePointer.getPointerInfo().getLocation();
</code></pre>
<p>Once you have the location, you can convert it to your parent containers coordinate system by doing:</p>
<pre><code>Point relativeLocation = SwingUtilities.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.