Saturday, 31 August 2013

javascript object declaration no working as i want it to

javascript object declaration no working as i want it to

i am creating a (lame) game, in which i declare the object player like so:
var player = {
"id": "player",
"displayText" : "<img src =
'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZSagpqJGExef2ebpgUWDH1dFVcyaJ-oFcIr-EUMYd8bHEUcDantAjIRzQrOoYqb1unJXQzykhjEBFsBFL42U87qgsIAC1QQMT-vc38EYXb8hVFZrBqcfmROMW8OTS7XaPdMm7ET8m1Ms/s1600/smileys_001_01.png'"
+
"class='onTop' id='" + this.id + "' alt='you' border='0' />" +
"<div id = '" + this.id + "health' class = 'healthLost hide'></div>",
};
however this.id is returning undefined, why and what can i do to fix this?

Mediawiki Extension:RSS

Mediawiki Extension:RSS

The MediaWiki Extension:RSS (http://www.mediawiki.org/wiki/Extension:RSS)
uses the plainlinks class to present the RSS feed link. I have tried all
manner of searching, including trying to edit the MediaWiki:Rss-feed
template to force the link to presented in non-bolded format.
Has anyone used this extension and can tell me how to change the fonts in
the RSS link?
Thanks

Structural-type casting does not work with String?

Structural-type casting does not work with String?

Given these definitions:
type HasMkString = { def mkString(sep:String):String }
val name = "John"
val names = List("Peter", "Gabriel")
And given these facts:
name.mkString("-") // => "J-o-h-n"
name.isInstanceOf[HasMkString] // => true
names.isInstanceOf[HasMkString] // => true
While this works:
names.asInstanceOf[HasMkString].mkString("-")
// => Peter-Gabriel
This does not work:
name.asInstanceOf[HasMkString].mkString(", ")
java.lang.NoSuchMethodException: java.lang.String.mkString(java.lang.String)
at java.lang.Class.getMethod(Class.java:1624)
at .reflMethod$Method1(<console>:10)
at .<init>(<console>:10)
at .<clinit>(<console>:10)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
Why is that? Is it because String is a Java class? Can I work around this
problem? Is this a bug/shortcoming in the Scala implementation?

Adding text to paragraph moves neighbor elements down

Adding text to paragraph moves neighbor elements down

When ever I add text that differs in size to one of my paragraph tags the
neighbor elements get pushed down and I can't figure out why.
Codepen: http://cdpn.io/bqJec

Replace All String literals in a line in Java using Regex

Replace All String literals in a line in Java using Regex

Is there any regex in java which can convert the following input into the
output
Input:
System.out.println("This is \" line number one"); System.out.println("This
is line number two"); String x = "This is string x";
Output:
System.out.println("ABC"); System.out.println("ABC"); String x = "ABC";
Notes:
1) I am basically reading a java file line by line using StringBuffer and
replacing ALL the string literals with a string of my choice.
2) Since there can be exceptional conditions like multiple println
statement on a single line or something sort of like that, or there can be
quote characters inside the string itself following an escape character, I
have used the above mentioned sample input.
3) I had posted a similar question in the forum, but I guess i wasn't able
to explain my requirement properly there. And I'm not completely aware of
"duplicate question" policies here... So please pardon me and take
necessary actions, but please first try to answer my question. Here is the
link to my previous question regarding this requirement: My Previous
Question
4) I know what my requirement is, so please be kind enough to spare me
from answers like "why are you doing this way... why do you NEED to do
this... "

PHP - Generating several forms, but the forms only ever output the same thing for each form

PHP - Generating several forms, but the forms only ever output the same
thing for each form

Ok so I basically have generated a list of links that use forms to send a
variable to PHP that would allow me to load different things on the next
page from each link. However, each link seems to only request the same
data from the database each time
Here is the first page:

Friday, 30 August 2013

infix to postfix using stacks as linked lists in C language

infix to postfix using stacks as linked lists in C language

i have written a program to convert infix to postfix using C language in
UBUNTU...but my program is not woarking properly can any one help??? MY
PROGRAM IS AS FOLLOWS
#include<stdio.h>
#include<stdlib.h>
char op[50];
struct node
{
char data;
struct node *next;
} *l1=NULL;
void push(char x) // pushes char into the linkedlist
{
if(l1==NULL)
{
l1=(struct node *)malloc(sizeof(struct node));
l1->data=x;
l1->next=NULL;
}
else
{
struct node *p;
p=(struct node *)malloc(sizeof(struct node));
p->data=x;
p->next=l1;
l1=p;
}
}
char pop() // pops char outof linkedlist
{
char c;
struct node *p;
if (l1==NULL)
{
printf("the stack is empty\n");
// exit(1);
}
else
{
c=l1->data;
p=l1->next;
free (l1);
l1=p;
}
return c;
}
void display(struct node *start)
{
{
int i=0;
struct node *p;
p=start;
if(p==NULL)
printf("Empty list");
else
{
while(p!=NULL)
{
printf("%c->",p->data);
p=p->next;
}
printf("NULL\n");
}
}
}
int prior(char s, char c)
{
if ( c=='^' && s=='+' || s=='-' ||s=='/' || s=='*')
return 1;
else if( c=='*' || c=='/')
{
if(s=='+' || s=='-' )
return 1;
else
return 0;
}
else if( c=='+' || c=='-' )
return 0;
}
void cnvrt(char s[], int n) // convert infix to postfix
{
char g;
int i,j,x;
for(i=0,j=0;i<n;i++)
{
if (s[i]>='0'&&s[i]<='9' || s[i]>='a' && s[i]<='z'|| s[i]>='A' &&
s[i]<='Z')
{
op[j]=s[i];
j++;
}
else if(s[i]=='(')
{
push(s[i]);
}
else if (s[i]=='+' || s[i]=='/' || s[i]=='-' || s[i]=='*' ||
s[i]=='^')
{
if( l1==NULL)
push(s[i]);
else if(l1->data=='(')
push(s[i]);
else if(prior(l1->data, s[i] )!=1)
push(s[i]);
else
{ op[j]=pop();
j++;
push(s[i]);
}
}
else if(s[i]==')')
{
while(l1!=NULL && l1->data!='(')
{
op[j]=pop();
j++;
}
g=pop();
}
}
while(l1!=NULL)
{
op[j]=pop();
j++;
l1=l1->next;
}
}
void main()
{
int i,n;
char c[50];
printf(" enter the no of characters in infix string\n ");
scanf("%d",&n);
printf(" enter the infix string\n");
//for(i=0;i<n;i++)
scanf("%s",c);
cnvrt(c,n);
printf("the postfix string is \n");
for(i=0;i<n;i++)
{
printf("%c",op[i]);
}
}
always one of the operators is missing in the answer..also it gives CORE
DUMPED as output sometimes......... and if infix contains '(' ot ')'
.......then it gives output as stack is empty...... Plz help guys... i am
a student...so ther mi8 b mistakes in my program

Thursday, 29 August 2013

WebAPI ODATA without EntityFramework

WebAPI ODATA without EntityFramework

consider the following method in a WebApi controller:
[Queryable(AllowedQueryOptions= AllowedQueryOptions.All)]
public override IQueryable<Mandate> Get()
{
return new List<Mandate>() { new Mandate() {
Id = 1,
PolicyNumber = "350000000",
OpenPositions = new List<OpenPosition>(){
new OpenPosition(){ Id = 1, Amount =2300 },
new OpenPosition(){ Id = 2, Amount =2100 }
}},
new Mandate() {
Id = 2,
PolicyNumber = "240000000" ,
OpenPositions = new List<OpenPosition>(){
new OpenPosition(){ Id = 3, Amount =2500 },
new OpenPosition(){ Id = 2, Amount =2100 }
}
} }.AsQueryable<Mandate>();
}
Here the list is built manually and if I browse to the following url:
http://localhost:52446/odata/Mandates?$filter=Id eq 1 it returns the
correct item from the list.
Now obviously the list is more likely to be a database structure. Data
would be retrieved using some ORM and returned to the Web API service.
I don't use EntityFramework (and I can't because of legacy systems).
How would I use WebApi in this case ? How would I translate the url
parameters so that the filters are applied by the layer responsible of the
data access ?

Wednesday, 28 August 2013

ANTLR: How the behavior of this grammar which recognizes suffixes of a Java code be explained?

ANTLR: How the behavior of this grammar which recognizes suffixes of a
Java code be explained?

a week ago I started the following project: a grammar which recognizes
suffixes of a Java code. I used the official ANTLR grammar for Java -
Java.g4 as a baseline and started to add some rules. However, those new
rules also introduced left recursion which I also had to deal with. So
after a couple of days of work I got the following code. When I started
testing I noticed something unusual which I still can't explain. When
given the input { } the parser tells me no viable alternative at input
'<EOF>' but when I switch the order of the terminals in the right-handed
side of the rule s2, particularly if we change the right-handed side from
v2_1 | v2_2 | v2_3 ... to v2_36 | v2_1 | v2_2 ... (the terminal v2_36 is
moved to the first position), the sequence { } gets accepted. My first
thoughts were that Antlr does not backtrack because I noticed that with
the input { } the first version of the parser starts to follow the rule
v2_3 and just reports that nothing is found and does not try to consider
other options (that's what I think but maybe it's not true) like v2_36
which give exactly the positive answer. But after some research I found
out that ANTLR actually does backtrack but only if everything else fails.
At least this is true for v3.3 (read it in official ANTLR paper) but I
guess it's also true for v4. Now I'm a little bit confused. After spending
so many hours on this project I would feel really terrible if I don't make
it work. Can someone gives some kind of tip or something? It would be
greatly appreciated, thanks.

News Reader app works fine on iPhone and iPad simulator, NOT on iPad device

News Reader app works fine on iPhone and iPad simulator, NOT on iPad device

