HI,
I want to have set configuration settings for a unit test project that is only relative for one machine ( i.e build machine). So for e.g. is the unit test project is being compiled on a developer machine then use settings A from App.config, if it's compiled on a build machine then use settings B from App.config. Is there a best practice for this sort of things?
I having trouble scraping a certain long dash that is encoded as ; on the Time magazine site. It looks like this: —. It works fine when this dash is encoded as mdash, but when the problem dash is scraped, it is returned as unknown characters. I am using Nokogiri and am wondering if I have to use some sort of special encoding? The page says it is encoded with UTF-8.
Does anyone have any experience with this sort of thing?
I'm talking about applets like this http://dan-ball.jp/en/javagame/dust/
I'm really interested in how they work, it seems more like fluid-dynamics than regular game physics. Does anyone know any open source variations, or any hints on how they might work? I think it would be really fun and challenging to work on something like this, but I'm not sure where to start researching...
Thanks :)
hi, i have a nstimer and it works perfectly counting down from 2:00 but when i hit the reset button it does not work it just stops the timer and when i press start again it will carry on with the timer as if it had never been stopped. Here is my code `@implementation TimerAppDelegate
@synthesize window;
(void)applicationDidFinishLaunching:(UIApplication *)application {
timerLabel.text = @"2:00";
seconds = 120;
// Override point for customization after application launch
[window makeKeyAndVisible];
}
(void)viewDidLoad {
[timer invalidate];
}
(void)countDownOneSecond
{
seconds--;
int currentTime = [timerLabel.text intValue];
int newTime = currentTime - 1;
int displaySeconds = !(seconds % 60) ? 0 : seconds < 60 ? seconds : seconds - 60;
int displayMinutes = floor(seconds / 60);
NSString *time = [NSString stringWithFormat:@"%d:%@%d",
displayMinutes,
[[NSString stringWithFormat:@"%d", displaySeconds] length] == 1 ? @"0" : @"",
displaySeconds
];
timerLabel.text = time;
if(seconds == 0)
{
[timer invalidate];
}
}
(void)startOrStopTimer
{
if(timerIsRunning){
[timer invalidate];
[startOrStopButton setTitle:@"Start" forState:UIControlStateNormal];
} else {
timer = [[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countDownOneSecond) userInfo:nil repeats:YES] retain];
[startOrStopButton setTitle:@"Stop" forState:UIControlStateNormal];
}
timerIsRunning = !timerIsRunning;
}
(void)resetTimer
{
[timer invalidate];
[startOrStopButton setTitle:@"Start" forState:UIControlStateNormal];
[timer invalidate];
timerLabel.text = @"2:00";
}
(void)dealloc {
[window release];
[super dealloc];
}
@end`
thanks
Due to specific requirements [*], I need a singly-linked list implementation that uses integer indices instead of pointers to link nodes. The indices are always interpreted with respect to a vector containing the list nodes.
I thought I might achieve this by defining my own allocator, but looking into the gcc's implementation of , they explicitly use pointers for the link fields in the list nodes (i.e., they do not use the pointer type provided by the allocator):
struct _List_node_base
{
_List_node_base* _M_next; ///< Self-explanatory
_List_node_base* _M_prev; ///< Self-explanatory
...
}
(For this purpose, the allocator interface is also deficient in that it does not define a dereference function; "dereferencing" an integer index always needs a pointer to the underlying storage.)
Do you know a library of STL-like data structures (i am mostly in need of singly- and doubly-linked list) that use indices (wrt. a base vector) instead of pointers to link nodes?
[*] Saving space: the lists will contain many 32-bit integers. With two pointers per node (STL list is doubly-linked), the overhead is 200%, or 400% on 64-bit platform, not counting the overhead of the default allocator.
hi
does anyone know any sort of app that lets users visit a page on their mobile phone, enter information and have it update the website
i believe the term is "mobile-blogging" but there isn't all that much on google
or, is there any good resources for coding pages specifically for a mobile phone? I could probably design a script to insert blog posts on a site but not sure how it would work with a mobile.
thanks for any pointers
I am looking for a javascript beautifier with a very specific function. I need a beautifier that can sort functions and vars alphabetically based off of their names. I have a very long javascript file that is an eyesore to look at. Does anyone know of any javascript beautifiers that will do this?
Case example: I have a long list of items, and when I put my mouse over this div changes to that picture of that item. No matter where you scroll to, the div remains in a fixed position.
Sort of like a frame.
Hello folks,
I have a really short question: Is it possible to communicate/use USB devices on Android OS? I assume it might be tablet device.
Lest say i want to connect some sort of USB card scanner to android tablet. Will it work? Do i need to write drivers by myself?
Thanks.
Is there a simple way to shift cell content to the right? Like a horizontal alignment or some sort of offset?
I'd rather not
include a blank cell.imageView.image, or
add spaces to each cell.textLabel.text.
Any ideas please. Thanks.
Hello everyone :)
This is becoming a common pattern in my code, for when I need to manage an object that needs to be noncopyable because either A. it is "heavy" or B. it is an operating system resource, such as a critical section:
class Resource;
class Implementation : public boost::noncopyable
{
friend class Resource;
HANDLE someData;
Implementation(HANDLE input) : someData(input) {};
void SomeMethodThatActsOnHandle() {
//Do stuff
};
public:
~Implementation() { FreeHandle(someData) };
};
class Resource
{
boost::shared_ptr<Implementation> impl;
public:
Resource(int argA) explicit {
HANDLE handle =
SomeLegacyCApiThatMakesSomething(argA);
if (handle == INVALID_HANDLE_VALUE)
throw SomeTypeOfException();
impl.reset(new Implementation(handle));
};
void SomeMethodThatActsOnTheResource() {
impl->SomeMethodThatActsOnTheHandle();
};
};
This way, shared_ptr takes care of the reference counting headaches, allowing Resource to be copyable, even though the underlying handle should only be closed once all references to it are destroyed.
However, it seems like we could save the overhead of allocating shared_ptr's reference counts and such separately if we could move that data inside Implementation somehow, like boost's intrusive containers do.
If this is making the premature optimization hackles nag some people, I actually agree that I don't need this for my current project. But I'm curious if it is possible.
In a Python Google App Engine app I'm writing, I have an entity stored in the datastore that I need to retrieve, make an exact copy of it (with the exception of the key), and then put this entity back in.
How should I do this? In particular, are there any caveats or tricks I need to be aware of when doing this so that I get a copy of the sort I expect and not something else.
I cannot use strtolower as it affects all char. Should I use some sort of regular expression ?
I'm getting a string which is a product code, I want to use this product code as a search key in a different palce with the first letter made lowercase.
Hi,
could someone recommend a PHP form validation library (that works independently outside of any php framework) that apart from doing all sort of basic validation (is empty, vs regex, is email, is alphanumeric and so on) can produce javascript code (ideally to work with jquery) to validate the very same form with the very same rules client-side and hence define validation rules in a single place and have a form validated both server and client side?
Thanks.
Is there a possibility to create any python object that will be not sortable? So that will be an exception when trying to sort a list of that objects?
I created a very simple class, didn't define any comparison methods, but still instances of this class are comparable and thus sortable. Maybe, my class inherits comparison methods from somewhere. But I don't want this behaviour.
I have a quadcore processor and I would really like to take advantage of all those cores when I'm running quick simulations. The problem is I'm only familiar with the small Linux cluster we have in the lab and I'm using Vista at home.
What sort of things do I want to look into for multicore programming with C or Java? What is the lingo that I want to google?
Thanks for the help.
I need to be able to display data that I have in 15 minute increments in different display types. I have two queries that are giving me trouble. One shows data by half an hour, the other shows data by hour. The only issue is that the data totals change between queries. It's not counting the data that happens between the time frames, only AT the time frames.
Ex:
There are 5 things that happen at 7:15am. 2 that happen at 7:30am and 4 that show at 7:00am.
The 15 minute view displays all of the data.
The half hour view displays the data from 7:00am and from 7:30am but ignores the 7:15am.
The hour display only shows the 7:00am data
Here are my queries:
$query="SELECT * FROM data WHERE startDate='$startDate' and queue='$queue' GROUP BY HOUR(start),floor(minute(start)/30)";
and
$query="SELECT * FROM data WHERE startDate='$startDate' and queue='$queue' GROUP BY HOUR(start) ";
How can I pull out the data in groups like I have but get all the data included?
Is the issue the way the data is stored in the mysql table? Currently I have a column with dates (2010-03-29) and a column with times (00:00) Do I need to convert these into something else?
If you have a for loop such as:
For Each s As String In stringList
..do stuff..
Next
is there some sort of (hidden) iterator or do I have to add an external integer to keep count:
Dim i As Integer
For Each s As String In stringList
..do stuff..
i += 1
Next
Hello,
I am working on my personal site, where I want to store my customers recent search result limited to that particular session.
I am using PHP platform and Javascripts.
Here is an example of what I am exactly looking at :
It stores your previously searched domain name for that particular session so that user can make decision by comparing those results.
How to achieve this using php, javascripts or some sort of div layer ????
Thanks.
I want to allow the user to add columns to a table in the UI.
The UI: Columns Name:__ Columns Type: Number/String/Date
My Question is how to build the SQL tables and C# objects so the implementation will be efficient and scalable.
My thought is to build two SQL tables:
TBL 1 - ColumnsDefinition:
ColId, ColName, ColType[Text]
TBL 2 - ColumnsValues:
RowId, ColId, Value [Text]
I want the solution to be efficient in DB space,
and I want to allow the user to sort the dynamic columns.
I work on .NET 3.5 MSSQL 2008.
Thanks.
Given a array of random integers, sort the odd elements in descending order and even numbers in ascending order.
e.g. for input (1,4,5,2,3,6,7)
Output = (7,5,3,1,2,4,6)
Optimize for time complexity.
ok, embarrassing enough, I posted code that I need explained. Specifically, it first chains absolute value and subtraction together, then tacks on a sort, all the while not having to mention parameters and arguments at all, because of the presense of "adverbs" that can join these functions "verbs"
What (non-APL-type) languages support this kind of no-arguments function composition (I have the vague idea it ties in strongly to the concepts of monad/dyad and rank, but its hard to get a particularly easy-to-understand picture just from reading Wikipedia) and what do I call this concept?
I have been looking around at web applications and websites with rich graphs, charts, and data visualization and for the most part have been able to determine which frameworks or tools websites are using. However I was looking over 'resumup.com' and couldn't determine what they are using. Does anyone know off hand or can you tell? It doesn't seem like any javascript framework i've seen unless its custom...is it some sort of flash or flex framework? Any help would be greatly appreciated.
Thanks,
Marques
OK, i have been doing some work modding a pre-compiled ASP.NET application (VB codebehind) but i have come across something i have never seen before.
When ever theres an error on the loading of a page, the page outputs nothing (no error message, no error message, nothing at all)
firefox displays this error:
XML Parsing Error: no element found
Location: http://site.local/Checkout.aspx
Line Number 1, Column 1:
Because there is no html output.
Is there some sort of setting that im missing that makes IIS/ASP.NET function like this?