Saturday, 31 August 2013

freeing the popup twice crashes applcation

freeing the popup twice crashes applcation

In my execute block that gets called with a button click, I create a popup
menu to appear where the button was clicked. It current appears properly,
with a few items with one of them having a couple sub items. When this
that runs once then calls the destructor, it is fine. But if I execute it
twice (show the popup and click an item twice) then destruct, the
application crashes. I think it is because I'm not freeing the popup
correctly (which is declared as a private property).
procedure TPlugIn.Execute(AParameters : WideString);
var
i: Integer;
pnt: TPoint;
begin
GetCursorPos(pnt);
FPopup := TPopupMenu.Create(nil);
FPopup.OwnerDraw:=True;
FPopup.AutoHotkeys := maManual;
//SQL Upgrade
Item := TMenuItem.Create(FPopup);
Item.Caption := 'Database Install/Upgrade';
Item.OnClick := ShowItemCaption;
FPopup.Items.Add(Item);
//Language Folder
Item := TMenuItem.Create(FPopup);
Item.Caption := 'Language Folder';
Item.OnClick := ShowItemCaption;
FPopup.Items.Add(Item);
//Machines
Item := TMenuItem.Create(FPopup);
Item.Caption := 'Machines';
MachineItem := TMenuItem.Create(FPopup);
MachineItem.Caption := 'Sample Machine 1';
MachineItem.OnClick := ShowItemCaption;
Item.Add(MachineItem);
MachineItem := TMenuItem.Create(FPopup);
MachineItem.Caption := 'Sample Machine 2';
MachineItem.OnClick := ShowItemCaption;
Item.Add(MachineItem);
FPopup.Items.Add(Item);
Self.FPopup := FPopup;
FPopup.Popup(pnt.X, pnt.Y);
end;
In the ShowItemCaption procedure I just show the caption of that sender
object. I haven't coded specific events yet. If it free the popup in the
execute procedure, the popup doesn't appear anymore.
destructor TPlugIn.Destroy;
begin
inherited;
FPopup.Free;
//ShowMessage('freed');
end;

IList Property stays null even when member is instantiated

IList Property stays null even when member is instantiated

I am having trouble using an IList property which always seems to return
null, even though the member is is getting is instantiated:
private List<ModelRootEntity> _validTargets = new
List<ModelRootEntity>();
public IList<IModelRootEntity> ValidTargets
{
get
{
return _validTargets as IList<IModelRootEntity>;
}
protected internal set
{
if (value == null)
_validTargets.Clear();
else
_validTargets = value as List<ModelRootEntity>;
}
}
ModelRootEntity implements IModelRootEntity. I watched both values during
debugging, whilst the member shows a positive count, the property stays
null.
I also tried raising an exception within the property getter to throw if
the counts of _validTargets and _validTargets as List<ModelRootEntity> are
different, but it never threw.
Found question [Dictionary properties are always null despite dictionaries
being instantiated, which seems similar, however in my case this seems to
happen regardless of serialization.
Any ideas?

jQuery HTML CSS effects

jQuery HTML CSS effects

Is possible with the sole use of jQuery / HTML / CSS to animate a diagonal
transition of block element from bottom left corner to top right. So a
triangular shape fills the transition period until the block is filled?
I am after this as I have users with a browsers that do not support CSS3
transitions. Ideally this would work in both Chrome and IE8+

NumPy : array methods and functions not working

NumPy : array methods and functions not working

I have a problem regarding NumPy arrays.
I cannot get array methods like .T or functions like numpy.concatenate to
work with arrays I create:
>>> a=np.array([1,2,3])
>>> a
array([1, 2, 3])
>>> a.T
array([1, 2, 3])
>>> np.concatenate((a,a),axis=0)
array([1, 2, 3, 1, 2, 3])
>>> np.concatenate((a,a),axis=1)
array([1, 2, 3, 1, 2, 3])
>>>
However when I create an array using bult-in functions like rand
everything is fine
>>> a=np.random.rand(1,4)
>>> a.T
array([[ 0.75973189],
[ 0.23873578],
[ 0.6422108 ],
[ 0.47079987]])
>>> np.concatenate((a,a),axis=0)
array([[ 0.92191111, 0.50662157, 0.75663621, 0.65802565],
[ 0.92191111, 0.50662157, 0.75663621, 0.65802565]])
Do you think it has to do with element types (int32 vs float64) ?
I anm running python 2.7 on windows 7
Any help would be greatly appreciated.
Thanks !

flask-admin queryset analog from django-admin

flask-admin queryset analog from django-admin

I'm using SQLAlchemy ModelView
Well, I'm trying to manage per-item permissions in my admin. So, users can
change only that model instances, they created.
I can add column "author" with relation to "User" table.
After that, in django-admin typically we use
def queryset:
qs = super(...
qs = qs.filter(author = request.user)
return qs
So, how to do this in flask-admin. Mb, it's definitely another way, and
maybe there is "queryset" analog?

To make the following code run faster?

To make the following code run faster?

Consider the code:
where i read an input file with 6columns (0-5)
Initialize a variable historyends to 5000.
Next when the column0 value i,e job[0] < 5000 i add 5000lines of the input
file in a list(historyjobs) else the rest of the lines till the eof in
another list(targetjobs).
Next all the historyjobs list all contents in item3,item4,item5 is equal
to targetjobs first list item3,item4,item5 when this condition is
satisfied add those historyjobs all item1 to list listsub.
Next find the running mean of the items in listsub & reverse the
list,store it in list a.Check the condition if items in listsub > a*0.9
the which staisfies the condition stores the result items in list condsub.
Next reopen the inputfile & check whether column0 is equal to items in
condsub if it satisfies then add the column1 to a list condrun.
Finally open the output file & write in colum0 the second item of first
list in targetjobs i,e j,in column1 write the average of list
condrun,column2 is (j-avg)/j ,column3 is maximum item in list condrun
,column4 is minimum item in list condrun,column5 is length of list
condrun,the last four column is based on condition.
Last i am repeating the whole procedure using a while loop by assigning
the variable historyends to the next item int(targetjobs[1][0])
from __future__
import division
import itertools
history_begins = 1; history_ends = 5000; n = 0; total = 0
historyjobs = []; targetjobs = []
listsub = []; listrun = []; listavg = [] ; F = [] ; condsub = [] ;condrun
= [] ;mlistsub = []; a = []
def check(inputfile):
f = open(inputfile,'r') #reads the inputfile
lines = f.readlines()
for line in lines:
job = line.split()
if( int(job[0]) < history_ends ): #if the column0 is less then
history_ends(i,e 5000 initially)
historyjobs.append(job) #historyjobs list contains all the
lines from the list whose column1 < history_ends
else:
targetjobs.append(job) #historyjobs list contains all the
lines from the list whose column1 > history_ends
k = 0
for i, element in enumerate(historyjobs):
if( (int(historyjobs[i][3]) == int(targetjobs[k][3])) and
(int(historyjobs[i][4]) == int(targetjobs[k][4])) and
(int(historyjobs[i][5]) == int(targetjobs[k][5])) ): #historyjobs
list all contents in column3,column4,column5 is equal to targetjobs
first list column3,column4,column5
listsub.append(historyjobs[i][1]) #when if condition true add
those historyjobs column1 to list listsub
def runningMean(iterable):
"""A generator, yielding a cumulative average of its input."""
num = 0
denom = 0
for x in iterable:
num += x
denom += 1
yield num / denom
def newfun(results):
results.reverse() # put them back in regular order
for value, average in results:
a.append(value)
return a #to return the value
def runcheck(subseq):
f = open('newfileinput','r') #again read the same inputfile
lines = f.readlines()
for line in lines:
job = line.split()
for i, element in enumerate(subseq):
if(int(job[1]) == int(subseq[i])): # if the column1 value of the
inputfile becomes equal to list obtained
condrun.append(str(job[2])) #return the value of column2 which
satisfies the if condition
return condrun
def listcreate(condrun,condsub):
f1 = open('outputfile','a') #outputfile to append the result
s = map(int,condrun)
j = int(targetjobs[0][2])
targetsub = int(targetjobs[0][1])
if(condsub != []):
try:
convertsub = int(condsub[-1])
a=sum(s)/len(s)
c=max(s)
d=min(s)
e1=abs(j-a)
er1=e1/j
g=len(s)
h=abs(convertsub-targetsub)
f1.write(str(j))
f1.write('\t')
f1.write('\t')
f1.write(str(round(a,2)))
f1.write('\t')
f1.write('\t')
f1.write(str(round(er1,3)))
f1.write('\t')
f1.write('\t')
f1.write(str(c))
f1.write('\t')
f1.write('\t')
f1.write(str(d))
f1.write('\t')
f1.write('\t')
f1.write(str(g))
f1.write('\t')
f1.write('\t')
f1.write(str(h))
f1.write('\t')
f1.write("\t")
if (float(er1) < 0.20):
f1.write("good")
f1.write("\t")
else :
f1.write("bad")
f1.write("\t")
if (float(er1) < 0.30):
f1.write("good")
f1.write("\t")
else :
f1.write("bad")
f1.write("\t")
if (float(er1) < 0.40):
f1.write("good")
f1.write("\t")
else :
f1.write("bad")
f1.write("\t")
if (float(er1) < 0.50):
f1.write("good")
f1.write("\n")
else :
f1.write("bad")
f1.write("\n")
except ZeroDivisionError :
print 'dem 0'
else:
print '0'
f1.close()
def new():
global history_ends
while 1: #To repeat the process untill the EOF(end of input file)
check('newfileinput') #First function call
if(len(targetjobs) != 1):
history_ends = int(targetjobs[1][0]) #initialize historyends to
targetjobs second lines first item
mlistsub = map(int,listsub)
results = list(itertools.takewhile(lambda x: x[0] > 0.9 * x[1],
itertools.izip(reversed(mlistsub),
runningMean(reversed(mlistsub)))))#call runningmean
function & check the condition
condsub = newfun(results) #function to reverse back the result
condrun=runcheck(condsub) #functionto match & return the value
listcreate(condrun,condsub) #function to write result to output file
del condrun[0:len(condrun)]#to delete the values in list
del condsub[0:len(condsub)]#to delete the values in list
del listsub[0:len(listsub)]#to delete the values in list
del targetjobs[0:len(targetjobs)]#to delete the values in list
del historyjobs[0:len(historyjobs)]#to delete the values in list
else:
break
def main():
new()
if __name__ == '__main__':
main()
the sample input file(whole file contains 200,000 lines):
1 0 9227 1152 34 2
2 111 7622 1120 34 2
3 68486 710 1024 14 2
6 265065 3389 800 22 2
7 393152 48438 64 132 3
8 412251 46744 64 132 3
9 430593 50866 256 95 4
10 430730 10770 256 95 4
11 433750 12701 256 14 3
12 437926 2794 64 34 2
13 440070 43 32 96 3
the sample output file contents:
930 1389.14 0.494 3625 977 7 15
bad bad bad good
4348 1331.75 0.694 3625 930 8 164
bad bad bad bad
18047 32237.0 0.786 61465 17285 3
325774 bad bad bad bad
1607 1509.0 0.061 1509 1509 1
6508 good good good good
304 40.06 0.868 80 32 35 53472
bad bad bad bad
7246 7247.0 0.0 7247 7247 1 9691
good good good good
95 1558.0 15.4 1607 1509 2 2148
bad bad bad bad
55 54.33 0.012 56 53 3 448142
good good good good
31 76.38 1.464 392 35 13 237152
bad bad bad bad
207 55.0 0.734 55 55 1 370 bad
bad bad bad
if anyone could suggest some changes through which the code runs faster it
would be helpful...

Add a layout dynamically, to overlapp the other layout

Add a layout dynamically, to overlapp the other layout

I'm writing a "Welcome Screen" for my application, that runs when
application launches for the first time. What I want: A transparent layout
to be overlapped on the root layout, dynamically through code. like this
image:

but when I run my app, It crashes due to NULLPOINTEREXCEPTION. even when I
didn't add the second layout
Problem 1: Why first layout doesn't show up, and app crashes?
Problem 2: How to show the second layout?
thanks in advance....
Authentication.java
public class Authentication extends Activity {
private RelativeLayout rootLayout;
public static Context CONTEXT;
public Authentication(){
CONTEXT=this;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
rootLayout=new RelativeLayout(CONTEXT);
LinearLayout firstLayout=(LinearLayout)
findViewById(R.layout.authentication);
rootLayout.addView(firstLayout);
setContentView(rootLayout);
if(Util.isFirstLaunch(CONTEXT)){
//Add the second layout
}
}
}
authentication.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/authentication"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background" >
<TextView
android:id="@+id/textView_login"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="12dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_gravity="center_horizontal"
android:text="@string/loginText"
android:textSize="18sp" />
<EditText
android:id="@+id/editText_username"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_gravity="center_horizontal"
android:nextFocusDown="@+id/editText_password"
android:inputType="textPersonName"
android:hint="@string/username" />
<EditText
android:id="@+id/editText_password"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="12dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_gravity="center_horizontal"
android:inputType="textPassword"
android:hint="@string/password" />
<Button
android:id="@+id/button_submit"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/button"
android:text="@string/submit"
android:textColor="#e1ecff" />
</LinearLayout>

LongListSelector's performance is very bad. How to improve?

LongListSelector's performance is very bad. How to improve?

here is my code
<phone:LongListSelector ItemsSource="{Binding
MovieTimeInDetailItems}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="24,0,0,12">
<TextBlock Text="{Binding Theater}"
FontSize="34"/>
<ListBox ItemsSource="{Binding TimeItems}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="115"
Margin="0,0,0,0">
<TextBlock Text="{Binding
Time}"
TextWrapping="Wrap"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="26"
Foreground="{StaticResource
PhoneSubtleBrush}"/>
<Border Margin="92,0,0,0"
HorizontalAlignment="Left"
Width="{Binding Width}"
Height="25"
BorderThickness="1.5,0,0,0"
BorderBrush="{StaticResource
PhoneSubtleBrush}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
In each LLS item contains a Listbox which display time list. my question
is ... Can I display a time list without Listbox ? It seems Listbox cause
the low performance.

