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
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 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.
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.
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
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.
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.
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?
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.
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)?
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?
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'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?
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.
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.
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.
I'm a noob at this and can't figure out why the hyphen gets added to something like this:
<% if flash[:notice] -%
<%= flash[:notice] %
<% end -%
Not even sure if my jargon in the title of this question is accurate.
Note: This is my first question on the stack exchange network so please give mercy and provide guidance where needed.
I have installed a CentOS 6.2 KVM guest and I am having problem getting yum to work. This is my first time working with CentOS so I feel that it's a setting somewhere that I am missing but cannot find using google.
Here are my steps;
Downloaded CentOS-6.2-x86_64-minimal.iso, booted, and went through default steps (only questions asked where keyboard, timezone, root password and use entire hdd)
Restarted, logged in, pinged google.com to no avail
Set the following settings;
vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="52:54:00:42:1B:4A"
#NM_CONTROLLED="yes"
BOOTPROTO=none
ONBOOT="yes"
NETMASK=255.255.255.0
IPADDR=192.168.122.151
TYPE=Ethernet
vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server3.example.com
GATEWAY=192.168.122.1
I can now ping google.com
ping google.com
PING google.com (173.194.70.139) 56(84) bytes of data.
64 bytes from fa-in-f139.1e100.net (173.194.70.139): icmp_seq=1 ttl=50 time=5.88 ms
64 bytes from fa-in-f139.1e100.net (173.194.70.139): icmp_seq=2 ttl=50 time=5.77 ms
But I cannot 'yum update'
yum update
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 7 - "Failed to connect to 2a01:c0:2:4:216:3eff:fe0d:266d: Network is unreachable"
Error: Cannot find a valid baseurl for repo: base
My KVM guest is also NAT'd incase it's of concern.
I am trying to get my FAS2040 to action user lookups using LDAP, below is the filer configuration options:
filer> options ldap
ldap.ADdomain dc1.colour.domain.local
ldap.base OU=Users,OU=something1,OU=something2,OU=darkside,DC=colour,DC=domain,DC=local
ldap.base.group
ldap.base.netgroup
ldap.base.passwd
ldap.enable on
ldap.minimum_bind_level anonymous
ldap.name domain-admin-account
ldap.nssmap.attribute.gecos gecos
ldap.nssmap.attribute.gidNumber gidNumber
ldap.nssmap.attribute.groupname cn
ldap.nssmap.attribute.homeDirectory homeDirectory
ldap.nssmap.attribute.loginShell loginShell
ldap.nssmap.attribute.memberNisNetgroup memberNisNetgroup
ldap.nssmap.attribute.memberUid memberUid
ldap.nssmap.attribute.netgroupname cn
ldap.nssmap.attribute.nisNetgroupTriple nisNetgroupTriple
ldap.nssmap.attribute.uid uid
ldap.nssmap.attribute.uidNumber uidNumber
ldap.nssmap.attribute.userPassword userPassword
ldap.nssmap.objectClass.nisNetgroup nisNetgroup
ldap.nssmap.objectClass.posixAccount posixAccount
ldap.nssmap.objectClass.posixGroup posixGroup
ldap.passwd ******
ldap.port 389
ldap.servers
ldap.servers.preferred
ldap.ssl.enable off
ldap.timeout 20
ldap.usermap.attribute.unixaccount unixaccount
ldap.usermap.attribute.windowsaccount sAMAccountName
ldap.usermap.base
ldap.usermap.enable on
output of nsswitch.conf:
hosts: files dns
passwd: ldap files
netgroup: ldap files
group: ldap files
shadow: files nis
Error Message(s):
[filer: auth.ldap.trace.LDAPConnection.statusMsg:info]: AUTH: TraceLDAPServer- Starting AD LDAP server address discovery for dc1.colour.domain.LOCAL.
[filer: auth.ldap.trace.LDAPConnection.statusMsg:info]: AUTH: TraceLDAPServer- Found no AD LDAP server addresses using DNS site query (site).
[filer: auth.ldap.trace.LDAPConnection.statusMsg:info]: AUTH: TraceLDAPServer- Found no AD LDAP server addresses using generic DNS query.
Could not get passwd entry for name = <random user>
the filer can ping the FQDN of dc1
the filer can ping the IP of dc1
the filer cannot ping "dc1"
I'm not sure where I'm going wrong, so any pointers would be great.
I am trying to get my FAS2040 to action user lookups using LDAP, below is the filer configuration options:
filer> options ldap
ldap.ADdomain dc1.colour.domain.local
ldap.base OU=Users,OU=something1,OU=something2,OU=darkside,DC=colour,DC=domain,DC=local
ldap.base.group
ldap.base.netgroup
ldap.base.passwd
ldap.enable on
ldap.minimum_bind_level anonymous
ldap.name domain-admin-account
ldap.nssmap.attribute.gecos gecos
ldap.nssmap.attribute.gidNumber gidNumber
ldap.nssmap.attribute.groupname cn
ldap.nssmap.attribute.homeDirectory homeDirectory
ldap.nssmap.attribute.loginShell loginShell
ldap.nssmap.attribute.memberNisNetgroup memberNisNetgroup
ldap.nssmap.attribute.memberUid memberUid
ldap.nssmap.attribute.netgroupname cn
ldap.nssmap.attribute.nisNetgroupTriple nisNetgroupTriple
ldap.nssmap.attribute.uid uid
ldap.nssmap.attribute.uidNumber uidNumber
ldap.nssmap.attribute.userPassword userPassword
ldap.nssmap.objectClass.nisNetgroup nisNetgroup
ldap.nssmap.objectClass.posixAccount posixAccount
ldap.nssmap.objectClass.posixGroup posixGroup
ldap.passwd ******
ldap.port 389
ldap.servers
ldap.servers.preferred
ldap.ssl.enable off
ldap.timeout 20
ldap.usermap.attribute.unixaccount unixaccount
ldap.usermap.attribute.windowsaccount sAMAccountName
ldap.usermap.base
ldap.usermap.enable on
output of nsswitch.conf:
hosts: files dns
passwd: ldap files
netgroup: ldap files
group: ldap files
shadow: files nis
Error Message(s):
[filer: auth.ldap.trace.LDAPConnection.statusMsg:info]: AUTH: TraceLDAPServer- Starting AD LDAP server address discovery for dc1.colour.domain.LOCAL.
[filer: auth.ldap.trace.LDAPConnection.statusMsg:info]: AUTH: TraceLDAPServer- Found no AD LDAP server addresses using DNS site query (site).
[filer: auth.ldap.trace.LDAPConnection.statusMsg:info]: AUTH: TraceLDAPServer- Found no AD LDAP server addresses using generic DNS query.
Could not get passwd entry for name = <random user>
the filer can ping the FQDN of dc1
the filer can ping the IP of dc1
the filer cannot ping "dc1"
I'm not sure where I'm going wrong, so any pointers would be great.