Best way to prevent someone reading the source code
there are some form which I want to hide it from being read by someone
else.. what do you think is the best way to doing that?
hiding the source code in mysql and use query select to view the form.
encrypt the page with encoder.
is there any other way?
Thursday, 3 October 2013
Wednesday, 2 October 2013
Is there a maximum value or output to BigIntegers?
Is there a maximum value or output to BigIntegers?
I have a simple loop that does n = n ^ 2, where n is a BigInteger. But,
after the 11th iteration of the loop (I currently have it set to not go
further because of this issue), the console goes blank, but filled with
spaces. Like there should be characters there but there aren't. This is
evident as it's highlight-able. My question is; is there a cap on
BigIntegers, a max displayable output, or am I just not giving my CPU
enough time do the calculation?
import java.math.*;
public class Main {
static BigInteger n = BigInteger.valueOf(123);
static int j = 11;
public static void main(String[] args) {
while(j != 0) {
System.out.println(n);
n = n.pow(2);
j--;
}
System.out.println("Done. ");
}
}
I have a simple loop that does n = n ^ 2, where n is a BigInteger. But,
after the 11th iteration of the loop (I currently have it set to not go
further because of this issue), the console goes blank, but filled with
spaces. Like there should be characters there but there aren't. This is
evident as it's highlight-able. My question is; is there a cap on
BigIntegers, a max displayable output, or am I just not giving my CPU
enough time do the calculation?
import java.math.*;
public class Main {
static BigInteger n = BigInteger.valueOf(123);
static int j = 11;
public static void main(String[] args) {
while(j != 0) {
System.out.println(n);
n = n.pow(2);
j--;
}
System.out.println("Done. ");
}
}
Excel VBA: OnAction and Listview - strange behavior
Excel VBA: OnAction and Listview - strange behavior
My worksheet (Excel 2003) has a problem in popup button that I did. The
.OnAction calls a function "Inicia" with parameters. It almost works.
Error occurs when funcion 'Inicia' calls a public function
'FormConsulta.Pesquisa2(string arg)' to search data from a sheet and to
fill to a listview. 'Pesquisa2' has a loop that passes only one time and
listview returns only one value (not always the first item found).
If I call 'FormConsulta.Pesquisa2(string arg)' anywhere, it works plenty,
but if my menu button calls it, it returns only 01 result. Here is my
code:
My Popup menu button:
With Application.CommandBars("Cell").Controls.Add(Type:=msoControlButton,
before:=1, temporary:=True)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "Inicia(" & Chr(34) &
CStr(celula) & Chr(34) & ")" 'celula = an excel Cell rightclicked (type
Variant)
'style, caption, images, etc..
End With
sub Inicia: (placed on same module)
Private Sub Inicia(Optional celula As Variant)
If IsMissing(celula) Then 'se a sub foi chamada sem clicar com o
botão direito, apenas exibe form
FormAberturaChamado.Show 'this works fine this form has a call to
FormConsulta.Pesquisa2(arg) thar works fine!!
Exit Sub
End If
'(...) problem lies down here VV
If FormConsulta.Pesquisa2(celula) > 0 Then FormConsulta.Show
'(...)
End Sub
And finally FormConsulta.Pesquisa2 code:
Public Function Pesquisa2(ByVal valor As String) As Long 'boolean
'Variáveis locais
Dim rng1 As Range, rngPesquisa As Range, linBD As Long, contEncontrado
As Long, firstAddress As String,
Dim liit As ListItem
With Me.lvConsulta 'lvConsulta is ListView
.ListItems.Clear
.ColumnHeaders.Clear
.Gridlines = True
.View = lvwReport
'headers
'(...)
.ColumnHeaders.Add , , "Nome Fantasia", Width:=150
.ColumnHeaders.Add , , "Razão Social", Width:=166
.ColumnHeaders.Add , , "Telefone", Width:=62
.ColumnHeaders.Add , , "Contato", Width:=76
'etc...
End With
contEncontrado = 0 'items found
Set rngPesquisa = Sheets(PLANBD).Range("A:A") 'range of search. It's a
sample, there are other ranges of search based on type of search
Set rng1 = rngPesquisa.Find(what:=valor, MatchCase:=False)
If Not rng1 Is Nothing Then 'found at least one item
firstAddress = rng1.Address
Do 'continue searching
linBD = rng1.Row 'actual line
Set liit = FormConsulta.lvConsulta.ListItems.Add(, ,
Sheets(PLANBD).Range("A" & linBD).Value) 'Nome Fanstasia
liit.SubItems(2) = Sheets(PLANBD).Range("D" & linBD).Value
'Razao Social col D
liit.SubItems(3) = Sheets(PLANBD).Range("G" & linBD).Value
'Telefone col G
liit.SubItems(4) = Sheets(PLANBD).Range("H" & linBD).Value
'Contato Col H
'(...)
rng1 = rngPesquisa.FindNext(rng1) 'find next item
contEncontrado = contEncontrado + 1 'add items found
Loop While Not rng1 Is Nothing And rng1.Address <> firstAddress
'MsgBox("found xxx items")
Else
Call MsgBox("Nothing found", vbExclamation + vbOKOnly)
End If
Pesquisa2 = contEncontrado 'returns number of items found
End Function
Here is Do Loop While that passes only one time when I click on my menu
button. However it works fine when I call it from another Form.
Debug does not work, except if I call 'Pesquisa2' from another Form.
Anyone can help me? thanx in advance
My worksheet (Excel 2003) has a problem in popup button that I did. The
.OnAction calls a function "Inicia" with parameters. It almost works.
Error occurs when funcion 'Inicia' calls a public function
'FormConsulta.Pesquisa2(string arg)' to search data from a sheet and to
fill to a listview. 'Pesquisa2' has a loop that passes only one time and
listview returns only one value (not always the first item found).
If I call 'FormConsulta.Pesquisa2(string arg)' anywhere, it works plenty,
but if my menu button calls it, it returns only 01 result. Here is my
code:
My Popup menu button:
With Application.CommandBars("Cell").Controls.Add(Type:=msoControlButton,
before:=1, temporary:=True)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "Inicia(" & Chr(34) &
CStr(celula) & Chr(34) & ")" 'celula = an excel Cell rightclicked (type
Variant)
'style, caption, images, etc..
End With
sub Inicia: (placed on same module)
Private Sub Inicia(Optional celula As Variant)
If IsMissing(celula) Then 'se a sub foi chamada sem clicar com o
botão direito, apenas exibe form
FormAberturaChamado.Show 'this works fine this form has a call to
FormConsulta.Pesquisa2(arg) thar works fine!!
Exit Sub
End If
'(...) problem lies down here VV
If FormConsulta.Pesquisa2(celula) > 0 Then FormConsulta.Show
'(...)
End Sub
And finally FormConsulta.Pesquisa2 code:
Public Function Pesquisa2(ByVal valor As String) As Long 'boolean
'Variáveis locais
Dim rng1 As Range, rngPesquisa As Range, linBD As Long, contEncontrado
As Long, firstAddress As String,
Dim liit As ListItem
With Me.lvConsulta 'lvConsulta is ListView
.ListItems.Clear
.ColumnHeaders.Clear
.Gridlines = True
.View = lvwReport
'headers
'(...)
.ColumnHeaders.Add , , "Nome Fantasia", Width:=150
.ColumnHeaders.Add , , "Razão Social", Width:=166
.ColumnHeaders.Add , , "Telefone", Width:=62
.ColumnHeaders.Add , , "Contato", Width:=76
'etc...
End With
contEncontrado = 0 'items found
Set rngPesquisa = Sheets(PLANBD).Range("A:A") 'range of search. It's a
sample, there are other ranges of search based on type of search
Set rng1 = rngPesquisa.Find(what:=valor, MatchCase:=False)
If Not rng1 Is Nothing Then 'found at least one item
firstAddress = rng1.Address
Do 'continue searching
linBD = rng1.Row 'actual line
Set liit = FormConsulta.lvConsulta.ListItems.Add(, ,
Sheets(PLANBD).Range("A" & linBD).Value) 'Nome Fanstasia
liit.SubItems(2) = Sheets(PLANBD).Range("D" & linBD).Value
'Razao Social col D
liit.SubItems(3) = Sheets(PLANBD).Range("G" & linBD).Value
'Telefone col G
liit.SubItems(4) = Sheets(PLANBD).Range("H" & linBD).Value
'Contato Col H
'(...)
rng1 = rngPesquisa.FindNext(rng1) 'find next item
contEncontrado = contEncontrado + 1 'add items found
Loop While Not rng1 Is Nothing And rng1.Address <> firstAddress
'MsgBox("found xxx items")
Else
Call MsgBox("Nothing found", vbExclamation + vbOKOnly)
End If
Pesquisa2 = contEncontrado 'returns number of items found
End Function
Here is Do Loop While that passes only one time when I click on my menu
button. However it works fine when I call it from another Form.
Debug does not work, except if I call 'Pesquisa2' from another Form.
Anyone can help me? thanx in advance
Internet LAN Line-connection was reset
Internet LAN Line-connection was reset
I have 12.04 LTS running on my machine. Since I have had Ubuntu installed
I have been unable to connect to the internet with my lan line. Whenever
firefox is opened the message appears, "This connection was reset, The
connection to the server was reset while the page was loading." This
happens with any website I attempt to visit.
When I run the command ifconfig the following appears:
hatch@hatch-MXC6300:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:30:64:0f:dd:7a
inet addr:10.7.32.113 Bcast:10.7.63.255 Mask:255.255.224.0
inet6 addr: fe80::230:64ff:fe0f:dd7a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20242 errors:0 dropped:0 overruns:0 frame:0
TX packets:3724 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1794017 (1.7 MB) TX bytes:577696 (577.6 KB)
Interrupt:20 Memory:f7e00000-f7e20000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:325 errors:0 dropped:0 overruns:0 frame:0
TX packets:325 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:28145 (28.1 KB) TX bytes:28145 (28.1 KB)
Also the firewall has been disabled.
Any help is much appreciated, -Cat
I have 12.04 LTS running on my machine. Since I have had Ubuntu installed
I have been unable to connect to the internet with my lan line. Whenever
firefox is opened the message appears, "This connection was reset, The
connection to the server was reset while the page was loading." This
happens with any website I attempt to visit.
When I run the command ifconfig the following appears:
hatch@hatch-MXC6300:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:30:64:0f:dd:7a
inet addr:10.7.32.113 Bcast:10.7.63.255 Mask:255.255.224.0
inet6 addr: fe80::230:64ff:fe0f:dd7a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20242 errors:0 dropped:0 overruns:0 frame:0
TX packets:3724 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1794017 (1.7 MB) TX bytes:577696 (577.6 KB)
Interrupt:20 Memory:f7e00000-f7e20000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:325 errors:0 dropped:0 overruns:0 frame:0
TX packets:325 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:28145 (28.1 KB) TX bytes:28145 (28.1 KB)
Also the firewall has been disabled.
Any help is much appreciated, -Cat
How to accept different data types from the user in java
How to accept different data types from the user in java
I'm a beginner in Java and I just wrote a program to get the user's name,
phone number and address. The problem is after reading the phone number
the program will not proceed to read the address, it's like if it's
skipping it. Here is my code:
public static void main(String [] arge){
Scanner sc = new Scanner(System.in);
System.out.println("Enter your name, phone number and address");
String name = sc.nextLine();
long phone = sc.nextLong();
String address = sc.nextLine();
System.out.println("\n *** Here is your info ***");
System.out.println("Name: "+name+"\nPhone number: "+phone+"\n Address:
"+address);
}
I'm a beginner in Java and I just wrote a program to get the user's name,
phone number and address. The problem is after reading the phone number
the program will not proceed to read the address, it's like if it's
skipping it. Here is my code:
public static void main(String [] arge){
Scanner sc = new Scanner(System.in);
System.out.println("Enter your name, phone number and address");
String name = sc.nextLine();
long phone = sc.nextLong();
String address = sc.nextLine();
System.out.println("\n *** Here is your info ***");
System.out.println("Name: "+name+"\nPhone number: "+phone+"\n Address:
"+address);
}
Tuesday, 1 October 2013
Accessing non-consecutive elements of a list in python
Accessing non-consecutive elements of a list in python
As far as I can tell, this is not officially not possible, but is there a
"trick" to access arbitrary non-sequential elements of a list by slicing?
For example:
>>> L = range(0,101,10)
>>> L
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Now I want to be able to do
a,b = L[2,5]
so that a == 20 and b == 50
One way besides two statements would be something silly like:
a,b = L[2:6:3][:2]
But that doesn't scale at all to irregular intervals.
Maybe with list comprehension using the indices I want?
[L[x] for x in [2,5]]
I would love to know what is recommended for this common problem.
As far as I can tell, this is not officially not possible, but is there a
"trick" to access arbitrary non-sequential elements of a list by slicing?
For example:
>>> L = range(0,101,10)
>>> L
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Now I want to be able to do
a,b = L[2,5]
so that a == 20 and b == 50
One way besides two statements would be something silly like:
a,b = L[2:6:3][:2]
But that doesn't scale at all to irregular intervals.
Maybe with list comprehension using the indices I want?
[L[x] for x in [2,5]]
I would love to know what is recommended for this common problem.
Does Github rate limit apply globally per IP address?
Does Github rate limit apply globally per IP address?
From the Github doc:
For requests using Basic Authentication or OAuth, you can make up to 5,000
requests per hour.
Is 5000 reqs/hour global or per IP address?
From the Github doc:
For requests using Basic Authentication or OAuth, you can make up to 5,000
requests per hour.
Is 5000 reqs/hour global or per IP address?
how to get quick expire of sudo auto password save?
how to get quick expire of sudo auto password save?
we all know that in Ubuntu sudo password will be auto saved for 15 minutes
and expires after that. But I want to make it for quick expire. I mean I
dont want to change any settings and when I ever I want , My system should
have to release the password with out storing for 15 min. I mean it should
store only 3 min or 4 min for example.
how can i do that ?
we all know that in Ubuntu sudo password will be auto saved for 15 minutes
and expires after that. But I want to make it for quick expire. I mean I
dont want to change any settings and when I ever I want , My system should
have to release the password with out storing for 15 min. I mean it should
store only 3 min or 4 min for example.
how can i do that ?
Solution for PDE
Solution for PDE
I have the following PDE: $$u_t+(1+\epsilon \sin x)u_x=0$$ where $\epsilon
\to 0$ and I want to find the explicit form of the solution including
terms up to $O(\epsilon)$ and as initial condition I have $x(0)=s$. Now, I
manage it to write down $dx/(1+\epsilon \sin x) = dt$ and then using
$1/(1+\epsilon \sin x) = 1 - \epsilon\sin x + O(\epsilon^2)$ I find out:
$$ x-s+\epsilon\bigl(\cos(x)-\cos(s)\bigr)=t \tag{$*$}$$
The problem is that my solution is $u=f(s)$ and therefore I need to
express $s$ as a function of $x$ and $t$ from $(*)$.
Any suggestions?
I have the following PDE: $$u_t+(1+\epsilon \sin x)u_x=0$$ where $\epsilon
\to 0$ and I want to find the explicit form of the solution including
terms up to $O(\epsilon)$ and as initial condition I have $x(0)=s$. Now, I
manage it to write down $dx/(1+\epsilon \sin x) = dt$ and then using
$1/(1+\epsilon \sin x) = 1 - \epsilon\sin x + O(\epsilon^2)$ I find out:
$$ x-s+\epsilon\bigl(\cos(x)-\cos(s)\bigr)=t \tag{$*$}$$
The problem is that my solution is $u=f(s)$ and therefore I need to
express $s$ as a function of $x$ and $t$ from $(*)$.
Any suggestions?
Subscribe to:
Comments (Atom)