Friday, 30 August 2013

draw bitmap images outside onDraw function Canvas Android

draw bitmap images outside onDraw function Canvas Android

I want to call a function to draw Bitmap images from the onDraw().
Actually I need to draw bitmap images outside the onDraw() . Help me.
Thanks.

Thursday, 29 August 2013

Assigning multiple properties to a Font

Assigning multiple properties to a Font

I have some code in which I allow the user to control the different
attributes of controls on a form, i.e. Italics, Bold, BackColor,
ForeColor.
My problem is that when the user selects Italics & Bold, I'm not sure what
the format is to do this. Here is what I have so far.
For Each ctl As Control In frm.Controls
If TypeOf (ctl) Is Button Then
ctl.Font = New Font(ctl.Font, FontStyle.Italic)
End If
Next
This is the effect I want:
ctl.Font = New Font(ctl.Font, FontStyle.Italic, FontStyle.Bold)

Google hangout in gmail : How to display textual notification?

Google hangout in gmail : How to display textual notification?

I have got a problem : With the first google chat integrated in gmail, I
can see when people talk to me on top right of my screen.
I switched to new hangout chat: How to display textual notification
instead of sound notification when a conversation start ? (like when a
email is received).
I read google doc without success to find answer....
I run latest chrome on mac 10.7
Should I go to adium + growl notification ?
Thank you.

Replacing property dynamically based on environments in ANT scripts

Replacing property dynamically based on environments in ANT scripts

I want to develop ant script which replaces application properties with
environment specific properties. My requirement is that i will have all
environment properties in single env.properties file. During building the
application i need to replace with whatever in env.properties file. Ant
replace works well when i have property files for each environment.
Sample : env.properties
dev.AddNETWORK_USER=devUser
dev.ADDPASS=devPass
sit.AddNETWORK_USER=situser
sit.ADDPASS=sitPass
This needs be replaced in mule.properties as for DEV environment:
dev.AddNETWORK_USER=devUser
dev.ADDPASS=devPass
for SIT environment:
AddNETWORK_USER=sitUser
ADDPASS=sitPass
Thanks for the Help.

Wednesday, 28 August 2013

Problems integrating Maven with Eclipse Kepler

Problems integrating Maven with Eclipse Kepler

I am totally new to working with Maven in Eclipse. I am using the latest
verion of Eclipse (Kepler). According other posts, as well as Eclipse's
help page
http://help.eclipse.org/kepler/index.jsp?topic=//org.eclipse.platform.doc.user/tasks/tasks-127.htm
, I am supposed to try to install new software within Eclipse IDE.
However, when I try to Add Eclipse's recommended m2e release, Eclipse
gives me an error:
Unable to read repository at
http://download.eclipse.org/technology/m2e/releases.
download.eclipse[...]releases is not a valid repository location.
Essentially I run into the same problem no matter which approach I take
outlined on the Eclipse help page. Is there some other/better way to
integrate Maven with Eclipse? Are there steps I should have taken before
this? All I have done so far is install Eclipse. How can I successfully
get Maven running?

