How to work with excel files in Node.js
I am new in Node.js development and i don't know how to import excel file
in Node.js. And how to display excel data in browser any help related to
this will be appreciated Thanks.
Bokman
Thursday, 3 October 2013
Wednesday, 2 October 2013
JQuery doesnt work on content loaded into popover using ajax
JQuery doesnt work on content loaded into popover using ajax
I have a button that is responsible for displaying a users pending friend
requests on click. When the button is clicked it triggers a popover which
is filled with a feed of pending friend requests using ajax.I got this far
without any problems, but for some reason I cant get any jquery to work on
the ajax/popover content. So I have 2 questions :
Is there some special trick to getting jquery to work on content loaded
using ajax that wasnt there when when the page is initially loaded?
If your loading content into a popover as i am where should I place the
link to the .js file that contains the jquery i would like triggered when
a user presses a button inside the ajax/popover? Does it go in the parent
or the child file that is being loaded via ajax when the friend request
button is pressed?
I have a button that is responsible for displaying a users pending friend
requests on click. When the button is clicked it triggers a popover which
is filled with a feed of pending friend requests using ajax.I got this far
without any problems, but for some reason I cant get any jquery to work on
the ajax/popover content. So I have 2 questions :
Is there some special trick to getting jquery to work on content loaded
using ajax that wasnt there when when the page is initially loaded?
If your loading content into a popover as i am where should I place the
link to the .js file that contains the jquery i would like triggered when
a user presses a button inside the ajax/popover? Does it go in the parent
or the child file that is being loaded via ajax when the friend request
button is pressed?
Merge dataframes based on overlapping genomic ranges
Merge dataframes based on overlapping genomic ranges
I have two files:
anno
chromosome position functionGVS
1 chr22 16050036 intergenic
2 chr22 16050039 intergenic
3 chr22 16050094 intergenic
4 chr22 16050097 intergenic
5 chr22 16050109 intergenic
6 chr22 16050115 intergenic
huvec
chr start end function
1 chr22 16050000 16051244 R
2 chr22 16051244 16051521 T
3 chr22 16051521 16060433 R
4 chr22 16060433 16060582 T
5 chr22 16060582 16080564 R
6 chr22 16080564 16082420 T
I am trying to find overlapping regions such that the anno$position should
fall within the range of huvec$start & huvec$end. Here is my code:
gr.huvec = with(huvec, GRanges(V1, IRanges(start=V2,end=V3)))
gr.anno <- GRanges(seqnames=anno$chromosome,
ranges=IRanges(start=anno$position, width=1))
hits = findOverlaps(gr.huvec,gr.anno)
My question is that now, after I have the query hits & subject hits, how
can I assign huvec$function to anno based on overlapping regions. So in my
case, each position in anno$position overlaps with the first start & end
values of huvec and so I want to assign the associated huvec$function i.e.
'R' to a new column in anno. Any suggestions?
I have two files:
anno
chromosome position functionGVS
1 chr22 16050036 intergenic
2 chr22 16050039 intergenic
3 chr22 16050094 intergenic
4 chr22 16050097 intergenic
5 chr22 16050109 intergenic
6 chr22 16050115 intergenic
huvec
chr start end function
1 chr22 16050000 16051244 R
2 chr22 16051244 16051521 T
3 chr22 16051521 16060433 R
4 chr22 16060433 16060582 T
5 chr22 16060582 16080564 R
6 chr22 16080564 16082420 T
I am trying to find overlapping regions such that the anno$position should
fall within the range of huvec$start & huvec$end. Here is my code:
gr.huvec = with(huvec, GRanges(V1, IRanges(start=V2,end=V3)))
gr.anno <- GRanges(seqnames=anno$chromosome,
ranges=IRanges(start=anno$position, width=1))
hits = findOverlaps(gr.huvec,gr.anno)
My question is that now, after I have the query hits & subject hits, how
can I assign huvec$function to anno based on overlapping regions. So in my
case, each position in anno$position overlaps with the first start & end
values of huvec and so I want to assign the associated huvec$function i.e.
'R' to a new column in anno. Any suggestions?
Shiro subject on HttpSession
Shiro subject on HttpSession
I'm using Shiro on my application layer which is served trough web
requests. I think SecurityUtils.getSubject won't work as expected as I
want to save the current subject through different requests, and I don't
want to use Shiro Web utils, because I would like to dettach my
Application Layer from the way it is served( I would later build a GUI to
access it ).
So, can I, for example, return from my application layer the Subject
instance, to be saved by the client in an HttpSession or whenever it
wants, and retrieve it at a later time to avoid having to re-authenticate
it?
I'm using Shiro on my application layer which is served trough web
requests. I think SecurityUtils.getSubject won't work as expected as I
want to save the current subject through different requests, and I don't
want to use Shiro Web utils, because I would like to dettach my
Application Layer from the way it is served( I would later build a GUI to
access it ).
So, can I, for example, return from my application layer the Subject
instance, to be saved by the client in an HttpSession or whenever it
wants, and retrieve it at a later time to avoid having to re-authenticate
it?
Split string in numbering
Split string in numbering
i want to ask a question. I have a text file of list of commands:
1. eat, food
7am
2. brush, teeth
8am
3. crack, eggs
1pm
How can we get:
"eat, food\n7am"
"brush, teeth\n8am"
"crack, eggs\n1pm"
I'm trying to use the classic split(), but so far i haven't figured out
how to get rid of the numbers.. Any suggestions?
i want to ask a question. I have a text file of list of commands:
1. eat, food
7am
2. brush, teeth
8am
3. crack, eggs
1pm
How can we get:
"eat, food\n7am"
"brush, teeth\n8am"
"crack, eggs\n1pm"
I'm trying to use the classic split(), but so far i haven't figured out
how to get rid of the numbers.. Any suggestions?
Tuesday, 1 October 2013
Creating calculator with Python
Creating calculator with Python
I have a task where I have to make simple python calculator using python
and I'm a bit stuck here. My calculator doesn't seem to work when I use
the equals button,it's not registering when I click it and it's not adding
or subtracting the two numbers. Any help would be great. This is my code
so far:
from tkinter import *
import tkinter.messagebox as mb
class NumberButton(Button):
def __init__(self, parent, number, display):
Button.__init__(self, parent, text=number, command=self.fillDisplay)
self.value = number
self.display = display
def fillDisplay(self):
curr_value = self.display.get()
if curr_value == '0':
new_value = str(self.value)
elif curr_value == '+':
new_value = ''.join([curr_value, str(self.value)])
else:
new_value = ''.join([curr_value, str(self.value)])
self.display.delete(0, END)
self.display.insert(0, new_value)
class ArithmeticButton(Button):
def __init__(self, parent, value, display):
Button.__init__(self, parent, text=value, command=self.doArithmetic)
self.display = display
self.value = value
def doArithmetic(self):
old_value = self.display.get()
if len(old_value) > 3:
mb.showinfo("Warning!", "This calculator cannot deal with numbers over 3
digits!")
else:
self.display.delete(0, END)
self.display.insert(0, self.value)
def explain():
mb.showinfo("Info", "This is a simple calculator interface which can add
and subtract values up to 999.")
def clearDisplay():
EntryBox.delete(0, END)
EntryBox.insert(0, '0')
root = Tk()
root.geometry("175x140")
root.title("Calculator")
menubar = Menu(root)
menubar.add_command(label="Info", command=explain)
EntryBox = Entry(root, width=7)
EntryBox.grid(row=0, columnspan=3)
EntryBox.insert(0, '0')
number = dict()
number[0] = NumberButton(root, 0, EntryBox).grid(row=4, sticky=W)
for x in range(7, 10):
number[x] = NumberButton(root, x, EntryBox).grid(row=1, column=(x-7),
sticky=W)
for x in range(4, 7):
number[x] = NumberButton(root, x, EntryBox).grid(row=2, column=(x-4),
sticky=W)
for x in range(1, 4):
number[x] = NumberButton(root, x, EntryBox).grid(row=3, column=(x-1),
sticky=W)
ArithmeticButton(root, "+", EntryBox).grid(row=4, column=2, sticky=W)
ArithmeticButton(root, "-", EntryBox).grid(row=4, column=1, sticky=W)
Button(root, text="=").grid(row=0, column=5, rowspan=2, columnspan=2,
stick=S)
Button(root, text="Clear", height=2, command=clearDisplay).grid(row=2,
column=5, rowspan=2, columnspan=2, stick=N)
root.config(menu=menubar)
mainloop()
I have a task where I have to make simple python calculator using python
and I'm a bit stuck here. My calculator doesn't seem to work when I use
the equals button,it's not registering when I click it and it's not adding
or subtracting the two numbers. Any help would be great. This is my code
so far:
from tkinter import *
import tkinter.messagebox as mb
class NumberButton(Button):
def __init__(self, parent, number, display):
Button.__init__(self, parent, text=number, command=self.fillDisplay)
self.value = number
self.display = display
def fillDisplay(self):
curr_value = self.display.get()
if curr_value == '0':
new_value = str(self.value)
elif curr_value == '+':
new_value = ''.join([curr_value, str(self.value)])
else:
new_value = ''.join([curr_value, str(self.value)])
self.display.delete(0, END)
self.display.insert(0, new_value)
class ArithmeticButton(Button):
def __init__(self, parent, value, display):
Button.__init__(self, parent, text=value, command=self.doArithmetic)
self.display = display
self.value = value
def doArithmetic(self):
old_value = self.display.get()
if len(old_value) > 3:
mb.showinfo("Warning!", "This calculator cannot deal with numbers over 3
digits!")
else:
self.display.delete(0, END)
self.display.insert(0, self.value)
def explain():
mb.showinfo("Info", "This is a simple calculator interface which can add
and subtract values up to 999.")
def clearDisplay():
EntryBox.delete(0, END)
EntryBox.insert(0, '0')
root = Tk()
root.geometry("175x140")
root.title("Calculator")
menubar = Menu(root)
menubar.add_command(label="Info", command=explain)
EntryBox = Entry(root, width=7)
EntryBox.grid(row=0, columnspan=3)
EntryBox.insert(0, '0')
number = dict()
number[0] = NumberButton(root, 0, EntryBox).grid(row=4, sticky=W)
for x in range(7, 10):
number[x] = NumberButton(root, x, EntryBox).grid(row=1, column=(x-7),
sticky=W)
for x in range(4, 7):
number[x] = NumberButton(root, x, EntryBox).grid(row=2, column=(x-4),
sticky=W)
for x in range(1, 4):
number[x] = NumberButton(root, x, EntryBox).grid(row=3, column=(x-1),
sticky=W)
ArithmeticButton(root, "+", EntryBox).grid(row=4, column=2, sticky=W)
ArithmeticButton(root, "-", EntryBox).grid(row=4, column=1, sticky=W)
Button(root, text="=").grid(row=0, column=5, rowspan=2, columnspan=2,
stick=S)
Button(root, text="Clear", height=2, command=clearDisplay).grid(row=2,
column=5, rowspan=2, columnspan=2, stick=N)
root.config(menu=menubar)
mainloop()
Limiting the output of specific column sql hana
Limiting the output of specific column sql hana
I have a table structure as given below and what I'd like to be able to do
is retrieve the top three records with the highest value for each Company
code.
I've googled and I couldn't find a better way so hopefully you guys can
help me out.
By the way, I'm attempting this in MySQL and SAP HANA. But I am hoping
that I can grab the "structure" if the query for HANA if I can get help
for only MySQL
Thanks much!
Here's the table:
¨X¨T¨T¨T¨T¨T¨T¨T¨T¨T¨j¨T¨T¨T¨T¨T¨T¨T¨j¨T¨T¨T¨T¨T¨T¨T¨[
¨U Company ¨U Plant ¨U Value ¨U
¨d¨T¨T¨T¨T¨T¨T¨T¨T¨T¨p¨T¨T¨T¨T¨T¨T¨T¨p¨T¨T¨T¨T¨T¨T¨T¨g
¨U 1 ¨U A ¨U 3 ¨U
¨U 1 ¨U B ¨U 4 ¨U
¨U 1 ¨U C ¨U 5 ¨U
¨U 1 ¨U D ¨U 2 ¨U
¨U 1 ¨U E ¨U 3 ¨U
¨U 1 ¨U F ¨U 1 ¨U
¨U 1 ¨U G ¨U 3 ¨U
¨U 2 ¨U A ¨U 1 ¨U
¨U 2 ¨U B ¨U 2 ¨U
¨U 2 ¨U C ¨U 5 ¨U
¨U 2 ¨U D ¨U 3 ¨U
¨U 2 ¨U E ¨U 2 ¨U
¨U 2 ¨U F ¨U 2 ¨U
¨U 2 ¨U G ¨U 6 ¨U
¨U 3 ¨U A ¨U 7 ¨U
¨U 3 ¨U B ¨U 3 ¨U
¨U 3 ¨U C ¨U 1 ¨U
¨U 3 ¨U D ¨U 2 ¨U
¨U 3 ¨U E ¨U 8 ¨U
¨U 3 ¨U F ¨U 2 ¨U
¨U 3 ¨U G ¨U 3 ¨U
¨^¨T¨T¨T¨T¨T¨T¨T¨T¨T¨m¨T¨T¨T¨T¨T¨T¨T¨m¨T¨T¨T¨T¨T¨T¨T¨a
I have a table structure as given below and what I'd like to be able to do
is retrieve the top three records with the highest value for each Company
code.
I've googled and I couldn't find a better way so hopefully you guys can
help me out.
By the way, I'm attempting this in MySQL and SAP HANA. But I am hoping
that I can grab the "structure" if the query for HANA if I can get help
for only MySQL
Thanks much!
Here's the table:
¨X¨T¨T¨T¨T¨T¨T¨T¨T¨T¨j¨T¨T¨T¨T¨T¨T¨T¨j¨T¨T¨T¨T¨T¨T¨T¨[
¨U Company ¨U Plant ¨U Value ¨U
¨d¨T¨T¨T¨T¨T¨T¨T¨T¨T¨p¨T¨T¨T¨T¨T¨T¨T¨p¨T¨T¨T¨T¨T¨T¨T¨g
¨U 1 ¨U A ¨U 3 ¨U
¨U 1 ¨U B ¨U 4 ¨U
¨U 1 ¨U C ¨U 5 ¨U
¨U 1 ¨U D ¨U 2 ¨U
¨U 1 ¨U E ¨U 3 ¨U
¨U 1 ¨U F ¨U 1 ¨U
¨U 1 ¨U G ¨U 3 ¨U
¨U 2 ¨U A ¨U 1 ¨U
¨U 2 ¨U B ¨U 2 ¨U
¨U 2 ¨U C ¨U 5 ¨U
¨U 2 ¨U D ¨U 3 ¨U
¨U 2 ¨U E ¨U 2 ¨U
¨U 2 ¨U F ¨U 2 ¨U
¨U 2 ¨U G ¨U 6 ¨U
¨U 3 ¨U A ¨U 7 ¨U
¨U 3 ¨U B ¨U 3 ¨U
¨U 3 ¨U C ¨U 1 ¨U
¨U 3 ¨U D ¨U 2 ¨U
¨U 3 ¨U E ¨U 8 ¨U
¨U 3 ¨U F ¨U 2 ¨U
¨U 3 ¨U G ¨U 3 ¨U
¨^¨T¨T¨T¨T¨T¨T¨T¨T¨T¨m¨T¨T¨T¨T¨T¨T¨T¨m¨T¨T¨T¨T¨T¨T¨T¨a
Subscribe to:
Comments (Atom)