PHP and jQuery progress bar while parsing
I was wondering how I could go about making a progress bar for parsing
HTML data. Essentially the user searches something and I parse another
website. I tried doing it with getting the amount of objects found in an
array then dividing 100 by it, and getting the current one in a for loop
and multiplying it by 100/total. Then I would update a text file with the
value. Then update the progress bar with that value. However, I want a
more efficient way to do it. Also it has to be unique to each user.
Thanks.
Buttaro
Sunday, 1 September 2013
Web proxy script in java or jsp
Web proxy script in java or jsp
Long story short, I want to integrate web proxy in my website.
After much reading, I stumble upon http://www.glype.com/ , but the problem
is they only provide PHP version.
My website is using java and jsp language, so I hope to have the script
written in these two languages.
While it's possible for me to write it myself, I really don't want to
reinvent the wheel, especially with thousands of web proxy out there.
Long story short, I want to integrate web proxy in my website.
After much reading, I stumble upon http://www.glype.com/ , but the problem
is they only provide PHP version.
My website is using java and jsp language, so I hope to have the script
written in these two languages.
While it's possible for me to write it myself, I really don't want to
reinvent the wheel, especially with thousands of web proxy out there.
Why my google +1 button doesn't show statistics/numbers?
Why my google +1 button doesn't show statistics/numbers?
I have more than 1K +1 for my website. And I want to show that number next
to my +1 button as it shows in all other websites. But mine is not
working.
If you are not understanding what i am trying to say then look at my
website http://come2chat.com
look at the top center of my webpage. It has a google +1 button but it
doesn't show how many +1 I have on it.
to see the number of +1, i have to visit my google plus one profile at
https://plus.google.com/107969039583165788589/posts
how to fix this problem?
I have more than 1K +1 for my website. And I want to show that number next
to my +1 button as it shows in all other websites. But mine is not
working.
If you are not understanding what i am trying to say then look at my
website http://come2chat.com
look at the top center of my webpage. It has a google +1 button but it
doesn't show how many +1 I have on it.
to see the number of +1, i have to visit my google plus one profile at
https://plus.google.com/107969039583165788589/posts
how to fix this problem?
CreateFile fails on opening lsass.exe
CreateFile fails on opening lsass.exe
I'm working on a program, which collects some statistics about processes,
which are running on the system.
I've got a code, which retrieves some routine information, such as
executable file version, publisher and so on.
The code works fine for me until I open lsass.exe. When I try to open file
for reading, CreateFile fails with error ERROR_FILE_NOT_FOUND.
Here is the code:
auto FileHandle
= CreateFile(file_to_process.c_str(), // C:\Windows\System32\lsass.exe
GENERIC_READ,
FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if ( INVALID_HANDLE_VALUE == FileHandle )
{
int err_v = GetLastError(); // ERROR_FILE_NOT_FOUND
}
This code is a part of a system service, which is running with 'SYSTEM'
privileges.
I'm working on a program, which collects some statistics about processes,
which are running on the system.
I've got a code, which retrieves some routine information, such as
executable file version, publisher and so on.
The code works fine for me until I open lsass.exe. When I try to open file
for reading, CreateFile fails with error ERROR_FILE_NOT_FOUND.
Here is the code:
auto FileHandle
= CreateFile(file_to_process.c_str(), // C:\Windows\System32\lsass.exe
GENERIC_READ,
FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if ( INVALID_HANDLE_VALUE == FileHandle )
{
int err_v = GetLastError(); // ERROR_FILE_NOT_FOUND
}
This code is a part of a system service, which is running with 'SYSTEM'
privileges.
Saturday, 31 August 2013
Read File in chunks and then read line by line using LineNumberReader. Repeat this activity
Read File in chunks and then read line by line using LineNumberReader.
Repeat this activity
I have a file containing some 6.5 lakh lines. Now I wish to read every
line of this file using LineNumberReader.
However I am encountering an outofMemoryError on adding these many number
of lines to another 3rd party library..
What I intend to do is, read 200000 lines of a file at a time and add
these lines to 3rd party library.
I am using LineNumberReader but I think the entire file is being read
although I have provided condition that when line count reaches 200000
break the loop and add these to 3rd party library..
A code snippet for the same:
LineNumberReader lnr=new LineNumberReader(new FileReader(file));
String line=null;
int i=0;
while(flags)
{
while( null != (line = lnr.readLine()) ){
i++;
3rdPartyLibrary.add(line.trim());
if(i==200000)
{
System.out.println("Breaking");
lnr.mark(i);
break;
}
if(i==400000)
{
System.out.println("" );
lnr.mark(i);
break;
}
if(i==600000)
{
System.out.println("BREAKING " );
lnr.mark(i);
break;
}
}
if(line==null)
{
System.out.println(" FLAG");
flags=false;
}
lnr.reset();
}
What I am intending to do here is read file from 0-200000 in first
iteration. Then read each individual line and add to 3rd party lib.. Once
this is done, read another 200000 lines from (200001-400000) and then
repeat the same activity.
Need help..Can someone please guide..
Repeat this activity
I have a file containing some 6.5 lakh lines. Now I wish to read every
line of this file using LineNumberReader.
However I am encountering an outofMemoryError on adding these many number
of lines to another 3rd party library..
What I intend to do is, read 200000 lines of a file at a time and add
these lines to 3rd party library.
I am using LineNumberReader but I think the entire file is being read
although I have provided condition that when line count reaches 200000
break the loop and add these to 3rd party library..
A code snippet for the same:
LineNumberReader lnr=new LineNumberReader(new FileReader(file));
String line=null;
int i=0;
while(flags)
{
while( null != (line = lnr.readLine()) ){
i++;
3rdPartyLibrary.add(line.trim());
if(i==200000)
{
System.out.println("Breaking");
lnr.mark(i);
break;
}
if(i==400000)
{
System.out.println("" );
lnr.mark(i);
break;
}
if(i==600000)
{
System.out.println("BREAKING " );
lnr.mark(i);
break;
}
}
if(line==null)
{
System.out.println(" FLAG");
flags=false;
}
lnr.reset();
}
What I am intending to do here is read file from 0-200000 in first
iteration. Then read each individual line and add to 3rd party lib.. Once
this is done, read another 200000 lines from (200001-400000) and then
repeat the same activity.
Need help..Can someone please guide..
Python 101 and Math Logic - Listing square root numbers less than n
Python 101 and Math Logic - Listing square root numbers less than n
I'm stuck on a Python 101 type problem involving loops. Here are the
directions:
The square numbers are the integers of the form K × K, e.g. 9 is a square
number since 3 × 3 = 9. Write a program that reads an integer n from input
and outputs all the positive square numbers less than n, one per line in
increasing order. For example, if the input is 16, then the correct output
would be
1
4
9
This is what I have so far but it sort of works but runs on forever. My
code never reaches the if statement so it breaks(stops) before it gets to
17.
Suppose n = 17.
n=int(input())
counter = 1
while counter * counter < n:
for counter in range(1,n):
a = counter*counter
print(a)
if a < n:
break
Results:
1
4
9
16
25
36
49
64
81
I'm stuck on a Python 101 type problem involving loops. Here are the
directions:
The square numbers are the integers of the form K × K, e.g. 9 is a square
number since 3 × 3 = 9. Write a program that reads an integer n from input
and outputs all the positive square numbers less than n, one per line in
increasing order. For example, if the input is 16, then the correct output
would be
1
4
9
This is what I have so far but it sort of works but runs on forever. My
code never reaches the if statement so it breaks(stops) before it gets to
17.
Suppose n = 17.
n=int(input())
counter = 1
while counter * counter < n:
for counter in range(1,n):
a = counter*counter
print(a)
if a < n:
break
Results:
1
4
9
16
25
36
49
64
81
Angular custom directive: Access parent scope property in linking function
Angular custom directive: Access parent scope property in linking function
I want to set the name of an event (click or touch) on a parent scope in
angular as a string. On a child scope I want to use that string to bind an
event with element.on.
Example:
angular.module('directives', [])
.directive('Sidebar', function () {
'use strict';
return {
link: function (scope) {
//determines whether or not to use click or touch events
//I want to use this to bind events with
//element.on(scope.sidebarClickEvent) in child scopes
scope.sidebarClickEvent = 'click';
},
restrict: 'E',
templateUrl: 'sidebar.html'
};
})
.directive('collapseBtn', function() {
'use strict';
return function (scope, element) {
element.on(scope.sidebarClickEvent /* undefined */ , function
() {
//scope.sidebarClickEvent is available here, when the
event handler executes
scope.toggleSidebarCollapseState();
element.find('i').toggleClass('icon-double-angle-right');
});
};
})
The problem is that properties defined on the parent scope aren't
available when I bind the events, so scope.sidebarClickEvent is undefined
when I bind the event. But if I change it to a regular click event then I
can get the property in the event handler.
Can I access properties inherited by the scope at the time that the event
binding occurs? I'm not even sure that I'm understanding scope inheritance
properly here, so pointing out errors in my understanding would also be
appreciated.
Thanks.
I want to set the name of an event (click or touch) on a parent scope in
angular as a string. On a child scope I want to use that string to bind an
event with element.on.
Example:
angular.module('directives', [])
.directive('Sidebar', function () {
'use strict';
return {
link: function (scope) {
//determines whether or not to use click or touch events
//I want to use this to bind events with
//element.on(scope.sidebarClickEvent) in child scopes
scope.sidebarClickEvent = 'click';
},
restrict: 'E',
templateUrl: 'sidebar.html'
};
})
.directive('collapseBtn', function() {
'use strict';
return function (scope, element) {
element.on(scope.sidebarClickEvent /* undefined */ , function
() {
//scope.sidebarClickEvent is available here, when the
event handler executes
scope.toggleSidebarCollapseState();
element.find('i').toggleClass('icon-double-angle-right');
});
};
})
The problem is that properties defined on the parent scope aren't
available when I bind the events, so scope.sidebarClickEvent is undefined
when I bind the event. But if I change it to a regular click event then I
can get the property in the event handler.
Can I access properties inherited by the scope at the time that the event
binding occurs? I'm not even sure that I'm understanding scope inheritance
properly here, so pointing out errors in my understanding would also be
appreciated.
Thanks.
Subscribe to:
Posts (Atom)