How to bring out proper search data for the user asp.net(c#)

How to bring out proper search data for the user asp.net(c#)

Well my scenario is like this i need to show certain apps to a user by
matching his/her country , state , Age group and gender.
For this i have a DB and an admin panel where i enter a set of apps with
fields like what country you want to target , gender you want to target ,
age group you want to target etc. [However these options can be left
blank]
Right now i have made a query that brings out a list based on all provided
parameters which makes the search very specific what should i do to solve
this problem how can i make this scenario better and show results when the
below query is empty. [Don't have much data to work with right now]
select * from App where
((@CountryId IS NULL) OR (CountryId = @CountryId)) AND
((@StateId IS NULL) OR (StateId = @StateId)) AND
((@Gender IS NULL) OR (GenderTarget = @Gender))
AND (@Age >= AppMinAge OR @Age IS NULL)
AND (@Age<= AppMaxAge OR @Age IS NULL)
Note : *OR* doesn't really help me here

Chinese bot visiting non-existent page every 5 minutes

Chinese bot visiting non-existent page every 5 minutes

Since 02.05.2013 some sort of bot is visiting my website, every 5 minutes.
Most of the time it calls this URL, which doesn't exist:
/viewtopic.php?f=3&t=849
Always with this user agent
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; TencentTraveler ;
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR
2.0.50727)
(= IE 6, Windows XP)
Not only it distorts the visitors statistic significantly, it doesn't even
identify as a bot, so I guess it is a spammer of some sort. My question
here is, what does this client do and why is it calling this page
continuously? - And how can I prevent this?
I'm using a vServer with Linux Debian.

git: best way to resolve merge conflicts in notes branch of git

git: best way to resolve merge conflicts in notes branch of git

what is the best approach to resolving merge conflicts in notes branch of
a git repository?
I ran into a scenario where in when I try to fetch the content of the
notes branch from the remote repository, I get an error saying
non-fast-forward, fetch rejected. Suggestions?

Tuesday, 27 August 2013

fetch book information using ISBN

fetch book information using ISBN

User will enter an ISBN number using a POST form. Script should be able to
pull details of the book from internet. It should be able to pull
information from Amazon, Google Books, openISBN, or ISBNdb.
I need the script to pull the following information when I enter an ISBN
number.
Book Name (Title) Publisher Author Cover Picture

what is heroku used for?

what is heroku used for?

I know this is really basic question, but I still have some confusion over
what exactly heroku is meant for. For example, if I create some simple
python program that says "hello world" can I use heroku for that?
I've read several tutorials as well as herokus own website and still don't
quite get it. I think the descriptions are too dense for me.
Can some explain this in incredibly simple laymans terms?

Writing gpg decrypted file to a specified outfile

Writing gpg decrypted file to a specified outfile

I attempted to decrypt an encrypted gpg file using:
gpg -d <encrypted file> --output <outfile>
and just get a message: usage: gpg [options] --decrypt [filename]
In contrast, if I use
gpg -d <encrypted file>
the file is decrypted, but it's written to a default file and displayed to
the terminal screen. The former isn't a big issue, but the latter (display
in terminal screen while decrypting) is a real nuisance. What, if
anything, can be done about it?

Is Kendo Upload control Vulnerable to XSS?

Is Kendo Upload control Vulnerable to XSS?

Is Kendo Upload control Vulnerable to XSS attack? If yes, is there a fix
available?

C++ virtual variable in inheritance class hierarchy

C++ virtual variable in inheritance class hierarchy

I have a template class hierarchy,
___ Class (ClassA)
|
AbstractClass_____
|___ Class (ClassB)
in classA and ClassB, I have a const NullPosition of a templated type,
which is different in ClassA and ClassB. In class classA and ClassB I have
to do some operation which are dependant on the value of the NullPosition.
Now I need to do some operations depending on the value on NullPosition,
but I am having hard time since the variable are different type and
values. To be more specific NullPosition in classA identifies an invalid
array index, therefore equals -1; in classB it identifies a NULL pointer
therefore it equals 0.
Please find below an example.
#ifndef ABSTRACTCLASS_H
#define ABSTRACTCLASS_H
template <class T, class P>
class AbstractClass
{
public:
typedef T Type;
typedef P Position;
void MethodX() const;
virtual Position Method() const = 0;
};
template <class T, class P>
void AbstractClass<T,P>::MethodX() const
{
Position p=Method();
/*
what I am trying to achieve is being able to use the constant
NullPosition in abstract class.
if (p==NullPosition)
cout<<"p is equal NULLPOSITION";
else
cout<<"p is not equal NULLPOSITION";
*/
}

jQuery on click if/else not working

jQuery on click if/else not working

I'm trying to create a condition to go to the next stage of a process.
The user needs select either 'Abandon' or 'Continue' before hitting the
'Next' button.
If one or the other is selected, hitting next button goes to the next
page. If not, an alert says "Have you checked Abandon or Continue?
This is what I've done looking at other codes but it is not working for
me. Nothing of the jQuery works, not even the alert =S Can anyone help me?
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Page</title>
<link href="remote_style.css" rel="stylesheet" type="text/css">
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$('#next').on('click', function() {
if ($('#abandon' || '#complete').attr('checked') === "checked") {
window.open('remote-user-testing5.html');
} else {
alert("Have you checked Abandon or Complete?");
}
return false;
});
</script>
</head>
<body>
<div>
<h1>Instruction window</h1>
<div class="text">
<p>Now you will be asked to carry out 3 tasks and provide
feedback on your experience.</p>
<p>To complete each task, you will need to navigate through a
website.</p>
<p>Task complete: When you feel you have completed a task tick
'Complete' and click 'Next' in this Instruction Window.</p>
<p>Abandon task: If you are finding it difficult to complete a
task, tick 'Abandon' and click 'Next' this Instruction
Window.</p>
<p>Please remember we are not testing you, we are evaluating
and testing the website.</p>
<p>When you are ready click 'Next' to find out your task
scenario.</p>
<input type="radio" name="radio" value="abandon"
id="abandon">Abandon<br>
<input type="radio" name="radio" value="complete"
id="complete">Complete<br>
<button id="next">Next</button>
</div>
</div>
</body>
</html>

How can I check if a php array's keys all have values and none are blank or unset

How can I check if a php array's keys all have values and none are blank
or unset

I create a php array on the fly like below in php, which is then
json_encoded and sent back to the ajax script that requested it.
$myarr['key_a'] = 'a';
$myarr['key_b'] = 'b';
$myarr['key_c'] = 'c';
Before I do the json_encode, since the values for this come from a
database, is there someway I can check if all values are set and none are
blank or unset without having to check each key individually?

Monday, 26 August 2013

How do i find if the model is new or has no property in it : backbone

How do i find if the model is new or has no property in it : backbone

This is my backbone model and collection:
var myModel = Backbone.Model.extend({ });
var myCollection = Backbone.Collection.extend({
model : myModel,
});
when i do new of model
debitRow = new myModel();
this will have no property or value in it.
now how do i find that the model is empty or not

Highlight ListView row without Views in it

Highlight ListView row without Views in it

I have created ListView with checkbox and textview(with custom background)
in every row. When I click on a row, checkbox and textview get highlighted
with a listview row, but I want to get highlighted only the listview row
without checkbox and textview after I click on the row. Could you help me
please?
This is what I want after click on a row: http://tinypic.com/r/14kfpza/5.
This is what I have after click on a row: http://tinypic.com/r/2mr5w9c/5.
Thank you
My adapter for listview:
public class MyAdapter<String> extends ArrayAdapter<String>{
Context ctx;
List<String> content;
public MyAdapter(Context context, List<String> objects) {
super(context, R.layout.listview_row ,objects);
this.ctx = context;
this.content = objects;
}
public View getView(int position, View convertView, ViewGroup parent){
View row = convertView;
if(row == null){
LayoutInflater inflater=getLayoutInflater();
row=inflater.inflate(R.layout.listview_row, parent, false);
}
TextView desc = (TextView)row.findViewById(R.id.textView1);
String name = content.get(position);
desc.setText(name.toString());
return row;
}
}
listview_row.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:text="Large Text"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:background="@drawable/textview_bg"
android:textAppearance="?android:attr/textAppearanceLarge" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/textView1"
android:layout_marginRight="5dp"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="" />
</RelativeLayout>

How to display an inline ProgressBar spinner?

How to display an inline ProgressBar spinner?

I want to display a ProgressBar spinner in place of another View, while it
is loading (i.e. NOT in a dialog). To be clear, I only want the
ProgressBar to replace one View, not take over the Window or Activity.
The best solution I can think of is to place both a ProgressBar and the
actual View in the layout, with the ProgressBar visibility set to VISIBLE
and the View visibility set to GONE. After loading, I swap their
visibility.
This will work but I was hoping for a more elegant solution. Any suggestions?

Load balancing DotNetNuke with Amazon with autoscale

Load balancing DotNetNuke with Amazon with autoscale

I am new to cloud services and need somebody to help me in getting started
with my project.
I have been tasked with building a web environment for a production .Net
application that utilizes DotNetNuke as a front-end CMS.
My end goal (hopefully) is the following:
Create two always-on web servers running DotNetNuke (with the ability to
scale on the fly with autoscaling when under heavy traffic)
Create two always-on SQL servers running SQL Server (with the ability to
scale on the fly with autoscaling when under traffic)
Ideally, I'd like my servers to have static private addresses configured
as such:
Public IP -NAT-> Private IP (172.x.x.x) -> Interface1 -> [Web Cluster] ->
Interface2 -> Backend Private IP (10.x.x.x) -> [Database Cluster]
This particular application sees heavy traffic and currently our managed
provider is not really giving us what we need in terms of performance
(latency issues, stability issues, etc).
That said, I would like these resources to also be load balanced, and
continuously identical to one another. I don't have the option of using
Amazon's database services for this, nor do I have the option of using
Beanstalk.
Is this even possible? I've found some documentation online that loosely
relates to what I'm looking for, but I feel like I'm not experienced
enough with Amazon to really understand what these tutorials are talking
about.
Any help or guidance would be greatly appreciated.

What way better to do Upload File with JQuery

What way better to do Upload File with JQuery

I'm trying to do upload with jquery.
http://malsup.com/jquery/form/
$('#upload').click(function() { $('#formupload').ajaxForm({
dataType: 'JSON',
type: 'POST',
url: 'servlet',
success: function() {
// do something
},
error: function() {
// Do something
} });
});
What's wrong?

Unable to change li Background Color on Hover

Unable to change li Background Color on Hover

Can you please take a look at this link and let me know why I am not able
to change the background color of the li on hover?
<ul class="inline">
<li>1</li>
<li>2</li>
<li>3</li>
<li>3</li>
<li>3</li>
</ul>
Css:
.inline li{
width:18% !important;
background:#FFF !important;
}
.inline li: hover{
background:#A5A5A5 !important;
}

Using R to reformat data from cross-tab to one-datum-per-line format

Using R to reformat data from cross-tab to one-datum-per-line format

I'm using R to pull in data through an API and merge all of it into a
single table, which I then write to a CSV file. To graph it properly in
Tableau, however, I need to prepare the data by using their reformatting
tool for Excel to get it from a cross-tablulated format to a format where
each line contains only once piece of data. For example, taking something
from the format:
ID,Gender,School,Math,English,Science
1,M,West,90,80,70
2,F,South,50,50,50
To:
ID,Gender,School,Subject,Score
1,M,West,Math,90
1,M,West,English,80
1,M,West,Science,70
2,F,South,Math,50
2,F,South,English,50
2,F,South,Science,50
Are there any existing tools in R or in an R library that would allow me
to do this, or that would provide a starting point? I am trying to
automate the preparation of data for Tableau so that I just need to run a
single script to get it formatted properly, and would like to remove the
manual Excel step if possible.

Progress 4GL queries

Progress 4GL queries

I am new to this language and having some problems understand queries.
for example:
There are 2 database tables: Warehouse, product. So each warehouse can
have multiple products and products can be stored in different warehouses.
Query:
for each warehouse,
each product:
display warehouse.name, product.prodcode.
end.
the display will like
warehousename productcode awarehouse SKA-301
so for this result, are these columns display total independent result,
eg. SKA-301 product may not in awarehouse. Or it will display the product
in awarehouse? what if product and warehouse don't have related fields?
Please help me. Thank you.

How to read the .doc or .docx file

How to read the .doc or .docx file

How to read the.doc file using Apache pig Latin programming using map reduce



A = load './pig/test.docx';
B = foreach A generate flatten(TextLoader((chararray)$0)) as word;
C = group B by word;
D = foreach C generate COUNT(B), group;
store D into './wordcountone';

I am creating multiple sliders in a page... but not getting the correct stop position if the number of slides are different from each other

I am creating multiple sliders in a page... but not getting the correct
stop position if the number of slides are different from each other

I am creating multiple sliders in a page... but not getting the correct
stop position if the number of slides are different from each other..
If I keep the number of slides same it works well..
But I need different number of slides in sliders...
$(document).ready(function(){
$('.myslider-wrapper').each(function(){
// thumbSlide
var countSlider = $('.thumbSlide').length;
if((".thumbSlide").length){
// Declare variables
var totalImages = $(".thumbSlide > li").length,
imageWidth = $(".thumbSlide > li:first").outerWidth(true),
totalWidth = imageWidth * totalImages,
visibleImages = Math.round($(".thumbSlide-wrap").width() /
imageWidth),
visibleWidth = visibleImages * imageWidth,
stopPosition = (visibleWidth - totalWidth/countSlider);
$(".thumbSlide").width(totalWidth+10);
$(".thumbSlide-prev").click(function(){
var parentMove = $(this).parent().prev('.thumbSlide');
if(parentMove.position().left < 0 &&
!$(".thumbSlide").is(":animated")){
parentMove.animate({left : "+=" + imageWidth + "px"});
}
return false;
});
$(".thumbSlide-next").click(function(){
var parentMove = $(this).parent().prev('.thumbSlide');
if(parentMove.position().left > stopPosition &&
!$(".thumbSlide").is(":animated")){
parentMove.animate({left : "-=" + imageWidth + "px"});
}
return false;
});
}
});
});
here is jsFiddle URL:
http://jsfiddle.net/mufeedahmad/GLSqS/

Sunday, 25 August 2013

Adjust brightness in windows phone 8

Adjust brightness in windows phone 8

I want to be able to adjust the brightness in my windows phone 8
programmatically using c#. What are the possible ways to do that?

iOS Library for Dates Natural Language Processing?

iOS Library for Dates Natural Language Processing?

Is there any option to detect natural language strings like:
"Every other Sunday"
"Mondays at 5-6pm from 20/9 until 30/11"
which will covert it to an object with date, hour, repeat rule, repeat
start & end, etc...
Is it possible to detect such things on iOS?

[ Facebook ] Open Question : I want a creative,cute senior name for Facebook!?

[ Facebook ] Open Question : I want a creative,cute senior name for
Facebook!?

My first name is Melanie. People call me Mel and Melanie, sometimes Melon
so maybe something cute with that? Something creative please!

ArrayIndexOutOfBounds in android app

ArrayIndexOutOfBounds in android app

i am developing an android app as our school project. I personally
contructed this code to the best of my ability but still i get
ArrayIndexOutOfBounds error from the logcat, and the app also forces to
stop. i have revised that code for days to no avail. please help. here
comes my program code...
package com.example.flames2;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity {
EditText name1, name2, out;
int diffCount=0;
public String output="",holder="";
public int length1, length2, total;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mai...
name1 = (EditText)findViewById(R.id.editText1);
name2 = (EditText)findViewById(R.id.editText2);
Button go = (Button)findViewById(R.id.button1);
out = (EditText)findViewById(R.id.editText3);
go.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
String input1 = name1.getText().toString().toUpperCase()...
String input2 = name2.getText().toString().toUpperCase()...
length1 = name1.length();
length2 = name2.length();
total = length1+length2;
theMethod(input1, input2);
out.setText(input1+" "+input2+" are "+output);
input1="";
input2=""; //to clear the names
name1.setText(input1);
name2.setText(input2);
}
});
}
public void theMethod(String a, String b){
char letter;
char flames[] = { 'F','L','A','M','E','S' };
char input1[] = {},input2[] = {};
//Log.i("a.len",a.length()+" O");
the error at the logcat points here at these for loops...
for(int z=0;z<=length1;z++){
input1[z]=a.charAt(z);
}
for(int y=0;y<=length2;y++){
input2[y]=b.charAt(y);
}
if(length1>length2) {
for( int i = 0; i <= length1; i++ ) {
for( int j = 0; j <= length2; j++ ) {
letter = input1[i];
if( letter == input2[j] ) {
total--;
break;
}
}
}
}
else if(length1<length2){
for( int i = 0; i <= length2; i++ ) {
for( int j = 0; j <= length1; j++ ) {
letter = input2[i];
if( letter == input1[j] ) {
total--;
break;
}
}
}
}
else if(length1==length2){
for( int i = 0; i <= length1; i++ ) {
for( int j = 0; j <= length2; j++ ) {
letter = input1[i];
if( letter == input2[j] ) {
total--;
//break;
}
}
}
}
output += flames[total];
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.mai... menu);
return true;
}
}