Guys this is a weird one.
The following app works fine on iPhone and iPad simulator (both 5.0 and
6.0), but doesn't work on iPad device.
The app is free and live at:
https://itunes.apple.com/us/app/canalegenoa/id443927444?mt=8
The app does not crash, however it is empty: news are not loaded.
How is that possible that everything is corretly loaded and showed on the
simulator and then doesn't work on the real device? I don't even know
where to start from since everything looks fine on the simulator.
Find below a screen of the app from the simulator
Hope someone else had a similar issue and can help me to figure out where
the problem is.

Joining two dictionaries

Joining two dictionaries

Hi I have two Dictionaries and I need to find a way to join them
together.Here are the two dictionary types.
IDictionary<string, byte[]> dictionary1
IDictionary<IFileShareDocument, string> dictionary2
Out of this two dictionaries I have to create a third dictionary that will
look like this
IDictionary<IFileShareDocument, byte[]> dictionary3
Both dictionaries have the exact same number of items and the string
property of both them is the linking point.
What I would like is to be able to write something that would do somethign
like this:
dictionary1.value join with dictionary2.key
where dictionary1.key == dictionary2.value
This statement should result in dictionary3.
Is there any way I can achieve this I can not seem to find a way to do this?

ClearInterval undefined when button clicked

ClearInterval undefined when button clicked

Suppose I have a few buttons and when they are clicked they trigger
certain setInterval, but when I clicked on different button the previous
setInterval doesn't clear or it say it is undefined.
example:
$("#button1").click(function () {
var url = "xxx";
var min = "yyy";
getGraphCredentials3(min,url);
var onehour = setInterval(function () {
getGraphCredentials3(min,url);
}, 5000);
clearInterval(twohour);
});
$("#button2").click(function () {
var url = "zzz";
var min = "uuu";
getGraphCredentials3(min,url);
var twohour = setInterval(function () {
getGraphCredentials3(min,url);
}, 5000);
clearInterval(onehour);
});
can anyone help please?
much appreciated

Different user.config file when applikation is running as scheduled task

Different user.config file when applikation is running as scheduled task

I have a applikation that is using a settings file, and when it is running
as ascheduled task, it uses another user.setting file than when im
debugging the applikation through Visual Studio. Is this normal behaviour?
user.config from VS debugging
appname.vshos_StrongName_ldr4uvycmc51wccs12nto50cvy3vujt3
user.config from Scheduled task
appname.exe_Url_5fnquv0g1secc1miglozdookwwdastgw
I want the same user.config in both cases! Do I need to make a custom
settings file (simple textfile) and read and write to that, or how do I
solve this?

Tuesday, 27 August 2013

"2013-01-10" To Tue Jan 01 00:08:00 IST 2013 conversion in scala

"2013-01-10" To Tue Jan 01 00:08:00 IST 2013 conversion in scala

hi i want to convert "2013-01-10" To Tue Jan 01 00:08:00 IST 2013 format
in scala my source date is in string format searchDate1="2013-01-10" val
format = new java.text.SimpleDateFormat("yyyy-mm-dd") var
x=format.parse(searchDate1)
i tried to format using format.parse but it does not give me the required
format.!

Javascript For Loop HTML syntax with JSON

Javascript For Loop HTML syntax with JSON

