instruction stringlengths 0 30k ⌀ |
|---|
|rpm| |
What do I need to add to my .spec file to create the desktop shortcut and assign an icon to the shortcut during install of my .rpm? If a script is required, an example would be very helpful. |
|linux|rpm| |
Thanks for the reply. I was trying to avoid custom serialization and take advantage of the each component serialization technique, but with the lack opf any way to "patch" an upgrade to a new component format I guess custom serialization is the only method. |
[The Unix Programming Environment][2] by Kernighan and Pike.
![The Unix Programming Environment][1]
More than any other book, it taught me the benefits in building small, easily-tested tools that can be combined to do big things.
[1]: http://upload.wikimedia.org/wikipedia/en/thumb/4/43/English4.gif/180... |
Make sure your event is wired:
dropDown.SelectedIndexChanged += new EventHandler(dropDown_SelectedIndexChanged);
You can also apply a client-side attribute to return the confirmation. Set the index accordingly if cancelled.
|
Make sure your event is wired:
dropDown.SelectedIndexChanged += new EventHandler(dropDown_SelectedIndexChanged);
You can also apply a client-side attribute to return the confirmation. Set the index accordingly if cancelled.
dropDown.Attributes.Add("onchange", "javascript: return confirm('confirmation m... |
In JSTL/JSP, given a java.util.Date, how do I find the next day? |
|java|jsp|jstl| |
On a JSTL/JSP page, I have a java.util.Date object from my application. I need to find the day *after* the day specified by that object. I can use <jsp:scriptlet> to drop into Java and use java.util.Calendar to do the necessary calculations, but this feels clumsy and inelegant to me.
Is there some way to use J... |
Have you tried to set the onChange event to a javascript function and then inside the function display the javascript alert and utilize the __doPostback function if it passes?
i.e.
<pre><code>
drpControl.Attributes("onChange") = "DisplayConfirmation();"
function DisplayConfirmation() {
if (confirm('Are yo... |
Web Services have some overhead with respect to XML over HTTP calls because of validation and what is called the "SOAP envelope", which adds some extra verbosity.
That said, I don't think the bigger response time is due to that. Did you try running the XML over HTTP version today to have a reasonable comparison poin... |
Open /usr/lib/python2.5/re.py and look for "def _compile". You'll find re.py's internal cache mechanism. |
I'm also not entirely sure what the exact behaviour you want is, but assuming its that you want bar.meth1(42) to be equivalent to foo.meth1 being a classmethod of bar (with "self" being the class), then you can acheive this with:
def convert_to_classmethod(method):
return classmethod(method.im_func)
... |
[When you want it to validate][1] (in XML/XHTML - thanks, [Loren Segal][2]).
[1]: http://javascript.about.com/library/blxhtml.htm
[2]: http://stackoverflow.com/users/6436/loren-segal |
The Link Manager Protocol (LMP) running in a Bluetooth device looks after the link setup and configuration. This is all done by two devices exchanging Protocol Data Units (PDUs).The hardware and software functionality of the RSSI is provided at the LMP level that permits you to manage the RSSI Data. It allows you to re... |
What about select the current node into an XSL parameter, and passing that parameter to the function? Like:
<xsl:value-of select="ourFunction($data)" /> |
What about <strike>select the current node</strike> selecting the relevant data from the current node into an XSL parameter, and passing that parameter to the function? Like:
<xsl:value-of select="ourFunction($data)" /> |
The unix command tee does this.
man tee |
It all depends how you use Java or C# enums. How you use it will dictate the solution you'll choose in Ruby.
Try the native `Set` type, for instance:
>> enum = Set['a', 'b', 'c']
=> #<Set: {"a", "b", "c"}>
>> enum.member? "b"
=> true
>> enum.member? "d"
=> false
>> enum.add? "b"
... |
The ASP script timeout applies to all scripting languages. If the script is running in an ASP page, the script timeout will close the offending page. |
Get list of records with multiple entries on the same date |
|sql| |
I need to return a list of record id's from a table that may/may not have multiple entries with that record id on the same date. The same date criteria is key - if a record has three entries on 09/10/2008, then I need all three returned. If the record only has one entry on 09/12/2008, then I don't need it.
Thanks in... |
I was not sure at first, most applications seemed to be pretty laggy (granted, WinForms isn't lightning fast either). This seems to be fixed with .NET 3.5 SP1 where they integrated hardware acceleration for a number of techniques.
The integrated animation / storyboard / vector capabilities are very nice and a step ... |
JAD and/or JADclipse Eclipse plugin, for sure. |
cat > FILENAME |
Something like:
SELECT id, body FROM messages LEFT JOIN
(SELECT message_id FROM messages_read WHERE user_id = ?)
ON id=message_id WHERE message_id IS NULL
Slightly tricky and I'm not sure how the performance will scale up, but it should work. |
I would do it like this:
get-content tmp.log -encoding Unicode | set-content new.log -encoding UTF8
My understanding is that the -encoding option selects the encdoing that the file should be read or written in. |
A few minutes on the [BitmapData LiveDoc Page][1] will take you where you need to go. Once you have your image loaded into a Bitmap variable, you can access its BitmapData property. Add a [Mouse Click Event][2] Listener to the image and then use [BitmapData::getPixel][3]. The example for getPixel shows how to conver... |
Just put the below toggleOn in the OnMouseDown and toggleOff in the OnMouseUp of the button.
var tid;
var speed = 100;
function toggleOn(){
if(this.tid==0){
this.tid=setInterval('ThingToDo()',speed);
}
}
function toggleOff(){
if(this.tid!=0){
... |
Just put the below toggleOn in the OnMouseDown and toggleOff in the OnMouseUp of the button.
var tid = 0;
var speed = 100;
function toggleOn(){
if(tid==0){
tid=setInterval('ThingToDo()',speed);
}
}
function toggleOff(){
if(tid!=0){
... |
Simply put. It comes down to comparing the time left and productivity you will get from someone excluding the amount of time it takes the additional resources to come up to speed and be productive and subtracting the time invested in teaching them by existing resources. The key factors (in order of significance):
1... |
Is it possible to pass a parameter to XSLT through a URL when using a browser to transform XML? |
|xml|browser|xslt|transform|param| |
When using a browser to transform XML (Google Chrome or IE7) is it possible to pass a parameter to the XSLT stylesheet through the URL?
example:
**data.xml**
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
<root>
<document type="resume">
... |
It takes some time to get into it and some time to start doing it in a project but... I always regret not doing a Test Driven approach when I find silly bugs that an automated test could have found very fast. In addition, TDD improves code quality. |
Use javascript. If you're using the jQuery library, try something like this:
$("input.a").after("<br/>")
Or whatever you need.
|
In most cases you should use IV. Since IV is generated randomly each time, if you encrypt same data twice, encrypted messages are going to be different and it will be impossible for the observer to say if this two messages are the same. |
An IV is essential when the same key might ever be used to encrypt more than one message.
The reason is because, under most encryption modes, two messages encrypted with the same key can be analyzed together. In a simple stream cipher, for instance, XORing two ciphertexts encrypted with the same key results in the ... |
An IV is essential when the same key might ever be used to encrypt more than one message.
The reason is because, under most encryption modes, two messages encrypted with the same key can be analyzed together. In a simple stream cipher, for instance, XORing two ciphertexts encrypted with the same key results in the ... |
If you really don't want to store any state, I think the best you can do is limit replay attacks by using timestamps and a short expiration time. For example, server sends:
{Ts, U, HMAC({Ts, U}, Ks)}
Where Ts is the timestamp, U is the username, and Ks is the server's secret key. The user sends this back to the s... |
A standard-ish API is the dlopen/dlsym API; AFAIK it's implemented by GNU libc on Linux and Mac OS X's standard C library (libSystem), and it might be implemented on Windows by MinGW or other compatibility packages.
|
- Namespaces
.Namespaces help us to define the "scope" of a set of entities in our object model or our application. This makes them a software design decision not a folder structure decision. For example, in an MVC application it would make good sense to have Model/View/Controller folders and related namespaces. ... |
Well, the ASP.NET script could be doing something different than the C# code. Try capturing each raw HTTP request and playing them back. Do they perform the same? If so, then it is likely differences in the client code. My guess is that one is a straight HTTP get/post request, the other SOAP over HTTP(s).
Other t... |
I found that writing the drawing code myself was the best way to:
* deal with potential transparency issues (some of the other options do add a white background to the whole image)
* performance was much better
The code below is not perfect, because it does not deal with scaling issues when going from bounds t... |
What is the best testing tool for Swing-based applications? |
|swing|testing| |
While we try to set up as many unit tests as time allows for our applications, I always find the amount of UI-level tests lacking. There are many options out there, but I'm not sure what would be a good place to start.
What is your preferred unit testing tool for testing Swing applications? Why do you like it?
T... |
|java|testing|swing| |
If you are strictly talking about WSS 3.0 (and not MOSS), then you really don't have global user profiles per se, but a hiddenh User Information List in each site collection. That mean none of the stuff in the Microsoft.Office.Server namespaces is available to you.
However, you can update the User Information List p... |
How to enforce all children to override the parent's Clone() method? |
|c++-cli|.net| |
How to make sure that all derived C++/CLI classes will override the Clone() method of the base class?
Do you think I should worry about this? Or this is not a responsibility of the base class' writer?
|
|.net|c++-cli| |
How to make sure that all derived C++/CLI classes will override the ICloneable::Clone() method of the base class?
Do you think I should worry about this? Or this is not a responsibility of the base class' writer?
**Amendment:** Sorry, I forgot to mention that the base class is a non-abstract class.
|
Pop open the source code to `unittest.py`. `unittest.main()` is hard-coded to call `sys.exit()` after running all tests. Use `TextTestRunner` to run test suites from the prompt. |
Let's say you have the Client and at one point you have to something with his Orders and maybe he has a Bonus for his Orders.
Then I would define a Repository with a fluent interface that will allow me to say something like :
new ClientRepo().LoadClientBy(id)
.WithOrders()
... |
> What if an odd number of quotes appear
> in the original string?
This looks uncannily like CSV parsing, which has some peculiarities to handling quoted fields. The field is only escaped if the field is delimited with double quotations, so:
> field1, "field2, field3", field4, "field5, field6" field7
becomes
... |
break will exit the loop completely, continue will just stop.
For example:
for(int i = 0; i < 10; i++){
if(i == 0) break;
DoSomeThingWith(i);
}
the break will cause the loop to exit on the first iteration - DoSomeThingWith will never be executed. This here:
for(int i = 0; i < ... |
break will exit the loop completely, continue will just stop the current iteration.
For example:
for(int i = 0; i < 10; i++){
if(i == 0) break;
DoSomeThingWith(i);
}
the break will cause the loop to exit on the first iteration - DoSomeThingWith will never be executed. This here:
... |
.NET 3.5 Redistributable -- 200 MB? Other options? |
|.net|redistributable| |
I've been using a lot of new .NET 3.5 features in the work that I've been doing, lately. The application that I'm building is intended for distribution among consumers who will probably not have the latest version (or perhaps *any version*) of the .NET framework on their machines.
I went to go [download the .NET 3.5... |
C#: Can I have a method return IEnumerator<T> and use it in a foreach loop? |
|c#|ienumerable|ienumerator|foreach| |
I need to set the height of every textbox on my form, some of which are nested within other controls. I thought I could do something like this:
private static IEnumerator<TextBox> FindTextBoxes(Control rootControl)
{
foreach (Control control in rootControl.Controls)
{
if (con... |
It's possible but only with reflection
public abstract class AbstractClass
{
public static AbstractClass MakeAbstractClass(string args)
{
if (args == "a")
return (AbstractClass)Activator.CreateInstance(typeof(ConcreteClassA), true);
if (args == "b... |
It's possible but only with reflection
public abstract class AbstractClass
{
public static AbstractClass MakeAbstractClass(string args)
{
if (args == "a")
return (AbstractClass)Activator.CreateInstance(typeof(ConcreteClassA), true);
if (args == "b... |
> To me, the simplest solution is to
> make child classes as samjudson
> mentioned. I'd like to avoid this
> however since it would make my
> abstract class' file a lot bigger than
> I'd like it to be. I'd rather keep
> classes split out over a few files for
> organization.
No problem, just use **partial** ke... |
It really depends on whether the variables themselves only have one variable (example: you can have a variable number of tires that are all the same type, or a set number of tires that are of variable type).
Since you seem to need to have multiple variables (eg. specific type for each tire, with a variable number of... |
If this is a business web site (or a serious site where it is important that it actually works on IE), then don't take the cheap route - invest in a Windows machine or two. Your customers will thank you.
Otherwise, virtualize. |
What's the best library for reading Outlook .msg files in Java ? |
|java|outlook|msg| |
I would like to read the text and binary attachments in a saved Outlook message (.msg file) from a Java application, without resorting to native code (JNI, Java Native Interface).
[Apache POI-HSMF][1] seems to be in the right direction, but it's in very early stages of development...
[1]: http://poi.apache.... |
having 2 files with the same name in the include path is not a good idea, rename your files so the files that you wrote have different names from third party libraries. anyway for your current situation I think by changing the order of paths in your include path, you can fix this.
PHP searches for the files in the inc... |
Using GraphicsMagick or ImageMagick along with Magick++, you can then use imagick.
imagick has all of the calls necessary to convert PSDs from layers, including doing masks. |
Importing Access data into SQL Server using ColdFusion |
|sql-server|ms-access|coldfusion| |
This should be simple. I'm trying to import data from Access into SQL Server. I don't have direct access to the SQL Server database - it's on GoDaddy and they only allow web access. So I can't use the Management Studio tools, or other third-party Access upsizing programs that require remote access to the database.
I... |
How do I pass a variable to a mysql script? |
|mysql|scripting|variables| |
I know that with mysql you can write SQL statements into a .sql file and run the file from the mysql command line like this:
mysql> source script.sql
How do I pass a variable to the script? For example, if I want to run a script that retrieves all the employees in a department, I want to be able to pass in th... |
|mysql|variables|scripting| |
I know that with mysql you can write SQL statements into a .sql file and run the file from the mysql command line like this:
mysql> source script.sql
How do I pass a variable to the script? For example, if I want to run a script that retrieves all the employees in a department, I want to be able to pass in th... |
The standard unix tool tee can do this. It copies input to output, while also logging it to a file.
|
You're not alone in needing something similar.. in fact, someone wanted i decades ago and developed [tee][1] :-)
Of course, you can redirect stdout directly to a file in any shell using the > character:
echo "hello, world!" > the-file.txt
[1]: http://linux.die.net/man/1/tee |
**In Java 5, with unit test:**
import junit.framework.Assert;
import org.junit.Test;
public class StringUtil
{
public static String join(String delim, String... strings)
{
StringBuilder builder = new StringBuilder();
if (strings != null)
... |
Cache data.
Unnecessary Trips to database to display something that gets displayed the same every load is what kills a server. Write its output to a file and use that instead. Most CMSs and frameworks have caching built in (but you have to turn it on) but rolling your own is not the most challenging task. |
**SOAP** currently has the advantage of better tools where they will generate a lot of the boilerplate code for both the service layer as well as generating clients from any given WSDL.
**REST** is simpler, can be easier to maintain as a result, lies at the heart of Web architecture, allows for better protocol visi... |
I found that writing the drawing code myself was the best way to:
* deal with potential transparency issues (some of the other options do add a white background to the whole image)
* performance was much better
The code below is not perfect, because it does not deal with scaling issues when going from bounds t... |
I recommend using [Rake](http://rake.rubyforge.org/). It's the easiest tool I've found.
Other good tools I've used, though, if Ruby's not your thing, are:
* [AAP](http://www.a-a-p.org/) (Python)
* [SCons](http://www.scons.org/) (Python)
* [Ant](http://ant.apache.org/) (Java, config in XML, pretty complex)
|
Both of the previous answers work, but they give you a macro that you call as
(++ varname)
instead of varname++ or ++varname, which I suspect you want. I don't know if you can actually get the former, but for the latter, you can do a read macro. Since it's two characters, a dispatch macro is probably best. Un... |
When you are going for strict XHTML compliance, you need the CDATA so less than and ampersands are not flagged as invalid characters. |
You can use [StyleCop][1] to enforce a comprehensive set of standards which pretty much forces everyone to use the same layout styles. Then all you need to do is develop a ReSharper code style specification that matches this, and distribute it to the team.
I'm still waiting for someone else to do this, and for JetBr... |
You can use [StyleCop][1] to enforce a comprehensive set of standards which pretty much forces everyone to use the same layout styles. Then all you need to do is develop a ReSharper code style specification that matches this, and distribute it to the team.
I'm still waiting for [someone else to do this][2], and for ... |
Sounds correct to me. |
Is there a Windows Registry "dictionary" that explains the whole (or most of) the Windows Registry? |
|windows|registry| |
I'd like to be able to see what registry keys are used for. A book on the registry would be fine as well. Info on Windows Vista changes would be great! |