[ Vegetarian & Vegan ] Open Question : Is cheese on toast healthy?

[ Vegetarian & Vegan ] Open Question : Is cheese on toast healthy?

Saturday, 24 August 2013

Why a file always missing after build in Intellij with maven?

Why a file always missing after build in Intellij with maven?

I have been stuck in the problem for quite a while.I use Intellij and
maven not very long. the problem like this:
the version of my Intellij is 12.1.4,I am making a project of Spring MVC
with maven.So the output directory is 'target' in the project workspace.I
have a mybatis xml file in my path.
once I found that the xml file did not change autoautomaticly in the
target directory.so I delete it in the target directory.after I have done
this,I rebuild the project,but the file never appear any more.
why?how should I do?

How to update database items using multiple threads within a transaction?

How to update database items using multiple threads within a transaction?

I hope you can help me
I'm writing an ASP.NET application and I have to loop on over more than
70,000 datarows within a datatable in order to update database records
(each datatable row has information to update a database record). My idea
was to break the table into 10,000 rows tables and create some async
methods to update the database (one async method per table). I need to
make sure every record on the table is updates, so everything is wrapped
into a TransacionScope block.
The problem is, when I run the Page.ExecuteRegisteredAsyncTasks() I get a
Timeout exception telling me that the max allowed time to get a connection
was finished.
My code is as follows
using (TransactionScope transaccion = new
TransactionScope(TransactionScopeOption.RequiresNew, new TimeSpan(0, 120,
0)))
{
//Validando momentos
clConsultoraCompensationPlan.asignaValoresFinales(dtConsultoraCompensationPlan,
compensation_plan, usuario,pagina);
transaccion.Complete();
}
private static void asignaValoresFinales(DataTable dtConsultorasMaster,
clCompensationPlan compensation_plan, int usuario,Page pagina)
{
List<DataTable> lista_tablas = new List<DataTable>();
//Separadno la tabla en 30 tablas
foreach(IEnumerable<DataRow> renglones in
LinqExtensions.Split(dtConsultorasMaster.AsEnumerable(), 50))
{
lista_tablas.Add(renglones.CopyToDataTable());
}
foreach (DataTable dtConsultoraCompensationPlan in lista_tablas)
{
AsignaValoresFinalesAsincrono tarea = new AsignaValoresFinalesAsincrono();
PageAsyncTask tarea_asincrona = new PageAsyncTask(tarea.OnBegin,
tarea.OnEnd, tarea.OnTimeout, new
ContenedorAsignaValoresFinalesAsincrono(dtConsultoraCompensationPlan,compensation_plan,usuario),
true);
pagina.RegisterAsyncTask(tarea_asincrona);
}
pagina.ExecuteRegisteredAsyncTasks();
}
In order to run the query I'm using a singleton instance, does this affect
something? Is there a better way to complete this task rather than split
the table and multithread?
Thanks in advance

Socket wait for read before writing

Socket wait for read before writing

Desire: I want to connect to the socket and have 'running' sent to the
client every second.
This of course is a test.
Issue: The output 'running' is only sent when the client sends data. It
seems like the loop is pausing waiting on the client to write back.
Code:
$socket = @socket_create_listen("12345");
while (true) {
$client = socket_accept($socket);
$msg = "\nHello"."\r\n".chr(0);
$length = strlen($msg);
socket_write($client, $msg,$length);
usleep(5);
while (true) {
$msg = 'running'."\r\n".chr(0);
$length = strlen($msg);
socket_write($client, $msg, $length);
sleep(1);
}
}
I am really not sure what could cause this.
Thanks JT

ASP.NET inserting form data into database

ASP.NET inserting form data into database

I'm pretty new to ASP.NET but I have a form with textboxes, some of which
are required using the RequiredFieldValidator. And once everything has
been filled out I want to insert into my database. I'm reading about all
different ways to indest and not sure the best, most current way of doing
an insert. Here's what I have but keep getting the error:
Object reference not set to an instance of an object. Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 50: finally Line 51: { Line 52: conn.Close(); Line 53: } Line 54: }
C# code -- the only thing I'm trying to insert is textbox with ID=BookingName
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms;
using System.IO;
using System.Net.Mail;
using System.Data.SqlClient;
public partial class _Default : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
// BookingName.Text = "test";
}
private void ExecuteInsert(string name)
{
string connString =
System.Configuration.ConfigurationManager.ConnectionStrings["CateringAuthorizationEntities"].ConnectionString;
SqlConnection conn = null;
string sql = "INSERT INTO tbBooking (BookingName) VALUES "
+ " (@BookingName)";
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
SqlParameter[] param = new SqlParameter[1];
//param[0] = new SqlParameter("@id", SqlDbType.Int, 20);
param[0] = new SqlParameter("@BookingName",
System.Data.SqlDbType.VarChar, 50);
param[0].Value = name;
for (int i = 0; i < param.Length; i++)
{
cmd.Parameters.Add(param[i]);
}
cmd.CommandType = System.Data.CommandType.Text;
cmd.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Insert Error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
conn.Close();
}
}
protected void BtnCatering_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
//call the method to execute insert to the database
ExecuteInsert(BookingName.Text);
Response.Write("Record was successfully added!");
}
}
}