I'm pretty new to Javascript so I'm not sure if I'm doing this right.
First off I'm using JSON to create an array object 'providerlisting'. Next
I am creating a for loop and it should loop through the html until there
are no more listings in the JSON array. I'm not sure that I did the syntax
correctly. I'm also kind of new to asking these questions so I'm sorry in
advance if I'm doing this incorrectly.
for (var i=0;i<providerlisting.length;i++)
{ document.write('<div class="entry panel row">
<div class="large-4 columns first">
<div
class="name">'providerlisting.nametitle[i]'</div>
<div
class="specialty">'providerlisting.caretype[i]'</div>
<div
class="peferred">'providerlisting.preferredprovider[i]'</div>
</div>
<div class="large-3 columns second">
<div
class="address">'providerlisting.address1[i]'<br
/>
'providerlisting.address2[i]'<br />
'providerlisting.citystatezip[i]'
</div>
</div>
<div class="large-3 columns third">
<img src="'providerlisting.coverage[i]'"
alt="example">
</div>
<div class="large-2 columns fourth">
<div class="status">'providerlisting.status[i]'</div>
<a data-dropdown="actionsMenu2" class="actions
button small secondary round dropdown"
href="#">Actions</a><br>
<ul id="actionsMenu2" data-dropdown-content=""
class="f-dropdown">
<li><a
href="'providerlisting.psn[i]'">Generate
PSN</a></li>
<li><a
href="'providerlisting.dcontact[i]'">Download
Contact</a></li>
<li><a href="'providerlisting.save[i]'">Save
to Provider List</a></li>
<li><a href="'providerlisting.rating[i]'">View
Healthgrades Rating</a></li>
</ul>
</div>
</div>
');

Update Statements in Stored Procedure Suquentially?

Update Statements in Stored Procedure Suquentially?

Below UPDATE A iam updating facot Sqares table
UPDATE A
SET
A.Factor=B.Candy/B.Randy,A.Candy=B.Candy,A.LastModified=sysDatetime(),A.LastModifiedBy=suser_name()
FROM Squares A
INNER JOIN Rects B
on A.YEAR=B.YEAR
AND A.Month=B.month
--iam using updatd factor from the sqare table to calulate final value in
Parameter
UPDATE C
SET C.FinalValue=(C.Cost*A.Factor)
from Parameter C
INNER JOIN Squares A
ON C.YEAR=A.YEAR
AND C.Month=A.Month
So my problem is execution was soing sucesfullu but final value is not
updating in parameter table.

A mandatory label user control in C#

A mandatory label user control in C#

Ok - I just need some ideas here. The scenario is - There are a lot of
fields in my windows form which are mandatory to be entered by the user.
One of them might be "Name". So for this, I have a label lblName with text
Name, another label lblMandatory with text * colored in red which
signifies it is mandatory. So that means I have two labels for a field
Name, and similarly I have more than 20 fields in my form. I was just
thinking of creating a custom label - something called
MandatoryLabelControl which will have a * by default after it's text. This
would help me in decreasing the number of labels in my form. The custom
label is actually a combination of two things - First a text for the
label, secondly the * in red color. I searched for this a lot, but can't
find anything to start with. Please help with some suggestions.

structure variable doesnot get initialized in c

structure variable doesnot get initialized in c

i am trying to run a programme implementing a function with structures in
c... which is:
#include<stdio.h>
#include<conio.h>
struct store
{
char name[20];
float price;
int quantity;
};
struct store update (struct store product, float p, int q);
float mul(struct store stock_value);
main()
{
int inc_q;
float inc_p,value;
struct store item = {"xyz", 10.895 ,10}; //## this is where the
problem lies ##
printf("name = %s\n price = %d\n quantity =
%d\n\n",item.name,item.price,item.quantity);
printf("enter increment in price(1st) and quantity(2nd) : ");
scanf("%f %d",&inc_p,&inc_q);
item = update(item,inc_p,inc_q);
printf("updated values are\n\n");
printf(" name = %d\n price = %d\n quantity =
%d",item.name,item.price,item.quantity);
value = mul(item);
printf("\n\n value = %d",value);
}
struct store update(struct store product, float p, int q)
{
product.price+=p;
product.quantity+=q;
return(product);
}
float mul(struct store stock_value)
{
return(stock_value.price*stock_value.quantity);
}
When i am initializing that struct store item = {"xyz",10.895,10} ; the
values are not being stored by the members i.e. ater this (struct store
item) line the members:
item.name should be "xyz",
item.price should be 10.895,
item.quantity should be 10;
but except the item.name=xyz other members take a garbage value of their
own.. i am not able to understand about this behaviour... i am using
devc++ (version 5.4.2 with mingw)...
am i getting the problem because i am using char name[20] as a member of
struct store???
some one please help to remove the error in my code.. reply soon

MVC4: nested partial-view loses model data

MVC4: nested partial-view loses model data

In an MVC4 project im using a partial View thats using a ViewModel and has
a GET Form on it. In the Controller action i expect the ViewModel object
with some data. When this partial is placed on a normal (.cshtml) View, i
recieve the data via the expected ViewModel object in the Controller
action. But, When this partial is placed on another partial view, for some
reason the ViewModel object in the controller action is empty. When i step
through the creation of the HttpGet-form, the passed-in model is not
empty, but when the GET controller action is called, the model is.
Anyone know the reason for this? Is this some MVC behavior i don't know
about maybe? Thanks!

Monday, 26 August 2013

Problen to make raintpl read array that contain values inside ' '

Problen to make raintpl read array that contain values inside ' '

Im trying to use template engine raintpl, but having problen when the
array use this syntax:
'loginCss' => '<link href="css/login.css" rel="stylesheet">',
i dont know if raintpl just reconize arrays that use "" instead of ''.
but if i chage to:
"loginCss" => "<link href="css/login.css" rel="stylesheet">",
the php dont work because of "" inside the "", if i change put \ before
the ", eg:
"loginCss" => "<link href=\"css/login.css\" rel=\"stylesheet\">",
dont work too... :(
Someone who had this experience could help me please?

Is it possible to insert sounds into a phone conversation?

Is it possible to insert sounds into a phone conversation?

I want the user at the other end of the line to believe I'm actually at a
baseball game by injecting baseball bat sounds and crowd cheers.
How would I play sounds that all parties in a phone conversation can hear?

Find strings after search in txt file

Find strings after search in txt file

I wondering if sombody could help me withth e following resolve the
following code:
I have a text-file called report.txt with following content (everything is
the same line):
Printed: 2013-07-12 05:09 PM QC Product: PROT2 CON Level: Level 3
Priority: QC Method RF Result 174 IU/mL Lot Number: 3BQH01 Sample ID:
3BQH01 Instrument ID: DV330681 QC Range 158.0 - 236.0 Comment Completed:
2013-07-12 17:09:14 Comment: Trigger: Manual Trigger Operator C160487AUR
Time of Run 2013-07-12 17:09:14 Reagent 13049MA
Now need to retrieve following information ( only the values after the : )
QC Product: PROT2 CON
Level: Level 3
Sample ID: 3BQH01
I was trying the following code:
with open ('report.txt', 'r') as inF:
for line in inF:
if 'Sample ID:' in line:
SID = line.split(':')[1].strip()
if 'Level:' in line:
LEV = line.split(':')[1].strip()
if 'QC Product:' in line:
QCP = line.split(':')[1].strip()
does anybody has an idea or an other solution?
Thanks a lot for all your efforts and help,
Kindly regards Koen

TinyMCE submenu icon (Wordpress)

TinyMCE submenu icon (Wordpress)

I´m create a menu with TinyMCE on Wordpress post page (create a css class
that puts a backgorund-image in that menu). This same menu contains a
submenu, that contains the same class applied for icon, but the does not
appear.
Anyone can help, please...
below the code that I have
var sub = m.addMenu({
title: 'Icons',
icon: 'tablet'
});
sub.add({
title : 'Tablet',
icon: 'tablet',
onclick : function() {
tinyMCE.activeEditor.selection.setContent('[icon img="tablet"]');
}
});
sub.addSeparator();

OpenCV static initialization fails after removing armeabi-v7a folder from libs

OpenCV static initialization fails after removing armeabi-v7a folder from
libs

when I have both libs/armeabi folder and libs/armeabi-v7a folder in my
project, everything works and I'm able to perform static initialization of
OpenCV by calling OpenCVLoader.initDebug()
However, since my primary goal is to support all the older devices that
aren't using ARM v7 CPU's, I heard that armeabi-v7a has some optimization
code while using just armeabi should be working for all devices so I
wanted to remove it to reduce APK size. However after doing that it failed
to initialize on my Samsung Galaxy S3.
Did I do something wrong? How to force it to initialize using libs/armeabi?
Thanks in advance!

MultiAutoCompleteText contacts

MultiAutoCompleteText contacts

I want to do a MultiAutoCompleteTextView like this:

I can retrieve contacts numbers in an array and names in an array. How can
I do this MultiAutoCompleteTextView? For example, in the picture if you
enter ca there is a suggestion and if you enter 22, there is same
suggestion, and they are under the other. I have two arrays numbers[] and
names[], a MultiAutoCompleteTextView.
Here is my code:
Cursor phones =
getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,null,null, null);
ArrayList<String> numbers = new ArrayList<String>();
ArrayList<String> names = new ArrayList<String>();
while (phones.moveToNext())
{
names.add(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)));
numbers.add(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
}
phones.close();
String[] numbersArray = new String[numbers.size()];
String[] namesArray = new String[names.size()];
numbers.toArray(numbersArray);
names.toArray(namesArray);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, namesArray);
MultiAutoCompleteTextView textView =
(MultiAutoCompleteTextView)findViewById(R.id.edt_numara);
textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
textView.setAdapter(adapter);
But it works only for names and numbers isn't showing.

Setting/Establishing the Parent and child relationship using the Codebehind values and Drawing the Chart

Setting/Establishing the Parent and child relationship using the
Codebehind values and Drawing the Chart

Hi,
I am creating the Organization Chart using JQuery dll and C# dll's for
that i am passing the the Code in aspx.cs file using the following code
like
BasicPrimitives.OrgDiagram.Item ParentObj= new
Item(itemName,CurrentId,ParentId,GroupId);
this.OrgDiagram.Items.Add(ParentObj);
BasicPrimitives.OrgDiagram.Item ChildObjOne= new
Item(itemName,CurrentId,ParentId,GroupId);
this.ParentObj.items.Add(ChildObjOne); // Here by adding like this we
are specifying that this parent Object for this item is "ParentObj"
Butting adding the items using the code behind ,is not a good idea . I am
loading the Data form database dynamically. so based on "CurrentId" and
"ParentId" values i need to set the relation.
Please suggest me the code to how to write it to establish the parent
child relation ship based on Datatable values without creating the code
like above in codebehind... ( here i need to avoid
this.ParentObj.items.Add(ChildObjOne); hard coding.)
Thank you.

Sunday, 25 August 2013

Passing value and iterating an arraylist in javascript

Passing value and iterating an arraylist in javascript

i need to pass an arraylist to javascript from jsp and then iterate
through the list in javascript. Can someone help me with the jsp synatax
as well as javascript iteration code?
TIA

Should there be one or multiple XXXRepository instances in my system, with DDD?

Should there be one or multiple XXXRepository instances in my system, with
DDD?

There's something that has been bothering from my DDD readings. From what
I've seen, it seems as if there is only repository instance for each given
aggregate root type in my system.
Consider, for instance, the following imaginary situation as an
abstraction of a deeper domain model:

When coding in a "standard-style" I'd consider that each Owner in my
system would have its own collection of cars, so there would be an equal
number of Car collections (should I call it Repositories?) as there are
Owners. But, as stated previously, it seems as if in DDD I should only
have one CarRepository in the whole system (I've seen examples in which
they are accessed as static classes), and to do simple operations such as
adding cars to the Owner, I should make use of a domain-service, which
seems to be, for the simple case, not very API friendly.
Am I right about only having one CarRepository instantiated in my system,
or am I missing something? I'd like to strive for something like
public void an_owner_has_cars() throws Exception {
Owner owner = new Owner(new OwnerId(1));
CarId carId = new CarId(1);
Car car = new Car(carId);
owner.addCar(car);
Assert.assertEquals(car, owner.getCarOf(carId));
}
but that doesn't seem to be possible without injecting a repository into
Owner, something that seems to be kind of forbidden.

No boot sector found

No boot sector found

Hi i created a bootable pendrive to install mac os snow leopard using
poweriso software. But when i try to set the default boot option to a usb
drive and try to install the mac os it gives me the error that no boot
sector is found error.

Saturday, 24 August 2013

How to become a healthy person from a thin,skinny person?

How to become a healthy person from a thin,skinny person?

I am 22 yr old student having height 6"2'and weight 53 kg.what are the
tips,diet,exercise which help me to change my thin body into healthy.Is
nightfall,tension affect body growth.

Why Android Studio delete all the files on git commit?

Why Android Studio delete all the files on git commit?

I recently migrated from Eclipse to Android Studio. Now I have all my
project working but directory structure has changed in Android Studio so I
have to commit this changes to my GitHub repository so I did:
Copied .git folder from Eclipse Project to Android Studio Project
VCS -> Git -> Add to VCS
So now I have a my Git repository and I can see all the changes I did in
Eclipse in Changes View. Now to commit the new project structure:
VCS -> Commit Changes
A new windows is opened with the changes and I see Android Studio want to
delete ALL my files except 2, one I modified on Android Studio and the
other a .iml file.

So when I commit all the files of my project are deleted from my git
repository instead of committing almost everything and delete some folders
due to directory structure change . Why this happens? Is it a bug? Is
there any workaround?

Dual Booting Problem with Windows 8 and Ubutnu 12.10

Dual Booting Problem with Windows 8 and Ubutnu 12.10

Am beignner to Linux world. Tried to dual boot ubuntu along side
preinstalled windows 8 in my samsung series 5 np550pc s03in Laptop.
I have followed this guide -
http://askubuntu.com/questions/22183...uefi-supported and based on the
video, i have created a swap space and Ubuntu OS Space.
I have disabled Secure Bootloader and Booted in CSM. Everything went fine,
ubuntu 12.10 installed fine and after restart, it doesnt booted up the
ubuntu as well as Windows. Just a blank screen displays.
After restarting Ubuntu via LiveCD, I selected Try Ubuntu and installed
Boot-repair. But still have booting problem.
Here is the pastebin link from boot loader -
http://paste.ubuntu.com/6022524
Also, Please advice how much space should i allocate for Swap? I am going
to allocate 200GB for Ubuntu and Hence advice the corresponding SWAP Size.
Please help me out. This booting problems cause me sick!
Thanks, Cyborgz

Linux Mint 13 connected to lan but not to internet

Linux Mint 13 connected to lan but not to internet

I've had a computer running linux mint 13 for about 6 months now without
any problems. Every time that I tried to connect to the internet I just
used a standard ethernet port and had no problems connecting to the
internet. Now this week when I moved back into my college apartment the
computer suddenly will no longer connect to the internet. The computer
connects to the lan no problem and I can access it my computer.
The computer is connected to the internet by a switch to a router to the
modem. I know that the switch and router and modem works because every
single other device (something like 12-14 devices between wifi and wired)
all can get to the internet and talk to each other on the lan no problem
simultaneously. There are two other computers on the switch which both
have internet access.
So my question is, does anyone know what might be causing this?

Resize evenly when resizing form

Resize evenly when resizing form

I have a form (600x500 px). In this form there are 2 groupboxes. The first
one being 260 px and the second one 330 px. What I would like is that when
I resize the form, those two boxes resize with it, but by keeping the
proportions. (the second one bigger then the first). No matter how I set
the Anchor points, I dont seem to be able to do this.

Wicket retrieve javascript variable to use in java

Wicket retrieve javascript variable to use in java

I am trying to retrieve a javascript variable using Java. I think that I
am close to the solution.
I want to retrieve the width of an element on my panel. To achieve this, I
added a behavior to my panel that adds the callback and retrieves the
parameters (width and height).
private class ImageBehavior extends AbstractDefaultAjaxBehavior {
@Override
protected void respond(AjaxRequestTarget target) {
//I receive a JavaScript call :)
StringValue width =
getRequest().getRequestParameters().getParameterValue("width");
StringValue height =
getRequest().getRequestParameters().getParameterValue("height");
}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.getExtraParameters().put("width", "undef");
attributes.getExtraParameters().put("height", "undef");
}
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
response.render(OnDomReadyHeaderItem.forScript(getCallbackScript().toString()));
}
}
In javascript, the following code gets called:
function callbackWicketNewImage(element) {
var wcall = Wicket.Ajax.get({ 'u': 'callbackUrl', 'ep' : {'width':
element.width(), 'height': element.height()}});
}
When the js-code is called, the 'respond' method gets called but the
values of the width and height parameter did not change. They remained
'undef'.

