How are \r and \n different. I think it has something to do with Unix vs. Windows vs. Mac, but I'm not sure how exactly they're difference, and which to search for/match in regexes.
In XCode is it possible to build a clean version of my project and remove any saved property lists associated with it?
I'm refactoring my code constantly and the old property list that gets saved is causing my app to crash because the data has become old and rotten.
I'm working on a Python extension module, and one of my little test scripts is doing something strange, viz.:
x_max, y_max, z_max = m.size
for x in xrange(x_max):
for y in xrange(y_max):
for z in xrange(z_max):
#do my stuff
What makes no sense is that the loop gets to the end of the first 'z' iteration, then throws a TypeError, stating that "an integer is required". If I put a try...except TypeError around it and check the types of x, y, and z, they all come back as < type 'int' .
Am I missing something here?
I can't figure out what I'm doing wrong here.
I can’t seem to get the #{@user.name} to work in my flash[:notice]
Everything else works just fine I can add new users, but when I add a new user instead of saying “User John Doe was successfully created”, it says “User #{@user.name} was successfully created.”
I'm at this point in the depot app: depot_p/app/controllers/users_controller.rb to work.
Hi all,
I'm testing out CouchDB to see how it could handle logging some search results. What I'd like to do is produce a view where I can produce the top queries from the results. At the moment I have something like this:
Example document portion
{
"query": "+dangerous +dogs",
"hits": "123"
}
Map function
(Not exactly what I need/want but it's good enough for testing)
function(doc) {
if (doc.query) {
var split = doc.query.split(" ");
for (var i in split) {
emit(split[i], 1);
}
}
}
Reduce Function
function (key, values, rereduce) {
return sum(values);
}
Now this will get me results in a format where a query term is the key and the count for that term on the right, which is great. But I'd like it ordered by the value, not the key. From the sounds of it, this is not yet possible with CouchDB.
So does anyone have any ideas of how I can get a view where I have an ordered version of the query terms & their related counts? I'm very new to CouchDB and I just can't think of how I'd write the functions needed.
For my Google Wave robot, on the onDocumentChanged event I want to apply a filter as follows:
@Capability(filter = FILTER)
@Override
public void onDocumentChanged(DocumentChangedEvent event) {
...
}
I want the filter to be generated the first time the robot is run, which I'm trying to do as follows:
private static final String FILTER = generateFilter();
private static final String generateFilter(){
...
}
However, it complains FILTER isn't a constant expression when used within @Capability.
generateFilter() will return the same string every time it is called, I'm only using it to create the string so that when I make changes, I don't need to worry about updating the filter.
Now I could be going about this all wrong, so wondered if anyone knew what I'm doing wrong, or knew a better way in which I could generate a constant expression from the function.
What's the most efficient way to pull 'en-US' out of 'form1.en-US.resx' using C#? The solution should also handle there not being culture info in the file name (ie form1.resx). In that case a string assigned "Default" should be returned.
Guys,
I have this code below which works in firefox and all others except in IE. Am I making a syntaxt error somewhere? Can't seem to find it and its driving me nuts. Any help is appreciated!
<script>
$(document).ready(function(){
$("label:contains('Number')").html("Register:");
$("input[type='textbox']").each(function(){
var name = $(this).attr('name'); // grab name of original
/* create new visible input */
var html = '<input type="checkbox" class="NetscapeFix" size="4" maxlength="5" name="'+name+'" id="'+name+'" value="1" dir="rtl" />';
$(this).after(html).remove(); // add new, then remove original input
});
});
</script>
Thank you,
Kaz
I have a strange situation where the following code works however XCode warns it is deprecated...
NSString *col1 = [NSString stringWithCString:(char *)sqlite3_column_text(compiledStatement, 0)];
However as that is the deprecated method if I set an encoding the string comes out wrong! I have tried all the encodings but none work!
NSString *col1 = [NSString stringWithCString:(char *)sqlite3_column_text(compiledStatement, 0) encoding:NSASCIIStringEncoding];
Trying to set a select dropdown with a slider. You move the jquery ui slider and then it will change the selection of the other two dropdowns.
is there a current method in jquery that would set these options?
Current dropdown:
<select id="alert-options-frequency-opts">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
int i ;
void set_array(int num){
int array[10];
for(i=0;i<10;i++){
array[i]=compare(num,i){
}
}
int compare(int a ,int b){
if(sub(a,b)>=0)
return 1;
else
return 0;
}
int sub(int a,int b){
return a-b;
}
anybody know how to convert to mips code
Hey All
I have a database with around 40 tables and need to rename every index column.
IE USER a table has a bunch of fields like
user_id | user_username | user_password | etc...
I want to rename the ID columns just to id ie
id | user_username | user_password | etc...
But I keep getting mysql errors on the alter table command ie.
ALTER TABLE database RENAME COLUMN user_id to id;
Plus many different variations.
Whats the best way to do this ?
Hope you can advise
I have a DataGridView that is being filled with data from a table. Inside this table is a column called 'group' that has the ID of an individual group in another table.
What I would like to do, is when the DataGridView is filled, instead of showing the ID contained in 'group', I'd like it to display the name of the group. Is there some type of VB.net 'magic' that can do this, or do I need to cross-reference the data myself?
Here is a breakdown of what the 2 tables look like:
table1
id
group (this holds the value of column id in table 2)
weight
last_update
table2
id
description (this is what I would like to be displayed in the DGV.)
BTW - I am using Visual Studio Express.
I my User has_many :event_patrons and EventPatron belongs_to :user. I would like to slap together the user with one specific event patron with something like this sql statement:
SELECT * FROM `users` INNER JOIN `event_patrons` ON `event_patrons`.`user_id` = `users`.`id` WHERE `event_patrons`.`event_id` = 1
So in rails I tried this:
User.all(:joins => :event_patrons, :condidions => {:event_patrons => {:event_id => 1}})
But that gives me SELECT users.* instead of SELECT *:
SELECT `users`* FROM `users` INNER JOIN `event_patrons` ON `event_patrons`.`user_id` = `users`.`id` WHERE `event_patrons`.`event_id` = 1
I then tried to switch the :joins with :include and got a whole jumbled mess that still returned me only the columns in User and none from EventPatron.
What am I missing?
I am trying to translate the following:
Action:
pushl %ebp
movl %esp, %eax
subl $32, %esp
movl $0, -8(%eax)
movl $0, -4(%eax)
movl -4(%eax), %eax
cmpl 32(%eax), %ebp
movl -4(%ebp), %eax
sall $2, %ebp
addl 8(%ebp), %ebp
movl (%ebp), %ebp
addl %ebp, -8(%eax)
addl $1, -4(%eax)
What is the best way to learn assembly and translating this code?
I recently upgraded a c# windows service to run as a 64 bit .net process. Normally, this would be trivial, but the system makes use of a 32-bit DLL written in C++. It is not an option to convert this DLL to 64 bit, so I wrapped the DLL in a separate 32 bit .net process and exposed a .net interface via remoting.
This is quite a reliable solution, but I would prefer to run the system as a single process. Is there any way I can load my 32 bit DLL into a 64 bit process and access it directly (perhaps through some sort of thunking layer)?
This is somewhat a subjective question.
Noticed themes like thematic and carrington use hooks to display their themes.
Trying to figure out which works best for a more efficient workflow.
Which seems more efficient at theming? Trying to weigh in the cons and pros of hooks vs. just including static files.
Are there any Windows IDEs that support both Ruby and Python?
I'm talking about the type of IDE that has syntax suggestions (auto-completion feature).
I've tried Netbeans but it only seems to support Ruby (maybe there's a way to add Python support?)
I am attempting to use a few of the simple android examples for Tab Views. One thing i am attempting to do different than all the examples i've seen so far, is to not use a TabActivity. I am trying to use a normal activity, which means i need to retrieve the TabHost object some how, so i can add tabs and etc to it. How can this be done?
If you wanted to retrieve a view, you can simply use findViewById(R.id.blah), but how can you retrieve the TabHost object in a similar manner?
Simple questions.
Can you change the color of sIFR after the flash has been applied?
I have a bit of a Google, but can't seem to find anything. Only people not being able to set the color initially.
Thanks
Where could I find good resources and examples for learning how to utilize TCP/IP in c# 2.0? Any suggestions on where to start? I'm pretty new at socket programming.
I'm currently mining sequence patterns using SPADE algorithm in R.
SPADE is included in "arulesSequence" package of R.
I'm running R on my CentOS 6.3 64bit.
For an exercise,
I've tried an example presented in http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Sequence_Mining/SPADE
When I tried to do
"cspade(x, parameter = list(support = 0.4), control = list(verbose = TRUE))"
R says:
parameter specification:
support : 0.4
maxsize : 10
maxlen : 10
algorithmic control:
bfstype : FALSE
verbose : TRUE
summary : FALSE
preprocessing ... 1 partition(s), 0 MB [0.096s]
mining transactions ... 0 MB [0.066s]
reading sequences ...Error in asMethod(object) : 's' is not an integer vector
When I try to run SPADE on my Window 7 32bit,
it runs well without any error.
Does anybody know why such errors occur?
recently, while reading former's code in my current project, I encounter the problems below:
while implementing the Queue, my former wrote codes like this:
while(uq->pHead)
{
char *tmp = uq->pHead;
uq->pHead = *(char **)tmp;
//...
}
the uq-pHead has definition like:
typedef struct {
char* pHead;
//...
} Queue;
Well, I'm quite confused about the usage that "uq->pHead = *(char**)tmp" , could anyone explain it to me in detail?
if we assume that *(uq-pHead) = 32(i.e. ' ') , *(char**)tmp would translate this into pointer-form, but...how could it make sense?
Thanks a lot.