Converting string to float with atof() in C++

Converting string to float with atof() in C++

I'm new to C++ and I need help converting my string variable into a
number. I need to print the person's age and her next year age on the
screen but I can't figure out how. I can't use the string to do math. So
can you please shoot me a couple examples please?
I tried to do it this way:
//converts F to C
ctemp=(ftemp-32)*5.0/9.0;
//calculates age
age2 = age + 1 ; age2 = atof (age2.c_str()); age = atof (age.c_str());
cout<<name<<" is "<<age<<" now, and will be " <<age2<<" a year from
now.\n"<<"Its "<<ftemp<<" in "<<city<<"--- That's
"<<setprecision(2)<<ctemp<<" degrees C"<<endl;

Django, storing HTML code in databases

Django, storing HTML code in databases

So I am currently designing a website that I am deploying on Heroku with
Django.
I want to have project pages that I load dynamically using templates
(instead of hard coding various HTML templates) and loading them
dynamically into a div on page load time. These pages are going to be
"project" pages and I am currently thinking of the best way to store them.
I do not think they will be overly similar to each other since I want
different pages to use different HTML, though the general layout will be
similar. I also want to be able to store code sections, much like stack
overflow.
I have 2 ideas on how to store the information:
1) Create a text field and let myself render the HTML tags (since its only
me the admin posting to these pages)
2) Create HTML templates and use a database to store links to the pages so
I can dynamically render a side tab to view the latest and easily archive
them.
What would be the best approach? Any other ideas are welcome as well.

Json does not work in Django with Ajax

Json does not work in Django with Ajax

I want to make an ajax request in a Django framework. However, I don't
pass to get data from the client in json. It works when I don't use Json.
If I use dataType:'json' with a {'a': 'value'} in the ajax, I can't get it
in the view.py, the result is nothing... However if I use
data:$(this).serializeArray() in the ajax I can get result with
request.POST. However, I really need to customize my data and send to my
view.py other data than the data from the form. I would like to send a
{'a', 'mydata', 'form': myformdata}... Is there a way to do it?
template:
<form id="ajax2" action="/seghca/test-post/" method="post">{% csrf_token %}
Nom : <input type="text" name="nom" value="" id="nom"/><br/>
prenom : <input type="text" name="prenom" value=""/><br/>
<input type="submit" value="Envoyer"/>
</form>
<div id="result"></div>
javascript: $(document).ready(function(){
// POST AJAX
$("#ajax2").submit( function() {
var urlSubmit = $(this).attr('action');
var input_string = $("#nom").val();
var t = {};
$.ajax({
type: "POST",
url: urlSubmit,
dataType: "json",
data : {input :
input_string},//$(this).serializeArray(),
success: function(data) {
alert("Ajax completed");
$('#result').html(data);
}
});
return false;
});
});
view.py (the ajax launch the test_post view, home2 is the view of the
formular): from datetime import datetime from django.http import
HttpResponse, Http404 from django.shortcuts import redirect, render from
seghca.models import Article
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.template import RequestContext
import json
def home2(request):
return render_to_response('seghca/form.html',
context_instance=RequestContext(request))
def test_post(request):
if request.POST.has_key('input'):
print request.POST['input']
return HttpResponse(request.POST['input'])
else:
return HttpResponse("No input")

Decode Base64 to string

Decode Base64 to string

In my current project m displaying contents of an xml in an list view.
Some fields are endoded to base64. One field is xmlFile encodedto base64
and another string. The xml file is getting decoded correctly. But the
other is decoded to &#65533;]&#65533;d&#65533;A&#65533;&#65533;&#65533;
)&#65533; Please help/p pThanks in advance/p

Friday, 23 August 2013

Failed to open thee connection. Details:[Database Vendor Code 17] Error For crystal Report

Failed to open thee connection. Details:[Database Vendor Code 17] Error
For crystal Report

I m developing a desktop application using VB.NET. I have an error while
running the crystal reports as follows Failed to open the connection.
Details:[Database Vendor Code 17] Failed to open the connection.
temp_7acd9169-d48e-408b-aafe-e85ffafa3b28
{0CAA0D1D-CBF4-4058-A601-371F43ED0119}.rpt Details:[Database Vendor Code
17]
I haven't any idea about this Please hepl me...

Trying make a terminal shell like webpage, why this dosen't work?

Trying make a terminal shell like webpage, why this dosen't work?

I'm trying to make a terminal shell like webpage,type something in text
input field then hit enter to print it out then scroll the prompt, I have
no idea what exactly to do, so this just a very easy test, but why dosen't
it work? http://jsfiddle.net/paopaomj/qGw4Q/1/ I write it on jsfiddle, not
sure how to post embeded code on stackoverflow, so code below already has
those javascript and jquery loading statement. I'm such a newbie at
coding, so thank you for your help.
html:
<body>
<div id="output"></div>
<div id="input">
<span>root@host</span>&nbsp;
<input type="text" id="command" />
</div>
javascript:
$("command").keyup(function (e) {
if (e.keyCode == 13) {
submit();
}
});
var submit = function () {
var command = document.getElementById("command").value;
var outputel = document.getElementById("output");
var div = document.createElement("div");
div.innerHTML = "root@host " + command;
outputel.appendChild(div);
};

Can I Replace A Deleted Key In The Registry Win XP SP3?

Can I Replace A Deleted Key In The Registry Win XP SP3?

I deleted the key HKEY_LOCAL_MACHINE/SYSTEM/CONTROLSET001/SERVICES/TUNMP
in order to uninstall the Miniport Adapter but found I still couldn't
uninstall it.
the machine tells me it 'might be needed for bootup' or somesuch.
I was following these helpful instructions:
http://forums.whirlpool.net.au/forum-replies.cfm?t=2139271#r13
Now I can't even start the adapter because of the registry hole and I seem
to need it for somethings, for instance my Blaze DTV.
Can I somehow find a way to complete that uninstall?
Or Can I somehow replace this Key? This key exists in Controlset003 and 4.
Could I copy that over and have it work okay?

iOS Ad Hoc installation via TestFlight failing

iOS Ad Hoc installation via TestFlight failing

I'm getting the following error when I try to install an app via
TestFlightApp.com
"Unable to download application. "helloworld" could not be installed at
this time.
When I first got this error, I thought it might be due to Apple's
developer program being down a few weeks back, so I regenerated all my
certificates using the code signing request on my laptop, then rebuilt all
my provisioning profiles.
I then deleted all the profiles from my iPhone, and from XCode, and I
deleted TestFlight from my phone.
Then I archived the app, uploaded to test flight, gave permission to all
the devices in the profile, and sent the notification emails with the
download link.
When I try to download, the progress bar gets nearly all the way to the
end then the error pops up. This is what I see in the Console during
installation (from the iPhone Configuration Utility):
SpringBoard[67] <Warning>: Killing com.helloworldapp for app installation
installd[53] <Error>: 0x2c6000 handle_install: Install
of "/var/mobile/Media/Downloads/-2429066128781955904/-410631401396950200"
requested by itunesstored
installd[53] <Error>: 0x2c6000 MobileInstallationInstall_Server: Installing
app com.helloworldapp
installd[53] <Error>: Aug 23 11:45:37 SecTrustEvaluate
[leaf CriticalExtensions IssuerCommonName]
installd[53] <Error>: 0x2c6000 verify_signer_identity:
MISValidateSignatureAndCopyInfo failed for
/var/tmp/install_staging.a1ku9y/foo_extracted/Payload/helloworld.app/helloworld:
0xe8008017
installd[53] <Error>: 0x2c6000 do_preflight_verification: Could not verify
executable at
/var/tmp/install_staging.a1ku9y/foo_extracted/Payload/helloworld.app
installd[53] <Error>: 0x2c6000 install_application: Could not preflight
application install
itunesstored[71] <Error>: 0x183b000 MobileInstallationInstall: failed with -1
installd[53] <Error>: 0x2c6000 handle_install: API failed
So I've got brand new certificates and profiles, the profile has the
devices I'm trying to install embedded and I've given permission to those
devices in TestFlight.
I'm at a loss now, I've fixed similar problems to this in the past, so
I've run out of all my usual ideas.
And I've tried increasing the version number as well, (that's worked in
the past) but no luck.

How i can add an exception to firewall inside windows server 2008 r2

How i can add an exception to firewall inside windows server 2008 r2

i am using windows server 2008 , but when i opened the firewall setting
using firewall.cpl commnad or using Server Manager, i can not find a tab
to define exceptions. can anyone advice please..

MS SQL 2005 Client excessive memory usage

MS SQL 2005 Client excessive memory usage

Hi I inherited the support of an MS SQL 2005 server on a Windows 2003
server and its client XP workstations running MS SQL 2005 Native client.
The database is appox. 1GB in size and some of the tables contain several
thousand records.
The problem I now have is that when the client (OLEDB) applications access
the server to create an new customer for example their memory usage peaks
out at 1.23GB whilst performing the task. On some workstations they simply
run out out memory and the operation fails. I have loaded an earlier much
smaller copy of the database and when running that the memory usage is
less then 50MB. So memory creep seems to be related to number of records
in the database. What can I do on the client workstations to determine
what is using the memory and how to reduce the memory usage. Any advice
would be greatly appreciated. Many thanks. Arthur