Can you build phonegap project without using build.phonegap.com

Can you build phonegap project without using build.phonegap.com

I'm new to phonegap and it's not clear to me whether you are able to build
phonegap project on multiple platforms without using their
build.phonegap.com site that is limited on number of private apps.
I want to target my apps to Android and iOS, they should be both, free and
commercial, but I dont want to be forced to publish them as opensource on
github as you can have only 1 private app on free plan and other apps has
to be opensource.

Massive ERP system using Scala language

Massive ERP system using Scala language

After reading slow compiler and Martin Odersky's response, We are so
worried to kick start massive ERP product (which is heavily funded that
targets a specific Industry) using Scala language.
Are there any workarounds/strategies to improve compile time of building
such massive system with N number of modules?
Are there any ERP type of products built using Scala?
Some guidance is really appreciated.
Thanks
Mk

Friday, 23 August 2013

Archimedean property application

Archimedean property application

The Archimedean property states that
for all $a \in \Bbb R$ and for some $n \in \Bbb N: a < n$.
Similarly,
for all $n \in \Bbb N | b \in \Bbb R | 0 < {1 \over n} < b$.
Thus, there can be found a rational number such that it is the boundary
point of some open set.
In other words, there can be made Dedekind cuts $(A, B)$.
Is it true we can make infinitely many open sets - that is, does this
imply that there can be infinitely many disjoint open sets $A, B$ - all
bounded by some Dedekind cut?

How to Enable scroll for specific div and disable scroll for page

How to Enable scroll for specific div and disable scroll for page

Goodevening,
Is it possible to disable scroll for the page, and only enable for a
specific div element inside the page?
Thank you. Casper

Ubuntu boots to black screen after messing with Nvidia

Ubuntu boots to black screen after messing with Nvidia

So... I screwed up. I was trying to get a second monitor to work on ubuntu
but it wasn't auto detecting it. So I went online and found out that it
could be a video drive issue. So I went to drivers and selected one of the
Nvidia drivers that ubuntu suggested. At this point, I restarted the
computer. When it booted, I was stuck in 480x640. I googled this issue and
found that someone suggested I use some kind of command (something "purge"
something "Nvidia" sorry I don't remember the actual command). After doing
that, I rebooted and now Ubuntu boots to a black screen with no cursor, or
anything. When I hold down my power button to shutdown, the ubuntu logo
shows up with the four loading dots underneath but it shutsdown before it
goes further.
If I had to guess, i would guess I don't have a video driver assigned
anymore, or the one I'm using is screwed up, but I haven't used Ubuntu
long, so I'm not an expert.
If someone could help, I would really really appreciate it.

Setting base class object to derived class object

Setting base class object to derived class object

I have four classes. Person, NaturalPerson (Inherits from Person),
GroupFamilyMember(Inherits from NaturalPerson), QuotationHolder(Inherits
from GroupFamilyMember).
They all share the same ID.
My problem is the following one:
There is a method that returns an existing NaturalPerson(stored in DB)
object based on a document number. Then, I have to create a
QuotationHolder, and I want that QuotationHolder object to contain the
retrieved NaturalPerson object.
The issue, is that I can´t cast the object like this (I know the reason):
QuotationHolder quotationHolder = (QuotationHolder) naturalPerson;
I tried creating a new QuotationHolder object and setting its values with
the naturalPerson´s object values using reflection.
But as I lose the reference to the retrieved object, when I want to save
in cascade, NHibernate gives me the following exception:
a different object with the same identifier value was already associated
with the session
I guess that its trying to save the object as a new one.
Just to consider:
The IDs are set using the HILO Algorithm. The mappings cannot be changed,
neither the classes.

How Recreate FileUploads Created on Client

How Recreate FileUploads Created on Client

I have a multiple upload component which has a problem with postback. I
know what the reason is but I would like to know what would be the best
solution.
Every time when a user attach a document component hides current input and
creates a new one with javascript. The problem is that server side does
not anything about those inputs created in javascript. I know that I have
to recreate them on server side but I don't know what should be the best
way to recreate them on server side.

Thursday, 22 August 2013

Convert C char to UTF-16 for transmission over network

Convert C char to UTF-16 for transmission over network

I'm writing a program that will interface with another machine running
Java, and I need to send character arrays over the network. On the
receiving end, the Java program uses DataInputStream's readChar() function
and expects characters. However, since characters are stored as 1 byte in
C, I'm having some trouble writing to the network.
How would I go about converting this?
The actual protocol specification is like so:
short: Contains length of char array
char 1, 2, 3...: The characters in the array
For background information, my short conversion is like so:
char *GetBytesShort(short data)
{
short net_data = NET_htons(data);
char *ptr = (char *) malloc(sizeof(short));
memcpy(ptr, &net_data, sizeof(short));
return ptr;
}
I've tested it on the receiving end in Java, and the short does get sent
over correctly with the correct length, but the character array does not.
Thanks in advance!

Can a class with getters separate from input processing methods be considered "thread-safe"?

Can a class with getters separate from input processing methods be
considered "thread-safe"?

I was reading though a book on Java and there was this exercise question
where they declared a class with one private variable, one public void
method that did some expensive operation to calculate and then set the
private variable, and a second public method to return the private
variable. The question was "how can you make this thread-safe" and one
possible answer was "synchronize each of the two methods" and one other
possible answer was "this class can not be made thread-safe".
I figured the class could not be made thread-safe since even if you
synchronize both methods, you could have a situation that Thread1 would
invoke the setter and before Thread1 could invoke the getter, Thread2
might execute and invoke the setter, so that when Thread1 went and
retrieved the result it would get the wrong info. Is this the right way to
look at things? The book suggested the correct answer was that the class
could be made thread safe by synchronizing the two methods and now I'm
confused...

Worth Styling Zoomed Out?

Worth Styling Zoomed Out?

This might be a poor question for this exchange but is it worth styling
for zoomed out browsers? For instance, I can zoom chrome out to 25% and my
navigation breaks, should I accommodate for this or will 99% of cases be
fine without the extra effort in styling? What case would I run into
problems like that?

multiple intent in broadcast receiver

multiple intent in broadcast receiver

So I am making an app that listens for Screen On activity in android. I
have a broadcast receiver that receives Intent.ACTION_SCREEN_ON. This
receiver then starts an activity.
Everything works fine but it starts the activity even when the screen was
on because of an incoming call.
This is my code.
if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)){
Intent i = new Intent(context, MainScreenActivity.class);
i.putExtras(intent);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
Log.e("receiver", "throwing in the lock screen");
}
I am not quite sure how to I check the current state of the phone. I have
the permission to read PHONE_STATE but how do I find out if the sceen on
action was fired because of the call?
Also there is a delay when the screen is actually turned on and the
activity is displayed. The default lock screen is visible for a short time
and then the custom one appears. Is there anything that can be done to
avoid this delay?

Front facing Camera Recorded video not proper

Front facing Camera Recorded video not proper

I want to record Video using front facing camera. Using the example from
here as reference. I changed the getCamerainstance method to
getFrontFacingCamera. I am able to see the preview while recording. But
when i close the recording and play the video, it is always some
horizontal flickering lines. Seems like some encoding issue. I tried-
changing the media recorder profile to QUALITY_LOW/ QUALITY_HIGH, -
Setting the frame rate to 15. the same app works perfectly when i use rear
camera.
P.S: I have set the preview's(surface view's) size to 208×208. (Should
this affect? , It's working fine with rear camera).
Thanks

Omit Curve for null values then continue plot it for real values with Libchart

Omit Curve for null values then continue plot it for real values with
Libchart

I use Libchart to draw curve for data in my database. My problem is:
Libchart plots (zero value) for my null data (Y axis values). I need
Libchart draw (X axis value) but not draw curve for (Y axis value) when Y
is null. In another words I need the curve to be omitted for null values,
and then continue plotting for real values. Below code which I used to
draw the curve:
<?php
$x1="Value 1";
$x2="Value 2";
$x3="Value 3";
$x4="Value 4";
$x5="Value 5";
$x6="Value 6";
$x7="Value 7";
$x8="Value 8";
$x9="Value 9";
$x10="Value 10";
$x11="Value 11";
$x12="Value 12";
$y1=45;
$y2=06;
$y3=82;
$y4=15;
$y5=45;
$y6=null;
$y7=null;
$y8=null;
$y9=null;
$y10=75;
$y11=16;
$y12=34;
include "libchart/classes/libchart.php";
$chart = new LineChart(1000, 400);
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point($x1,$y1));
$dataSet->addPoint(new Point($x2,$y2));
$dataSet->addPoint(new Point($x3,$y3));
$dataSet->addPoint(new Point($x4,$y4));
$dataSet->addPoint(new Point($x5,$y5));
$dataSet->addPoint(new Point($x6,$y6));
$dataSet->addPoint(new Point($x7,$y7));
$dataSet->addPoint(new Point($x8,$y8));
$dataSet->addPoint(new Point($x9,$y9));
$dataSet->addPoint(new Point($x10,$y10));
$dataSet->addPoint(new Point($x11,$y11));
$dataSet->addPoint(new Point($x12,$y12));
$chart->setDataSet($dataSet);
$chart->setTitle("Monthly usage for www.example.com");
$chart->render("generated/demo1.png");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>
<center><img alt="my_curve" src="generated/demo1.png" style="border: 1px
solid gray;"/></center>
</body>
</html>

