I am currently playing with some open source home automation software www.domotiga.nl
The software is built in Gambas2 (a graphical programming language similar to visual basic). I am considering building something similar or porting domotiga to a server based application/service.
The application would need a web front end and i will likely be developing in debian (arm). But i'm not sure if php or python are suitable for server based applications which need to be always running (collecting data etc) rather than just running when accessed.
Which technology(s) / language(s) would you suggest i look into?
I used to do a lot of Visual Basic, then VB.NET, now C# and have played with php a few years back- but don't really want this to sway the decision too much as i should be able to pickup whatever language if i decide to proceed.
I have two resource controllers where I am using a slug to represent the ID. (friendly_id gem).
I am able to have the show path for one resource on the route but not for two at the same time. ie.
root :to => 'home#index'
match '/:id' => "properties#show"
match '/:id' => "contents#show"
Basically I want urls like,
# Content
domain.com/about-us
domain.com/terms
# Property
domain.com/unique-property-name
domain.com/another-unique-property-name
Whatever resource I put on top works. Is there a way to do this?
Thanks in advace if you can help.
is it good practice to use iframe to implement header/navbar?
my website is basically 5 thousand pages but all static html (not using any content manager, php, etc.).
am in the process to add a navbar at the top of each page. e.g. tabs, or crumbs, or any sort of header with js menu. (the exact design not decided yet)
my question is, is it good practice to use a iframe for this? (so, instead have same text repeated in all 5 thousand pages, each will just have a short iframe pointing to a header file)
am aware that one should reduce http request for speed, but this is ok with me. Any other problems i might have with this? SEO or any tech issue?
I am working on a menu navigation that has parent horizontal bar as static
and a vertical accordion child menu that interacts with the parent.
I have them working fine except one part where I want to toggle show() and hide() child menu when clicked on the same parent menu item.
I've looked at toggle() jQuery API but couldn't get it working properly.
The following is only a script for parent part which I got rid of toggle() for now.
$(function () {
$('#mainMenu > ul > li > a').click(function () {
$('#mainMenu li').removeClass('active');
$(this).closest('li').addClass('active');
if ($(this).text() == "1st click") {
$('#subMenu > ul').siblings().hide();
$('#subMenu > ul:nth-child(1)').show();
} else if ($(this).text() == "2nd click") {
$('#subMenu > ul').siblings().hide();
$('#subMenu > ul:nth-child(2)').show();
}
});
});
The Full code that isolates the problem is available here
There are two methods GetUserAssignedSystems() and GetUserAssignedSystems(string Id)
These methods act very differently from each other. The problem is, when I want to call GetUserAssignedSystems(string Id), the parameter-less method is called.
Here are the methods:
[WebMethod]
[ScriptMethod]
public IEnumerable GetUserAssignedSystems(string cacId)
{
return Data.UserManager.GetUserAssingedSystems(cacId);
}
[WebMethod]
[ScriptMethod]
public IEnumerable GetUserAssignedSystems()
{
//do something else
}
Here is the jquery making the call:
CallMfttService("ServiceLayer/UserManager.asmx/GetUserAssignedSystems", "{'cacId':'" + $('#EditUserCacId').val() + "'}", function(result) {
for (var userSystem in result.d) {
$('input[UserSystemID=' + result.d[userSystem] + ']').attr('checked', 'true');
}
});
Any ideas why this method is being ignored?
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];
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
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>
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?)