Thursday, 22 August 2013

How to change the height and width of the master page in BIRT?

How to change the height and width of the master page in BIRT?

I have to change the height and width of the master page dynamically based
up on the parameter which i send through the URL ?

Identity in Euclidean Domain

Identity in Euclidean Domain

let A be a ring that is commutative and also has a euclidean norm function
d.Then A must have an multiplicative identity.
here d is a function from nonzero elements of A to nonnegative integers
satisfying the property: for every a and nonzero b in A there exists q and
r in A such that a=bq+r and either r=0 or d(r)

Where to wAtCh Detroit Lions vs New England Patriots Live streaming Preseason Week 3 NFL online Broadcast 2013

Where to wAtCh Detroit Lions vs New England Patriots Live streaming
Preseason Week 3 NFL online Broadcast 2013

!!!Hello NFL Fan's! Welcome To Watch Detroit Lions vs New England Patriots
live.Don't Miss Enjoy Detroit Lions vs New England Patriots Live streaming
NFL Preseason Week 3 online 2013.No Hassle, No Hidden Cost You can easily
watch here high quality online TV for watch. your favourite many games you
can watch Anytime ! Anywhere! Anyhow!. There is no hardware required,all
you need is an internet connection.
http://satellitedirectnfltv.blogspot.com/
http://satellitedirectnfltv.blogspot.com/
Now contribute and join with us by watching online TV . station is
available and will appear here on the day of the event..Enjoy the live NFL
Preseason Week 3 match Live streaming between Detroit Lions vs New England
Patriots live,Watch Detroit Lions vs New England Patriots live NFL
Preseason Week 3 this great exciting match live on your HD TV in this
site.Not only this match but also you will be able to watch full coverage
of NFL sports.Ensure that you must be 100% satisfied in out service so
don't be hesitated just click the link bellow and start watching and enjoy
more. Click Here To Watch NFL live
~~~~~ NFL Live Schedule:~~~~~ Week: Preseason Week 3 Competition: National
Football League(NFL) Team: Detroit Lions vs New England Patriots Date
:August 22,2013,Thursdayday Kick Off Time :07:30 PM (ET)
Watch Detroit Lions vs New England Patriots live You can easily find live
Detroit Lions vs New England Patriots live,Watch Detroit Lions vs New
England Patriots live Preseason Week 3 match here don't waste your time
watch and enjoy all live NFL Preseason Week 3 match. Here is live NFL TV
link Carolina vs Baltimore live, Watch Detroit Lions vs New England
Patriots live HD quality video online broadcast. Your subscription will
grant you immediate access to the most comprehensive listing of live NFL
Preseason Week 3. NFL Preseason Week 3 fees anywhere in the world where
you have access to internet connection. Detroit Lions vs New England
Patriots live Preseason Week 3,Watch Detroit Lions vs New England Patriots
live, Detroit Lions vs New England Patriots live, Watch Detroit Lions vs
New England Patriots live, Detroit Lions vs New England Patriots
live,Watch Detroit Lions vs New England Patriots live free,live streaming
NFL free, Detroit Lions vs New England Patriots live,Watch Pittsburgh vs
Washington live, Detroit Lions vs New England Patriots live,Watch Detroit
Lions vs New England Patriots live video, Pittsburgh vs Washington
live,Watch Detroit Lions vs New England Patriots livestream tv link,
Detroit Lions vs New England Patriots live,Watch Pittsburgh vs Washington
live sopcast,Watch Detroit Lions vs New England Patriots live , So, don't
miss this event Watch and enjoy the 2013 Detroit Lions vs New England
Patriots live stream online broadcast of live tv channel. In addition to
sports, you can choose between a list of over 4500 worldwide TV channels
like ABC, CBS, ESPN, FOX, NBC, TNT, BBC, CBC, Sky TV, TSN, local channels
and more. Live Stream Detroit Lions vs New England Patriots live online
NFL 2013 Video Coverage Online HD TV Broadcast

Get the weeks list between 2 dates

Get the weeks list between 2 dates

I am trying to get list of weeks between 2 dates to be like (1st week
May-2013,2nd week may-2003,.....);
I tried a lot of example with no luck.
here is my code until now
function days_between($datefrom,$dateto){
$fromday_start =
mktime(0,0,0,date("m",$datefrom),date("d",$datefrom),date("Y",$datefrom));
$diff = $dateto - $datefrom;
$days = intval( $diff / 86400 ); // 86400 / day
if( ($datefrom - $fromday_start) + ($diff % 86400) > 86400 )
$days++;
return $days;
}
function weeks_between($datefrom, $dateto)
{
$day_of_week = date("w", $datefrom);
echo $days_of_week."<br />";
$fromweek_start = $datefrom - ($day_of_week * 86400) - ($datefrom %
86400);
echo $fromweek_start."<br />";
$diff_days = days_between($datefrom, $dateto);
echo $diff_days."<br />";
$diff_weeks = intval($diff_days / 7);
echo $diff_weeks."<br />";
$seconds_left = ($diff_days % 7) * 86400;
if( ($datefrom - $fromweek_start) + $seconds_left > 604800 )
$diff_weeks ++;
return $diff_weeks;
}
echo weeks_between($_POST[Datepicker1], $_POST[Datepicker1]);// 21
any suggestion

Changing of color Buttons in android

Changing of color Buttons in android

How can i implements the buttons like this?.
http://www.sporcle.com/games/mrsiriustab/what-you-get-when-oxygen-is-a-moron
I have a game, comparing buttons from the left side and the right side.
when you click on the left side and compare it to right side and its
correct the 2 buttons must be color green.

Debugging C Linked List Program caught in infinite loop

Debugging C Linked List Program caught in infinite loop

So this is a very simple program to create and display a linked list. Here
I'm getting caught in the display loop, and I'm seeing infinite
'2->2->2->...' on screen.
After debugging, I can see that my program ALWAYS goes into the if
statement of insertNode() whereas it should only go there ONCE i.e. when
the linked list is initialized.
#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node * next;
};
struct node * head = NULL;
struct node * curr = NULL;
void insertNode(struct node * temp2) {
if (head == NULL) {
head = temp2;
head->next = NULL;
}
else {
temp2->next = head;
head = temp2;
}
}
void display() {
curr = head;
while (curr->next != NULL)
{
printf("%d->",curr->data);
curr = curr->next;
}
}
void main() {
struct node * temp = (struct node *) malloc (sizeof(struct node));
temp->data = 5;
insertNode(temp);
temp->data = 6;
insertNode(temp);
temp->data = 1;
insertNode(temp);
temp->data = 2;
insertNode(temp);
display();
}

nivo slider with sliding HTML captions

nivo slider with sliding HTML captions

I'm using nivo slider with HTML captions. Now the images slide, but the
captions just appear if the image slide. But I want the captions to be
slided with the images.
See here my nivo slider: link
I found this code, but that also slides the caption after the image has
slided. And also the direction is fixed.
I have no idea how to fix this or if this is even possible with nivo slider.
PS: I already have a working slider, buth the customer tells me that it is
not working on his computer (navigation buttons don't react). However..
It's working on all major browsers on my computer and all friends I asked.

Wednesday, 21 August 2013

Transforming SQL results in PHP into correct value for shopping cart to recognise

Transforming SQL results in PHP into correct value for shopping cart to
recognise

So I have quite a specific question and would appreciate if anyone is able
help at all. I'm trying to create a page that lists a users purchase
history for the past 3 months. I have simply stored the cart session data
into the table as their purchase for each transaction, which is each item
id X qty. For example, one entry may be '1,1,1,2,2,3,6,1' and another may
be '6,5,9,6,6'. I don't know how to retrieve the data from the table with
PHP in such a way that the code I have from the cart that details each of
the item ID's can recognise it. Below is the code I'm using to try and
create a value, and under that is the shopping cart page pasted in. All in
all, I would just like to be able to display all the retrieved items as a
user purchase history.
Thank you very very much.
$olddate = date("d/m/Y",strtotime("3 months ago"));
global $db;
$hist = "SELECT ORDITEMS FROM cust_orderc WHERE ORDDATE >
to_date('".$olddate."', 'dd/mm/yyyy')";
//$pastitem="";
$histitem = OCIParse($db, $hist);
OCIExecute($histitem);
while($row = OCIFetch($histitem)){
foreach ($row as $purchase){
$pastitem = $purchase;
}
}
echo "$pastitem";
if ($pastitem) {
$items = explode(',',$pastitem);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] +
1 : 1;
}
$output[] = '<form action="cart.php?action=update" method="post"
id="cart">';
$output[] = '<table>';
foreach ($contents as $id=>$qty) {
$sql = 'SELECT * FROM Flowers WHERE FID = '.$id;
// modified by Shang
$stmt = OCIParse($db, $sql);
if(!$stmt) {
echo "An error occurred in parsing the sql string.\n";
exit;
}
OCIExecute($stmt);
while(OCIFetch($stmt)) {
$title= OCIResult($stmt,"FCOMMON");
$image = OCIResult($stmt,"FPHOTO");
$price = OCIResult($stmt,"FPRICE");
$id = OCIResult($stmt,"FID");
}
$output[] = '<tr>';
$output[] = '<td><a href="cart.php?action=delete&id='.$id.'"
class="r">Remove</a></td>';
$output[] = '<td align="center">'.$title.' <img
src="images/'.$image.'" alt="'.$title.'"
class="cart_thumb"/></td>';
$output[] = '<td align="center">Price Each<br>AU$ '.$price.'</td>';
$output[] = '<td align="center">Quantity<input type="text"
name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3"
/></td>';
$output[] = '<td align="center">Subtotal<br>AU$ '.($price *
$qty).'</td>';
$total += $price * $qty;
$output[] = '</tr>';
}
$output[] = '</table>';
$output[] = '<p>Grand total: <strong>AU$ '.$total.'</strong></p>';
$output[] = '<div><button type="submit">Update cart</button></div>';
$output[] = '</form>';
} else {
$output[] = '<p>You shopping cart is empty.</p>';
}
return join('',$output);