how to send an arraylist as a request to server to compare the contacts present in server and arraylist?

how to send an arraylist as a request to server to compare the contacts
present in server and arraylist?

I am creating an application in which I have to pass an arraylist to
server as a request. If contacts present in arraylist and the server are
matched then they should be identified.. How can I send arraylist as a
request? Is this possible?

Wednesday, 21 August 2013

how to achieve this in java ? requirement given below

how to achieve this in java ? requirement given below

I want to create a list of list
List<integer> nodes[10]=new ArrayList();
i want this, coz i will be iterating through it and reading data..and it
will be dynamically created in runtime depending upon the size of inputs

How do i enable javascript for windoes phone 8?

How do i enable javascript for windoes phone 8?

I need to enable JavaScript on my windows phone 8. But how? Its not in the
internet settings or advanced internet settings.

proof of convexity 3

proof of convexity 3

i hav a function of 7 variables, suppose i plot the function while varying
any one variable at a time, the function is visually convex, can i
conclude that the function is convex for all possible
x1,x2,x3,x4,x5,x6,x7.. (note i have also plotted the function varying any
two variables, and all (7 choose 2) plots are visually convex (bowl
shaped).. also, can u possibly point me towards some reference text. that
may help me out, thanks alot..

Is there a QR Code api for BlackBerry OS 4.6?

Is there a QR Code api for BlackBerry OS 4.6?

Please someone have an idea if there is some API out there to read QRCodes
using BlackBerry devices running OS 4.6 ?

Eclipse - Hover not showing variables in abstract Java class

Eclipse - Hover not showing variables in abstract Java class

I'm currently using Spring Tool Suite 2.9.2 (based off of Eclipse 3.x).
In every class that I debug through, it has no issue with on-hover
displaying the values of my variables. But, when I am in an abstract
class, on-hover just displays the variable type and name.
This is super frustrating to me, because the values get displayed in the
Variables window. I usually go "Oh, I'm in an abstract class..." and I
have to switch my perspective.
Is there anyway that I can display values on-hover in an abstract class
with Eclipse?
I've tried resetting hover options to default and checking the combined
hover button to no avail.

Mocha in the browser: How to get a report using chai.assert

Mocha in the browser: How to get a report using chai.assert

I can't get Mocha to produce output when using chai.assert.
http://jsfiddle.net/web5me/244PT/6/
var assert = chai.assert();
mocha.setup('bdd');
describe('Kata', function() {
it('should return...', function() {
assert.equal(true, true, 'Truthy values should be treated equal.');
});
});
mocha.run();
It works perfectly with chai.should and chai.expect.
http://jsfiddle.net/web5me/244PT/#base

How to do Web Method for List in C#?

How to do Web Method for List in C#?

I have the Web Method.
[WebMethod]
public List<string[]> getObjective()
{
List<string[]> objectiveStringList = new List<string[]>();
con.dbConnect();
objectiveStringList = con.getObjective();
con.dbClose();
return objectiveStringList;
}
And also, the query.
public List<string[]> getObjective()
{
string strCMD = "SELECT objective FROM CorrespondingBall WHERE
objective IS NOT NULL";
SqlCommand cmd = new SqlCommand(strCMD, conn);
SqlDataReader dr = cmd.ExecuteReader();
List<string[]> objectiveStringList = new List<string[]>();
while (dr.Read())
{
objectiveStringList.Add((string[])dr["objective"]);
}
return objectiveStringList;
}
However, error "HTTP 500 Internal Server Error" message was shown. I have
tried it with List Byte Array and there was no error. Does anyone know how
can I solved it?
FYI: I am doing an application for Windows Phone 7.

Tuesday, 20 August 2013

Return elements of the array that form a sum

Return elements of the array that form a sum

I wrote the below code to see if an array has 2 numbers that account to a
sum. I don't know how to capture the elements that contribute to that sum.
Any thoughts
public static boolean isSum(int[] a,int val,int count,int index){
if(count == 0 && val ==0){
return true;
}
if(index>=a.length)
return false;
else{
return
isSum(a,val-a[index],count-1,index+1)||isSum(a,val,count,index+1);
}
}

Is there a way to parse a string in javascript into a number with respect to the locale

Is there a way to parse a string in javascript into a number with respect
to the locale

I'm editing a web based program at the moment. It is used all over the
globe. I'm adding a number based field. I want to be able to allow the end
user to enter in the number the way they want in their local locale. I see
that there is a function called Number.toLocaleString() that will give me
what I need. However, I can't seem to find an inverse function.
Take the string "1,000" for example. If my user's locale is US-en, I want
it to be interpreted as 1000. If my user's locale is DE-de then it should
be interpreted as 1. What is the standard way of doing this in JavaScript?

float compression, give output that i can't understand output confuse me

float compression, give output that i can't understand output confuse me

statements are
float a=3.2,b=4.5,c=4.9,d=4.5;
if(a == 1.1+2.1)
printf("A");
if(b == 3.2+1.3)
printf("B");
if(c == 5.7-0.8)
printf("C");
if(d == 5.5-1.0)
printf("D");
output is
BD
why not print AC.

Rails 4: internal messaging system

Rails 4: internal messaging system

I'm trying to write a simple messaging system for signed up users. I
realize there are gems for this but I'm trying to roll my own simpler one.
I've set up my models as follows:
class Conversation < ActiveRecord::Base
has_many :messages, dependent: :destroy
has_many :users
end
class Message < ActiveRecord::Base
belongs_to :conversation
end
class User < ActiveRecord::Base
has_many :conversations
end
I've set my routes and controller up so that I can make new conversations,
and add messages to those conversations. However, I'm trying to figure out
how I can make it so that only a logged in user can start a conversation
with ONE other user. No other users should be able to access that
conversation.
Is this a permissions (cancan) thing or should this be defined by some
controller logic?
Thanks!

ASP: Disable/remove script reference programmatically

ASP: Disable/remove script reference programmatically

General idea
My general idea is to have mobile and desktop version of my site. Users
can switch versions with buttons on the bottom of the page. I'm using ASP
themes, so that I can easily switch themes depending on the required
version of the site.
The problem
Switching themes is great, but since I've got JavaScript files already
included in my project in the following ScriptManager in my master page:
<asp:ScriptManager runat="server" ID="sm">
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-2.0.2.min.js" />
<asp:ScriptReference Path="~/Scripts/jQueryMobileBehaviour.js" />
<asp:ScriptReference Path="~/Scripts/Master.js" />
<asp:ScriptReference
Path="~/Scripts/jquery.mobile-1.3.1.min.js" />
</Scripts>
</asp:ScriptManager>
When the user switch to desktop version there are problems caused by
jquery.mobile-1.3.1.min.js and jQueryMobileBehaviour.js. Is there a way to
use two ScriptManagers (some sort of themes but for js files)?
What I've tried without success
My first approach was to remove the mobile JavaScript files from the
ScriptManager and then include them manually in the click event of the
button that switches to mobile version like that sm.Scripts.Add.
The second approach was to remove programmatically the mobile JavaScript
files like that sm.Scripts.Remove.
protected void CommandBtn_Click(Object sender, CommandEventArgs e)
{
switch (e.CommandName)
{
case "Desktop":
HttpContext.Current.Response.Cookies["theme"].Value =
"Desktop";
//sm.Scripts.Remove(new
ScriptReference("~/Scripts/jquery.mobile-1.3.1.min.js"));
break;
case "Mobile":
HttpContext.Current.Response.Cookies["theme"].Value =
"Mobile";
//sm.Scripts.Add(new
ScriptReference("~/Scripts/jquery-2.0.2.min.js"));
//Response.Redirect(Request.RawUrl);
break;
default:
break;
}
Page.Response.Redirect(Page.Request.Url.ToString(), true);
}
Both approaches didn't work.
To sum up the questions
Is there something wrong in my code - assuming that the paths should be
alright? Is there a better approach, which will allow me to switch
JavaScript files, like is done with the themes?

Add buttons to my form, captions are stored in Databse

Add buttons to my form, captions are stored in Databse

the captions, which infact are item names are stored in my database, now I
want to add these items/captions dynamically at runtime in buttons to my
form.
Like if I have Pepsi Dew Coca Cola
saved in my database, I want them to appear as buttons in runtime on a
specific grid.. any idea please? thanks.

Monday, 19 August 2013

Two pointers will meet at k nodes from start of the cycle in a linked list?

Two pointers will meet at k nodes from start of the cycle in a linked list?

Two pointers, one that moves at normal speed, n, and one that moves at 2n,
will meet at a point k nodes from the start of the cycle in the linked
list, where k = length of cycle - number of nodes before the beginning of
the cycle.
Can someone please explain how you can reach this conclusion?

Taking a screenshot with C# WebBrowser doesn't work properly on windows server 2012

Taking a screenshot with C# WebBrowser doesn't work properly on windows
server 2012

I've written a function that uses WebBrowser to get a screenshot of a web
page in my C# MVC application(this is the reference of the code that I
used
http://www.codeproject.com/Articles/95439/Get-ASP-NET-C-2-0-Website-Thumbnail-Screenshot).
In more details, on the web page that I'm going to capture there is a
youtube iframe and I need the preview of that video is captured on my
screenshot.
When I run the function on my computer(OS Windows 8) it works properly,
but when I run the function on the published project(on Windows Server
2012) the iframe on the screenshot is not captured(is blank).
I think that probabily the issue is related to something in IE10 on
Windows Server, since I use WebBrowser.
I tried to set the configuration of IE on the Server as they are in my
computer, and I tried also to install flash player on the server but it
doesn't work.
Does anyone have some suggestions? Thanks.

Android: Filter gallery results (date range)

