Product of exponents of prime factorization – math.stackexchange.com
Let $p(n)$ be the product of the exponents of the prime factorization of
$n$. For example, $$p(5184) = p(2^6 3^4) = 24 \;,$$ $$p(65536) = p(2^{16})
= 16 \;.$$ Define $P(n)$ as the number of iterations …
Monday, 30 September 2013
First occurrence of "by the usual compactness argument"? mathoverflow.net
First occurrence of "by the usual compactness argument"? – mathoverflow.net
In his blog, Jeff Shallit asks, what was the first occurrence of the exact
phrase, "by the usual compactness arguments," in the mathematical
literature? He reports that the earliest appearance he has …
In his blog, Jeff Shallit asks, what was the first occurrence of the exact
phrase, "by the usual compactness arguments," in the mathematical
literature? He reports that the earliest appearance he has …
twitter web intent callbacks do not fire in all versions of internet explorer when a hash exists in the URL
twitter web intent callbacks do not fire in all versions of internet
explorer when a hash exists in the URL
In all versions of IE, the web intent for tweet or follow are not firing
when the url contains a hash. Here is an example:
This fails:
http://clientqa.rtm.com/impossiblycomfortable/test.html#abc
This works:
http://clientqa.rtm.com/impossiblycomfortable/test.html
explorer when a hash exists in the URL
In all versions of IE, the web intent for tweet or follow are not firing
when the url contains a hash. Here is an example:
This fails:
http://clientqa.rtm.com/impossiblycomfortable/test.html#abc
This works:
http://clientqa.rtm.com/impossiblycomfortable/test.html
how to find duration of a video file using mediainfo?
how to find duration of a video file using mediainfo?
How can I find duration of a video file in miliseconds i.e. in integer in
deterministic way. I have used ffprobe to get the duration but it doesn't
give duration for all file formats.
How can I find duration of a video file in miliseconds i.e. in integer in
deterministic way. I have used ffprobe to get the duration but it doesn't
give duration for all file formats.
Sunday, 29 September 2013
how to pass array size to function in C++
how to pass array size to function in C++
just I want to ask how can I pass array size to throw function to set size
of my game recoreds
void playGame(int max_streak_length)
{
int tracker =0 ;
const int arrsize = max_streak_length;
int gameRecored[arrsize]={0};
while( tracker < 4)
{
Craps games;
if( games.Play()== true)
{
tracker++;
}
else
if(tracker >0)
{
gameRecored[tracker-1]++;
tracker = 0;
}
}
gameRecored[tracker-1]++;
int v= 0;
}
just I want to ask how can I pass array size to throw function to set size
of my game recoreds
void playGame(int max_streak_length)
{
int tracker =0 ;
const int arrsize = max_streak_length;
int gameRecored[arrsize]={0};
while( tracker < 4)
{
Craps games;
if( games.Play()== true)
{
tracker++;
}
else
if(tracker >0)
{
gameRecored[tracker-1]++;
tracker = 0;
}
}
gameRecored[tracker-1]++;
int v= 0;
}
Secure the removal of an entity with Symfony 2
Secure the removal of an entity with Symfony 2
I'm new to Symfony, and in order to apply what I learned with this
framework, I wanted to build a complete app. I have a Message entity, and
I would like to secure the removal of this entity. Only the user who
created the message and the moderators can remove it. How to secure the
removal ? I mean, in my code I've already written something like
if($message->$user == $this->user || $this->user->isGranted('ROLE_MODO')),
but how to prevent CSRF attack ?
I'm new to Symfony, and in order to apply what I learned with this
framework, I wanted to build a complete app. I have a Message entity, and
I would like to secure the removal of this entity. Only the user who
created the message and the moderators can remove it. How to secure the
removal ? I mean, in my code I've already written something like
if($message->$user == $this->user || $this->user->isGranted('ROLE_MODO')),
but how to prevent CSRF attack ?
Replace ObjectID method for node-mongo-native
Replace ObjectID method for node-mongo-native
The objectID object used in mongo seems to be a little difficult to deal
with when it comes to passing it back and forth with json and
communicating with other applications. It seems that to use it, I have to
convert back and forth between the object for querying and the string for
json message passing.
I think it would be great instead for node-mongo-native to create my _id's
as strings by default. Something like this would make a good unique id
generation system that also doubles as a timestamper:
function createID(){
return (Date.now() + ((Math.round(Math.random()*1000000))/1000000)
).toString();
}
Is there a way for me to have node-mongo-native use this function for id
generation instead of the default?
The objectID object used in mongo seems to be a little difficult to deal
with when it comes to passing it back and forth with json and
communicating with other applications. It seems that to use it, I have to
convert back and forth between the object for querying and the string for
json message passing.
I think it would be great instead for node-mongo-native to create my _id's
as strings by default. Something like this would make a good unique id
generation system that also doubles as a timestamper:
function createID(){
return (Date.now() + ((Math.round(Math.random()*1000000))/1000000)
).toString();
}
Is there a way for me to have node-mongo-native use this function for id
generation instead of the default?
Dynamic default open page in excel
Dynamic default open page in excel
Below is my data in sheet "Sheet1"
ID Jan-13 Feb-13 Mar-13 Apr-13 Apr-13 May-13 Jun-13 Jul-13 Aug-13 Sep-13
A1 12 16 26 46 10 20 50 40 25 15 A2 24 18 24 26 20 20 20 20 25 25 A3 48 15
30 18 30 10 10 10 20 45 A4 16 51 20 10 40 50 20 30 30 15
I wish the data should be visible only for latest six months. for example,
if the current month for Sep-13,
ID Apr-13 May-13 Jun-13 Jul-13 Aug-13 Sep-13 A1 10 20 50 40 25 15 A2 20 20
20 20 25 25 A3 30 10 10 10 20 45 A4 40 50 20 30 30 15
and if the current month is Oct-13,
ID May-13 Jun-13 Jul-13 Aug-13 Sep-13 Oct-13 A1 20 50 40 25 15 10 A2 20 20
20 25 25 25 A3 10 10 10 20 45 35 A4 50 20 30 30 15 30
remaining columns should be hidden. If there is no data in Oct-13 the
current month view should be same as Sep-13. I have month row is filled
till 2014 and each row has formula based on another sheet "Sheet2". If I
add data for oct-13 in "Sheet2", the data will be visible for Oct-13
column in "Sheet1" otherwise it will be blank. It will be helpful if
someone help me how to make this dynamic using excel VBA.
Thanks in advance.
Below is my data in sheet "Sheet1"
ID Jan-13 Feb-13 Mar-13 Apr-13 Apr-13 May-13 Jun-13 Jul-13 Aug-13 Sep-13
A1 12 16 26 46 10 20 50 40 25 15 A2 24 18 24 26 20 20 20 20 25 25 A3 48 15
30 18 30 10 10 10 20 45 A4 16 51 20 10 40 50 20 30 30 15
I wish the data should be visible only for latest six months. for example,
if the current month for Sep-13,
ID Apr-13 May-13 Jun-13 Jul-13 Aug-13 Sep-13 A1 10 20 50 40 25 15 A2 20 20
20 20 25 25 A3 30 10 10 10 20 45 A4 40 50 20 30 30 15
and if the current month is Oct-13,
ID May-13 Jun-13 Jul-13 Aug-13 Sep-13 Oct-13 A1 20 50 40 25 15 10 A2 20 20
20 25 25 25 A3 10 10 10 20 45 35 A4 50 20 30 30 15 30
remaining columns should be hidden. If there is no data in Oct-13 the
current month view should be same as Sep-13. I have month row is filled
till 2014 and each row has formula based on another sheet "Sheet2". If I
add data for oct-13 in "Sheet2", the data will be visible for Oct-13
column in "Sheet1" otherwise it will be blank. It will be helpful if
someone help me how to make this dynamic using excel VBA.
Thanks in advance.
Saturday, 28 September 2013
Grails How to show a different link name in a form
Grails How to show a different link name in a form
In my domain i have a one to many relationship with Inventory and
Inventory Item. This is the snippet from the gsp. It shows each inventory
item assigned to a specific inventory.
<g:if test="${inventoryInstance?.inventoryItem}">
<li class="fieldcontain">
<span id="inventoryItem-label" class="property-label"><g:message
code="inventory.inventoryItem.label" default="Inventory Item"
/></span>
<g:each in="${inventoryInstance.inventoryItem}" var="i">
<span class="property-value"
aria-labelledby="inventoryItem-label"><g:link
controller="inventoryItem" action="show"
id="${i.id}">${i?.encodeAsHTML()}</g:link></span>
</g:each>
</li>
</g:if>
Problem is the links shown is package.InventoryItem: 1
how do you change it to the InventoryItem's name ( i have a name row in my
database)
In my domain i have a one to many relationship with Inventory and
Inventory Item. This is the snippet from the gsp. It shows each inventory
item assigned to a specific inventory.
<g:if test="${inventoryInstance?.inventoryItem}">
<li class="fieldcontain">
<span id="inventoryItem-label" class="property-label"><g:message
code="inventory.inventoryItem.label" default="Inventory Item"
/></span>
<g:each in="${inventoryInstance.inventoryItem}" var="i">
<span class="property-value"
aria-labelledby="inventoryItem-label"><g:link
controller="inventoryItem" action="show"
id="${i.id}">${i?.encodeAsHTML()}</g:link></span>
</g:each>
</li>
</g:if>
Problem is the links shown is package.InventoryItem: 1
how do you change it to the InventoryItem's name ( i have a name row in my
database)
Using BindConstraint in Clutter to constrain the size of an actor
Using BindConstraint in Clutter to constrain the size of an actor
I recently discovered constraints in Clutter, however, I can't find
information on how to constrain the size of actor by proportion. For
example, I want an actor to keep to 1/2 the width of another actor, say
it's parent.
I recently discovered constraints in Clutter, however, I can't find
information on how to constrain the size of actor by proportion. For
example, I want an actor to keep to 1/2 the width of another actor, say
it's parent.
Converting JSON string to Associative array in PHP
Converting JSON string to Associative array in PHP
What I'm trying to Do is so simple yet everything I tries had failed. I
have the following string: "{"msg":"background1.jpg"}", and I want to
convert it to an array to access the msg value. this should simply be done
like so(or so I've thought):
$theString = "{"msg":"background1.jpg"}";
var_dump(json_decode($theString, TRUE));
The vr_dump() is dumping NULL, also tried:
var_dump(json_decode(json_encode($theString), TRUE));
This dumps string(45) "{"msg":"background1.jpg"}"
and tried many many more things, but all failed. Any thought please.
What I'm trying to Do is so simple yet everything I tries had failed. I
have the following string: "{"msg":"background1.jpg"}", and I want to
convert it to an array to access the msg value. this should simply be done
like so(or so I've thought):
$theString = "{"msg":"background1.jpg"}";
var_dump(json_decode($theString, TRUE));
The vr_dump() is dumping NULL, also tried:
var_dump(json_decode(json_encode($theString), TRUE));
This dumps string(45) "{"msg":"background1.jpg"}"
and tried many many more things, but all failed. Any thought please.
Export/save specific data from a html file to word or text or excel or csv extension
Export/save specific data from a html file to word or text or excel or csv
extension
I have some huge html files in ".txt" extension. I want to extract
information such as Name, Address, Mobile No, E-mail Address and want to
save it in a text or excel or csv so that it will be easier for me to
access data...Please help as soon as possible.
Thanks - Vikram Kumar
extension
I have some huge html files in ".txt" extension. I want to extract
information such as Name, Address, Mobile No, E-mail Address and want to
save it in a text or excel or csv so that it will be easier for me to
access data...Please help as soon as possible.
Thanks - Vikram Kumar
Friday, 27 September 2013
is it possible to just login once using Google Calendar APIs v3?
is it possible to just login once using Google Calendar APIs v3?
I am developing a desktop application which interacts with Google
Calendar. I want user to log in just the first time, so later it will auto
login. Can it be done using Google Calendar API v3?
I am developing a desktop application which interacts with Google
Calendar. I want user to log in just the first time, so later it will auto
login. Can it be done using Google Calendar API v3?
Redirect Old URLs with htm Extension
Redirect Old URLs with htm Extension
I have moved to php software that creates SEF URLs. But my site has been
around a long time and there are many Not Found errors that come in for
old URLs that have the htm extension. Is there a way to direct any URL
with the .htm extension to, say, the home page of the site?
I have moved to php software that creates SEF URLs. But my site has been
around a long time and there are many Not Found errors that come in for
old URLs that have the htm extension. Is there a way to direct any URL
with the .htm extension to, say, the home page of the site?
Is there a CDN for unstable versions of Angular.js?
Is there a CDN for unstable versions of Angular.js?
I generally use CDNs for javascript libraries, but now I want to try
something from the newest "release candidate" version of Angular.js ( 1.2
at this time )
Is there a CDN that serves "unstable" new releases of Angular.js? Or do I
have to download it and serve it myself?
I generally use CDNs for javascript libraries, but now I want to try
something from the newest "release candidate" version of Angular.js ( 1.2
at this time )
Is there a CDN that serves "unstable" new releases of Angular.js? Or do I
have to download it and serve it myself?
jquery multitype Jagged array behaving strangely
jquery multitype Jagged array behaving strangely
Please refer to this:
http://jsfiddle.net/MasterOfKitties/v7xbu/7/
/*This is the desired behavior*/
/*var A = [1, 2, 3]*/
/*var B = "hello", [1, 2, 3],
"hello", [2, 3, 2],
"hello", [1, 5, 1]]*/
var A = new Array();
var B = new Array();
function fnMakeArray()
{
var strTemp;
var arrTemp = new Array();
strTemp = parseInt(window.prompt("Enter a number until you hit
cancel",""));
while (strTemp>0)
{
arrTemp.push(strTemp);
strTemp = parseInt(window.prompt("Enter a number until you hit
cancel",""));
}
A[0] = "hello";
A[1] = arrTemp;
alert(A);
}
function fnReplicateArray()
{
B.push(A);
fnDisBArray();
alert(B);
}
function fnDisBArray()
{
var strTemp;
for(var x = 0; x<B.length;x++)
{
strTemp += "<P>" + B[x] + "</p>"
}
document.getElementById('parse').innerHTML = strTemp ;
}
For some reason, when attempting to display the B array, it puts out
undefined. Furthermore, it does not seem to increment the jagged array
correctly, as the b[0] element begins to radically change even though the
b[1] or b[2] element is being arranged.
Any assistance? What's going on?
Please refer to this:
http://jsfiddle.net/MasterOfKitties/v7xbu/7/
/*This is the desired behavior*/
/*var A = [1, 2, 3]*/
/*var B = "hello", [1, 2, 3],
"hello", [2, 3, 2],
"hello", [1, 5, 1]]*/
var A = new Array();
var B = new Array();
function fnMakeArray()
{
var strTemp;
var arrTemp = new Array();
strTemp = parseInt(window.prompt("Enter a number until you hit
cancel",""));
while (strTemp>0)
{
arrTemp.push(strTemp);
strTemp = parseInt(window.prompt("Enter a number until you hit
cancel",""));
}
A[0] = "hello";
A[1] = arrTemp;
alert(A);
}
function fnReplicateArray()
{
B.push(A);
fnDisBArray();
alert(B);
}
function fnDisBArray()
{
var strTemp;
for(var x = 0; x<B.length;x++)
{
strTemp += "<P>" + B[x] + "</p>"
}
document.getElementById('parse').innerHTML = strTemp ;
}
For some reason, when attempting to display the B array, it puts out
undefined. Furthermore, it does not seem to increment the jagged array
correctly, as the b[0] element begins to radically change even though the
b[1] or b[2] element is being arranged.
Any assistance? What's going on?
Converting Binary To Ascii but Getting Same Result for all bit strings
Converting Binary To Ascii but Getting Same Result for all bit strings
I am doing a little project where I have to write a Genetic Algorithm to
evolve my name and id number. Basically I'm randomly generating bit
strings which have to then be generated into strings of ascii characters
and measure to see how close the generation gets. I will then mutate the
best 10 generations to try and get it as close as possible to my name and
id.
The bit I am having trouble with at the moment is the ascii generation. It
works fine for the first bit string but then just repeats itself for the
rest of them despite the fact that each bit string is different. Can
anyone see the problem? Any help is much appreciated.
Code so far:
import java.util.Random ;
public class GeneticAlgorithm {
public static void main(String[] args) throws Exception
{
int popSize = 0 ;
int gen ;
double repRate ;
double crossRate ;
double mutRate ;
int seed = 9005970 ;
String id = "John Connolly 00000000" ;
int bits = 7 * id.length() ;
String output ;
int pop ;
int bitGen ;
Random rand = new Random(seed) ;
ConvertToAscii convert = new ConvertToAscii() ;
Fitness fit = new Fitness() ;
try {
popSize = Integer.parseInt(args[0]) ;
if(popSize < 0 || popSize > 100000)
{
System.out.print("Invalid number! A positive number
between 0 and 100000 must be used for the population
rate!") ;
System.exit(1) ; // Signifies system exit if error occurs
}
gen = Integer.parseInt(args[1]) ;
if(gen < 0 || gen > 100000)
{
System.out.println("Invalid number! A positive number
between 0 and 100000 must be used for the generation
rate!") ;
System.exit(1) ;
}
repRate = Double.parseDouble(args[2]) ;
if(repRate < 0 || repRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
reproduction rate!") ;
System.exit(1) ;
}
crossRate = Double.parseDouble(args[3]) ;
if(crossRate < 0 || crossRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
crossover rate!") ;
System.exit(1) ;
}
mutRate = Double.parseDouble(args[4]) ;
if(mutRate < 0 || mutRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
mutation rate!") ;
System.exit(1) ;
}
if(repRate + crossRate + mutRate != 1.0)
{
System.out.println("The Reproduction Rate, Crossover Rate
and Mutation Rate when sumed together must equal 1.0!") ;
System.exit(1) ;
}
output = args[5] ;
java.io.File file = new java.io.File(output);
java.io.PrintWriter writeOut = new java.io.PrintWriter(file) ;
StringBuffer bitString = new StringBuffer() ;
int bestFit = 0, fitness = 0, totalFit = 0 ;
String ascii = "" ;
writeOut.println(popSize + " " + gen + " " + repRate + " " +
crossRate + " " + mutRate + " " + output + " " + seed) ;
for(pop = 0 ; pop < popSize ; pop++)
{
ascii = "" ;
writeOut.print(pop + " ") ;
for(int i = 0 ; i < bits ; i++)
{
bitGen = rand.nextInt(2);
writeOut.print(bitGen) ;
bitString.append(bitGen) ;
}
ascii = convert.binaryToASCII(bitString) ;
writeOut.print(" " + ascii) ;
writeOut.println() ;
}
writeOut.close() ;
System.exit(0) ;
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("You have entered the incorrect number of
arguments!") ;
System.out.println("Please enter the required 6 arguments.") ;
System.exit(1) ;
} catch(NumberFormatException n) {
System.out.println("Invalid argument type") ;
System.exit(1) ;
}
}
}
Here is the conversion code:
public class ConvertToAscii {
public String binaryToASCII(StringBuffer bitString)
{
String ascii = "" ;
String byteString ;
int decimal ;
int i = 0, n = 7 ;
int baseNumber = 2 ;
char asciiChar ;
while(n <= 154)
{
byteString = bitString.substring(i, n) ;
decimal = Integer.parseInt(byteString, baseNumber) ;
System.out.print(" " + decimal) ;
i += 7 ;
n += 7 ;
if(decimal < 33 || decimal > 136)
{
decimal = 32 ;
asciiChar = (char) decimal ;
} else {
asciiChar = (char) decimal ;
}
ascii += asciiChar ;
}
return ascii ;
}
}
I am doing a little project where I have to write a Genetic Algorithm to
evolve my name and id number. Basically I'm randomly generating bit
strings which have to then be generated into strings of ascii characters
and measure to see how close the generation gets. I will then mutate the
best 10 generations to try and get it as close as possible to my name and
id.
The bit I am having trouble with at the moment is the ascii generation. It
works fine for the first bit string but then just repeats itself for the
rest of them despite the fact that each bit string is different. Can
anyone see the problem? Any help is much appreciated.
Code so far:
import java.util.Random ;
public class GeneticAlgorithm {
public static void main(String[] args) throws Exception
{
int popSize = 0 ;
int gen ;
double repRate ;
double crossRate ;
double mutRate ;
int seed = 9005970 ;
String id = "John Connolly 00000000" ;
int bits = 7 * id.length() ;
String output ;
int pop ;
int bitGen ;
Random rand = new Random(seed) ;
ConvertToAscii convert = new ConvertToAscii() ;
Fitness fit = new Fitness() ;
try {
popSize = Integer.parseInt(args[0]) ;
if(popSize < 0 || popSize > 100000)
{
System.out.print("Invalid number! A positive number
between 0 and 100000 must be used for the population
rate!") ;
System.exit(1) ; // Signifies system exit if error occurs
}
gen = Integer.parseInt(args[1]) ;
if(gen < 0 || gen > 100000)
{
System.out.println("Invalid number! A positive number
between 0 and 100000 must be used for the generation
rate!") ;
System.exit(1) ;
}
repRate = Double.parseDouble(args[2]) ;
if(repRate < 0 || repRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
reproduction rate!") ;
System.exit(1) ;
}
crossRate = Double.parseDouble(args[3]) ;
if(crossRate < 0 || crossRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
crossover rate!") ;
System.exit(1) ;
}
mutRate = Double.parseDouble(args[4]) ;
if(mutRate < 0 || mutRate > 1.0)
{
System.out.println("Invalid number! A positive decimal
point number between 0 and 1.0 must be used for the
mutation rate!") ;
System.exit(1) ;
}
if(repRate + crossRate + mutRate != 1.0)
{
System.out.println("The Reproduction Rate, Crossover Rate
and Mutation Rate when sumed together must equal 1.0!") ;
System.exit(1) ;
}
output = args[5] ;
java.io.File file = new java.io.File(output);
java.io.PrintWriter writeOut = new java.io.PrintWriter(file) ;
StringBuffer bitString = new StringBuffer() ;
int bestFit = 0, fitness = 0, totalFit = 0 ;
String ascii = "" ;
writeOut.println(popSize + " " + gen + " " + repRate + " " +
crossRate + " " + mutRate + " " + output + " " + seed) ;
for(pop = 0 ; pop < popSize ; pop++)
{
ascii = "" ;
writeOut.print(pop + " ") ;
for(int i = 0 ; i < bits ; i++)
{
bitGen = rand.nextInt(2);
writeOut.print(bitGen) ;
bitString.append(bitGen) ;
}
ascii = convert.binaryToASCII(bitString) ;
writeOut.print(" " + ascii) ;
writeOut.println() ;
}
writeOut.close() ;
System.exit(0) ;
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("You have entered the incorrect number of
arguments!") ;
System.out.println("Please enter the required 6 arguments.") ;
System.exit(1) ;
} catch(NumberFormatException n) {
System.out.println("Invalid argument type") ;
System.exit(1) ;
}
}
}
Here is the conversion code:
public class ConvertToAscii {
public String binaryToASCII(StringBuffer bitString)
{
String ascii = "" ;
String byteString ;
int decimal ;
int i = 0, n = 7 ;
int baseNumber = 2 ;
char asciiChar ;
while(n <= 154)
{
byteString = bitString.substring(i, n) ;
decimal = Integer.parseInt(byteString, baseNumber) ;
System.out.print(" " + decimal) ;
i += 7 ;
n += 7 ;
if(decimal < 33 || decimal > 136)
{
decimal = 32 ;
asciiChar = (char) decimal ;
} else {
asciiChar = (char) decimal ;
}
ascii += asciiChar ;
}
return ascii ;
}
}
Accordion like menu - sub-menu not hiding while click on another link - jQuery
Accordion like menu - sub-menu not hiding while click on another link -
jQuery
I have a menu made with ul an li, and I am trying to hide other sub-menus
when a click event is triggered on a anchor. The HTML menu looks like this
<ul id="navigation">
<li>
<a href="javascript:void(0)">link 1</a>
<ul class="subnavi">
<li><a href="#">sublink 1</a></li>
<li><a href="#">sublink 2</a></li>
</ul>
</li>
<li>
<a href="javascript:void(0)">link 2</a>
<ul class="subnavi">
<li><a href="#">sublink 3</a></li>
<li><a href="#">sublink 4</a></li>
</ul>
</li>
<li class="active">
<a href="javascript:void(0)">link 3</a>
<ul class="subnavi">
<li><a href="#">sublink 5</a></li>
<li><a href="#">sublink 6</a></li>
</ul>
</li>
<li>
<a href="#">link 4</a>
</li>
</ul>
the CSS code looks like this
#navigation li ul{ display: none;}
an the Jquery part looks like this
$('#navigation > li:has(ul) > a').on("click",function(ev) {
$(this).siblings('ul').toggle().end().siblings().find('ul').hide();
ev.preventDefault();
});
What am I doing wrong ?
jQuery
I have a menu made with ul an li, and I am trying to hide other sub-menus
when a click event is triggered on a anchor. The HTML menu looks like this
<ul id="navigation">
<li>
<a href="javascript:void(0)">link 1</a>
<ul class="subnavi">
<li><a href="#">sublink 1</a></li>
<li><a href="#">sublink 2</a></li>
</ul>
</li>
<li>
<a href="javascript:void(0)">link 2</a>
<ul class="subnavi">
<li><a href="#">sublink 3</a></li>
<li><a href="#">sublink 4</a></li>
</ul>
</li>
<li class="active">
<a href="javascript:void(0)">link 3</a>
<ul class="subnavi">
<li><a href="#">sublink 5</a></li>
<li><a href="#">sublink 6</a></li>
</ul>
</li>
<li>
<a href="#">link 4</a>
</li>
</ul>
the CSS code looks like this
#navigation li ul{ display: none;}
an the Jquery part looks like this
$('#navigation > li:has(ul) > a').on("click",function(ev) {
$(this).siblings('ul').toggle().end().siblings().find('ul').hide();
ev.preventDefault();
});
What am I doing wrong ?
Why i haven't got any beep from my kernel driver
Why i haven't got any beep from my kernel driver
I want to do beep whis IOCTL_BEEP_SET, but i hear only some slight knock
out from speaker.. Where is my problem? I want to create code that i can
run on difference versions of Windows. And don't want to write port and
using HalMakeBeep().
NTSTATUS Beep(IN DWORD dwFreq, IN DWORD dwDuration)
{
HANDLE hBeep;
UNICODE_STRING BeepDevice;
OBJECT_ATTRIBUTES oaBeepAttr;
IO_STATUS_BLOCK IoStatusBlock;
BEEP_SET_PARAMETERS BeepParameters;
NTSTATUS Status;
RtlInitUnicodeString(&BeepDevice, DD_BEEP_DEVICE_NAME_U);
InitializeObjectAttributes(&oaBeepAttr,&BeepDevice, 0, NULL, NULL);
Status = ZwCreateFile(&hBeep,
FILE_READ_DATA|FILE_WRITE_DATA|SYNCHRONIZE,
&oaBeepAttr,
&IoStatusBlock,
NULL,
0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_SYNCHRONOUS_IO_NOALERT,
NULL,
0);
if (!NT_SUCCESS(Status))
{
DbgPrint("ZwCreateFile error = 0x%x\n", Status);
return STATUS_UNSUCCESSFUL;
}
if ((dwFreq >= BEEP_FREQUENCY_MINIMUM && dwFreq <=BEEP_FREQUENCY_MAXIMUM) ||
(dwFreq == 0x0 && dwDuration == 0x0))
{
BeepParameters.Frequency = dwFreq;
BeepParameters.Duration = dwDuration;
Status = ZwDeviceIoControlFile(hBeep,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_BEEP_SET,
&BeepParameters,
sizeof(BeepParameters),
NULL,
0);
if (Status != STATUS_SUCCESS && Status != STATUS_PENDING )
{
DbgPrint("ZwDeviceIoControlFile returns error
0x%X\nIO_STATUS_BLOCK 0x%X 0x%X 0x%X\n",
Status,IoStatusBlock.Status, IoStatusBlock.Pointer,
IoStatusBlock.Information);
}
DbgPrint("ZwDeviceIoControlFile returns error 0x%X\nIO_STATUS_BLOCK
0x%X 0x%X 0x%X\n", Status,IoStatusBlock.Status, IoStatusBlock.Pointer,
IoStatusBlock.Information);
}
else
{
DbgPrint("Wrong parameters\n");
ZwClose(hBeep);
return STATUS_INVALID_PARAMETER;
}
ZwClose(hBeep);
return STATUS_UNSUCCESSFUL;
}
I want to do beep whis IOCTL_BEEP_SET, but i hear only some slight knock
out from speaker.. Where is my problem? I want to create code that i can
run on difference versions of Windows. And don't want to write port and
using HalMakeBeep().
NTSTATUS Beep(IN DWORD dwFreq, IN DWORD dwDuration)
{
HANDLE hBeep;
UNICODE_STRING BeepDevice;
OBJECT_ATTRIBUTES oaBeepAttr;
IO_STATUS_BLOCK IoStatusBlock;
BEEP_SET_PARAMETERS BeepParameters;
NTSTATUS Status;
RtlInitUnicodeString(&BeepDevice, DD_BEEP_DEVICE_NAME_U);
InitializeObjectAttributes(&oaBeepAttr,&BeepDevice, 0, NULL, NULL);
Status = ZwCreateFile(&hBeep,
FILE_READ_DATA|FILE_WRITE_DATA|SYNCHRONIZE,
&oaBeepAttr,
&IoStatusBlock,
NULL,
0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_SYNCHRONOUS_IO_NOALERT,
NULL,
0);
if (!NT_SUCCESS(Status))
{
DbgPrint("ZwCreateFile error = 0x%x\n", Status);
return STATUS_UNSUCCESSFUL;
}
if ((dwFreq >= BEEP_FREQUENCY_MINIMUM && dwFreq <=BEEP_FREQUENCY_MAXIMUM) ||
(dwFreq == 0x0 && dwDuration == 0x0))
{
BeepParameters.Frequency = dwFreq;
BeepParameters.Duration = dwDuration;
Status = ZwDeviceIoControlFile(hBeep,
NULL,
NULL,
NULL,
&IoStatusBlock,
IOCTL_BEEP_SET,
&BeepParameters,
sizeof(BeepParameters),
NULL,
0);
if (Status != STATUS_SUCCESS && Status != STATUS_PENDING )
{
DbgPrint("ZwDeviceIoControlFile returns error
0x%X\nIO_STATUS_BLOCK 0x%X 0x%X 0x%X\n",
Status,IoStatusBlock.Status, IoStatusBlock.Pointer,
IoStatusBlock.Information);
}
DbgPrint("ZwDeviceIoControlFile returns error 0x%X\nIO_STATUS_BLOCK
0x%X 0x%X 0x%X\n", Status,IoStatusBlock.Status, IoStatusBlock.Pointer,
IoStatusBlock.Information);
}
else
{
DbgPrint("Wrong parameters\n");
ZwClose(hBeep);
return STATUS_INVALID_PARAMETER;
}
ZwClose(hBeep);
return STATUS_UNSUCCESSFUL;
}
Thursday, 26 September 2013
Unicode support for android - How to identify fontavailable on particular device
Unicode support for android - How to identify fontavailable on particular
device
We looked at various threads on stackoverflow, so do understand limitation
of some fonts on lower android version.
Is there way to identify whether particular device has unicode font
available ( e.g. Hindi, Chinese, etc )?
If we get to know which fonts are available then we will display unicode
support only on those phone..
So what we want to achieve is method something like
isUnicodeAvailable(fontname/FontType)
Settings page
Some Method (){
if ( **isUnicodeAvailable(FontName)** ) {
//Show text with unicode
}else{
//Show normal text
}
}
device
We looked at various threads on stackoverflow, so do understand limitation
of some fonts on lower android version.
Is there way to identify whether particular device has unicode font
available ( e.g. Hindi, Chinese, etc )?
If we get to know which fonts are available then we will display unicode
support only on those phone..
So what we want to achieve is method something like
isUnicodeAvailable(fontname/FontType)
Settings page
Some Method (){
if ( **isUnicodeAvailable(FontName)** ) {
//Show text with unicode
}else{
//Show normal text
}
}
Thursday, 19 September 2013
Adding a strong name / signature to an outside DLL?
Adding a strong name / signature to an outside DLL?
We're signing our library but one of our external dependencies is itself
not signed, giving us the following error:
Referenced assembly 'ManyConsole' does not have a strong name
We get the ManyConsole package (a great one BTW!) via Nuget but are ok
with a non-Nuget orphan that is signed by us. In fact, we could very well
sign it with the same key as our own app but it's not clear how we can
sign an "outside" DLL.
We're signing our library but one of our external dependencies is itself
not signed, giving us the following error:
Referenced assembly 'ManyConsole' does not have a strong name
We get the ManyConsole package (a great one BTW!) via Nuget but are ok
with a non-Nuget orphan that is signed by us. In fact, we could very well
sign it with the same key as our own app but it's not clear how we can
sign an "outside" DLL.
WordPress theme - pagination issue
WordPress theme - pagination issue
I've installed a WordPress theme and pages 2,3,4,etc aren't working. They
come up with a 404 error that the pages cannot be found.
The url for page 2 is http://mysite.com/?paged=2.
After some messing around I've figured out how to get my pages to appear
but I have to manually type in the url to see them. For example, the url
to get page 2 to appear is http://mysite.com/?page_id=2&paged=2
How can I get it to go to this url automatically? Is it a permalink
problem (in my WordPress settings) or do I need to edit the pagination
code?
Any help will be so appreciated!
Here is the pagination code:
<?php
global $wp_query;
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link(
$big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'list',
'prev_text' => __(''),
'next_text' => __('»')
) );
?>
</div>
I've installed a WordPress theme and pages 2,3,4,etc aren't working. They
come up with a 404 error that the pages cannot be found.
The url for page 2 is http://mysite.com/?paged=2.
After some messing around I've figured out how to get my pages to appear
but I have to manually type in the url to see them. For example, the url
to get page 2 to appear is http://mysite.com/?page_id=2&paged=2
How can I get it to go to this url automatically? Is it a permalink
problem (in my WordPress settings) or do I need to edit the pagination
code?
Any help will be so appreciated!
Here is the pagination code:
<?php
global $wp_query;
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link(
$big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'list',
'prev_text' => __(''),
'next_text' => __('»')
) );
?>
</div>
Using $in and $lt to find data with specific array values in MongoDB
Using $in and $lt to find data with specific array values in MongoDB
I have a people collection with a timeline array containing a year when
something happened to this person. For example the year they were born,
like this:
db.people.insert({
"timeline": [
{ "born_year": 1999 },
{ "other_event": 2005 }
]
});
I can query this collection for someone born 1999:
db.people.find({
"timeline": { $in: [ { "born_year": 1999 } ] }
});
However, when using $lt to query for people born before 2000 I don't get
any results at all:
db.people.find({
"timeline": { $in: [ { "born_year": { $lt: 2000 } } ] }
});
Can anyone explain to me what I'm doing wrong here?
I have a people collection with a timeline array containing a year when
something happened to this person. For example the year they were born,
like this:
db.people.insert({
"timeline": [
{ "born_year": 1999 },
{ "other_event": 2005 }
]
});
I can query this collection for someone born 1999:
db.people.find({
"timeline": { $in: [ { "born_year": 1999 } ] }
});
However, when using $lt to query for people born before 2000 I don't get
any results at all:
db.people.find({
"timeline": { $in: [ { "born_year": { $lt: 2000 } } ] }
});
Can anyone explain to me what I'm doing wrong here?
High Level Overview Of Throwing Exceptions In Java
High Level Overview Of Throwing Exceptions In Java
I am a little bit confused with exceptions in Java and when to use which
particular style of implementation.
I used IllegalArgumentException as an example, but the main point I would
like to address is when does one throw, extends or throw new exception?
Also as an additional point I have an assignment where I have to create a
java class and the spec vaguely states that the constructor should throw
an IllegalArgumentException so which one would be the best to use?
public class Test{
//when does one use this type of exception
public Test(String yourName) throws IllegalArgumentException{
//code implemented
}
//when does one use this type of exception
public Test(String yourName) extends IllegalArgumentException{
//code implemented
}
public Test(String yourName){
if(yourName.length() <= 0){
//why not use this type of exception instead
//and what happens when I use this type of exception
throw new IllegalArgumentException("Please Enter Your Name..!");
}
}
}
Thanks in advance.
I am a little bit confused with exceptions in Java and when to use which
particular style of implementation.
I used IllegalArgumentException as an example, but the main point I would
like to address is when does one throw, extends or throw new exception?
Also as an additional point I have an assignment where I have to create a
java class and the spec vaguely states that the constructor should throw
an IllegalArgumentException so which one would be the best to use?
public class Test{
//when does one use this type of exception
public Test(String yourName) throws IllegalArgumentException{
//code implemented
}
//when does one use this type of exception
public Test(String yourName) extends IllegalArgumentException{
//code implemented
}
public Test(String yourName){
if(yourName.length() <= 0){
//why not use this type of exception instead
//and what happens when I use this type of exception
throw new IllegalArgumentException("Please Enter Your Name..!");
}
}
}
Thanks in advance.
crm 4.0 filtered lookup
crm 4.0 filtered lookup
I have a lookup field in my base-entity. The target entity has a
number-field in it.
When I open the lookup-dialog all the target-records are shown, but I only
want to show the records where the number-field is 123, for example.
the value is fixed, but how can filter the lookupfield. Best would be if
could edit the fetchxml in javascript, but I don't know how
I have a lookup field in my base-entity. The target entity has a
number-field in it.
When I open the lookup-dialog all the target-records are shown, but I only
want to show the records where the number-field is 123, for example.
the value is fixed, but how can filter the lookupfield. Best would be if
could edit the fetchxml in javascript, but I don't know how
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on project
Failed to execute goal
org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on
project
when am trying to build webservices am getting build errors. its failing
to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc
Failed to execute goal
org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on
project hibu-apiservices-webservices: An error has occurred in JavaDocs
report generation:Exit code: 1 - Sep 19, 2013 5:07:50 PM
com.sun.jersey.wadl.resourcedoc.ResourceDoclet start
[ERROR] SEVERE: Could not serialize ResourceDoc.
[ERROR] java.lang.IllegalArgumentException
[ERROR] at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
[ERROR] at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:954)
[ERROR] at sun.misc.URLClassPath$3.run(URLClassPath.java:326)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
[ERROR] at sun.misc.URLClassPath.findResource(URLClassPath.java:144)
[ERROR] at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
[ERROR] at java.lang.ClassLoader.getResource(ClassLoader.java:978)
[ERROR] at
javax.xml.bind.ContextFinder.loadJAXBProperties(ContextFinder.java:391)
[ERROR] at javax.xml.bind.ContextFinder.find(ContextFinder.java:323)
[ERROR] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
[ERROR] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
[ERROR] at
com.sun.jersey.wadl.resourcedoc.ResourceDoclet.start(ResourceDoclet.java:177)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[ERROR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:597)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
[ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:128)
[ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:41)
[ERROR] at com.sun.tools.javadoc.Main.main(Main.java:31)
[ERROR]
[ERROR] Command line was:"C:\Program
Files\Java\jdk1.6.0_13\bin\javadoc.exe"
-J-Djava.util.logging.ConsoleHandler.level=ALL @options
[ERROR] -> [Help 1]
org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on
project
when am trying to build webservices am getting build errors. its failing
to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc
Failed to execute goal
org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (default) on
project hibu-apiservices-webservices: An error has occurred in JavaDocs
report generation:Exit code: 1 - Sep 19, 2013 5:07:50 PM
com.sun.jersey.wadl.resourcedoc.ResourceDoclet start
[ERROR] SEVERE: Could not serialize ResourceDoc.
[ERROR] java.lang.IllegalArgumentException
[ERROR] at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
[ERROR] at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:954)
[ERROR] at sun.misc.URLClassPath$3.run(URLClassPath.java:326)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
[ERROR] at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
[ERROR] at sun.misc.URLClassPath.findResource(URLClassPath.java:144)
[ERROR] at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
[ERROR] at java.lang.ClassLoader.getResource(ClassLoader.java:978)
[ERROR] at
javax.xml.bind.ContextFinder.loadJAXBProperties(ContextFinder.java:391)
[ERROR] at javax.xml.bind.ContextFinder.find(ContextFinder.java:323)
[ERROR] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
[ERROR] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
[ERROR] at
com.sun.jersey.wadl.resourcedoc.ResourceDoclet.start(ResourceDoclet.java:177)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[ERROR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:597)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
[ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
[ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
[ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:128)
[ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:41)
[ERROR] at com.sun.tools.javadoc.Main.main(Main.java:31)
[ERROR]
[ERROR] Command line was:"C:\Program
Files\Java\jdk1.6.0_13\bin\javadoc.exe"
-J-Djava.util.logging.ConsoleHandler.level=ALL @options
[ERROR] -> [Help 1]
JSONModel returns nil
JSONModel returns nil
I'mm using JSONModel to get the JSON from the URL. It's a very simple
object, containing only 2 strings - "name" and "url".
First I made the Object Model:
@protocol
Tutorial
@end
@interface Tutorial : JSONModel
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *url;
@end
Then Object Feed:
#import "JSONModel.h"
#import "Tutorial.h"
@interface TutorialFeed : JSONModel
@property (nonatomic, strong) NSArray <Tutorial> *tutorials;
@end
and then in MasterViewController.m:
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "TutorialFeed.h"
#import "JSONModelLib.h"
@interface MasterViewController () {
TutorialFeed *feed;
TutorialFeed *testFeed;
}
@end
@implementation MasterViewController
-(void)viewDidAppear:(BOOL)animated
{
feed = [[TutorialFeed alloc]
initFromURLWithString:@"http://api.matematikfessor.dk/apps/teacher_videos"
completion:^(JSONModel *model, JSONModelError *err) {
NSLog(@"Tutorials %@", feed.tutorials);
}];
}
@end
The problem is, I get returned nil in my log :( Im not sure why is this
happening, because I managed to fetch data from JSON from this URL: Kiwa
URL
All that done, following this tutorial
Im not sure what am I doing wrong. Does anybody has any clue ?
I'mm using JSONModel to get the JSON from the URL. It's a very simple
object, containing only 2 strings - "name" and "url".
First I made the Object Model:
@protocol
Tutorial
@end
@interface Tutorial : JSONModel
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *url;
@end
Then Object Feed:
#import "JSONModel.h"
#import "Tutorial.h"
@interface TutorialFeed : JSONModel
@property (nonatomic, strong) NSArray <Tutorial> *tutorials;
@end
and then in MasterViewController.m:
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "TutorialFeed.h"
#import "JSONModelLib.h"
@interface MasterViewController () {
TutorialFeed *feed;
TutorialFeed *testFeed;
}
@end
@implementation MasterViewController
-(void)viewDidAppear:(BOOL)animated
{
feed = [[TutorialFeed alloc]
initFromURLWithString:@"http://api.matematikfessor.dk/apps/teacher_videos"
completion:^(JSONModel *model, JSONModelError *err) {
NSLog(@"Tutorials %@", feed.tutorials);
}];
}
@end
The problem is, I get returned nil in my log :( Im not sure why is this
happening, because I managed to fetch data from JSON from this URL: Kiwa
URL
All that done, following this tutorial
Im not sure what am I doing wrong. Does anybody has any clue ?
Wednesday, 18 September 2013
JMeter: An error occurred: java.lang.ExceptionInInitializerError
JMeter: An error occurred: java.lang.ExceptionInInitializerError
Trying to install Jmeter 2.9 on Mac osx , seeing following error
JMeter: An error occurred: java.lang.ExceptionInInitializerError
ANy help would be appreciated
Trying to install Jmeter 2.9 on Mac osx , seeing following error
JMeter: An error occurred: java.lang.ExceptionInInitializerError
ANy help would be appreciated
Blackberry package-id of apk2bar generated package
Blackberry package-id of apk2bar generated package
We have a problem where we would like to distribute our blackberry app as
a new application - rather than an upgrade and the Blackberry portal is
saying that our current .bar file has the same package ID as another app.
The .bar file is created from an android app using apk2bar.
Looking at the package id in the .bar's manifest file it's obviously a
generated hash, and in trying to figure out where it comes from I found
this comment on twitter from @BlackBerryDev:
The package name and code signing key are both used to create the package ID.
(Source: https://twitter.com/ruvcan/status/327129884629553153)
My question is, what exactly is the code signing key - is that the
developer certificate, or is it based on the client-*.csj files in the
keystore, or both or something else?
What I need to know is what's the easiest way to get a new package ID
without changing the package id of the underlying Android app?
What I'd like to know is how the blackberry code signing works with a bit
more detail. I haven't been able to find a good explanation of how all the
bits (client-RDK.csj, client-PBDT.csj, developer certificate, key store,
blackberry ID, android package id, version numbers, portal packages,
applications vs upgrades etc...) all tie together.
We have a problem where we would like to distribute our blackberry app as
a new application - rather than an upgrade and the Blackberry portal is
saying that our current .bar file has the same package ID as another app.
The .bar file is created from an android app using apk2bar.
Looking at the package id in the .bar's manifest file it's obviously a
generated hash, and in trying to figure out where it comes from I found
this comment on twitter from @BlackBerryDev:
The package name and code signing key are both used to create the package ID.
(Source: https://twitter.com/ruvcan/status/327129884629553153)
My question is, what exactly is the code signing key - is that the
developer certificate, or is it based on the client-*.csj files in the
keystore, or both or something else?
What I need to know is what's the easiest way to get a new package ID
without changing the package id of the underlying Android app?
What I'd like to know is how the blackberry code signing works with a bit
more detail. I haven't been able to find a good explanation of how all the
bits (client-RDK.csj, client-PBDT.csj, developer certificate, key store,
blackberry ID, android package id, version numbers, portal packages,
applications vs upgrades etc...) all tie together.
iphone- App Crashes for No Reason
iphone- App Crashes for No Reason
Here is some background information. I originally developed this game for
the iPhone 3.1 software, but then edited the code to make it compatible
with newer software. My app is a space game.Basically, UIImageViews start
to spawn at the top of the screen and come down, and you have to move your
character (another UIImageview) out of the way. All of the code works
flawlessly on the simulator. It also generally works fine on the device.
However, just on the device, once every five or six times, halfway through
the game the volume shuts off (I have a fire button which not only spawns
a new uiimageview that moves accross the screen, but it also plays an
avaudio noise). When I click the fire button, no avaudio sound is made.
The rest of the game keeps running fine. Then, when I crash into a meteor,
the game crashes. I don't know where or what the problem is because the
game only has the sound turn off and then crash when you hit a meteor like
once out of every six times you play the game, and there is no problems at
all on the simulator, only on the device. If you need any additional
information or have any suggestions, please feel free to ask.
Here is my code for when you crash into a meteor (even if the problem is
here, it does not explain my avaudioplayer malfunctioning only when the
game is about to crash):
if (CGRectIntersectsRect(one.frame, image.frame) && ![meteorsToRemove
containsObject:one]) {
NSURL *url = [NSURL fileURLWithPath:[NSString
stringWithFormat:@"%@/shipExplosion.wav", [[NSBundle mainBundle]
resourcePath ]]];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url
error:&error];
audioPlayer.numberOfLoops = 0;
[audioPlayer play];
[error release];
background.image = [UIImage imageNamed:@"gameOver.png"];
fire.hidden = YES;
image.hidden=YES;
quit2.hidden=NO;
one.hidden=NO;
highscorePageButton.hidden=NO;
playAgain.hidden=NO;
image.center=CGPointMake(500,500);
secondsTotalCount.hidden=NO;
NSString *newText = [[NSString alloc] initWithFormat:@"You Lasted
%d Seconds", _totalSeconds];
secondsTotalCount.text = newText;
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSNumber *highscore = [[NSNumber alloc]
initWithInteger:_totalSeconds];
NSString *choice = [NSString stringWithFormat:@"%@/userschoice",
documentsDirectory];
NSMutableArray *array;
if ([[NSFileManager defaultManager] fileExistsAtPath:choice]) {
array = [NSMutableArray arrayWithContentsOfFile:choice];
}
else {
array = [[[NSMutableArray alloc] init]autorelease];
}
[array addObject:highscore];
[array writeToFile:choice atomically:YES];
[newText release];
}
Note: one is the name of a meteor, image is the name of your
character.MeteorsToRemove is an array of inactive meteors (that got shot
down by the character). Also, I save the score of the character in a text
file named choice.
Here is some background information. I originally developed this game for
the iPhone 3.1 software, but then edited the code to make it compatible
with newer software. My app is a space game.Basically, UIImageViews start
to spawn at the top of the screen and come down, and you have to move your
character (another UIImageview) out of the way. All of the code works
flawlessly on the simulator. It also generally works fine on the device.
However, just on the device, once every five or six times, halfway through
the game the volume shuts off (I have a fire button which not only spawns
a new uiimageview that moves accross the screen, but it also plays an
avaudio noise). When I click the fire button, no avaudio sound is made.
The rest of the game keeps running fine. Then, when I crash into a meteor,
the game crashes. I don't know where or what the problem is because the
game only has the sound turn off and then crash when you hit a meteor like
once out of every six times you play the game, and there is no problems at
all on the simulator, only on the device. If you need any additional
information or have any suggestions, please feel free to ask.
Here is my code for when you crash into a meteor (even if the problem is
here, it does not explain my avaudioplayer malfunctioning only when the
game is about to crash):
if (CGRectIntersectsRect(one.frame, image.frame) && ![meteorsToRemove
containsObject:one]) {
NSURL *url = [NSURL fileURLWithPath:[NSString
stringWithFormat:@"%@/shipExplosion.wav", [[NSBundle mainBundle]
resourcePath ]]];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url
error:&error];
audioPlayer.numberOfLoops = 0;
[audioPlayer play];
[error release];
background.image = [UIImage imageNamed:@"gameOver.png"];
fire.hidden = YES;
image.hidden=YES;
quit2.hidden=NO;
one.hidden=NO;
highscorePageButton.hidden=NO;
playAgain.hidden=NO;
image.center=CGPointMake(500,500);
secondsTotalCount.hidden=NO;
NSString *newText = [[NSString alloc] initWithFormat:@"You Lasted
%d Seconds", _totalSeconds];
secondsTotalCount.text = newText;
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSNumber *highscore = [[NSNumber alloc]
initWithInteger:_totalSeconds];
NSString *choice = [NSString stringWithFormat:@"%@/userschoice",
documentsDirectory];
NSMutableArray *array;
if ([[NSFileManager defaultManager] fileExistsAtPath:choice]) {
array = [NSMutableArray arrayWithContentsOfFile:choice];
}
else {
array = [[[NSMutableArray alloc] init]autorelease];
}
[array addObject:highscore];
[array writeToFile:choice atomically:YES];
[newText release];
}
Note: one is the name of a meteor, image is the name of your
character.MeteorsToRemove is an array of inactive meteors (that got shot
down by the character). Also, I save the score of the character in a text
file named choice.
How can I parse escaped XML with XML::LibXML
How can I parse escaped XML with XML::LibXML
So the responses are basically full XML documents escaped as a string
inside of another XML Document. What is the best way to extract this
String and Parse it into something I can simply get the values from.
(will accept simply how to get it back to raw XML)
<soap:Body>
<DoItUsernamePwdResponse xmlns="http://www.aspdotnetstorefront.com/">
<DoItUsernamePwdResult><?xml version="1.0"
encoding="utf-8"?><AspDotNetStorefrontImportResult
Version="9.2" DateTime="9/18/2013 1:46:06 PM"><Item
NodeType="Entity" Name="Nike"
GUID="84775261-731D-4E11-BB82-FA5F61BC61C5" ID="1" ActionTaken="Add"
Status="OK" Message=""
/></AspDotNetStorefrontImportResult></DoItUsernamePwdResult>
</DoItUsernamePwdResponse>
</soap:Body>
So the responses are basically full XML documents escaped as a string
inside of another XML Document. What is the best way to extract this
String and Parse it into something I can simply get the values from.
(will accept simply how to get it back to raw XML)
<soap:Body>
<DoItUsernamePwdResponse xmlns="http://www.aspdotnetstorefront.com/">
<DoItUsernamePwdResult><?xml version="1.0"
encoding="utf-8"?><AspDotNetStorefrontImportResult
Version="9.2" DateTime="9/18/2013 1:46:06 PM"><Item
NodeType="Entity" Name="Nike"
GUID="84775261-731D-4E11-BB82-FA5F61BC61C5" ID="1" ActionTaken="Add"
Status="OK" Message=""
/></AspDotNetStorefrontImportResult></DoItUsernamePwdResult>
</DoItUsernamePwdResponse>
</soap:Body>
Cant define a Foreign Key in PHPMyAdmin
Cant define a Foreign Key in PHPMyAdmin
Setting up a database in PHPMyAdmin and i have two tables, Foo and Bar. I
want to use the Primary Key from Foo as a Foreign Key in Bar, but when i
go to the relational view it says "No index defined!". Any ideas why?
Also, if i set this up, does that mean that as an Foreign Key, Foo will
have its data auto imported and updated to Bar every time a new row is
added?
Setting up a database in PHPMyAdmin and i have two tables, Foo and Bar. I
want to use the Primary Key from Foo as a Foreign Key in Bar, but when i
go to the relational view it says "No index defined!". Any ideas why?
Also, if i set this up, does that mean that as an Foreign Key, Foo will
have its data auto imported and updated to Bar every time a new row is
added?
Need to select closest item on table
Need to select closest item on table
I need to hide the "lblItemPrice" div when I click the "btnEdit" button.I
need to get the closest div which having "lblItemPrice" class.
I have tried like this,But not working.
$('.btnEdit').die('click').live('click', function () {
$(this).closest('.lblItemPrice').hide();
});
HTML
<table class="invoice" id="invoiceList">
<tbody>
<tr class="">
<td class="value" id="pricetd">
<div id="itemPriceDiv">
<div class="lblItemPrice">
$2.00
</div>
<input type="text" id="editPrice" name="editPrice"
placeholder="edit price">
</div>
</td>
<td class="value">
$2.00
</td>
<td>
<button class="btnEdit actionButton secondaryButton short"
type="button">
Edit</button>
</td>
<td>
</td>
</tr>
</tbody>
</table>
I need to hide the "lblItemPrice" div when I click the "btnEdit" button.I
need to get the closest div which having "lblItemPrice" class.
I have tried like this,But not working.
$('.btnEdit').die('click').live('click', function () {
$(this).closest('.lblItemPrice').hide();
});
HTML
<table class="invoice" id="invoiceList">
<tbody>
<tr class="">
<td class="value" id="pricetd">
<div id="itemPriceDiv">
<div class="lblItemPrice">
$2.00
</div>
<input type="text" id="editPrice" name="editPrice"
placeholder="edit price">
</div>
</td>
<td class="value">
$2.00
</td>
<td>
<button class="btnEdit actionButton secondaryButton short"
type="button">
Edit</button>
</td>
<td>
</td>
</tr>
</tbody>
</table>
JAXB Umarshaller error
JAXB Umarshaller error
I am trying to generate Object from XML using JAXB. First, I created the
objects out of supplied schema and packaged them into 1 .jar. Now I am
using this simple test program (after it refused to work with Jersey):
import org.editeur.ns.onix._3_0.reference.*;
public class Mapping {
public static void main(String[] args) {
System.out.println("Please enter the Onix message:");
BufferedReader reader = new BufferedReader(new
InputStreamReader(System.in));
try {
String request = reader.readLine();
request.trim();
StringReader stringReader = new StringReader(request);
JAXBContext context =
JAXBContext.newInstance("org.editeur.ns.onix._3_0.reference");
Unmarshaller unmarshaller = context.createUnmarshaller();
ONIXMessage message = (ONIXMessage)
unmarshaller.unmarshal(stringReader);
stringReader.close();
//System.out.println(message.getHeader().getSentDateTime());
//System.out.println(message.getHeader().getMessageNote().get(0).getValue());
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
I use the following test XML-string (withouts spaces or line breaks):
<?xml version="1.0" encoding="UTF-8"?><ONIXMessage
release="3.0"><Header><Sender><SenderName>Global
Bookinfo</SenderName><ContactName>Jane King, +1 555 321
7654</ContactName><EmailAddress>jbk@globalbookinfo.com</EmailAddress></Sender><Addressee><AddresseeName>BooksBooksBooks.com</AddresseeName></Addressee><MessageNumber>231</MessageNumber><SentDateTime>20100510T1115-0400</SentDateTime><MessageNote>Sample
message</MessageNote></Header><Product><RecordReference>com.globalbookinfo.onix.01734529</RecordReference><NotificationType>03</NotificationType><RecordSourceType>04</RecordSourceType><RecordSourceIdentifier><RecordSourceIDType>06</RecordSourceIDType><IDValue>0614141800001</IDValue></RecordSourceIdentifier><RecordSourceName>Global
Bookinfo</RecordSourceName><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>9780007232833</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>15</ProductIDType><IDValue>9780007232833</IDValue></ProductIdentifier></Product></ONIXMessage>
But it gives me the same error:
javax.xml.bind.UnmarshalException: unexpected element (uri:"",
local:"ONIXMessage"). Expected elements are
<{http://ns.editeur.org/onix/3.0/reference}Addressee>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeIDType>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeIdentifier>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeName>,<{http://ns.editeur.org/onix/3.0/reference}Affiliation>,<{http://ns.editeur.org/onix/3.0/reference}AgentIDType>,<{http://ns.editeur.org/onix/3.0/reference}AgentIdentifier>,<{http://ns.editeur.org/onix/3.0/reference}AgentName>,<{http://ns.editeur.org/onix/3.0/reference}AgentRole>,<{http://ns.editeur.org/onix/3.0/reference}AlternativeName>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContent>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContentDescription>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContentType>,<{http://ns.editeur.org/onix/3.0/reference}Audience>,<{http://ns.editeur.org/onix/3.0/reference}AudienceCode>
...
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:648)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:236)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:231)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1051)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:484)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:135)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:194)
at Mapping.main(Mapping.java:19)
When I was generating classes with XJC, no problems were detected. But
when parsing XML, it seems to ask for a correct element. But according to
the Schema, the first element (root) is ONIXMessage tag, which is there.
When I am using Jersey, it does not even show anything - just returns null
contents of ONIXMessage root tag.
What is wrong? How can I fix it? Any help appreciated.
I am trying to generate Object from XML using JAXB. First, I created the
objects out of supplied schema and packaged them into 1 .jar. Now I am
using this simple test program (after it refused to work with Jersey):
import org.editeur.ns.onix._3_0.reference.*;
public class Mapping {
public static void main(String[] args) {
System.out.println("Please enter the Onix message:");
BufferedReader reader = new BufferedReader(new
InputStreamReader(System.in));
try {
String request = reader.readLine();
request.trim();
StringReader stringReader = new StringReader(request);
JAXBContext context =
JAXBContext.newInstance("org.editeur.ns.onix._3_0.reference");
Unmarshaller unmarshaller = context.createUnmarshaller();
ONIXMessage message = (ONIXMessage)
unmarshaller.unmarshal(stringReader);
stringReader.close();
//System.out.println(message.getHeader().getSentDateTime());
//System.out.println(message.getHeader().getMessageNote().get(0).getValue());
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
I use the following test XML-string (withouts spaces or line breaks):
<?xml version="1.0" encoding="UTF-8"?><ONIXMessage
release="3.0"><Header><Sender><SenderName>Global
Bookinfo</SenderName><ContactName>Jane King, +1 555 321
7654</ContactName><EmailAddress>jbk@globalbookinfo.com</EmailAddress></Sender><Addressee><AddresseeName>BooksBooksBooks.com</AddresseeName></Addressee><MessageNumber>231</MessageNumber><SentDateTime>20100510T1115-0400</SentDateTime><MessageNote>Sample
message</MessageNote></Header><Product><RecordReference>com.globalbookinfo.onix.01734529</RecordReference><NotificationType>03</NotificationType><RecordSourceType>04</RecordSourceType><RecordSourceIdentifier><RecordSourceIDType>06</RecordSourceIDType><IDValue>0614141800001</IDValue></RecordSourceIdentifier><RecordSourceName>Global
Bookinfo</RecordSourceName><ProductIdentifier><ProductIDType>03</ProductIDType><IDValue>9780007232833</IDValue></ProductIdentifier><ProductIdentifier><ProductIDType>15</ProductIDType><IDValue>9780007232833</IDValue></ProductIdentifier></Product></ONIXMessage>
But it gives me the same error:
javax.xml.bind.UnmarshalException: unexpected element (uri:"",
local:"ONIXMessage"). Expected elements are
<{http://ns.editeur.org/onix/3.0/reference}Addressee>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeIDType>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeIdentifier>,<{http://ns.editeur.org/onix/3.0/reference}AddresseeName>,<{http://ns.editeur.org/onix/3.0/reference}Affiliation>,<{http://ns.editeur.org/onix/3.0/reference}AgentIDType>,<{http://ns.editeur.org/onix/3.0/reference}AgentIdentifier>,<{http://ns.editeur.org/onix/3.0/reference}AgentName>,<{http://ns.editeur.org/onix/3.0/reference}AgentRole>,<{http://ns.editeur.org/onix/3.0/reference}AlternativeName>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContent>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContentDescription>,<{http://ns.editeur.org/onix/3.0/reference}AncillaryContentType>,<{http://ns.editeur.org/onix/3.0/reference}Audience>,<{http://ns.editeur.org/onix/3.0/reference}AudienceCode>
...
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:648)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:236)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:231)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1051)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:484)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:135)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200)
at
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:194)
at Mapping.main(Mapping.java:19)
When I was generating classes with XJC, no problems were detected. But
when parsing XML, it seems to ask for a correct element. But according to
the Schema, the first element (root) is ONIXMessage tag, which is there.
When I am using Jersey, it does not even show anything - just returns null
contents of ONIXMessage root tag.
What is wrong? How can I fix it? Any help appreciated.
Google Maps - "App won't run unless you update Google Play services"
Google Maps - "App won't run unless you update Google Play services"
I'm just trying to run the simple Google Maps tutorial here:
https://developers.google.com/maps/documentation/android/start
I'm running my app on my Nexus 4, and I receive the "update Google Play
services" message with an Update button. When I click the Update button,
it takes me to the Google Play services app on the Play Store, but it
appears that it's updated to the latest version.
Is there anything else I might be missing?
Android Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ridenotifier"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.example.ridenotifier.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.ridenotifier.ContactListActivity"
android:label="@string/title_activity_contact_list" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyATNKboMr-94m9GUWOlLkEgApQW4uvh4Js"
/>
</application>
</manifest>
I'm just trying to run the simple Google Maps tutorial here:
https://developers.google.com/maps/documentation/android/start
I'm running my app on my Nexus 4, and I receive the "update Google Play
services" message with an Update button. When I click the Update button,
it takes me to the Google Play services app on the Play Store, but it
appears that it's updated to the latest version.
Is there anything else I might be missing?
Android Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ridenotifier"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.example.ridenotifier.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.ridenotifier.ContactListActivity"
android:label="@string/title_activity_contact_list" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyATNKboMr-94m9GUWOlLkEgApQW4uvh4Js"
/>
</application>
</manifest>
Tuesday, 17 September 2013
R- Display value with aggregate
R- Display value with aggregate
I have a dataframe in R with the following variables:
DateTime year dayYear diameter dendro
I want to calculate the min diameter for each day of the year for each
dendrometer, so I used aggregate:
dailymin <- aggregate(diameter~year+dayYear+dendro, FUN=min, data=myData)
However, I also need the time when the min diameter happened at each day
and dendro. Therefore, I need to keep the info contained in the variable
DateTime in the row of each min. Thanks for helping me.
I have a dataframe in R with the following variables:
DateTime year dayYear diameter dendro
I want to calculate the min diameter for each day of the year for each
dendrometer, so I used aggregate:
dailymin <- aggregate(diameter~year+dayYear+dendro, FUN=min, data=myData)
However, I also need the time when the min diameter happened at each day
and dendro. Therefore, I need to keep the info contained in the variable
DateTime in the row of each min. Thanks for helping me.
How to query the element and other nodes of the XML through scanf inputs for searching? Using C console MSXML
How to query the element and other nodes of the XML through scanf inputs
for searching? Using C console MSXML
How to query the element and other nodes of the XML through scanf inputs
for searching? Using C++ console MSXML
for searching? Using C console MSXML
How to query the element and other nodes of the XML through scanf inputs
for searching? Using C++ console MSXML
Java making LinkedList from scratch [on hold]
Java making LinkedList from scratch [on hold]
I have a project due tomorrow for my class involving adts and really
haven't started yet.
I need to design a structure that looks like this (almost exactly as
displayed in the UML) does anyone know any reading/websites that are easy
to access and can get the point across. He gave us this assignment with
very little information on the subject. Basically it involves making a
linked list with an array
I have a project due tomorrow for my class involving adts and really
haven't started yet.
I need to design a structure that looks like this (almost exactly as
displayed in the UML) does anyone know any reading/websites that are easy
to access and can get the point across. He gave us this assignment with
very little information on the subject. Basically it involves making a
linked list with an array
Executing VIM commands in a shell script
Executing VIM commands in a shell script
I am writing a bash script that runs a command line program (Gromacs),
saves the results, modifies the input files, and then loops through the
process again. I am trying to use VIM to modify the input text files, but
I have not been able to find a way to execute internal VIM commands like
:1234, w, x, dd, ect. from the .sh file after opening my input files in
VIM ("vim conf.gro").
Is there any practical way to execute VIM commands from the shell script?
I am writing a bash script that runs a command line program (Gromacs),
saves the results, modifies the input files, and then loops through the
process again. I am trying to use VIM to modify the input text files, but
I have not been able to find a way to execute internal VIM commands like
:1234, w, x, dd, ect. from the .sh file after opening my input files in
VIM ("vim conf.gro").
Is there any practical way to execute VIM commands from the shell script?
Where are math.py and sys.py?
Where are math.py and sys.py?
I found all the other modules in Python33/Lib, but I can't find these. I'm
sure there are others "missing" too, but these are the only ones I've
noticed. They work just fine when I import them, I just can't find them. I
checked sys.path and they weren't anywhere in there. Are they built-in or
something?
I found all the other modules in Python33/Lib, but I can't find these. I'm
sure there are others "missing" too, but these are the only ones I've
noticed. They work just fine when I import them, I just can't find them. I
checked sys.path and they weren't anywhere in there. Are they built-in or
something?
Failure of image in middle of sequence to load
Failure of image in middle of sequence to load
I have a list of images in a database. Under user control, they are
selected one at a time. After sizing other elements on the screen
appropriately, the latest user selected image is displayed via a java
script function that resizes the page and loads the image via
document.getElementById("prodSlideShowImage").src =svi;
where prodSlideShowImage is the same div for all images and svi is the
relative location on the disk of the current image. All the data
associated with the image is displayed properly on the page but not the
image. I have been in Firebug and determined that all the data base image
name and ancillary data were appropriately downloaded after the ajax call.
There are ten images in my test data base. They all work except for the
fourth and the ninth. I have checked the directory on the web server to be
sure they are there and are the same size as the ones on my localhost
(XAMPP with Windows7). (This code runs correctly on my local server).
User interface timing does not seem to be a problems. I have tried varying
speeds and always get the same result.
I could really use any suggestions that someone might make.
Thanks in advance for your help.
Ann Maybury ann.maybury@gmail.com
I have a list of images in a database. Under user control, they are
selected one at a time. After sizing other elements on the screen
appropriately, the latest user selected image is displayed via a java
script function that resizes the page and loads the image via
document.getElementById("prodSlideShowImage").src =svi;
where prodSlideShowImage is the same div for all images and svi is the
relative location on the disk of the current image. All the data
associated with the image is displayed properly on the page but not the
image. I have been in Firebug and determined that all the data base image
name and ancillary data were appropriately downloaded after the ajax call.
There are ten images in my test data base. They all work except for the
fourth and the ninth. I have checked the directory on the web server to be
sure they are there and are the same size as the ones on my localhost
(XAMPP with Windows7). (This code runs correctly on my local server).
User interface timing does not seem to be a problems. I have tried varying
speeds and always get the same result.
I could really use any suggestions that someone might make.
Thanks in advance for your help.
Ann Maybury ann.maybury@gmail.com
Sunday, 15 September 2013
TDS SQL Querying: Asynchronous Approach
TDS SQL Querying: Asynchronous Approach
I'm using: Node.js, MS-SQL, tedious TDS implementation for Node.js
Essentially, I have an array of items. I need to lookup each item in an
SQL-based database via TDS protocol and
Extract column data for each item
Identify items which arn't found in the database
The problem is that the queries are asynchronous in the sense that I need
to wait for the response of a query before sending the next one. So my
options are:
Wait. Wait for each query-response for each item in the array to execute
back-to-back.
Do something like SELECT <cols> FROM <table> WHERE <key> IN <the array> to
do a single query, then leave it up to me to efficiently try to match
items in my array to returned rows
Something better?
Thoughts? Ideally I'd like an asynchronous solution where I can send off a
query for each item in the array at the same time, process separate
request as they come in, and continue once all request-response pairs are
completed.
I'm using: Node.js, MS-SQL, tedious TDS implementation for Node.js
Essentially, I have an array of items. I need to lookup each item in an
SQL-based database via TDS protocol and
Extract column data for each item
Identify items which arn't found in the database
The problem is that the queries are asynchronous in the sense that I need
to wait for the response of a query before sending the next one. So my
options are:
Wait. Wait for each query-response for each item in the array to execute
back-to-back.
Do something like SELECT <cols> FROM <table> WHERE <key> IN <the array> to
do a single query, then leave it up to me to efficiently try to match
items in my array to returned rows
Something better?
Thoughts? Ideally I'd like an asynchronous solution where I can send off a
query for each item in the array at the same time, process separate
request as they come in, and continue once all request-response pairs are
completed.
Android pause async task after network lost
Android pause async task after network lost
I am using an AsyncTask where I download images using HttpUrlConnection.Im
using a BroacastReciever to listen to connectivity changes. I want to know
how I can pause it when network is lost and continue it after regaining
the connectivity. It would be helpful if anyone can provide some
snippet/code.
Thank you.
I am using an AsyncTask where I download images using HttpUrlConnection.Im
using a BroacastReciever to listen to connectivity changes. I want to know
how I can pause it when network is lost and continue it after regaining
the connectivity. It would be helpful if anyone can provide some
snippet/code.
Thank you.
Cahnge default style of MS Access elements
Cahnge default style of MS Access elements
When I add any element (control like text box, label etc) to my form, it
has default style as:
Font: Calibri (Detail) Font Size: 11 Fore Color: Text 2, Lighter 40%
How is it possible to change that, I need MS Sans Serif, 8, Black for
default.
Thanks!
When I add any element (control like text box, label etc) to my form, it
has default style as:
Font: Calibri (Detail) Font Size: 11 Fore Color: Text 2, Lighter 40%
How is it possible to change that, I need MS Sans Serif, 8, Black for
default.
Thanks!
jquery - On Paste, Getting input value not working
jquery - On Paste, Getting input value not working
I have been trying to get the value of an input of paste, but it always
returns nothing:
$('form#post-game :input[name="header"]').keyup(function(){
var str = $(this).val();
IsImageValid(str, "#post-game-img-header");
});
$(document).on('paste','form#post-game :input[name="header"]',function(e) {
var str = $('form#post-game :input[name="header"]').val();
IsImageValid(str, "#post-game-img-header"); // there is a console log
in this function
});
The keyup works fine, But the paste does not.
I have been trying to get the value of an input of paste, but it always
returns nothing:
$('form#post-game :input[name="header"]').keyup(function(){
var str = $(this).val();
IsImageValid(str, "#post-game-img-header");
});
$(document).on('paste','form#post-game :input[name="header"]',function(e) {
var str = $('form#post-game :input[name="header"]').val();
IsImageValid(str, "#post-game-img-header"); // there is a console log
in this function
});
The keyup works fine, But the paste does not.
Saving Expression Tree to a File
Saving Expression Tree to a File
I want to debug an expression and save the expression tree to a file:
var generator = DebugInfoGenerator.CreatePdbGenerator();
var document = Expression.SymbolDocument(fileName: "MyDebug.txt");
var debugInfo = Expression.DebugInfo(document, 6, 9, 6, 22);
var expressionBlock = Expression.Block(debugInfo, fooExpression);
var lambda = Expression.Lambda(expressionBlock, parameters);
lambda.CompileToMethod(method, generator);
var bakedType = type.CreateType();
return (type)bakedType.GetMethod(method.Name).Invoke(null, parameters);
How can I find or save "MyDebug.txt"?
I want to debug an expression and save the expression tree to a file:
var generator = DebugInfoGenerator.CreatePdbGenerator();
var document = Expression.SymbolDocument(fileName: "MyDebug.txt");
var debugInfo = Expression.DebugInfo(document, 6, 9, 6, 22);
var expressionBlock = Expression.Block(debugInfo, fooExpression);
var lambda = Expression.Lambda(expressionBlock, parameters);
lambda.CompileToMethod(method, generator);
var bakedType = type.CreateType();
return (type)bakedType.GetMethod(method.Name).Invoke(null, parameters);
How can I find or save "MyDebug.txt"?
angularjs custom directives value change
angularjs custom directives value change
I have the following code (it does not work on jsfiddle but it does if you
save it as index.html)
<!DOCTYPE html>
<html ng-app="app">
<head>
<script type="text/javascript"
src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.min.js"></script>
<script>
var photos = [
{"url":"http://archive.vetknowledge.com/files/images/guinea-pig---tan.jpg"},
{"url":"http://www.rfadventures.com/images/Animals/Mammals/guinea%20pig.jpg"}
];
angular.module('app', [])
.directive('ngBackground', function(){
return function(scope, element, attrs){
var url = attrs.ngBackground;
element.css({
'background-image': 'url(' + url + ')',
'background-size' : 'cover'
});
};
})
.controller('PhotosCtrl', function($scope){
$scope.photos = photos;
$scope.flags = {
modalOpen: false,
imgSrc: null
};
$scope.doModal = function(url){
if(url != false) {
$scope.flags.imgSrc = url;
$scope.flags.modalOpen = true;
} else $scope.flags.modalOpen = false;
};
$scope.sourcifier = function(url){
var temp = document.createElement('a');
temp.href = url;
if(temp.hostname.substring(0, 4) == 'www.')
return temp.hostname.substring(4);
else return temp.hostname;
};
});
</script>
</head>
<body>
<div ng-controller="PhotosCtrl">
<div ng-repeat="photo in photos" class="item">
<img ng-src="{{photo.url}}" ng-click="doModal(photo.url)">
<p><a ng-href="{{photo.url}}"
target="_blank">{{sourcifier(photo.url)}}</a></p>
</div>
<div ng-show="flags.modalOpen" ng-click="doModal(false)">
<div ng-background="{{flags.imgSrc}}">my background should be of
the clicked image</div>
</div>
</div>
</body>
</html>
That basically loads the images form the array "photos" and displays them.
What I am trying to achieve is to use a custom created ng-background
directive to change the background image of a div to the clicked image
src.
It does not work at all! Now, I amsure that flags.imgSrc is correct, since
if I use ng-src on an img tag, it does work. It seems more like that the
custom directive ng-background does not "refresh" the value of that flag.
Any ideas why and how this could be fixed? Thanks in advance.
I have the following code (it does not work on jsfiddle but it does if you
save it as index.html)
<!DOCTYPE html>
<html ng-app="app">
<head>
<script type="text/javascript"
src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.min.js"></script>
<script>
var photos = [
{"url":"http://archive.vetknowledge.com/files/images/guinea-pig---tan.jpg"},
{"url":"http://www.rfadventures.com/images/Animals/Mammals/guinea%20pig.jpg"}
];
angular.module('app', [])
.directive('ngBackground', function(){
return function(scope, element, attrs){
var url = attrs.ngBackground;
element.css({
'background-image': 'url(' + url + ')',
'background-size' : 'cover'
});
};
})
.controller('PhotosCtrl', function($scope){
$scope.photos = photos;
$scope.flags = {
modalOpen: false,
imgSrc: null
};
$scope.doModal = function(url){
if(url != false) {
$scope.flags.imgSrc = url;
$scope.flags.modalOpen = true;
} else $scope.flags.modalOpen = false;
};
$scope.sourcifier = function(url){
var temp = document.createElement('a');
temp.href = url;
if(temp.hostname.substring(0, 4) == 'www.')
return temp.hostname.substring(4);
else return temp.hostname;
};
});
</script>
</head>
<body>
<div ng-controller="PhotosCtrl">
<div ng-repeat="photo in photos" class="item">
<img ng-src="{{photo.url}}" ng-click="doModal(photo.url)">
<p><a ng-href="{{photo.url}}"
target="_blank">{{sourcifier(photo.url)}}</a></p>
</div>
<div ng-show="flags.modalOpen" ng-click="doModal(false)">
<div ng-background="{{flags.imgSrc}}">my background should be of
the clicked image</div>
</div>
</div>
</body>
</html>
That basically loads the images form the array "photos" and displays them.
What I am trying to achieve is to use a custom created ng-background
directive to change the background image of a div to the clicked image
src.
It does not work at all! Now, I amsure that flags.imgSrc is correct, since
if I use ng-src on an img tag, it does work. It seems more like that the
custom directive ng-background does not "refresh" the value of that flag.
Any ideas why and how this could be fixed? Thanks in advance.
Switching two activities
Switching two activities
I am new to Android apps development. I have a question on switching two
activities. I followed a youtube for switching two activities:
http://www.youtube.com/watch?v=0wz0bM-xy3M
But when I enter those code as shown in the bottom for my next class
NextActivity.java,
I noticed that I have three mistakes.......
protected void onCreate(Bundle savedInstanceState) - The method
onCreate(Bundle) of type NextActivity must override or implement a
supertype method
super.onCreate(savedInstanceState)-The method onCreate() in the type
Application is not applicable for the arguments (Bundle)
setContentView(R.layout.next) - The method setContentView(int) is
undefined for the type NextActivity
What's mistakes do I make? Thanks a lot!
package gorilla3d.activitytutorial;
import android.app.Application;
import android.os.Bundle;
public class NextActivity extends Application {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.next);
}
}
I am new to Android apps development. I have a question on switching two
activities. I followed a youtube for switching two activities:
http://www.youtube.com/watch?v=0wz0bM-xy3M
But when I enter those code as shown in the bottom for my next class
NextActivity.java,
I noticed that I have three mistakes.......
protected void onCreate(Bundle savedInstanceState) - The method
onCreate(Bundle) of type NextActivity must override or implement a
supertype method
super.onCreate(savedInstanceState)-The method onCreate() in the type
Application is not applicable for the arguments (Bundle)
setContentView(R.layout.next) - The method setContentView(int) is
undefined for the type NextActivity
What's mistakes do I make? Thanks a lot!
package gorilla3d.activitytutorial;
import android.app.Application;
import android.os.Bundle;
public class NextActivity extends Application {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.next);
}
}
Saturday, 14 September 2013
Need part of my content moving left
Need part of my content moving left
once selected which type of bet they have done, then number of winners,
the actual calculator is center of the screen.
I need this shifting slightly to the left to it is more in line with the
buttons themselves.
http://freebetoffersonline.com/bet-calc.php
once selected which type of bet they have done, then number of winners,
the actual calculator is center of the screen.
I need this shifting slightly to the left to it is more in line with the
buttons themselves.
http://freebetoffersonline.com/bet-calc.php
Save cropped area as image
Save cropped area as image
I have code that allows me to obtain four coordinates:
initial_x initial_y final_x final_y
This coords form a rectangle which allows to crop the body of a website
(all the area within the rectangle). My question is how can you save this
cropped area as a file (export it to the machine likewise .jpeg for
example) or just allocate memory from the browser to perform this task
temporarily? This runs on javascript html and css
I have code that allows me to obtain four coordinates:
initial_x initial_y final_x final_y
This coords form a rectangle which allows to crop the body of a website
(all the area within the rectangle). My question is how can you save this
cropped area as a file (export it to the machine likewise .jpeg for
example) or just allocate memory from the browser to perform this task
temporarily? This runs on javascript html and css
How programming block in java?
How programming block in java?
I try copy data from file to file but each 32 bytes for one translate also
the copy shuld be integer number translate like the following
byte[] block = new byte[32];
FileInputStream fis = new FileInputStream(clearmsg);
FileOutputStream fcs = new FileOutputStream(ciphermsg);
int i;
while ((i = fis.read(block)) != -1) {
BigInteger M2 = new BigInteger(block);
byte[] block2=new byte[32] ;
block2 = M2.toString().getBytes();
fos.write(block2, 0, i);
}
fos.close();
but when run this part and take M2.bitLength() it give me 255 bits Why any
suggest
I try copy data from file to file but each 32 bytes for one translate also
the copy shuld be integer number translate like the following
byte[] block = new byte[32];
FileInputStream fis = new FileInputStream(clearmsg);
FileOutputStream fcs = new FileOutputStream(ciphermsg);
int i;
while ((i = fis.read(block)) != -1) {
BigInteger M2 = new BigInteger(block);
byte[] block2=new byte[32] ;
block2 = M2.toString().getBytes();
fos.write(block2, 0, i);
}
fos.close();
but when run this part and take M2.bitLength() it give me 255 bits Why any
suggest
Qt: QMenu does not work on Linux
Qt: QMenu does not work on Linux
I have added a QMenu to QMainWindow like this:
boost::scoped_ptr<QMenu> file_menu;
file_menu.reset(menuBar()->addMenu("&File"));
file_menu->addAction(my_action1.get());
file_menu->addAction(my_action2.get());
...
And it works perfectly on Windows but not on Linux. The "File" menu
appears on the window but nothing happens if I click it.
The Qt version is 4.7.3 and I use Ubuntu 11.04 via VirtualBox 4.1.2.
I have added a QMenu to QMainWindow like this:
boost::scoped_ptr<QMenu> file_menu;
file_menu.reset(menuBar()->addMenu("&File"));
file_menu->addAction(my_action1.get());
file_menu->addAction(my_action2.get());
...
And it works perfectly on Windows but not on Linux. The "File" menu
appears on the window but nothing happens if I click it.
The Qt version is 4.7.3 and I use Ubuntu 11.04 via VirtualBox 4.1.2.
Create Case in MS CRM 2011 from post on Facebook page
Create Case in MS CRM 2011 from post on Facebook page
Goal: Create case from post on facebook page
Is it possible to create records in CRM when people post on facebook page ?
Goal: Create case from post on facebook page
Is it possible to create records in CRM when people post on facebook page ?
Using the move method part of the Point-Java
Using the move method part of the Point-Java
So I am using the move method part of the Point. I was wonder how I would
move the point with out changing the angle or the length. Could I get
examples of how I would do this.
So I am using the move method part of the Point. I was wonder how I would
move the point with out changing the angle or the length. Could I get
examples of how I would do this.
Friday, 13 September 2013
Get max and min of object values from JavaScript array
Get max and min of object values from JavaScript array
What is the best way to get the maximum and minimum values from a
JavaScript array of objects?
Given:
var a = [{x:1,y:0},{x:-1,y:10},{x:12,y:20},{x:61,y:10}];
var minX = Infinity, maxX = -Infinity;
for( var x in a ){
if( minX > a[x].x )
minX = a[x].x;
if( minX < a[x].x )
maxX = a[x].x;
}
Seems a bit clumsy. Is there a more elegant way, perhaps using dojo?
What is the best way to get the maximum and minimum values from a
JavaScript array of objects?
Given:
var a = [{x:1,y:0},{x:-1,y:10},{x:12,y:20},{x:61,y:10}];
var minX = Infinity, maxX = -Infinity;
for( var x in a ){
if( minX > a[x].x )
minX = a[x].x;
if( minX < a[x].x )
maxX = a[x].x;
}
Seems a bit clumsy. Is there a more elegant way, perhaps using dojo?
MySQL WRITE hangs on spring hibernate application
MySQL WRITE hangs on spring hibernate application
not sure where to start in my research.
Recently I have moved my hard drives to a new server. My old server used
to be one core just 4GB RAM. Now I am running 8 cores 32GB RAM. MySQL
version 5.0.77. I have SPring Hibernate setup. Here is a configuration
file
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
primary="true">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://host:port"/>
<property name="user" value="xxx"/>
<property name="password" value="xxx"/>
<property name="minPoolSize" value="2"/>
<property name="maxPoolSize" value="50"/>
<property name="maxIdleTime" value="3600"/>
<property name="maxStatements" value="500"/>
<property name="automaticTestTable" value="pool_test"/>
<property name="idleConnectionTestPeriod" value="120"/>
So everything seems to be fine, however recently I started to get strange
issue. When I login into the website, its all working, but when I try to
SAVE stuff it hangs. I am looking at the Java Melody monitoring and it
shows me lots of hanged current requests. Looking at the my sql
connections, all of them are SLEEP.
Can it be maybe the MySQL server has to be update? THis is never happened
before on the old server. Any clue where I can start looking ? Thanks in a
advance
not sure where to start in my research.
Recently I have moved my hard drives to a new server. My old server used
to be one core just 4GB RAM. Now I am running 8 cores 32GB RAM. MySQL
version 5.0.77. I have SPring Hibernate setup. Here is a configuration
file
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
primary="true">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://host:port"/>
<property name="user" value="xxx"/>
<property name="password" value="xxx"/>
<property name="minPoolSize" value="2"/>
<property name="maxPoolSize" value="50"/>
<property name="maxIdleTime" value="3600"/>
<property name="maxStatements" value="500"/>
<property name="automaticTestTable" value="pool_test"/>
<property name="idleConnectionTestPeriod" value="120"/>
So everything seems to be fine, however recently I started to get strange
issue. When I login into the website, its all working, but when I try to
SAVE stuff it hangs. I am looking at the Java Melody monitoring and it
shows me lots of hanged current requests. Looking at the my sql
connections, all of them are SLEEP.
Can it be maybe the MySQL server has to be update? THis is never happened
before on the old server. Any clue where I can start looking ? Thanks in a
advance
iPython Notebook does not appear after upgrading to 1.0/1.1
iPython Notebook does not appear after upgrading to 1.0/1.1
iPython notebook worked fine with python(x,y) installation which includes
ipython 0.13.2-2. After upgrading to 1.0 and now 1.1, the notebook opens a
blank page in the browser with backend messages like the following:
2013-09-13 18:10:04.236 [tornado.access] WARNING | 404 GET
/static/components/jq uery-ui/themes/smoothness/jquery-ui.min.css
(127.0.0.1) 0.00ms WARNING:tornado.access:404 GET
/static/components/jquery-ui/themes/smoothness/jq uery-ui.min.css
(127.0.0.1) 0.00ms 2013-09-13 18:10:04.236 [tornado.access] WARNING | 404
GET /static/components/re quirejs/require.js (127.0.0.1) 0.00ms
WARNING:tornado.access:404 GET /static/components/requirejs/require.js
(127.0.0. 1) 0.00ms 2013-09-13 18:10:04.252 [tornado.access] WARNING | 404
GET /static/components/jq uery-ui/ui/minified/jquery-ui.min.js (127.0.0.1)
0.00ms WARNING:tornado.access:404 GET
/static/components/jquery-ui/ui/minified/jquery-u i.min.js (127.0.0.1)
0.00ms 2013-09-13 18:10:04.252 [tornado.access] WARNING | 404 GET
/static/components/bo otstrap/bootstrap/js/bootstrap.min.js (127.0.0.1)
0.00ms ...
I first tried to install from a local git repository for python 1.0 that I
copied over. Because this is a corporate machine, I am somewhat strapped
on installation flexibility. I came back to the issue when 1.1 was
released and attempted to install from the 1.1 zip for windows. Same
result in both cases.
What do these message imply?
iPython notebook worked fine with python(x,y) installation which includes
ipython 0.13.2-2. After upgrading to 1.0 and now 1.1, the notebook opens a
blank page in the browser with backend messages like the following:
2013-09-13 18:10:04.236 [tornado.access] WARNING | 404 GET
/static/components/jq uery-ui/themes/smoothness/jquery-ui.min.css
(127.0.0.1) 0.00ms WARNING:tornado.access:404 GET
/static/components/jquery-ui/themes/smoothness/jq uery-ui.min.css
(127.0.0.1) 0.00ms 2013-09-13 18:10:04.236 [tornado.access] WARNING | 404
GET /static/components/re quirejs/require.js (127.0.0.1) 0.00ms
WARNING:tornado.access:404 GET /static/components/requirejs/require.js
(127.0.0. 1) 0.00ms 2013-09-13 18:10:04.252 [tornado.access] WARNING | 404
GET /static/components/jq uery-ui/ui/minified/jquery-ui.min.js (127.0.0.1)
0.00ms WARNING:tornado.access:404 GET
/static/components/jquery-ui/ui/minified/jquery-u i.min.js (127.0.0.1)
0.00ms 2013-09-13 18:10:04.252 [tornado.access] WARNING | 404 GET
/static/components/bo otstrap/bootstrap/js/bootstrap.min.js (127.0.0.1)
0.00ms ...
I first tried to install from a local git repository for python 1.0 that I
copied over. Because this is a corporate machine, I am somewhat strapped
on installation flexibility. I came back to the issue when 1.1 was
released and attempted to install from the 1.1 zip for windows. Same
result in both cases.
What do these message imply?
PHP password_hash() maximum password length?
PHP password_hash() maximum password length?
What is the maximum password length I can use with PHP 5.5 password_hash() ?
What is the maximum password length I can use with PHP 5.5 password_hash() ?
i just need a div to be shown when on submit of form errors arise just like yahoo login
i just need a div to be shown when on submit of form errors arise just
like yahoo login
i want the to be displayed when i didnt find any record in the databaase
<div id="error">Record not found in the database</div>
<form action="login.php" method="get">
<div id="block">
<label id="user" for="name">p</label>
<input type="text" name="username" id="name"
placeholder="Username" required/>
<label id="pass" for="password">k</label>
<input type="password" name="password" id="password"
placeholder="Password" required />
<input type="submit" id="submit" name="submit" value="a"/>
</div>
</form>`enter code here`
like yahoo login
i want the to be displayed when i didnt find any record in the databaase
<div id="error">Record not found in the database</div>
<form action="login.php" method="get">
<div id="block">
<label id="user" for="name">p</label>
<input type="text" name="username" id="name"
placeholder="Username" required/>
<label id="pass" for="password">k</label>
<input type="password" name="password" id="password"
placeholder="Password" required />
<input type="submit" id="submit" name="submit" value="a"/>
</div>
</form>`enter code here`
Regex to match MAC address and also extract it's values
Regex to match MAC address and also extract it's values
I'm trying to first check if a string confirms the format of a MAC
address, and if it does I would like to extract all the byte values out of
the string.
So far I wrote this, and it successfully matches if the format of a mac
address is correct or not:
mac_regx = re.compile(r'^([0-9A-F]{1,2})(\:[0-9A-F]{1,2}){5}$',
re.IGNORECASE)
But when I use this regex to extract the byte values, I'm only getting the
first and the last one:
(Pdb) print(mac_regx.findall('aa:bb:cc:dd:ee:ff'))
[('aa', ':ff')]
I know I could simply split by : and that would do the job. I was just
hoping to be able to do both, the matching and value extraction, in only
one step with one regex.
I'm trying to first check if a string confirms the format of a MAC
address, and if it does I would like to extract all the byte values out of
the string.
So far I wrote this, and it successfully matches if the format of a mac
address is correct or not:
mac_regx = re.compile(r'^([0-9A-F]{1,2})(\:[0-9A-F]{1,2}){5}$',
re.IGNORECASE)
But when I use this regex to extract the byte values, I'm only getting the
first and the last one:
(Pdb) print(mac_regx.findall('aa:bb:cc:dd:ee:ff'))
[('aa', ':ff')]
I know I could simply split by : and that would do the job. I was just
hoping to be able to do both, the matching and value extraction, in only
one step with one regex.
html special symbols is displayed as characters
html special symbols is displayed as characters
I've been trying to set content of a text input dynamically using JS, the
problem I encountered is I can not have the browser render the special
symbols rather than chars so for example
document.getElementById("textField").value = "nbsp";
Instead of displaying a space it displays  , anybody got any idea?
Thanks a lot
I've been trying to set content of a text input dynamically using JS, the
problem I encountered is I can not have the browser render the special
symbols rather than chars so for example
document.getElementById("textField").value = "nbsp";
Instead of displaying a space it displays  , anybody got any idea?
Thanks a lot
Thursday, 12 September 2013
smtp Error in code igniter
smtp Error in code igniter
I am trying to send a password reset link to user using the smtp in
codeigniter with following configurations
$config = Array('protocol' => 'smtp',
'smtp_host' => 'my-host',
'smtp_user' => 'user',
'smtp_port' =>25,
'smtp_pass' => '********',
'_smtp_auth'=>TRUE,
'mailtype' => 'text',
'charset'=> 'iso-8859-1'
);
$this->load->library('email',$config);
$this->email->to($address);
$this->email->from($from);
$this->email->subject($subject);
$this->email->message($message);
$res=$this->email->send();
echo $this->email->print_debugger();
but following error are print by debugger.I am not getting what the actual
problem is.
220-vps.hostjinniwebhosting.com ESMTP Exim 4.80.1 #2 Fri, 13 Sep 2013
09:48:37 +0530
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
<br /><pre>hello: 250-vps.hostjinniwebhosting.com Hello tv100.info
[66.225.213.151]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
</pre><pre>from: 250 OK
</pre><pre>to: 501 <>: missing or malformed local part
</pre>The following SMTP error was encountered: 501 <>: missing or
malformed local part
<br /><pre>data: 503-All RCPT commands were rejected with this error:
503-501 <>: missing or malformed local part
503 Valid RCPT command must precede DATA
</pre>The following SMTP error was encountered: 503-All RCPT commands were
rejected with this error:
503-501 <>: missing or malformed local part
503 Valid RCPT command must precede DATA
<br />500 unrecognized command
<br />The following SMTP error was encountered: 500 unrecognized command
<br />Unable to send email using PHP SMTP. Your server might not be
configured to send mail using this method.<br /><pre>User-Agent:
CodeIgniter
Date: Thu, 12 Sep 2013 23:18:37 -0500
From: <tv100@tv100.com>
Return-Path: <tv100@tv100.com>
Subject: =?iso-8859-1?Q?Reset_your_password?=
Reply-To: "tv100@tv100.com" <tv100@tv100.com>
X-Sender: tv100@tv100.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5232921db117e@tv100.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
please someone tell me whats wrong with this...
I am trying to send a password reset link to user using the smtp in
codeigniter with following configurations
$config = Array('protocol' => 'smtp',
'smtp_host' => 'my-host',
'smtp_user' => 'user',
'smtp_port' =>25,
'smtp_pass' => '********',
'_smtp_auth'=>TRUE,
'mailtype' => 'text',
'charset'=> 'iso-8859-1'
);
$this->load->library('email',$config);
$this->email->to($address);
$this->email->from($from);
$this->email->subject($subject);
$this->email->message($message);
$res=$this->email->send();
echo $this->email->print_debugger();
but following error are print by debugger.I am not getting what the actual
problem is.
220-vps.hostjinniwebhosting.com ESMTP Exim 4.80.1 #2 Fri, 13 Sep 2013
09:48:37 +0530
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
<br /><pre>hello: 250-vps.hostjinniwebhosting.com Hello tv100.info
[66.225.213.151]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
</pre><pre>from: 250 OK
</pre><pre>to: 501 <>: missing or malformed local part
</pre>The following SMTP error was encountered: 501 <>: missing or
malformed local part
<br /><pre>data: 503-All RCPT commands were rejected with this error:
503-501 <>: missing or malformed local part
503 Valid RCPT command must precede DATA
</pre>The following SMTP error was encountered: 503-All RCPT commands were
rejected with this error:
503-501 <>: missing or malformed local part
503 Valid RCPT command must precede DATA
<br />500 unrecognized command
<br />The following SMTP error was encountered: 500 unrecognized command
<br />Unable to send email using PHP SMTP. Your server might not be
configured to send mail using this method.<br /><pre>User-Agent:
CodeIgniter
Date: Thu, 12 Sep 2013 23:18:37 -0500
From: <tv100@tv100.com>
Return-Path: <tv100@tv100.com>
Subject: =?iso-8859-1?Q?Reset_your_password?=
Reply-To: "tv100@tv100.com" <tv100@tv100.com>
X-Sender: tv100@tv100.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5232921db117e@tv100.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
please someone tell me whats wrong with this...
getting values from column in database
getting values from column in database
I am getting values from the column "threadid" in the database.Problem is
that it gets the value from the previous record/row. and when I try to get
the first record my app crashes,, How to tackle this problem and whats the
issue?
long id;
long threadid = datasource.getthreadid(id);
Toast.makeText(getActivity(), String.valueOf(threadid),
Toast.LENGTH_SHORT).show();
public long getthreadid(long id)
{
String ide=String.valueOf(id);
String queryz = "SELECT " + MySQLiteHelper.COLUMN_THREADID
+ " FROM " + MySQLiteHelper.TABLE_NAME
+ " WHERE " + MySQLiteHelper.COLUMN_ID + "=" + ide;
Cursor cursor = database.rawQuery(queryz, null);
cursor.moveToFirst();
// cursor.moveToPosition(Integer.parseInt(String.valueOf(id)));
long threadid= cursor.getLong(cursor.getColumnIndex("threadid"));
cursor.close();
return threadid;
}
I am getting values from the column "threadid" in the database.Problem is
that it gets the value from the previous record/row. and when I try to get
the first record my app crashes,, How to tackle this problem and whats the
issue?
long id;
long threadid = datasource.getthreadid(id);
Toast.makeText(getActivity(), String.valueOf(threadid),
Toast.LENGTH_SHORT).show();
public long getthreadid(long id)
{
String ide=String.valueOf(id);
String queryz = "SELECT " + MySQLiteHelper.COLUMN_THREADID
+ " FROM " + MySQLiteHelper.TABLE_NAME
+ " WHERE " + MySQLiteHelper.COLUMN_ID + "=" + ide;
Cursor cursor = database.rawQuery(queryz, null);
cursor.moveToFirst();
// cursor.moveToPosition(Integer.parseInt(String.valueOf(id)));
long threadid= cursor.getLong(cursor.getColumnIndex("threadid"));
cursor.close();
return threadid;
}
Royal Slider Different Color Thumbnails
Royal Slider Different Color Thumbnails
I am trying to change the color of each thumbnail below the slider on the
wordpress royal slider plugin. At the moment they are all the same color.
Here is my HTML markup
<div class="rsTmb">
{{html}}
</div>
And here is the html code from each off my slides
<a class="rsImg" href="imageurl.png" data-
rsVideo="videorul">title goes here</a>
<div class="rsTmb" style="background:#108FD2">title goes here</div>
Can someone help me have set it up so that i have individual colors for
each off the tabs
I am trying to change the color of each thumbnail below the slider on the
wordpress royal slider plugin. At the moment they are all the same color.
Here is my HTML markup
<div class="rsTmb">
{{html}}
</div>
And here is the html code from each off my slides
<a class="rsImg" href="imageurl.png" data-
rsVideo="videorul">title goes here</a>
<div class="rsTmb" style="background:#108FD2">title goes here</div>
Can someone help me have set it up so that i have individual colors for
each off the tabs
Firefox 3D transforms and z-index
Firefox 3D transforms and z-index
I created flipping cards that based on CSS transitions and transforms, but
it has a few rendering glitches in various browsers when card is flipping.
Live example
In Firefox the top card which is animates overlaps by the under cards.
In Chrome the card is flickering when animates.
backface-visibility:hidden and transform-style:preserve-3d are specified,
and everything else seems to be okay.
Maybe there's some other CSS/JS hack?
Thanks
I created flipping cards that based on CSS transitions and transforms, but
it has a few rendering glitches in various browsers when card is flipping.
Live example
In Firefox the top card which is animates overlaps by the under cards.
In Chrome the card is flickering when animates.
backface-visibility:hidden and transform-style:preserve-3d are specified,
and everything else seems to be okay.
Maybe there's some other CSS/JS hack?
Thanks
How to change the text color of a fadeIn div?
How to change the text color of a fadeIn div?
I have the following working script that run on load.
$("div.fadeinWrapper").fadeIn(3000);
When the fadeIn is completed, I want to use animate function to change the
color of a span inside the div, from #000000 to #FF0000. How I do that?
I have the following working script that run on load.
$("div.fadeinWrapper").fadeIn(3000);
When the fadeIn is completed, I want to use animate function to change the
color of a span inside the div, from #000000 to #FF0000. How I do that?
SIP client register periodically with server
SIP client register periodically with server
I have written a SIP client with a SIP SDK that you can get online.
Classic SIP stuff: you register with SIP server, make calls, get called
... This works all fine, but suppose that the SIP server restarts or for
some other reason loses the registration of your SIP client. Now other
clients can't call you because you are not found on the SIP server.
How is this handled? Do you periodically send another register message
even if you're registered? Every 10 minutes or something like that? Do you
first unregister then (which means for some time in between you're not
reachable, would not be good) and then register or can you call register
when you're already registered without problems?
I've also found register/options keep-alive messaging, but I'm not sure
what its purpose is, can it handle this scenario where the sip server no
longer has your registration? Is it always supported by the sip-servers?
I have written a SIP client with a SIP SDK that you can get online.
Classic SIP stuff: you register with SIP server, make calls, get called
... This works all fine, but suppose that the SIP server restarts or for
some other reason loses the registration of your SIP client. Now other
clients can't call you because you are not found on the SIP server.
How is this handled? Do you periodically send another register message
even if you're registered? Every 10 minutes or something like that? Do you
first unregister then (which means for some time in between you're not
reachable, would not be good) and then register or can you call register
when you're already registered without problems?
I've also found register/options keep-alive messaging, but I'm not sure
what its purpose is, can it handle this scenario where the sip server no
longer has your registration? Is it always supported by the sip-servers?
Wednesday, 11 September 2013
Cross Browser issue for ajax file upload
Cross Browser issue for ajax file upload
Here is my jquery method:
function upload_profile_picture() {
$('#profile_image_upload').click();
var fileInput = $('#profile_image_upload');
var fileData = fileInput.prop("files")[0];
var formData = new window.FormData();
formData.append("file", fileData);
var imagePath = '';
$.ajax({
url: '/ImageHandler.ashx',
data: formData,
processData: false,
contentType: false,
type: 'POST',
success: function (data) {
var obj = $.parseJSON(data);
if (obj.StatusCode == "OK") {
imagePath = obj.Path;
log(imagePath);
$('#profile_image').attr('src', '/img/profile/' + imagePath);
} else if (obj.StatusCode == "ERROR") {
log("Unsuccesful profile picture upload. Message: " +
obj.Message);
}
},
error: function (errorData) {
log("Unsuccesful profile picture upload. " + errorData);
}
});
}
When user clicks on an image, I'm calling the javascript function above.
But it behaves different in Internet Explorer and Chrome (latest
versions). In Internet Explorer when the following line executed:
$('#profile_image_upload').click();
the following hidden input opens the dialog to choose the file to upload.
<input id="profile_image_upload" class="hidden" type="file">
and the rest of the function is not being executed until user selects a
file or cancels the dialog.
Inversely in chrome, I see that the lines after the first one are being
executed before users selects the file.
What do I have to do to fix this?
Thanks in advance,
Here is my jquery method:
function upload_profile_picture() {
$('#profile_image_upload').click();
var fileInput = $('#profile_image_upload');
var fileData = fileInput.prop("files")[0];
var formData = new window.FormData();
formData.append("file", fileData);
var imagePath = '';
$.ajax({
url: '/ImageHandler.ashx',
data: formData,
processData: false,
contentType: false,
type: 'POST',
success: function (data) {
var obj = $.parseJSON(data);
if (obj.StatusCode == "OK") {
imagePath = obj.Path;
log(imagePath);
$('#profile_image').attr('src', '/img/profile/' + imagePath);
} else if (obj.StatusCode == "ERROR") {
log("Unsuccesful profile picture upload. Message: " +
obj.Message);
}
},
error: function (errorData) {
log("Unsuccesful profile picture upload. " + errorData);
}
});
}
When user clicks on an image, I'm calling the javascript function above.
But it behaves different in Internet Explorer and Chrome (latest
versions). In Internet Explorer when the following line executed:
$('#profile_image_upload').click();
the following hidden input opens the dialog to choose the file to upload.
<input id="profile_image_upload" class="hidden" type="file">
and the rest of the function is not being executed until user selects a
file or cancels the dialog.
Inversely in chrome, I see that the lines after the first one are being
executed before users selects the file.
What do I have to do to fix this?
Thanks in advance,
Regex: characters following a slash and ending before a hyphen
Regex: characters following a slash and ending before a hyphen
I've been playing around with regex for a bit and regex visualizations,
but have had no luck in generating something that will match a section of
a url that is text of variable length preceeded by a forward slash and
terminated by a hyphen. What expression would do this?
www.lamp.com/;alskfjdlkfja;sdlkfjasldfj-209
but not
www.lamp.com/a;slkfja;sdlkfjas;dflkj
because that doesn't contain a hyphen
I've been playing around with regex for a bit and regex visualizations,
but have had no luck in generating something that will match a section of
a url that is text of variable length preceeded by a forward slash and
terminated by a hyphen. What expression would do this?
www.lamp.com/;alskfjdlkfja;sdlkfjasldfj-209
but not
www.lamp.com/a;slkfja;sdlkfjas;dflkj
because that doesn't contain a hyphen
BasePage in ASP.Net
BasePage in ASP.Net
i want to create a base class page that has all the scripts, link, and
icon in it and i have this so far
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace VGD.Client
{
public class BasePage : Page
{
public new string Title { get; set; }
protected override void FrameworkInitialize()
{
Controls.Add(ParseControl("<!DOCTYPE html>"));
Controls.Add(ParseControl("<html lang='en'>"));
Controls.Add(ParseControl(head()));
Controls.Add(ParseControl(upperBody()));
base.FrameworkInitialize();
}
protected override void OnPreRender(EventArgs e)
{
Controls.Add(ParseControl(lowerBody()));
base.OnPreRender(e);
}
private string head()
{
string _retVal = @"<head id='Head1' runat='server'>
<title>" + Title + @"</title>
</head>";
return _retVal;
}
private string upperBody()
{
string _retVal = @"<body>
<form runat='server'>";
return _retVal;
}
private string lowerBody()
{
string _retVal = @"</form>
</body>
</html>";
return _retVal;
}
}
}
but upon the initialize, it throws an error that Unexpected end of file
looking for </form> tag.
i separated the upperBody() and lowerBody() so that the content of
Home.aspx will be added in between the upperBody() and lowerBody() upon
creating the page.
any help please.
i want to create a base class page that has all the scripts, link, and
icon in it and i have this so far
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace VGD.Client
{
public class BasePage : Page
{
public new string Title { get; set; }
protected override void FrameworkInitialize()
{
Controls.Add(ParseControl("<!DOCTYPE html>"));
Controls.Add(ParseControl("<html lang='en'>"));
Controls.Add(ParseControl(head()));
Controls.Add(ParseControl(upperBody()));
base.FrameworkInitialize();
}
protected override void OnPreRender(EventArgs e)
{
Controls.Add(ParseControl(lowerBody()));
base.OnPreRender(e);
}
private string head()
{
string _retVal = @"<head id='Head1' runat='server'>
<title>" + Title + @"</title>
</head>";
return _retVal;
}
private string upperBody()
{
string _retVal = @"<body>
<form runat='server'>";
return _retVal;
}
private string lowerBody()
{
string _retVal = @"</form>
</body>
</html>";
return _retVal;
}
}
}
but upon the initialize, it throws an error that Unexpected end of file
looking for </form> tag.
i separated the upperBody() and lowerBody() so that the content of
Home.aspx will be added in between the upperBody() and lowerBody() upon
creating the page.
any help please.
Wordpress: Can I trigger the previews autosave?
Wordpress: Can I trigger the previews autosave?
I guess a fairly straight forward question:
For my current assignment, I had to hijack wordpress's preview button (on
the edit post page). That I resolved and have my code working. The problem
is, to keep wordpress from popping up its newview window, I had to
interrupt all the javascript originally hooked to the preview button.
Of course, this also means when the preview button is pushed now, autosave
isn't triggering. I'd like for the save to still happen so the preview
shows the latest data. Any advice? I can copy my code in to help sort it
out.
I guess a fairly straight forward question:
For my current assignment, I had to hijack wordpress's preview button (on
the edit post page). That I resolved and have my code working. The problem
is, to keep wordpress from popping up its newview window, I had to
interrupt all the javascript originally hooked to the preview button.
Of course, this also means when the preview button is pushed now, autosave
isn't triggering. I'd like for the save to still happen so the preview
shows the latest data. Any advice? I can copy my code in to help sort it
out.
Java service with multiple child thread
Java service with multiple child thread
ps -ef | grep 426
root 4260 587 0 Apr17 ? 00:00:00 [bnx2i_thread/4]
root 4261 587 0 Apr17 ? 00:00:00 [bnx2i_thread/5]
root 4262 587 0 Apr17 ? 00:00:00 [bnx2i_thread/6]
root 4263 587 0 Apr17 ? 00:00:00 [bnx2i_thread/7]
root 4264 587 0 Apr17 ? 00:00:00 [bnx2i_thread/8]
root 4265 587 0 Apr17 ? 00:00:00 [bnx2i_thread/9]
root 4267 587 0 Apr17 ? 00:00:00 [bnx2i_thread/10]
root 4268 587 0 Apr17 ? 00:00:00 [bnx2i_thread/11]
root 4269 587 0 Apr17 ? 00:00:00 [bnx2i_thread/12]
Please help me understand this output of ps command with given pid. I was
trying to check if service is running or not.
ps -ef | grep 426
root 4260 587 0 Apr17 ? 00:00:00 [bnx2i_thread/4]
root 4261 587 0 Apr17 ? 00:00:00 [bnx2i_thread/5]
root 4262 587 0 Apr17 ? 00:00:00 [bnx2i_thread/6]
root 4263 587 0 Apr17 ? 00:00:00 [bnx2i_thread/7]
root 4264 587 0 Apr17 ? 00:00:00 [bnx2i_thread/8]
root 4265 587 0 Apr17 ? 00:00:00 [bnx2i_thread/9]
root 4267 587 0 Apr17 ? 00:00:00 [bnx2i_thread/10]
root 4268 587 0 Apr17 ? 00:00:00 [bnx2i_thread/11]
root 4269 587 0 Apr17 ? 00:00:00 [bnx2i_thread/12]
Please help me understand this output of ps command with given pid. I was
trying to check if service is running or not.
Python find coninuous interesctions of intervals
Python find coninuous interesctions of intervals
I tired multiple approaches, but failed to do this one job. All of them
use only 2 lists or range of lists. The one most promising was:
infile = open('file','r')
for line in infile:
line = line.split()
f = range(int(line[0]),int(line[1]))
results_union = set().union(*f)
print results_union
I have a file with start,end positions like this: (sorted)
1 5
1 3
1 2
2 4
3 6
9 11
9 16
12 17
I would like the output to be:
1 6
9 17
I tired multiple approaches, but failed to do this one job. All of them
use only 2 lists or range of lists. The one most promising was:
infile = open('file','r')
for line in infile:
line = line.split()
f = range(int(line[0]),int(line[1]))
results_union = set().union(*f)
print results_union
I have a file with start,end positions like this: (sorted)
1 5
1 3
1 2
2 4
3 6
9 11
9 16
12 17
I would like the output to be:
1 6
9 17
C mmap + BZ2_bzDecompress way slower than bzip2 command
C mmap + BZ2_bzDecompress way slower than bzip2 command
I'm using mmap + BZ2_bzDecompress to sequentially decompress a large file
(29GB). This is done because I need to parse the uncompressed xml data,
but only need small bits of it, and it seemed like it would be way more
efficient to do this sequentially than to uncompress the whole file (400GB
uncompressed) and then parse it. Interestingly already the decompression
part is extremely slow - while the shell command bzip2 is able to do a bit
more than 52MB per second (used several runs of timeout 10 bzip2 -c -k -d
input.bz2 > output and divided produced filesize by 10), my program is
able to do not even 2MB/s, slowing down after a few seconds to 1.2MB/s
The file I'm trying to process uses multiple bz2 streams, so I'm checking
BZ2_bzDecompress for BZ_STREAM_END, and if it occurs, use
BZ2_bzDecompressEnd( strm ); and BZ2_bzDecompressInit( strm, 0, 0 ) to
restart with the next stream, in case the file hasn't been completely
processed. I also tried without BZ2_bzDecompressEnd but that didn't change
anything (and I can't really see in the documentation how one should
handle multiple streams correctly)
The file is being mmap'ed before, where I also tried different
combinations of flags, currently MAP_RDONLY + MAP_PRIVATE with madvise to
MADV_SEQUENTIAL | MADV_WILLNEED | MADV_HUGEPAGE (I'm checking return
value, and madvise does not report any problems, and I'm on a linux kernel
3.2x debian setup which has hugepage support)
When profiling I made sure that other than some counters for measuring
speed and a printf which was limited to once every n iterations, nothing
else was run. Also this is on a modern multicore server processor where
all other cores where idle, and it's bare metal, not virtualized.
Any ideas on what I could be doing wrong / do to improve performance?
I'm using mmap + BZ2_bzDecompress to sequentially decompress a large file
(29GB). This is done because I need to parse the uncompressed xml data,
but only need small bits of it, and it seemed like it would be way more
efficient to do this sequentially than to uncompress the whole file (400GB
uncompressed) and then parse it. Interestingly already the decompression
part is extremely slow - while the shell command bzip2 is able to do a bit
more than 52MB per second (used several runs of timeout 10 bzip2 -c -k -d
input.bz2 > output and divided produced filesize by 10), my program is
able to do not even 2MB/s, slowing down after a few seconds to 1.2MB/s
The file I'm trying to process uses multiple bz2 streams, so I'm checking
BZ2_bzDecompress for BZ_STREAM_END, and if it occurs, use
BZ2_bzDecompressEnd( strm ); and BZ2_bzDecompressInit( strm, 0, 0 ) to
restart with the next stream, in case the file hasn't been completely
processed. I also tried without BZ2_bzDecompressEnd but that didn't change
anything (and I can't really see in the documentation how one should
handle multiple streams correctly)
The file is being mmap'ed before, where I also tried different
combinations of flags, currently MAP_RDONLY + MAP_PRIVATE with madvise to
MADV_SEQUENTIAL | MADV_WILLNEED | MADV_HUGEPAGE (I'm checking return
value, and madvise does not report any problems, and I'm on a linux kernel
3.2x debian setup which has hugepage support)
When profiling I made sure that other than some counters for measuring
speed and a printf which was limited to once every n iterations, nothing
else was run. Also this is on a modern multicore server processor where
all other cores where idle, and it's bare metal, not virtualized.
Any ideas on what I could be doing wrong / do to improve performance?
Tuesday, 10 September 2013
What conditions can be used to derive as which for loop in java is most efficient?
What conditions can be used to derive as which for loop in java is most
efficient?
I have been trying to evaluate the performance of for loop.
I had a look at this and this.
But I have not yet understood what is the correct way to measure the
performance of for loops.
Should we also consider inserting some elements in the data structure like
ArrayList?
efficient?
I have been trying to evaluate the performance of for loop.
I had a look at this and this.
But I have not yet understood what is the correct way to measure the
performance of for loops.
Should we also consider inserting some elements in the data structure like
ArrayList?
How to store video streaming as a video file in java
How to store video streaming as a video file in java
Question is just like title. How can I store video streaming as file?
are there any recommandable libraries or methods? A sample code will be
very greeted. Thanks.
Question is just like title. How can I store video streaming as file?
are there any recommandable libraries or methods? A sample code will be
very greeted. Thanks.
Select Subviews With Tap in Xcode
Select Subviews With Tap in Xcode
I'm adding several (from 2 to 4) subviews to my View. I want to know, what
I need to do to tap in any of my subviews, and identify which subview was
selected and change its background color...
I'm adding several (from 2 to 4) subviews to my View. I want to know, what
I need to do to tap in any of my subviews, and identify which subview was
selected and change its background color...
Regex pattern to match three different things
Regex pattern to match three different things
I need help to create 4 regex patterns to match 4 different things in a
block of text.
This is the block of text (the names are irrelevant):
[2013/8/27 - 20:44:3] AdmCmd: Damian Santos was fined $1000 by Scott
Parker, reason: BH(8-27-2013)
[2013/8/29 - 21:56:49] AdmCmd: Jimmy Greiner was fined $304389 by Scott
Parker, reason: LOL(8-29-2013)
[2013/8/29 - 22:4:54] AdmCmd: Jimmy Greiner has been jailed by Scott
Parker, reason: LOL(8-29-2013)
[2013/8/29 - 22:5:38] AdmCmd: Jimmy Greiner has been released from prison
by Scott Parker, reason: TS(8-29-2013)
[2013/8/29 - 22:42:55] AdmCmd: James McAdams has been released from prison
by Damian Santos, reason: test(8-29-2013)
[2013/8/30 - 20:17:23] AdmCmd: James McAdams has been released from prison
by Scott Parker, reason: TS(8-30-2013)
[2013/8/30 - 20:26:15] AdmCmd: James McAdams has been jailed by Jimmy
Greiner, reason: Test(8-30-2013)
[2013/8/30 - 20:26:37] AdmCmd: James McAdams has been released from prison
by Scott Parker, reason: Test(8-30-2013)
[2013/8/31 - 11:35:35] AdmCmd: Scott Parker was fined $5000 by Scott
Parker, reason: BH(8-31-2013)
[2013/8/31 - 11:36:0] AdmCmd: Scott Parker was fined $5000 by Scott
Parker, reason: BH(8-31-2013)
[2013/8/31 - 11:36:49] AdmCmd: Damian Santos was fined $5000 by Scott
Parker, reason: UNRP driving(8-31-2013)
I need to match the names who were: fined, released or jailed. I got a
pattern for this one already:
[A-Za-z ]+(?=was|has)
I need the name of the person who issued one of these actions (the names
near the end of each sentence). I tried to get a pattern for it, but I
can't exclude the "by" word:
(?=by)[A-Za-z ]+(?=,)
I didn't try a pattern for the reason (without the date) and the date,
which are both located at the end. I need them cut clean via a nice
pattern.
I would appreciate some help.
Thank you.
I need help to create 4 regex patterns to match 4 different things in a
block of text.
This is the block of text (the names are irrelevant):
[2013/8/27 - 20:44:3] AdmCmd: Damian Santos was fined $1000 by Scott
Parker, reason: BH(8-27-2013)
[2013/8/29 - 21:56:49] AdmCmd: Jimmy Greiner was fined $304389 by Scott
Parker, reason: LOL(8-29-2013)
[2013/8/29 - 22:4:54] AdmCmd: Jimmy Greiner has been jailed by Scott
Parker, reason: LOL(8-29-2013)
[2013/8/29 - 22:5:38] AdmCmd: Jimmy Greiner has been released from prison
by Scott Parker, reason: TS(8-29-2013)
[2013/8/29 - 22:42:55] AdmCmd: James McAdams has been released from prison
by Damian Santos, reason: test(8-29-2013)
[2013/8/30 - 20:17:23] AdmCmd: James McAdams has been released from prison
by Scott Parker, reason: TS(8-30-2013)
[2013/8/30 - 20:26:15] AdmCmd: James McAdams has been jailed by Jimmy
Greiner, reason: Test(8-30-2013)
[2013/8/30 - 20:26:37] AdmCmd: James McAdams has been released from prison
by Scott Parker, reason: Test(8-30-2013)
[2013/8/31 - 11:35:35] AdmCmd: Scott Parker was fined $5000 by Scott
Parker, reason: BH(8-31-2013)
[2013/8/31 - 11:36:0] AdmCmd: Scott Parker was fined $5000 by Scott
Parker, reason: BH(8-31-2013)
[2013/8/31 - 11:36:49] AdmCmd: Damian Santos was fined $5000 by Scott
Parker, reason: UNRP driving(8-31-2013)
I need to match the names who were: fined, released or jailed. I got a
pattern for this one already:
[A-Za-z ]+(?=was|has)
I need the name of the person who issued one of these actions (the names
near the end of each sentence). I tried to get a pattern for it, but I
can't exclude the "by" word:
(?=by)[A-Za-z ]+(?=,)
I didn't try a pattern for the reason (without the date) and the date,
which are both located at the end. I need them cut clean via a nice
pattern.
I would appreciate some help.
Thank you.
Using SQL views in asp.net dynamic data site
Using SQL views in asp.net dynamic data site
I've spent a fair while googling and haven't been able to get a definitive
answer to this.
I'm reasonable new to asp.net but have created a dynamic data site which
is all working when i use database tables in my dbml, however if i try and
link to a view in the database it is automatically displayed by the
scaffolding but no hyperlink to the table it links to.
Is this possible?
An example of what i'm working with:
This works:
TableA: id
TableB: id, TableA_id
When i view Table A, i get a field with "View TableBs", When i look at
TableB i see a link to "TableA"
However when i have this:
ViewA: id
TableB: id, ViewA_id
Looking at ViewA in the browser there's nothing for TableB, Looking at
TableB i can see ViewA_id but it's just text and not a link.
I've tried creating a partial class and using the UiHint(ForiegnKey) but
this gave an error (assuming because it's not a real FK field in the DB).
Thanks in advance!
I've spent a fair while googling and haven't been able to get a definitive
answer to this.
I'm reasonable new to asp.net but have created a dynamic data site which
is all working when i use database tables in my dbml, however if i try and
link to a view in the database it is automatically displayed by the
scaffolding but no hyperlink to the table it links to.
Is this possible?
An example of what i'm working with:
This works:
TableA: id
TableB: id, TableA_id
When i view Table A, i get a field with "View TableBs", When i look at
TableB i see a link to "TableA"
However when i have this:
ViewA: id
TableB: id, ViewA_id
Looking at ViewA in the browser there's nothing for TableB, Looking at
TableB i can see ViewA_id but it's just text and not a link.
I've tried creating a partial class and using the UiHint(ForiegnKey) but
this gave an error (assuming because it's not a real FK field in the DB).
Thanks in advance!
how to add cutom color in to fabric image filteration in fabric js
how to add cutom color in to fabric image filteration in fabric js
This is my code
$('invert').onclick = function() {
alert("invert");[enter link description here][1]
applyFilter(0, this.click && new f.Sepia());
};
how can i add this custom color insted of applyFilter(0, this.click && new
f.Sepia());
var $ = function(id){return document.getElementById(id)};
function applyFilter(index, filter) {
var obj = canvas.getActiveObject();
obj.filters[index] = filter;
obj.applyFilters(canvas.renderAll.bind(canvas));
}
function applyFilterValue(index, prop, value) {
var obj = canvas.getActiveObject();
if (obj.filters[index]) {
obj.filters[index][prop] = value;
obj.applyFilters(canvas.renderAll.bind(canvas));
}
}
canvas.on({
'object:selected': function() {
fabric.util.toArray(document.getElementsByTagName('input'))
.forEach(function(el){ el.disabled = false; })
var filters = [ 'invert'];
for (var i = 0; i < filters.length; i++) {
$(filters[i]).checked = !!canvas.getActiveObject().filters[i];
}
},
'selection:cleared': function() {
fabric.util.toArray(document.getElementsByTagName('input'))
.forEach(function(el){ el.disabled = true; })
}
});
fabric.Image.fromURL('google.jpg', function(img) {
var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9);
canvas.add(oImg).renderAll();
canvas.setActiveObject(oImg);
});
$('invert').onclick = function() {
alert("invert");[enter link description here][1]
applyFilter(0, this.click && new f.Sepia());
};
when user can upload there image and he can change their custom color
This is my code
$('invert').onclick = function() {
alert("invert");[enter link description here][1]
applyFilter(0, this.click && new f.Sepia());
};
how can i add this custom color insted of applyFilter(0, this.click && new
f.Sepia());
var $ = function(id){return document.getElementById(id)};
function applyFilter(index, filter) {
var obj = canvas.getActiveObject();
obj.filters[index] = filter;
obj.applyFilters(canvas.renderAll.bind(canvas));
}
function applyFilterValue(index, prop, value) {
var obj = canvas.getActiveObject();
if (obj.filters[index]) {
obj.filters[index][prop] = value;
obj.applyFilters(canvas.renderAll.bind(canvas));
}
}
canvas.on({
'object:selected': function() {
fabric.util.toArray(document.getElementsByTagName('input'))
.forEach(function(el){ el.disabled = false; })
var filters = [ 'invert'];
for (var i = 0; i < filters.length; i++) {
$(filters[i]).checked = !!canvas.getActiveObject().filters[i];
}
},
'selection:cleared': function() {
fabric.util.toArray(document.getElementsByTagName('input'))
.forEach(function(el){ el.disabled = true; })
}
});
fabric.Image.fromURL('google.jpg', function(img) {
var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9);
canvas.add(oImg).renderAll();
canvas.setActiveObject(oImg);
});
$('invert').onclick = function() {
alert("invert");[enter link description here][1]
applyFilter(0, this.click && new f.Sepia());
};
when user can upload there image and he can change their custom color
I want to know why the navigation div is not occupying 100% height
I want to know why the navigation div is not occupying 100% height
I have a sample page as shown below
HTML code:
<div class="container">
<div class="header floatL width100p">
<h2>
Header
</h2>
</div>
<div class="content floatL width100p">
<div class="floatL width29p npv">
<p>navigation div</p>
</div>
<div class="floatL width70p rtb">
<div class="floatL width100p ql">
<p>
div one
</p>
<p>Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since the
1500s
</p>
</div>
<div class="floatL width100p mtbs">
<p>
div two
</p>
<p>
Lorem Ipsum is simply dummy text of the printing
and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the
1500s
</p>
</div>
<div class="floatL width100p widdiv">
<div class="floatL width100p">
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
</div>
<div class="floatL width100p">
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="footer floatL width100p">
<h2>
Footer
</h2>
</div>
<div class="clear"></div>
</div>
The styles are:
*,html{
margin: 0;
padding: 0;
}
.container{
width:960px;
margin:20px auto;
}
.header h2,.footer h2{
text-align: center;
}
.floatL{
float: left;
}
.floatR{
float: right;
}
.clear{
clear:both;
}
.width100p{
width: 100%;
}
.width29p{
width: 29%;
}
.width70p{
width: 70.8%;
}
.header,.footer,.content{
border:1px solid;
}
.npv{
border-right: 1px solid;
height: 100%;
}
.ql,.mtbs{
border-bottom: 1px solid;
}
.width40p{
width: 40%;
}
.incont{
margin: 4%;
background: #ccc;
border:1px solid red;
}
I would like to know why the left navigation div is not occupying 100%
height as you can see by running the above code.
Any help would be appreciated. It is urgent...
I have a sample page as shown below
HTML code:
<div class="container">
<div class="header floatL width100p">
<h2>
Header
</h2>
</div>
<div class="content floatL width100p">
<div class="floatL width29p npv">
<p>navigation div</p>
</div>
<div class="floatL width70p rtb">
<div class="floatL width100p ql">
<p>
div one
</p>
<p>Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since the
1500s
</p>
</div>
<div class="floatL width100p mtbs">
<p>
div two
</p>
<p>
Lorem Ipsum is simply dummy text of the printing
and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the
1500s
</p>
</div>
<div class="floatL width100p widdiv">
<div class="floatL width100p">
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
</div>
<div class="floatL width100p">
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
<div class="floatL width40p incont">
<p>
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy
text ever since the 1500s
</p>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="footer floatL width100p">
<h2>
Footer
</h2>
</div>
<div class="clear"></div>
</div>
The styles are:
*,html{
margin: 0;
padding: 0;
}
.container{
width:960px;
margin:20px auto;
}
.header h2,.footer h2{
text-align: center;
}
.floatL{
float: left;
}
.floatR{
float: right;
}
.clear{
clear:both;
}
.width100p{
width: 100%;
}
.width29p{
width: 29%;
}
.width70p{
width: 70.8%;
}
.header,.footer,.content{
border:1px solid;
}
.npv{
border-right: 1px solid;
height: 100%;
}
.ql,.mtbs{
border-bottom: 1px solid;
}
.width40p{
width: 40%;
}
.incont{
margin: 4%;
background: #ccc;
border:1px solid red;
}
I would like to know why the left navigation div is not occupying 100%
height as you can see by running the above code.
Any help would be appreciated. It is urgent...
Monday, 9 September 2013
$location.path not working when using third party library with AngularJS
$location.path not working when using third party library with AngularJS
I am building an application using AngularJS where all the API call to the
web service is carrying out by a third party JavaScript file.
Here is my controller code;
app.controller('LoginCtrl', function ($scope, $location,FlashService,
$http) {
var MyAPI = new MyAppAPI("http://localhost/myapp");
$scope.logout = function () {
var data = FluentXS.logout();
if(data) {
localStorage.removeItem('session_id');
$location.path('/login').replace();
$scope.$apply()
FlashService.show(data.statusMessage);
}
};
});
Here is my JavaScript file from which API call is making;
function FluentXSApi (url) {
this.baseUrl =url
this.serviceData = function(method,path, async, body, callback){
if(method=='GET')
{
return jQuery.ajax({
url: path,
async: async,
dataType:'json',
success: function(data){callback(data)},
error: function(e){console.log(e)}
});
}
else if(method=='POST')
{
return $.ajax({
url: path,
type : 'POST',
async: async,
contentType : 'application/json',
data: JSON.stringify(body),
dataType: 'json',
success: function(data){callback(data)},
error: function(e){console.log(e)}
});
}
};
this.logout = function() {
var dataTemplates;
var httpMethod='GET';
var path =
this.baseUrl+"/api/user/logout.{format}".replace(/{format}/g,'json');
//alert(path);
this.serviceData(httpMethod,path, false, null, function (data) {
dataTemplates = data;
return dataTemplates;
}
When I am trying this $location.path is not at all working and console is
throwing an error $apply already in progress. What am I doing wrong here?.
I am building an application using AngularJS where all the API call to the
web service is carrying out by a third party JavaScript file.
Here is my controller code;
app.controller('LoginCtrl', function ($scope, $location,FlashService,
$http) {
var MyAPI = new MyAppAPI("http://localhost/myapp");
$scope.logout = function () {
var data = FluentXS.logout();
if(data) {
localStorage.removeItem('session_id');
$location.path('/login').replace();
$scope.$apply()
FlashService.show(data.statusMessage);
}
};
});
Here is my JavaScript file from which API call is making;
function FluentXSApi (url) {
this.baseUrl =url
this.serviceData = function(method,path, async, body, callback){
if(method=='GET')
{
return jQuery.ajax({
url: path,
async: async,
dataType:'json',
success: function(data){callback(data)},
error: function(e){console.log(e)}
});
}
else if(method=='POST')
{
return $.ajax({
url: path,
type : 'POST',
async: async,
contentType : 'application/json',
data: JSON.stringify(body),
dataType: 'json',
success: function(data){callback(data)},
error: function(e){console.log(e)}
});
}
};
this.logout = function() {
var dataTemplates;
var httpMethod='GET';
var path =
this.baseUrl+"/api/user/logout.{format}".replace(/{format}/g,'json');
//alert(path);
this.serviceData(httpMethod,path, false, null, function (data) {
dataTemplates = data;
return dataTemplates;
}
When I am trying this $location.path is not at all working and console is
throwing an error $apply already in progress. What am I doing wrong here?.
Subscribe to:
Comments (Atom)