sed or operator in set of regex

sed or operator in set of regex

The bash script I wrote is supposed to modify my text files. The problem
is the speed of operation. There are 4 lines of each file I want to
modify.
This is my bash script to modify all .txt files in a given folder:
srcdir="$1" //source directory
cpr=$2 //given string argument
find $srcdir -name "*.txt" | while read i; do
echo "#############################"
echo "$i"
echo "Custom string: $cpr"
echo "#############################"
# remove document name and title
sed -i 's_document=.*\/[0-9]\{10\}\(, User=team\)\?__g' $i
# remove document date
sed -i 's|document date , [0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}
[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\} MDT||g' $i
# remove document id
sed -i 's|document id = 878h67||g' $i
# replace new producer
sed_arg="-i 's|Reproduced by $cpr|john smith|g' $i"
eval sed "$sed_arg"
done
I dont know how to concatinate all my sed commands in one command or two,
so the job would be done faster ( I think! )
I have tried the OR operator for regex | but no success.

How to Increment a nvarchar value + number when more then one value is displayed for a given ID

How to Increment a nvarchar value + number when more then one value is
displayed for a given ID

I need to add a address type value to a column when more then one value is
returned from the query below. For example if a single result is returned
then I want the value in the address type column to be Business. But if
there is more then one value returned, I want it to increment a value
after the first result to be Alternate Business 1,Alternate Business 2,
Alternate Business 3 etc.
Can anyone help me out?
SELECT al.ADDRESS_ID, addr.LINE1 + ' (' + addr.LABEL + ')' AS
ModifiedLine1, addr2.ADDR_TYP_ID, addr2.LABEL, addr2.LINE2, addr2.LINE3,
addr2.CITY, addr2.STATE, addr2.COUNTRY, addr2.POSTAL_CD FROM
INT_AUX_LST_ADDR al LEFT JOIN INT_AUX_ADDRESS addr ON addr.ADDRESS_ID =
al.ADDRESS_ID LEFT JOIN INT_AUX_ADDRESS addr2 ON addr2.ADDRESS_ID =
al.ADDRESS_ID LEFT JOIN INT_RELATION_TYP rt ON rt.RLTN_TYP_ID =
al.RLTN_TYP_ID WHERE al.LISTING_ID = 1

What is the when.js equivalent of Q.js's "done()"?

What is the when.js equivalent of Q.js's "done()"?

In addition to then(), Q.js also has a done(). done() is usually called at
the end of a promise chain, like this:
promise .then(callback) .then(callback) .done(callback);
This will catch any rejections that were not handled by the previous
then()s, and it will handle any exceptions raised in then()'s callbacks.
Is there something similar in when.js? How do you handle exceptions raised
in callbacks? And what if you never register a rejection handler?

JTable in JScrollPane, how to set background?

JTable in JScrollPane, how to set background?