Android: Filter gallery results (date range)

I would like to let the user select some images from the phone's gallery
and then load them into the application. That seems to be a
straightforward task with Intent.ACTION_PICK and
startActivityForResult(intent, SELECT_PHOTO).
However, I am required to filter the results in the gallery by date range.
I need to set an initial date and an end date and only photos taken
between these two dates should be shown (or be selectable). Does anybody
know how to achieve this? I cannot seem to filter the gallery results
anyhow.
Thank you!

Ubuntu install problem HP Z800

Ubuntu install problem HP Z800

I try to install Ubuntu Server V12.10 (same with V12.04) on a HP Z800
workstation. - bios: V03.56 - Xeon 2.40Ghz CPUs - 12Gb RAM - NVidia quadro
graphics(tried also with a ATI)
When I select the language "English" and then select "Install UBUNTU
SERVER", I get a direct complete shutdown of the PC. 1 in the more than
100 attemps it continues but then crashes again with direct complete
shutdown during installation
I tried a different HDD, change almost all bios settings,... I find on
internet that the Z800 workstation is supported but I cannot get it
installed.
Can anyone give me instructions how to install? thank you very much.

Sunday, 18 August 2013

How can I simplify this awful code?

How can I simplify this awful code?

I'm a newb to programming and have some problems simplifying my code. I
have no problem with the parts preceding this, just need to know how I can
simplify this code. I'd like the code below to also plot for 12,18,20,27,
and 28, in the place of "11". I'd appreciate any help greatly!
simrecno1inds11 = nonzero(datasim11[:,1]==no1)[0]
simrecno2inds11 = nonzero(datasim11[:,1]==no2)[0]
simrecno3inds11 = nonzero(datasim11[:,1]==no3)[0]
simrecno4inds11 = nonzero(datasim11[:,1]==no4)[0]
simrecno5inds11 = nonzero(datasim11[:,1]==no5)[0]
simrecno7inds11 = nonzero(datasim11[:,1]==no7)[0]
simrecno8inds11 = nonzero(datasim11[:,1]==no8)[0]
simrecno9inds11 = nonzero(datasim11[:,1]==no9)[0]
simrecno10inds11 = nonzero(datasim11[:,1]==no10)[0]
simrecno11inds11 = nonzero(datasim11[:,1]==no11)[0]
simrecno12inds11 = nonzero(datasim11[:,1]==no12)[0]
simrecno13inds11 = nonzero(datasim11[:,1]==no13)[0]
simrecno14inds11 = nonzero(datasim11[:,1]==no14)[0]
simrecno15inds11 = nonzero(datasim11[:,1]==no15)[0]
simrecno16inds11 = nonzero(datasim11[:,1]==no16)[0]
simrecno17inds11 = nonzero(datasim11[:,1]==no17)[0]
simrecno18inds11 = nonzero(datasim11[:,1]==no18)[0]
simrecno19inds11 = nonzero(datasim11[:,1]==no19)[0]
simrecno20inds11 = nonzero(datasim11[:,1]==no20)[0]
simrecno21inds11 = nonzero(datasim11[:,1]==no21)[0]
simrecno22inds11 = nonzero(datasim11[:,1]==no22)[0]
simrecno23inds11 = nonzero(datasim11[:,1]==no23)[0]
simrecno24inds11 = nonzero(datasim11[:,1]==no24)[0]
simrecno25inds11 = nonzero(datasim11[:,1]==no25)[0]
simrecno26inds11 = nonzero(datasim11[:,1]==no26)[0]
simrecno27inds11 = nonzero(datasim11[:,1]==no27)[0]
simrecno28inds11 = nonzero(datasim11[:,1]==no28)[0]
simrecno29inds11 = nonzero(datasim11[:,1]==no29)[0]
simrecno30inds11 = nonzero(datasim11[:,1]==no30)[0]
recno1inds11 = nonzero(data11[:,1]==no1)[0]
recno2inds11 = nonzero(data11[:,1]==no2)[0]
recno3inds11 = nonzero(data11[:,1]==no3)[0]
recno4inds11 = nonzero(data11[:,1]==no4)[0]
recno5inds11 = nonzero(data11[:,1]==no5)[0]
recno7inds11 = nonzero(data11[:,1]==no7)[0]
recno8inds11 = nonzero(data11[:,1]==no8)[0]
recno9inds11 = nonzero(data11[:,1]==no9)[0]
recno10inds11 = nonzero(data11[:,1]==no10)[0]
recno11inds11 = nonzero(data11[:,1]==no11)[0]
recno12inds11 = nonzero(data11[:,1]==no12)[0]
recno13inds11 = nonzero(data11[:,1]==no13)[0]
recno14inds11 = nonzero(data11[:,1]==no14)[0]
recno15inds11 = nonzero(data11[:,1]==no15)[0]
recno16inds11 = nonzero(data11[:,1]==no16)[0]
recno17inds11 = nonzero(data11[:,1]==no17)[0]
recno18inds11 = nonzero(data11[:,1]==no18)[0]
recno19inds11 = nonzero(data11[:,1]==no19)[0]
recno20inds11 = nonzero(data11[:,1]==no20)[0]
recno21inds11 = nonzero(data11[:,1]==no21)[0]
recno22inds11 = nonzero(data11[:,1]==no22)[0]
recno23inds11 = nonzero(data11[:,1]==no23)[0]
recno24inds11 = nonzero(data11[:,1]==no24)[0]
recno25inds11 = nonzero(data11[:,1]==no25)[0]
recno26inds11 = nonzero(data11[:,1]==no26)[0]
recno27inds11 = nonzero(data11[:,1]==no27)[0]
recno28inds11 = nonzero(data11[:,1]==no28)[0]
recno29inds11 = nonzero(data11[:,1]==no29)[0]
recno30inds11 = nonzero(data11[:,1]==no30)[0]

c# label not dragging:

c# label not dragging:

When I try and drag label into the rich text box, the icon stays as
rejected. My labels are in a panel, separate from the rich text box. How
can I get the text from the label to copy into the rich text box? Right
now I get the circle with a line as though I hadn't set txtText.AllowDrop
to true, but I did right there at the form load.
Below is most of my code. Thanks
private void frmMain_Load(object sender, EventArgs e)
{
txtText.AllowDrop = true;
txtText.DragDrop += new DragEventHandler(txtText_DragDrop);
txtText.DragEnter += new DragEventHandler(txtText_DragEnter);
txtText.MouseWheel += new MouseEventHandler(textBox1_MouseWheel);
}
void lblWord_MouseDown(object sender, MouseEventArgs e)
{
Label label = sender as Label;
DoDragDrop(label.Text, DragDropEffects.Copy);
}
void txtText_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
{
e.Effect = DragDropEffects.Copy;
}
}
void txtText_DragDrop(object sender, DragEventArgs e)
{
string add = txtText.Text + " " +
(string)e.Data.GetData(DataFormats.Text);
txtText.Text = add.TrimStart();
}

Positioning in Bootstrap dropdown element in Firefox

Positioning in Bootstrap dropdown element in Firefox

I am trying to position a Bootstrap close button within a dropdown element
(also Bootstrap).
<div id="contextmenu" class="dropdown clearfix" style="position:
absolute;">
<ul class="dropdown-menu" style="display: block;">
<li>Text <button type="button" class="close">&times;</button></li>
</ul>
</div>
That thing floats right, but appears mispositioned in Firefox (first
screenshot). Chrome renders it as intended (second screenshot).


Is there any way to make Firefox render it correctly (i.e. as Chrome does)?

What is wrong with this apache virtualhost directive?

What is wrong with this apache virtualhost directive?

I'm getting 403 forbidden errors with this virtualhost directory in apache
2.2. Can anyone help, please?
<VirtualHost *:80>
ServerName www.xyz.com
ServerAlias xyz.com
DocumentRoot "/home/bruce/projects/links/www"
<Directory />
AllowOverride None
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.htm index.jsp index.php
</VirtualHost>
Thanks!

C++ - Code debug

C++ - Code debug

This is my friend's code though.. He tells me that it has error because it
should run with AJAX or JavaScript or something like that.
He says that he mainly create it for chatting program.
C++ codes :
#include <Windows.h>
HINSTANCE hInstance;
// Function I made to get the size of the text
int GetTextSize (LPSTR a0)
{
for (int iLoopCounter = 0; ;iLoopCounter++)
{
if (a0 [iLoopCounter] == '\0')
return iLoopCounter;
}
}
LPSTR TextArray [] = {
"Hello World"
};
LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CLOSE:
DestroyWindow (hwnd);
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint (hwnd, &ps);
TextOut (hdc,
// Location of the text
10,
10,
// Text to print
TextArray [0],
// Size of the text, my function gets this for us
GetTextSize (TextArray
[0,1,2,3,4,5,6,7,8,9{Font.Size}]));
EndPaint (hwnd, &ps);
}
break;
}
return DefWindowProc (hwnd, msg, wParam, lParam);
}
int WINAPI WinMain (HINSTANCE hInstanace, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
WNDCLASSEX WindowClass;
WindowClass.cbClsExtra = 0;
WindowClass.cbWndExtra = 0;
WindowClass.cbSize = sizeof (WNDCLASSEX);
WindowClass.lpszClassName = "1";
WindowClass.lpszMenuName = NULL;
WindowClass.lpfnWndProc = WndProc;
WindowClass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
WindowClass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
WindowClass.hCursor = LoadCursor (NULL, IDC_ARROW);
WindowClass.style = 0;
WindowClass.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
RegisterClassEx (&WindowClass);
HWND hwnd = CreateWindowEx (WS_EX_CLIENTEDGE,
"1",
"Printing Text in Win32 C/C++",
WS_OVERLAPPEDWINDOW,
315, 115,
640, 480,
NULL,
NULL,
hInstance,
NULL);
ShowWindow (hwnd, SW_SHOWNORMAL);
MSG msg;
while (GetMessage (&msg, NULL, 0, 0) > 0)
{
TranslateMessage (&msg);
DispatchMessage (&msg);
if (VK_ESCAPE == msg.wParam)
break;
}
return 0;
}
Line 42 has errors in it..

