I don't understand why this doesn't work:
[abc = ([def intValue] - 71) * 6];
'*' should be the viable way of doing multiplication and 'abc' is defined as an NSInteger. ('def' is an NSString)
I'm trying to find a better way to get the next or previous record from a table. Let's say I have a blog or news table:
CREATE TABLE news (
news_id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
news_datestamp DATETIME NOT NULL,
news_author VARCHAR(100) NOT NULL,
news_title VARCHAR(100) NOT NULL,
news_text MEDIUMTEXT NOT…
I'm new to JSTL/EL and JSP and can't seem to find a reference which covers the following scenario:
I have an array of values in JavaScipt:
var Countries = ('US', 'CA');
I then need to check to see if the currently selected value of a standard HTML select box is in that array.
This is what I have so far:
<select id="shippingCountry">…
I've been using PDO and preparing all my statements primarily for security reasons. However, I have a part of my code that does execute the same statement many times with different parameters, and I thought this would be where the prepared statements really shine. But they actually break the code...
The basic logic of the code is this.
…
I've got this weird crashing happening when creating a C# Word 2007 Template Project in Visual Studio 2008. The IDE tells me that it's creating the project (it does create the solution and C# vsproj as well as the dotx and cs files). Then the IDE just crashes - no errors, messages, etc. When I try devenv /SafeMode it still doesn't work.…
I'm building out a medium-sized application using Sinatra and all was well when I had a single app.rb file and I followed Aslak's guidance up on Github:
http://wiki.github.com/aslakhellesoy/cucumber/sinatra
As the app grew a bit larger and the app.rb file started to bulge, I refactored out a lot of of the bits into "middleware" style…
Hi,
I have some text that has HTML hyper-links in it.
I want to remove the hyperlinks, but only specific ones.
e.g. I start with this:
This is text <a href="link/to/somewhere">Link to Remove</a> and more text with another link <a href="/link/to/somewhere/else">Keep this link</a>
I want to have:
This is text…
When refactoring away some #defines I came across declarations similar to the following in a C++ header file:
static const unsigned int VAL = 42;
const unsigned int ANOTHER_VAL = 37;
The question is, what difference, if any, will the static make? Note that multiple inclusion of the headers isn't possible due to the classic #ifndef…
Hello,
I have a section of code that uploads an image:
[activity startAnimating];
[self uploadImage:img Session_id:appDelegate.sessionID PlaceID:place.placeID Comment:comment.text];
[activity stopAnimating];
I am sure that activity is wired up correctly to a UIActivityViewIndicator, but it never shows. Inside the uploadImage…
I'm trying to install Rails 3 on a brand new MacBook Pro running OS X 10.6.3, Ruby 1.8.7, and Rails 2.3.5 and I'm wondering if I've hosed myself. So far, I've run these commands:
$ gem update --system
$ gem install arel tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
$ gem…
Is there a way to check to see if an Microsoft Office process (i.e. Word, Excel) has hung when using Office Automation? Additionally, if the process is hung, is there a way to terminate it?
I'm designing a set of web apps to track scientific laboratory data. Each laboratory has several members, each of whom will access both their own data and that of their laboratory as a whole. Many typical queries will thus be expected to return records of multiple members (e.g. my mouse, joe's mouse and sally's mouse).
I…
Currently, my cURL multi exec stops if one url it connects to doesn't work, so a few questions:
1: Why does it stop? That doesn't make sense to me.
2: How can I make it continue?
EDIT: Here is my code:
$SQL = mysql_query("SELECT url FROM shells") ;
$mh = curl_multi_init();
$handles = array();
while($resultSet =…
Well, I know its possible, using external libraries and modules such as scapy. But how about without external modules? Without running the script as root? No external dependencies?
I've been doing a lot of googling, but haven't found much help. I'd like to be able to create my own packets, but without running as…
Here's the basic idea of what I'm trying to do:
Set the innerHTML of a DIV to some value X
Animate the DIV
When the animation finishes, change the value of X and repeat N times
If I do this in a loop, what ends up happening is, because the animations occur asynchronously, the loop finishes and the DIV is set…
So I've got a delayed_job task that pushes some info to an XMPP server. Ideally you create a connection to XMPP once and then constantly push data to it, rather than creating a new connection every time you have some data to send.
Is there any kind of facility in delayed_job for running a sort of 'setup' method…
I know this sounds like a really, really simple use case and I'm hoping that it is, but I swear I've looked all over the place and haven't found any mention of any way - not even the best way - of doing this.
I'm brand-spanking new to Ruby, Rails and everything surrounding either (which may explain a lot). The…
OK, so I know what a code smell is, and the Wikipedia Article is pretty clear in its definition:
In computer programming, code smell is
any symptom in the source code of a
computer program that indicates
something may be wrong. It generally
indicates that the code should be
refactored or the…
For example, take this code:
$ch = curl_init($resultSet['url']."?get0=get0&get1=".$get1."&get2=".$get2."&get3=".$get3);
This of course, looks very ugly, and kind of a pain in the ass to read. So my question is, would I be able to use something like this:
$allgets…
Is there a way to set a default position for a UIPicker? I mean, if the user has the option of selecting any number from 1 to 100 in the UIPicker, can I set it to automatically start at 50?
I am using three buttons along with the list view.These three buttons are added to the layout using the TableRow.The first button takes more space on content, so the other two becomes smaller in size than first one. When the application runs, it doesn't even show the two other…
As noted by the title, what is the best way to configure an IIS 6.0 deployment of an ASP.NET MVC application such that connections to hidden shares are ignored? The application in question is using wildcard mapping to allow for clean URLs since we are planning on upgrading to…
When I compile scanf("%s", &var);, gcc sends back a warning:
warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[20]’
however when I compile scanf("%s", var);, no warning is applied. Both pieces of code work and the book I am reading…
I have the following SQL to format a US address into each line for a mailing address but it is rather ugly. Is there a better way to solve this problem or does it have to be this ugly?
declare @NL varchar(2);
set @NL = char(13) + char(10);
select
case when…
I'm interested in using the Module Pattern to better organize my future projects. Unfortunately, there are only a few brief tutorials and proof-of-concept examples of the Module Pattern.
Using the module pattern, I would like to organize projects into this…