I am using a JScrollPane to wrap a JTable. Depending on the configuration,
there is some space that is not occupied by the table. It is drawn gray
(it looks like it is transparent and you can just see the component in the
back). How can I set this area to be a certain color?
Here is a SSCCE to illustrate.
import java.awt.Color;
import java.util.Vector;
import javax.swing.JDialog;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class DialogDemo extends JDialog {
public static void main(final String[] args) {
final DialogDemo diag = new DialogDemo();
diag.setVisible(true);
}
public DialogDemo() {
super();
setTitle("SSCCE");
final Vector<Vector<String>> rowData = new Vector<Vector<String>>();
final Vector<String> columnNames = new
VectorBuilder<String>().addCont("Property").addCont("Value");
rowData.addElement(new
VectorBuilder<String>().addCont("lorem").addCont("ipsum"));
rowData.addElement(new
VectorBuilder<String>().addCont("dolor").addCont("sit amet"));
rowData.addElement(new
VectorBuilder<String>().addCont("consectetur").addCont("adipiscing
elit."));
rowData.addElement(new
VectorBuilder<String>().addCont("Praesent").addCont("posuere..."));
final JTable table = new JTable(rowData, columnNames);
JScrollPane pane = new JScrollPane(table);
// ************* make that stuff white! *******************
table.setBackground(Color.white);
table.setOpaque(true);
pane.setBackground(Color.white);
pane.setOpaque(true);
// ************* make that stuff white! *******************
add(pane);
pack();
setLocationRelativeTo(null);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
class VectorBuilder<T> extends Vector<T> {
public VectorBuilder<T> addCont(final T elem) {
addElement(elem);
return this;
}
}
}
And here you can see the area, which I want "colorize". In the SSCCE, I
try to do that by using setOpaque(boolean) and setBackgroundColor(Color)
of the table and scroll pane, with no success.

Can you tell me, what I am doing wrong?

save not working properlly

save not working properlly

controller
userdetails.php
class Controller_Userdetails extends Controller {
public function action_index() {
$view = new View('userdetails/index');
$this->response->body($view);
}
public function action_add() {//load adddetails.php
$userdetails = new Model_Userdetails();
$view = new View('userdetails/adddetails');
$view->set("userdetails", $userdetails);
$this->response->body($view);
}
public function action_post() {//save the post data
$userdetails_id = $this->request->param('id');
$userdetails = new Model_Userdetails($userdetails_id);
$userdetails->values($_POST);
$userdetails->save();
$this->request->redirect('index.php/userdetails');
}
}
views
adddetails.php
<?php echo Form::open('userdetails/post/'.$userdetails->id); ?>
<?php echo Form::label("first_name", "First Name"); ?>
<?php echo Form::input("first_name", $userdetails->first_name); ?>
<br />
<?php echo Form::label("last_name", "Last Name"); ?>
<?php echo Form::input("last_name", $userdetails->last_name); ?>
<br />
<?php echo Form::label("email", "Email"); ?>
<?php echo Form::input("email", $userdetails->email); ?>
<br />
<?php echo Form::submit("submit", "Submit"); ?>
<?php echo Form::close(); ?>
I am trying to insert the data into database.The name and email field are
loading correctly,if i enter values and hit enter it is redirecting to
other page but objects not saved in database.Need help to solve this.

Struts 1 ExceptionHandler doesn't work for Filter

Struts 1 ExceptionHandler doesn't work for Filter

I want to define a global exception handler for the Struts 1.x web
application. I do it in the struts-config.xml like this:
<global-exceptions>
<exception
key="some.key"
type="com.example.DatabaseException"
handler="com.example.DatabaseExceptionHandler"
path="error.jsp" />
</global-exceptions>
The exception occurs in AuthenticationFilter, not in Struts Action. I
think this is the reason why DatabaseExceptionHandler is never called. But
how to overcome this limitation? I want to be able to catch all the
exceptions, not only those, raised by Struts Actions.

Tuesday, 20 August 2013

To stop finding running average once the condition fails?

To stop finding running average once the condition fails?

Consider the code below:
sub = [767220, 769287, 770167, 770276, 770791, 770835, 771926, 1196500,
1199789, 1201485, 1206331, 1206467, 1210929, 1213184, 1213204,
1213221, 1361867, 1361921, 1361949, 1364886, 1367224, 1368005, 1368456,
1368982, 1369000, 1370365, 1370434, 1370551, 1371492, 1471407, 1709408,
1710264, 1710308, 1710322, 1710350, 1710365, 1710375]
avg = []; final = []
def runningMean(seq, n=0, total=0): #fuction called recursively
if not seq:
return []
total =total+int(seq[-1])
return runningMean(seq[:-1], n=n+1, total=total) + [total/float(n+1)]
def main():
avg = runningMean(sub,n = 0,total = 0) #fuction call to obtain running
mean starting from last element in the list i,e 1710375
print avg
for i in range(len(sub)):
if (int(sub[i]) > float(avg[i] * 0.9)): #cheking the condition
final.append(sub[i])
print final
if __name__ == '__main__':
main()
output consists of list of runningmean & the sub list doesn't statisfy the
condition :
[1282960.6216216215, 1297286.75, 1312372.4571428571, 1328319.6764705882,
1345230.0909090908, 1363181.3125, 1382289.2580645161, 1402634.7,
1409742.7931034483, 1417241.142857143, 1425232.111111111,
1433651.3846153845, 1442738.76, 1452397.5, 1462798.0869565217,
1474143.2727272727, 1486568.142857143, 1492803.2, 1499691.7368421052,
1507344.111111111, 1515724.0, 1525005.25, 1535471.9333333333,
1547401.642857143, 1561126.2307692308, 1577136.75, 1595934.1818181819,
1618484.2, 1646032.3333333333, 1680349.875, 1710198.857142857,
1710330.6666666667, 1710344.0, 1710353.0, 1710363.3333333333, 1710370.0,
1710375.0]
[1361867, 1361921, 1361949, 1364886, 1367224, 1709408, 1710264, 1710308,
1710322, 1710350, 1710365, 1710375]
What i need to do is it should stop the finding of running average once
the condition fails (sub[i] > float(avg[i] * 0.9)) i,e the result should
be
[1680349.875, 1710198.857142857, 1710330.6666666667, 1710344.0,
1710353.0, 1710363.3333333333, 1710370.0, 1710375.0]
[1709408, 1710264, 1710308, 1710322, 1710350, 1710365, 1710375]
If anyone could suggest a solution in python for this it will be
helpful..........

Android blur background Such as Core Image?

Android blur background Such as Core Image?

I am of the view I want to handle blur background. As well as a
transparent state.
The view behind the blur is handled naturally blur the image or text, and
I want to be treated.
iOS core image on the screen to change the background, Process or blur a
Bitmap, Android, or blur the whole process Activity (now Deprecated) as to
background blur on the screen is coated wondering if there is a way.
Using NDK import an image blur in the back knows how to handle.

Calling javascript within Chrome from C#

Calling javascript within Chrome from C#

We have a .net (C#) application that launches an accompanying web page in
an external browser window, and then needs to communicate with that page
via javascript.
We have successfully done this with Internet Explorer, using
mshtml.HTMLDocument. We iterate over the ShellWindows to find the open
Internet Explorer window, and then can do something like the following:
mshtml.HTMLDocument doc = iExplorer.Document;
mshtml.IHTMLWindow2 win = doc.parentWindow as mshtml.IHTMLWindow2;
win.execScript("myJavaScriptFunction('arg1','arg2')", "javascript");
Is there an equivalent way to do this with Chrome? We can find the Chrome
window, but is there an equivalent API we can call into to execute
javascript on the desired page?

MySQL query stucks with state "Sending Data"

MySQL query stucks with state "Sending Data"

I have following MySQL query which is stucked with state "Sending Data"
and running from past 14 hours. Query has 3 parts. First part is a self
join on table AGG_EI which fetches DISTINCT combination of
uuid,cmp_id,lTypeId for the max date. Second part fetches
uuid,cmp_id,lType_id,date from table CUL. First and second part are joined
and stored in a temporary table. Third part selects data from temporary
table and stores in CUL table. AGG_EI table has 4.5 million
records(duplicate uuid,cmp_id,lTypeId,date combination with other columns
not used in query) and CUL has 0.7 million records(unique combination of
uuid,cmp_id,lTypeId,date)
CREATE TEMPORARY TABLE IF NOT EXISTS temp_lt
SELECT cLType.uuid AS uuid,
cLType.cmp_id AS cmp_id,
cLType.lTypeId AS lTypeId,
(CASE WHEN cLType.lTypeId = eLType.lTypeId THEN eLType.lFrom
WHEN eLType.lFrom IS NULL THEN DATE_FORMAT(now(),'%Y%m%d')
ELSE cLType.lFrom END) AS lFrom
FROM
(
SELECT DISTINCT d1.ei_uuid AS uuid,
d1.cmp_id AS cmp_id,
d1.ei_type AS lTypeId,
d1.datedm_id AS lFrom
FROM AGG_EI d1
LEFT OUTER JOIN AGG_EI d2
ON (d1.ei_uuid = d2.ei_uuid
AND d1.cmp_id = d2.cmp_id
AND d1.datedm_id <
d2.datedm_id )
WHERE d2.ei_uuid IS NULL AND d2.cmp_id IS NULL
) AS cLType
LEFT OUTER JOIN
(
SELECT uuid AS uuid,
cmp_id AS cmp_id,
ei_type AS lTypeId,
lFrom AS lFrom
FROM
CUL
) AS eLType
ON cLType.uuid = eLType.uuid AND cLType.cmp_id = eLType.cmp_id;
INSERT INTO `CUL` (`uuid`,`cmp_id`,`ei_type`,`lFrom`)
SELECT uuid,cmp_id,lTypeId,lFrom FROM temp_lt;
Why does this query gets stucked at state "sending data"

Evaluating the bounds of integral

Evaluating the bounds of integral

Given that $$f(x)\leq
C\epsilon^{-1}\int^1_x(1+\epsilon^{-k}e^{-\alpha(1-t)/\epsilon})e^{-\alpha(t-x)/\epsilon}dt.$$
I want to show that $$f(x)\leq
C(1+\epsilon^{-(k+1)}e^{-\alpha(1-x)/\epsilon}).$$On evaluating the
integral I get $$f(x)\leq
C\left(\epsilon(1-e^{-\alpha(1-x)/\epsilon})/\alpha+(1-x)\epsilon^{-k}e^{-\alpha(1-x)/\epsilon}\right)$$How
do I proceed?

date returned from dateFromString method

date returned from dateFromString method

Please help me solve the problem.
(The values for objValidation.aRange.MinimumValue,
objValidation.aRange.MaximumValue come from web services)
(I am getting wrong dates in firstDate, secondDate.)
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"MM/dd/yyyy"];
[df setTimeZone:[NSTimeZone localTimeZone]];
NSDate *myDate = [df dateFromString:inputString];
[df setDateFormat:@"MM/dd/yyyy"];
NSLog(@"objValidation.aRange.MinimumValue :
%@,objValidation.aRange.MaximumValue :%@, inputString :
%@",objValidation.aRange.MinimumValue,objValidation.aRange.MaximumValue,inputString);
NSDate *firstDate = [df
dateFromString:objValidation.aRange.MinimumValue];
NSDate *secondDate = [df
dateFromString:objValidation.aRange.MaximumValue];
NSLog(@"myDate : %@,firstDate :%@, secondDate :
%@",myDate,firstDate,secondDate);
[df release];

Implementing Dragable Pushpin in windows phone 8

Implementing Dragable Pushpin in windows phone 8

How can i implement dragable pushpin in windows phone 8 Bing map
application. Is there any in built method is available for implementing
this in windows phone 8.

Monday, 19 August 2013

database "CREATE TABLE IF NOT EXISTS" syntax error

database "CREATE TABLE IF NOT EXISTS" syntax error

My code contains a database class.While running it shows an error
regarding with the CREATE TABLE IF NOT EXISTS statement.please the give me
the solution to correct the error.
clasdbOpenHelper.java
package example.events1;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class classdbOpenHelper extends SQLiteOpenHelper {
public static final String KEY_ROWID = "_id";
public static final String KEY_DESC = "countdesc";
public static final String KEY_DATE = "countdate";
public static final String KEY_EVENT = "countevent";
public static final String DATABASE_NAME= "countdb";
public static final String DATABASE_TABLE = "countable";
public static final int DATABASE_VERSION = 1;
public classdbOpenHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_CONTACTS_TABLE = "CREATE TABLE IF NOT EXISTS" +
DATABASE_TABLE + "("
+ KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
KEY_DESC + " TEXT, " + KEY_DATE + " TEXT, " + KEY_EVENT +
" TEXT )";
db.execSQL(CREATE_CONTACTS_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
// TODO Auto-generated method stub
db.execSQL("DROP TABLE IF EXITS " + DATABASE_TABLE);
onCreate(db);
}
public Cursor fetchAllEvents() {
SQLiteDatabase db = this.getReadableDatabase();
Cursor mCursor = db.query(DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_DESC, KEY_DATE, KEY_EVENT },
null, null, null, null, null );
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
public Cursor fetchEventByName(String inputText,String datevalue )
throws SQLException {
SQLiteDatabase db = this.getReadableDatabase();
Cursor mCursor = null;
if (inputText == null || inputText.length () == 0) {
mCursor = db.query(DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_DESC, KEY_DATE, KEY_EVENT },
null, null, null, null, null);
}
else {
mCursor = db.rawQuery("SELECT * FROM countable WHERE
countdesc = ? AND countdate = ?", new String[]
{inputText,datevalue});
}
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
public void delete(long id) {
SQLiteDatabase db = this.getReadableDatabase();
db.delete(DATABASE_TABLE, KEY_ROWID + " = ?",
new String[] { String.valueOf(id )});
db.close();
}
}
logcat
08-20 04:32:26.411: E/SQLiteLog(839): (1) near "EXISTScountable": syntax
error
08-20 04:32:26.681: E/AndroidRuntime(839): FATAL EXCEPTION: main
08-20 04:32:26.681: E/AndroidRuntime(839): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{example.events1/example.events1.Getclicker}:
android.database.sqlite.SQLiteException: near "EXISTScountable": syntax
error (code 1): , while compiling: CREATE TABLE IF NOT EXISTScountable(_id
INTEGER PRIMARY KEY AUTOINCREMENT, countdesc TEXT, countdate TEXT,
countevent TEXT )
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.os.Looper.loop(Looper.java:137)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.ActivityThread.main(ActivityThread.java:5041)
08-20 04:32:26.681: E/AndroidRuntime(839): at
java.lang.reflect.Method.invokeNative(Native Method)
08-20 04:32:26.681: E/AndroidRuntime(839): at
java.lang.reflect.Method.invoke(Method.java:511)
08-20 04:32:26.681: E/AndroidRuntime(839): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-20 04:32:26.681: E/AndroidRuntime(839): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-20 04:32:26.681: E/AndroidRuntime(839): at
dalvik.system.NativeStart.main(Native Method)
08-20 04:32:26.681: E/AndroidRuntime(839): Caused by:
android.database.sqlite.SQLiteException: near "EXISTScountable": syntax
error (code 1): , while compiling: CREATE TABLE IF NOT EXISTScountable(_id
INTEGER PRIMARY KEY AUTOINCREMENT, countdesc TEXT, countdate TEXT,
countevent TEXT )
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native
Method)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1663)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594)
08-20 04:32:26.681: E/AndroidRuntime(839): at
example.events1.classdbOpenHelper.onCreate(classdbOpenHelper.java:31)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
08-20 04:32:26.681: E/AndroidRuntime(839): at
example.events1.classdbOpenHelper.fetchEventByName(classdbOpenHelper.java:57)
08-20 04:32:26.681: E/AndroidRuntime(839): at
example.events1.Getclicker.onCreate(Getclicker.java:36)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.Activity.performCreate(Activity.java:5104)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-20 04:32:26.681: E/AndroidRuntime(839): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
08-20 04:32:26.681: E/AndroidRuntime(839): ... 11 more