Static member modification in const member function in C++
I am working on linked-list but can't modifying the value of current
pointer in const function "void Print() const"
Here in print function i want to do "current= head" & then increment like
"current=current->link" but can't do so, bcz it is showing that
"error C3490: 'current' cannot be modified because it is being accessed
through a const object e:\Cpp\projects\data structure ass-1\data structure
ass-1\source.cpp 83 1 Data Structure Ass-1 "
#include<iostream>
struct node
{
int data;
node *link;
};
class List
{
node *head,*current,*last;
public:
List();
// List(const List&);
// ~List();
void print() const;
};
using namespace std;
int main()
{
List List1;
}
void List::print() const
{
current=head; //here is my error
current=current->link;
}
List::List():current(head)
{
}
Saturday, 31 August 2013
How would i create an array of object reference Variables?
How would i create an array of object reference Variables?
So i'm working on a program in Java, and whenever i run it, i get an error
"Exception in thread "main" java.lang.NullPointerException". When i look
at it closely, it appears that its caused by array of Reference Variables.
Here's the code causing the problem:
public class agendafunctions {
static String input = "true";
agendaitem item[] = new agendaitem[5];
public agendafunctions() {
item[0].name = "one";
item[1].name = "two";
item[2].name = "three";
item[3].name = "four";
item[4].name = "five";
}
name is a variable in class agendaitem. From what i've read elsewhere, the
error is caused by the program trying to use variables with a null value.
But when i add a value, it says it can't convert from String or whatever
to type agendaitem. Can anyone help?
So i'm working on a program in Java, and whenever i run it, i get an error
"Exception in thread "main" java.lang.NullPointerException". When i look
at it closely, it appears that its caused by array of Reference Variables.
Here's the code causing the problem:
public class agendafunctions {
static String input = "true";
agendaitem item[] = new agendaitem[5];
public agendafunctions() {
item[0].name = "one";
item[1].name = "two";
item[2].name = "three";
item[3].name = "four";
item[4].name = "five";
}
name is a variable in class agendaitem. From what i've read elsewhere, the
error is caused by the program trying to use variables with a null value.
But when i add a value, it says it can't convert from String or whatever
to type agendaitem. Can anyone help?
How do you add mysql-connector-java-5.1.26 to Eclipse Android Developer Tools
How do you add mysql-connector-java-5.1.26 to Eclipse Android Developer Tools
I want the following line of code to work in Eclipse Java but apparently I
need to import/add mysql-connector-java-5.1.26 to my eclipse android
project so I can send a mySQL query via an android device.
Class.forName("com.mysql.jdbc.Driver");
How can I add the mySQL library to a current project? I've seen other
tutorials about doing this here at stack overflow but they've been kind of
unspecific and just say "just ADD it to your current project" but that's
where I'm stumped.
Most tutorials online just tell you how to start a new project from
scratch, but I'm working with an android application.
Do I go to File>Import? and then select the .zip with the mySQL files? Or
do I select the folder or something? I'm doing this on a Mac.
Thanks.
I want the following line of code to work in Eclipse Java but apparently I
need to import/add mysql-connector-java-5.1.26 to my eclipse android
project so I can send a mySQL query via an android device.
Class.forName("com.mysql.jdbc.Driver");
How can I add the mySQL library to a current project? I've seen other
tutorials about doing this here at stack overflow but they've been kind of
unspecific and just say "just ADD it to your current project" but that's
where I'm stumped.
Most tutorials online just tell you how to start a new project from
scratch, but I'm working with an android application.
Do I go to File>Import? and then select the .zip with the mySQL files? Or
do I select the folder or something? I'm doing this on a Mac.
Thanks.
Using exceptions for control flow
Using exceptions for control flow
I have read that using exceptions for control flow is not good, but how
can I achieve the following easily without throwing exceptions? So if user
enters username that is already in use, I want to show error message next
to the input field. Here is code from my sign up page:
public String signUp() {
User user = new User(username, password, email);
try {
if ( userService.save(user) != null ) {
// ok
}
else {
// not ok
}
}
catch ( UsernameInUseException e ) {
// notify user that username is already in use
}
catch ( EmailInUseException e ) {
// notify user that email is already in use
}
catch ( DataAccessException e ) {
// notify user about db error
}
return "index";
}
save method of my userService:
@Override
@Transactional
public User save(User user) {
if ( userRepository.findByUsername(user.getUsername()) != null ) {
LOGGER.debug("Username '{}' is already in use", user.getUsername());
throw new UsernameInUseException();
}
else if ( userRepository.findByEmail(user.getEmail()) != null ) {
LOGGER.debug("Email '{}' is already in use", user.getEmail());
throw new EmailInUseException();
}
user.setPassword(BCrypt.hashpw(user.getPassword(), BCrypt.gensalt()));
user.setRegisteredOn(DateTime.now(DateTimeZone.UTC));
return userRepository.save(user);
}
I have read that using exceptions for control flow is not good, but how
can I achieve the following easily without throwing exceptions? So if user
enters username that is already in use, I want to show error message next
to the input field. Here is code from my sign up page:
public String signUp() {
User user = new User(username, password, email);
try {
if ( userService.save(user) != null ) {
// ok
}
else {
// not ok
}
}
catch ( UsernameInUseException e ) {
// notify user that username is already in use
}
catch ( EmailInUseException e ) {
// notify user that email is already in use
}
catch ( DataAccessException e ) {
// notify user about db error
}
return "index";
}
save method of my userService:
@Override
@Transactional
public User save(User user) {
if ( userRepository.findByUsername(user.getUsername()) != null ) {
LOGGER.debug("Username '{}' is already in use", user.getUsername());
throw new UsernameInUseException();
}
else if ( userRepository.findByEmail(user.getEmail()) != null ) {
LOGGER.debug("Email '{}' is already in use", user.getEmail());
throw new EmailInUseException();
}
user.setPassword(BCrypt.hashpw(user.getPassword(), BCrypt.gensalt()));
user.setRegisteredOn(DateTime.now(DateTimeZone.UTC));
return userRepository.save(user);
}
sphinx returns less matches in comparison a sql like search
sphinx returns less matches in comparison a sql like search
im using Sphinx to make searchs in my web, but i have a thing, when i
search in phpmyadmin using
LIKE '%19.628%'
returns the data that im looking for (8 matches), but when i use the
sphinx returns less matches (3 matches) in comparison a sql LIKE search.
here the PHP code
$sp->SetMatchMode(SPH_MATCH_ANY);
$sp->SetArrayResult(true);
$sp->SetLimits(0,1000000);
$results = $sp->Query($query, 'data_base');
why?
regards
im using Sphinx to make searchs in my web, but i have a thing, when i
search in phpmyadmin using
LIKE '%19.628%'
returns the data that im looking for (8 matches), but when i use the
sphinx returns less matches (3 matches) in comparison a sql LIKE search.
here the PHP code
$sp->SetMatchMode(SPH_MATCH_ANY);
$sp->SetArrayResult(true);
$sp->SetLimits(0,1000000);
$results = $sp->Query($query, 'data_base');
why?
regards
Getting "This QueryDict instance is immutable" on one Django view but not another
Getting "This QueryDict instance is immutable" on one Django view but not
another
I have two views, one that is working fine when I try to add to the POST
data when a form is not valid, another that gives me a "This QueryDict
instance is immutable" error when trying to do the same thing. I know
these views are too similar to exist in the first place and plan on
combining them... but would like to first understand what is the
difference that makes one of them fail.
This view works fine:
@login_required
def url_parse(request):
cu = request.user
if request.method == 'POST':
form = UrlBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.url = form.cleaned_data['url']
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = UrlBragForm()
return render_to_response('brag/url_brag.html', {'form':form,},
context_instance=RequestContext(request))
But this view gives me a "This QueryDict instance is immutable" when
trying to fill the request.POST['brag'] with the 'clean' data when view is
not valid:
@login_required
def brag_add_image(request):
cu = request.user
if request.method == 'POST':
form = ImageAddBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
b.url = 'http://%s%s' %
(Site.objects.get_current().domain,
reverse('image_display', args=(b.pk,)))
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = ImageAddBragForm()
return render_to_response('brag/image_brag_add.html', {'form':form,},
context_instance=RequestContext(request))
another
I have two views, one that is working fine when I try to add to the POST
data when a form is not valid, another that gives me a "This QueryDict
instance is immutable" error when trying to do the same thing. I know
these views are too similar to exist in the first place and plan on
combining them... but would like to first understand what is the
difference that makes one of them fail.
This view works fine:
@login_required
def url_parse(request):
cu = request.user
if request.method == 'POST':
form = UrlBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.url = form.cleaned_data['url']
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = UrlBragForm()
return render_to_response('brag/url_brag.html', {'form':form,},
context_instance=RequestContext(request))
But this view gives me a "This QueryDict instance is immutable" when
trying to fill the request.POST['brag'] with the 'clean' data when view is
not valid:
@login_required
def brag_add_image(request):
cu = request.user
if request.method == 'POST':
form = ImageAddBragForm(request.POST, request.FILES)
if form.is_valid():
t = handle_image_upload(form.cleaned_data['image'],cu.pk,'url')
if t:
b = Brag()
b.user = cu
b.image = t
b.description = form.cleaned_data['brag']
b.active = True
b.timestamp = time.time()
b.save()
b.url = 'http://%s%s' %
(Site.objects.get_current().domain,
reverse('image_display', args=(b.pk,)))
b.save()
tags = parse_tags(form.cleaned_data['brag'])
if tags:
for tg in tags:
b.tags.add(tg)
else:
errors = form._errors.setdefault("image", ErrorList())
errors.append(u"There was an issue with your image.
Please try again.")
else:
clean = cleanMessage(request.POST['brag'])
if clean != 'is_clean':
request.POST['brag'] = clean
else:
form = ImageAddBragForm()
return render_to_response('brag/image_brag_add.html', {'form':form,},
context_instance=RequestContext(request))
How to fill DropDownList Dinamyc
How to fill DropDownList Dinamyc
I have some Asp.net dropdownList control, List docs have 3 properties :
DocID , UniqueIdentifier, Name. How to fill DDL only with this record
which goes across "IF" condition. It's a pseudo code.
List<IR_DocumentType> docs = IR_DocumentType.getDocType();
foreach (IR_DocumentType item in docs)
{
if (item.DocID ==1)
{
}
}
//dropdownList
DDL.DataSoure = docs;
DDL.Bind();
I have some Asp.net dropdownList control, List docs have 3 properties :
DocID , UniqueIdentifier, Name. How to fill DDL only with this record
which goes across "IF" condition. It's a pseudo code.
List<IR_DocumentType> docs = IR_DocumentType.getDocType();
foreach (IR_DocumentType item in docs)
{
if (item.DocID ==1)
{
}
}
//dropdownList
DDL.DataSoure = docs;
DDL.Bind();
Friday, 30 August 2013
get ID of Img element which is inside the td of table Using Jquery
get ID of Img element which is inside the td of table Using Jquery
I have a table in which i got the img elements in each td (table is in the
order of 2 rows and 2 Columns) i have to get the id of the image on Hover
i used the "closest" selecter in Jquery.. but not able to get the "id " of
the img which i hover
$(document).ready(function () {
$('img').closest('td').hover(function () {
var id =
$(this).parent('td').prev().children('img').attr('src').substring(0,
7);
alert(id);
});
});
Kindly help me with this issue
I have a table in which i got the img elements in each td (table is in the
order of 2 rows and 2 Columns) i have to get the id of the image on Hover
i used the "closest" selecter in Jquery.. but not able to get the "id " of
the img which i hover
$(document).ready(function () {
$('img').closest('td').hover(function () {
var id =
$(this).parent('td').prev().children('img').attr('src').substring(0,
7);
alert(id);
});
});
Kindly help me with this issue
Thursday, 29 August 2013
What is faster - Loading a pickled dictionary object or Loading a JSON file - to a dictionary?
What is faster - Loading a pickled dictionary object or Loading a JSON
file - to a dictionary?
What is faster -
(A) 'Unpickling' (Loading) a pickled dictionary object, using pickle.load
or
(B) Loading a JSON file to a dictionary using simplejson.load
Assume: The pickled object file exists already in case A, and that the
JSON file exists already in case B
file - to a dictionary?
What is faster -
(A) 'Unpickling' (Loading) a pickled dictionary object, using pickle.load
or
(B) Loading a JSON file to a dictionary using simplejson.load
Assume: The pickled object file exists already in case A, and that the
JSON file exists already in case B
Ho to check if php session is valid?
Ho to check if php session is valid?
I'm using Zend framework 1.12 and I've been built a web app where the
users has to be logging in order to do tasks.
All the task are made through json calls to functions in php modules.
The problem it's when the session has expired and the user wants to
execute a task, the response from the JSON it's the login page and the
response code it's 200.
There is a way to check if the session it's expired?
In the controller of user validation I've:
if ($User->isValid()) {
$this->_redirect(base64_decode($this->redirect));
} else {
return $this->render('logging');
}
Can you help me?
Thanks
I'm using Zend framework 1.12 and I've been built a web app where the
users has to be logging in order to do tasks.
All the task are made through json calls to functions in php modules.
The problem it's when the session has expired and the user wants to
execute a task, the response from the JSON it's the login page and the
response code it's 200.
There is a way to check if the session it's expired?
In the controller of user validation I've:
if ($User->isValid()) {
$this->_redirect(base64_decode($this->redirect));
} else {
return $this->render('logging');
}
Can you help me?
Thanks
how to show tooltip using jquery
how to show tooltip using jquery
I am using Knockout and WCF service. I get json data from service.
Requirement I get concatenated strings which i need to compare and show
them in red color if there is some difference. I have achieved that with
below code
var string1 = "DD,CC,FF";
var string2 = "DD,XX,FF";
var string1ColName ="id,name,address"
var string2ColName ="id,name,address"
var new_string = checkStrings(string1, string2);
document.body.innerHTML = new_string;
function checkStrings(str1, str2) {
str1 = Array.isArray(str1) ? str1 : str1.split(',');
str2 = Array.isArray(str2) ? str2 : str2.split(',');
for (var i = 0; i < str1.length; i++) {
if (str1[i] !== str2[i] ){
str1[i] = '<temp>' + str1[i] + '</temp>';
}
}
return str1.join(',');
}
Here is fiddle
Now what i want is to show tooltip when i hover over text. So when i hover
over text "CC" then it should corresponding column name. So in our case it
will be "name".
How can i achieve it?
I am using Knockout and WCF service. I get json data from service.
Requirement I get concatenated strings which i need to compare and show
them in red color if there is some difference. I have achieved that with
below code
var string1 = "DD,CC,FF";
var string2 = "DD,XX,FF";
var string1ColName ="id,name,address"
var string2ColName ="id,name,address"
var new_string = checkStrings(string1, string2);
document.body.innerHTML = new_string;
function checkStrings(str1, str2) {
str1 = Array.isArray(str1) ? str1 : str1.split(',');
str2 = Array.isArray(str2) ? str2 : str2.split(',');
for (var i = 0; i < str1.length; i++) {
if (str1[i] !== str2[i] ){
str1[i] = '<temp>' + str1[i] + '</temp>';
}
}
return str1.join(',');
}
Here is fiddle
Now what i want is to show tooltip when i hover over text. So when i hover
over text "CC" then it should corresponding column name. So in our case it
will be "name".
How can i achieve it?
Wednesday, 28 August 2013
Google Charts java api DataTable from JSON?
Google Charts java api DataTable from JSON?
All I want to do is create in a google charts DataTable in java from a
JSON string:
public DataTable generateDataTable(Query query, HttpServletRequest request) {
return new DataTable(Json string);
}
But I couldn't find how (there is no such constructor) and all the
questions I've found on this subject were the other way around (how to
create a Json string from a DataTable). Help will be appreciated.
All I want to do is create in a google charts DataTable in java from a
JSON string:
public DataTable generateDataTable(Query query, HttpServletRequest request) {
return new DataTable(Json string);
}
But I couldn't find how (there is no such constructor) and all the
questions I've found on this subject were the other way around (how to
create a Json string from a DataTable). Help will be appreciated.
Alsamixer won't work with bluetooth device
Alsamixer won't work with bluetooth device
I'm running Debian unstable. My .asoundrc looks like this:
pcm.btheadset
{
type plug
slave
{
pcm
{
type bluetooth
device 5A:5A:5A:A6:08:09
profile "auto"
}
}
}
ctl.btheadset
{
type bluetooth
}
I can play music through the headset, however I cannot control the volume.
$ alsamixer -D btheadset
ALSA lib audio/ctl_bluetooth.c:167:(bluetooth_send_ctl) Unable to receive
new volume value from server
ALSA lib audio/ctl_bluetooth.c:161:(bluetooth_send_ctl) Unable to request
new volume value to server: Broken pipe
cannot load mixer controls: Broken pipe
daemon.log has this:
bluetoothd[15628]: Invalid message: length mismatch
Any ideas? I suspected this may be some mismatch of binaries, so I tried
downgrading bluez to Debian stable. No luck. Maybe I should try the same
with alsa libs...
A lot of FAQs and tutorials suggest that PulseAudio should automatically
solve this, however I installed it, it pulled down dozens of dependencies
I have no interest in, and turned out to be a very user-hostile daemon
that refused to play any sound at all. So I am not interested in that as a
solution.
I'm running Debian unstable. My .asoundrc looks like this:
pcm.btheadset
{
type plug
slave
{
pcm
{
type bluetooth
device 5A:5A:5A:A6:08:09
profile "auto"
}
}
}
ctl.btheadset
{
type bluetooth
}
I can play music through the headset, however I cannot control the volume.
$ alsamixer -D btheadset
ALSA lib audio/ctl_bluetooth.c:167:(bluetooth_send_ctl) Unable to receive
new volume value from server
ALSA lib audio/ctl_bluetooth.c:161:(bluetooth_send_ctl) Unable to request
new volume value to server: Broken pipe
cannot load mixer controls: Broken pipe
daemon.log has this:
bluetoothd[15628]: Invalid message: length mismatch
Any ideas? I suspected this may be some mismatch of binaries, so I tried
downgrading bluez to Debian stable. No luck. Maybe I should try the same
with alsa libs...
A lot of FAQs and tutorials suggest that PulseAudio should automatically
solve this, however I installed it, it pulled down dozens of dependencies
I have no interest in, and turned out to be a very user-hostile daemon
that refused to play any sound at all. So I am not interested in that as a
solution.
getting source code of redirected http site via c# webclient
getting source code of redirected http site via c# webclient
i have problem with certain site - i am provided with list of product ID
numbers (about 2000) and my tak is to pull data from producent site. I
already tried forming url of product pages, but there are some unknown
variables that i cant put to get results. However there is search field so
i can use url like this:
http://www.hansgrohe.de/suche.htm?searchtext=58143000 - the problem is,
that given page display info (probably java script) and then redirect
straight to desired page - the one that i need to pull data from.
is there any way of tracking this redirection thing?
i would like to put some of my code, but everything i got so far, i find
unhelpfull because it just download source of preredirected page.
public static string Download(string uri)
{
WebClient client = new WebClient();
client.Encoding = Encoding.UTF8;
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.2; .NET CLR 1.0.3705;)");
string s = client.DownloadString(uri);
return s;
}
Also suggested answer is not helpfull in this case, because redirection
doesn't come with http request - page is redirected after few seconds of
loading http://www.hansgrohe.de/suche.htm?searchtext=58143000 url
i have problem with certain site - i am provided with list of product ID
numbers (about 2000) and my tak is to pull data from producent site. I
already tried forming url of product pages, but there are some unknown
variables that i cant put to get results. However there is search field so
i can use url like this:
http://www.hansgrohe.de/suche.htm?searchtext=58143000 - the problem is,
that given page display info (probably java script) and then redirect
straight to desired page - the one that i need to pull data from.
is there any way of tracking this redirection thing?
i would like to put some of my code, but everything i got so far, i find
unhelpfull because it just download source of preredirected page.
public static string Download(string uri)
{
WebClient client = new WebClient();
client.Encoding = Encoding.UTF8;
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.2; .NET CLR 1.0.3705;)");
string s = client.DownloadString(uri);
return s;
}
Also suggested answer is not helpfull in this case, because redirection
doesn't come with http request - page is redirected after few seconds of
loading http://www.hansgrohe.de/suche.htm?searchtext=58143000 url
How to add android library project in another android project in eclipse
How to add android library project in another android project in eclipse
I am trying to add a library project in another project but I am unable to
add it.
I made e.g. Project A as a library project by going in to its properties
and checking isLibrary checkbox. Then I tried to add this in Project B ,
by going into its properties , and by clicking Add button and selecting
Project A as a library.
Then I clicked on ok , but when I try to use any class or reference of
Project A , I get an error that it is not defined. I checked Project B's
properties again , and there is no reference there of Project A, which I
established earlier.
The reference is automatically disappearing. I need help in this.
Edit : Both Projects are in same workspace.
I am trying to add a library project in another project but I am unable to
add it.
I made e.g. Project A as a library project by going in to its properties
and checking isLibrary checkbox. Then I tried to add this in Project B ,
by going into its properties , and by clicking Add button and selecting
Project A as a library.
Then I clicked on ok , but when I try to use any class or reference of
Project A , I get an error that it is not defined. I checked Project B's
properties again , and there is no reference there of Project A, which I
established earlier.
The reference is automatically disappearing. I need help in this.
Edit : Both Projects are in same workspace.
Tuesday, 27 August 2013
Trouble uploading info to Parse and performing segue with the same IBAction button
Trouble uploading info to Parse and performing segue with the same
IBAction button
I call this method:
- (IBAction)createGroup:(id)sender {
PFObject *message = [PFObject objectWithClassName:@"Messages"];
[message setObject:self.recipients forKey:@"recipientIds"];
[message saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (error) {
NSLog(@"Error %@ %@", error, [error userInfo]);
}
else {
self.message = message;
}
}];
}
When I run that by itself, it runs fine and the data class is created on
Parse. But when I add a segue to the same button, it performs the segue
and does not create the class on Parse. What can I do to make the same
IBAction button create the class on Parse BEFORE it performs the segue?
IBAction button
I call this method:
- (IBAction)createGroup:(id)sender {
PFObject *message = [PFObject objectWithClassName:@"Messages"];
[message setObject:self.recipients forKey:@"recipientIds"];
[message saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (error) {
NSLog(@"Error %@ %@", error, [error userInfo]);
}
else {
self.message = message;
}
}];
}
When I run that by itself, it runs fine and the data class is created on
Parse. But when I add a segue to the same button, it performs the segue
and does not create the class on Parse. What can I do to make the same
IBAction button create the class on Parse BEFORE it performs the segue?
User Interface for Google App Engine
User Interface for Google App Engine
I do not even know how to start to ask this question. So here is my best
effort. Please guide me along. I have always been interested in GAE. Now I
would like to develop an application that uses GAE. But I am having
trouble selecting the appropriate technology stack to use with GAE. For
example, should I use Python or Java in GAE? Should I use GWT or some
other tool to develop the end user interface (GUI).
Right now, I tend to favor using Python on the GAE. But I don't know about
the end user interface (GUI). Is GWT the only option?
About my little application: The application will allow the user to input
information/photos about an inspection (common stuff) and create a record
of the inspection. Then the application will generated an inspection
report (common format) of a selected record.
I hope this is enough to describe my dilemma. Thanks,
I do not even know how to start to ask this question. So here is my best
effort. Please guide me along. I have always been interested in GAE. Now I
would like to develop an application that uses GAE. But I am having
trouble selecting the appropriate technology stack to use with GAE. For
example, should I use Python or Java in GAE? Should I use GWT or some
other tool to develop the end user interface (GUI).
Right now, I tend to favor using Python on the GAE. But I don't know about
the end user interface (GUI). Is GWT the only option?
About my little application: The application will allow the user to input
information/photos about an inspection (common stuff) and create a record
of the inspection. Then the application will generated an inspection
report (common format) of a selected record.
I hope this is enough to describe my dilemma. Thanks,
How to return the max number of words contained in a vector of characters
How to return the max number of words contained in a vector of characters
I have vector of characters c("Mark Twain", "Phil Hall", "Michael Paul
O'Connor", " ",...)
I want to know what the max number of words per value I can find in my
vector.
I have vector of characters c("Mark Twain", "Phil Hall", "Michael Paul
O'Connor", " ",...)
I want to know what the max number of words per value I can find in my
vector.
No response with Port.Readline(). Why?
No response with Port.Readline(). Why?
I am using C#. I have a device connected to the com port. I am sending
initial command i.e socket alive to the device through comport . I already
have packet format in hexvalue. When I write in port i.e
port.write(result)
I won't get any response in port.readline i.e.
port.readline = empty
Please help me to sort this out.
I am using C#. I have a device connected to the com port. I am sending
initial command i.e socket alive to the device through comport . I already
have packet format in hexvalue. When I write in port i.e
port.write(result)
I won't get any response in port.readline i.e.
port.readline = empty
Please help me to sort this out.
Monday, 26 August 2013
Why do we use Interface to define the methods and implement and define body of it in Concrete Class?
Why do we use Interface to define the methods and implement and define
body of it in Concrete Class?
Let me clear my question with an example. Suppose I have an interface I in
which method abc() is defined. I have another two class say A and B which
implements I and override abc() method.
Now my question is why do we user interface just to define the methods and
not implemented directly in a class without defining and implementing
interface?like...
interface I{
public void abc();
}
class A implements I{
@Override
public void abc() { ... }
}
class B implements I{
@Override
public void abc() { ... }
}
instead of
class A {
public void abc() { ... }
}
class B {
public void abc() { ... }
}
Explaination with small example will be very helpful. Thank You.
body of it in Concrete Class?
Let me clear my question with an example. Suppose I have an interface I in
which method abc() is defined. I have another two class say A and B which
implements I and override abc() method.
Now my question is why do we user interface just to define the methods and
not implemented directly in a class without defining and implementing
interface?like...
interface I{
public void abc();
}
class A implements I{
@Override
public void abc() { ... }
}
class B implements I{
@Override
public void abc() { ... }
}
instead of
class A {
public void abc() { ... }
}
class B {
public void abc() { ... }
}
Explaination with small example will be very helpful. Thank You.
I'm trying to display specific mysql table value based on two variables php
I'm trying to display specific mysql table value based on two variables php
First of all, I am new to php and objective c. I am making an iOS app in
Xcode and I'm trying to display the points that are specific to each
customer. Right now in phpmyadmin, I have 3 tables in 1 database. The
tables are testt (which contains each business name and other
information), customers (which contains each customers' information), and
rewards_points (which contains a two columns to connect with the other two
columns and a points column).
You don't have to give any code (although it would probably be more
helpful). I just want to know how to get specific points based on the
customer id and the business id and display it in Xcode. I think this
would be accomplished in the php file connecting to the Xcode project
since it is where the data is organized.
Thanks in advance!
First of all, I am new to php and objective c. I am making an iOS app in
Xcode and I'm trying to display the points that are specific to each
customer. Right now in phpmyadmin, I have 3 tables in 1 database. The
tables are testt (which contains each business name and other
information), customers (which contains each customers' information), and
rewards_points (which contains a two columns to connect with the other two
columns and a points column).
You don't have to give any code (although it would probably be more
helpful). I just want to know how to get specific points based on the
customer id and the business id and display it in Xcode. I think this
would be accomplished in the php file connecting to the Xcode project
since it is where the data is organized.
Thanks in advance!
Display an icon in a specific jtable cell
Display an icon in a specific jtable cell
I want to display an icon in a specific jtable cell,and not having the
same icon in the hole column cells please help
I want to display an icon in a specific jtable cell,and not having the
same icon in the hole column cells please help
Copying files containing specific text in its content from a folder to other
Copying files containing specific text in its content from a folder to other
At times I have come across situation where by I have to copy all the
files containing a specific pattern in its content from a folder to other.
For ex.. DirA contains 100 files out of which there are 60 files which
contains a pattern say FOO and my requirement is to copy these 60 files
from DirA to DirB.
I typically write a small shell script to do this job and it works
properly. However I am trying to understand if there is a way to it only
using a combination of some commands and I need not write any shell
script.
Any pointer will be helpful.
Regards, Ramakant
At times I have come across situation where by I have to copy all the
files containing a specific pattern in its content from a folder to other.
For ex.. DirA contains 100 files out of which there are 60 files which
contains a pattern say FOO and my requirement is to copy these 60 files
from DirA to DirB.
I typically write a small shell script to do this job and it works
properly. However I am trying to understand if there is a way to it only
using a combination of some commands and I need not write any shell
script.
Any pointer will be helpful.
Regards, Ramakant
When Terminal forks process, current app loses focus
When Terminal forks process, current app loses focus
While I'm running some program in Terminal (or iTerm2), when the program
forks the process, the OS X desktop switches focus from the current
application to the forked process. When this happens, the forked process
name shows in OS X menu bar.
This is especially annoying while using full screen mode as it causes the
workspace to change when the forked process receives focus.
How can I stop this focus switch from happening? These terminal programs
are interrupting the work I'm doing in other applications while they run.
While I'm running some program in Terminal (or iTerm2), when the program
forks the process, the OS X desktop switches focus from the current
application to the forked process. When this happens, the forked process
name shows in OS X menu bar.
This is especially annoying while using full screen mode as it causes the
workspace to change when the forked process receives focus.
How can I stop this focus switch from happening? These terminal programs
are interrupting the work I'm doing in other applications while they run.
how can i return an array created in a loop javascript?
how can i return an array created in a loop javascript?
i am trying to return a column values from database in an array,but it
always returns empty array.
function Select(query, db) {
var result = new Array();
db.transaction(function(tx) {
tx.executeSql(query, [], function(tx, rs) {
var len = rs.rows.length;
for (var i = 0; i < len; i++) {
var row = rs.rows.item(i);
result.push({latitude : row['latitude']});
}
});
});
return result;
}
I am sure that array is created just after for loop but returns empty at
last.
i am trying to return a column values from database in an array,but it
always returns empty array.
function Select(query, db) {
var result = new Array();
db.transaction(function(tx) {
tx.executeSql(query, [], function(tx, rs) {
var len = rs.rows.length;
for (var i = 0; i < len; i++) {
var row = rs.rows.item(i);
result.push({latitude : row['latitude']});
}
});
});
return result;
}
I am sure that array is created just after for loop but returns empty at
last.
Where is file that saves Environment Variables=?iso-8859-1?Q?=3F_=96_superuser.com?=
Where is file that saves Environment Variables? – superuser.com
I am a developer and usually do stuff with the PATH variable. However, now
there are too much path in it, and using a short textbox of Windows is a
pain. Before I happen to jump into a text file, ...
I am a developer and usually do stuff with the PATH variable. However, now
there are too much path in it, and using a short textbox of Windows is a
pain. Before I happen to jump into a text file, ...
Sunday, 25 August 2013
Pointing to div of other page
Pointing to div of other page
I have 2 html pages (say 1.html and 2.html) which I want to display in 2
different frames. 1.html contains a table with some rows. Each row
contains some details which I have stored in 2.html using div for each
row. Initially I want to hide these div's so nothing should be displayed
in 2.html. Now when I select any row from 1.html, respective details (div)
in 2.html should be displayed.
Any thoughts.
I have 2 html pages (say 1.html and 2.html) which I want to display in 2
different frames. 1.html contains a table with some rows. Each row
contains some details which I have stored in 2.html using div for each
row. Initially I want to hide these div's so nothing should be displayed
in 2.html. Now when I select any row from 1.html, respective details (div)
in 2.html should be displayed.
Any thoughts.
MySQL + PHP 1 Input Login
MySQL + PHP 1 Input Login
I am trying to make 1 Password-Login. For example, when user enters code,
his page appears. I have a table, 2 strings in my database.
Strings:
sifre (it is password)
bizimkey (it is userpage)
My Code is like this:
Index.html (Just important part, please don't talk about html, body etc.
tags):
<form action="key.php" method="POST">
<input type="password" id=yaz name="pass" maxlength="30" value="">
<input type="submit" value=" " id="login" style="margin-bottom:10px;">
</form>
key.php:
<? ob_start(); ?>
<html>
<?php
$host = "localhost";
$user = "username";
$password = "password";
$database = "database";
$con = mysqli_connect($host,$user,$password,$database);
// Check connection
if (mysqli_connect_errno())
{
echo "ERROR!";
}
$result = mysqli_query($con,"SELECT * FROM keyler");
if ($_POST['pass'] == $row['sifre'])
{
while($row = mysqli_fetch_array($result))
{
echo $row['bizimkey'];
}
} else {
header('Location:index.html');
}
mysqli_close($con);
?>
</html>
<? ob_flush(); ?>
When I try this, password not working and key.php shows every single
bizimkey strings.
Please help :(
I am trying to make 1 Password-Login. For example, when user enters code,
his page appears. I have a table, 2 strings in my database.
Strings:
sifre (it is password)
bizimkey (it is userpage)
My Code is like this:
Index.html (Just important part, please don't talk about html, body etc.
tags):
<form action="key.php" method="POST">
<input type="password" id=yaz name="pass" maxlength="30" value="">
<input type="submit" value=" " id="login" style="margin-bottom:10px;">
</form>
key.php:
<? ob_start(); ?>
<html>
<?php
$host = "localhost";
$user = "username";
$password = "password";
$database = "database";
$con = mysqli_connect($host,$user,$password,$database);
// Check connection
if (mysqli_connect_errno())
{
echo "ERROR!";
}
$result = mysqli_query($con,"SELECT * FROM keyler");
if ($_POST['pass'] == $row['sifre'])
{
while($row = mysqli_fetch_array($result))
{
echo $row['bizimkey'];
}
} else {
header('Location:index.html');
}
mysqli_close($con);
?>
</html>
<? ob_flush(); ?>
When I try this, password not working and key.php shows every single
bizimkey strings.
Please help :(
click image hear sound in browser
click image hear sound in browser
Im John
Im creating a website at present. My HTML, CSS and skills in DW CS5, FLASH
etc are at beginner level. There many sites/sources I have and could go to
for doing what I want. But their ways/steps aren't working for me.
But I need some help. I have the following situation. I have 2 cols in
Dreamweaver. 1 for images and the right col for text. I want the person to
click on the image and hear the audio of the person in the picture. No
players or other pages opening. click image and hear audio that's it.
Can this be done. As the current and only example seems to leave me
uncertain. http://www.it-student.org.uk/playsound/playsounds.php I set it
up as it asks nothing happens no sound.. As I said at the start ive no
idea about scripts in way.
Im John
Im creating a website at present. My HTML, CSS and skills in DW CS5, FLASH
etc are at beginner level. There many sites/sources I have and could go to
for doing what I want. But their ways/steps aren't working for me.
But I need some help. I have the following situation. I have 2 cols in
Dreamweaver. 1 for images and the right col for text. I want the person to
click on the image and hear the audio of the person in the picture. No
players or other pages opening. click image and hear audio that's it.
Can this be done. As the current and only example seems to leave me
uncertain. http://www.it-student.org.uk/playsound/playsounds.php I set it
up as it asks nothing happens no sound.. As I said at the start ive no
idea about scripts in way.
Saturday, 24 August 2013
Transportation from Don Muang Airport to Khao San Road and from Khao San Road [on hold]
Transportation from Don Muang Airport to Khao San Road and from Khao San
Road [on hold]
I'm coming from Singapore and I will arrive in Bangkok via the Don Muang
Airport. So I need to know a few things. I will be travelling alone and
it's my first time doing so. I do not know Thai as well.
1) What's the price of a taxi from Don Muang Airport to Khaosan Road? I'll
be staying in Dang Derm Hotel
2) How much is a cab from Khaosan to the silom nightlife areas?bars and etc?
3) I would like to go from Khao san to Pattaya. Most probably Citin Garden
Resort. Any ideas how i can get there without taking a cab? A straight
(bus air conditioned) from somewhere nearby would be ok. Last option would
be a cab. How much would that be as well?
4) From the Citin Garden Resort to Don Muang airport. I would also need to
know what transportation to take. Any ideas how i can get back to don
muang airport? Prices as well would be a great help.
Road [on hold]
I'm coming from Singapore and I will arrive in Bangkok via the Don Muang
Airport. So I need to know a few things. I will be travelling alone and
it's my first time doing so. I do not know Thai as well.
1) What's the price of a taxi from Don Muang Airport to Khaosan Road? I'll
be staying in Dang Derm Hotel
2) How much is a cab from Khaosan to the silom nightlife areas?bars and etc?
3) I would like to go from Khao san to Pattaya. Most probably Citin Garden
Resort. Any ideas how i can get there without taking a cab? A straight
(bus air conditioned) from somewhere nearby would be ok. Last option would
be a cab. How much would that be as well?
4) From the Citin Garden Resort to Don Muang airport. I would also need to
know what transportation to take. Any ideas how i can get back to don
muang airport? Prices as well would be a great help.
Looking for a webcam datasheet using lsusb code in ubuntu
Looking for a webcam datasheet using lsusb code in ubuntu
I have a webcam that I am able to capture images from it.
I have tried 3 color formats to display those images:
1 - YUV420
2 - RGB565
3 - RGB32
None of them works for my webcam. Item 0 is the one which displays better.
I need to identify wich color format my webcam supports and all I know is
the result of lsusb showing:
1e4e:0100 - Etron Technologies
Is there a way to find its datasheet from this code?
I have a webcam that I am able to capture images from it.
I have tried 3 color formats to display those images:
1 - YUV420
2 - RGB565
3 - RGB32
None of them works for my webcam. Item 0 is the one which displays better.
I need to identify wich color format my webcam supports and all I know is
the result of lsusb showing:
1e4e:0100 - Etron Technologies
Is there a way to find its datasheet from this code?
Node XHR file upload events
Node XHR file upload events
Consider an ExpressJS app which receives file uploads:
app.post('/api/file', function(req, res) {
req.on('data', function() {
console.log('asd')
})
})
I can't understand why data event is never fired. I'm also using
bodyParser() middleware which gives me the following object for each file
which seems to have some events available but still no effect:
{
file: {
domain: null,
_events: {},
_maxListeners: 10,
size: 43330194,
path: 'public/uploads/a4abdeae32d56a2494db48e9b0b22a5e.deb',
name: 'google-chrome-stable_current_amd64.deb',
type: 'application/x-deb',
hash: null,
lastModifiedDate: Sat Aug 24 2013 20: 59: 00 GMT + 0200(CEST),
_writeStream: {
_writableState: [Object],
writable: true,
domain: null,
_events: {},
_maxListeners: 10,
path: 'public/uploads/a4abdeae32d56a2494db48e9b0b22a5e.deb',
fd: null,
flags: 'w',
mode: 438,
start: undefined,
pos: undefined,
bytesWritten: 43330194,
closed: true,
open: [Function],
_write: [Function],
destroy: [Function],
close: [Function],
destroySoon: [Function],
pipe: [Function],
write: [Function],
end: [Function],
setMaxListeners: [Function],
emit: [Function],
addListener: [Function],
on: [Function],
once: [Function],
removeListener: [Function],
removeAllListeners: [Function],
listeners: [Function]
},
open: [Function],
toJSON: [Function],
write: [Function],
end: [Function],
setMaxListeners: [Function],
emit: [Function],
addListener: [Function],
on: [Function],
once: [Function],
removeListener: [Function],
removeAllListeners: [Function],
listeners: [Function]
}
}
I would like to understand how to make progress and complete events work.
Consider an ExpressJS app which receives file uploads:
app.post('/api/file', function(req, res) {
req.on('data', function() {
console.log('asd')
})
})
I can't understand why data event is never fired. I'm also using
bodyParser() middleware which gives me the following object for each file
which seems to have some events available but still no effect:
{
file: {
domain: null,
_events: {},
_maxListeners: 10,
size: 43330194,
path: 'public/uploads/a4abdeae32d56a2494db48e9b0b22a5e.deb',
name: 'google-chrome-stable_current_amd64.deb',
type: 'application/x-deb',
hash: null,
lastModifiedDate: Sat Aug 24 2013 20: 59: 00 GMT + 0200(CEST),
_writeStream: {
_writableState: [Object],
writable: true,
domain: null,
_events: {},
_maxListeners: 10,
path: 'public/uploads/a4abdeae32d56a2494db48e9b0b22a5e.deb',
fd: null,
flags: 'w',
mode: 438,
start: undefined,
pos: undefined,
bytesWritten: 43330194,
closed: true,
open: [Function],
_write: [Function],
destroy: [Function],
close: [Function],
destroySoon: [Function],
pipe: [Function],
write: [Function],
end: [Function],
setMaxListeners: [Function],
emit: [Function],
addListener: [Function],
on: [Function],
once: [Function],
removeListener: [Function],
removeAllListeners: [Function],
listeners: [Function]
},
open: [Function],
toJSON: [Function],
write: [Function],
end: [Function],
setMaxListeners: [Function],
emit: [Function],
addListener: [Function],
on: [Function],
once: [Function],
removeListener: [Function],
removeAllListeners: [Function],
listeners: [Function]
}
}
I would like to understand how to make progress and complete events work.
Deleting songs on computer from an iTunes playlist
Deleting songs on computer from an iTunes playlist
Oftentimes, I am in an iTunes playlist and want to delete a song from my
computer.
However, if I am in an iTunes playlist, I can only delete the song from
the playlist, and then I have to go back to All Music in iTunes to delete
the song from the computer.
The picture above shows the window that appears when I go to delete a song
in a playlist.
Is there a way to delete a song from a playlist and the computer at the
same time?
Tech Specs
OS X 10.8.4
iTunes 11.0.5
Oftentimes, I am in an iTunes playlist and want to delete a song from my
computer.
However, if I am in an iTunes playlist, I can only delete the song from
the playlist, and then I have to go back to All Music in iTunes to delete
the song from the computer.
The picture above shows the window that appears when I go to delete a song
in a playlist.
Is there a way to delete a song from a playlist and the computer at the
same time?
Tech Specs
OS X 10.8.4
iTunes 11.0.5
argument unpacking and assignment to class variables
argument unpacking and assignment to class variables
Hi I have the following code, which attempts to create an instance of a
class and assign argument values to it. I am trying to use *args to do
this as follows:
def main():
testdata = ['FDR', False, 4, 1933]
apresident = President(testdata)
print apresident
print apresident.alive
class President:
id_iter = itertools.count(1)
#def __init__(self, president, alive, terms, firstelected):
def __init__(self, *args):
self.id = self.id_iter.next()
self.president = args[0]
self.alive = args[1]
self.terms = args[2]
self.firstelected = args[3]
I get a "tuple index out of range" error. As you can see from the
commented line, I was previously using positional arguments to accomplish
this (which worked), and used lines like the following to do it:
self.president = president
What is the right way to use *args in this case? should I be using *kwargs?
Hi I have the following code, which attempts to create an instance of a
class and assign argument values to it. I am trying to use *args to do
this as follows:
def main():
testdata = ['FDR', False, 4, 1933]
apresident = President(testdata)
print apresident
print apresident.alive
class President:
id_iter = itertools.count(1)
#def __init__(self, president, alive, terms, firstelected):
def __init__(self, *args):
self.id = self.id_iter.next()
self.president = args[0]
self.alive = args[1]
self.terms = args[2]
self.firstelected = args[3]
I get a "tuple index out of range" error. As you can see from the
commented line, I was previously using positional arguments to accomplish
this (which worked), and used lines like the following to do it:
self.president = president
What is the right way to use *args in this case? should I be using *kwargs?
how to use angularjs as a client side templating engine like mustache?
how to use angularjs as a client side templating engine like mustache?
I want to generate HTML by combining template & json data. (I know how to
do this by mustache.js)
but I want to do this by angularjs. is it possible?
I want to generate HTML by combining template & json data. (I know how to
do this by mustache.js)
but I want to do this by angularjs. is it possible?
The overall performance where the method is placed in a code
The overall performance where the method is placed in a code
Consider this code:
namespace FastReflectionTests
{
public class Test
{
public void Method1()
{
var x = 10;
var y = 20;
if (x == 10 && y == 20)
{
}
}
public void Method2()
{
var x = 10;
var y = 20;
if (x == 10 && y == 20)
{
}
}
}
}
So consider the IL Code:
This is method1:
instance void Method1 () cil managed
{
// Method begins at RVA 0x3bd0
// Code size 17 (0x11)
.maxstack 2
.locals init (
[0] int32 x,
[1] int32 y
)
IL_0000: ldc.i4.s 10
IL_0002: stloc.0
IL_0003: ldc.i4.s 20
IL_0005: stloc.1
IL_0006: ldloc.0
IL_0007: ldc.i4.s 10
IL_0009: bne.un.s IL_0010
IL_000b: ldloc.1
IL_000c: ldc.i4.s 20
IL_000e: pop
IL_000f: pop
IL_0010: ret
} // end of method Test::Method1
This is method2:
instance void Method2 () cil managed
{
// Method begins at RVA 0x3bf0
// Code size 17 (0x11)
.maxstack 2
.locals init (
[0] int32 x,
[1] int32 y
)
IL_0000: ldc.i4.s 10
IL_0002: stloc.0
IL_0003: ldc.i4.s 20
IL_0005: stloc.1
IL_0006: ldloc.0
IL_0007: ldc.i4.s 10
IL_0009: bne.un.s IL_0010
IL_000b: ldloc.1
IL_000c: ldc.i4.s 20
IL_000e: pop
IL_000f: pop
IL_0010: ret
} // end of method Test::Method2
method1 get 00:00:00.0000019 second for invoke.
method2 get 00:00:00.0000006 second for invoke.
I write this code for test
public class Program
{
private static void Main(string[] args)
{
var test = new Test();
test.Method1();
test.Method2();
System.Console.ReadLine();
}
}
public class Test
{
public void Method1()
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var x = 10;
var y = 20;
if (x == 10)
{
if (y == 20)
{
}
}
stopwatch.Stop();
Console.WriteLine("Time Method1: {0}",
stopwatch.Elapsed);
}
public void Method2()
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var x = 10;
var y = 20;
if (x == 10 && y == 20)
{
}
stopwatch.Stop();
Console.WriteLine("Time Method2: {0}",
stopwatch.Elapsed);
}
}
I change place of method1 and method2. test.Method2(); test.Method1();
and run test.
method1 get 00:00:00.0000006 second for invoke.
method2 get 00:00:00.0000019 second for invoke.
Why when changing the place of method the second method get more time than
first method?
Consider this code:
namespace FastReflectionTests
{
public class Test
{
public void Method1()
{
var x = 10;
var y = 20;
if (x == 10 && y == 20)
{
}
}
public void Method2()
{
var x = 10;
var y = 20;
if (x == 10 && y == 20)
{
}
}
}
}
So consider the IL Code:
This is method1:
instance void Method1 () cil managed
{
// Method begins at RVA 0x3bd0
// Code size 17 (0x11)
.maxstack 2
.locals init (
[0] int32 x,
[1] int32 y
)
IL_0000: ldc.i4.s 10
IL_0002: stloc.0
IL_0003: ldc.i4.s 20
IL_0005: stloc.1
IL_0006: ldloc.0
IL_0007: ldc.i4.s 10
IL_0009: bne.un.s IL_0010
IL_000b: ldloc.1
IL_000c: ldc.i4.s 20
IL_000e: pop
IL_000f: pop
IL_0010: ret
} // end of method Test::Method1
This is method2:
instance void Method2 () cil managed
{
// Method begins at RVA 0x3bf0
// Code size 17 (0x11)
.maxstack 2
.locals init (
[0] int32 x,
[1] int32 y
)
IL_0000: ldc.i4.s 10
IL_0002: stloc.0
IL_0003: ldc.i4.s 20
IL_0005: stloc.1
IL_0006: ldloc.0
IL_0007: ldc.i4.s 10
IL_0009: bne.un.s IL_0010
IL_000b: ldloc.1
IL_000c: ldc.i4.s 20
IL_000e: pop
IL_000f: pop
IL_0010: ret
} // end of method Test::Method2
method1 get 00:00:00.0000019 second for invoke.
method2 get 00:00:00.0000006 second for invoke.
I write this code for test
public class Program
{
private static void Main(string[] args)
{
var test = new Test();
test.Method1();
test.Method2();
System.Console.ReadLine();
}
}
public class Test
{
public void Method1()
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var x = 10;
var y = 20;
if (x == 10)
{
if (y == 20)
{
}
}
stopwatch.Stop();
Console.WriteLine("Time Method1: {0}",
stopwatch.Elapsed);
}
public void Method2()
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var x = 10;
var y = 20;
if (x == 10 && y == 20)
{
}
stopwatch.Stop();
Console.WriteLine("Time Method2: {0}",
stopwatch.Elapsed);
}
}
I change place of method1 and method2. test.Method2(); test.Method1();
and run test.
method1 get 00:00:00.0000006 second for invoke.
method2 get 00:00:00.0000019 second for invoke.
Why when changing the place of method the second method get more time than
first method?
how to use value of one switch case in another switch case: value is Scanner inputs?
how to use value of one switch case in another switch case: value is
Scanner inputs?
I have two nested switches and I wanted to use value of one switch case in
another switch case. As in the below example, I wanted to use the double
variable temp_usr and pass it as an argument to a method (cels()) in the
another switch case, how can I do this?
switch( switch1){
case 1:
{
System.out.println(" You have selected Celsius");
Scanner temp_ip= new Scanner(System.in);
System.out.println("Please enter the temperature in celsius");
double temp_usr= temp_ip.nextDouble();
}
break;
case 2: ...............
case 3: ...............
switch(switch2) {
case 1:
{
System.out.println("convert it into Celsius");
System.out.println(cels(arg)); /*this argument should take value of
temp_usr*/
}
break;
case 2: .........
case 3: .........
Scanner inputs?
I have two nested switches and I wanted to use value of one switch case in
another switch case. As in the below example, I wanted to use the double
variable temp_usr and pass it as an argument to a method (cels()) in the
another switch case, how can I do this?
switch( switch1){
case 1:
{
System.out.println(" You have selected Celsius");
Scanner temp_ip= new Scanner(System.in);
System.out.println("Please enter the temperature in celsius");
double temp_usr= temp_ip.nextDouble();
}
break;
case 2: ...............
case 3: ...............
switch(switch2) {
case 1:
{
System.out.println("convert it into Celsius");
System.out.println(cels(arg)); /*this argument should take value of
temp_usr*/
}
break;
case 2: .........
case 3: .........
Friday, 23 August 2013
PHP form with MYSQL only posts what I put in. Not the search result
PHP form with MYSQL only posts what I put in. Not the search result
Ok so I'm frustrated. I cant figure out what I did wrong. I'm new to PHP
and MYSQL. Ok so I've got a database all set up. The tables are all set up
too. I'm having a difficult time with the PHP though.
The I have 15 fields that I want to search. But on the test run it the PHP
keeps posting what I put in the box. If I put in "Seth" It just simply
posts "Seth". That's it nothing from the database. I only put one field in
the PHP just to test it.
I put my code in here. The curly braces are in the right places. I had
trouble with indenting on this site.
The first one is my php.func.inc.
<?php
include 'db.inc.php';
function search_results($keywords) {
$returned_results = array();
$where = "";
$keywords = preg_split('/[\s]+/', $keywords);
$total_keywords = count($keywords);
foreach($keywords as $key=>$keyword){
$where .= " 'keywords' LIKE '%$keyword%' ";
if($key != ($total_keywords - 1))
{
$where .= " AND";
}
}
$results = "SELECT 'Investigator', 'ProjectTitle', 'Institution' FROM
'Studies' WHERE
where";
$results_num = $results = mysql_query($results) ?
mysql_num_rows($results) : 0;
if($results_num === 0)
{
return false;
}else {
while ($results_row = mysql_fetch_assoc($results)) {
echo $results_row['OtherNotes'];
}
}
}
?>
The next is my Index.php. I left out the file where I connect to the
Database.
<?php include 'func.inc.php'; ?>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<h2> Search </h2>
<form action = "" method = "POST">
<p>
<input type = "text" name = "keywords" /> <input type = "submit" value =
"search" />
</p>
</form>
<?php
if(isset($_POST['keywords']))
{
$keywords =
mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));
echo $keywords;
$errors = array();
if(empty($keywords)){
$errors[] = "Please enter a search term";
}else if (strlen($keywords) < 3) {
$errors[] = "Your search term must be a 3 or more character";
}else if (search_results($keywords === false)){
$errors[] = 'Your search for ' . $keywords . 'returned no results';
}
if(empty($errors)){
search_results($keywords);
} else {
foreach ($errors as $error) {
echo $error;
}
}
}
?>
</body>
<html>
Ok so I'm frustrated. I cant figure out what I did wrong. I'm new to PHP
and MYSQL. Ok so I've got a database all set up. The tables are all set up
too. I'm having a difficult time with the PHP though.
The I have 15 fields that I want to search. But on the test run it the PHP
keeps posting what I put in the box. If I put in "Seth" It just simply
posts "Seth". That's it nothing from the database. I only put one field in
the PHP just to test it.
I put my code in here. The curly braces are in the right places. I had
trouble with indenting on this site.
The first one is my php.func.inc.
<?php
include 'db.inc.php';
function search_results($keywords) {
$returned_results = array();
$where = "";
$keywords = preg_split('/[\s]+/', $keywords);
$total_keywords = count($keywords);
foreach($keywords as $key=>$keyword){
$where .= " 'keywords' LIKE '%$keyword%' ";
if($key != ($total_keywords - 1))
{
$where .= " AND";
}
}
$results = "SELECT 'Investigator', 'ProjectTitle', 'Institution' FROM
'Studies' WHERE
where";
$results_num = $results = mysql_query($results) ?
mysql_num_rows($results) : 0;
if($results_num === 0)
{
return false;
}else {
while ($results_row = mysql_fetch_assoc($results)) {
echo $results_row['OtherNotes'];
}
}
}
?>
The next is my Index.php. I left out the file where I connect to the
Database.
<?php include 'func.inc.php'; ?>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<h2> Search </h2>
<form action = "" method = "POST">
<p>
<input type = "text" name = "keywords" /> <input type = "submit" value =
"search" />
</p>
</form>
<?php
if(isset($_POST['keywords']))
{
$keywords =
mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));
echo $keywords;
$errors = array();
if(empty($keywords)){
$errors[] = "Please enter a search term";
}else if (strlen($keywords) < 3) {
$errors[] = "Your search term must be a 3 or more character";
}else if (search_results($keywords === false)){
$errors[] = 'Your search for ' . $keywords . 'returned no results';
}
if(empty($errors)){
search_results($keywords);
} else {
foreach ($errors as $error) {
echo $error;
}
}
}
?>
</body>
<html>
Compare two images in php and get the sucessrate in percent
Compare two images in php and get the sucessrate in percent
I want to compare in php two images so I can see how much is similar in
percent.
http://img3.fotos-hochladen.net/uploads/1pwiv98qblc.jpg
http://img3.fotos-hochladen.net/uploads/2734zn8wkoa.jpg
I want to compare in php two images so I can see how much is similar in
percent.
http://img3.fotos-hochladen.net/uploads/1pwiv98qblc.jpg
http://img3.fotos-hochladen.net/uploads/2734zn8wkoa.jpg
YouTube Subscribe button in IE7
YouTube Subscribe button in IE7
Is this a known-incompatibility? It seems broken on Google's configuration
page:
https://developers.google.com/youtube/youtube_subscribe_button#Configure_a_Button
Is this a known-incompatibility? It seems broken on Google's configuration
page:
https://developers.google.com/youtube/youtube_subscribe_button#Configure_a_Button
How to compare row value against static value
How to compare row value against static value
I have a very low level, beginner question. My goal is to essentially run
some kind of stock level report, where I compare the stock level against a
static number. So for instance I have 3 parts and I'd like to maintain at
least 5 parts at all times, so I want to have a page that can pull the
current stock level and output how many I need to order, then multiply
that number by the cost, then total the cost of every part, for now I'm
using a excel sheet to accomplish this, but I'd like to move it to a
webpage. I really just need to be pointed in the right direction, for now
I'm just echoing the parts and their quantity, but I'm not sure where to
begin, or what kind of operations I'll need to use to get this going. Or
if anyone could point me in the direction of an example that would be
great, as usual any assistance is appreciated.
I have a very low level, beginner question. My goal is to essentially run
some kind of stock level report, where I compare the stock level against a
static number. So for instance I have 3 parts and I'd like to maintain at
least 5 parts at all times, so I want to have a page that can pull the
current stock level and output how many I need to order, then multiply
that number by the cost, then total the cost of every part, for now I'm
using a excel sheet to accomplish this, but I'd like to move it to a
webpage. I really just need to be pointed in the right direction, for now
I'm just echoing the parts and their quantity, but I'm not sure where to
begin, or what kind of operations I'll need to use to get this going. Or
if anyone could point me in the direction of an example that would be
great, as usual any assistance is appreciated.
is is possible to publish multiple bonjour service through my application?
is is possible to publish multiple bonjour service through my application?
Is it possible to publish multiple bonjour services of different service
type simultaneously through my application? Currently my application
publishes a generic bonjour service of type "_http._tcp". when my client
program browses for the list of of devices running this type of service,
it gets a list of all devices publishing this type of service. Since it is
a generic service type I am getting a list of printers and other device
also. I need to filter out the devices which are running my application. I
think it is only possible when we publish a service which is not generic.
But i also need this service of type "_http._tcp" to be published. Please
suggest what will be the suitable approach.
Is it possible to publish multiple bonjour services of different service
type simultaneously through my application? Currently my application
publishes a generic bonjour service of type "_http._tcp". when my client
program browses for the list of of devices running this type of service,
it gets a list of all devices publishing this type of service. Since it is
a generic service type I am getting a list of printers and other device
also. I need to filter out the devices which are running my application. I
think it is only possible when we publish a service which is not generic.
But i also need this service of type "_http._tcp" to be published. Please
suggest what will be the suitable approach.
Thursday, 22 August 2013
Jquery for pass selected radio button value on button click
Jquery for pass selected radio button value on button click
pAm new to JQuery. I want to pass the selected radio button values on
button click and show that selected radio button values in textboxes and
comboboxes./p pI dont know how it can be done./p pMy current code as
followscode.displayjobs()/code displays the table with values in page
load./p precodefunction displayjobs() { $('#jobsTable').empty();
$(#jobsTable).append(lt;trgt;lt;thgt;Idlt;/thgt;lt;thgt;Operating
Systemlt;/thgt;lt;thgt;Browserlt;/thgt;lt;thgt;versionlt;/thgt;lt;thgt;testscriptlt;/thgt;lt;thgt;serverlt;/thgt;lt;/trgt;);
$.ajax({ type: 'GET', url: /getJobs, dataType: json, success: function
(jobs) { alert(jobs); if(jobs.length == 0) { alert(There are no scheduled
Jobs); $(#jobsTable).hide(); } else { //jobs.forEach(function(job) {
$.each(jobs, function(key,value) { alert(value.server); var tabString =
'lt;trgt;lt;tdgt;' + value.jobid + 'lt;/tdgt;lt;tdgt;' + value.os +
'lt;/tdgt;lt;tdgt;' + value.browser + 'lt;/tdgt;lt;tdgt;' + value.version
+ 'lt;/tdgt;lt;tdgt;' + value.script + 'lt;/tdgt;lt;tdgt;' + value.server
+ 'lt;/tdgt;lt;tdgt;' + 'lt;input type=radio name=joblist id= '+
value.jobid +'value=' + value.jobid + '/gt; lt;/tdgt;lt;/trgt;';
$(#jobsTable).append(tabString); }); } } }); } /code/pre pIn button
onClick showdata()i have to show the selected radio button values to text
boxes and comboboxex/p precodelt;h3gt;List Jobslt;/h3gt; lt;divgt; lt;h1
style=padding: 10px;gt;Jobs In Databaselt;/h1gt; lt;div id=jobTable
style=padding-left: 50px;gt; lt;div style=padding: 5px; padding-left:
0px;gt; lt;table id=jobsTable border=1gt; lt;/tablegt; lt;input
type=button id=show value=showrecord onclick=showdata();/gt; lt;/divgt;
lt;/divgt; lt;br/gt; lt;/divgt; lt;div id=managegt; lt;divgt;
lt;labelgt;Operating Systemslt;/labelgt; lt;select id=OS
onchange=browserlist();gt; lt;option value=win7 32gt;Windows 7 - 32
lt;/optiongt; lt;option value=win7 64gt;Windows 7 - 64 lt;/optiongt;
lt;option value=Vista 32gt;Windows Vista - 32lt;/optiongt; lt;option
value=Vista 64gt;Windows Vista - 64lt;/optiongt; lt;option value=Win8
X64gt;Windows 8 - X64lt;/optiongt; lt;/selectgt; lt;/divgt; lt;divgt;
lt;labelgt;Browserslt;/labelgt; lt;select id=browsers
onchange=browserDet();gt; lt;option value=gt;lt;/optiongt; lt;/selectgt;
lt;/divgt; lt;divgt; lt;labelgt;Versionslt;/labelgt; lt;select
id=versiongt; lt;/selectgt; lt;/divgt; lt;divgt; lt;labelgt;Test
Scriptslt;/labelgt; lt;select id=testscriptlistgt; lt;option
value=gt;lt;/optiongt; lt;option value=gt;lt;/optiongt; lt;/selectgt;
lt;/divgt; lt;divgt; lt;labelgt;Server:lt;/labelgt; lt;input type=text
id=server value= /gt; lt;/divgt; lt;br/gt; lt;/divgt; /code/pre
pAm new to JQuery. I want to pass the selected radio button values on
button click and show that selected radio button values in textboxes and
comboboxes./p pI dont know how it can be done./p pMy current code as
followscode.displayjobs()/code displays the table with values in page
load./p precodefunction displayjobs() { $('#jobsTable').empty();
$(#jobsTable).append(lt;trgt;lt;thgt;Idlt;/thgt;lt;thgt;Operating
Systemlt;/thgt;lt;thgt;Browserlt;/thgt;lt;thgt;versionlt;/thgt;lt;thgt;testscriptlt;/thgt;lt;thgt;serverlt;/thgt;lt;/trgt;);
$.ajax({ type: 'GET', url: /getJobs, dataType: json, success: function
(jobs) { alert(jobs); if(jobs.length == 0) { alert(There are no scheduled
Jobs); $(#jobsTable).hide(); } else { //jobs.forEach(function(job) {
$.each(jobs, function(key,value) { alert(value.server); var tabString =
'lt;trgt;lt;tdgt;' + value.jobid + 'lt;/tdgt;lt;tdgt;' + value.os +
'lt;/tdgt;lt;tdgt;' + value.browser + 'lt;/tdgt;lt;tdgt;' + value.version
+ 'lt;/tdgt;lt;tdgt;' + value.script + 'lt;/tdgt;lt;tdgt;' + value.server
+ 'lt;/tdgt;lt;tdgt;' + 'lt;input type=radio name=joblist id= '+
value.jobid +'value=' + value.jobid + '/gt; lt;/tdgt;lt;/trgt;';
$(#jobsTable).append(tabString); }); } } }); } /code/pre pIn button
onClick showdata()i have to show the selected radio button values to text
boxes and comboboxex/p precodelt;h3gt;List Jobslt;/h3gt; lt;divgt; lt;h1
style=padding: 10px;gt;Jobs In Databaselt;/h1gt; lt;div id=jobTable
style=padding-left: 50px;gt; lt;div style=padding: 5px; padding-left:
0px;gt; lt;table id=jobsTable border=1gt; lt;/tablegt; lt;input
type=button id=show value=showrecord onclick=showdata();/gt; lt;/divgt;
lt;/divgt; lt;br/gt; lt;/divgt; lt;div id=managegt; lt;divgt;
lt;labelgt;Operating Systemslt;/labelgt; lt;select id=OS
onchange=browserlist();gt; lt;option value=win7 32gt;Windows 7 - 32
lt;/optiongt; lt;option value=win7 64gt;Windows 7 - 64 lt;/optiongt;
lt;option value=Vista 32gt;Windows Vista - 32lt;/optiongt; lt;option
value=Vista 64gt;Windows Vista - 64lt;/optiongt; lt;option value=Win8
X64gt;Windows 8 - X64lt;/optiongt; lt;/selectgt; lt;/divgt; lt;divgt;
lt;labelgt;Browserslt;/labelgt; lt;select id=browsers
onchange=browserDet();gt; lt;option value=gt;lt;/optiongt; lt;/selectgt;
lt;/divgt; lt;divgt; lt;labelgt;Versionslt;/labelgt; lt;select
id=versiongt; lt;/selectgt; lt;/divgt; lt;divgt; lt;labelgt;Test
Scriptslt;/labelgt; lt;select id=testscriptlistgt; lt;option
value=gt;lt;/optiongt; lt;option value=gt;lt;/optiongt; lt;/selectgt;
lt;/divgt; lt;divgt; lt;labelgt;Server:lt;/labelgt; lt;input type=text
id=server value= /gt; lt;/divgt; lt;br/gt; lt;/divgt; /code/pre
switch-case with return and break
switch-case with return and break
Just out of curiosity, I often see situations like:
switch(something) {
case 'alice':
return something;
break;
}
Where the break seems to be completely unnecessary, is there any reason
for it to be there anyway?
Just out of curiosity, I often see situations like:
switch(something) {
case 'alice':
return something;
break;
}
Where the break seems to be completely unnecessary, is there any reason
for it to be there anyway?
Why do I get a scroll bar on bottom whilst my content fits?
Why do I get a scroll bar on bottom whilst my content fits?
Well, this is what im talking about. http://jsfiddle.net/CvgFS/1/ My
english is too lacking to explain it any better, I hope its understandable
why I get a scroll bar, I mean, content fits the page. I get this on
Opera.
x
Well, this is what im talking about. http://jsfiddle.net/CvgFS/1/ My
english is too lacking to explain it any better, I hope its understandable
why I get a scroll bar, I mean, content fits the page. I get this on
Opera.
x
Undefined variable notices in PHP class instance call
Undefined variable notices in PHP class instance call
Using PHP, when I call an instance of a class I am getting an undefined
variable notice back. I program in other languages, but am less familiar
with PHP, can you please look at my code and inform me as to my mistake in
defining my class variables? Thanks.
<?php
// create class Bike
class Bike
{
// create variables for class Bike of price, max_speed, and miles
var $price;
var $max_speed;
var $miles;
// create constructor for class Bike with user set price and
max_speed
function __construct($price, $max_speed)
{
$this->price = $price;
$this->max_speed = $max_speed;
}
// METHODS for class Bike:
// displayInfo() - have this method display the bike's price,
maximum speed, and the total miles driven
function displayInfo()
{
echo "Price: $" . $price . "<p>Maximum Speed: " . $max_speed
. "</p>" . "<p>Total Miles Driven: " . $miles . "</p>";
}
// drive() - have it display "Driving" on the screen and increase
the total miles driven by 10
function drive()
{
$miles = $miles + 10;
echo "<p>Driving!</p>" . "<p>Total Miles Driven: " . $miles .
"</p>";
}
// reverse() - have it display "Reversing" on the screen and
decrease the total miles driven by 5...
function reverse()
{
// What would you do to prevent the instance from having
negative miles?
if($miles >= 5)
{
$miles = $miles - 5;
echo "<p>Reversing</p><p>Total Miles Driven: " . $miles .
"</p>";
}
else
{
echo "<p>Total Miles Driven is less than 5 miles, unable
to reverse!</p>";
}
}
}
?>
<?php
// Create 3 bike object class instances
$Schwinn = new Bike(50, '10mph');
$Specialized = new Bike(500, '25mph');
$Cannondale = new Bike(1000, '50mph');
// Have the first instance drive three times, reverse one and have it
displayInfo().
var_dump($Schwinn); // shows instance is created with proper variable
assignments
$Schwinn -> drive();
// $Schwinn -> drive();
// $Schwinn -> drive();
$Schwinn -> reverse();
$Schwinn -> displayInfo();
?>
Using PHP, when I call an instance of a class I am getting an undefined
variable notice back. I program in other languages, but am less familiar
with PHP, can you please look at my code and inform me as to my mistake in
defining my class variables? Thanks.
<?php
// create class Bike
class Bike
{
// create variables for class Bike of price, max_speed, and miles
var $price;
var $max_speed;
var $miles;
// create constructor for class Bike with user set price and
max_speed
function __construct($price, $max_speed)
{
$this->price = $price;
$this->max_speed = $max_speed;
}
// METHODS for class Bike:
// displayInfo() - have this method display the bike's price,
maximum speed, and the total miles driven
function displayInfo()
{
echo "Price: $" . $price . "<p>Maximum Speed: " . $max_speed
. "</p>" . "<p>Total Miles Driven: " . $miles . "</p>";
}
// drive() - have it display "Driving" on the screen and increase
the total miles driven by 10
function drive()
{
$miles = $miles + 10;
echo "<p>Driving!</p>" . "<p>Total Miles Driven: " . $miles .
"</p>";
}
// reverse() - have it display "Reversing" on the screen and
decrease the total miles driven by 5...
function reverse()
{
// What would you do to prevent the instance from having
negative miles?
if($miles >= 5)
{
$miles = $miles - 5;
echo "<p>Reversing</p><p>Total Miles Driven: " . $miles .
"</p>";
}
else
{
echo "<p>Total Miles Driven is less than 5 miles, unable
to reverse!</p>";
}
}
}
?>
<?php
// Create 3 bike object class instances
$Schwinn = new Bike(50, '10mph');
$Specialized = new Bike(500, '25mph');
$Cannondale = new Bike(1000, '50mph');
// Have the first instance drive three times, reverse one and have it
displayInfo().
var_dump($Schwinn); // shows instance is created with proper variable
assignments
$Schwinn -> drive();
// $Schwinn -> drive();
// $Schwinn -> drive();
$Schwinn -> reverse();
$Schwinn -> displayInfo();
?>
can optional parameter be put before params of same type in C#
can optional parameter be put before params of same type in C#
In other words: Is this possible?
public void ShowMessage(string cultureKeyText, string cultureKeyTitle =
null, params string[] fields)
when using comma separated list to call it. How would it know if 2nd
parameter is actually 2nd parameter or 1st in comma separated list of 3rd
parameter?
In other words: Is this possible?
public void ShowMessage(string cultureKeyText, string cultureKeyTitle =
null, params string[] fields)
when using comma separated list to call it. How would it know if 2nd
parameter is actually 2nd parameter or 1st in comma separated list of 3rd
parameter?
how to search letter in span value with jquery
how to search letter in span value with jquery
I want search one letter for example a in many spans and I want if exist
in span show this span and hide others.
<span id="1">janatan</span>
<span id="2">john</span>
<span id="3">jarry</span>
<span id="4">marry</span>
<span id="5">dfdgdf</span>
<span id="6">ghjkgk</span>
I want search one letter for example a in many spans and I want if exist
in span show this span and hide others.
<span id="1">janatan</span>
<span id="2">john</span>
<span id="3">jarry</span>
<span id="4">marry</span>
<span id="5">dfdgdf</span>
<span id="6">ghjkgk</span>
Wednesday, 21 August 2013
MissingMethodException When I Deploy MVC4 Application using TFS build
MissingMethodException When I Deploy MVC4 Application using TFS build
I have MVC4 application which is working perfectly when i published this
manually by copying all files from local to server. I have created TFS
build definition to automate the build process for this application. TFS
build is coping all files correctly but when i am running application i am
getting below exception.
Method not found: 'Void
Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)'.
I checked Newtonsoft.Json.dll presence. It's available in the bin folder.
This dll is comes with Nuget package. I am not getting exact problem.
Please help to resolve this issue. Is there anything i need to do in build
definitions for explicit packages? Why IIS is not finding method even the
dll is available in bin folder?
Thanks in Advance!
I have MVC4 application which is working perfectly when i published this
manually by copying all files from local to server. I have created TFS
build definition to automate the build process for this application. TFS
build is coping all files correctly but when i am running application i am
getting below exception.
Method not found: 'Void
Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)'.
I checked Newtonsoft.Json.dll presence. It's available in the bin folder.
This dll is comes with Nuget package. I am not getting exact problem.
Please help to resolve this issue. Is there anything i need to do in build
definitions for explicit packages? Why IIS is not finding method even the
dll is available in bin folder?
Thanks in Advance!
using definition of derivative
using definition of derivative
$f(x)=x^3-6x^2+9x-5$ is given.
What is the value of $$\lim_{h\to0}\frac{[f'(1+2h)+f'(3-3h)]}{2h}$$
I tried to use the definition of derivative,and here it seems like the
expression will be equal to something like the 2nd derivative of $f(x)$
but I'm confused with $2h$ and $-3h$.
$f(x)=x^3-6x^2+9x-5$ is given.
What is the value of $$\lim_{h\to0}\frac{[f'(1+2h)+f'(3-3h)]}{2h}$$
I tried to use the definition of derivative,and here it seems like the
expression will be equal to something like the 2nd derivative of $f(x)$
but I'm confused with $2h$ and $-3h$.
How to hode a progm, the, reopen on a hotkey C#
How to hode a progm, the, reopen on a hotkey C#
Is there a way to hide a window on close, and then have the window reopen
when you press a hot key?
Is there a way to hide a window on close, and then have the window reopen
when you press a hot key?
Towers of Hanoi Recursive Explanation in Ruby
Towers of Hanoi Recursive Explanation in Ruby
I'm having a difficult time understanding the recursive loop for the
Towers of Hanoi. I've commented and tried various tactics to see how the
procedure is operating, but I can't seem to grasp how the loops are
operating and how the rings are being directed.
def move(rings, from, destination, other)
if rings == 1
ring = from.pop
p "Move ring #{ring} from #{from} to #{destination}"
destination.push ring
else
move(rings-1, from, other, destination)
move(1, from, destination, other)
move(rings-1, other, destination, from)
end
end
Here's the output:
"Move ring 1 from a to c"
"Move ring 2 from a to b"
"Move ring 1 from c to b"
"Move ring 3 from a to c"
"Move ring 1 from b to a"
"Move ring 2 from b to c"
"Move ring 1 from a to c"
I've looked at various cases on this, but I don't see an explanation for
how the loops are being executed. For instance, I can't figure out why is
is it the case that when the rings are even, the first step places ring 1
from a to b, while for all odd number of rings, it's from a to c, as shown
above.
I understand the logic behind the solution, that in order to move n number
of rings to a destination while using an auxiliary peg requires that you
first move n-1 number of rings to the auxiliary peg followed by moving the
nth ring to the destination and repeating the same procedure. But, I'm
unsure how the directions for placement are changing, furthermore, I don't
see how a block is going from c to b when the call to the move method,
above, doesn't seem to mention c to b.
Thank you, in advance, for your time and help.
Also, if you have any suggestions for helping track the process of code
executions in Ruby, please let me know. I'd love to hear some of your
insights to how you'd troubleshoot instances where you're unsure how
things are being executed.
Eager to hear your answer :)
I'm having a difficult time understanding the recursive loop for the
Towers of Hanoi. I've commented and tried various tactics to see how the
procedure is operating, but I can't seem to grasp how the loops are
operating and how the rings are being directed.
def move(rings, from, destination, other)
if rings == 1
ring = from.pop
p "Move ring #{ring} from #{from} to #{destination}"
destination.push ring
else
move(rings-1, from, other, destination)
move(1, from, destination, other)
move(rings-1, other, destination, from)
end
end
Here's the output:
"Move ring 1 from a to c"
"Move ring 2 from a to b"
"Move ring 1 from c to b"
"Move ring 3 from a to c"
"Move ring 1 from b to a"
"Move ring 2 from b to c"
"Move ring 1 from a to c"
I've looked at various cases on this, but I don't see an explanation for
how the loops are being executed. For instance, I can't figure out why is
is it the case that when the rings are even, the first step places ring 1
from a to b, while for all odd number of rings, it's from a to c, as shown
above.
I understand the logic behind the solution, that in order to move n number
of rings to a destination while using an auxiliary peg requires that you
first move n-1 number of rings to the auxiliary peg followed by moving the
nth ring to the destination and repeating the same procedure. But, I'm
unsure how the directions for placement are changing, furthermore, I don't
see how a block is going from c to b when the call to the move method,
above, doesn't seem to mention c to b.
Thank you, in advance, for your time and help.
Also, if you have any suggestions for helping track the process of code
executions in Ruby, please let me know. I'd love to hear some of your
insights to how you'd troubleshoot instances where you're unsure how
things are being executed.
Eager to hear your answer :)
jQuery replace button dropdown list with a label on click
jQuery replace button dropdown list with a label on click
I have a table with a button dropdown list as a column in each row. When
the users selects from the dropdown I want the dropdown to be replaced by
a label that reflects the selection they have made. I have this working
but it will only on the first dropdown list.
The rows are each identical to this, except different row numbers:
<tr>
<td>1.</td>
<td>
<!-- Single button -->
<div class="btn-group" id="MACdropdown">
<button type="button" class="btn btn-success dropdown-toggle"
data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a id="move" href="#">Move Assets</a></li>
<li><a id="swap" href="#">SWAP Assets</a></li>
<li><a id="add" href="#">Add Assets</a></li>
<li><a id="cancel" href="#">Cancel Assets</a></li>
<li><a id="change" href="#">Change Assets</a></li>
<li class="divider"></li>
<li><a href="#">Entire Site Move</a></li>
</ul>
</div>
</td>
<td>4534-23423</td>
<td>123-234</td>
<td>346</td>
</tr>
JS:
$(document).ready(function(){
$("#MACdropdown").on('click' , 'a#move' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">MOVE</span></a>');
})
$("#MACdropdown").on('click' , 'a#swap' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">SWAP</span></a>');
})
$("#MACdropdown").on('click' , 'a#add' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">ADD</span></a>');
})
$("#MACdropdown").on('click' , 'a#cancel' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">CANCEL</span></a>');
})
$("#MACdropdown").on('click' , 'a#change' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">CHANGE</span></a>');
})
});
I would rather not have to make separate sets of JS statements for each
dropdown list on the page. Example: changing #MACdropdown to #MACdropdown1
etc. and making separate functions.
Check out the Fiddle for more info: http://bootply.com/75941
I have a table with a button dropdown list as a column in each row. When
the users selects from the dropdown I want the dropdown to be replaced by
a label that reflects the selection they have made. I have this working
but it will only on the first dropdown list.
The rows are each identical to this, except different row numbers:
<tr>
<td>1.</td>
<td>
<!-- Single button -->
<div class="btn-group" id="MACdropdown">
<button type="button" class="btn btn-success dropdown-toggle"
data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a id="move" href="#">Move Assets</a></li>
<li><a id="swap" href="#">SWAP Assets</a></li>
<li><a id="add" href="#">Add Assets</a></li>
<li><a id="cancel" href="#">Cancel Assets</a></li>
<li><a id="change" href="#">Change Assets</a></li>
<li class="divider"></li>
<li><a href="#">Entire Site Move</a></li>
</ul>
</div>
</td>
<td>4534-23423</td>
<td>123-234</td>
<td>346</td>
</tr>
JS:
$(document).ready(function(){
$("#MACdropdown").on('click' , 'a#move' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">MOVE</span></a>');
})
$("#MACdropdown").on('click' , 'a#swap' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">SWAP</span></a>');
})
$("#MACdropdown").on('click' , 'a#add' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">ADD</span></a>');
})
$("#MACdropdown").on('click' , 'a#cancel' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">CANCEL</span></a>');
})
$("#MACdropdown").on('click' , 'a#change' , function(){
$('#MACdropdown').replaceWith('<a href="viewassets-move.html"><span
class="label label-danger">CHANGE</span></a>');
})
});
I would rather not have to make separate sets of JS statements for each
dropdown list on the page. Example: changing #MACdropdown to #MACdropdown1
etc. and making separate functions.
Check out the Fiddle for more info: http://bootply.com/75941
How to execute multiple commands automatically using ant?
How to execute multiple commands automatically using ant?
I Have n number of rbinfo files in my directory structure.
For eg: I have StateRB.rbinfo file in the directory structure
\wt\lifecycle. To execute this file i run the below ant script:
< exec executable="${WT_HOME}/bin/ResourceBuild.bat">
< arg value="wt.lifecycle.StateRB"/>
< /exec>
This works perfectly fine.
Similarily i have RoleRB.rbinfo file in the location \wt\project and this
can be executed using:
< exec executable="${WT_HOME}/bin/ResourceBuild.bat">
< arg value="wt.project.RoleRB"/>
< /exec>
Note: basically arg value will be folder structure.file name
If i have to run n rbinfo files i need to include the ant scripts n times.
Please can any one suggest if there is any simpler way to run these files
automatically without much manual work!!!
Thanks,
Gouthami
I Have n number of rbinfo files in my directory structure.
For eg: I have StateRB.rbinfo file in the directory structure
\wt\lifecycle. To execute this file i run the below ant script:
< exec executable="${WT_HOME}/bin/ResourceBuild.bat">
< arg value="wt.lifecycle.StateRB"/>
< /exec>
This works perfectly fine.
Similarily i have RoleRB.rbinfo file in the location \wt\project and this
can be executed using:
< exec executable="${WT_HOME}/bin/ResourceBuild.bat">
< arg value="wt.project.RoleRB"/>
< /exec>
Note: basically arg value will be folder structure.file name
If i have to run n rbinfo files i need to include the ant scripts n times.
Please can any one suggest if there is any simpler way to run these files
automatically without much manual work!!!
Thanks,
Gouthami
how to create div with shadow and gradiant?
how to create div with shadow and gradiant?
I'm noob in jquey and css3 but I create one div and I want to edit it and
give it shadow and gradiant but I know about it.
I want create this image but I can not!!!! please guide me about that.
I'm noob in jquey and css3 but I create one div and I want to edit it and
give it shadow and gradiant but I know about it.
I want create this image but I can not!!!! please guide me about that.
Tuesday, 20 August 2013
Cannot get ajax post to work
Cannot get ajax post to work
I am able to the js file to fire which does do the first alert but i
cannot get the 2nd alert to happen, php file is there and working
returning 0 but the alert('finished post'); is not coming up. I think its
some syntax I am missing.
$(function () {
$("#login_form").submit(function () {
alert('started js');
//get the username and password
var username = $('#username').val();
var password = $('#password').val();
//use ajax to run the check
$.post("../php/checklogin.php", { username: username, password:
password },
function (result) {
alert('finished post');
//if the result is not 1
if (result == 0) {
//Alert username and password are wrong
$('#login').html('Credentials wrong');
alert('got 0');
}
});
});
});
I am able to the js file to fire which does do the first alert but i
cannot get the 2nd alert to happen, php file is there and working
returning 0 but the alert('finished post'); is not coming up. I think its
some syntax I am missing.
$(function () {
$("#login_form").submit(function () {
alert('started js');
//get the username and password
var username = $('#username').val();
var password = $('#password').val();
//use ajax to run the check
$.post("../php/checklogin.php", { username: username, password:
password },
function (result) {
alert('finished post');
//if the result is not 1
if (result == 0) {
//Alert username and password are wrong
$('#login').html('Credentials wrong');
alert('got 0');
}
});
});
});
Removing values from list python, without square brackets
Removing values from list python, without square brackets
Does anyone know how I can remove some vaue from inside of tuple square
brackets.
I have something like
def fun:
val1=re.findall(pattern1, html_stuff)
val2=re.findall(pattern2, html_stuff)
return val1,val2
mylist=fun()
print mylist[0]
print mylist[1]
this will return
['stuff']
['more stuff']
I can't find out how to remove 'stuff' from []
Does anyone know how I can remove some vaue from inside of tuple square
brackets.
I have something like
def fun:
val1=re.findall(pattern1, html_stuff)
val2=re.findall(pattern2, html_stuff)
return val1,val2
mylist=fun()
print mylist[0]
print mylist[1]
this will return
['stuff']
['more stuff']
I can't find out how to remove 'stuff' from []
Ruby route for custom controller
Ruby route for custom controller
So I want when I access: site.com/panel to look into
/app/controller/panel/index_controller.rb
Before I start I'm new to ruby, I started a couple hours ago
So in my routes.rb I have this
namespace :panel do
root 'index#index'
resources :index
end
And I created a file called index_controller.rb in
/app/controller/panel/index_controller.rb which looks like this
class IndexController < ApplicationController
def index
@foo = "Foo"
end
end
Now when I go to site.com/panel I get this: superclass mismatch for class
IndexController
What I did wrong? Also can I setup diffrent views and layout here to use
for the controllers inside /app/controller/panel/*_controller.rb
So I want when I access: site.com/panel to look into
/app/controller/panel/index_controller.rb
Before I start I'm new to ruby, I started a couple hours ago
So in my routes.rb I have this
namespace :panel do
root 'index#index'
resources :index
end
And I created a file called index_controller.rb in
/app/controller/panel/index_controller.rb which looks like this
class IndexController < ApplicationController
def index
@foo = "Foo"
end
end
Now when I go to site.com/panel I get this: superclass mismatch for class
IndexController
What I did wrong? Also can I setup diffrent views and layout here to use
for the controllers inside /app/controller/panel/*_controller.rb
Iptables and Port Scanning and Recent module
Iptables and Port Scanning and Recent module
I'm trying to write an adaptive firewall using iptables, and am not clear
on how the recent module is working. For example, see
http://blog.zioup.org/2008/iptables_recent/
Snippet from my iptables:
...input stuff, established, etc...
-A INPUT -m conntrack --ctstate NEW -j limiter
... more input stuff...
# very end of chain, nothing matches. Likely unauthorized port
-A INPUT -m conntrack --ctstate NEW -m recent --name PORTSCAN --set
# limiter table
-A limiter -m recent --update --name PORTSCAN
-A limiter -m recent --rcheck --name PORTSCAN --hitcount 10 --seconds 300
-j LOG
This setup works. Watching /proc/net/xt_recent/PORTSCAN, running nmap on a
closed port adds my ip, and then trying to connect to, say, port 80 (which
is open) updates the list. Additionally, if I connect to just open ports,
I am not added to the list.
My question is, when I try to combine the two lines in the limiter table
into one, it no longer works.
#-A limiter -m recent --update --name PORTSCAN
#-A limiter -m recent --rcheck --name PORTSCAN --hitcount 10 --seconds 300
-j LOG
-A limiter -m recent --update --name PORTSCAN --hitcount 10 --seconds 300
-j LOG
Scanning an open port after a closed one does not update the list
(although if the limit of 10 packets/300 secs is overrun, it is logged).
My understanding was that the update line would be equivalent to the other
two. Why not?
I'm trying to write an adaptive firewall using iptables, and am not clear
on how the recent module is working. For example, see
http://blog.zioup.org/2008/iptables_recent/
Snippet from my iptables:
...input stuff, established, etc...
-A INPUT -m conntrack --ctstate NEW -j limiter
... more input stuff...
# very end of chain, nothing matches. Likely unauthorized port
-A INPUT -m conntrack --ctstate NEW -m recent --name PORTSCAN --set
# limiter table
-A limiter -m recent --update --name PORTSCAN
-A limiter -m recent --rcheck --name PORTSCAN --hitcount 10 --seconds 300
-j LOG
This setup works. Watching /proc/net/xt_recent/PORTSCAN, running nmap on a
closed port adds my ip, and then trying to connect to, say, port 80 (which
is open) updates the list. Additionally, if I connect to just open ports,
I am not added to the list.
My question is, when I try to combine the two lines in the limiter table
into one, it no longer works.
#-A limiter -m recent --update --name PORTSCAN
#-A limiter -m recent --rcheck --name PORTSCAN --hitcount 10 --seconds 300
-j LOG
-A limiter -m recent --update --name PORTSCAN --hitcount 10 --seconds 300
-j LOG
Scanning an open port after a closed one does not update the list
(although if the limit of 10 packets/300 secs is overrun, it is logged).
My understanding was that the update line would be equivalent to the other
two. Why not?
Ethernet port plastic plug blocking port access on server
Ethernet port plastic plug blocking port access on server
I have Dell Poweredge server with plastic blockers inside their ethernet
ports. My problem is that I don't know how to take it out. You can see
photo of the plug here:
I tried to pull them out, or to squeeze and then pull, but they don't
move. I cannot find anything on the Dell installation manual, so it's
probably not provided by Dell.
Did you see this kind of plugs and do you know how to take them out
without risking to break something?
I have Dell Poweredge server with plastic blockers inside their ethernet
ports. My problem is that I don't know how to take it out. You can see
photo of the plug here:
I tried to pull them out, or to squeeze and then pull, but they don't
move. I cannot find anything on the Dell installation manual, so it's
probably not provided by Dell.
Did you see this kind of plugs and do you know how to take them out
without risking to break something?
Create loop scroll
Create loop scroll
I create this script for simple scroll of news , the problem for me it´s i
don´t know how i can create loop in the scroll
For example when scroll go to the end actually stop , i want the scroll
start other time , when go to the end start other time and continue all
time
My script :
function scroll_cp(id,time)
{
var div = $('#'+id);
setInterval(function(){
var pos = div.scrollTop();
div.scrollTop(pos + 2);
}, time)
}
Thank´s for the help
I create this script for simple scroll of news , the problem for me it´s i
don´t know how i can create loop in the scroll
For example when scroll go to the end actually stop , i want the scroll
start other time , when go to the end start other time and continue all
time
My script :
function scroll_cp(id,time)
{
var div = $('#'+id);
setInterval(function(){
var pos = div.scrollTop();
div.scrollTop(pos + 2);
}, time)
}
Thank´s for the help
Monday, 19 August 2013
JavaScript event on addition of certain element
JavaScript event on addition of certain element
There is a page with list of URLs,
When User clicks on one of the URL, a JQuery Modal popup opens with list
of elements. Items in the list are added dynamically by doing AJAX call.
Each Item in the list has Raty & timeago (both JQuery Plugins){"5 star
rating, 2 Months Ago"}.
Now the problem is - Typically We execute JavaScript functions related to
these plugins at the time of page load in Document.ready event.
However, Now these functions need to be executed After items are added &
are ready for processing.
What is name of the event to handle?
There is a page with list of URLs,
When User clicks on one of the URL, a JQuery Modal popup opens with list
of elements. Items in the list are added dynamically by doing AJAX call.
Each Item in the list has Raty & timeago (both JQuery Plugins){"5 star
rating, 2 Months Ago"}.
Now the problem is - Typically We execute JavaScript functions related to
these plugins at the time of page load in Document.ready event.
However, Now these functions need to be executed After items are added &
are ready for processing.
What is name of the event to handle?
What is the meaning of "ITEM_ID_LIST"?
What is the meaning of "ITEM_ID_LIST"?
at the code below, what is the meaning of "ITEM_ID_LIST".
I don't know what to replace this..."ITEM_ID_LIST"
ArrayList skuList = new ArrayList();
skuList.add("premiumUpgrade");
skuList.add("gas");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
at the code below, what is the meaning of "ITEM_ID_LIST".
I don't know what to replace this..."ITEM_ID_LIST"
ArrayList skuList = new ArrayList();
skuList.add("premiumUpgrade");
skuList.add("gas");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
Bxslider not working
Bxslider not working
I'm implementing bxSlider in a rails app, I'm having trouble making it
work, so far my issue is transition is not working instead appear each one
below the other. Can you point me what I'm missing?
HTML:
<!--BxSlider-->
<ul class="bxslider">
<li>
<%= image_tag "header1.png" %>
<div class="row text-center">
<div class="span10 offset1">
<h1>Tittle one</h1><br />
<a class="btn-main" href="about.html">Learn More</a>
</div>
</div>
</li>
<li>
<%= image_tag "header2.png" %>
<div class="row text-center">
<div class="span10 offset1">
<h1>Tittle 2</h1><br />
<a class="btn-main" href="about.html">Learn More</a>
</div>
</div>
</li>
</ul>
CSS:
/** RESET AND LAYOUT
===================================*/
.bx-wrapper {
position: relative;
margin: 0 auto 60px;
padding: 0;
*zoom: 1;
}
.bx-wrapper img {
max-width: 100%;
display: block;
}
/** THEME
===================================*/
.bx-wrapper .bx-viewport {
-moz-box-shadow: 0 0 5px #ccc;
-webkit-box-shadow: 0 0 5px #ccc;
box-shadow: 0 0 5px #ccc;
border: solid #fff 5px;
left: -5px;
background: #fff;
}
.bx-wrapper .bx-pager,
.bx-wrapper .bx-controls-auto {
position: absolute;
bottom: -30px;
width: 100%;
}
/* LOADER */
.bx-wrapper .bx-loading {
min-height: 50px;
background: url(bx_loader.gif) center center no-repeat #fff;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2000;
}
/* PAGER */
.bx-wrapper .bx-pager {
text-align: center;
font-size: .85em;
font-family: Arial;
font-weight: bold;
color: #666;
padding-top: 20px;
}
.bx-wrapper .bx-pager .bx-pager-item,
.bx-wrapper .bx-controls-auto .bx-controls-auto-item {
display: inline-block;
*zoom: 1;
*display: inline;
}
.bx-wrapper .bx-pager.bx-default-pager a {
background: #666;
text-indent: -9999px;
display: block;
width: 10px;
height: 10px;
margin: 0 5px;
outline: 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.bx-wrapper .bx-pager.bx-default-pager a:hover,
.bx-wrapper .bx-pager.bx-default-pager a.active {
background: #000;
}
/* DIRECTION CONTROLS (NEXT / PREV) */
.bx-wrapper .bx-prev {
left: 10px;
background: url(controls.png) no-repeat 0 -32px;
}
.bx-wrapper .bx-next {
right: 10px;
background: url(controls.png) no-repeat -43px -32px;
}
.bx-wrapper .bx-prev:hover {
background-position: 0 0;
}
.bx-wrapper .bx-next:hover {
background-position: -43px 0;
}
.bx-wrapper .bx-controls-direction a {
position: absolute;
top: 50%;
margin-top: -16px;
outline: 0;
width: 32px;
height: 32px;
text-indent: -9999px;
z-index: 9999;
}
.bx-wrapper .bx-controls-direction a.disabled {
display: none;
}
/* AUTO CONTROLS (START / STOP) */
.bx-wrapper .bx-controls-auto {
text-align: center;
}
.bx-wrapper .bx-controls-auto .bx-start {
display: block;
text-indent: -9999px;
width: 10px;
height: 11px;
outline: 0;
background: url(controls.png) -86px -11px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-start:hover,
.bx-wrapper .bx-controls-auto .bx-start.active {
background-position: -86px 0;
}
.bx-wrapper .bx-controls-auto .bx-stop {
display: block;
text-indent: -9999px;
width: 9px;
height: 11px;
outline: 0;
background: url(controls.png) -86px -44px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-stop:hover,
.bx-wrapper .bx-controls-auto .bx-stop.active {
background-position: -86px -33px;
}
/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
text-align: left;
width: 80%;
}
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager
.bx-controls-auto {
right: 0;
width: 35px;
}
/* IMAGE CAPTIONS */
.bx-wrapper .bx-caption {
position: absolute;
bottom: 0;
left: 0;
background: #666\9;
background: rgba(80, 80, 80, 0.75);
width: 100%;
}
.bx-wrapper .bx-caption span {
color: #fff;
font-family: Arial;
display: block;
font-size: .85em;
padding: 10px;
}
JS:
<script>
$(document).ready(function(){
$('.bxslider').bxSlider({
mode: 'fade',
auto: true,
pause: 4000,
autoHover: false,
touchEnabled: true,
adaptiveHeight: false,
autoControls: false
});
});
</script>
Error:
Uncaught TypeError: Object [object Object] has no method 'bxSlider'
I'm implementing bxSlider in a rails app, I'm having trouble making it
work, so far my issue is transition is not working instead appear each one
below the other. Can you point me what I'm missing?
HTML:
<!--BxSlider-->
<ul class="bxslider">
<li>
<%= image_tag "header1.png" %>
<div class="row text-center">
<div class="span10 offset1">
<h1>Tittle one</h1><br />
<a class="btn-main" href="about.html">Learn More</a>
</div>
</div>
</li>
<li>
<%= image_tag "header2.png" %>
<div class="row text-center">
<div class="span10 offset1">
<h1>Tittle 2</h1><br />
<a class="btn-main" href="about.html">Learn More</a>
</div>
</div>
</li>
</ul>
CSS:
/** RESET AND LAYOUT
===================================*/
.bx-wrapper {
position: relative;
margin: 0 auto 60px;
padding: 0;
*zoom: 1;
}
.bx-wrapper img {
max-width: 100%;
display: block;
}
/** THEME
===================================*/
.bx-wrapper .bx-viewport {
-moz-box-shadow: 0 0 5px #ccc;
-webkit-box-shadow: 0 0 5px #ccc;
box-shadow: 0 0 5px #ccc;
border: solid #fff 5px;
left: -5px;
background: #fff;
}
.bx-wrapper .bx-pager,
.bx-wrapper .bx-controls-auto {
position: absolute;
bottom: -30px;
width: 100%;
}
/* LOADER */
.bx-wrapper .bx-loading {
min-height: 50px;
background: url(bx_loader.gif) center center no-repeat #fff;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2000;
}
/* PAGER */
.bx-wrapper .bx-pager {
text-align: center;
font-size: .85em;
font-family: Arial;
font-weight: bold;
color: #666;
padding-top: 20px;
}
.bx-wrapper .bx-pager .bx-pager-item,
.bx-wrapper .bx-controls-auto .bx-controls-auto-item {
display: inline-block;
*zoom: 1;
*display: inline;
}
.bx-wrapper .bx-pager.bx-default-pager a {
background: #666;
text-indent: -9999px;
display: block;
width: 10px;
height: 10px;
margin: 0 5px;
outline: 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.bx-wrapper .bx-pager.bx-default-pager a:hover,
.bx-wrapper .bx-pager.bx-default-pager a.active {
background: #000;
}
/* DIRECTION CONTROLS (NEXT / PREV) */
.bx-wrapper .bx-prev {
left: 10px;
background: url(controls.png) no-repeat 0 -32px;
}
.bx-wrapper .bx-next {
right: 10px;
background: url(controls.png) no-repeat -43px -32px;
}
.bx-wrapper .bx-prev:hover {
background-position: 0 0;
}
.bx-wrapper .bx-next:hover {
background-position: -43px 0;
}
.bx-wrapper .bx-controls-direction a {
position: absolute;
top: 50%;
margin-top: -16px;
outline: 0;
width: 32px;
height: 32px;
text-indent: -9999px;
z-index: 9999;
}
.bx-wrapper .bx-controls-direction a.disabled {
display: none;
}
/* AUTO CONTROLS (START / STOP) */
.bx-wrapper .bx-controls-auto {
text-align: center;
}
.bx-wrapper .bx-controls-auto .bx-start {
display: block;
text-indent: -9999px;
width: 10px;
height: 11px;
outline: 0;
background: url(controls.png) -86px -11px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-start:hover,
.bx-wrapper .bx-controls-auto .bx-start.active {
background-position: -86px 0;
}
.bx-wrapper .bx-controls-auto .bx-stop {
display: block;
text-indent: -9999px;
width: 9px;
height: 11px;
outline: 0;
background: url(controls.png) -86px -44px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-stop:hover,
.bx-wrapper .bx-controls-auto .bx-stop.active {
background-position: -86px -33px;
}
/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
text-align: left;
width: 80%;
}
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager
.bx-controls-auto {
right: 0;
width: 35px;
}
/* IMAGE CAPTIONS */
.bx-wrapper .bx-caption {
position: absolute;
bottom: 0;
left: 0;
background: #666\9;
background: rgba(80, 80, 80, 0.75);
width: 100%;
}
.bx-wrapper .bx-caption span {
color: #fff;
font-family: Arial;
display: block;
font-size: .85em;
padding: 10px;
}
JS:
<script>
$(document).ready(function(){
$('.bxslider').bxSlider({
mode: 'fade',
auto: true,
pause: 4000,
autoHover: false,
touchEnabled: true,
adaptiveHeight: false,
autoControls: false
});
});
</script>
Error:
Uncaught TypeError: Object [object Object] has no method 'bxSlider'
Accidently Deleted GL folder located at /usr/include/GL
Accidently Deleted GL folder located at /usr/include/GL
[I am working on Fedora 19 x64]
This sounds silly but I intended to remove the GL folder located at
/usr/local/include. But I accidently removed the GL folder located at
/usr/include.
So I have kind of lost gl.h, glu.h and many other header file.
Is there any way to fix this.
[I am working on Fedora 19 x64]
This sounds silly but I intended to remove the GL folder located at
/usr/local/include. But I accidently removed the GL folder located at
/usr/include.
So I have kind of lost gl.h, glu.h and many other header file.
Is there any way to fix this.
Mac OS X - File Open Dialog: Can't sort or resize columns
Mac OS X - File Open Dialog: Can't sort or resize columns
I'm having a problem where when I go to File > Open; I can't resize the
different columns.
I'm having a problem where when I go to File > Open; I can't resize the
different columns.
WPF - Window DataContext or ElementName
WPF - Window DataContext or ElementName
I am currently facing a little problem with specifing or not specifing the
datacontext of a window, and why there is a difference between various
methods. Hope you can help me out.
Lets start with some code to show my problem. This is the code behind for
my TestWindow.xaml.cs, nothing really special about it just a simple
string property
public partial class TestWindow : Window
{
private string _helloWorld = "Hello World!";
public string HelloWorld
{
get { return _helloWorld; }
set { _helloWorld = value; }
}
public TestWindow()
{
InitializeComponent();
}
}
This code will be the same for all 3 following XAML layouts, so no changes
behind the code only in XAML.
1.) Databinding with given ElementName
<Window x:Class="Ktsw.Conx.ConxClient.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="300" Width="300"
Name="TestWin">
<Grid>
<TextBlock Text="{Binding HelloWorld,
ElementName=TestWin}"></TextBlock>
</Grid>
</Window>
2.) Databinding with specifing DataContext on Window
<Window x:Class="Ktsw.Conx.ConxClient.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="300" Width="300"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<Grid>
<TextBlock Text="{Binding HelloWorld}"></TextBlock>
</Grid>
</Window>
3.) Neither ElementName nor specifing DataContext
<Window x:Class="Ktsw.Conx.ConxClient.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="300" Width="300">
<Grid>
<TextBlock Text="{Binding HelloWorld}"></TextBlock>
</Grid>
</Window>
The first two methods work just fine, but why fails the 3rd?
In the first method I am not specifing the DataContext and it works
automatically, in the second method I am not specifing the ElementName and
it works, but without declaring one of those it fails. Why would it fail
getting both automatically, but work fine with getting each individually?
I am currently facing a little problem with specifing or not specifing the
datacontext of a window, and why there is a difference between various
methods. Hope you can help me out.
Lets start with some code to show my problem. This is the code behind for
my TestWindow.xaml.cs, nothing really special about it just a simple
string property
public partial class TestWindow : Window
{
private string _helloWorld = "Hello World!";
public string HelloWorld
{
get { return _helloWorld; }
set { _helloWorld = value; }
}
public TestWindow()
{
InitializeComponent();
}
}
This code will be the same for all 3 following XAML layouts, so no changes
behind the code only in XAML.
1.) Databinding with given ElementName
<Window x:Class="Ktsw.Conx.ConxClient.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="300" Width="300"
Name="TestWin">
<Grid>
<TextBlock Text="{Binding HelloWorld,
ElementName=TestWin}"></TextBlock>
</Grid>
</Window>
2.) Databinding with specifing DataContext on Window
<Window x:Class="Ktsw.Conx.ConxClient.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="300" Width="300"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<Grid>
<TextBlock Text="{Binding HelloWorld}"></TextBlock>
</Grid>
</Window>
3.) Neither ElementName nor specifing DataContext
<Window x:Class="Ktsw.Conx.ConxClient.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="300" Width="300">
<Grid>
<TextBlock Text="{Binding HelloWorld}"></TextBlock>
</Grid>
</Window>
The first two methods work just fine, but why fails the 3rd?
In the first method I am not specifing the DataContext and it works
automatically, in the second method I am not specifing the ElementName and
it works, but without declaring one of those it fails. Why would it fail
getting both automatically, but work fine with getting each individually?
Sunday, 18 August 2013
Dynamic selection of fields
Dynamic selection of fields
I'm attempting to write a linq extension method but I'm missing some
knowledge. I'm not even sure I know how to ask what I need, so please
consider the following:
public static class LinqExtensions
{
public class MyExtRet
{
WHAT_TYPE keys;
WHAT_TYPE vals;
}
public static IQueryable<T> MyExt<T, TKey>(this IQueryable<T> source,
Expression<Func<T, TKey>> keySelector)
{
List<MyExtRet> ret = new List<MyExtRet>();
foreach (var o in source.OrderBy(keySelector))
{
MyExtRet r = new MyExtRet();
r.keys = ; // how to dereference?
r.vals = ;
}
}
}
I want to be able to call this thusly (using EF):
TestContainer db = new TestContainer();
var MyList = db.SomeEntity
.Select(x => new { x.state, x.year, x.price })
.MyExt(x => new { x.state, x.year });
foreach (var o in MyList)
{
Console.WriteLine(o.keys.state);
Console.WriteLine(o.vals.price);
}
with the result that I get objects where the keys are separated from the
values.
so my question is: how do I dereference o, which contains some object the
properties of which I don't know, to select the values of all those
properties given to me as keys in the keySelector, and then select the
values of all those properties NOT given to me?
and furthermore, how do I return this stuff so it's IQueryable (I'm not
even sure how to declare the right return type)?
thanks for thinking about it
-- ekkis
I'm attempting to write a linq extension method but I'm missing some
knowledge. I'm not even sure I know how to ask what I need, so please
consider the following:
public static class LinqExtensions
{
public class MyExtRet
{
WHAT_TYPE keys;
WHAT_TYPE vals;
}
public static IQueryable<T> MyExt<T, TKey>(this IQueryable<T> source,
Expression<Func<T, TKey>> keySelector)
{
List<MyExtRet> ret = new List<MyExtRet>();
foreach (var o in source.OrderBy(keySelector))
{
MyExtRet r = new MyExtRet();
r.keys = ; // how to dereference?
r.vals = ;
}
}
}
I want to be able to call this thusly (using EF):
TestContainer db = new TestContainer();
var MyList = db.SomeEntity
.Select(x => new { x.state, x.year, x.price })
.MyExt(x => new { x.state, x.year });
foreach (var o in MyList)
{
Console.WriteLine(o.keys.state);
Console.WriteLine(o.vals.price);
}
with the result that I get objects where the keys are separated from the
values.
so my question is: how do I dereference o, which contains some object the
properties of which I don't know, to select the values of all those
properties given to me as keys in the keySelector, and then select the
values of all those properties NOT given to me?
and furthermore, how do I return this stuff so it's IQueryable (I'm not
even sure how to declare the right return type)?
thanks for thinking about it
-- ekkis
How to rotate an image by its bottom center?
How to rotate an image by its bottom center?
I tried to rotate an image by its bottom center by setting the anchorPoint
property of the views layer to CGPointMake(0.5, 1).It did rotate based on
the bottom center,but the image views bottom center was translated to the
image views center position and thus the whole image was translated up by
half the height of the image.How to have the image view retain its center
but still rotate about its bottom center?
Has anyone ever encountered this issue before?
Thanks!
I tried to rotate an image by its bottom center by setting the anchorPoint
property of the views layer to CGPointMake(0.5, 1).It did rotate based on
the bottom center,but the image views bottom center was translated to the
image views center position and thus the whole image was translated up by
half the height of the image.How to have the image view retain its center
but still rotate about its bottom center?
Has anyone ever encountered this issue before?
Thanks!
Invalid Signature - Creating Flickr Photoset
Invalid Signature - Creating Flickr Photoset
I'am trying now for hours to get a valid api call for flickr. The
following link is build by my clojure program:
"http://api.flickr.com/services/rest/?method=flickr.photosets.create&oauth_signature=
{sig}&oauth_token={token}&oauth_consumer_key={key}&oauth_signature_method=HMAC-SHA1&oauth_timestamp={time}&oauth_nonce={nonce}&oauth_version=1.0&title={title}&primary_photo_id={photoid}&format=json&nojsoncallback=1"
And that is the message the browser returns:
oauth_problem=signature_invalid&debug_sbs=GET&http%3A%2F%2Fapi.flickr.com%2Fservices%2Frest%2F&format%3Djson%26method%3Dflickr.photosets.create%26nojsoncallback%3D1%26oauth_consumer_key%3D23XXXXXXXXXXX6e46a05ae55c4%26oauth_nonce%3De6u52XXXXXXXXXpphqner4e0j%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D13XXXXX06%26oauth_token%3D721XXXXXXXX503-356bXXXXXXXf66e%26oauth_version%3D1.0%26primary_photo_id%3D12345678%26title%3Dphotoset-title
Calls with method "flickr.photosets.getPhotos" and
"flickr.photosets.getList" are working.
Thanks for any help!
I'am trying now for hours to get a valid api call for flickr. The
following link is build by my clojure program:
"http://api.flickr.com/services/rest/?method=flickr.photosets.create&oauth_signature=
{sig}&oauth_token={token}&oauth_consumer_key={key}&oauth_signature_method=HMAC-SHA1&oauth_timestamp={time}&oauth_nonce={nonce}&oauth_version=1.0&title={title}&primary_photo_id={photoid}&format=json&nojsoncallback=1"
And that is the message the browser returns:
oauth_problem=signature_invalid&debug_sbs=GET&http%3A%2F%2Fapi.flickr.com%2Fservices%2Frest%2F&format%3Djson%26method%3Dflickr.photosets.create%26nojsoncallback%3D1%26oauth_consumer_key%3D23XXXXXXXXXXX6e46a05ae55c4%26oauth_nonce%3De6u52XXXXXXXXXpphqner4e0j%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D13XXXXX06%26oauth_token%3D721XXXXXXXX503-356bXXXXXXXf66e%26oauth_version%3D1.0%26primary_photo_id%3D12345678%26title%3Dphotoset-title
Calls with method "flickr.photosets.getPhotos" and
"flickr.photosets.getList" are working.
Thanks for any help!
Pushing to heroku got an asset precompile error database error
Pushing to heroku got an asset precompile error database error
I git cloned down a repo (a simple job board site made in rails). I
altered the gemfile (removed sqlite 3 and added in pg, altered the
database.yml file to use pg).
I added in config.assets.initialize_on_precompile = true to application.rb
to fix the precompile assets issue
then when I push to heroku, I am getting this error.
Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
No such file or directory - /tmp/build_1anu322cyrrs8/config/email.yml
Since I git cloned this down, I did not write this so I am still learning
the code. What is this tmp file that I am supposed to need? where should I
look?
Here is a bit more of the log that I feel like its needed
Tasks: TOP => environment
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 28.1MB
-----> Launching... done, v6
http://secret-forest-8321.herokuapp.com deployed to Heroku
I git cloned down a repo (a simple job board site made in rails). I
altered the gemfile (removed sqlite 3 and added in pg, altered the
database.yml file to use pg).
I added in config.assets.initialize_on_precompile = true to application.rb
to fix the precompile assets issue
then when I push to heroku, I am getting this error.
Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
No such file or directory - /tmp/build_1anu322cyrrs8/config/email.yml
Since I git cloned this down, I did not write this so I am still learning
the code. What is this tmp file that I am supposed to need? where should I
look?
Here is a bit more of the log that I feel like its needed
Tasks: TOP => environment
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 28.1MB
-----> Launching... done, v6
http://secret-forest-8321.herokuapp.com deployed to Heroku
Why is twitter bootstrap carousel class "slide" unknown in bootsrap 3
Why is twitter bootstrap carousel class "slide" unknown in bootsrap 3
I have downloaded the twitter bootsrap carousel example. I noticed that
when I navigate the slide nothing happens and in my view the "slide" class
from the bootstrap.css version 3 is unknown.
Based on the heading below I believe I have all the necessary js and css
files.
I have 2 questions. Why is the the "slide" class unknown and should the
the carousel be navigable straight out of the box?
<head>
<link href ="/Content/bootstrap/css/bootstrap.min.css"
rel="stylesheet">
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script
src="/Content/bootstrap/js-twitter-bootstrap/bootstrap-dropdown.js"></script>
<script
src="/Content/bootstrap/css/bootstrap-responsive.css"></script>
<script data-main="/Scripts/main"
src="~/Scripts/require.min.js"></script>
<script src="/Content/bootstrap/js/bootstrap.min.js"></script>
</head>
<div id="carousel-example-generic" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0"
class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
...
</div>
</div>
...
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic"
data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic"
data-slide="next">
<span class="icon-next"></span>
</a>
</div
I have downloaded the twitter bootsrap carousel example. I noticed that
when I navigate the slide nothing happens and in my view the "slide" class
from the bootstrap.css version 3 is unknown.
Based on the heading below I believe I have all the necessary js and css
files.
I have 2 questions. Why is the the "slide" class unknown and should the
the carousel be navigable straight out of the box?
<head>
<link href ="/Content/bootstrap/css/bootstrap.min.css"
rel="stylesheet">
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script
src="/Content/bootstrap/js-twitter-bootstrap/bootstrap-dropdown.js"></script>
<script
src="/Content/bootstrap/css/bootstrap-responsive.css"></script>
<script data-main="/Scripts/main"
src="~/Scripts/require.min.js"></script>
<script src="/Content/bootstrap/js/bootstrap.min.js"></script>
</head>
<div id="carousel-example-generic" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0"
class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
...
</div>
</div>
...
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic"
data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic"
data-slide="next">
<span class="icon-next"></span>
</a>
</div
EXTJS 3.4: Missing header in grid panel when number of columns grows
EXTJS 3.4: Missing header in grid panel when number of columns grows
I have an application developed using extjs 3.4. We use Grid panel and
populate rows using array store. The array size is huge, 68 columns. Till
around 50 columns the header was displaying right. But when i start adding
more columns, missing headers. I have a main headers(3 of them) and
subclassed to 4 sub headers and each sub headers has it own headers.
When I inspect the HTML component using debugger tools, i see that the
text is available in the component. Just that it is not displayed on the
screen. I am using IE9. I have tried both in non compatible and compatible
views.
Ext.each(subgroup2, function(subhdr2){
fields.push({
type: 'string',
name: headerText + subhdr2
});
columns.push({
dataIndex: headerText + subhdr2,
header:
(trimHdr(subhdr2)=="img")?
setHistCol(headerText+subhdr2):subhdr2,
headerAsText: true,
width: setWidth(subhdr2),
//width:
(trimHdr(subhdr2)=="img")?3:60,
// flex:
(trimHdr(subhdr2)=="img")?0.2:1,
// minWidth: setWidth(subhdr2), //PL change from width to minWidth
menuDisabled: true,
renderer: function (value, metaData, record, rowIndex, colIndex, store) {
//console.info("renderer subhdr2: "+ subhdr2);
//if (colIndex==28){ //
if(subhdr2 == 'PR-img'){
return String.format(
'<span id="histLink"
class="headerExpandImg"
title="Click to open
history screen"></span>');
} else {
if(subhdr2.indexOf('Accts')
> 0){
return String.format(
Ext.util.Format.number(value,
"123,456"));
}else if(subhdr2=="Change
in Long Value" ||
subhdr2=="Change in
Price"){
return (value < 0) ?
String.format('<font
class="negCell">'+Ext.util.Format.number((value*-1),
"(12.00%)")+'</font>')
:
String.format(Ext.util.Format.number(value,
"12.00%"));
}else{
return (value < 0) ?
String.format( '<font
class="negCell">'+
Ext.util.Format.number((value*-1)/million,
"(1,234.00)")
+'</font>')
:
String.format(
Ext.util.Format.number(value/million,
"123,456.00"));
}
}
},
listeners : {
scope : this,
click : function(column, grid,
rowIndex, eventObj){
//if (column.id==28){
if(subhdr2 ==
'PR-img'){
var record =
grid.getStore().getAt(rowIndex);
var baclass =
((rowIndex==0)&&(record.get("broadAssetCode")==""))?tripWireTab.searchCriteria.baClass:record.get("broadAssetCode");
var prodtypecode =
((rowIndex==0)&&(record.get("prodTypeCode")==""))?tripWireTab.searchCriteria.productType
:record.get("prodTypeCode");
var srcLink = (
(rowIndex==0)&&(record.get("broadAssetCode")=="")&&(record.get("prodTypeCode")==""))?"prodtype":"security";
var bastore =
tripWireTab.toolBarRef.getBroadAssetStore();
var collection =
bastore.query('code',
baclass, true,
false);
var badesc =
((collection.items[0]!=null)||(collection.items[0]!=undefined))
?collection.items[0].get('Description'):"N/A";
var proddesc =
Ext.util.Format.stripTags(record.get("Security
Description"));
var histTitle =
(srcLink=="prodtype")?
String.format(
"Broad Asset Class
=
"+Ext.util.Format.capitalize(
badesc) + "<br
/>"+ "Product Type
= "+proddesc )
:
String.format(
"Security
=
"+
proddesc
+"
("+record.get("securityNo")+")");
callHistoryService(srcLink,
false, baclass,
prodtypecode,
record.get("securityNo"),histTitle);
}
}
}
});
}); // eof
I have an application developed using extjs 3.4. We use Grid panel and
populate rows using array store. The array size is huge, 68 columns. Till
around 50 columns the header was displaying right. But when i start adding
more columns, missing headers. I have a main headers(3 of them) and
subclassed to 4 sub headers and each sub headers has it own headers.
When I inspect the HTML component using debugger tools, i see that the
text is available in the component. Just that it is not displayed on the
screen. I am using IE9. I have tried both in non compatible and compatible
views.
Ext.each(subgroup2, function(subhdr2){
fields.push({
type: 'string',
name: headerText + subhdr2
});
columns.push({
dataIndex: headerText + subhdr2,
header:
(trimHdr(subhdr2)=="img")?
setHistCol(headerText+subhdr2):subhdr2,
headerAsText: true,
width: setWidth(subhdr2),
//width:
(trimHdr(subhdr2)=="img")?3:60,
// flex:
(trimHdr(subhdr2)=="img")?0.2:1,
// minWidth: setWidth(subhdr2), //PL change from width to minWidth
menuDisabled: true,
renderer: function (value, metaData, record, rowIndex, colIndex, store) {
//console.info("renderer subhdr2: "+ subhdr2);
//if (colIndex==28){ //
if(subhdr2 == 'PR-img'){
return String.format(
'<span id="histLink"
class="headerExpandImg"
title="Click to open
history screen"></span>');
} else {
if(subhdr2.indexOf('Accts')
> 0){
return String.format(
Ext.util.Format.number(value,
"123,456"));
}else if(subhdr2=="Change
in Long Value" ||
subhdr2=="Change in
Price"){
return (value < 0) ?
String.format('<font
class="negCell">'+Ext.util.Format.number((value*-1),
"(12.00%)")+'</font>')
:
String.format(Ext.util.Format.number(value,
"12.00%"));
}else{
return (value < 0) ?
String.format( '<font
class="negCell">'+
Ext.util.Format.number((value*-1)/million,
"(1,234.00)")
+'</font>')
:
String.format(
Ext.util.Format.number(value/million,
"123,456.00"));
}
}
},
listeners : {
scope : this,
click : function(column, grid,
rowIndex, eventObj){
//if (column.id==28){
if(subhdr2 ==
'PR-img'){
var record =
grid.getStore().getAt(rowIndex);
var baclass =
((rowIndex==0)&&(record.get("broadAssetCode")==""))?tripWireTab.searchCriteria.baClass:record.get("broadAssetCode");
var prodtypecode =
((rowIndex==0)&&(record.get("prodTypeCode")==""))?tripWireTab.searchCriteria.productType
:record.get("prodTypeCode");
var srcLink = (
(rowIndex==0)&&(record.get("broadAssetCode")=="")&&(record.get("prodTypeCode")==""))?"prodtype":"security";
var bastore =
tripWireTab.toolBarRef.getBroadAssetStore();
var collection =
bastore.query('code',
baclass, true,
false);
var badesc =
((collection.items[0]!=null)||(collection.items[0]!=undefined))
?collection.items[0].get('Description'):"N/A";
var proddesc =
Ext.util.Format.stripTags(record.get("Security
Description"));
var histTitle =
(srcLink=="prodtype")?
String.format(
"Broad Asset Class
=
"+Ext.util.Format.capitalize(
badesc) + "<br
/>"+ "Product Type
= "+proddesc )
:
String.format(
"Security
=
"+
proddesc
+"
("+record.get("securityNo")+")");
callHistoryService(srcLink,
false, baclass,
prodtypecode,
record.get("securityNo"),histTitle);
}
}
}
});
}); // eof
Saturday, 17 August 2013
Subseqeunce convergence definition
Subseqeunce convergence definition
Definition: A subsequence $(a_{n_k})$ of $(a_n)$ is convergent if given
any $\epsilon >0$, there is an $N$ such that $\forall k\geq N
\implies\vert a_{n_k} - \ell\vert < \epsilon$
Why do we want $k \geq N$ and not $n_{k} \geq N$?, Don't they both refer
on the same "last" term of your subsequence?
Or am I getting confused that $n$ is actually 'fixed' and it is only used
to refer back to our original sequence $(a_n)$? And what is referring to
the terms of my subsequence are actually the $k$s?
Definition: A subsequence $(a_{n_k})$ of $(a_n)$ is convergent if given
any $\epsilon >0$, there is an $N$ such that $\forall k\geq N
\implies\vert a_{n_k} - \ell\vert < \epsilon$
Why do we want $k \geq N$ and not $n_{k} \geq N$?, Don't they both refer
on the same "last" term of your subsequence?
Or am I getting confused that $n$ is actually 'fixed' and it is only used
to refer back to our original sequence $(a_n)$? And what is referring to
the terms of my subsequence are actually the $k$s?
Table spacing, multi column
Table spacing, multi column
Good day, hi, I have a question to ask. If you have some spare time please
kindly spare me a few minutes to enlighten me on the following question.
Thanks in advance!
So I am trying to construct a table, but the spacing isn't balanced.
\documentclass{article}
\usepackage[english]{babel}
\usepackage{multirow}
\begin{document}
\begin{center}
\begin{tabular}{ |c|c|c|c|c|c|c|c|c|c| }
\hline
\multirow{2}{*}{Class} & \multicolumn{2}{c|}{Similarity Gibbs Sampling} &
\multicolumn{2}{c|}{Hand Computatation} & \multicolumn{4}{c|}{Combination}
& \multirow{2}{*}{Graph Cut(S)} \\ \cline{2-1} \cline{3-1} \cline{4-1}
\cline{5-1} \cline{6-1} \cline{7-1} \cline{8-1} \cline{9-1}
& 0 & 1 & 0 & 1 & 1 & 2 & 3 & 4 & \\ \hline
${V_1}$ & 0.388 & 0.612 & 0.393 & 0.607 & 0 & 0 & 1 & 0 & 2 \\ \hline
${V_2}$ & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 2 \\ \hline
${V_3}$ & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 3 \\ \hline
${V_4}$ & 0.388 & 0.612 & 0.393 & 0.607 & 1 & 0 & 1 & 1 & 1 \\ \hline
%\cline{2-1}
\end{tabular}
\end{center}
\end{document}
As you can see, the 3rd column and 5th column do not share the same
spacing as 2nd and 4th respectively.
Good day, hi, I have a question to ask. If you have some spare time please
kindly spare me a few minutes to enlighten me on the following question.
Thanks in advance!
So I am trying to construct a table, but the spacing isn't balanced.
\documentclass{article}
\usepackage[english]{babel}
\usepackage{multirow}
\begin{document}
\begin{center}
\begin{tabular}{ |c|c|c|c|c|c|c|c|c|c| }
\hline
\multirow{2}{*}{Class} & \multicolumn{2}{c|}{Similarity Gibbs Sampling} &
\multicolumn{2}{c|}{Hand Computatation} & \multicolumn{4}{c|}{Combination}
& \multirow{2}{*}{Graph Cut(S)} \\ \cline{2-1} \cline{3-1} \cline{4-1}
\cline{5-1} \cline{6-1} \cline{7-1} \cline{8-1} \cline{9-1}
& 0 & 1 & 0 & 1 & 1 & 2 & 3 & 4 & \\ \hline
${V_1}$ & 0.388 & 0.612 & 0.393 & 0.607 & 0 & 0 & 1 & 0 & 2 \\ \hline
${V_2}$ & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 2 \\ \hline
${V_3}$ & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 3 \\ \hline
${V_4}$ & 0.388 & 0.612 & 0.393 & 0.607 & 1 & 0 & 1 & 1 & 1 \\ \hline
%\cline{2-1}
\end{tabular}
\end{center}
\end{document}
As you can see, the 3rd column and 5th column do not share the same
spacing as 2nd and 4th respectively.
Set width-height-left-top dynamically in Safari
Set width-height-left-top dynamically in Safari
I'm trying to set size and position of dynamically generated elements with
jQuery or inline css, but Safari just doesn't use it.
This is the example for jQuery:
$("#e"+i).css("width", var1).css("height", var1).css("left",
varcleft+'px').css("top", -(varleft/2)+'px').css("z-index", var1);
NOTE:I'm using the +"px" because positions are previously set with
percentages. I use something similar for inline style, but Safari still
ignore it. Any ideas on how to make that work in Safari? Thanks
I'm trying to set size and position of dynamically generated elements with
jQuery or inline css, but Safari just doesn't use it.
This is the example for jQuery:
$("#e"+i).css("width", var1).css("height", var1).css("left",
varcleft+'px').css("top", -(varleft/2)+'px').css("z-index", var1);
NOTE:I'm using the +"px" because positions are previously set with
percentages. I use something similar for inline style, but Safari still
ignore it. Any ideas on how to make that work in Safari? Thanks
Command loop for processing on a directory of images
Command loop for processing on a directory of images
I have a program called GPU Debayer that converts images using this
command-line code:
DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i inputpic.pgm -o
outputpic.ppm
I was previously dealing with folders of images whose file names were the
same except the ends were numbered 0-39. As such, I was debayering the
folders like this in cmd prompt.
for %a in (0 1 2 3 4 5 6 7 8 9 10 11 1
2 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
37 38
39) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i single%a.pgm
-o si
ngle%a.ppm
Now, I need to deal with one folder holding many sets of these images now
labled filename0000 - filename0039 But, there are, like I said, a few of
these. I.e., 120 images, 40 with the names "filename0000 - filename0039" ,
40 named "filename25_0000 - filename25_0039" and 40 named "filename37_0000
- filename37_0039".
Is there any sort of way or loop to debayer ALL of these images with one
script? I have imagemagick on my machine. And if anyone is familiar with
the GPU Debayer, this is the tool i'm using. It seems to have some sort of
repeat function
maybe?http://www.fastcompression.com/products/debayer/debayer.htm
Thanks for any ideas!!
I have a program called GPU Debayer that converts images using this
command-line code:
DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i inputpic.pgm -o
outputpic.ppm
I was previously dealing with folders of images whose file names were the
same except the ends were numbered 0-39. As such, I was debayering the
folders like this in cmd prompt.
for %a in (0 1 2 3 4 5 6 7 8 9 10 11 1
2 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
37 38
39) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i single%a.pgm
-o si
ngle%a.ppm
Now, I need to deal with one folder holding many sets of these images now
labled filename0000 - filename0039 But, there are, like I said, a few of
these. I.e., 120 images, 40 with the names "filename0000 - filename0039" ,
40 named "filename25_0000 - filename25_0039" and 40 named "filename37_0000
- filename37_0039".
Is there any sort of way or loop to debayer ALL of these images with one
script? I have imagemagick on my machine. And if anyone is familiar with
the GPU Debayer, this is the tool i'm using. It seems to have some sort of
repeat function
maybe?http://www.fastcompression.com/products/debayer/debayer.htm
Thanks for any ideas!!
What is wrong with my code? PHP
What is wrong with my code? PHP
Hey I am having issues submitting on li the code is submitting just that
my data is not changing. Here is the code:
<?php
$theme1 = business;
$theme2 = modern;
$theme3 = web2;
if(isset($_POST['style']))
{setcookie('style', $_POST['style'], time()+(60*60*24*1000));
$style=$_POST['style'];}
elseif(isset($_COOKIE['style']))
{$style=$_COOKIE['style'];}
else
{$style=$theme1;}
echo "
<link href='"; $style; echo".css' rel='stylesheet' type='text/css' />
<form action='".$_SERVER['PHP_SELF']."' method='post' id='myForm'>
<li onclick='myForm.submit();' value='$theme1'> business</li>
</form>
";
?>
The code does submit on the website but it is not changing the data. The
form was made using the select option style. Here is the code:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<select name="style">
<option type="submit" <?php echo "value='$theme1'";if($style ==
$theme1){echo "selected='selected'";}?>><?php echo $theme1; ?></option>
<option type="submit" <?php echo "value='$theme2'";if($style ==
$theme2){echo "selected='selected'";}?>><?php echo $theme2; ?></option>
<option type="submit" <?php echo "value='$theme3'";if($style ==
$theme3){echo "selected='selected'";}?>><?php echo $theme3; ?></option>
</select>
<input type="submit">
</form>
I think there is a problem with the li missing some information. What is
wrong with my code?
Hey I am having issues submitting on li the code is submitting just that
my data is not changing. Here is the code:
<?php
$theme1 = business;
$theme2 = modern;
$theme3 = web2;
if(isset($_POST['style']))
{setcookie('style', $_POST['style'], time()+(60*60*24*1000));
$style=$_POST['style'];}
elseif(isset($_COOKIE['style']))
{$style=$_COOKIE['style'];}
else
{$style=$theme1;}
echo "
<link href='"; $style; echo".css' rel='stylesheet' type='text/css' />
<form action='".$_SERVER['PHP_SELF']."' method='post' id='myForm'>
<li onclick='myForm.submit();' value='$theme1'> business</li>
</form>
";
?>
The code does submit on the website but it is not changing the data. The
form was made using the select option style. Here is the code:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<select name="style">
<option type="submit" <?php echo "value='$theme1'";if($style ==
$theme1){echo "selected='selected'";}?>><?php echo $theme1; ?></option>
<option type="submit" <?php echo "value='$theme2'";if($style ==
$theme2){echo "selected='selected'";}?>><?php echo $theme2; ?></option>
<option type="submit" <?php echo "value='$theme3'";if($style ==
$theme3){echo "selected='selected'";}?>><?php echo $theme3; ?></option>
</select>
<input type="submit">
</form>
I think there is a problem with the li missing some information. What is
wrong with my code?
Using scanner with a prompt and user input
Using scanner with a prompt and user input
I tried to do counting lines, words, character from user "inputted" file.
After this show counting and keep asking again.
If file doesn't exist print all data which have been counted during running.
Code:
public class KeepAskingApp {
private static int lines;
private static int words;
private static int chars;
public static void main(String[] args) {
boolean done = false;
//counters
int charsCount = 0, wordsCount = 0, linesCount = 0;
Scanner in = null;
Scanner scanner = null;
while (!done) {
try {
in = new Scanner(System.in);
System.out.print("Enter a (next) file name: ");
String input = in.nextLine();
scanner = new Scanner(new File(input));
while(scanner.hasNextLine()) {
lines += linesCount++;
Scanner lineScanner = new Scanner(scanner.nextLine());
lineScanner.useDelimiter(" ");
while(lineScanner.hasNext()) {
words += wordsCount++;
chars += charsCount += lineScanner.next().length();
}
System.out.printf("# of chars: %d\n# of words: %d\n# of
lines: ",
charsCount, wordsCount, charsCount);
lineScanner.close();
}
scanner.close();
in.close();
} catch (FileNotFoundException e) {
System.out.printf("All lines: %d\nAll words: %d\nAll chars:
%d\n",
lines, words, chars);
System.out.println("The end");
done = true;
}
}
}
}
But I can't understand why it always show output with no parameters:
All lines: 0
All words: 0
All chars: 0
The end
Why it omits all internal part.
It may be coz I'm using few scanners, but all look ok. Any suggestions?
I tried to do counting lines, words, character from user "inputted" file.
After this show counting and keep asking again.
If file doesn't exist print all data which have been counted during running.
Code:
public class KeepAskingApp {
private static int lines;
private static int words;
private static int chars;
public static void main(String[] args) {
boolean done = false;
//counters
int charsCount = 0, wordsCount = 0, linesCount = 0;
Scanner in = null;
Scanner scanner = null;
while (!done) {
try {
in = new Scanner(System.in);
System.out.print("Enter a (next) file name: ");
String input = in.nextLine();
scanner = new Scanner(new File(input));
while(scanner.hasNextLine()) {
lines += linesCount++;
Scanner lineScanner = new Scanner(scanner.nextLine());
lineScanner.useDelimiter(" ");
while(lineScanner.hasNext()) {
words += wordsCount++;
chars += charsCount += lineScanner.next().length();
}
System.out.printf("# of chars: %d\n# of words: %d\n# of
lines: ",
charsCount, wordsCount, charsCount);
lineScanner.close();
}
scanner.close();
in.close();
} catch (FileNotFoundException e) {
System.out.printf("All lines: %d\nAll words: %d\nAll chars:
%d\n",
lines, words, chars);
System.out.println("The end");
done = true;
}
}
}
}
But I can't understand why it always show output with no parameters:
All lines: 0
All words: 0
All chars: 0
The end
Why it omits all internal part.
It may be coz I'm using few scanners, but all look ok. Any suggestions?
SQL Server Operating system error 5: "5(Access is denied.)"
SQL Server Operating system error 5: "5(Access is denied.)"
I am starting to learn school and I have a book that already gives a
database to work on. These below are in the directly but the porblem is
when I run the query, it it giving me this error: Msg 5120, Level 16,
State 101, Line 1 Unable to open the physical file "C:\Murach\SQL Server
2008\Databases\AP.mdf". Operating system error 5: "5(Access is denied.)".
CREATE DATABASE AP
ON PRIMARY (FILENAME = 'C:\Murach\SQL Server 2008\Databases\AP.mdf')
LOG ON (FILENAME = 'C:\Murach\SQL Server
2008\Databases\AP_log.ldf')
FOR ATTACH
GO
As in the book, the author says it should work but it is not working in my
case, I searched here but it is not exactly what my problem is, so I
posted this question.
I am starting to learn school and I have a book that already gives a
database to work on. These below are in the directly but the porblem is
when I run the query, it it giving me this error: Msg 5120, Level 16,
State 101, Line 1 Unable to open the physical file "C:\Murach\SQL Server
2008\Databases\AP.mdf". Operating system error 5: "5(Access is denied.)".
CREATE DATABASE AP
ON PRIMARY (FILENAME = 'C:\Murach\SQL Server 2008\Databases\AP.mdf')
LOG ON (FILENAME = 'C:\Murach\SQL Server
2008\Databases\AP_log.ldf')
FOR ATTACH
GO
As in the book, the author says it should work but it is not working in my
case, I searched here but it is not exactly what my problem is, so I
posted this question.
Friday, 16 August 2013
How can i make this GridLayout in Java?
How can i make this GridLayout in Java?
I have a specific grid i want to make but im not sure how to make it
-------------------------------------------
| |
| | <-- My Banner
| |
-------------------------------------------
| | |
| Panel1 | |
| | |
-----------------------| |
| | |
| Panel2 | | <--Info or something. I want
this space to be
| | | a white area. Im going to
put images here.
-----------------------| |
| | |
| Panel3 | |
| | |
-------------------------------------------
So im wondering what layout manager should i use?
I have a specific grid i want to make but im not sure how to make it
-------------------------------------------
| |
| | <-- My Banner
| |
-------------------------------------------
| | |
| Panel1 | |
| | |
-----------------------| |
| | |
| Panel2 | | <--Info or something. I want
this space to be
| | | a white area. Im going to
put images here.
-----------------------| |
| | |
| Panel3 | |
| | |
-------------------------------------------
So im wondering what layout manager should i use?
Subscribe to:
Comments (Atom)