Why SSH key login asking me the Passphrase every time?

Why SSH key login asking me the Passphrase every time?

I use putty and follow this tutorial:
http://www.howtoforge.com/ssh_key_based_logins_putty
I just got asked to input the passphrase every time. How do I avoid that
because I don't want to input something every time.

Saturday, 17 August 2013

Append Form And Elements jQuery Mobile

Append Form And Elements jQuery Mobile

Hello I want to append a form and checkbox elements, but the form is
losing its style. The checkboxes should be combined in "list" and the
button Save Attendance should be styled according to jquery Mobile.
How can I fix this please?
This is how it looks:

Code:
$('#editattendancecontent').append('<p>Who Attended?</p><form
id="editattendanceform"><div data-role="fieldcontain"><fieldset
data-role="controlgroup" id="editattendancelist"></fieldset></div><input
type="submit" value="Save Attendance" data-inline="true" /></form>');
for (var i = 0; i < json.length; i++)
{
$('#editattendancelist').append('<input type="checkbox" id=\"' +
json[i].userID + '\" class="custom" /><label for=\"' + json[i].userID
+ '\">'+json[i].name+'</label>').trigger('create');
}
$('input: checkbox').checkboxradio("refresh");

Java: Stage 4: draws all the cards which are currently in the cardsOnTable array

Java: Stage 4: draws all the cards which are currently in the cardsOnTable
array

I am currently doing an assignment, and am upto Stage 4. The instructions
given are
In the A1JPanel class complete the: private void drawTableCards(Graphics
g) { ... } helper method. This method draws all the cards which are
currently in the cardsOnTable array. Remember that some of the elements of
the cardsOnTable array are null. Use the howManyInEachRow array which
contains the number of cards which are currently in each row of the
cardsOnTable array.
I think that the problem may be somewhere else, most of this is just a
skeleton file. The problem could either be in the Card class which is used
for Stage 1 or the JPanel which is used for Stage 3/4. Stage 2 is not the
problem.
STAGE 1 - Card Class
import java.awt.*;
import javax.swing.*;
public class Card {
private int suit;
private int value;
private Rectangle cardArea;
private boolean isFaceUp;
private boolean isSelected;
public Card(int value, int suit) {
this.value = value;
this.suit = suit;
cardArea = new Rectangle(0,0,0,0);
isFaceUp = false;
isSelected = false;
}
//-------------------------------------------------------------------
//-------- Accessor and mutator methods -----------------------------
//-------------------------------------------------------------------
public void setIsFaceUp(boolean faceUp) {
isFaceUp = faceUp;
}
public boolean getIsFaceUp() {
return isFaceUp;
}
public boolean getIsSelected() {
return isSelected;
}
public void setIsSelected(boolean selected) {
isSelected = selected;
}
public void setCardArea(int x, int y, int w, int h) {
cardArea = new Rectangle(x, y, w, h);
}
//-------------------------------------------------------------------
//-------- Short methods for getting the centre point --------------
//-------- of the Card object, changing the position of -------------
//-------- the Card object and for comparing two Card objects: ------
//-------- (comparing suit and for comparing value). ----------------
//-------------------------------------------------------------------
public Rectangle getCardArea() {
return cardArea;
}
public void translate(int x, int y) {
cardArea.x = cardArea.x + x;
cardArea.y = cardArea.y + y;
}
public boolean isSameSuit(Card other) {
if(suit == other.suit){
return true;
}else{
return false;
}
}
public boolean hasSmallerValue(Card other) {
if(other.suit == 0){
return false;
}else if(suit == 0){
return true;
}else if(other.suit < suit){
return true;
}else{
return false;
}
}
public Point getCardCentrePt() {
int x1 = cardArea.x + (cardArea.width/2);
int y1 = cardArea.y + (cardArea.height/2);
Point cardCentrePt = new Point(x1, y1);
return cardCentrePt;
}
//-------------------------------------------------------------------
//-------- Returns true if the parameter Point object, --------------
//-------- pressPt, is inside the Card area. ------------------------
//-------------------------------------------------------------------
public boolean isInsideCardArea(Point pressPt) {
if(cardArea.contains(pressPt)){
return true;
}else{
return false;
}
}
//-------------------------------------------------------------------
//-------- Get String containing the card state ---------------------
//-------------------------------------------------------------------
public String getCardStatusInformation() {
String cardStatusInformation = new String(value + " " + suit + " "
+ cardArea.x +
" " + cardArea.y + " " +
isFaceUp + " " +
isSelected);
return cardStatusInformation;
}
STAGE 3/4 - Methods from JPanel
private void addNextColOfCards(ArrayList<Card> cardStack, Card[][]
cardsOnTable, int[] howManyInEachRow) {
for (int i = 0; i < NUMBER_ROWS; i++){
int cardStackSize = cardStack.size();
Card toPut = null;
int randomCard = (int)(Math.random()*cardStackSize - 1);
toPut = cardStack.get(randomCard);
cardStack.remove(randomCard);
cardsOnTable[i][howManyInEachRow[i]]=toPut;
toPut.setIsFaceUp(true);
howManyInEachRow[i] ++;
int row = i;
int col = howManyInEachRow[row];
setupIndividualCardPositionAndSize(toPut, row, col);
}
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
drawTableCards(g);
drawRestOfJPanelDisplay(g);
}
/*
Stage 4 (8 Marks)
*/
private void drawTableCards(Graphics g) {
//super.paintComponent(g);
for(int i = 0; i<cardsOnTable.length; i++){
for(int j = 0; j < howManyInEachRow[i]; j++){
Card draw = null;
cardsOnTable[i] [howManyInEachRow[i]] = draw;
if( draw != null){
draw.drawCard(g, this
);

Access-Control-Allow-Origin getJSON Rails

Access-Control-Allow-Origin getJSON Rails

I have some code that works fine in development.
ORIGINAL CODE
respond_to :json
def index
@tags = current_user.tags
respond_with(@tags.map{|tag| {:id => tag.id, :name => tag.name} })
end
with a route file of
get "tags/index"
and my jQuery file has a line like this
$.getJSON('http://localhost:3000/tags.json', function(data) {
However, when pushing it to production I get an error XmlHttpRequest
error: Origin is not allowed by Access-Control-Allow-Origin. After doing
some research
Here Here and Here
I changed my code to this
NEW CODE
def index
@tags = current_user.tags
respond_to do |format|
if params[:callback]
format.json { render :json => @tags.map{|tag| {:id => tag.id, :name
=> tag.name} }.to_json , :callback => params[:callback]}
else
format.json { render :json => @tags.map{|tag| {:id => tag.id, :name
=> tag.name} }}
end
end
end
and
$.getJSON('http://localhost:3000/tags.json' + '&callback=?', function(data) {
with the same route.
I was able to get rid of the XmlHttpRequest error, however I am now
looking at this error "Failed to Load Resource tags.json"
What is going on here?

Remove the IE 9 image link box

Remove the IE 9 image link box

On my website http://www.andytechguy.com/ I have a linked image on the top
of every page that leads to the home page. When I am looking at the same
page in IE 9 or some other versions of IE it appears to have a box of blue
or purple around it. How do I remove this box?

Flattening a collection

Flattening a collection

Say I have a Map<List<String>>
I can get the values of the map easily enough, and iterate over it to
produce a single List<String>.
for (List<String> list : someMap.values()) {
someList.addAll(list);
}
Is there a way to flatten it in one shot?
List<String> someList = SomeMap.values().flatten();

How to set Vim's color scheme search directory?

How to set Vim's color scheme search directory?

Using Vundle to manage packages and I installed a color scheme package.
Would like to redirect vim to search in that folder instead of the
default. Could copy the color schemes to the default folder but that makes
it pointless to use vundle for this.

how to change background colour in echo

how to change background colour in echo

i am trying to apply the background color in echo using an inline style
but it is not applying background color in however changes only the text
color. i want to change background color in a particular part of the code
echo "<p style='color:orange';background-color:red;>"."record number:
".$rec_num. "</p>"."<br>"
program code is
class db_access
{
private $_uname;
private $_pass;
private $_db;
private $_server;
//_construct connects databaseand fetchest he result
public function __construct($server,$user_name,$password,$d_b)
{
$this->_server=$server;
$this->_pass=$password;
$this->_uname=$user_name;
$this->_db=$d_b;
$con=mysql_connect($this->_server,$this->_uname,$this->_pass);
$db_found=mysql_select_db($this->_db,$con);
if($db_found)
{
$sql="SELECT * FROM login";
$result = mysql_query($sql);
if ($result)
{
while ( $db_field = mysql_fetch_assoc($result) )
{
static $rec_num=1;
//inline css
echo "<p
style='color:orange';background-color:red;>"."record
number: ".$rec_num. "</p>"."<br>";
print $db_field['ID'] . "<BR>";
print $db_field['u_name'] . "<BR>";
print $db_field['pass'] . "<BR>";
print $db_field['email'] . "<BR><br><br>";
$rec_num++;
}
//returns the connection name that is used as a
resource id in __destruct function
return $this->_con=$con;
}
else {die(mysql_error());}
}
else
{return die(mysql_error());}
}
// destruct function closes database
public function __destruct()
{
$close=mysql_close($this->_con);
if($close)
{print "connection closed";}
else {die(mysql_error());}
}
}
$db=new db_access("127.0.0.1","root","","fabeeno");
//var_dump($db);

Friday, 16 August 2013

Add in app purchase with the app on apple developer portal

Add in app purchase with the app on apple developer portal

I am working on an app, in which I have added in app purchase. When I try
to add that in app purchase with the application then I am getting
following message.

But I didn't submit the application, Its current status is "Waiting for
Upload".
I want to add 3 types of In-App-Purchase with the application. What should
I do now ?
Please help me guys.

Thursday, 8 August 2013

Java vs C++ GUI libraries?

Java vs C++ GUI libraries?

I am currently working on a project that is a SaaS. All functionality to
the end user is only available with an internet connection by accessing a
website currently. However, this is troublesome because the software is a
management software that won't have wifi in range at all times for the
users to connect to. For this reason, I am trying to develop a software
with similar functionality to the online SaaS that will basically be an
offline version of the online site. I must be able to use mySQL.
So I'd like to start with understanding what styling options are there
with various Java or C++ (I would consider other languages as well)
libraries and how complex would it be to develop a GUI with drop down
menus, auto fill capabilities, box shadows, background colors. Ideally any
library that resembles CSS in its capabilities is a plus.
I appreciate any advice, many thanks in advance!

misterious adsl router failure

misterious adsl router failure

My ADSL router (TD-8840T 2.0) has some strange behavior last couple weeks
after some amount time (from few minutes to hours) it loses adsl and
internet led,
I am not sure, but I suspect it restarts.
I bought it for from my ISP for more then 3 years ago.
Wireshark is not showing any unknown traffic.
I can not find whats wrong?
Could it be that its lifetime is up?
I am using my PC 10h daily.

Is it possible to code while i am sleeping on the bed ? why must i get up get on a computer and put on shades in order to program?

Is it possible to code while i am sleeping on the bed ? why must i get up
get on a computer and put on shades in order to program?

Currently, i must leave the bed, get on my desk...
and then put on the shades so the light from the monitor
does not damage my eyes..
all so i can code.
the keyboard can not be used in the bed.
neither the monitor
or the computer.
tablets don't work for coding
neither do laptops.
coding is diffikult.
i need to code while i am in the bed.
is there like a washable keyboard that is both flexible and yet ridgit

how do I convert wpf dispatcher to winforms

how do I convert wpf dispatcher to winforms

I was moving over a method to my winforms project from a wpf project.
Everything but this section was moved without issue:
private void ServerProcErrorDataReceived(object sender,
DataReceivedEventArgs e)
{
// You have to do this through the Dispatcher because this method is
called by a different Thread
Dispatcher.Invoke(new Action(() =>
{
richTextBox_Console.Text += e.Data + Environment.NewLine;
richTextBox_Console.SelectionStart = richTextBox_Console.Text.Length;
richTextBox_Console.ScrollToCaret();
ParseServerInput(e.Data);
}));
}
I have no idea how to convert over Dispatcher to winforms.
Can anyone help me out?

How to send data to Code behind in Dojo

How to send data to Code behind in Dojo

Just today morning I started to work with dojo with NO support. Hence,
feeling everything difficuilt.
I have one form with Fields: DeptNo, DName, Loc.
User can enter either nothing or all the values for the above fields and
clicks on Search button.
Now, I should able to read these values in code behind to make service call.
Since I am using just HTML input elements I am not understanding how to
pass these values into Code behind.
Can anybody please suggest me on this.

knockout dynamically replace a object in an observable array

knockout dynamically replace a object in an observable array

I have knockout observable array like
var viewModel={
people : ko.observableArray([
{ name: 'Bert' },
{ name: 'Charles' },
{ name: 'Denise' }
])};
ko.applyBindings(viewModel);
with foreach binding i have displayed the array in a table now i want to
chane the first row of the table dynamically using the array index i tryed
(viewModel.people.name[0]("new value"); it doesn't work
Any ideas?

How to call a jQuery function on click event in the following scenario?

How to call a jQuery function on click event in the following scenario?

I'm using PHP, Smarty and jQuery for my website. There is a functionality
of showing and hiding an
element on a form. The HTML as well as code from jQuery function is as
below: HTML Code:
<div class="c-mega-accord">
<ol class="fnAccordion">
<li>
<a class="fnTrigger" href="#">Practice Sheet Basic Details
<span></span></a>
<div class="fnAccContent">
<div class="c-grad-box">
<div class="form-wrapper">
{if $error_msg}<div
class="error-info">{$error_msg.error_msgs}</div>{/if}
<form name="manage_practice_sheet" id="manage_practice_sheet"
action="practice_sheet.php" method="post">
<input type="hidden" name="op" id="op" value="{$op}" />
<input type="hidden" name="sheet_type" id="sheet_type"
value="{$sheet_type}" />
<input type="hidden" name="form_submitted" id="form_submitted"
value="yes" />
<input type="hidden" name="practice_sheet_id"
id="practice_sheet_id" value="{$practice_sheet_id}" />
<input type="hidden" name="hidden_practice_sheet_category_id"
id="hidden_practice_sheet_category_id"
value="{$practice_sheet_category_id}" />
<input type="hidden" name="practice_sheet_id"
id="practice_sheet_id" value="{$practice_sheet_id}" />
<p class="form-info fl-right">* Mandatory fields</p>
<ul>
<li>
<label>{'Category'|signal_on_error:$error_msg:'practice_sheet_category_id'}<span
class="reqd">*</span></label>
<div class="form-element">
<select name="practice_sheet_category_id"
id="practice_sheet_category_id"
<!--onChange="get_subcategory_by_category('{$control_url}modules/category/manage_category.php',
this.value, 'get_subcategory_by_category',
'#practice_sheet_sub_category_id');"--> >
<option value="">Select</option>
{if $all_parent_categories}
{foreach from=$all_parent_categories
item="parent_category"}
<option value="{$parent_category.category_id}" {if
$data.practice_sheet_category_id==$parent_category.category_id
||
$practice_sheet_category_id==$parent_category.category_id}
selected="selected"{/if}>{$parent_category.category_name}</option>
{/foreach}
{/if}
</select>
</div>
</li>
<li>
<label>{'Practice Sheet
Name'|signal_on_error:$error_msg:'practice_sheet_name'}<span
class="reqd">*</span></label>
<div class="form-element">
<input class="" type="text"
name="practice_sheet_name"
id="practice_sheet_name"
value="{$data.practice_sheet_name}"
maxlength="50">
</div>
</li>
<li>
<label>Display Date</label>
<div class="form-element">
<input type="text" class="cal fl-left" id="frmDate"
name="frmDate" value="{if
$data.practice_sheet_display_date !='0' &&
$data.practice_sheet_display_date
!=''}{$data.practice_sheet_display_date}{/if}">
</div>
</li>
<li>
<label>Practice Sheet For</label>
<div class="form-element">
<input class="" type="text" name="practice_sheet_for"
id="practice_sheet_for" value="{$data.practice_sheet_for}"
maxlength="50">
</div>
</li>
<li>
<label></label>
<div class="form-element">
<!--<input type="submit" value="{$submit_value}"
class="c-btn" id="saveAddMore" name="submit">
<input type="button" value="{$cancel_value}"
class="c-gray-btn" id="done" name="done"
onclick="javascript:window.location.href='{$control_url}modules/practice_sheet/practice_sheet.php?op={$query_string}'"><br/>-->
<span class="c-btn c-continus-btn"><input type="button"
name="continus" id="continus" value="Continue" id=""
name=""></span>
<span class="c-gray-btn c-cancel-btn"><input type="button"
value="Cancel" id="" name=""></span>
</div>
</li>
</ul>
</form>
</div>
</div>
</div>
</li>
<li>
<a class="fnTrigger" href="#">Select Category <span></span></a>
<div class="fnAccContent">
<div class="c-grad-box">
</div>
</div>
</li>
</ol>
</div>
jQUery Code:
function accordion(){
var li = $(".fnAccordion > li");
li.eq(0).addClass("active");
li.children('.fnAccContent').not(':first').hide();
$(".fnAccordion .fnTrigger").click(function(e){
e.preventDefault();
var numLi = $(this).parent('li').siblings();
if(numLi.length > 0){
$(this).parent('li').siblings().removeClass("active");
var curState =
$(this).parent().find(".fnAccContent").css("display");
if(curState == "none"){
$(".fnAccContent").slideUp();
$(this).parent().addClass("active");
$(this).parent().find(".fnAccContent").slideDown();
}
}else{
$(this).parent('li').toggleClass("active");
$(this).parent().find(".fnAccContent").slideToggle();
}
})
}
$(document).ready(function(){
accordion();
})
Now the functionality of hide/show is working fine when I click on
following two elements:
<a class="fnTrigger" href="#">Practice Sheet Basic Details <span></span></a>
<a class="fnTrigger" href="#">Select Category <span></span></a>
Actually I want to make this functionality work on Continue
button(following is the HTML code snippet for it):
<input type="button" name="continus" id="continus" value="Continue" id=""
name="">
I tried to make it work on Continue button by applying the class fnTrigger
but it didn't work. Can you help me in this regard? Thanks in advance.

php modbus read multiple register with mysql

php modbus read multiple register with mysql

Thanks in advance.
I am trying to read registers 146 and 601 from a modbus register using
phpmodbus from http://code.google.com/p/phpmodbus/
The script sueccessfully loads the first record but fails at the second
The error i get is: Fatal error: Maximum execution time exceeded
my code is as following:
require_once dirname(__FILE__) . '/Phpmodbus/Phpmodbus/ModbusMaster.php';
$modbus = new ModbusMaster("10.234.6.11", "TCP");
//the sql contaions the two records 146 and 601
$sql = "SELECT num FROM `main`";
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)) {
echo $row['num'] . "<br>";
$recData = $modbus->readMultipleRegisters(1, $row['num'], 1);
//modbus status
echo $modbus;
//converting
$values = array_chunk($recData, 2);
foreach($values as $bytes) {
echo PhpType::bytes2signedInt($bytes) . "<br>";
}
}