ASP.NET 4.0 Deployment Issue CSS / Javascript
I have created a small ASP .Net 4.5 application for a client which I have
deployed to their server.
When the application is deployed to the client server, the css is not
applied to the screens and javascript is not working either.
The clients server is a Windows Server 2008 R2 server and IIS is version 7.
Any help or advice would be greatly appreciated.
Thursday, 12 September 2013
Wednesday, 11 September 2013
Rule Flow In Drools
Rule Flow In Drools
I am new to drools and guvnor.
I have basic question for rule flow.
I have created 3 rules using guided editor on guvnor plugin. Now I want to
invoke the 2nd or 3rd rule based on the outcome of 1st rule.
e.g. If the patient's age is less than 18 go for 2nd rule for minor checks
otherwise invoke 3rd rule for check from senior physician.
So can this be achieved using rule flow? If yes how? Are there any example
links, documents demonstrating it? Any help very much appreciated.
Thanks
I am new to drools and guvnor.
I have basic question for rule flow.
I have created 3 rules using guided editor on guvnor plugin. Now I want to
invoke the 2nd or 3rd rule based on the outcome of 1st rule.
e.g. If the patient's age is less than 18 go for 2nd rule for minor checks
otherwise invoke 3rd rule for check from senior physician.
So can this be achieved using rule flow? If yes how? Are there any example
links, documents demonstrating it? Any help very much appreciated.
Thanks
Rails: Appending models to collection
Rails: Appending models to collection
I'm trying to conditionally build up a list of models. I.e.
@items = []
if some_condition
@items << MyModel.where(...)
end
if another_condition
@items << MyModel.where(...)
end
...
This isn't working. It will actually build up an array of the correct
objects but when I access fields and relationships of items in the array,
they are 'not found'. I tried a few other things like @items =
MyModel.none and @items = {} and .merge but none work. I cant seem to
figure this out.
What is the best way to conditionally build up a collection like this?
I'm trying to conditionally build up a list of models. I.e.
@items = []
if some_condition
@items << MyModel.where(...)
end
if another_condition
@items << MyModel.where(...)
end
...
This isn't working. It will actually build up an array of the correct
objects but when I access fields and relationships of items in the array,
they are 'not found'. I tried a few other things like @items =
MyModel.none and @items = {} and .merge but none work. I cant seem to
figure this out.
What is the best way to conditionally build up a collection like this?
Get php object values into array
Get php object values into array
Thanks for reading.
I want what is output from the initial echo $zip to be stuffed into an
array as a simple integer stack... i've tried [],{} and a variety of other
accessors... Thanks again!
I have:
$userZip = new ZipCode($userZip); $theZips = array();
foreach ($userZip->getZipsInRange(0, 10) as $miles => $zip) {
echo $zip . '
';
$theZips = $zip;
}
print_r($theZips);
// print_r($theZips) output: ZipCode Object (
[zip_code_id:ZipCode:private] => 33816 [zip_code:ZipCode:private] => 21115
[lat:ZipCode:private] => 42.48 [lon:ZipCode:private] => -83.02
[city:ZipCode:private] => CENTER Ville [county:ZipCode:private] =>
[area_code:ZipCode:private] => [time_zone:ZipCode:private] =>
[state_prefix:ZipCode:private] => VA [state_name:ZipCode:private] =>
[mysql_table] => zip_code [mysql_conn] => [mysql_row:ZipCode:private] =>
Array ( [miles] => 8.88798662376604 [zip_code_id] => 33816 [zip_code] =>
21119 [city] => City [state_prefix] => VA [lat] => 42.48 [lon] => -83.02 )
[print_name:ZipCode:private] => 48015 [location_type:ZipCode:private] =>
[miles] => 8.88798662376604 )
Thanks for reading.
I want what is output from the initial echo $zip to be stuffed into an
array as a simple integer stack... i've tried [],{} and a variety of other
accessors... Thanks again!
I have:
$userZip = new ZipCode($userZip); $theZips = array();
foreach ($userZip->getZipsInRange(0, 10) as $miles => $zip) {
echo $zip . '
';
$theZips = $zip;
}
print_r($theZips);
// print_r($theZips) output: ZipCode Object (
[zip_code_id:ZipCode:private] => 33816 [zip_code:ZipCode:private] => 21115
[lat:ZipCode:private] => 42.48 [lon:ZipCode:private] => -83.02
[city:ZipCode:private] => CENTER Ville [county:ZipCode:private] =>
[area_code:ZipCode:private] => [time_zone:ZipCode:private] =>
[state_prefix:ZipCode:private] => VA [state_name:ZipCode:private] =>
[mysql_table] => zip_code [mysql_conn] => [mysql_row:ZipCode:private] =>
Array ( [miles] => 8.88798662376604 [zip_code_id] => 33816 [zip_code] =>
21119 [city] => City [state_prefix] => VA [lat] => 42.48 [lon] => -83.02 )
[print_name:ZipCode:private] => 48015 [location_type:ZipCode:private] =>
[miles] => 8.88798662376604 )
Kruskals Algorithm using C
Kruskals Algorithm using C
I have two Kruskal algorithm programs.One which i made and another which i
took from a friend. Both the programs look almost same to me except a few
things which do not matter. hes program is givinga different ouput and
mine a different one. Though i think both of them are giving the wrong set
of edges but the right weight. My program :
#include<stdio.h>
#include<stdlib.h>
typedef struct info
{
int initial;
int final;
int weight;
}info;
void uon(int x,int y,int*p,int *r);
int findset(int x,int *p);
void sort(info *edgelist,int n);
void qksort(info *edgelist,int l,int u);
int partition(info *edgelist,int l,int u);
void makeset(int n,int *p,int *r);
int kruskal(info *edgelist,int n,int w);
int main()
{
FILE *fp;
int n,i,j,temp;
int **gmatrix,cost;
info *edgelist;
int cnt =0,a;
fp = fopen("grph.txt","r");
fscanf(fp,"%d",&n);
gmatrix=(int**)calloc(sizeof(int*),n);
for(i=0;i<n;i++)
gmatrix[i]=(int*)calloc(sizeof(int),n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
fscanf(fp,"%d",&temp);
gmatrix[i][j]=temp;
}
}
edgelist = (info*)calloc(sizeof(info),n*n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d ",gmatrix[i][j]);
temp = gmatrix[i][j];
a=cnt;
if(temp !=0)
{
edgelist[a].initial = i;
edgelist[a].weight = temp;
edgelist[a].final = j;
cnt++;
}
}
printf("\n");
}
printf("%d \n",edgelist[0].initial);
printf("%d \n ",cnt);
cost =kruskal(edgelist,n,cnt);
printf("\nTotal Cost is %d",cost);
return 0;
}
int kruskal(info *edgelist,int n,int cnt)
{
int b,i,initial,dest,cost_cnt=0;
int *p,*r;
int cost=0;
info *krus;
p = (int*)calloc(sizeof(int),n);
r = (int*)calloc(sizeof(int),n);
makeset(n,p,r);
qksort(edgelist,0,cnt);
//sort(edgelist,w);
krus=(info*)calloc(sizeof(info),n-1);
for(i=0;i<cnt;i++)
{
//printf("INITIAL 1 : %d \n",edgelist[i].initial);
initial=findset(edgelist[i].initial,p);
// printf("INITIAL 2 : %d \n",initial);
dest=findset(edgelist[i].final,p);
if(initial!=dest)
{
b=cost_cnt;
krus[b].initial=initial;
krus[b].final=dest;
krus[b].weight=edgelist[i].weight;
cost_cnt++;
uon(initial,dest,p,r);
}
}
for(i=0;i<cost_cnt;i++)
{
printf("{%d,%d}: %d \n",krus[i].initial+1,krus[i].final+1,
krus[i].weight);
cost = cost + krus[i].weight;
}
return cost;
}
void uon(int initial,int dest,int *p,int *r)
{
int u,v;
//link(findset(x),findset(y));
printf("\n X1 : %d",initial);
u = findset(initial,p);
printf("\n X2 : %d",initial);
v = findset(dest,p);
if(r[u]>r[v])
{
p[v] = u;
}
else
{
p[u] = v;
if(r[u]==r[v])
r[v] = r[v]+1;
}
}
int findset(int x,int *p)
{
if(x!=p[x])
{
p[x]=findset(p[x],p);
}
return p[x];
}
void makeset(int n,int *p,int *r)
{
int i;
for(i=0;i<n;i++)
{
p[i] = i;
r[i] = 0;
}
}
void qksort(info *edgelist,int l,int u) {
int pq;
if(l<u)
{
pq=partition(edgelist,l,u);
qksort(edgelist,l,pq-1);
qksort(edgelist,pq+1,u);
}
}
int partition(info *edgelist,int l,int u) {
int i,j,pq;
info pv,t;
pv.initial=edgelist[l].initial;
pv.final=edgelist[l].final;
pv.weight=edgelist[l].weight;
j=l;
for(i=l+1;i<=u;i++)
{
if(edgelist[i].weight<=pv.weight)
{
j++;
t=edgelist[i];
t.initial=edgelist[i].initial;
t.final=edgelist[i].final;
t.weight=edgelist[i].weight;
edgelist[i].initial=edgelist[j].initial;
edgelist[i].final=edgelist[j].final;
edgelist[i].weight=edgelist[j].weight;
edgelist[j].initial=t.initial;
edgelist[j].final=t.final;
edgelist[j].weight=t.weight;
}
}
pq=j;
t.initial=edgelist[pq].initial;
t.final=edgelist[pq].final;
t.weight=edgelist[pq].weight;
edgelist[pq].initial=edgelist[l].initial;
edgelist[pq].final=edgelist[l].final;
edgelist[pq].weight=edgelist[l].weight;
edgelist[l].initial=t.initial;
edgelist[l].final=t.final;
edgelist[l].weight=t.weight;
return(pq);
}
Friends Program :
#include<stdio.h>
#include<stdlib.h>
struct info{
int initial;
int dest;
int weight;
};
void kruskal(struct info *,int **,int,int);
void makeset(int *,int *,int);
void quick_sort(struct info *,int,int);
int find_set(int *,int);
void union_set(int * ,int *,int,int);
int partition(struct info *,int,int);
int main(int argc,char **argv)
{
FILE *fp;
int **gmatrix;
int num,source,i,j,temp,count,a;
struct info *edgelist;
if(argc!=2)
{
printf("enter the proper argument");
return(EXIT_FAILURE);
}
fp=fopen(argv[1],"r");
fscanf(fp,"%d",&num);
printf("num=%d\n",num);
gmatrix=(int **)calloc(sizeof(int *),num);
for(i=0;i<num;i++)
gmatrix[i]=(int *)calloc(sizeof(int),num);
for(i=0;i<num;i++)
{
for(j=0;j<num;j++)
{
fscanf(fp,"%d",&temp);
*(*(gmatrix+i)+j)=temp;
}
}
edgelist=(struct info *)calloc(sizeof(struct info),num*num);
count=0;
for(i=0;i<num;i++)
{
for(j=0;j<num;j++)
{
temp=*(*(gmatrix+i)+j);
if(temp!=0)
{
a=count;
edgelist[a].initial=i;
edgelist[a].dest=j;
printf("(%d,%d)\n",edgelist[a].initial,edgelist[a].dest);
edgelist[a].weight=temp;
printf("weight=%d\t",edgelist[a].weight);
count=count+1;
printf("a=%d\n",count);
}
}
}
printf("ans=%d\t",count);
kruskal(edgelist,gmatrix,num,count);
}
void kruskal(struct info *edgelist,int **gmatrix,int num,int count)
{
int *parent;
int *rank;
int i,cost_count,b,initial,dest,cost=0;
struct info *krus;
parent = (int *)calloc(sizeof(int),num);
rank = (int *)calloc(sizeof(int),num);
makeset(parent,rank,num);
quick_sort(edgelist,0,count);
for(i=0;i<count;i++)
{
printf("sorting=%d\t",edgelist[i].weight);
}
krus=(struct info *)calloc(sizeof(struct info),num-1);
cost_count=0;
for(i=0;i<count;i++)
{
initial=find_set(parent,edgelist[i].initial);
dest=find_set(parent,edgelist[i].dest);
if(initial != dest )
{
b=cost_count;
krus[b].initial=initial;
krus[b].dest=dest;
krus[b].weight=edgelist[i].weight;
cost_count=cost_count+1;
// printf("weight=%d and
(%d,%d)\t",krus[b].weight,krus[b].initial,krus[b].dest);
union_set(parent,rank,initial,dest);
}
}
for (i=0;i<num-1;i++) {
printf("\n%d . {%d, %d}",i+1,krus[i].initial+1,krus[i].dest+1);
cost = cost + krus[i].weight;
}
printf("\ncost of minimum mst is..... %d\n\n",cost);
}
void union_set(int *parent ,int *rank,int initial,int dest)
{
int u,v;
printf("\n X1 : %d",u);
u=find_set(parent,initial);
printf("\n X2 : %d\n",u);
v=find_set(parent,dest);
if(rank[u]>rank[v])
parent[v]=u;
else
{
parent[u]=v;
if(rank[u]==rank[v])
rank[v]=rank[v]+1;
}
}
int find_set(int *parent,int x)
{
if(x!=parent[x])
parent[x] = find_set(parent,parent[x]);
return parent[x];
}
void makeset(int *parent,int *rank,int num)
{
int i;
for (i=0; i<num; i++)
{
parent[i] = i;
rank[i] = 0;
}
}
void quick_sort(struct info *edgelist,int left,int right)
{
int q;
if(left<right)
{
q=partition(edgelist,left,right);
quick_sort(edgelist,left,q-1);
quick_sort(edgelist,q+1,right);
}
}
int partition(struct info *edgelist,int left,int right)
{
struct info pivot,temp;
int i,j,k,pp;
pivot.initial=edgelist[left].initial;
pivot.dest =edgelist[left].dest;
pivot.weight =edgelist[left].weight;
j=left;
for(i=left+1;i<=right;i++)
{
if(edgelist[i].weight < pivot.weight)
{
j=j+1;
temp.initial=edgelist[i].initial;
temp.dest=edgelist[i].dest;
temp.weight=edgelist[i].weight;
edgelist[i].initial=edgelist[j].initial;
edgelist[i].dest=edgelist[j].dest;
edgelist[i].weight=edgelist[j].weight;
edgelist[j].initial=temp.initial;
edgelist[j].dest=temp.dest;
edgelist[j].weight=temp.weight;
}
}
pp=j;
temp.initial=edgelist[left].initial;
temp.dest=edgelist[left].dest;
temp.weight=edgelist[left].weight;
edgelist[left].initial=edgelist[pp].initial;
edgelist[left].dest=edgelist[pp].dest;
edgelist[left].weight=edgelist[pp].weight;
edgelist[pp].initial=temp.initial;
edgelist[pp].dest=temp.dest;
edgelist[pp].weight=temp.weight;
//printf("aaaa=%d\t\n",pp);
return pp;
}
The graph i am using
9
0 4 0 0 0 0 0 8 0
4 0 8 0 0 0 0 11 0
0 8 0 7 0 4 0 0 2
0 0 7 0 9 14 0 0 0
0 0 0 9 0 10 0 0 0
0 0 4 14 10 0 2 0 0
0 0 0 0 0 2 0 1 6
8 11 0 0 0 0 1 0 7
0 0 2 0 0 0 6 7 0
The weight is 37 but the programs arent giving the crrect set of edges
I have two Kruskal algorithm programs.One which i made and another which i
took from a friend. Both the programs look almost same to me except a few
things which do not matter. hes program is givinga different ouput and
mine a different one. Though i think both of them are giving the wrong set
of edges but the right weight. My program :
#include<stdio.h>
#include<stdlib.h>
typedef struct info
{
int initial;
int final;
int weight;
}info;
void uon(int x,int y,int*p,int *r);
int findset(int x,int *p);
void sort(info *edgelist,int n);
void qksort(info *edgelist,int l,int u);
int partition(info *edgelist,int l,int u);
void makeset(int n,int *p,int *r);
int kruskal(info *edgelist,int n,int w);
int main()
{
FILE *fp;
int n,i,j,temp;
int **gmatrix,cost;
info *edgelist;
int cnt =0,a;
fp = fopen("grph.txt","r");
fscanf(fp,"%d",&n);
gmatrix=(int**)calloc(sizeof(int*),n);
for(i=0;i<n;i++)
gmatrix[i]=(int*)calloc(sizeof(int),n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
fscanf(fp,"%d",&temp);
gmatrix[i][j]=temp;
}
}
edgelist = (info*)calloc(sizeof(info),n*n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d ",gmatrix[i][j]);
temp = gmatrix[i][j];
a=cnt;
if(temp !=0)
{
edgelist[a].initial = i;
edgelist[a].weight = temp;
edgelist[a].final = j;
cnt++;
}
}
printf("\n");
}
printf("%d \n",edgelist[0].initial);
printf("%d \n ",cnt);
cost =kruskal(edgelist,n,cnt);
printf("\nTotal Cost is %d",cost);
return 0;
}
int kruskal(info *edgelist,int n,int cnt)
{
int b,i,initial,dest,cost_cnt=0;
int *p,*r;
int cost=0;
info *krus;
p = (int*)calloc(sizeof(int),n);
r = (int*)calloc(sizeof(int),n);
makeset(n,p,r);
qksort(edgelist,0,cnt);
//sort(edgelist,w);
krus=(info*)calloc(sizeof(info),n-1);
for(i=0;i<cnt;i++)
{
//printf("INITIAL 1 : %d \n",edgelist[i].initial);
initial=findset(edgelist[i].initial,p);
// printf("INITIAL 2 : %d \n",initial);
dest=findset(edgelist[i].final,p);
if(initial!=dest)
{
b=cost_cnt;
krus[b].initial=initial;
krus[b].final=dest;
krus[b].weight=edgelist[i].weight;
cost_cnt++;
uon(initial,dest,p,r);
}
}
for(i=0;i<cost_cnt;i++)
{
printf("{%d,%d}: %d \n",krus[i].initial+1,krus[i].final+1,
krus[i].weight);
cost = cost + krus[i].weight;
}
return cost;
}
void uon(int initial,int dest,int *p,int *r)
{
int u,v;
//link(findset(x),findset(y));
printf("\n X1 : %d",initial);
u = findset(initial,p);
printf("\n X2 : %d",initial);
v = findset(dest,p);
if(r[u]>r[v])
{
p[v] = u;
}
else
{
p[u] = v;
if(r[u]==r[v])
r[v] = r[v]+1;
}
}
int findset(int x,int *p)
{
if(x!=p[x])
{
p[x]=findset(p[x],p);
}
return p[x];
}
void makeset(int n,int *p,int *r)
{
int i;
for(i=0;i<n;i++)
{
p[i] = i;
r[i] = 0;
}
}
void qksort(info *edgelist,int l,int u) {
int pq;
if(l<u)
{
pq=partition(edgelist,l,u);
qksort(edgelist,l,pq-1);
qksort(edgelist,pq+1,u);
}
}
int partition(info *edgelist,int l,int u) {
int i,j,pq;
info pv,t;
pv.initial=edgelist[l].initial;
pv.final=edgelist[l].final;
pv.weight=edgelist[l].weight;
j=l;
for(i=l+1;i<=u;i++)
{
if(edgelist[i].weight<=pv.weight)
{
j++;
t=edgelist[i];
t.initial=edgelist[i].initial;
t.final=edgelist[i].final;
t.weight=edgelist[i].weight;
edgelist[i].initial=edgelist[j].initial;
edgelist[i].final=edgelist[j].final;
edgelist[i].weight=edgelist[j].weight;
edgelist[j].initial=t.initial;
edgelist[j].final=t.final;
edgelist[j].weight=t.weight;
}
}
pq=j;
t.initial=edgelist[pq].initial;
t.final=edgelist[pq].final;
t.weight=edgelist[pq].weight;
edgelist[pq].initial=edgelist[l].initial;
edgelist[pq].final=edgelist[l].final;
edgelist[pq].weight=edgelist[l].weight;
edgelist[l].initial=t.initial;
edgelist[l].final=t.final;
edgelist[l].weight=t.weight;
return(pq);
}
Friends Program :
#include<stdio.h>
#include<stdlib.h>
struct info{
int initial;
int dest;
int weight;
};
void kruskal(struct info *,int **,int,int);
void makeset(int *,int *,int);
void quick_sort(struct info *,int,int);
int find_set(int *,int);
void union_set(int * ,int *,int,int);
int partition(struct info *,int,int);
int main(int argc,char **argv)
{
FILE *fp;
int **gmatrix;
int num,source,i,j,temp,count,a;
struct info *edgelist;
if(argc!=2)
{
printf("enter the proper argument");
return(EXIT_FAILURE);
}
fp=fopen(argv[1],"r");
fscanf(fp,"%d",&num);
printf("num=%d\n",num);
gmatrix=(int **)calloc(sizeof(int *),num);
for(i=0;i<num;i++)
gmatrix[i]=(int *)calloc(sizeof(int),num);
for(i=0;i<num;i++)
{
for(j=0;j<num;j++)
{
fscanf(fp,"%d",&temp);
*(*(gmatrix+i)+j)=temp;
}
}
edgelist=(struct info *)calloc(sizeof(struct info),num*num);
count=0;
for(i=0;i<num;i++)
{
for(j=0;j<num;j++)
{
temp=*(*(gmatrix+i)+j);
if(temp!=0)
{
a=count;
edgelist[a].initial=i;
edgelist[a].dest=j;
printf("(%d,%d)\n",edgelist[a].initial,edgelist[a].dest);
edgelist[a].weight=temp;
printf("weight=%d\t",edgelist[a].weight);
count=count+1;
printf("a=%d\n",count);
}
}
}
printf("ans=%d\t",count);
kruskal(edgelist,gmatrix,num,count);
}
void kruskal(struct info *edgelist,int **gmatrix,int num,int count)
{
int *parent;
int *rank;
int i,cost_count,b,initial,dest,cost=0;
struct info *krus;
parent = (int *)calloc(sizeof(int),num);
rank = (int *)calloc(sizeof(int),num);
makeset(parent,rank,num);
quick_sort(edgelist,0,count);
for(i=0;i<count;i++)
{
printf("sorting=%d\t",edgelist[i].weight);
}
krus=(struct info *)calloc(sizeof(struct info),num-1);
cost_count=0;
for(i=0;i<count;i++)
{
initial=find_set(parent,edgelist[i].initial);
dest=find_set(parent,edgelist[i].dest);
if(initial != dest )
{
b=cost_count;
krus[b].initial=initial;
krus[b].dest=dest;
krus[b].weight=edgelist[i].weight;
cost_count=cost_count+1;
// printf("weight=%d and
(%d,%d)\t",krus[b].weight,krus[b].initial,krus[b].dest);
union_set(parent,rank,initial,dest);
}
}
for (i=0;i<num-1;i++) {
printf("\n%d . {%d, %d}",i+1,krus[i].initial+1,krus[i].dest+1);
cost = cost + krus[i].weight;
}
printf("\ncost of minimum mst is..... %d\n\n",cost);
}
void union_set(int *parent ,int *rank,int initial,int dest)
{
int u,v;
printf("\n X1 : %d",u);
u=find_set(parent,initial);
printf("\n X2 : %d\n",u);
v=find_set(parent,dest);
if(rank[u]>rank[v])
parent[v]=u;
else
{
parent[u]=v;
if(rank[u]==rank[v])
rank[v]=rank[v]+1;
}
}
int find_set(int *parent,int x)
{
if(x!=parent[x])
parent[x] = find_set(parent,parent[x]);
return parent[x];
}
void makeset(int *parent,int *rank,int num)
{
int i;
for (i=0; i<num; i++)
{
parent[i] = i;
rank[i] = 0;
}
}
void quick_sort(struct info *edgelist,int left,int right)
{
int q;
if(left<right)
{
q=partition(edgelist,left,right);
quick_sort(edgelist,left,q-1);
quick_sort(edgelist,q+1,right);
}
}
int partition(struct info *edgelist,int left,int right)
{
struct info pivot,temp;
int i,j,k,pp;
pivot.initial=edgelist[left].initial;
pivot.dest =edgelist[left].dest;
pivot.weight =edgelist[left].weight;
j=left;
for(i=left+1;i<=right;i++)
{
if(edgelist[i].weight < pivot.weight)
{
j=j+1;
temp.initial=edgelist[i].initial;
temp.dest=edgelist[i].dest;
temp.weight=edgelist[i].weight;
edgelist[i].initial=edgelist[j].initial;
edgelist[i].dest=edgelist[j].dest;
edgelist[i].weight=edgelist[j].weight;
edgelist[j].initial=temp.initial;
edgelist[j].dest=temp.dest;
edgelist[j].weight=temp.weight;
}
}
pp=j;
temp.initial=edgelist[left].initial;
temp.dest=edgelist[left].dest;
temp.weight=edgelist[left].weight;
edgelist[left].initial=edgelist[pp].initial;
edgelist[left].dest=edgelist[pp].dest;
edgelist[left].weight=edgelist[pp].weight;
edgelist[pp].initial=temp.initial;
edgelist[pp].dest=temp.dest;
edgelist[pp].weight=temp.weight;
//printf("aaaa=%d\t\n",pp);
return pp;
}
The graph i am using
9
0 4 0 0 0 0 0 8 0
4 0 8 0 0 0 0 11 0
0 8 0 7 0 4 0 0 2
0 0 7 0 9 14 0 0 0
0 0 0 9 0 10 0 0 0
0 0 4 14 10 0 2 0 0
0 0 0 0 0 2 0 1 6
8 11 0 0 0 0 1 0 7
0 0 2 0 0 0 6 7 0
The weight is 37 but the programs arent giving the crrect set of edges
How to deal with system "static" data in java
How to deal with system "static" data in java
I was just wondering if there is some better way how to handle system
"static" configuration data. Let say you have a system which offers
several operation which are in code translated to operation code but you
need to keep other related information to that operation like description,
priority etc. Nasty way I have seen is public static final constants.
Better way I was using before was create a class eg:
public abstract Codebook{
private int id;
private String description;
... getters setters
}
Then for given cathegory - in this case OperationalCode:
public class OperationalCode extends Codebook{}
Instance of this class were created with the data from BD. Now I cannot
use DB so I thought I will create factories which will populate classes
with given set of parameters. BUT all is hardcoded to factory class which
I don't like.
Is there a better solution how to tackle this case as I believe I am not
the first one solving that. Some handy framework or ...
I was just wondering if there is some better way how to handle system
"static" configuration data. Let say you have a system which offers
several operation which are in code translated to operation code but you
need to keep other related information to that operation like description,
priority etc. Nasty way I have seen is public static final constants.
Better way I was using before was create a class eg:
public abstract Codebook{
private int id;
private String description;
... getters setters
}
Then for given cathegory - in this case OperationalCode:
public class OperationalCode extends Codebook{}
Instance of this class were created with the data from BD. Now I cannot
use DB so I thought I will create factories which will populate classes
with given set of parameters. BUT all is hardcoded to factory class which
I don't like.
Is there a better solution how to tackle this case as I believe I am not
the first one solving that. Some handy framework or ...
Changing OEM Info in C#
Changing OEM Info in C#
How do I add/change OEMInformation registry keys using C#?
I tried to use this code but it returns an error :
RegistryKey myKey =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\Windows\CurrentVersion\OEMInformation",
true);
myKey.SetValue("manufacturer", "Asus", RegistryValueKind.String);
This error is being returned :
An unhandled exception of type 'System.Security.SecurityException'
occurred in mscorlib.dll
Additional information: Requested registry access is not allowed.
How do I add/change OEMInformation registry keys using C#?
I tried to use this code but it returns an error :
RegistryKey myKey =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\Windows\CurrentVersion\OEMInformation",
true);
myKey.SetValue("manufacturer", "Asus", RegistryValueKind.String);
This error is being returned :
An unhandled exception of type 'System.Security.SecurityException'
occurred in mscorlib.dll
Additional information: Requested registry access is not allowed.
Subscribe to:
Posts (Atom)