Tinymce url needs to be versatile
I need relative path in links which don't have full url and i don't need
relative path in url which have full url.
When i insert in tinymce:
1. I need full url(non-relative path) in:
"http://dignepal.com/images/logo.png"
2. But i don't need full url (relative path) in: "javascript:"
While initializing tinymce i am currently using relative_urls as false and
it is causing problem in number 2 problem as mentioned above. And main
problem is i need it in same page and in same textarea.
Saturday, August 31, 2013
Change the format of a word in Emacs-AUCTeX without actually selecting it
Change the format of a word in Emacs-AUCTeX without actually selecting it
One nice feature of modern word processors is that one can change the
format (say, from roman to italic) of a word without actually selecting
it; one just needs to place the text cursor within the word and tell the
word processor (via a keyboard shortcut) to change its format. (Smart
editing, I believe it is sometimes called.)
Is there a way of doing that in Emacs-AUCTeX? (The usual way to change the
format---that is, insert a format command---is to select the word [mark
its region] and then press the key combination for the command [e.g. C-c
C-f C-i to insert \textit{}].)
One nice feature of modern word processors is that one can change the
format (say, from roman to italic) of a word without actually selecting
it; one just needs to place the text cursor within the word and tell the
word processor (via a keyboard shortcut) to change its format. (Smart
editing, I believe it is sometimes called.)
Is there a way of doing that in Emacs-AUCTeX? (The usual way to change the
format---that is, insert a format command---is to select the word [mark
its region] and then press the key combination for the command [e.g. C-c
C-f C-i to insert \textit{}].)
MySQL selecting data from 2 tables
MySQL selecting data from 2 tables
I have 2 mysql tables, members and team_members.
members table:
member_id
name
team_members table:
team_id
member_id
I want to select the data from the members table that do not belong to any
team (do not exist in team_members table)
SELECT *
FROM members
INNER JOIN team_members
ON members.member_id = team_members.member_id
The problem is that the query is doing precisely the opposite i need. It
is selecting the data from the members that already have a team. I also
tried with '!=' but that gives me all fields duplicated, but does not
duplicate the members that belong to a team.
I have 2 mysql tables, members and team_members.
members table:
member_id
name
team_members table:
team_id
member_id
I want to select the data from the members table that do not belong to any
team (do not exist in team_members table)
SELECT *
FROM members
INNER JOIN team_members
ON members.member_id = team_members.member_id
The problem is that the query is doing precisely the opposite i need. It
is selecting the data from the members that already have a team. I also
tried with '!=' but that gives me all fields duplicated, but does not
duplicate the members that belong to a team.
java.lang.IllegalArgumentException when trying to run a clojure web application
java.lang.IllegalArgumentException when trying to run a clojure web
application
I'm trying to run a clojure web app I wrote using ring, compojure, hiccup,
and lein-ring, and when I run lein ring server, I get an exception.
java.lang.IllegalArgumentException: No implementation of method: :as-file
of protocol: #'clojure.java.io/Coercions found for class: clojure.l
ang.PersistentVector
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:541)
at clojure.java.io$fn__8496$G__8491__8501.invoke(io.clj:35)
at clojure.java.io$file.invoke(io.clj:413)
at leiningen.core.project$absolutize.invoke(project.clj:308)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$partial$fn__4190.doInvoke(core.clj:2396)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$update_in.doInvoke(core.clj:5587)
at clojure.lang.RestFn.invoke(RestFn.java:445)
at leiningen.core.project$absolutize_path.invoke(project.clj:314)
at clojure.core.protocols$fn__6034.invoke(protocols.clj:143)
at
clojure.core.protocols$fn__6005$G__6000__6014.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
at clojure.core.protocols$fn__6028.invoke(protocols.clj:48)
at
clojure.core.protocols$fn__5979$G__5974__5992.invoke(protocols.clj:13)
at clojure.core$reduce.invoke(core.clj:6177)
at leiningen.core.project$absolutize_paths.invoke(project.clj:322)
at leiningen.core.project$init_profiles.doInvoke(project.clj:603)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at leiningen.core.project$read.invoke(project.clj:684)
at leiningen.core.project$read.invoke(project.clj:685)
at leiningen.core.project$read.invoke(project.clj:686)
at leiningen.core.main$_main$fn__1332.invoke(main.clj:256)
at leiningen.core.main$_main.doInvoke(main.clj:252)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.core$apply.invoke(core.clj:617)
at clojure.main$main_opt.invoke(main.clj:335)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at clojure.lang.Var.invoke(Var.java:423)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
The googling I've done shows two options, test suits not named properly,
or having multiple java source paths in my project.clj, both of which I've
checked, so I'm stumped.
Can someone please sift through the stack trace and point me in the right
direction? Thank you.
application
I'm trying to run a clojure web app I wrote using ring, compojure, hiccup,
and lein-ring, and when I run lein ring server, I get an exception.
java.lang.IllegalArgumentException: No implementation of method: :as-file
of protocol: #'clojure.java.io/Coercions found for class: clojure.l
ang.PersistentVector
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:541)
at clojure.java.io$fn__8496$G__8491__8501.invoke(io.clj:35)
at clojure.java.io$file.invoke(io.clj:413)
at leiningen.core.project$absolutize.invoke(project.clj:308)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$partial$fn__4190.doInvoke(core.clj:2396)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$update_in.doInvoke(core.clj:5587)
at clojure.lang.RestFn.invoke(RestFn.java:445)
at leiningen.core.project$absolutize_path.invoke(project.clj:314)
at clojure.core.protocols$fn__6034.invoke(protocols.clj:143)
at
clojure.core.protocols$fn__6005$G__6000__6014.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
at clojure.core.protocols$fn__6028.invoke(protocols.clj:48)
at
clojure.core.protocols$fn__5979$G__5974__5992.invoke(protocols.clj:13)
at clojure.core$reduce.invoke(core.clj:6177)
at leiningen.core.project$absolutize_paths.invoke(project.clj:322)
at leiningen.core.project$init_profiles.doInvoke(project.clj:603)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at leiningen.core.project$read.invoke(project.clj:684)
at leiningen.core.project$read.invoke(project.clj:685)
at leiningen.core.project$read.invoke(project.clj:686)
at leiningen.core.main$_main$fn__1332.invoke(main.clj:256)
at leiningen.core.main$_main.doInvoke(main.clj:252)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.core$apply.invoke(core.clj:617)
at clojure.main$main_opt.invoke(main.clj:335)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at clojure.lang.Var.invoke(Var.java:423)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
The googling I've done shows two options, test suits not named properly,
or having multiple java source paths in my project.clj, both of which I've
checked, so I'm stumped.
Can someone please sift through the stack trace and point me in the right
direction? Thank you.
Client prints Half Data Before Connection is Closed By Server on Socket
Client prints Half Data Before Connection is Closed By Server on Socket
I have this scenario. I'm trying to use socket in C to send and receive
data. Client sends some string, server manipulates it, sends it back to
the client. Everything is fine but one small issue is: The client receives
only the first line from server, displays it and then halts till the
connection is closed by server after a time out. Although the bytes sent
by server = the bytes received by client. As soon as the connection is
closed, the rest of the string is displayed by the client.
I would like to know your thoughts and possible issues. Please let me know
if you ahve any questions.
Protocol used: TCP
I have this scenario. I'm trying to use socket in C to send and receive
data. Client sends some string, server manipulates it, sends it back to
the client. Everything is fine but one small issue is: The client receives
only the first line from server, displays it and then halts till the
connection is closed by server after a time out. Although the bytes sent
by server = the bytes received by client. As soon as the connection is
closed, the rest of the string is displayed by the client.
I would like to know your thoughts and possible issues. Please let me know
if you ahve any questions.
Protocol used: TCP
Onclick div content should change another div with the same content
Onclick div content should change another div with the same content
Lets say I have two divs:
<div id="text1">Text</div>
<div id="text2">Same text from the 1st div</div>
How can I change "text2" to the same text on "text1" by clicking on "text1"
Lets say I have two divs:
<div id="text1">Text</div>
<div id="text2">Same text from the 1st div</div>
How can I change "text2" to the same text on "text1" by clicking on "text1"
Plugin execution not covered by lifecycle configuration AppEngine
Plugin execution not covered by lifecycle configuration AppEngine
Need help with the following Eclipse m2e issue:
Plugin execution not covered by lifecycle configuration:
com.google.appengine:appengine-maven-plugin:1.8.3:endpoints_get_discovery_doc
(execution: default, phase: compile)
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.8.3</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
</configuration>
<executions>
**<execution>**
<goals>
<goal>endpoints_get_discovery_doc</goal>
</goals>
</execution>
</executions>
</plugin>
Any ideas? The pom.xml looks like:
https://github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-java-maven/blob/master/pom.xml
Need help with the following Eclipse m2e issue:
Plugin execution not covered by lifecycle configuration:
com.google.appengine:appengine-maven-plugin:1.8.3:endpoints_get_discovery_doc
(execution: default, phase: compile)
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.8.3</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
</configuration>
<executions>
**<execution>**
<goals>
<goal>endpoints_get_discovery_doc</goal>
</goals>
</execution>
</executions>
</plugin>
Any ideas? The pom.xml looks like:
https://github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-java-maven/blob/master/pom.xml
How to make padding:auto work in CSS?
How to make padding:auto work in CSS?
I am working on a legacy project that has CSS Reset with *{ margin:0;
padding:0 } applied to everything. Now, my new code doesn't need that as
it relies on Normalize.css. This hasn't been much of a problem but at some
places I need to use both styles.
How do I unreset my CSS? I have been able to do *{margin:auto} which works
fine. The same isn't true about padding. *{ padding:auto } doesn't work.
How do you go about solving this?
I am working on a legacy project that has CSS Reset with *{ margin:0;
padding:0 } applied to everything. Now, my new code doesn't need that as
it relies on Normalize.css. This hasn't been much of a problem but at some
places I need to use both styles.
How do I unreset my CSS? I have been able to do *{margin:auto} which works
fine. The same isn't true about padding. *{ padding:auto } doesn't work.
How do you go about solving this?
Friday, August 30, 2013
Access properties of 1 java bean in session using c:out tag
Access properties of 1 java bean in session using c:out tag
I am trying to output text value of a property of a bean in session in a
JSP. I need to output it between tag. I am struck up on the syntax. Here
is my code till now
<%EditTicketBean etlBean=
(EditTicketBean)session.getAttribute("etBeanInServlet");
<textarea><c:out value = "${etlBean.ticketDesc}" />
However this does not work. If I use out.println it works
<textarea><%out.println(etlBean.getTicketDesc());%> </textarea>
What is the correct syntax for using this JSTL tag
I am trying to output text value of a property of a bean in session in a
JSP. I need to output it between tag. I am struck up on the syntax. Here
is my code till now
<%EditTicketBean etlBean=
(EditTicketBean)session.getAttribute("etBeanInServlet");
<textarea><c:out value = "${etlBean.ticketDesc}" />
However this does not work. If I use out.println it works
<textarea><%out.println(etlBean.getTicketDesc());%> </textarea>
What is the correct syntax for using this JSTL tag
Thursday, August 29, 2013
Android use namespace as prefix for attributes in library
Android use namespace as prefix for attributes in library
I am trying to implement the ActionBar through the support library, v7.
Because I want to support the app for Android 2.1 (API level 7) and above.
I read in http://developer.android.com/guide/topics/ui/actionbar.html
following: "Using XML attributes from the support library Notice that the
showAsAction attribute above uses a custom namespace defined in the tag.
This is necessary when using any XML attributes defined by the support
library, because these attributes do not exist in the Android framework on
older devices. So you must use your own namespace as a prefix for all
attributes defined by the support library."
My question is how do I use my own namespace as a prefix for all
attributes defined by the support library?
Step by step explanation please! //Thanks.
I am trying to implement the ActionBar through the support library, v7.
Because I want to support the app for Android 2.1 (API level 7) and above.
I read in http://developer.android.com/guide/topics/ui/actionbar.html
following: "Using XML attributes from the support library Notice that the
showAsAction attribute above uses a custom namespace defined in the tag.
This is necessary when using any XML attributes defined by the support
library, because these attributes do not exist in the Android framework on
older devices. So you must use your own namespace as a prefix for all
attributes defined by the support library."
My question is how do I use my own namespace as a prefix for all
attributes defined by the support library?
Step by step explanation please! //Thanks.
Own classloader for springframework TaskExecutor
Own classloader for springframework TaskExecutor
I have a spring batch job that run on single JVM.
Every taskitem processing invoked by
org.springframework.core.task.TaskExecutor#execute
Application has a bottleneck in parallel processing: every taskitem invoke
synchronized method from 3-party lib.
protected synchronized boolean doFetch(java.lang.String
currencyCheckValue, boolean cachePersistently, boolean
useSharedCacheIgnored, java.lang.Object[] extendedArgs) throws
com.documentum.fc.common.DfException { /* compiled code */ }
Is it possible to use TaskExecutor implementation, that run task in own
classloader, to avoid synchronized method invocation bottleneck?
Can you suggest such implementations?
I have a spring batch job that run on single JVM.
Every taskitem processing invoked by
org.springframework.core.task.TaskExecutor#execute
Application has a bottleneck in parallel processing: every taskitem invoke
synchronized method from 3-party lib.
protected synchronized boolean doFetch(java.lang.String
currencyCheckValue, boolean cachePersistently, boolean
useSharedCacheIgnored, java.lang.Object[] extendedArgs) throws
com.documentum.fc.common.DfException { /* compiled code */ }
Is it possible to use TaskExecutor implementation, that run task in own
classloader, to avoid synchronized method invocation bottleneck?
Can you suggest such implementations?
How to Access the Andriod mobile internet using pc bluetooth?
How to Access the Andriod mobile internet using pc bluetooth?
In wifi internet accessible android mobile that is connected the internet.
how can i get the internet access from that via bluetooth to my computer.
In wifi internet accessible android mobile that is connected the internet.
how can i get the internet access from that via bluetooth to my computer.
Wednesday, August 28, 2013
Wordpress: is it possible to create a sticky post that is at the top of the search results no matter the terms searched for?
Wordpress: is it possible to create a sticky post that is at the top of
the search results no matter the terms searched for?
Title pretty much says it all. I'd like a post to appear at the top of
every search results page.
Google and their support forums turned up nothing.
Any pro's on here want to shed some light if its possible or not?
the search results no matter the terms searched for?
Title pretty much says it all. I'd like a post to appear at the top of
every search results page.
Google and their support forums turned up nothing.
Any pro's on here want to shed some light if its possible or not?
convert h5 file to csv file or text file for data processing
convert h5 file to csv file or text file for data processing
i have a dataset of about 1.85 GB which contains h5 files,i need to
process these files using hadoop,for this i may need to convert these
files to text or csv. is there any way hadoop can read h5 files?or any
good online tool to convert h5 files to csv or text files?or can any one
give a link where i can download a huge dataset which contains text or csv
files?
thanks in advance
i have a dataset of about 1.85 GB which contains h5 files,i need to
process these files using hadoop,for this i may need to convert these
files to text or csv. is there any way hadoop can read h5 files?or any
good online tool to convert h5 files to csv or text files?or can any one
give a link where i can download a huge dataset which contains text or csv
files?
thanks in advance
Data travel from DAL to MVC View
Data travel from DAL to MVC View
ASP.NET MVC4
I have Business layer DLL which communicates to my DAL and retrieves
classes like:
public class ProductionParameter
{
public string CompanyCode { get; set; }
public string UnitCode { get; set; }
public string ItemDescriptionLocal { get; set; }
public string ItemDescriptionEnglish { get; set; }
public string ConsumedItemDescriptionLocal { get; set; }
public string ConsumedItemDescriptionEnglish { get; set; }
public string LotCategory1Description { get; set; }
public string LotCategory2Description { get; set; }
public string LotCategory3Description { get; set; }
public string LotCategory1Code { get; set; }
public string LotCategory2Code { get; set; }
public string LotCategory3Code { get; set; }
public string LineCode { get; set; }
public string LineCodeDisplay { get; set; }
public List<Pallet> PalletsProduced { get; set; }
}
My controller gets the above info but my View doesnt need all the above.
For example lets say i get 3 production parameters classes that each one
has 20 Pallets. It means that each productionparameter has 20 pallets
produced.
I want to show to my MVC View consolidated data for each production
parameter.
How i do it correctly?
Standard Case:
Do i create in Models a class with exactly the info i need for the view
and then define this class in the @model directive?
AJAX:
What changes if i want to make this via AJAX? My AJAX call will return the
consolidated data or the full data and let AngularJS or Jquery make the
consolidation on the client?
ASP.NET MVC4
I have Business layer DLL which communicates to my DAL and retrieves
classes like:
public class ProductionParameter
{
public string CompanyCode { get; set; }
public string UnitCode { get; set; }
public string ItemDescriptionLocal { get; set; }
public string ItemDescriptionEnglish { get; set; }
public string ConsumedItemDescriptionLocal { get; set; }
public string ConsumedItemDescriptionEnglish { get; set; }
public string LotCategory1Description { get; set; }
public string LotCategory2Description { get; set; }
public string LotCategory3Description { get; set; }
public string LotCategory1Code { get; set; }
public string LotCategory2Code { get; set; }
public string LotCategory3Code { get; set; }
public string LineCode { get; set; }
public string LineCodeDisplay { get; set; }
public List<Pallet> PalletsProduced { get; set; }
}
My controller gets the above info but my View doesnt need all the above.
For example lets say i get 3 production parameters classes that each one
has 20 Pallets. It means that each productionparameter has 20 pallets
produced.
I want to show to my MVC View consolidated data for each production
parameter.
How i do it correctly?
Standard Case:
Do i create in Models a class with exactly the info i need for the view
and then define this class in the @model directive?
AJAX:
What changes if i want to make this via AJAX? My AJAX call will return the
consolidated data or the full data and let AngularJS or Jquery make the
consolidation on the client?
File uploading in MVC
File uploading in MVC
I have a form like this.
<form method="post" action="Home/ContactUs" enctype="mutlipart/form-data">
<input type="text" name="Subject"/>
<input type="file" name="file" id="fileUpload">
</form>
I must upload a file, and save it in some folder. When I choose a file,
and submit form, on form subbmiting calling the ContactUs action.There is
ContactUs action from Home controller.
public ActionResult ContactUs(HttpPostedFileBase file, ContactFormModel
model)
{
//other code
}
But HttpPostedFileBase file is null, and I havn't got any notions why. Can
you help me, please?
I have a form like this.
<form method="post" action="Home/ContactUs" enctype="mutlipart/form-data">
<input type="text" name="Subject"/>
<input type="file" name="file" id="fileUpload">
</form>
I must upload a file, and save it in some folder. When I choose a file,
and submit form, on form subbmiting calling the ContactUs action.There is
ContactUs action from Home controller.
public ActionResult ContactUs(HttpPostedFileBase file, ContactFormModel
model)
{
//other code
}
But HttpPostedFileBase file is null, and I havn't got any notions why. Can
you help me, please?
Low performance kernel
Low performance kernel
I have a CUDA kernel where there are many operations and few branches. It
looks like
__global__
void kernel(Real *randomValues, Real mu, Real sigma)
{
int row = blockDim.y * blockIdx.y + threadIdx.y;
int col = blockDim.x * blockIdx.x + threadIdx.x;
if ( row >= cnTimeSteps || col >= cnPaths ) return;
Real alphaLevel = randomValues[row*cnPaths+col];
Real q = 0.0;
Real x = 0.0;
if ( alphaLevel < p_low)
{
q = sqrt( -2*log( alphaLevel ) );
x = (((((c1*q+c2)*q+c3)*q+c4)*q+c5)*q+c6) /
((((d1*q+d2)*q+d3)*q+d4)*q+1);
}
else if ( alphaLevel < p_high )
{
q = alphaLevel-0.5;
Real r = q*q;
x= (((((a1*r+a2)*r+a3)*r+a4)*r+a5)*r+a6)*q /
(((((b1*r+b2)*r+b3)*r+b4)*r+b5)*r+1);
}
else
{
q = sqrt( -2*log( 1.0-alphaLevel ) );
x = -(((((c1*q+c2)*q+c3)*q+c4)*q+c5)*q+c6) /
((((d1*q+d2)*q+d3)*q+d4)*q+1);
}
randomValues[row*cnPaths+col] = sigma * x + mu;
}
where all the a's, b's, c's and d's are constant values (in the device
constant memory)
static __device__ __constant__ float a1 = 1.73687;
static __device__ __constant__ float a2 = 1.12321100;
and so on.
After profiling the kernel I found that the theoretical occupancy is 100%
but I am getting no more than 60%.
I went through this and this GTC talks to try to optimize my kernel.
On one side I have that the IPC reports an average of 1.32 issued
instructions and 0.62 executed. The instruction serialization is about 50%
but the SM activity is almost 100%. On the other hand, there are around 38
active warps but 8 are eligible to execute the next instruction but on
warp issue efficiency I get that around 70% of the cycles there is no
eligible warp. The stall reasons are reported as "Other" which I think has
to do with the computation of the log and sqrt.
How can the SM activity be 99.82% if most of the cycles there is no
eligible warp?
How can I reduce stall?
As threads in a warp may not go into the same branch, requests to constant
memory are probably seralized, is this true? Should I put those constants
in global memory (maybe use shared memory also)?
Is the first time I use Nsight Visual Studio so I'm trying to figure out
the meaning of all the performance analysis. BTW my card is a Quadro
K4000.
I have a CUDA kernel where there are many operations and few branches. It
looks like
__global__
void kernel(Real *randomValues, Real mu, Real sigma)
{
int row = blockDim.y * blockIdx.y + threadIdx.y;
int col = blockDim.x * blockIdx.x + threadIdx.x;
if ( row >= cnTimeSteps || col >= cnPaths ) return;
Real alphaLevel = randomValues[row*cnPaths+col];
Real q = 0.0;
Real x = 0.0;
if ( alphaLevel < p_low)
{
q = sqrt( -2*log( alphaLevel ) );
x = (((((c1*q+c2)*q+c3)*q+c4)*q+c5)*q+c6) /
((((d1*q+d2)*q+d3)*q+d4)*q+1);
}
else if ( alphaLevel < p_high )
{
q = alphaLevel-0.5;
Real r = q*q;
x= (((((a1*r+a2)*r+a3)*r+a4)*r+a5)*r+a6)*q /
(((((b1*r+b2)*r+b3)*r+b4)*r+b5)*r+1);
}
else
{
q = sqrt( -2*log( 1.0-alphaLevel ) );
x = -(((((c1*q+c2)*q+c3)*q+c4)*q+c5)*q+c6) /
((((d1*q+d2)*q+d3)*q+d4)*q+1);
}
randomValues[row*cnPaths+col] = sigma * x + mu;
}
where all the a's, b's, c's and d's are constant values (in the device
constant memory)
static __device__ __constant__ float a1 = 1.73687;
static __device__ __constant__ float a2 = 1.12321100;
and so on.
After profiling the kernel I found that the theoretical occupancy is 100%
but I am getting no more than 60%.
I went through this and this GTC talks to try to optimize my kernel.
On one side I have that the IPC reports an average of 1.32 issued
instructions and 0.62 executed. The instruction serialization is about 50%
but the SM activity is almost 100%. On the other hand, there are around 38
active warps but 8 are eligible to execute the next instruction but on
warp issue efficiency I get that around 70% of the cycles there is no
eligible warp. The stall reasons are reported as "Other" which I think has
to do with the computation of the log and sqrt.
How can the SM activity be 99.82% if most of the cycles there is no
eligible warp?
How can I reduce stall?
As threads in a warp may not go into the same branch, requests to constant
memory are probably seralized, is this true? Should I put those constants
in global memory (maybe use shared memory also)?
Is the first time I use Nsight Visual Studio so I'm trying to figure out
the meaning of all the performance analysis. BTW my card is a Quadro
K4000.
Tuesday, August 27, 2013
How to show multiple areas by location in google maps using php
How to show multiple areas by location in google maps using php
Here is the Initialise function..... function initialize() {
Here the variables $Latitude,$Longitude are array values so how can i
store them in Javascript Variables so that they can store the above array
values....
var lat='<?php echo $Latitude?>';
var lon='<?php echo $Longitude?>';
var latlng = new google.maps.LatLng(lat,lon);
var myOptions = {
zoom: 10,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
Here how can i loop the geocoder to show multiple areas using above array
variables...
map = new
google.maps.Map(document.getElementById("map_canvas"),
myOptions);
geocoder = new google.maps.Geocoder();
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: "Hello World!"
});
}
Here is the Initialise function..... function initialize() {
Here the variables $Latitude,$Longitude are array values so how can i
store them in Javascript Variables so that they can store the above array
values....
var lat='<?php echo $Latitude?>';
var lon='<?php echo $Longitude?>';
var latlng = new google.maps.LatLng(lat,lon);
var myOptions = {
zoom: 10,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
Here how can i loop the geocoder to show multiple areas using above array
variables...
map = new
google.maps.Map(document.getElementById("map_canvas"),
myOptions);
geocoder = new google.maps.Geocoder();
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: "Hello World!"
});
}
Blending alpha in opengl es 2.0
Blending alpha in opengl es 2.0
I try blending alpha of two textures. First texture it some image, second
texture this is rectangle with transparent round in center. I need mix
this two textures so that in result I my background with transperent round
in center. For this, I try to use glBlendFunc, but I was able to get only
the whole transparent background, in other words, all of my background
became transparent. How can I mixed alpha of textures via glBlendFunc?
I try blending alpha of two textures. First texture it some image, second
texture this is rectangle with transparent round in center. I need mix
this two textures so that in result I my background with transperent round
in center. For this, I try to use glBlendFunc, but I was able to get only
the whole transparent background, in other words, all of my background
became transparent. How can I mixed alpha of textures via glBlendFunc?
Is CSS for SVG "standard" CSS?
Is CSS for SVG "standard" CSS?
I'd like to style some SVG sprites using an external stylesheet, as
detailed in this Sitepoint tutorial and W3C's Styling with SVG.
However, the CSS isn't very, er, standard:
rect {
fill: red;
stroke: blue;
stroke-width: 3
}
as it doesn't validate with the W3C CSS Validator.
What gives?
I'd like to style some SVG sprites using an external stylesheet, as
detailed in this Sitepoint tutorial and W3C's Styling with SVG.
However, the CSS isn't very, er, standard:
rect {
fill: red;
stroke: blue;
stroke-width: 3
}
as it doesn't validate with the W3C CSS Validator.
What gives?
Visual C++ 2012: compiler complains about "missing ';'"
Visual C++ 2012: compiler complains about "missing ';'"
Could you please point out to me what is wrong with the following template
class?
#include <vector>
template <typename T, typename C>
struct pQueue{
pQueue():currEnd(c.end()){};
~pQueue(){c.~vector();}
void insert(T& t);
void remove(T& t);
bool find(T& t);
T head(void);
private:
std::vector<T> c;
std::vector<T>::iterator currEnd;
};
The compiler isn't very happy about the std::vector<T>::iterator currEnd;
line, and produces the following error messages:
error C2146: syntax error : missing ';' before identifier 'currEnd'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
Thank you very much!
Could you please point out to me what is wrong with the following template
class?
#include <vector>
template <typename T, typename C>
struct pQueue{
pQueue():currEnd(c.end()){};
~pQueue(){c.~vector();}
void insert(T& t);
void remove(T& t);
bool find(T& t);
T head(void);
private:
std::vector<T> c;
std::vector<T>::iterator currEnd;
};
The compiler isn't very happy about the std::vector<T>::iterator currEnd;
line, and produces the following error messages:
error C2146: syntax error : missing ';' before identifier 'currEnd'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
Thank you very much!
Can i safely delete MSSQL Server 2008 R2 after installing 2012?
Can i safely delete MSSQL Server 2008 R2 after installing 2012?
I just upgraded my MS SQL Server 2008 R2 to 2012 on my local machine. Its
all ok and there is no problems. All is working good (I mostly develop
asp.net mvc applications and some desktop applications. All of them are
pretty simple). Can i safely delete 2008 server from my computer? Are
there any things that i should care about? Thank you.
I just upgraded my MS SQL Server 2008 R2 to 2012 on my local machine. Its
all ok and there is no problems. All is working good (I mostly develop
asp.net mvc applications and some desktop applications. All of them are
pretty simple). Can i safely delete 2008 server from my computer? Are
there any things that i should care about? Thank you.
How many domains can be associated with an EC2 instance simultaneously?
How many domains can be associated with an EC2 instance simultaneously?
How many domains can be associated simultaneously with an EC2 instance
which runs on windows 2012 Server with SQL Web ?
We have 5*n domain names to host on these servers, n stands for number of
versions we run parallel to each other..
How many domains can be associated simultaneously with an EC2 instance
which runs on windows 2012 Server with SQL Web ?
We have 5*n domain names to host on these servers, n stands for number of
versions we run parallel to each other..
Monday, August 26, 2013
convert txt to excel with delphi
convert txt to excel with delphi
My work is convert .txt to excel But,I am confuse because this file use
MML.script. Example:
ADD GCELL:CELLID=0, CELLNAME="ML037GA", MCC="510", MNC="08", LAC=471,
CI=60911, NCC=1, BCC=1, EXTTP=Normal_cell, IUOTP=Normal_cell,
FLEXMAIO=OFF, CSVSP=3, CSDSP=5, PSHPSP=4, PSLPSVP=6, BSPBCCHBLKS=1,
BSPAGBLKSRES=4, BSPRACHBLKS=1, TYPE=DCS1800, OPNAME="opname", VIPCELL=NO,
MOCNCMCELL=NO, HYBHIFREQBANDSUPPORT=NO;
I need someone to help me convert with excel
example |CELLNAME| MCC | MNC | LAC | CI | ...etc
Please help me :) Thanks
My work is convert .txt to excel But,I am confuse because this file use
MML.script. Example:
ADD GCELL:CELLID=0, CELLNAME="ML037GA", MCC="510", MNC="08", LAC=471,
CI=60911, NCC=1, BCC=1, EXTTP=Normal_cell, IUOTP=Normal_cell,
FLEXMAIO=OFF, CSVSP=3, CSDSP=5, PSHPSP=4, PSLPSVP=6, BSPBCCHBLKS=1,
BSPAGBLKSRES=4, BSPRACHBLKS=1, TYPE=DCS1800, OPNAME="opname", VIPCELL=NO,
MOCNCMCELL=NO, HYBHIFREQBANDSUPPORT=NO;
I need someone to help me convert with excel
example |CELLNAME| MCC | MNC | LAC | CI | ...etc
Please help me :) Thanks
Is it appropriate to use constants for dates?
Is it appropriate to use constants for dates?
pI use dates throughout an app. Rather than calculating the dates I need
each time I need them, I set them once in a constants file./p pI.e.
codedefine('NOW', date('Y-m-d'));/code/p pPreviously I used constants for
things like file paths, etc. Does it make sense to load a bunch of dates
like this, over, say, a single array of dates?/p
pI use dates throughout an app. Rather than calculating the dates I need
each time I need them, I set them once in a constants file./p pI.e.
codedefine('NOW', date('Y-m-d'));/code/p pPreviously I used constants for
things like file paths, etc. Does it make sense to load a bunch of dates
like this, over, say, a single array of dates?/p
Android Textview Wraps and ugly formatting
Android Textview Wraps and ugly formatting
I have created a android textview field .My problem is i want all text to
come to new line as soon as there is a Enter or "/n" on the line .For
Example :- I have a text line below :-
Twinkle, twinkle, little star,How I wonder what you are.
Up above the world so high,Like a diamond in the sky.
I want this to come as shown below but when i use the below code it wraps
the lines during runtime .Any Idea how can i do this .My Code is below
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".DisplayGanMessageActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title_activity_display_gan_message" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="18dp"
android:text="
Twinkle, twinkle, little star,How I wonder what you are.
Up above the world so high,Like a diamond in the sky."/>
I got the below output from this :- Twinkle, twinkle, little star,How I
wonder what you are.Up above the world so high,Like a diamond in the sky
I have created a android textview field .My problem is i want all text to
come to new line as soon as there is a Enter or "/n" on the line .For
Example :- I have a text line below :-
Twinkle, twinkle, little star,How I wonder what you are.
Up above the world so high,Like a diamond in the sky.
I want this to come as shown below but when i use the below code it wraps
the lines during runtime .Any Idea how can i do this .My Code is below
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".DisplayGanMessageActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title_activity_display_gan_message" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="18dp"
android:text="
Twinkle, twinkle, little star,How I wonder what you are.
Up above the world so high,Like a diamond in the sky."/>
I got the below output from this :- Twinkle, twinkle, little star,How I
wonder what you are.Up above the world so high,Like a diamond in the sky
Searching folder for a specific XML file using XSLT
Searching folder for a specific XML file using XSLT
I have a folder with multiple XML files and all of them have the same
structure, with different attribute values.
File1.Xml
<Parent attribtueValue="A">
<Child>
<Data1>grape</Data1>
<Data2>sour</Data2>
</Child>
</Parent>
File2.Xml
<Parent attribtueValue="B">
<Child>
<Data1>apple</Data1>
<Data2>sweet</Data2>
</Child>
</Parent>
I have a different Xml (tree.xml) that looks like this:
<Tree>
<Branch></Branch>
<attributeValue>B</attributeValue>
</Tree>
I am doing an XSLT transform to transform tree.xml to look like this:
<Tree>
<Branch></Branch>
<Data1>apple</Data1>
<Data2>sweet</Data2>
</Tree>
Now, the transformation works fine if I take one particular document from
the folder as
<xsl:variable name="file" select="'C:\docs\file2.xml'"/>
<xsl:variable name="info" select="document($file)/Parent/Child/."/>
I want to be able to take the folder as a parameter input, and loop
through to find the right xml, through attributeValue, and use the Data
within that to transform my tree.xml. I am new to XSLT and I can't find
any help with this in the limited research that I've done so far.
Any help is appreciated. Thanks.
I have a folder with multiple XML files and all of them have the same
structure, with different attribute values.
File1.Xml
<Parent attribtueValue="A">
<Child>
<Data1>grape</Data1>
<Data2>sour</Data2>
</Child>
</Parent>
File2.Xml
<Parent attribtueValue="B">
<Child>
<Data1>apple</Data1>
<Data2>sweet</Data2>
</Child>
</Parent>
I have a different Xml (tree.xml) that looks like this:
<Tree>
<Branch></Branch>
<attributeValue>B</attributeValue>
</Tree>
I am doing an XSLT transform to transform tree.xml to look like this:
<Tree>
<Branch></Branch>
<Data1>apple</Data1>
<Data2>sweet</Data2>
</Tree>
Now, the transformation works fine if I take one particular document from
the folder as
<xsl:variable name="file" select="'C:\docs\file2.xml'"/>
<xsl:variable name="info" select="document($file)/Parent/Child/."/>
I want to be able to take the folder as a parameter input, and loop
through to find the right xml, through attributeValue, and use the Data
within that to transform my tree.xml. I am new to XSLT and I can't find
any help with this in the limited research that I've done so far.
Any help is appreciated. Thanks.
Java/Objective-C, Ruby or Both?
Java/Objective-C, Ruby or Both?
I'm 15 years old, currently still in school and learning RoR, I think it's
a great framework and have seen many calling it the language of the future
for server-side.
On the other hand are languages such as Java and Ojective-C for mobile.
Obviously mobile is currently a massive industry and will continue to grow
for many years.
My question is, in terms of employability, which language will be more
favourable in the coming years: Server-side like RoR or mobile like Java
and Objective-C, or both?
I'm 15 years old, currently still in school and learning RoR, I think it's
a great framework and have seen many calling it the language of the future
for server-side.
On the other hand are languages such as Java and Ojective-C for mobile.
Obviously mobile is currently a massive industry and will continue to grow
for many years.
My question is, in terms of employability, which language will be more
favourable in the coming years: Server-side like RoR or mobile like Java
and Objective-C, or both?
kernel panic after starting quicktime video
kernel panic after starting quicktime video
I'm getting a kernel panic whenever I start a movie in quicktime player
this is what the crash report looks like
Interval Since Last Panic Report: 204039 sec Panics Since Last Report: 3
Anonymous UUID: 0F5C514A-96D2-917B-6D39-72A3E70945FB
Mon Aug 26 12:38:06 2013 panic(cpu 0 caller 0xffffff7f9d213f1a): "GPU
Panic: [] 3 3 7f 0 0 0 0 3 : NVRM[0/1:0:0]: Read Error 0x00000100: CFG
0xffffffff 0xffffffff 0xffffffff, BAR0 0xd2000000 0xffffff810bdf5000
0x0a5480a2, D0,
P3/4\n"@/SourceCache/AppleGraphicsControl/AppleGraphicsControl-3.4.5/src/AppleMuxControl/kext/GPUPanic.cpp:127
Backtrace (CPU 0), Frame : Return Address 0xffffff810adab190 :
0xffffff801b01d626 0xffffff810adab200 : 0xffffff7f9d213f1a
0xffffff810adab2d0 : 0xffffff7f9b7ecf1e 0xffffff810adab390 :
0xffffff7f9b8c112d 0xffffff810adab3d0 : 0xffffff7f9b8c118e
0xffffff810adab440 : 0xffffff7f9bb87ed0 0xffffff810adab570 :
0xffffff7f9b8e9a75 0xffffff810adab590 : 0xffffff7f9b7f3d50
0xffffff810adab640 : 0xffffff7f9b7f17d0 0xffffff810adab840 :
0xffffff7f9b7f2722 0xffffff810adab920 : 0xffffff7f9c7a5f80
0xffffff810adab960 : 0xffffff7f9c7b5db7 0xffffff810adab980 :
0xffffff7f9c7e4e5f 0xffffff810adab9c0 : 0xffffff7f9c7e4ebd
0xffffff810adaba00 : 0xffffff7f9c7bbb8f 0xffffff810adaba50 :
0xffffff7f9c785fe6 0xffffff810adabae0 : 0xffffff7f9c781d7c
0xffffff810adabb10 : 0xffffff7f9c77f90b 0xffffff810adabb40 :
0xffffff801b466363 0xffffff810adabbc0 : 0xffffff801b4683f3
0xffffff810adabc20 : 0xffffff801b465e2f 0xffffff810adabd70 :
0xffffff801b098c01 0xffffff810adabe80 : 0xffffff801b020b3d
0xffffff810adabeb0 : 0xffffff801b010448 0xffffff810adabf00 :
0xffffff801b01961b 0xffffff810adabf70 : 0xffffff801b0a6536
0xffffff810adabfb0 : 0xffffff801b0ce9e3 Kernel Extensions in backtrace:
com.apple.NVDAResman(8.1.2)[96AE69DE-8A37-39D0-B2D3-D8446A6AA670]@0xffffff7f9b78b000->0xffffff7f9ba30fff
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
dependency:
com.apple.iokit.IONDRVSupport(2.3.7)[6C8CFC18-75F0-3DEF-86C7-CEB2C1FD6BB1]@0xffffff7f9b777000
dependency:
com.apple.iokit.IOGraphicsFamily(2.3.7)[990D1A42-DF16-3AB9-ABC1-6A88AC142244]@0xffffff7f9b734000
com.apple.nvidia.nv50hal(8.1.2)[988EAF3A-3318-3787-8A5A-844830FA1522]@0xffffff7f9ba3c000->0xffffff7f9bd10fff
dependency:
com.apple.NVDAResman(8.1.2)[96AE69DE-8A37-39D0-B2D3-D8446A6AA670]@0xffffff7f9b78b000
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
com.apple.GeForce(8.1.2)[7EC545A4-4B57-32F1-8DC3-C31023AFBDCB]@0xffffff7f9c763000->0xffffff7f9c830fff
dependency:
com.apple.NVDAResman(8.1.2)[96AE69DE-8A37-39D0-B2D3-D8446A6AA670]@0xffffff7f9b78b000
dependency:
com.apple.iokit.IONDRVSupport(2.3.7)[6C8CFC18-75F0-3DEF-86C7-CEB2C1FD6BB1]@0xffffff7f9b777000
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
dependency:
com.apple.iokit.IOGraphicsFamily(2.3.7)[990D1A42-DF16-3AB9-ABC1-6A88AC142244]@0xffffff7f9b734000
com.apple.driver.AppleMuxControl(3.4.5)[49FEF732-D7A3-327B-A7AA-6AC5A6E3DCFF]@0xffffff7f9d206000->0xffffff7f9d218fff
dependency:
com.apple.driver.AppleBacklightExpert(1.0.4)[1D0BB11E-7D71-34CF-ACC3-57DF01CADA08]@0xffffff7f9d201000
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
dependency:
com.apple.driver.AppleGraphicsControl(3.4.5)[4A2C8548-7EF1-38A9-8817-E8CB34B8DCA6]@0xffffff7f9d1ed000
dependency:
com.apple.iokit.IOACPIFamily(1.4)[A35915E8-C1B0-3C0F-81DF-5515BC9002FC]@0xffffff7f9b675000
dependency:
com.apple.iokit.IONDRVSupport(2.3.7)[6C8CFC18-75F0-3DEF-86C7-CEB2C1FD6BB1]@0xffffff7f9b777000
dependency:
com.apple.iokit.IOGraphicsFamily(2.3.7)[990D1A42-DF16-3AB9-ABC1-6A88AC142244]@0xffffff7f9b734000
BSD process name corresponding to current thread: WindowServer
Mac OS version: 12E55
Kernel version: Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013;
root:xnu-2050.24.15~1/RELEASE_X86_64 Kernel UUID:
896CB1E3-AB79-3DF1-B595-549DFFDF3D36 Kernel slide: 0x000000001ae00000
Kernel text base: 0xffffff801b000000 System model name: MacBookPro6,2
(Mac-F22586C8)
System uptime in nanoseconds: 114083936688 last loaded kext at 8560011391:
org.virtualbox.kext.VBoxNetAdp 4.1.22 (addr 0xffffff7f9d358000, size
28672) loaded kexts: org.virtualbox.kext.VBoxNetAdp 4.1.22
org.virtualbox.kext.VBoxNetFlt 4.1.22 org.virtualbox.kext.VBoxUSB 4.1.22
org.virtualbox.kext.VBoxDrv 4.1.22 com.quark.driver.Tether64 1.1.0d3
net.telestream.driver.TelestreamAudio 1.0.4 com.apple.driver.AudioAUUC
1.60 com.apple.driver.AppleHWSensor 1.9.5d0 com.apple.filesystems.autofs
3.0 com.apple.iokit.IOBluetoothSerialManager 4.1.4f2
com.apple.driver.AppleTyMCEDriver 1.0.2d2 com.apple.driver.AGPM 100.12.87
com.apple.driver.AppleMikeyHIDDriver 122
com.apple.driver.AppleHDAHardwareConfigDriver 2.3.7fc4
com.apple.driver.AppleHDA 2.3.7fc4 com.apple.iokit.IOUserEthernet 1.0.0d1
com.apple.Dont_Steal_Mac_OS_X 7.0.0 com.apple.iokit.IOBluetoothUSBDFU
4.1.4f2 com.apple.driver.ApplePolicyControl 3.4.5
com.apple.iokit.BroadcomBluetoothHCIControllerUSBTransport 4.1.4f2
com.apple.driver.ACPI_SMC_PlatformPlugin 1.0.0
com.apple.driver.AppleSMCLMU 2.0.3d0 com.apple.driver.AppleMikeyDriver
2.3.7fc4 com.apple.driver.AppleMuxControl 3.4.5
com.apple.driver.AppleBacklight 170.2.5
com.apple.driver.AppleIntelHDGraphics 8.1.2
com.apple.driver.AppleIntelHDGraphicsFB 8.1.2 com.apple.GeForce 8.1.2
com.apple.driver.AppleUpstreamUserClient 3.5.10
com.apple.driver.AppleMCCSControl 1.1.11 com.apple.driver.AppleLPC 1.6.0
com.apple.nvidia.NVDAStartup 8.1.2 com.apple.driver.AppleSMCPDRC 1.0.0
com.apple.driver.SMCMotionSensor 3.0.3d1
com.apple.driver.AppleUSBTCButtons 237.1
com.apple.driver.AppleFileSystemDriver 3.0.1
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
com.apple.BootCache 34 com.apple.driver.AppleUSBTCKeyEventDriver 237.1
com.apple.driver.AppleUSBTCKeyboard 237.1
com.apple.iokit.SCSITaskUserClient 3.5.5
com.apple.driver.AppleUSBCardReader 3.1.7
com.apple.driver.AppleIRController 320.15 com.apple.driver.XsanFilter 404
com.apple.iokit.IOAHCIBlockStorage 2.3.1 com.apple.driver.AppleAHCIPort
2.5.2 com.apple.driver.AppleUSBHub 5.5.5 com.apple.driver.AirPort.Brcm4331
615.20.17 com.apple.driver.AppleFWOHCI 4.9.6 com.apple.driver.AppleUSBUHCI
5.2.5 com.apple.iokit.AppleBCM5701Ethernet 3.6.1b4
com.apple.driver.AppleUSBEHCI 5.5.0 com.apple.driver.AppleEFINVRAM 1.7
com.apple.driver.AppleSmartBatteryManager 161.0.0
com.apple.driver.AppleACPIButtons 1.7 com.apple.driver.AppleRTC 1.5
com.apple.driver.AppleHPET 1.8 com.apple.driver.AppleSMBIOS 1.9
com.apple.driver.AppleACPIEC 1.7 com.apple.driver.AppleAPIC 1.6
com.apple.driver.AppleIntelCPUPowerManagementClient 196.0.0
com.apple.nke.applicationfirewall 4.0.39 com.apple.security.quarantine 2.1
com.apple.driver.AppleIntelCPUPowerManagement 196.0.0
com.apple.kext.triggers 1.0 com.apple.iokit.IOSerialFamily 10.0.6
com.apple.driver.DspFuncLib 2.3.7fc4 com.apple.iokit.IOAudioFamily
1.8.9fc11 com.apple.kext.OSvKernDSPLib 1.6 com.apple.iokit.IOSurface
86.0.4 com.apple.iokit.IOBluetoothFamily 4.1.4f2
com.apple.iokit.AppleBluetoothHCIControllerUSBTransport 4.1.4f2
com.apple.driver.AppleHDAController 2.3.7fc4 com.apple.iokit.IOHDAFamily
2.3.7fc4 com.apple.driver.IOPlatformPluginLegacy 1.0.0
com.apple.iokit.IOFireWireIP 2.2.5 com.apple.driver.AppleGraphicsControl
3.4.5 com.apple.driver.AppleBacklightExpert 1.0.4
com.apple.driver.AppleSMBusPCI 1.0.11d0
com.apple.driver.AppleSMBusController 1.0.11d0 com.apple.nvidia.nv50hal
8.1.2 com.apple.NVDAResman 8.1.2 com.apple.iokit.IONDRVSupport 2.3.7
com.apple.iokit.IOGraphicsFamily 2.3.7
com.apple.driver.IOPlatformPluginFamily 5.3.0d51 com.apple.driver.AppleSMC
3.1.4d2 com.apple.driver.AppleUSBMultitouch 237.3
com.apple.iokit.IOSCSIBlockCommandsDevice 3.5.5
com.apple.iokit.IOUSBMassStorageClass 3.5.1
com.apple.iokit.IOSCSIArchitectureModelFamily 3.5.5
com.apple.iokit.IOUSBHIDDriver 5.2.5 com.apple.driver.AppleUSBMergeNub
5.5.5 com.apple.driver.AppleUSBComposite 5.2.5
com.apple.iokit.IOAHCIFamily 2.3.1 com.apple.iokit.IO80211Family 530.4
com.apple.iokit.IOUSBUserClient 5.5.5 com.apple.iokit.IOFireWireFamily
4.5.5 com.apple.iokit.IOEthernetAVBController 1.0.2b1
com.apple.iokit.IONetworkingFamily 3.0 com.apple.iokit.IOUSBFamily 5.6.0
com.apple.driver.AppleEFIRuntime 1.7 com.apple.iokit.IOHIDFamily 1.8.1
com.apple.iokit.IOSMBusFamily 1.1 com.apple.security.sandbox 220.3
com.apple.kext.AppleMatch 1.0.0d1 com.apple.security.TMSafetyNet 7
com.apple.driver.DiskImages 345 com.apple.iokit.IOStorageFamily 1.8
com.apple.driver.AppleKeyStore 28.21 com.apple.driver.AppleACPIPlatform
1.7 com.apple.iokit.IOPCIFamily 2.7.3 com.apple.iokit.IOACPIFamily 1.4
com.apple.kec.corecrypto 1.0 Model: MacBookPro6,2, BootROM MBP61.0057.B0F,
2 processors, Intel Core i7, 2.66 GHz, 8 GB, SMC 1.58f17 Graphics: Intel
HD Graphics, Intel HD Graphics, Built-In, 288 MB Graphics: NVIDIA GeForce
GT 330M, NVIDIA GeForce GT 330M, PCIe, 512 MB Memory Module: BANK 0/DIMM0,
4 GB, DDR3, 1067 MHz, 0x0000, 0x000000000000000000000000000000000000
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1067 MHz, 0x0000,
0x000000000000000000000000000000000000 AirPort:
spairport_wireless_card_type_airport_extreme (0x14E4, 0x93), Broadcom
BCM43xx 1.0 (5.106.98.100.17) Bluetooth: Version 4.1.4f2 12041, 2 service,
18 devices, 1 incoming serial ports Network Service: AirPort, AirPort, en1
Serial ATA Device: WDC WD5000BEKT-00KA9T0, 500.11 GB Serial ATA Device:
Samsung SSD 840 PRO Series, 128.04 GB USB Device: hub_device, 0x0424
(SMSC), 0x2514, 0xfd100000 / 2 USB Device: IR Receiver, apple_vendor_id,
0x8242, 0xfd120000 / 4 USB Device: Built-in iSight, apple_vendor_id,
0x8507, 0xfd110000 / 3 USB Device: hub_device, 0x0424 (SMSC), 0x2514,
0xfa100000 / 2 USB Device: Apple Internal Keyboard / Trackpad,
apple_vendor_id, 0x0237, 0xfa120000 / 5 USB Device: Internal Memory Card
Reader, apple_vendor_id, 0x8403, 0xfa130000 / 4 USB Device: BRCM2070 Hub,
0x0a5c (Broadcom Corp.), 0x4500, 0xfa110000 / 3 USB Device: Bluetooth USB
Host Controller, apple_vendor_id, 0x8218, 0xfa113000 / 8
I'm getting a kernel panic whenever I start a movie in quicktime player
this is what the crash report looks like
Interval Since Last Panic Report: 204039 sec Panics Since Last Report: 3
Anonymous UUID: 0F5C514A-96D2-917B-6D39-72A3E70945FB
Mon Aug 26 12:38:06 2013 panic(cpu 0 caller 0xffffff7f9d213f1a): "GPU
Panic: [] 3 3 7f 0 0 0 0 3 : NVRM[0/1:0:0]: Read Error 0x00000100: CFG
0xffffffff 0xffffffff 0xffffffff, BAR0 0xd2000000 0xffffff810bdf5000
0x0a5480a2, D0,
P3/4\n"@/SourceCache/AppleGraphicsControl/AppleGraphicsControl-3.4.5/src/AppleMuxControl/kext/GPUPanic.cpp:127
Backtrace (CPU 0), Frame : Return Address 0xffffff810adab190 :
0xffffff801b01d626 0xffffff810adab200 : 0xffffff7f9d213f1a
0xffffff810adab2d0 : 0xffffff7f9b7ecf1e 0xffffff810adab390 :
0xffffff7f9b8c112d 0xffffff810adab3d0 : 0xffffff7f9b8c118e
0xffffff810adab440 : 0xffffff7f9bb87ed0 0xffffff810adab570 :
0xffffff7f9b8e9a75 0xffffff810adab590 : 0xffffff7f9b7f3d50
0xffffff810adab640 : 0xffffff7f9b7f17d0 0xffffff810adab840 :
0xffffff7f9b7f2722 0xffffff810adab920 : 0xffffff7f9c7a5f80
0xffffff810adab960 : 0xffffff7f9c7b5db7 0xffffff810adab980 :
0xffffff7f9c7e4e5f 0xffffff810adab9c0 : 0xffffff7f9c7e4ebd
0xffffff810adaba00 : 0xffffff7f9c7bbb8f 0xffffff810adaba50 :
0xffffff7f9c785fe6 0xffffff810adabae0 : 0xffffff7f9c781d7c
0xffffff810adabb10 : 0xffffff7f9c77f90b 0xffffff810adabb40 :
0xffffff801b466363 0xffffff810adabbc0 : 0xffffff801b4683f3
0xffffff810adabc20 : 0xffffff801b465e2f 0xffffff810adabd70 :
0xffffff801b098c01 0xffffff810adabe80 : 0xffffff801b020b3d
0xffffff810adabeb0 : 0xffffff801b010448 0xffffff810adabf00 :
0xffffff801b01961b 0xffffff810adabf70 : 0xffffff801b0a6536
0xffffff810adabfb0 : 0xffffff801b0ce9e3 Kernel Extensions in backtrace:
com.apple.NVDAResman(8.1.2)[96AE69DE-8A37-39D0-B2D3-D8446A6AA670]@0xffffff7f9b78b000->0xffffff7f9ba30fff
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
dependency:
com.apple.iokit.IONDRVSupport(2.3.7)[6C8CFC18-75F0-3DEF-86C7-CEB2C1FD6BB1]@0xffffff7f9b777000
dependency:
com.apple.iokit.IOGraphicsFamily(2.3.7)[990D1A42-DF16-3AB9-ABC1-6A88AC142244]@0xffffff7f9b734000
com.apple.nvidia.nv50hal(8.1.2)[988EAF3A-3318-3787-8A5A-844830FA1522]@0xffffff7f9ba3c000->0xffffff7f9bd10fff
dependency:
com.apple.NVDAResman(8.1.2)[96AE69DE-8A37-39D0-B2D3-D8446A6AA670]@0xffffff7f9b78b000
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
com.apple.GeForce(8.1.2)[7EC545A4-4B57-32F1-8DC3-C31023AFBDCB]@0xffffff7f9c763000->0xffffff7f9c830fff
dependency:
com.apple.NVDAResman(8.1.2)[96AE69DE-8A37-39D0-B2D3-D8446A6AA670]@0xffffff7f9b78b000
dependency:
com.apple.iokit.IONDRVSupport(2.3.7)[6C8CFC18-75F0-3DEF-86C7-CEB2C1FD6BB1]@0xffffff7f9b777000
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
dependency:
com.apple.iokit.IOGraphicsFamily(2.3.7)[990D1A42-DF16-3AB9-ABC1-6A88AC142244]@0xffffff7f9b734000
com.apple.driver.AppleMuxControl(3.4.5)[49FEF732-D7A3-327B-A7AA-6AC5A6E3DCFF]@0xffffff7f9d206000->0xffffff7f9d218fff
dependency:
com.apple.driver.AppleBacklightExpert(1.0.4)[1D0BB11E-7D71-34CF-ACC3-57DF01CADA08]@0xffffff7f9d201000
dependency:
com.apple.iokit.IOPCIFamily(2.7.3)[1D668879-BEF8-3C58-ABFE-FAC6B3E9A292]@0xffffff7f9b6f5000
dependency:
com.apple.driver.AppleGraphicsControl(3.4.5)[4A2C8548-7EF1-38A9-8817-E8CB34B8DCA6]@0xffffff7f9d1ed000
dependency:
com.apple.iokit.IOACPIFamily(1.4)[A35915E8-C1B0-3C0F-81DF-5515BC9002FC]@0xffffff7f9b675000
dependency:
com.apple.iokit.IONDRVSupport(2.3.7)[6C8CFC18-75F0-3DEF-86C7-CEB2C1FD6BB1]@0xffffff7f9b777000
dependency:
com.apple.iokit.IOGraphicsFamily(2.3.7)[990D1A42-DF16-3AB9-ABC1-6A88AC142244]@0xffffff7f9b734000
BSD process name corresponding to current thread: WindowServer
Mac OS version: 12E55
Kernel version: Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013;
root:xnu-2050.24.15~1/RELEASE_X86_64 Kernel UUID:
896CB1E3-AB79-3DF1-B595-549DFFDF3D36 Kernel slide: 0x000000001ae00000
Kernel text base: 0xffffff801b000000 System model name: MacBookPro6,2
(Mac-F22586C8)
System uptime in nanoseconds: 114083936688 last loaded kext at 8560011391:
org.virtualbox.kext.VBoxNetAdp 4.1.22 (addr 0xffffff7f9d358000, size
28672) loaded kexts: org.virtualbox.kext.VBoxNetAdp 4.1.22
org.virtualbox.kext.VBoxNetFlt 4.1.22 org.virtualbox.kext.VBoxUSB 4.1.22
org.virtualbox.kext.VBoxDrv 4.1.22 com.quark.driver.Tether64 1.1.0d3
net.telestream.driver.TelestreamAudio 1.0.4 com.apple.driver.AudioAUUC
1.60 com.apple.driver.AppleHWSensor 1.9.5d0 com.apple.filesystems.autofs
3.0 com.apple.iokit.IOBluetoothSerialManager 4.1.4f2
com.apple.driver.AppleTyMCEDriver 1.0.2d2 com.apple.driver.AGPM 100.12.87
com.apple.driver.AppleMikeyHIDDriver 122
com.apple.driver.AppleHDAHardwareConfigDriver 2.3.7fc4
com.apple.driver.AppleHDA 2.3.7fc4 com.apple.iokit.IOUserEthernet 1.0.0d1
com.apple.Dont_Steal_Mac_OS_X 7.0.0 com.apple.iokit.IOBluetoothUSBDFU
4.1.4f2 com.apple.driver.ApplePolicyControl 3.4.5
com.apple.iokit.BroadcomBluetoothHCIControllerUSBTransport 4.1.4f2
com.apple.driver.ACPI_SMC_PlatformPlugin 1.0.0
com.apple.driver.AppleSMCLMU 2.0.3d0 com.apple.driver.AppleMikeyDriver
2.3.7fc4 com.apple.driver.AppleMuxControl 3.4.5
com.apple.driver.AppleBacklight 170.2.5
com.apple.driver.AppleIntelHDGraphics 8.1.2
com.apple.driver.AppleIntelHDGraphicsFB 8.1.2 com.apple.GeForce 8.1.2
com.apple.driver.AppleUpstreamUserClient 3.5.10
com.apple.driver.AppleMCCSControl 1.1.11 com.apple.driver.AppleLPC 1.6.0
com.apple.nvidia.NVDAStartup 8.1.2 com.apple.driver.AppleSMCPDRC 1.0.0
com.apple.driver.SMCMotionSensor 3.0.3d1
com.apple.driver.AppleUSBTCButtons 237.1
com.apple.driver.AppleFileSystemDriver 3.0.1
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
com.apple.BootCache 34 com.apple.driver.AppleUSBTCKeyEventDriver 237.1
com.apple.driver.AppleUSBTCKeyboard 237.1
com.apple.iokit.SCSITaskUserClient 3.5.5
com.apple.driver.AppleUSBCardReader 3.1.7
com.apple.driver.AppleIRController 320.15 com.apple.driver.XsanFilter 404
com.apple.iokit.IOAHCIBlockStorage 2.3.1 com.apple.driver.AppleAHCIPort
2.5.2 com.apple.driver.AppleUSBHub 5.5.5 com.apple.driver.AirPort.Brcm4331
615.20.17 com.apple.driver.AppleFWOHCI 4.9.6 com.apple.driver.AppleUSBUHCI
5.2.5 com.apple.iokit.AppleBCM5701Ethernet 3.6.1b4
com.apple.driver.AppleUSBEHCI 5.5.0 com.apple.driver.AppleEFINVRAM 1.7
com.apple.driver.AppleSmartBatteryManager 161.0.0
com.apple.driver.AppleACPIButtons 1.7 com.apple.driver.AppleRTC 1.5
com.apple.driver.AppleHPET 1.8 com.apple.driver.AppleSMBIOS 1.9
com.apple.driver.AppleACPIEC 1.7 com.apple.driver.AppleAPIC 1.6
com.apple.driver.AppleIntelCPUPowerManagementClient 196.0.0
com.apple.nke.applicationfirewall 4.0.39 com.apple.security.quarantine 2.1
com.apple.driver.AppleIntelCPUPowerManagement 196.0.0
com.apple.kext.triggers 1.0 com.apple.iokit.IOSerialFamily 10.0.6
com.apple.driver.DspFuncLib 2.3.7fc4 com.apple.iokit.IOAudioFamily
1.8.9fc11 com.apple.kext.OSvKernDSPLib 1.6 com.apple.iokit.IOSurface
86.0.4 com.apple.iokit.IOBluetoothFamily 4.1.4f2
com.apple.iokit.AppleBluetoothHCIControllerUSBTransport 4.1.4f2
com.apple.driver.AppleHDAController 2.3.7fc4 com.apple.iokit.IOHDAFamily
2.3.7fc4 com.apple.driver.IOPlatformPluginLegacy 1.0.0
com.apple.iokit.IOFireWireIP 2.2.5 com.apple.driver.AppleGraphicsControl
3.4.5 com.apple.driver.AppleBacklightExpert 1.0.4
com.apple.driver.AppleSMBusPCI 1.0.11d0
com.apple.driver.AppleSMBusController 1.0.11d0 com.apple.nvidia.nv50hal
8.1.2 com.apple.NVDAResman 8.1.2 com.apple.iokit.IONDRVSupport 2.3.7
com.apple.iokit.IOGraphicsFamily 2.3.7
com.apple.driver.IOPlatformPluginFamily 5.3.0d51 com.apple.driver.AppleSMC
3.1.4d2 com.apple.driver.AppleUSBMultitouch 237.3
com.apple.iokit.IOSCSIBlockCommandsDevice 3.5.5
com.apple.iokit.IOUSBMassStorageClass 3.5.1
com.apple.iokit.IOSCSIArchitectureModelFamily 3.5.5
com.apple.iokit.IOUSBHIDDriver 5.2.5 com.apple.driver.AppleUSBMergeNub
5.5.5 com.apple.driver.AppleUSBComposite 5.2.5
com.apple.iokit.IOAHCIFamily 2.3.1 com.apple.iokit.IO80211Family 530.4
com.apple.iokit.IOUSBUserClient 5.5.5 com.apple.iokit.IOFireWireFamily
4.5.5 com.apple.iokit.IOEthernetAVBController 1.0.2b1
com.apple.iokit.IONetworkingFamily 3.0 com.apple.iokit.IOUSBFamily 5.6.0
com.apple.driver.AppleEFIRuntime 1.7 com.apple.iokit.IOHIDFamily 1.8.1
com.apple.iokit.IOSMBusFamily 1.1 com.apple.security.sandbox 220.3
com.apple.kext.AppleMatch 1.0.0d1 com.apple.security.TMSafetyNet 7
com.apple.driver.DiskImages 345 com.apple.iokit.IOStorageFamily 1.8
com.apple.driver.AppleKeyStore 28.21 com.apple.driver.AppleACPIPlatform
1.7 com.apple.iokit.IOPCIFamily 2.7.3 com.apple.iokit.IOACPIFamily 1.4
com.apple.kec.corecrypto 1.0 Model: MacBookPro6,2, BootROM MBP61.0057.B0F,
2 processors, Intel Core i7, 2.66 GHz, 8 GB, SMC 1.58f17 Graphics: Intel
HD Graphics, Intel HD Graphics, Built-In, 288 MB Graphics: NVIDIA GeForce
GT 330M, NVIDIA GeForce GT 330M, PCIe, 512 MB Memory Module: BANK 0/DIMM0,
4 GB, DDR3, 1067 MHz, 0x0000, 0x000000000000000000000000000000000000
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1067 MHz, 0x0000,
0x000000000000000000000000000000000000 AirPort:
spairport_wireless_card_type_airport_extreme (0x14E4, 0x93), Broadcom
BCM43xx 1.0 (5.106.98.100.17) Bluetooth: Version 4.1.4f2 12041, 2 service,
18 devices, 1 incoming serial ports Network Service: AirPort, AirPort, en1
Serial ATA Device: WDC WD5000BEKT-00KA9T0, 500.11 GB Serial ATA Device:
Samsung SSD 840 PRO Series, 128.04 GB USB Device: hub_device, 0x0424
(SMSC), 0x2514, 0xfd100000 / 2 USB Device: IR Receiver, apple_vendor_id,
0x8242, 0xfd120000 / 4 USB Device: Built-in iSight, apple_vendor_id,
0x8507, 0xfd110000 / 3 USB Device: hub_device, 0x0424 (SMSC), 0x2514,
0xfa100000 / 2 USB Device: Apple Internal Keyboard / Trackpad,
apple_vendor_id, 0x0237, 0xfa120000 / 5 USB Device: Internal Memory Card
Reader, apple_vendor_id, 0x8403, 0xfa130000 / 4 USB Device: BRCM2070 Hub,
0x0a5c (Broadcom Corp.), 0x4500, 0xfa110000 / 3 USB Device: Bluetooth USB
Host Controller, apple_vendor_id, 0x8218, 0xfa113000 / 8
Oracle regexp_replace every occurence
Oracle regexp_replace every occurence
I want to replace the every occurence of String expect the first occurence
using regexp_replace. below query will repalce only Second occurence.
select 'This is test STRING STRING some text STRING some more text' from dual
select regexp_replace('This is test STRING STRING some text STRING some
more text','STRING', 'REPLACED-STRING' , 1,2) from dual
Results is
This is test STRING REPLACED-STRING some text STRING some more text
But I need result like
This is test STRING REPLACED-STRING some text REPLACED-STRING some more text
I want to replace the every occurence of String expect the first occurence
using regexp_replace. below query will repalce only Second occurence.
select 'This is test STRING STRING some text STRING some more text' from dual
select regexp_replace('This is test STRING STRING some text STRING some
more text','STRING', 'REPLACED-STRING' , 1,2) from dual
Results is
This is test STRING REPLACED-STRING some text STRING some more text
But I need result like
This is test STRING REPLACED-STRING some text REPLACED-STRING some more text
Sunday, August 25, 2013
How to get longitude and latitude of a city/country inputted through an input box?
How to get longitude and latitude of a city/country inputted through an
input box?
I have this code,
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function myIP(){
$("#btn").click(function(){
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': '#city'}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert("location : " + results[0].geometry.location.lat() + " "
+results[0].geometry.location.lng());
} else {
alert("Something got wrong " + status);
}
});
});
}
</script>
</head>
<body onload="myIP()">
<input type="text" id= "city">
<input id="btn" type="button" value="get Lat&Long" />
</body>
</html>
This will give me latitude and longitude of the inputted city in small
dialog box. But I need this in the same page or parent page. Please help
me
input box?
I have this code,
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function myIP(){
$("#btn").click(function(){
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': '#city'}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert("location : " + results[0].geometry.location.lat() + " "
+results[0].geometry.location.lng());
} else {
alert("Something got wrong " + status);
}
});
});
}
</script>
</head>
<body onload="myIP()">
<input type="text" id= "city">
<input id="btn" type="button" value="get Lat&Long" />
</body>
</html>
This will give me latitude and longitude of the inputted city in small
dialog box. But I need this in the same page or parent page. Please help
me
Php recursive array counting
Php recursive array counting
I'm trying to write a function which counts array elements recursively.
But result is false.
What could it be problem?
$schema = array(
'div' => array(
'class' => 'lines',
'div' => array(
'span' => array(
'key' => 'Product Name'
),
'val' => 'Soap'
),
'layer' => array(
'span' => array(
'key' => 'Product Name'
),
'val' => 'Ball'
)
)
);
function count_r($array, $i = 0){
foreach($array as $k){
if(is_array($k)){ $i += count_r($k, count($k)); }
else{ $i++; }
}
return $i;
}
echo count_r($schema);
I'm trying to write a function which counts array elements recursively.
But result is false.
What could it be problem?
$schema = array(
'div' => array(
'class' => 'lines',
'div' => array(
'span' => array(
'key' => 'Product Name'
),
'val' => 'Soap'
),
'layer' => array(
'span' => array(
'key' => 'Product Name'
),
'val' => 'Ball'
)
)
);
function count_r($array, $i = 0){
foreach($array as $k){
if(is_array($k)){ $i += count_r($k, count($k)); }
else{ $i++; }
}
return $i;
}
echo count_r($schema);
Google Spreadsheet - Call an event when the active spreadsheet changes
Google Spreadsheet - Call an event when the active spreadsheet changes
I'm working with a spreadsheet that has multiple sheets, I would like my
custom toolbar menu to change dynamically depending on which sheet is open
at the time.
Is there an event that can be called when the active spreadsheet is
changed? Or some other method of updating the menus as I change between
sheets.
Thanks.
I'm working with a spreadsheet that has multiple sheets, I would like my
custom toolbar menu to change dynamically depending on which sheet is open
at the time.
Is there an event that can be called when the active spreadsheet is
changed? Or some other method of updating the menus as I change between
sheets.
Thanks.
Unable to find matching navigation case with from-view-id '/index.xhtml' for action : JSF
Unable to find matching navigation case with from-view-id '/index.xhtml'
for action : JSF
I am getting the following error : Unable to find matching navigation case
with from-view-id '/index.xhtml' for action
'#{medcontroller.getMedGeneric}' with outcome
'javax.faces.model.ListDataModel@7a652236'
I am new to jsf and I'm really clueless about solving this error. I have a
ManagedBean with the following code:
MedController.java
@ManagedBean(name = "medcontroller")
@SessionScoped
public class MedController implements Serializable {
int startId;
String gName;
int endId;
DataModel medNames;
//DataModel medGeneric;
MedicineHelper helper;
private int recordCount = 1000;
private int pageSize = 10;
private Medicine current;
private int selectedItemIndex;
public MedController() {
helper = new MedicineHelper();
startId = 1;
endId = 10;
}
public MedController(int startId, int endId) {
helper = new MedicineHelper();
this.startId = startId;
this.endId = endId;
}
public Medicine getSelected() {
if (current == null) {
current = new Medicine();
selectedItemIndex = -1;
}
return current;
}
public DataModel getMedNames() {
if (medNames == null) {
medNames = new ListDataModel(helper.getMedNames(startId, endId));
}
return medNames;
}
public String getgName()
{
return gName;
}
public void setgName(String gName)
{
this.gName = gName;
}
public DataModel getMedGeneric() {
if (medNames == null) {
medNames= new ListDataModel(helper.getMedGeneric(gName));
}
return medNames;
}
void recreateModel() {
medNames = null;
}
public boolean isHasNextPage() {
if (endId + pageSize <= recordCount) {
return true;
}
return false;
}
public boolean isHasPreviousPage() {
if (startId-pageSize > 0) {
return true;
}
return false;
}
public String next() {
startId = endId+1;
endId = endId + pageSize;
recreateModel();
return "index";
}
public String previous() {
startId = startId - pageSize;
endId = endId - pageSize;
recreateModel();
return "index";
}
public int getPageSize() {
return pageSize;
}
public String prepareView(){
current = (Medicine) getMedNames().getRowData();
return "browse";
}
public String prepareList(){
recreateModel();
return "index";
}
}
And here is my JSF file
index.xhtml
<ui:define name="body">
<h:form styleClass="jsfcrud_list_form">
<h:commandLink action="#{medcontroller.previous}" value="Previous
#{medcontroller.pageSize}"
rendered="#{medcontroller.hasPreviousPage}"/>
<h:commandLink action="#{medcontroller.next}" value="Next
#{medcontroller.pageSize}" rendered="#{medcontroller.hasNextPage}"/>
<h:dataTable value="#{medcontroller.medNames}" var="item" border="1"
cellpadding="15" cellspacing="10"
rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all"
style="border:solid 1px">
<h:column>
<f:facet name="header">
<h:outputText value="BrandName"/>
</f:facet>
<h:outputText value="#{item.brandName}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Generic"/>
</f:facet>
<h:outputText value="#{item.generic}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value=" "/>
</f:facet>
<h:commandLink action="#{medcontroller.prepareView}"
value="View"/>
</h:column>
</h:dataTable>
<h:inputText value="#{medcontroller.gName}" />
<h:commandButton value="Submit"
action="#{medcontroller.getMedGeneric}" />
</h:form>
</ui:define>
Please help me solve the error. Also, I do not have a faces-config.xml
file. I am using netbeans ide 7.1.2 web application with jsf and hibernate
framework.
Thank you in advance.
for action : JSF
I am getting the following error : Unable to find matching navigation case
with from-view-id '/index.xhtml' for action
'#{medcontroller.getMedGeneric}' with outcome
'javax.faces.model.ListDataModel@7a652236'
I am new to jsf and I'm really clueless about solving this error. I have a
ManagedBean with the following code:
MedController.java
@ManagedBean(name = "medcontroller")
@SessionScoped
public class MedController implements Serializable {
int startId;
String gName;
int endId;
DataModel medNames;
//DataModel medGeneric;
MedicineHelper helper;
private int recordCount = 1000;
private int pageSize = 10;
private Medicine current;
private int selectedItemIndex;
public MedController() {
helper = new MedicineHelper();
startId = 1;
endId = 10;
}
public MedController(int startId, int endId) {
helper = new MedicineHelper();
this.startId = startId;
this.endId = endId;
}
public Medicine getSelected() {
if (current == null) {
current = new Medicine();
selectedItemIndex = -1;
}
return current;
}
public DataModel getMedNames() {
if (medNames == null) {
medNames = new ListDataModel(helper.getMedNames(startId, endId));
}
return medNames;
}
public String getgName()
{
return gName;
}
public void setgName(String gName)
{
this.gName = gName;
}
public DataModel getMedGeneric() {
if (medNames == null) {
medNames= new ListDataModel(helper.getMedGeneric(gName));
}
return medNames;
}
void recreateModel() {
medNames = null;
}
public boolean isHasNextPage() {
if (endId + pageSize <= recordCount) {
return true;
}
return false;
}
public boolean isHasPreviousPage() {
if (startId-pageSize > 0) {
return true;
}
return false;
}
public String next() {
startId = endId+1;
endId = endId + pageSize;
recreateModel();
return "index";
}
public String previous() {
startId = startId - pageSize;
endId = endId - pageSize;
recreateModel();
return "index";
}
public int getPageSize() {
return pageSize;
}
public String prepareView(){
current = (Medicine) getMedNames().getRowData();
return "browse";
}
public String prepareList(){
recreateModel();
return "index";
}
}
And here is my JSF file
index.xhtml
<ui:define name="body">
<h:form styleClass="jsfcrud_list_form">
<h:commandLink action="#{medcontroller.previous}" value="Previous
#{medcontroller.pageSize}"
rendered="#{medcontroller.hasPreviousPage}"/>
<h:commandLink action="#{medcontroller.next}" value="Next
#{medcontroller.pageSize}" rendered="#{medcontroller.hasNextPage}"/>
<h:dataTable value="#{medcontroller.medNames}" var="item" border="1"
cellpadding="15" cellspacing="10"
rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all"
style="border:solid 1px">
<h:column>
<f:facet name="header">
<h:outputText value="BrandName"/>
</f:facet>
<h:outputText value="#{item.brandName}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Generic"/>
</f:facet>
<h:outputText value="#{item.generic}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value=" "/>
</f:facet>
<h:commandLink action="#{medcontroller.prepareView}"
value="View"/>
</h:column>
</h:dataTable>
<h:inputText value="#{medcontroller.gName}" />
<h:commandButton value="Submit"
action="#{medcontroller.getMedGeneric}" />
</h:form>
</ui:define>
Please help me solve the error. Also, I do not have a faces-config.xml
file. I am using netbeans ide 7.1.2 web application with jsf and hibernate
framework.
Thank you in advance.
I want to make a currency ticker using the webservice
I want to make a currency ticker using the webservice
I have to use the ajax to make it done. And what am suffering from right
now is how do i get the url that points to a webservices that returns json
objects.
I have to use the ajax to make it done. And what am suffering from right
now is how do i get the url that points to a webservices that returns json
objects.
Saturday, August 24, 2013
Write JSON object to Windows Phone Isolated Storage
Write JSON object to Windows Phone Isolated Storage
I'm trying to save a JSON object that is returned from Azure Mobile
Services to the Windows Phone isolated storage. I've started with the code
below, but I'm not entirely sure how to actually write the file to
Isolated Storage or what format to save it in (XML, TXT, etc.).
string offlineData = Path.Combine("WPTracker", "Offline");
string offlineDataFile = Path.Combine(offlineData, "phones.xml");
var store = IsolatedStorageFile.GetUserStoreForApplication();
//Query
try
{
phoneList = await phoneTable
.Where(PhoneItem => PhoneItem.Publish == true)
.OrderBy(PhoneItem => PhoneItem.FullName)
.ToListAsync();
}
catch (MobileServiceInvalidOperationException f)
{
MessageBox.Show(f.Response.Content.ToString(),
string.Format("{0} (HTTP {1})",
f.Response.Content,
f.Response.StatusCode), MessageBoxButton.OK);
}
//Write
IsolatedStorageFileStream dataFile = null;
dataFile = store.OpenFile(offlineDataFile, FileMode.Create);
DataContractSerializer ser = new
DataContractSerializer(typeof(IEnumerable<Phones>));
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
JsonWriter jWriter = new JsonTextWriter(sw);
ser.WriteObject(dataFile, phoneList);
dataFile.Close();
Any suggestions? :)
I'm trying to save a JSON object that is returned from Azure Mobile
Services to the Windows Phone isolated storage. I've started with the code
below, but I'm not entirely sure how to actually write the file to
Isolated Storage or what format to save it in (XML, TXT, etc.).
string offlineData = Path.Combine("WPTracker", "Offline");
string offlineDataFile = Path.Combine(offlineData, "phones.xml");
var store = IsolatedStorageFile.GetUserStoreForApplication();
//Query
try
{
phoneList = await phoneTable
.Where(PhoneItem => PhoneItem.Publish == true)
.OrderBy(PhoneItem => PhoneItem.FullName)
.ToListAsync();
}
catch (MobileServiceInvalidOperationException f)
{
MessageBox.Show(f.Response.Content.ToString(),
string.Format("{0} (HTTP {1})",
f.Response.Content,
f.Response.StatusCode), MessageBoxButton.OK);
}
//Write
IsolatedStorageFileStream dataFile = null;
dataFile = store.OpenFile(offlineDataFile, FileMode.Create);
DataContractSerializer ser = new
DataContractSerializer(typeof(IEnumerable<Phones>));
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
JsonWriter jWriter = new JsonTextWriter(sw);
ser.WriteObject(dataFile, phoneList);
dataFile.Close();
Any suggestions? :)
How to find loop-node of a linkedlist with a loop?
How to find loop-node of a linkedlist with a loop?
This question is a bit different than finding an intersection of 2 linked
lists.
Consider a linkedlist with a loop: A - B - C - D - E - F - C.
If node A is the input to the function, then it should return C.
Since I do not know what to call C, I have used a term loop-node C as seen
in the question. Although an O(n2) term appears obvious, can there be a
way to find loop-node with lesser complexity?
A hash table / extra space of O(n) not allowed.
This question is a bit different than finding an intersection of 2 linked
lists.
Consider a linkedlist with a loop: A - B - C - D - E - F - C.
If node A is the input to the function, then it should return C.
Since I do not know what to call C, I have used a term loop-node C as seen
in the question. Although an O(n2) term appears obvious, can there be a
way to find loop-node with lesser complexity?
A hash table / extra space of O(n) not allowed.
installation on to memory stick instead of hard drive
installation on to memory stick instead of hard drive
i want to install your software to a memory stick the location where the
boot sector belongs is defective so the installer file will not work. have
tried many times and the installations simply locks and the i get a
message saying installation failure. Windows 7 restore disk has the exact
same issue. I am currently booting via the install disk in the drive.
i want to install your software to a memory stick the location where the
boot sector belongs is defective so the installer file will not work. have
tried many times and the installations simply locks and the i get a
message saying installation failure. Windows 7 restore disk has the exact
same issue. I am currently booting via the install disk in the drive.
MySQL List Set theory, relational database
MySQL List Set theory, relational database
SELECT business.name FROM business WHERE (3) NOT IN (1,2,3)
The above is a valid MySQL statement. But I need a statement which allows
the NOT IN condition to work with 2 lists i.e. none of the elements in the
first list appear in the second.
E.g.
SELECT business.name FROM business WHERE (4, 5) NOT IN (1,2,3)
Note: These lists are integer values and are generated using nested queries
Thank You in advance
SELECT business.name FROM business WHERE (3) NOT IN (1,2,3)
The above is a valid MySQL statement. But I need a statement which allows
the NOT IN condition to work with 2 lists i.e. none of the elements in the
first list appear in the second.
E.g.
SELECT business.name FROM business WHERE (4, 5) NOT IN (1,2,3)
Note: These lists are integer values and are generated using nested queries
Thank You in advance
How to set a value for DateTimePicker control?
How to set a value for DateTimePicker control?
I have DateTimePicker control in form1, I want to set value in that
control from a nvarchar(50) BirthDate field from an Employee table in my
DB.
public string EmpBirthDate
{
get { return dateTimePickerBirthDate.Value.ToString(); }
set { dateTimePickerBirthDate.value = DateTime.Parse(value); }
}
But I got this error: 'System.Windows.Forms.DateTimePicker' does not
contain a definition for 'value' and no extension method 'value' accepting
a first argument of type 'System.Windows.Forms.DateTimePicker' could be
found (are you missing a using directive or an assembly reference?)
I have DateTimePicker control in form1, I want to set value in that
control from a nvarchar(50) BirthDate field from an Employee table in my
DB.
public string EmpBirthDate
{
get { return dateTimePickerBirthDate.Value.ToString(); }
set { dateTimePickerBirthDate.value = DateTime.Parse(value); }
}
But I got this error: 'System.Windows.Forms.DateTimePicker' does not
contain a definition for 'value' and no extension method 'value' accepting
a first argument of type 'System.Windows.Forms.DateTimePicker' could be
found (are you missing a using directive or an assembly reference?)
Inpute & Update record in excel
Inpute & Update record in excel
I am working on creating a user form to store data in excel & update
record, I have 3 requirement to complete my user form design.
How can i create a unique reference number (preferable starting with first
3 character in some textbox followed by incremental number) for each of
the record which is getting saved in a excel using userform.
Also would like to know how can i retrieve a record and update record in
excel using userform.(Preferable by using one or two value) In case search
result have more then one record to search result option to select
required record.
I will also be adding 3 drop down box(Segment, Product & Sub Product) in
user form. Values which are available under Product should depend on what
user have selected Value under Segment & Values which are available under
Sub-Product should depend on what user have selected Value under Product
Sample structure of Database i have created in excel
Segment Product Sub-Product SEG-1 Prod-1 SubP_1 SEG-1 Prod-1 SubP_2 SEG-2
Prod_2 SubP_3 SEG-2 Prod_2 SubP_4
I am working on creating a user form to store data in excel & update
record, I have 3 requirement to complete my user form design.
How can i create a unique reference number (preferable starting with first
3 character in some textbox followed by incremental number) for each of
the record which is getting saved in a excel using userform.
Also would like to know how can i retrieve a record and update record in
excel using userform.(Preferable by using one or two value) In case search
result have more then one record to search result option to select
required record.
I will also be adding 3 drop down box(Segment, Product & Sub Product) in
user form. Values which are available under Product should depend on what
user have selected Value under Segment & Values which are available under
Sub-Product should depend on what user have selected Value under Product
Sample structure of Database i have created in excel
Segment Product Sub-Product SEG-1 Prod-1 SubP_1 SEG-1 Prod-1 SubP_2 SEG-2
Prod_2 SubP_3 SEG-2 Prod_2 SubP_4
XSLT tranform a document with group element
XSLT tranform a document with group element
I have the document like this:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<data attribute1="12" attribute2="1" attribute3="1">Director</data>
<data attribute1="12" attribute2="1" attribute3="5">James</data>
<data attribute1="12" attribute2="1" attribute3="8">Male</data>
<data attribute1="12" attribute2="1" attribute3="9">10-Dec-1965</data>
<data attribute1="12" attribute2="2"
attribute3="18">James@gmail.com</data>
<data attribute1="12" attribute2="2" attribute3="1">Chief Account</data>
<data attribute1="12" attribute2="2" attribute3="5">Anna</data>
<data attribute1="12" attribute2="2" attribute3="8">Female</data>
<data attribute1="12" attribute2="1" attribute3="9">5-Aug-1980</data>
<data attribute1="12" attribute2="2"
attribute3="18">Anna@gmail.com</data>
</document>
I want to transform to
<Person>
<Title>Director</Title>
<FullName>James</FullName>
<Gender>Male</Gender>
<DateOfBirth>10-Dec-1965</DateOfBirth>
<EmailAddress>James@gmail.com</EmailAddress>
</Person>
<Person>
<Title>Chief Account</Title>
<FullName>Anna</FullName>
<Gender>Female</Gender>
<DateOfBirth>5-Aug-1980</DateOfBirth>
<EmailAddress>Anna@gmail.com</EmailAddress>
</Person>
Problem with me that when I use the xslt as below, it made duplicated tag
in each element.
<xsl:for-each select="document/data[@attribute1=12]">
<Person>
<xsl:choose>
<xsl:when test="boolean(./@attribute3 = '1')">
<Title>
<xsl:value-of select="./."/>
</Title>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '5')">
<FullName>
<xsl:value-of select="./."/>
</FullName>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '8')">
<Gender>
<xsl:value-of select="./."/>
</Gender>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '9')">
<DateOfBirth>
<xsl:value-of select="./."/>
</DateOfBirth>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '18')">
<EmailAddress>
<xsl:value-of select="./."/>
</EmailAddress>
</xsl:when>
</xsl:choose>
</Person>
</xsl:for-each>
So could anyone help me solving this problem. Thank you!
I have the document like this:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<data attribute1="12" attribute2="1" attribute3="1">Director</data>
<data attribute1="12" attribute2="1" attribute3="5">James</data>
<data attribute1="12" attribute2="1" attribute3="8">Male</data>
<data attribute1="12" attribute2="1" attribute3="9">10-Dec-1965</data>
<data attribute1="12" attribute2="2"
attribute3="18">James@gmail.com</data>
<data attribute1="12" attribute2="2" attribute3="1">Chief Account</data>
<data attribute1="12" attribute2="2" attribute3="5">Anna</data>
<data attribute1="12" attribute2="2" attribute3="8">Female</data>
<data attribute1="12" attribute2="1" attribute3="9">5-Aug-1980</data>
<data attribute1="12" attribute2="2"
attribute3="18">Anna@gmail.com</data>
</document>
I want to transform to
<Person>
<Title>Director</Title>
<FullName>James</FullName>
<Gender>Male</Gender>
<DateOfBirth>10-Dec-1965</DateOfBirth>
<EmailAddress>James@gmail.com</EmailAddress>
</Person>
<Person>
<Title>Chief Account</Title>
<FullName>Anna</FullName>
<Gender>Female</Gender>
<DateOfBirth>5-Aug-1980</DateOfBirth>
<EmailAddress>Anna@gmail.com</EmailAddress>
</Person>
Problem with me that when I use the xslt as below, it made duplicated tag
in each element.
<xsl:for-each select="document/data[@attribute1=12]">
<Person>
<xsl:choose>
<xsl:when test="boolean(./@attribute3 = '1')">
<Title>
<xsl:value-of select="./."/>
</Title>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '5')">
<FullName>
<xsl:value-of select="./."/>
</FullName>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '8')">
<Gender>
<xsl:value-of select="./."/>
</Gender>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '9')">
<DateOfBirth>
<xsl:value-of select="./."/>
</DateOfBirth>
</xsl:when>
<xsl:when test="boolean(./@attribute3 = '18')">
<EmailAddress>
<xsl:value-of select="./."/>
</EmailAddress>
</xsl:when>
</xsl:choose>
</Person>
</xsl:for-each>
So could anyone help me solving this problem. Thank you!
Please convert the below sentence to active voice [on hold]
Please convert the below sentence to active voice [on hold]
If the Online Help is updated to a newer version relaunch the web browser
If the Online Help is updated to a newer version relaunch the web browser
Friday, August 23, 2013
Jquery have to click twice to activate animation
Jquery have to click twice to activate animation
I am making a tab bar using Jquery. Everything is working, however, on the
first load, I have to click the icon I wish to select twice to change to
it. After this, all icons need to only be clicked once. I can't seem to
figure out the reason for this in my code. The Javascript:
function loadTabBar()
{
var person = false;
var current = false;
var wine = false;
var sale = false;
var oldImg = null;
if (!person & !current & !wine & !sale)
{
newLaunch();
}
function tabBarReady(){
$('#Wine').click(function()
{
if(!wine){
wine = true;
switchImg();}
})
$('#Current').click(function()
{
if(!current){
current = true;
switchImg();}
})
$('#Person').click(function()
{
if(!person){
person = true;
switchImg();}
})
$('#Sale').click(function()
{
if(!sale){
sale = true;
switchImg();}
})}
function switchImg()
{
var newImg = null;
if(sale)
{
newImg='#Sale';
}
if(current)
{
newImg='#Current';
}
if(wine)
{
newImg='#Wine';
}
if(person)
{
newImg='#Person';
}
ran = true;
$(oldImg).attr('src', ("images/icons/tabBar/" +
oldImg.substring(1) + '1.png'))
$(oldImg).fadeIn(10);
$(newImg).attr('src', ("images/icons/tabBar/" +
newImg.substring(1) + '2.png'))
$(newImg).fadeIn(0)
oldImg = newImg;
newImg = null;
wine = false;
sale = false;
current = false;
person = false;
}
function newLaunch()
{
$('#Person').attr('src', 'images/icons/tabBar/Person2.png');
$('#Person').fadeIn(0);
person = true;
oldImg = "#Person";
tabBarReady()
}
}
Website with a demo http://jagspcmagic.com/test/index.html
I am making a tab bar using Jquery. Everything is working, however, on the
first load, I have to click the icon I wish to select twice to change to
it. After this, all icons need to only be clicked once. I can't seem to
figure out the reason for this in my code. The Javascript:
function loadTabBar()
{
var person = false;
var current = false;
var wine = false;
var sale = false;
var oldImg = null;
if (!person & !current & !wine & !sale)
{
newLaunch();
}
function tabBarReady(){
$('#Wine').click(function()
{
if(!wine){
wine = true;
switchImg();}
})
$('#Current').click(function()
{
if(!current){
current = true;
switchImg();}
})
$('#Person').click(function()
{
if(!person){
person = true;
switchImg();}
})
$('#Sale').click(function()
{
if(!sale){
sale = true;
switchImg();}
})}
function switchImg()
{
var newImg = null;
if(sale)
{
newImg='#Sale';
}
if(current)
{
newImg='#Current';
}
if(wine)
{
newImg='#Wine';
}
if(person)
{
newImg='#Person';
}
ran = true;
$(oldImg).attr('src', ("images/icons/tabBar/" +
oldImg.substring(1) + '1.png'))
$(oldImg).fadeIn(10);
$(newImg).attr('src', ("images/icons/tabBar/" +
newImg.substring(1) + '2.png'))
$(newImg).fadeIn(0)
oldImg = newImg;
newImg = null;
wine = false;
sale = false;
current = false;
person = false;
}
function newLaunch()
{
$('#Person').attr('src', 'images/icons/tabBar/Person2.png');
$('#Person').fadeIn(0);
person = true;
oldImg = "#Person";
tabBarReady()
}
}
Website with a demo http://jagspcmagic.com/test/index.html
Query multiple rows that leads to one row in other table
Query multiple rows that leads to one row in other table
I'm a noob at making mySQL queries so I couldn't get my work done. I hope
you guys know the answer to my question.
I want to make options to my products. Like if you have a black t-shirt,
with a tanktop model and diamonds on it. You must have the black t-shirt
tanktop model and diamonds row. I want to make it like this:
table: product_option
--------------------------------
product_option_id name product_combination_id
1 Black 1
2 Diamond 1
3 Tanktop 1
4 Option 2
5 Option 2
table: product_combination
--------------------------------
product_combination_id name
1 Black tanktop with diamonds
So my question is. Is it possible to query the product_options and get an
product_combination row out of it?
I hope you guys know the answer to my question! Thank you for your time :)
I'm a noob at making mySQL queries so I couldn't get my work done. I hope
you guys know the answer to my question.
I want to make options to my products. Like if you have a black t-shirt,
with a tanktop model and diamonds on it. You must have the black t-shirt
tanktop model and diamonds row. I want to make it like this:
table: product_option
--------------------------------
product_option_id name product_combination_id
1 Black 1
2 Diamond 1
3 Tanktop 1
4 Option 2
5 Option 2
table: product_combination
--------------------------------
product_combination_id name
1 Black tanktop with diamonds
So my question is. Is it possible to query the product_options and get an
product_combination row out of it?
I hope you guys know the answer to my question! Thank you for your time :)
what is PATH on the MAC (UNIX) system
what is PATH on the MAC (UNIX) system
im trying to setup a project , storm from git
https://github.com/nathanmarz/storm/wiki/Setting-up-development-environment
Download a Storm release , unpack it, and put the unpacked bin/ directory
on your PATH
My question is what is PATH mean, what exactly they want me to do ?
Sometimes I see some /bin/path , $PATH, echo PATH
can someone explain the concept of the PATH , so I can setup everything
easily in the future without just blindly following the instructions?
im trying to setup a project , storm from git
https://github.com/nathanmarz/storm/wiki/Setting-up-development-environment
Download a Storm release , unpack it, and put the unpacked bin/ directory
on your PATH
My question is what is PATH mean, what exactly they want me to do ?
Sometimes I see some /bin/path , $PATH, echo PATH
can someone explain the concept of the PATH , so I can setup everything
easily in the future without just blindly following the instructions?
PHP shoutbox command with more than 1 parameter
PHP shoutbox command with more than 1 parameter
I am working on a shoutbox in PHP and Javascript. And I'm currently
working on commands.
I've made a ban system where it just works like this;
/ban *username*
But I'd like to make it more unique, and add duration of ban + reason. So
a command like this;
/tempban *username* *time* *reason*
But my problem is, I don't know how to get those 3 parameters, which I was
hoping you could help me.
Here is my preg_match for ban, maybe that will help.
if (preg_match("#^(/ban\s+?)#i", $message, $matches) &&
$this->can_do_admin())
I am working on a shoutbox in PHP and Javascript. And I'm currently
working on commands.
I've made a ban system where it just works like this;
/ban *username*
But I'd like to make it more unique, and add duration of ban + reason. So
a command like this;
/tempban *username* *time* *reason*
But my problem is, I don't know how to get those 3 parameters, which I was
hoping you could help me.
Here is my preg_match for ban, maybe that will help.
if (preg_match("#^(/ban\s+?)#i", $message, $matches) &&
$this->can_do_admin())
Magento simple product custom options price as product price
Magento simple product custom options price as product price
I have product with price 0 and custom options (100g,200g,300g etc.) with
prices 10$,20$... In the product catalog and product page displays zero
price, how to display cheapest option price? Thanks.
I have product with price 0 and custom options (100g,200g,300g etc.) with
prices 10$,20$... In the product catalog and product page displays zero
price, how to display cheapest option price? Thanks.
Proving $G\cong \Bbb{Z}_p$ if $|G|$ is prime.
Proving $G\cong \Bbb{Z}_p$ if $|G|$ is prime.
For a group $G$, if $|G|$ is prime, then I have to prove $G\cong \Bbb{Z}_p$.
Take any element $g\in G$. As $G$ cannot have proper subgroups, and as it
also has finite order, $|g|=p$. Hence, $G=\{1,g,g^2,\dots,g^{p-1}\}$. We
know $\Bbb{Z}_p=\{0,1,2,\dots,p-1\}$. Hence, $f:G\to\Bbb{Z}_p$ defined by
$f(g^r)=r$ for any $r\in\Bbb{Z}_p$ is a homomorphism.
If we can now prove that the kernel of this mapping is $\{1\}$, then we're
done. Clearly, $1$ is the only element that maps to $0$ in the above
homomorphism.
Is the above reasoning correct?
What are some other ways of proving isomorphism between the two groups? Is
proving that the kernel is composed of only one element the only way? I
read somewhere that if provided you have proven $f$ is a homomorphism, and
that $h$ is another mapping from $\Bbb{Z}_p$ to $G$, then proving $fg$ is
injective and $gf$ is surjective is sufficient to prove isomorphism. But
what are the properties of $g$?
For a group $G$, if $|G|$ is prime, then I have to prove $G\cong \Bbb{Z}_p$.
Take any element $g\in G$. As $G$ cannot have proper subgroups, and as it
also has finite order, $|g|=p$. Hence, $G=\{1,g,g^2,\dots,g^{p-1}\}$. We
know $\Bbb{Z}_p=\{0,1,2,\dots,p-1\}$. Hence, $f:G\to\Bbb{Z}_p$ defined by
$f(g^r)=r$ for any $r\in\Bbb{Z}_p$ is a homomorphism.
If we can now prove that the kernel of this mapping is $\{1\}$, then we're
done. Clearly, $1$ is the only element that maps to $0$ in the above
homomorphism.
Is the above reasoning correct?
What are some other ways of proving isomorphism between the two groups? Is
proving that the kernel is composed of only one element the only way? I
read somewhere that if provided you have proven $f$ is a homomorphism, and
that $h$ is another mapping from $\Bbb{Z}_p$ to $G$, then proving $fg$ is
injective and $gf$ is surjective is sufficient to prove isomorphism. But
what are the properties of $g$?
Thursday, August 22, 2013
Mahout "Inverse" Recommender
Mahout "Inverse" Recommender
With Mahout recommender (with Hadoop map reduce), the typical question is
"which movies this particular user may be interested in?". How do we
reverse that question and instead ask for "which users may be interested
in this particular movie"?
And eventually to take it one step further: "for this list of movies,
which users are the most suitable candidates?"
In reality this is not about movies, but to build a recommendation to pick
top candidates with resources/preferences that most suitably meet a
particular set of requirements.
Any thoughts how to solve this with Mahout, in particular using hadoop
map-reduce jobs?
With Mahout recommender (with Hadoop map reduce), the typical question is
"which movies this particular user may be interested in?". How do we
reverse that question and instead ask for "which users may be interested
in this particular movie"?
And eventually to take it one step further: "for this list of movies,
which users are the most suitable candidates?"
In reality this is not about movies, but to build a recommendation to pick
top candidates with resources/preferences that most suitably meet a
particular set of requirements.
Any thoughts how to solve this with Mahout, in particular using hadoop
map-reduce jobs?
Hook system power button in Windows
Hook system power button in Windows
Is it possible to hook the system power button under Windows XP & up, such
that my program would get the event before Windows initiates a
powerdown/sleep event (before PBT_APMQUERYSUSPEND gets sent out)?
Is it possible to hook the system power button under Windows XP & up, such
that my program would get the event before Windows initiates a
powerdown/sleep event (before PBT_APMQUERYSUSPEND gets sent out)?
Macbook pro 15" mid 2012 SSD problem
Macbook pro 15" mid 2012 SSD problem
I have MBP 15" mid 2012 i7 2.6ghz 16gb ram GT 650M 1GB. I installed OWC
Mercury EXTREME Pro 6G SSD in HDD bay's port. I ran blackmagic disk speed
test and got only 220 MB/s write speed and 460 MB/s read. Official website
says they have 527 MB/s write and 559 MB/s read. So i am far far away from
this. Anyone has idea where could be the problem?
I have MBP 15" mid 2012 i7 2.6ghz 16gb ram GT 650M 1GB. I installed OWC
Mercury EXTREME Pro 6G SSD in HDD bay's port. I ran blackmagic disk speed
test and got only 220 MB/s write speed and 460 MB/s read. Official website
says they have 527 MB/s write and 559 MB/s read. So i am far far away from
this. Anyone has idea where could be the problem?
How can i pass latitude and longtitude variables to create google map preview
How can i pass latitude and longtitude variables to create google map preview
I have created the following script and i need to pass the lat and long
variables to the url in order to create a google map preview. I need to
make the preview on window.open with a hybrid map, marker and define zoom.
<script type="text/javascript">
function geoPreview(lat,long) {
var elemA = document.getElementById("lat").value;
var elemB = document.getElementById("long").value;
window.open('http://maps.google.com/maps?q='+elemA+', '+elemB+');
}
</script>
Any help would be appreciated. Thanks.
I have created the following script and i need to pass the lat and long
variables to the url in order to create a google map preview. I need to
make the preview on window.open with a hybrid map, marker and define zoom.
<script type="text/javascript">
function geoPreview(lat,long) {
var elemA = document.getElementById("lat").value;
var elemB = document.getElementById("long").value;
window.open('http://maps.google.com/maps?q='+elemA+', '+elemB+');
}
</script>
Any help would be appreciated. Thanks.
How to check IIS log to find out any intruders hacked?
How to check IIS log to find out any intruders hacked?
I have a asp website.Is it possible to find from IIS Log that any thing
went wrong.hacked?etc
I have a asp website.Is it possible to find from IIS Log that any thing
went wrong.hacked?etc
Wednesday, August 21, 2013
Can't access domain shared folder by name but I can by ip
Can't access domain shared folder by name but I can by ip
I have server with windows server 2008 r2, router works as dhcp, after I
created domain on it, and created users, making clients access the network
via new users of domain then the computers work fine but after sometime
some of them cant access folder of domain server except by using it's ip,
sometime when I change the ip of the client then it's working fine but
after a while the problem comes again. appreciate your help.
I have server with windows server 2008 r2, router works as dhcp, after I
created domain on it, and created users, making clients access the network
via new users of domain then the computers work fine but after sometime
some of them cant access folder of domain server except by using it's ip,
sometime when I change the ip of the client then it's working fine but
after a while the problem comes again. appreciate your help.
Parallax background performance and behavior
Parallax background performance and behavior
So far I've created a horizontally-scrolling site that has parallax
effects on element background images (which are stretched to fit the size
of the viewport). I've used the Stellar.js library to achieve the effect;
$.stellar({
horizontalScrolling: true,
verticalScrolling: false,
horizontalOffset: $(window).width()
});
However, two problems I'm facing;
The images tend to 'run out' before the the element has fully disappeared;
showing the white background underneath. The severity of this effect
depends on the size and shape of the viewport, so I'm guessing trying to
figure out the math involved for image size, aspect ratio or the defined
scroll ratios isn't worth it. Is there a way to make the scroll ratio
"automatic" within Stellar, so that the background never 'runs out' (or is
there an alternative parallax library that does that)?
The performance of the effect is miserable regardless of browser and
machine. Removing background-size: cover seems to improve things somewhat,
but not "enough"; would using img elements improve the performance over
background images? It's a huge change and a messy way of doing it, but it
would be worth it if it fixes the laggy scrolling.
Thanks in advance!
So far I've created a horizontally-scrolling site that has parallax
effects on element background images (which are stretched to fit the size
of the viewport). I've used the Stellar.js library to achieve the effect;
$.stellar({
horizontalScrolling: true,
verticalScrolling: false,
horizontalOffset: $(window).width()
});
However, two problems I'm facing;
The images tend to 'run out' before the the element has fully disappeared;
showing the white background underneath. The severity of this effect
depends on the size and shape of the viewport, so I'm guessing trying to
figure out the math involved for image size, aspect ratio or the defined
scroll ratios isn't worth it. Is there a way to make the scroll ratio
"automatic" within Stellar, so that the background never 'runs out' (or is
there an alternative parallax library that does that)?
The performance of the effect is miserable regardless of browser and
machine. Removing background-size: cover seems to improve things somewhat,
but not "enough"; would using img elements improve the performance over
background images? It's a huge change and a messy way of doing it, but it
would be worth it if it fixes the laggy scrolling.
Thanks in advance!
add button to uitableviewcell and did not showed up
add button to uitableviewcell and did not showed up
I am adding a delete button to uitableviewcell at cellforrowatindexpath
but the button did not show up.
double deleteYOffset=10;
double deleteW=100;
double deleteH=100;
UIButton *deleteButton =[UIButton buttonWithType:UIButtonTypeCustom];
deleteButton.frame=CGRectMake(imageXoffset, deleteYOffset, deleteW,
deleteH);
UIImage *image = [UIImage imageNamed:@"Delete.png"];
[deleteButton setBackgroundColor:[UIColor greenColor]];
[deleteButton setImage:image forState:UIControlStateNormal];
[[cell contentView ]addSubview:deleteButton];
I am adding a delete button to uitableviewcell at cellforrowatindexpath
but the button did not show up.
double deleteYOffset=10;
double deleteW=100;
double deleteH=100;
UIButton *deleteButton =[UIButton buttonWithType:UIButtonTypeCustom];
deleteButton.frame=CGRectMake(imageXoffset, deleteYOffset, deleteW,
deleteH);
UIImage *image = [UIImage imageNamed:@"Delete.png"];
[deleteButton setBackgroundColor:[UIColor greenColor]];
[deleteButton setImage:image forState:UIControlStateNormal];
[[cell contentView ]addSubview:deleteButton];
13.04 Crash/Kernel Panic
13.04 Crash/Kernel Panic
I just installed Ubuntu 13.04 on my Studio 1749 after having used 12.04
without any problems. However, right after installation I get random
crashes/kernel panics with this screen...
http://postimg.org/image/yzgbw7i99/
I suspect this has to do something with my broadcom wireless card. Please,
any help is welcome.
I just installed Ubuntu 13.04 on my Studio 1749 after having used 12.04
without any problems. However, right after installation I get random
crashes/kernel panics with this screen...
http://postimg.org/image/yzgbw7i99/
I suspect this has to do something with my broadcom wireless card. Please,
any help is welcome.
Setting width for TD including border and padding - IE8 Quirks mode
Setting width for TD including border and padding - IE8 Quirks mode
I have complex table with variable cell padding and borders. I want to set
fixed width for some cells, that will include the border and padding for
each one.
Unfortunately I target IE8 Quirks mode so I can't use box-sizing. I also
cannot use "table-layout: fixed", so answers in this direction will not
help.
I think that I can reduce the problem to this simple case, and maybe the
solution will help me in the general case:
<style>
td.td1 { width: 190px; border:10px; padding :10px; }
td.td2 { width: auto; }
</style>
<table style="width:100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="td1">cell 1</td>
<td class="td2">cell 2</td>
</tr>
</table>
td1 has width 210 instead of 190 as desired.
I have complex table with variable cell padding and borders. I want to set
fixed width for some cells, that will include the border and padding for
each one.
Unfortunately I target IE8 Quirks mode so I can't use box-sizing. I also
cannot use "table-layout: fixed", so answers in this direction will not
help.
I think that I can reduce the problem to this simple case, and maybe the
solution will help me in the general case:
<style>
td.td1 { width: 190px; border:10px; padding :10px; }
td.td2 { width: auto; }
</style>
<table style="width:100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="td1">cell 1</td>
<td class="td2">cell 2</td>
</tr>
</table>
td1 has width 210 instead of 190 as desired.
SQL data to XML
SQL data to XML
i want save data from sql database to xml. I have this code:
SqlConnection con = new SqlConnection("Data Source=*****;Persist Security
Info=True;User ID=****;Password=*******;");
string strSQL = "Select * from DATABAZE WHERE (KOD_ZBOZI
='1047')";
SqlDataAdapter dt = new SqlDataAdapter(strSQL, con);
DataSet ds = new DataSet();
dt.Fill(ds, "DATABAZE");
ds.WriteXml(Server.MapPath("C:\\Users\\Lukas\\Desktop\\NOHEL.xml"));
But i have this error:
The name 'Server' does not exist in the current context
Have you any idea?
i want save data from sql database to xml. I have this code:
SqlConnection con = new SqlConnection("Data Source=*****;Persist Security
Info=True;User ID=****;Password=*******;");
string strSQL = "Select * from DATABAZE WHERE (KOD_ZBOZI
='1047')";
SqlDataAdapter dt = new SqlDataAdapter(strSQL, con);
DataSet ds = new DataSet();
dt.Fill(ds, "DATABAZE");
ds.WriteXml(Server.MapPath("C:\\Users\\Lukas\\Desktop\\NOHEL.xml"));
But i have this error:
The name 'Server' does not exist in the current context
Have you any idea?
Tuesday, August 20, 2013
What's wrong with this JSONP request
What's wrong with this JSONP request
I've trying to build profanity filtering api. The response of api is
coming in JSON. I'm using following codes to access the api. But, it's
showing some error which i can't able to fig out.
Here is my code..
$.ajax({
dataType: 'jsonp',
jsonp: 'callback',
url:
'http://www.employeeexperts.com/Profanity/index.php/rest/check/Good
Morning',
success: function(data) {
console.log('success');
console.log(JSON.stringify(data));
},
error: function (header, status, error) {
console.log('ajax answer post returned error ' + header +
' ' + status + ' ' + error);
}
});
Regards
I've trying to build profanity filtering api. The response of api is
coming in JSON. I'm using following codes to access the api. But, it's
showing some error which i can't able to fig out.
Here is my code..
$.ajax({
dataType: 'jsonp',
jsonp: 'callback',
url:
'http://www.employeeexperts.com/Profanity/index.php/rest/check/Good
Morning',
success: function(data) {
console.log('success');
console.log(JSON.stringify(data));
},
error: function (header, status, error) {
console.log('ajax answer post returned error ' + header +
' ' + status + ' ' + error);
}
});
Regards
What does this awk sentence mean?
What does this awk sentence mean?
I have the following sentence in awk
$ gawk '$2 == "-" { print $1 }' file
I was wondering what thing this instruction exactly did because I can't
parse exactly the words I need.
Thanks for your time and response!
I have the following sentence in awk
$ gawk '$2 == "-" { print $1 }' file
I was wondering what thing this instruction exactly did because I can't
parse exactly the words I need.
Thanks for your time and response!
merge-like scenario with two data.tables
merge-like scenario with two data.tables
I have two dataframes (actually data.tables).
set.seed(123)
dt1 <- data.table(P=rep(letters[1:3],each=c(4,2,3),X=sample(9))
dt1
P X
1: a 3
2: a 7
3: a 9
4: a 6
5: b 5
6: b 1
7: c 2
8: c 8
9: c 4
and:
dt2 <- data.table(P=rep[letters[1:5],length=10,D=c("X","Y","Z","G","F"))
dt2
P D
1: a X
2: b Y
3: c Z
4: d G
5: e F
6: a X
7: b Y
8: c Z
9: d G
10: e F
Now I want to add a new column to dt1, with column "D" of dt2 where P has
the same value in dt1 and dt2. It should look like this:
dt_new
P X D
1: a 3 X
2: a 7 X
3: a 9 X
4: a 6 X
5: b 5 Y
6: b 1 Y
7: c 2 Z
8: c 8 Z
9: c 4 Z
I have two dataframes (actually data.tables).
set.seed(123)
dt1 <- data.table(P=rep(letters[1:3],each=c(4,2,3),X=sample(9))
dt1
P X
1: a 3
2: a 7
3: a 9
4: a 6
5: b 5
6: b 1
7: c 2
8: c 8
9: c 4
and:
dt2 <- data.table(P=rep[letters[1:5],length=10,D=c("X","Y","Z","G","F"))
dt2
P D
1: a X
2: b Y
3: c Z
4: d G
5: e F
6: a X
7: b Y
8: c Z
9: d G
10: e F
Now I want to add a new column to dt1, with column "D" of dt2 where P has
the same value in dt1 and dt2. It should look like this:
dt_new
P X D
1: a 3 X
2: a 7 X
3: a 9 X
4: a 6 X
5: b 5 Y
6: b 1 Y
7: c 2 Z
8: c 8 Z
9: c 4 Z
reading images from memory card
reading images from memory card
This code reads images from DRAWABLE folder of android :
import android.widget.ImageView;
import android.widget.ZoomControls;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.os.Bundle;
import android.util.FloatMath;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
public class info extends Activity {
Bitmap bmp = BitmapFactory.decodeFile("sdcard/THQ/Para01/page1.jpg");
ImageView img;
Matrix matrix = new Matrix();
Matrix savedMatrix = new Matrix();
PointF startPoint = new PointF();
PointF midPoint = new PointF();
float oldDist = 1f;
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
// img.setImageBitmap(bmp);
private int imCurrentPhotoIndex = 0;
private int[] imPhotoIds = new int[] { R.drawable.info, R.drawable.info1,
R.drawable.info2, R.drawable.info3, R.drawable.info4,
R.drawable.info5, R.drawable.info6 };
Button ibd1, ibd2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// fullscreen starts
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// fullscreen code ends
//img.setb
setContentView(R.layout.info);
showPhoto(imCurrentPhotoIndex);
ibd1 = (Button) findViewById(R.id.next);
ibd2 = (Button) findViewById(R.id.prev);
ibd1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
imCurrentPhotoIndex++;
if (imCurrentPhotoIndex < 7)
showPhoto(imCurrentPhotoIndex);
else
imCurrentPhotoIndex--;
// ///
}
});
ibd2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
imCurrentPhotoIndex--;
if (imCurrentPhotoIndex > -1)
showPhoto(imCurrentPhotoIndex);
else
imCurrentPhotoIndex++;
// ///
}
});
}
protected void onSaveInstanceState(Bundle outState) {
outState.putInt("photo_index", imCurrentPhotoIndex);
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
imCurrentPhotoIndex = savedInstanceState.getInt("photo_index");
showPhoto(imCurrentPhotoIndex);
super.onRestoreInstanceState(savedInstanceState);
}
private void showPhoto(int photoIndex) {
ImageView imageView = (ImageView) findViewById(R.id.image_view);
// imageView.setImageResource(imPhotoIds[photoIndex]);
imageView.setImageResource(imPhotoIds[photoIndex]);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
// getMenuInflater().inflate(R.menu.starting_point, menu);
return true;
}
}
Could you help me please to make it read and display image from folder
"sdcard\THQ\something.png" .
This code reads images from DRAWABLE folder of android :
import android.widget.ImageView;
import android.widget.ZoomControls;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.os.Bundle;
import android.util.FloatMath;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
public class info extends Activity {
Bitmap bmp = BitmapFactory.decodeFile("sdcard/THQ/Para01/page1.jpg");
ImageView img;
Matrix matrix = new Matrix();
Matrix savedMatrix = new Matrix();
PointF startPoint = new PointF();
PointF midPoint = new PointF();
float oldDist = 1f;
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
// img.setImageBitmap(bmp);
private int imCurrentPhotoIndex = 0;
private int[] imPhotoIds = new int[] { R.drawable.info, R.drawable.info1,
R.drawable.info2, R.drawable.info3, R.drawable.info4,
R.drawable.info5, R.drawable.info6 };
Button ibd1, ibd2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// fullscreen starts
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// fullscreen code ends
//img.setb
setContentView(R.layout.info);
showPhoto(imCurrentPhotoIndex);
ibd1 = (Button) findViewById(R.id.next);
ibd2 = (Button) findViewById(R.id.prev);
ibd1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
imCurrentPhotoIndex++;
if (imCurrentPhotoIndex < 7)
showPhoto(imCurrentPhotoIndex);
else
imCurrentPhotoIndex--;
// ///
}
});
ibd2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
imCurrentPhotoIndex--;
if (imCurrentPhotoIndex > -1)
showPhoto(imCurrentPhotoIndex);
else
imCurrentPhotoIndex++;
// ///
}
});
}
protected void onSaveInstanceState(Bundle outState) {
outState.putInt("photo_index", imCurrentPhotoIndex);
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
imCurrentPhotoIndex = savedInstanceState.getInt("photo_index");
showPhoto(imCurrentPhotoIndex);
super.onRestoreInstanceState(savedInstanceState);
}
private void showPhoto(int photoIndex) {
ImageView imageView = (ImageView) findViewById(R.id.image_view);
// imageView.setImageResource(imPhotoIds[photoIndex]);
imageView.setImageResource(imPhotoIds[photoIndex]);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
// getMenuInflater().inflate(R.menu.starting_point, menu);
return true;
}
}
Could you help me please to make it read and display image from folder
"sdcard\THQ\something.png" .
Resources for PSTricks examples
Resources for PSTricks examples
What resources for PSTricks examples do you know? Please feel free to add
nice work of your own here as well!
Background: I am constantly looking for PSTricks examples to get ideas how
to solve my problems, how to visualize things or what possibilities I have
using PSTricks.
What resources for PSTricks examples do you know? Please feel free to add
nice work of your own here as well!
Background: I am constantly looking for PSTricks examples to get ideas how
to solve my problems, how to visualize things or what possibilities I have
using PSTricks.
Default value on Left
Default value on Left
I make a call to external function and in return have several Either. Say
I have
val a = Right("hey")
val b = Right(2)
val c = Left("oops") .....
for{
x <- a.right
y <- b.right
z <- c.right
} yield(User(x,y,z))
But say, if z is a Left as above. Then I wish to give it a default String.
i.e. by
for{
x <- a.right
y <- b.right
z <- c.right.getOrElse(Right("default String")).right
} yield(User(x,y,z))
How can I reduce this: c.right.getOrElse(Right("default String")).right.
It is dirty. c.right.getOrElse("default") will not work as a map on String
returns IndexedSeq.
I make a call to external function and in return have several Either. Say
I have
val a = Right("hey")
val b = Right(2)
val c = Left("oops") .....
for{
x <- a.right
y <- b.right
z <- c.right
} yield(User(x,y,z))
But say, if z is a Left as above. Then I wish to give it a default String.
i.e. by
for{
x <- a.right
y <- b.right
z <- c.right.getOrElse(Right("default String")).right
} yield(User(x,y,z))
How can I reduce this: c.right.getOrElse(Right("default String")).right.
It is dirty. c.right.getOrElse("default") will not work as a map on String
returns IndexedSeq.
Monday, August 19, 2013
How to install java7 version to Run an applet in web broswer
How to install java7 version to Run an applet in web broswer
I am running an applet program in my browser.When i am running that applet
the browser is asking to me install java7.And then i am redirecting to
THIS LINK.When i download java and install the applet is working fine.When
i install i got only jre only.I did not get jdk.
My Question is:
I heard one thing previously.Browser contains java.So if it is correct
,Why i need to install java7 in my system.Only browser need java7
version.Is there any possibility to install in browser only.
Thanks in advance...
I am running an applet program in my browser.When i am running that applet
the browser is asking to me install java7.And then i am redirecting to
THIS LINK.When i download java and install the applet is working fine.When
i install i got only jre only.I did not get jdk.
My Question is:
I heard one thing previously.Browser contains java.So if it is correct
,Why i need to install java7 in my system.Only browser need java7
version.Is there any possibility to install in browser only.
Thanks in advance...
Make AJAX requests between an ASP.NET Azure hosted Web Site and Web Role?
Make AJAX requests between an ASP.NET Azure hosted Web Site and Web Role?
I have a C# ASP.NET/MVC Web Role that is hosted on Azure. I want it to
service one or more Azure hosted web sites as an API provider available
via AJAX calls. Normally making AJAX requests from two different web
locations violates the browser cross site security restrictions. But I'm
wondering if there is a procedure or a set of steps I can take to
configure my Webs Sites and Web Role that would avoid violating the
browser security restrictions? The Web Sites and Web Role are all under my
control and all running under the same Azure account, so perhaps there are
things I can do to mitigate this restriction?
I have a C# ASP.NET/MVC Web Role that is hosted on Azure. I want it to
service one or more Azure hosted web sites as an API provider available
via AJAX calls. Normally making AJAX requests from two different web
locations violates the browser cross site security restrictions. But I'm
wondering if there is a procedure or a set of steps I can take to
configure my Webs Sites and Web Role that would avoid violating the
browser security restrictions? The Web Sites and Web Role are all under my
control and all running under the same Azure account, so perhaps there are
things I can do to mitigate this restriction?
idangero swiper working in a angular directive
idangero swiper working in a angular directive
How would I initialize an idangero swiper library inside a angular js
directive.
Especially when the directive has the panes created with a ng-repeat
swiper lib: http://www.idangero.us/sliders/swiper/api.php
How would I initialize an idangero swiper library inside a angular js
directive.
Especially when the directive has the panes created with a ng-repeat
swiper lib: http://www.idangero.us/sliders/swiper/api.php
JavaScript true condition doesn't execute
JavaScript true condition doesn't execute
Here is my code:
sessionStorage.loggedIn = true;
if (sessionStorage.loggedIn) {
alert('true');
}
else {
alert('false');
}
Simple enough. There must be some small thing I'm not understanding about
how JavaScript is evaluating these expressions. When I put
sessionStorage.loggedIn = false, the "false" alert shows correctly.
However, when I change sessionStorage.loggedIn to true, the "false" alert
still pops, even after clearing the session. What am I not getting right
with this expression? It seems so simple, maybe I just need another pair
of eyes on it.
Here is my code:
sessionStorage.loggedIn = true;
if (sessionStorage.loggedIn) {
alert('true');
}
else {
alert('false');
}
Simple enough. There must be some small thing I'm not understanding about
how JavaScript is evaluating these expressions. When I put
sessionStorage.loggedIn = false, the "false" alert shows correctly.
However, when I change sessionStorage.loggedIn to true, the "false" alert
still pops, even after clearing the session. What am I not getting right
with this expression? It seems so simple, maybe I just need another pair
of eyes on it.
Adding a Table Border
Adding a Table Border
Hey everyone this may have been a idiots mistake but I have Googled and
attempted all ideas (most likely in the wrong place in my code) but I can
not seem to find out the code/shortcut/MAGIC_TRICK to provided my table
with a border/boxed
<Table bored = "5" cellpadding ="5px" >
<tr>
<td>"sentence" <td/> <td><input type="radio" name="question7"
value="0"<td/><br/><br/>
<tr/>
<tr>
<td>"sentence."<td/> <td> <input type="radio" name="question7"
value="0"<td/> <br/><br/>
<tr/>
<table/>
this is just a small part of if but it is displayed just without lines, so
there is no clear table in place. any help would be great
thank you very much Jordan.
Hey everyone this may have been a idiots mistake but I have Googled and
attempted all ideas (most likely in the wrong place in my code) but I can
not seem to find out the code/shortcut/MAGIC_TRICK to provided my table
with a border/boxed
<Table bored = "5" cellpadding ="5px" >
<tr>
<td>"sentence" <td/> <td><input type="radio" name="question7"
value="0"<td/><br/><br/>
<tr/>
<tr>
<td>"sentence."<td/> <td> <input type="radio" name="question7"
value="0"<td/> <br/><br/>
<tr/>
<table/>
this is just a small part of if but it is displayed just without lines, so
there is no clear table in place. any help would be great
thank you very much Jordan.
Sunday, August 18, 2013
How can I suppress Google's API warning when using ggmap with knitr?
How can I suppress Google's API warning when using ggmap with knitr?
How can I suppress Google's messages when using ggmap with a knitr .Rnw
file? Here is code to generate a pdf from .Rnw:
\documentclass{article}
\begin{document}
<<>>=
library(ggmap)
qmap("empire state building", zoom = 15, messaging = FALSE, source =
"google")
@
\end{document}
In the resulting .pdf, the following poorly formatted messages appear:
Map from URL :
http://maps.googleapis.com/maps/api/staticmap?center=empire+state+building&zoom=15&size=%20640x640&scale=%202&maptype=terrain&sensor=false
Google Maps API Terms of Service : http://developers.google.com/maps/terms
Information from URL :
http://maps.googleapis.com/maps/api/geocode/json?address=empire+state+building&sensor=false
Google Maps API Terms of Service : http://developers.google.com/maps/terms
Can this be suppressed (was hoping messaging = FALSE would do this) or at
least formatted so the warnings don't run off the page? Thank you.
How can I suppress Google's messages when using ggmap with a knitr .Rnw
file? Here is code to generate a pdf from .Rnw:
\documentclass{article}
\begin{document}
<<>>=
library(ggmap)
qmap("empire state building", zoom = 15, messaging = FALSE, source =
"google")
@
\end{document}
In the resulting .pdf, the following poorly formatted messages appear:
Map from URL :
http://maps.googleapis.com/maps/api/staticmap?center=empire+state+building&zoom=15&size=%20640x640&scale=%202&maptype=terrain&sensor=false
Google Maps API Terms of Service : http://developers.google.com/maps/terms
Information from URL :
http://maps.googleapis.com/maps/api/geocode/json?address=empire+state+building&sensor=false
Google Maps API Terms of Service : http://developers.google.com/maps/terms
Can this be suppressed (was hoping messaging = FALSE would do this) or at
least formatted so the warnings don't run off the page? Thank you.
Energy Efficient Data Centers
Energy Efficient Data Centers
The energy consumption of data centers continuously increased during last
years. Between 2000 and 2010 the world-wide energy consumption of data
centers tripled as shown in studies of the Environmental Protection
Agency. Whats the best method for energy efficiency on data centers? The
natural way to reduce energy costs is to improve energy eciency, so that
the same amount of computational work can be done with less energy. Also
there are a lot of method for reduce energy consumption on data centers
e.g. Proactively Control of Air-Conditioners, becuase about 50% of energy
was consumed in data centers by Air-Conditioners. Another way to reduce
energy costs based on reducing energy on IT's infrastructures and
equipments e.g. Migration, Virtual Machine, and Dispatching jobs to
servers and turn off idel servers. But, what do you think? what's your
idea about this important concern?/p
The energy consumption of data centers continuously increased during last
years. Between 2000 and 2010 the world-wide energy consumption of data
centers tripled as shown in studies of the Environmental Protection
Agency. Whats the best method for energy efficiency on data centers? The
natural way to reduce energy costs is to improve energy eciency, so that
the same amount of computational work can be done with less energy. Also
there are a lot of method for reduce energy consumption on data centers
e.g. Proactively Control of Air-Conditioners, becuase about 50% of energy
was consumed in data centers by Air-Conditioners. Another way to reduce
energy costs based on reducing energy on IT's infrastructures and
equipments e.g. Migration, Virtual Machine, and Dispatching jobs to
servers and turn off idel servers. But, what do you think? what's your
idea about this important concern?/p
how to remove children in cocos2d, is there more that one way?
how to remove children in cocos2d, is there more that one way?
Hello I am making a Cocos2d side scroller. I have a CCSprite that I add
using the [self addChild:sprite]; method. After a while I want the
CCSprite to be removed. I tried the [self removeChild:sprite cleanup:YES];
method and it gave me a thread bad access error. Is this the only way to
remove a child in Cocos2d?? Is there an alternate way?? I am a beginner to
Cocos2d and objective c so any help is valuable.
Hello I am making a Cocos2d side scroller. I have a CCSprite that I add
using the [self addChild:sprite]; method. After a while I want the
CCSprite to be removed. I tried the [self removeChild:sprite cleanup:YES];
method and it gave me a thread bad access error. Is this the only way to
remove a child in Cocos2d?? Is there an alternate way?? I am a beginner to
Cocos2d and objective c so any help is valuable.
Java: Game modding, instanceof
Java: Game modding, instanceof
I'm making a "forcefield" for a game called Minecraft. What I commented on
is what I need help with.
if (Camb.killaura)
{
nchitDelay++;
for(Object o: mc.theWorld.loadedEntityList){
Entity e = (Entity)o;
if(e != this && e instanceof EntitySkeleton || e instanceof
EntityCow && getDistanceToEntity(e) <= killauraRange &&
mc.thePlayer.canEntityBeSeen(e)
&&!Camb.friend.contains(e.getEntityName())){ // checking if the
entity is either a skeleton or cow
if(e.isEntityAlive()){
if(nchitDelay >= 8){
if(Camb.auraaimbot){
facetoEntity(e); // facing the skeleton from an infinite distance.
}
if(Camb.criticals){
if(mc.thePlayer.isSprinting()==false){
if(mc.thePlayer.isJumping==false){
if(mc.thePlayer.onGround){
mc.thePlayer.jump();
}
}
}
}
Minecraft.SwitchToSword(mc.thePlayer.inventory.currentItem);
swingItem();
mc.playerController.attackEntity(this, e);
nchitDelay = 0;
break;
}
}
}
}
}
}
So, the idea is if a skeleton or cow enters the distance(4 blocks), then
it will face it and attack it. Everything is working, but the player is
facing the skeleton from any distance. Not just 4 blocks. How do I fix
this?
Thanks
I'm making a "forcefield" for a game called Minecraft. What I commented on
is what I need help with.
if (Camb.killaura)
{
nchitDelay++;
for(Object o: mc.theWorld.loadedEntityList){
Entity e = (Entity)o;
if(e != this && e instanceof EntitySkeleton || e instanceof
EntityCow && getDistanceToEntity(e) <= killauraRange &&
mc.thePlayer.canEntityBeSeen(e)
&&!Camb.friend.contains(e.getEntityName())){ // checking if the
entity is either a skeleton or cow
if(e.isEntityAlive()){
if(nchitDelay >= 8){
if(Camb.auraaimbot){
facetoEntity(e); // facing the skeleton from an infinite distance.
}
if(Camb.criticals){
if(mc.thePlayer.isSprinting()==false){
if(mc.thePlayer.isJumping==false){
if(mc.thePlayer.onGround){
mc.thePlayer.jump();
}
}
}
}
Minecraft.SwitchToSword(mc.thePlayer.inventory.currentItem);
swingItem();
mc.playerController.attackEntity(this, e);
nchitDelay = 0;
break;
}
}
}
}
}
}
So, the idea is if a skeleton or cow enters the distance(4 blocks), then
it will face it and attack it. Everything is working, but the player is
facing the skeleton from any distance. Not just 4 blocks. How do I fix
this?
Thanks
Upload is slow via curl and fast via Browser
Upload is slow via curl and fast via Browser
I'm using curl to upload backups of my files to a server as a post
request. The request is up to 10X slower than sending the same file via
the browser, how is this possible? The Files are between 500MB and 4GB,
one file per request. Here is the request:
$file = realpath("500MB.rar");
$postfields[] = "@".$file;
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$return = curl_exec($ch);
I'm using WAMP on Windows Server 2008 (PHP 5.3.13), I've also tried it
with XAMPP and with IIS, but it is always slow. It is not limited by the
network connection, curl is able to upload with 100% of the network
connection, but only if the server I'm trying to upload to is significant
faster. So the speed is limited by the remote server but it never reaches
the possible speed of the remote server. Like curl would be set up to only
use 10% of the possible speed. This is really strange IMO. Is it because
it always reads from the HDD? Is there a way to buffer the file? Is there
any other solution?
I can't use FTP since the remote server is a regular Filehosting service.
Thanks for any help or tips in advance.
I'm using curl to upload backups of my files to a server as a post
request. The request is up to 10X slower than sending the same file via
the browser, how is this possible? The Files are between 500MB and 4GB,
one file per request. Here is the request:
$file = realpath("500MB.rar");
$postfields[] = "@".$file;
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$return = curl_exec($ch);
I'm using WAMP on Windows Server 2008 (PHP 5.3.13), I've also tried it
with XAMPP and with IIS, but it is always slow. It is not limited by the
network connection, curl is able to upload with 100% of the network
connection, but only if the server I'm trying to upload to is significant
faster. So the speed is limited by the remote server but it never reaches
the possible speed of the remote server. Like curl would be set up to only
use 10% of the possible speed. This is really strange IMO. Is it because
it always reads from the HDD? Is there a way to buffer the file? Is there
any other solution?
I can't use FTP since the remote server is a regular Filehosting service.
Thanks for any help or tips in advance.
Binding the same renderbuffer to multiple FBOs
Binding the same renderbuffer to multiple FBOs
My opengl scene has two passes - one which renders the entire scene (color
and depth) and a second which renders only some scene objects, which needs
the depth buffer from the first pass.
Is it possible to use two framebuffer objects FBO1 and FBO2, and to bind
the same depth renderbuffer to both of them? A pseudo-code for that would
be:
// ---------- Initialization ---------- // create 'FBO1' // create render
buffer 'RB' // bind RB to FBO1 // bind TEXTURE1 to FBO1 for color
rendering
// create FBO2 // bind RB to FBO2 // bind TEXTURE2 to FBO2 for color
rendering
// ---------- Rendering frame---------- // bind FBO1 // render entire
scene with depth writing enabled // bind FB2 // render some objects again
with depth mask GL_EQUAL
The result should be that TEXTURE2 contains only those parts of the
objects which are not occluded by other objects rendered in the first
pass.
My opengl scene has two passes - one which renders the entire scene (color
and depth) and a second which renders only some scene objects, which needs
the depth buffer from the first pass.
Is it possible to use two framebuffer objects FBO1 and FBO2, and to bind
the same depth renderbuffer to both of them? A pseudo-code for that would
be:
// ---------- Initialization ---------- // create 'FBO1' // create render
buffer 'RB' // bind RB to FBO1 // bind TEXTURE1 to FBO1 for color
rendering
// create FBO2 // bind RB to FBO2 // bind TEXTURE2 to FBO2 for color
rendering
// ---------- Rendering frame---------- // bind FBO1 // render entire
scene with depth writing enabled // bind FB2 // render some objects again
with depth mask GL_EQUAL
The result should be that TEXTURE2 contains only those parts of the
objects which are not occluded by other objects rendered in the first
pass.
Unable to show BindingMode Enum in comboBox (WPF)
Unable to show BindingMode Enum in comboBox (WPF)
I'm trying to show the original BindingMode enum in a comboBox (the list
of TwoWay`OneWay` etc.).
In the XAML file, inside Resources I need to set ObjectDataProvider to be
the type of BindingMode:
<!--BindingMode combo box-->
<ObjectDataProvider x:Key="BindingMode" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="sys:BindingMode"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
The problem is that I can't include System.Windows.Data in 'xmlns', i've
tried to declare:
xmlns:sysWinData="clr-namespace:System.Windows.Data;assembly=mscorlib"
but it won't work. What am I missng here? Thanks.
I'm trying to show the original BindingMode enum in a comboBox (the list
of TwoWay`OneWay` etc.).
In the XAML file, inside Resources I need to set ObjectDataProvider to be
the type of BindingMode:
<!--BindingMode combo box-->
<ObjectDataProvider x:Key="BindingMode" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="sys:BindingMode"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
The problem is that I can't include System.Windows.Data in 'xmlns', i've
tried to declare:
xmlns:sysWinData="clr-namespace:System.Windows.Data;assembly=mscorlib"
but it won't work. What am I missng here? Thanks.
Saturday, August 17, 2013
500 error on any new created php files
500 error on any new created php files
I'm getting a 500 internal server error on any new php files that I create
on my server.
So even if they are blank or have something simple such as
<?php
echo "foo";
?>
They will still error.
I have created and successfully received .html files and am still able to
get all my old php files, I just can't get any more that I create.
Why would it do this, is there some sort of limit on how many php files I
can have on my server?
I'm getting a 500 internal server error on any new php files that I create
on my server.
So even if they are blank or have something simple such as
<?php
echo "foo";
?>
They will still error.
I have created and successfully received .html files and am still able to
get all my old php files, I just can't get any more that I create.
Why would it do this, is there some sort of limit on how many php files I
can have on my server?
How can I make Grails 2.2 "run-app" detect changes to UrlMappings.groovy?
How can I make Grails 2.2 "run-app" detect changes to UrlMappings.groovy?
When I invoke run-app in the Grails console, code changes are
auto-detected, and a recompile is triggered.
But when I change conf/UrlMappings.groovy, even though I see "Compiling 1
source files" appear in the console, the live web server doesn't, in fact,
update its behavior.
The problem appears specific to UrlMappings.groovy; for example, I can
make changes to a controller class and they appear automatically when I
hit "refresh" in the browser.
Any thoughts on what's causing this behavior and how I can fix it?
Thanks!
When I invoke run-app in the Grails console, code changes are
auto-detected, and a recompile is triggered.
But when I change conf/UrlMappings.groovy, even though I see "Compiling 1
source files" appear in the console, the live web server doesn't, in fact,
update its behavior.
The problem appears specific to UrlMappings.groovy; for example, I can
make changes to a controller class and they appear automatically when I
hit "refresh" in the browser.
Any thoughts on what's causing this behavior and how I can fix it?
Thanks!
Continuity of generalized mean functions
Continuity of generalized mean functions
I'm studying generalized mean functions, and somewhere I found that a
weighted mean function could be defined as $M: (0,\infty)^n \rightarrow
(0,\infty)$ with the properties:
Fixed Point : $M(1,1,\dotsc,1) = 1$
Homogeneity : $M(\lambda x_1, \dotsc, \lambda x_n) = \lambda M(x_1,
\dotsc, x_n)$
Monotonicity : if $x_i \leq y_i$ for each $i$ then $M(x_1,\dotsc, x_n)
\leq M(y_1, \dotsc, y_n)$
This imply some of the properties expected for mean functions, such
boundedness: $\min\{x_i\} \leq M(x_i) \leq \max\{x_i\}$ and continuity.
Though, I was unable to find a proof for continuity. I'm familiar with
real analysis, but not in $\mathbb{R}^n$.
I tried to find a counterexample of such function, only to fail again. The
non-homogeneous functions that would serve as counterexample fail to be
monotonic or to be positive.
I'm studying generalized mean functions, and somewhere I found that a
weighted mean function could be defined as $M: (0,\infty)^n \rightarrow
(0,\infty)$ with the properties:
Fixed Point : $M(1,1,\dotsc,1) = 1$
Homogeneity : $M(\lambda x_1, \dotsc, \lambda x_n) = \lambda M(x_1,
\dotsc, x_n)$
Monotonicity : if $x_i \leq y_i$ for each $i$ then $M(x_1,\dotsc, x_n)
\leq M(y_1, \dotsc, y_n)$
This imply some of the properties expected for mean functions, such
boundedness: $\min\{x_i\} \leq M(x_i) \leq \max\{x_i\}$ and continuity.
Though, I was unable to find a proof for continuity. I'm familiar with
real analysis, but not in $\mathbb{R}^n$.
I tried to find a counterexample of such function, only to fail again. The
non-homogeneous functions that would serve as counterexample fail to be
monotonic or to be positive.
How to capture a photo from the camera without intent
How to capture a photo from the camera without intent
I want my app to be able to capture photos without using another
application. The code i used :
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = null;
try
{
photo = this.createTemporaryFile("picture", ".jpg");
photo.delete();
}
catch(Exception e)
{
Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_LONG).show();
}
mImageUri = Uri.fromFile(photo);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri);
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
But this code uses the phone's main camera app. Can anyone give me some
code ?
I want my app to be able to capture photos without using another
application. The code i used :
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = null;
try
{
photo = this.createTemporaryFile("picture", ".jpg");
photo.delete();
}
catch(Exception e)
{
Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_LONG).show();
}
mImageUri = Uri.fromFile(photo);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri);
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
But this code uses the phone's main camera app. Can anyone give me some
code ?
Prove: $f(x)^{p^k}\equiv f\left(x^{p^k}\right)\bmod p$
Prove: $f(x)^{p^k}\equiv f\left(x^{p^k}\right)\bmod p$
$p$ is a prime number, $k$ is an positive integer.
Prove: $f(x)^{p^k}\equiv f\left(x^{p^k}\right)\bmod p$
$p$ is a prime number, $k$ is an positive integer.
Prove: $f(x)^{p^k}\equiv f\left(x^{p^k}\right)\bmod p$
How to collect MySQL base path using JPQL?
How to collect MySQL base path using JPQL?
I am trying to make a simple Java application on windows-7 that can
database backup from mysql. I need mysql base path . I tried using JPQL
that is
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("BackupRestoreMysqlDatabasePU");
EntityManager em = emf.createEntityManager();
String path = em.createQuery("SELECT
@@basedir").getSingleResult().toString();
System.out.println("My Database Path::" + path);
When I run it, show following error:
Exception in thread "main" java.lang.IllegalArgumentException: An
exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing [SELECT @@basedir].
[16, 16] A select statement must have a FROM clause.
[7, 16] The identification variable '@@basedir' is not following the
rules for a Java identifier.
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1585)
atJava Result: 1
Please help me.
I am trying to make a simple Java application on windows-7 that can
database backup from mysql. I need mysql base path . I tried using JPQL
that is
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("BackupRestoreMysqlDatabasePU");
EntityManager em = emf.createEntityManager();
String path = em.createQuery("SELECT
@@basedir").getSingleResult().toString();
System.out.println("My Database Path::" + path);
When I run it, show following error:
Exception in thread "main" java.lang.IllegalArgumentException: An
exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing [SELECT @@basedir].
[16, 16] A select statement must have a FROM clause.
[7, 16] The identification variable '@@basedir' is not following the
rules for a Java identifier.
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1585)
atJava Result: 1
Please help me.
Counting up when saving
Counting up when saving
I am saving an image however it is just duplicating itself since I only
set only one name however I want it to count up so that it wont replace
itself. Is there any way to do this?
NSArray *directoryNames = [NSArray
arrayWithObjects:@"hats",@"bottoms",@"right",@"left",nil];
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get
documents folder
for (int i = 0; i < [directoryNames count] ; i++) {
NSString *dataPath = [documentsDirectory
stringByAppendingPathComponent:[directoryNames objectAtIndex:i]];
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath
withIntermediateDirectories:NO attributes:nil error:nil];
//Create folder
NSString *folderPath = [documentsDirectory
stringByAppendingPathComponent:@"hats"]; // "right" is at index 2,
per comments & code
NSString *filePath = [folderPath
stringByAppendingPathComponent:@"hats.PNG"]; // you maybe want to
incorporate a timestamp into the name to avoid duplicates
NSData *imageData = UIImagePNGRepresentation(captureImage.image);
[imageData writeToFile:filePath atomically:YES];
}
I am saving an image however it is just duplicating itself since I only
set only one name however I want it to count up so that it wont replace
itself. Is there any way to do this?
NSArray *directoryNames = [NSArray
arrayWithObjects:@"hats",@"bottoms",@"right",@"left",nil];
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get
documents folder
for (int i = 0; i < [directoryNames count] ; i++) {
NSString *dataPath = [documentsDirectory
stringByAppendingPathComponent:[directoryNames objectAtIndex:i]];
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath
withIntermediateDirectories:NO attributes:nil error:nil];
//Create folder
NSString *folderPath = [documentsDirectory
stringByAppendingPathComponent:@"hats"]; // "right" is at index 2,
per comments & code
NSString *filePath = [folderPath
stringByAppendingPathComponent:@"hats.PNG"]; // you maybe want to
incorporate a timestamp into the name to avoid duplicates
NSData *imageData = UIImagePNGRepresentation(captureImage.image);
[imageData writeToFile:filePath atomically:YES];
}
Friday, August 16, 2013
C++ hash function, how is the original haser i.e. hash implemented
C++ hash function, how is the original haser i.e. hash implemented
I am new to the hashing in general and also to the STL world and saw the
new std::unrdered_set and the SGI :hash_set,both of which uses the hasher
hash. I understand to get a good load factor , you might need to write
your own hashfunction, and I have been able to write one.
However, I am trying to go deep into , how the original default
has_functions are written. My question is : 1) How is the original default
HashFcn written ; more concretely how is the hash generated? Is it based
on some pseudo random number. Can anyone point me to some header file (I
am a bit lost with the documentation), where I can look up ; how the
hasher hash is implemented.
2)How does it guarantee that each time , you will be able to get the same
key?
Please, let me know if I can make my questions clearer any way?
I am new to the hashing in general and also to the STL world and saw the
new std::unrdered_set and the SGI :hash_set,both of which uses the hasher
hash. I understand to get a good load factor , you might need to write
your own hashfunction, and I have been able to write one.
However, I am trying to go deep into , how the original default
has_functions are written. My question is : 1) How is the original default
HashFcn written ; more concretely how is the hash generated? Is it based
on some pseudo random number. Can anyone point me to some header file (I
am a bit lost with the documentation), where I can look up ; how the
hasher hash is implemented.
2)How does it guarantee that each time , you will be able to get the same
key?
Please, let me know if I can make my questions clearer any way?
Saturday, August 10, 2013
Changing metatable in Lua breaks colon operator
Changing metatable in Lua breaks colon operator
While learning Lua, I borrowed some code from here to use string indexing,
which is exactly this:
getmetatable("").__index = function(str, i) return string.sub(str, i, i) end
After that, I wrote a function to reverse a string as practice.
function reverse_string(str)
local s = ""
for i = string.len(str), 1, -1 do s = s .. str[i] end
return s
end
That works fine, until I change the string.len(str) to str:len(), then I
get this error:
reverse.lua:9: bad argument #2 to 'sub' (number expected, got string)
Debugging print()'s tell me that the __index function is being called on
str:len(), and that the i argument is becoming the string "len". I know
that str:len() works without the metatable there, but as soon as I add it
this happens, why?
While learning Lua, I borrowed some code from here to use string indexing,
which is exactly this:
getmetatable("").__index = function(str, i) return string.sub(str, i, i) end
After that, I wrote a function to reverse a string as practice.
function reverse_string(str)
local s = ""
for i = string.len(str), 1, -1 do s = s .. str[i] end
return s
end
That works fine, until I change the string.len(str) to str:len(), then I
get this error:
reverse.lua:9: bad argument #2 to 'sub' (number expected, got string)
Debugging print()'s tell me that the __index function is being called on
str:len(), and that the i argument is becoming the string "len". I know
that str:len() works without the metatable there, but as soon as I add it
this happens, why?
Implementing Undo in FingerPaint
Implementing Undo in FingerPaint
I know there are already too many questions about that. but i have been
trying a lot for few days and nothing is working for me. I am posting the
parts of code and results (only relevant) that might help you
understanding the problem.
public class Canvass extends View {
private ArrayList<Path> paths = new ArrayList<Path>();
private ArrayList<Path> undonePaths = new ArrayList<Path>();
private Path path = new Path();
public Canvass(Context context) {
super(context);
paths.add(path);
}
public void onSizeChanged(int w, int h, int oldW, int oldH)
{
super.onSizeChanged(w, h, oldW, oldH);
myBitmap = Bitmap.createBitmap(getWidth(), getHeight(),
Bitmap.Config.ARGB_8888);
bitmapCanvas = new Canvas(myBitmap);
bitmapCanvas.drawColor(bcolor);
}
protected void onDraw(Canvas canvas)
{ //ON DRAW
if(undo) // I made boolean undo=true on Undo button's
onTouch event
{
onClickUndo();
undo=false;
}
canvas.drawBitmap(myBitmap, 0, 0, paint);
for (Path p : paths)
{canvas.drawPath(p, opaint);
invalidate();
}
On Touch Event
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
touchStarted(x,y);
invalidate();
break;
case MotionEvent.ACTION_MOVE:
touchMoved(x,y);
invalidate();
break;
case MotionEvent.ACTION_UP:
touchEnded();
invalidate();
break;
}
return true;
}
Touch Start
private void touchStarted(float x, float y)
{
path.reset();
path.moveTo(x, y);
paths.add(path);
mX = x;
mY = y;
}
Touch Move
private void touchMoved(float x, float y)
{
float dx = Math.abs(x - mX);
float dy = Math.abs(y - mY);
if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE)
{
path.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
mX = x;
mY = y;
}
}
Touch End
private void touchEnded()
{
path.lineTo(mX, mY);
bitmapCanvas.drawPath(path, opaint);
path.reset();
path = new Path();
paths.add(path);
}
And My UNDO method
public void onClickUndo () {
//UNDO
if (paths.size()>0)
{
undonePaths.add(paths.remove(paths.size()-1));
String s=String.valueOf(paths.size());
Toast.makeText(getContext(), s, Toast.LENGTH_SHORT).show();
invalidate();
}
else
Toast.makeText(getContext(), "fghg",
Toast.LENGTH_SHORT).show();
}
Now, The results I get by clicking undo buttons:- I don't get any of the
line removed, but I do get the toast consisting String "s" (String
s=String.valueOf(paths.size());)
When i draw one line and press "undo", "s" is increased by 1 every time.
but when I draw two lines and press "undo", "s" is increased by 3.
I have tried different solutions but nothing seems to be working... please
help
I know there are already too many questions about that. but i have been
trying a lot for few days and nothing is working for me. I am posting the
parts of code and results (only relevant) that might help you
understanding the problem.
public class Canvass extends View {
private ArrayList<Path> paths = new ArrayList<Path>();
private ArrayList<Path> undonePaths = new ArrayList<Path>();
private Path path = new Path();
public Canvass(Context context) {
super(context);
paths.add(path);
}
public void onSizeChanged(int w, int h, int oldW, int oldH)
{
super.onSizeChanged(w, h, oldW, oldH);
myBitmap = Bitmap.createBitmap(getWidth(), getHeight(),
Bitmap.Config.ARGB_8888);
bitmapCanvas = new Canvas(myBitmap);
bitmapCanvas.drawColor(bcolor);
}
protected void onDraw(Canvas canvas)
{ //ON DRAW
if(undo) // I made boolean undo=true on Undo button's
onTouch event
{
onClickUndo();
undo=false;
}
canvas.drawBitmap(myBitmap, 0, 0, paint);
for (Path p : paths)
{canvas.drawPath(p, opaint);
invalidate();
}
On Touch Event
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
touchStarted(x,y);
invalidate();
break;
case MotionEvent.ACTION_MOVE:
touchMoved(x,y);
invalidate();
break;
case MotionEvent.ACTION_UP:
touchEnded();
invalidate();
break;
}
return true;
}
Touch Start
private void touchStarted(float x, float y)
{
path.reset();
path.moveTo(x, y);
paths.add(path);
mX = x;
mY = y;
}
Touch Move
private void touchMoved(float x, float y)
{
float dx = Math.abs(x - mX);
float dy = Math.abs(y - mY);
if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE)
{
path.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
mX = x;
mY = y;
}
}
Touch End
private void touchEnded()
{
path.lineTo(mX, mY);
bitmapCanvas.drawPath(path, opaint);
path.reset();
path = new Path();
paths.add(path);
}
And My UNDO method
public void onClickUndo () {
//UNDO
if (paths.size()>0)
{
undonePaths.add(paths.remove(paths.size()-1));
String s=String.valueOf(paths.size());
Toast.makeText(getContext(), s, Toast.LENGTH_SHORT).show();
invalidate();
}
else
Toast.makeText(getContext(), "fghg",
Toast.LENGTH_SHORT).show();
}
Now, The results I get by clicking undo buttons:- I don't get any of the
line removed, but I do get the toast consisting String "s" (String
s=String.valueOf(paths.size());)
When i draw one line and press "undo", "s" is increased by 1 every time.
but when I draw two lines and press "undo", "s" is increased by 3.
I have tried different solutions but nothing seems to be working... please
help
how to display address in google map
how to display address in google map
I am displaying google map on my asp.net page using jquery.I have Nation
name,company name,Address and Longitude and latitude.
Right now i have add all addresses in dropdown,on the basis of dropdown
selection i have passed longitude and latitude in code.this part is
working as it display map on the basis of latitude and longitude.But i
have no longitude and latitude for some comapnies.So i want to use
directly address of comapnies to display map.
Here is the code that i have used:
<script src="js/jquery/jquery-1.9.0.min.js"></script>
<!-- <msdropdown> -->
<link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css" />
<script src="js/msdropdown/jquery.dd.js"></script>
<link
href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC6v5-2uaq_wusHDktM9ILcqIrlPtnZgEk&sensor=false">
</script>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places">
</script>
</head>
<body onload="initialize()">
<select id="countries" style="width:300px;"
onchange="updateMap(this.options[this.selectedIndex].value)">
<option value='TVSH - Rruga Ismail Quemali 11>TVSH - Rruga
Ismail Quemali 11, Tirana</option></select>
function updateMap(selectControl) {
alert(selectControl);
switch (selectControl) {
case 'TVSH - Rruga Ismail Quemali 11, Tirana':
var polyline = new google.maps.Polyline({
path: [
new google.maps.LatLng(41.321102, 19.823112)],
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
var latLng = new google.maps.LatLng(41.321102, 19.823112)
break;
default:
break;
}
initialize(polyline, latLng);
}
function initialize(polyline, schoolLatLng) {
var myLatLng = schoolLatLng;
var myOptions = {
zoom: 13,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new
google.maps.Map(document.getElementById("map_canvas"),
myOptions);
polyline.setMap(map);
}
Now map is displaying on the basis of latitude and longitude.Is there any
way so i can directly show map on the basis address.I have address of all
comapnies like this:EURONEWS - 60, chemin des Mouilles - 69130
Lyon-Écully, France
Can i show map on the base of this address.Please ask me more description
if you need.
I am displaying google map on my asp.net page using jquery.I have Nation
name,company name,Address and Longitude and latitude.
Right now i have add all addresses in dropdown,on the basis of dropdown
selection i have passed longitude and latitude in code.this part is
working as it display map on the basis of latitude and longitude.But i
have no longitude and latitude for some comapnies.So i want to use
directly address of comapnies to display map.
Here is the code that i have used:
<script src="js/jquery/jquery-1.9.0.min.js"></script>
<!-- <msdropdown> -->
<link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css" />
<script src="js/msdropdown/jquery.dd.js"></script>
<link
href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC6v5-2uaq_wusHDktM9ILcqIrlPtnZgEk&sensor=false">
</script>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places">
</script>
</head>
<body onload="initialize()">
<select id="countries" style="width:300px;"
onchange="updateMap(this.options[this.selectedIndex].value)">
<option value='TVSH - Rruga Ismail Quemali 11>TVSH - Rruga
Ismail Quemali 11, Tirana</option></select>
function updateMap(selectControl) {
alert(selectControl);
switch (selectControl) {
case 'TVSH - Rruga Ismail Quemali 11, Tirana':
var polyline = new google.maps.Polyline({
path: [
new google.maps.LatLng(41.321102, 19.823112)],
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
var latLng = new google.maps.LatLng(41.321102, 19.823112)
break;
default:
break;
}
initialize(polyline, latLng);
}
function initialize(polyline, schoolLatLng) {
var myLatLng = schoolLatLng;
var myOptions = {
zoom: 13,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new
google.maps.Map(document.getElementById("map_canvas"),
myOptions);
polyline.setMap(map);
}
Now map is displaying on the basis of latitude and longitude.Is there any
way so i can directly show map on the basis address.I have address of all
comapnies like this:EURONEWS - 60, chemin des Mouilles - 69130
Lyon-Écully, France
Can i show map on the base of this address.Please ask me more description
if you need.
Subscribe to:
Comments (Atom)