Will changing an events Time-Zone affect other people on shared events?
If I were to normalize an EKEvent 's startDate property using a
NSFormatter or by setting the time zone with
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"hh:mm a"];
[formatter setTimeZone:[NSTimeZone systemTimeZone]];
event.startDate = [formatter dateFromString:[NSString
stringWithFormat:@"%@", [event.startDate]]];
and I later make a change to that event requiring me to call
[self.event.eventStore saveEvent:currentEvent span:EKSpanThisEvent
commit:YES error:nil];
Would it override the time-zone on the server, causing issues for the
person (whom uses GCal) in another state that originally created that
shared calendar event, or is it just a local change?
Saturday, 31 August 2013
iOS how to use .p12 certification?
iOS how to use .p12 certification?
my teacher only gave me a .p12 certification but no developer account. How
can I use it to test my app on the real device? Even publish the app?
Thanks!
my teacher only gave me a .p12 certification but no developer account. How
can I use it to test my app on the real device? Even publish the app?
Thanks!
How to get /, /article to map to same action in PHP Slim
How to get /, /article to map to same action in PHP Slim
I want to map two routes : / and /articles to the same action list_articles.
I tried using this code but it's not working.
$app->get('/:route', function () use($app, $layout) {
echo "test"
})->conditions(array("route" => "(/|articles)"))->name('list_articles');
What am I typing wrong?
I want to map two routes : / and /articles to the same action list_articles.
I tried using this code but it's not working.
$app->get('/:route', function () use($app, $layout) {
echo "test"
})->conditions(array("route" => "(/|articles)"))->name('list_articles');
What am I typing wrong?
How do i make the iphone smaller? [on hold]
How do i make the iphone smaller? [on hold]
i would like to know if anyone could help me and tell me, how i can make
this iphone plugin smaller?
http://www.awesom-media.de/umgebung/test.html ( my website)
and here is the direct link where i got it from
http://tympanus.net/Development/3DEffectMobileShowcase/
i would like to know if anyone could help me and tell me, how i can make
this iphone plugin smaller?
http://www.awesom-media.de/umgebung/test.html ( my website)
and here is the direct link where i got it from
http://tympanus.net/Development/3DEffectMobileShowcase/
H1's are floating into post above in Wordpress theme
H1's are floating into post above in Wordpress theme
I just noticed that on the Wordpress theme I created the H1 article titles
are floating up into the subsequent article when you start to shrink the
browser window. I can't seem to find the reason for this. Any insights
would be greatly appreciated.
ul.info li, .excerpt, .post-link {
float: left;
}
The styles above seem to be pushing the title of the article up but if I
remove it then "posted by, written on, date" all turn into a horizontal
list. Which I don't want.
I don't know if they're related by I noticed when I look at single post
pages if I shrink the browser window the content of the article flows off
the screen.
Thanks in advance for you help everyone. Really confused.
I just noticed that on the Wordpress theme I created the H1 article titles
are floating up into the subsequent article when you start to shrink the
browser window. I can't seem to find the reason for this. Any insights
would be greatly appreciated.
ul.info li, .excerpt, .post-link {
float: left;
}
The styles above seem to be pushing the title of the article up but if I
remove it then "posted by, written on, date" all turn into a horizontal
list. Which I don't want.
I don't know if they're related by I noticed when I look at single post
pages if I shrink the browser window the content of the article flows off
the screen.
Thanks in advance for you help everyone. Really confused.
Kyoto2006+ Dataset or other label network/host security datasets
Kyoto2006+ Dataset or other label network/host security datasets
Does anyone know how to access the Kyoto2006+ data set or another labeled
security dataset? An email to the Japanese authors of the set has not been
returned. The DARPA and KDD sets are outdated.
If anyone else is interested, here is the running list of some sets: -UNB
ISCX 2012 Intrusion Detection Evaluation Dataset -iCTF (unlabeled) -DEFCON
(unlabled)
Does anyone know how to access the Kyoto2006+ data set or another labeled
security dataset? An email to the Japanese authors of the set has not been
returned. The DARPA and KDD sets are outdated.
If anyone else is interested, here is the running list of some sets: -UNB
ISCX 2012 Intrusion Detection Evaluation Dataset -iCTF (unlabeled) -DEFCON
(unlabled)
How insert a image in canvas and after insert text in these canvas
How insert a image in canvas and after insert text in these canvas
I'm trying to insert a image in a canvas and after I want to insert a
input text in the same canvas but I cant do it, Anybody can help me?
thanks.
I'm trying to insert a image in a canvas and after I want to insert a
input text in the same canvas but I cant do it, Anybody can help me?
thanks.
Friday, 30 August 2013
How to get the records according to the where clauses in Mysql?
How to get the records according to the where clauses in Mysql?
I have been facing a small confusion from which I am not able to get rid.
I have a table "user_questions" with the attributes id,
question_sequence_number, title. From that table I want to take the
records according to the priority given like first I have given
'question_sequence_number' and then 'id'. So what I want is that the
records should be displayed first with the sequence numbers I have given
and the records should be displayed next with Ids I have given.
For that I have written a mySql query something like follows:
SELECT "user_questions".* FROM "user_questions" WHERE
(question_sequence_number IN (11,13,16,19) OR id IN (198,199,200,201,202))
But the records are coming first with ids I have given and the remaining
records with question sequence number.
Can anybody please help me out in this to achieve ?
Thanks.
I have been facing a small confusion from which I am not able to get rid.
I have a table "user_questions" with the attributes id,
question_sequence_number, title. From that table I want to take the
records according to the priority given like first I have given
'question_sequence_number' and then 'id'. So what I want is that the
records should be displayed first with the sequence numbers I have given
and the records should be displayed next with Ids I have given.
For that I have written a mySql query something like follows:
SELECT "user_questions".* FROM "user_questions" WHERE
(question_sequence_number IN (11,13,16,19) OR id IN (198,199,200,201,202))
But the records are coming first with ids I have given and the remaining
records with question sequence number.
Can anybody please help me out in this to achieve ?
Thanks.
Thursday, 29 August 2013
Convert matrix's coordinate to respective array's coordinate
Convert matrix's coordinate to respective array's coordinate
i want to convert matrix's (n, m) coordinates as i, j to respective
array's (n * m) coordinates as k, thus matrix[i, j] will be equivalents to
array[k]. I don't know how to create an expression that makes this
conversion.
Thanks a lot
i want to convert matrix's (n, m) coordinates as i, j to respective
array's (n * m) coordinates as k, thus matrix[i, j] will be equivalents to
array[k]. I don't know how to create an expression that makes this
conversion.
Thanks a lot
start() doesn't call run() method
start() doesn't call run() method
In my projects there're 3 classes that extends Thread, each of them does
some calculation for integer number. I need to run them to get all three
calculated values. This process needs to be done for all integers in a
certain range.
This's one of my threads:
public class FactorialNumber extends Thread {
private int number;
public void setNumber(int number) {
this.number = number;
}
public void run() {
System.out.print(NumbersOperations.getFactorial(number));
try {
sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
That's a method that tries to start threads:
public static void getThreevalues() throws InterruptedException {
int startOfRange = getBorder("Enter the left border of range: ");
int endOfRange = getBorder("Enter the right border of range: ");
for(int i = startOfRange; i <= endOfRange; i++) {
PrimeNumber primeNumber = new PrimeNumber();
FibonachiNumber fibonachiNumber = new FibonachiNumber();
FactorialNumber factorialNumber = new FactorialNumber();
primeNumber.setNumber(i);
fibonachiNumber.setNumber(i);
factorialNumber.setNumber(i);
System.out.print("Number: " + i);
System.out.print(" is prime number ");
primeNumber.start();
System.out.print(". Fibonachi - " );
fibonachiNumber.start();
System.out.print(". Factorial - ");
factorialNumber.start();
System.out.println();
}
}
After running my code I get this: Number: 3 is prime number . Fibonachi -
. Factorial - Number: 4 is prime number . Fibonachi - . Factorial -
Number: 5 is prime number . Fibonachi - . Factorial - Number: 6 is prime
number . Fibonachi - . Factorial - true2hi6falsetrue5hi2483falsehi720hi120
As I understand, start() does not call run() method. In my run method
there's sleep(500), but the result just appears in console without any
sleep.
I would appreciate any help, as I've spent too much time on this stuff
already and unfortunately didn't solve the problem.
In my projects there're 3 classes that extends Thread, each of them does
some calculation for integer number. I need to run them to get all three
calculated values. This process needs to be done for all integers in a
certain range.
This's one of my threads:
public class FactorialNumber extends Thread {
private int number;
public void setNumber(int number) {
this.number = number;
}
public void run() {
System.out.print(NumbersOperations.getFactorial(number));
try {
sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
That's a method that tries to start threads:
public static void getThreevalues() throws InterruptedException {
int startOfRange = getBorder("Enter the left border of range: ");
int endOfRange = getBorder("Enter the right border of range: ");
for(int i = startOfRange; i <= endOfRange; i++) {
PrimeNumber primeNumber = new PrimeNumber();
FibonachiNumber fibonachiNumber = new FibonachiNumber();
FactorialNumber factorialNumber = new FactorialNumber();
primeNumber.setNumber(i);
fibonachiNumber.setNumber(i);
factorialNumber.setNumber(i);
System.out.print("Number: " + i);
System.out.print(" is prime number ");
primeNumber.start();
System.out.print(". Fibonachi - " );
fibonachiNumber.start();
System.out.print(". Factorial - ");
factorialNumber.start();
System.out.println();
}
}
After running my code I get this: Number: 3 is prime number . Fibonachi -
. Factorial - Number: 4 is prime number . Fibonachi - . Factorial -
Number: 5 is prime number . Fibonachi - . Factorial - Number: 6 is prime
number . Fibonachi - . Factorial - true2hi6falsetrue5hi2483falsehi720hi120
As I understand, start() does not call run() method. In my run method
there's sleep(500), but the result just appears in console without any
sleep.
I would appreciate any help, as I've spent too much time on this stuff
already and unfortunately didn't solve the problem.
When iam trying to run spring example i am facing the following exception
When iam trying to run spring example i am facing the following exception
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [spring.test.StockValueFetcher] for bean with name 'stockBean'
defined in ServletContext resource [/WEB-INF/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
spring.test.StockValueFetcher
and my applicationContext.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="stockBean" class="spring.test.StockValueFetcher">
</bean>
</beans>
i have searched for the same in stackoverflow and other sites but i
couldnot find any helpful solution
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [spring.test.StockValueFetcher] for bean with name 'stockBean'
defined in ServletContext resource [/WEB-INF/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
spring.test.StockValueFetcher
and my applicationContext.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="stockBean" class="spring.test.StockValueFetcher">
</bean>
</beans>
i have searched for the same in stackoverflow and other sites but i
couldnot find any helpful solution
Wednesday, 28 August 2013
Installing NVIDIA driver with Intel HD Graphics
Installing NVIDIA driver with Intel HD Graphics
I have an HP laptop with both a Geforce GT 740M and the integrated HD
4600. The computer automatically switches between the two based on usage
in order to save power: it uses the integrated for most things, then
switches to the 740M when gaming or doing graphics-intensive tasks.
The new driver for the NVIDIA card came out, and I was prompted via
Geforce Experience if I wanted to update. I attempted to install it, but
it won't install because there is no "compatible graphics hardware." This
was obviously because HP only allows special switchable graphics drivers
and I couldn't install just the 740M driver.
I would like to still have this power-saving switching feature, but would
also like the new discrete card driver, since it promises immense
performance improvements. Is there any way I can install the NVIDIA driver
while still being able to use the integrated ones and switch between the
two cards as I do now?
I know HP will never get around to updating their special drivers, so is
there any way I could replace the existing NVIDIA driver with the new one
WITHOUT comprising the switching ability or disabling the integrated
graphics? Something along the lines of extracting HP's driver, replacing
the NVIDIA part of it with the new files, and then installing?
I'm not sure if I'm being totally clear, but I hope someone has ideas on
how to do this. To repeat, I want to install the new NVIDIA graphics
without removing the ability to use the integrated graphics and switch
between the two automatically as I do now.
EDIT: I'm running Windows 8 64-bit.
I have an HP laptop with both a Geforce GT 740M and the integrated HD
4600. The computer automatically switches between the two based on usage
in order to save power: it uses the integrated for most things, then
switches to the 740M when gaming or doing graphics-intensive tasks.
The new driver for the NVIDIA card came out, and I was prompted via
Geforce Experience if I wanted to update. I attempted to install it, but
it won't install because there is no "compatible graphics hardware." This
was obviously because HP only allows special switchable graphics drivers
and I couldn't install just the 740M driver.
I would like to still have this power-saving switching feature, but would
also like the new discrete card driver, since it promises immense
performance improvements. Is there any way I can install the NVIDIA driver
while still being able to use the integrated ones and switch between the
two cards as I do now?
I know HP will never get around to updating their special drivers, so is
there any way I could replace the existing NVIDIA driver with the new one
WITHOUT comprising the switching ability or disabling the integrated
graphics? Something along the lines of extracting HP's driver, replacing
the NVIDIA part of it with the new files, and then installing?
I'm not sure if I'm being totally clear, but I hope someone has ideas on
how to do this. To repeat, I want to install the new NVIDIA graphics
without removing the ability to use the integrated graphics and switch
between the two automatically as I do now.
EDIT: I'm running Windows 8 64-bit.
How to write this with less code?
How to write this with less code?
i'm trying to make a game. when a picture is displayed the user needs to
guess what it is. there are 4 possible choises only one is correct. i
don't want the correct answer to be in the same place for every photo so i
use a tween to move the buttons as if the correct aswer is elsewhere
although the buttons are the same. i need an if for every level and it's a
lot of code. Can anybody show me another method to white this in less code
lines? thx
if (level == 1) {
GAME.varianta1.text = "Ladybug";
GAME.varianta2.text = "Bee";
GAME.varianta3.text = "Beattle";
GAME.varianta4.text = "Fly";
TweenLite.to(GAME.variante.varianta_gresita1, 0, {x:1025.75, y:708.5});
TweenLite.to(GAME.variante.varianta_gresita2, 0, {x:1043.35, y:555.9});
TweenLite.to(GAME.variante.varianta_gresita3, 0, {x:834.3, y:710.9});
TweenLite.to(GAME.variante.varianta_corecta, 0, {x:835.15, y:633.7});
}
if (level == 2) {
GAME.varianta1.text = "x";
GAME.varianta2.text = "y";
GAME.varianta3.text = "z";
GAME.varianta4.text = "w";
TweenLite.to(GAME.variante.varianta_gresita1, 0, {x:1025.75, y:708.5});
TweenLite.to(GAME.variante.varianta_gresita2, 0, {x:1043.35, y:555.9});
TweenLite.to(GAME.variante.varianta_gresita3, 0, {x:834.3, y:710.9});
TweenLite.to(GAME.variante.varianta_corecta, 0, {x:835.15, y:633.7});
}
///...................\\\
if (level == 100) {
GAME.varianta1.text = "a";
GAME.varianta2.text = "b";
GAME.varianta3.text = "c";
GAME.varianta4.text = "d";
TweenLite.to(GAME.variante.varianta_gresita1, 0, {x:1025.75, y:708.5});
TweenLite.to(GAME.variante.varianta_gresita2, 0, {x:834.3, y:710.9});
TweenLite.to(GAME.variante.varianta_gresita3, 0, {x:835.15, y:633.7});
TweenLite.to(GAME.variante.varianta_corecta, 0, {x:1043.35, y:555.9});
}
i'm trying to make a game. when a picture is displayed the user needs to
guess what it is. there are 4 possible choises only one is correct. i
don't want the correct answer to be in the same place for every photo so i
use a tween to move the buttons as if the correct aswer is elsewhere
although the buttons are the same. i need an if for every level and it's a
lot of code. Can anybody show me another method to white this in less code
lines? thx
if (level == 1) {
GAME.varianta1.text = "Ladybug";
GAME.varianta2.text = "Bee";
GAME.varianta3.text = "Beattle";
GAME.varianta4.text = "Fly";
TweenLite.to(GAME.variante.varianta_gresita1, 0, {x:1025.75, y:708.5});
TweenLite.to(GAME.variante.varianta_gresita2, 0, {x:1043.35, y:555.9});
TweenLite.to(GAME.variante.varianta_gresita3, 0, {x:834.3, y:710.9});
TweenLite.to(GAME.variante.varianta_corecta, 0, {x:835.15, y:633.7});
}
if (level == 2) {
GAME.varianta1.text = "x";
GAME.varianta2.text = "y";
GAME.varianta3.text = "z";
GAME.varianta4.text = "w";
TweenLite.to(GAME.variante.varianta_gresita1, 0, {x:1025.75, y:708.5});
TweenLite.to(GAME.variante.varianta_gresita2, 0, {x:1043.35, y:555.9});
TweenLite.to(GAME.variante.varianta_gresita3, 0, {x:834.3, y:710.9});
TweenLite.to(GAME.variante.varianta_corecta, 0, {x:835.15, y:633.7});
}
///...................\\\
if (level == 100) {
GAME.varianta1.text = "a";
GAME.varianta2.text = "b";
GAME.varianta3.text = "c";
GAME.varianta4.text = "d";
TweenLite.to(GAME.variante.varianta_gresita1, 0, {x:1025.75, y:708.5});
TweenLite.to(GAME.variante.varianta_gresita2, 0, {x:834.3, y:710.9});
TweenLite.to(GAME.variante.varianta_gresita3, 0, {x:835.15, y:633.7});
TweenLite.to(GAME.variante.varianta_corecta, 0, {x:1043.35, y:555.9});
}
Operating JCalendar in a different time zone
Operating JCalendar in a different time zone
I work on a legacy application that makes use of JCalendar. Is it possible
to operate JCalendar in a different time zone? The internals of this
package seem to assume the local time zone. Our application assumes GMT so
we would like dates and times to be handled and rendered in GMT by the
com.toedter.calendar.JTextFieldDateEditor and
com.toedter.calendar.JSpinnerDateEditor classes.
I work on a legacy application that makes use of JCalendar. Is it possible
to operate JCalendar in a different time zone? The internals of this
package seem to assume the local time zone. Our application assumes GMT so
we would like dates and times to be handled and rendered in GMT by the
com.toedter.calendar.JTextFieldDateEditor and
com.toedter.calendar.JSpinnerDateEditor classes.
Root Nexus 7 with 4.2.2
Root Nexus 7 with 4.2.2
I'm trying to root a Nexus 7 with Android 4.2.2 (1st generation). I am
following instructions here:
http://honai-android.blogspot.com/2013/06/how-to-root-nexus-7-on-android-422.html?showComment=1377379346836#c8791363668077143555
I get to Step 4 in in which it says to wait until windows has finished
installing drivers. I am on OS X. The Nexus 7 is in fast boot mode. It has
an image of the green Android lying on its back with a panel open, in the
upper right is "Start >" and just below that up and down arrows. I plugged
in the USB and nothing happens, ie no indication of drivers being
installed. What do I do?
I'm trying to root a Nexus 7 with Android 4.2.2 (1st generation). I am
following instructions here:
http://honai-android.blogspot.com/2013/06/how-to-root-nexus-7-on-android-422.html?showComment=1377379346836#c8791363668077143555
I get to Step 4 in in which it says to wait until windows has finished
installing drivers. I am on OS X. The Nexus 7 is in fast boot mode. It has
an image of the green Android lying on its back with a panel open, in the
upper right is "Start >" and just below that up and down arrows. I plugged
in the USB and nothing happens, ie no indication of drivers being
installed. What do I do?
Could not load type '' (blank) error when trying to reference .NET assembly in NAV2013
Could not load type '' (blank) error when trying to reference .NET
assembly in NAV2013
I've created an assembly that I want to be able to call from C/SIDE in the
Role-Tailored Client in Dynamics NAV2013.
I've got this all working locally but when trying to deploy to the server
I can't compile the codeunit that references the .NET assembly
I have a variable of type DotNet but when trying to choose a subtype I get
this error:
Could not load type '' <-- nothing between the single quotes!
I've followed all steps in the MSDN guide (save exporting the types I want
to use) I've got this working locally. I can actually get it running by
installing the assembly into the GAC, but I don't want to have to do this
when it should work otherwise
(the add in is also registered in the Client Add-in table and is
strong-named with the correct public key token in the table)
These are the things I've tried:
Building for .NET 4.5, 4 and 3.5 all of which worked locally but not on
server
Dropping the dll in the client and service add-ins folder
Dropping the dll into windows/system32 folders
Running everything as administrator (dev environment, service etc etc -
I'm logged on as a domain administrator)
Ripping clumps of my own hair out
All the assembly does is calls out to some webservices and a couple of
other things, I just can't work out why I can't get it to work
I suspect it's permission related since installing to GAC seems to make it
happy
Any ideas?
Thanks in advance
assembly in NAV2013
I've created an assembly that I want to be able to call from C/SIDE in the
Role-Tailored Client in Dynamics NAV2013.
I've got this all working locally but when trying to deploy to the server
I can't compile the codeunit that references the .NET assembly
I have a variable of type DotNet but when trying to choose a subtype I get
this error:
Could not load type '' <-- nothing between the single quotes!
I've followed all steps in the MSDN guide (save exporting the types I want
to use) I've got this working locally. I can actually get it running by
installing the assembly into the GAC, but I don't want to have to do this
when it should work otherwise
(the add in is also registered in the Client Add-in table and is
strong-named with the correct public key token in the table)
These are the things I've tried:
Building for .NET 4.5, 4 and 3.5 all of which worked locally but not on
server
Dropping the dll in the client and service add-ins folder
Dropping the dll into windows/system32 folders
Running everything as administrator (dev environment, service etc etc -
I'm logged on as a domain administrator)
Ripping clumps of my own hair out
All the assembly does is calls out to some webservices and a couple of
other things, I just can't work out why I can't get it to work
I suspect it's permission related since installing to GAC seems to make it
happy
Any ideas?
Thanks in advance
How do I get this multi-select working with f.select?
How do I get this multi-select working with f.select?
My line of code looks like:
<%=f.collection_select :roles, Role.all,:id,:name,{}, {:multiple => true,
:include_blank => true}%>
right now, but its still only letting me select one value
EDIT: After fixing my typo, it now allows me to select multiple values
however when I click on the select box it wont drop down, i have to hold
down shift and use the arrow keys to get any values selected.
My line of code looks like:
<%=f.collection_select :roles, Role.all,:id,:name,{}, {:multiple => true,
:include_blank => true}%>
right now, but its still only letting me select one value
EDIT: After fixing my typo, it now allows me to select multiple values
however when I click on the select box it wont drop down, i have to hold
down shift and use the arrow keys to get any values selected.
Can't bind collection to view
Can't bind collection to view
How do I bind collection to view? When I debug I can't use
this.collection.get() or this.collection.at() in QuizView
My code - http://jsfiddle.net/zQYh5/
HTML
<div class="row" id="quizs">
<script type="text/template" id="quizTemplate">
< h1 ><%= title %>< /h1>
</script>
</div>
<button id="next">Next</button>
Javascript
$(function () {
var Quiz = Backbone.Model.extend({});
var QuizList = Backbone.Collection.extend({
model: Quiz
});
var quizs = {[{id: 1, title: "a"},{id: 2,title: "b"},{id: 3,title:
"c"},{id: 4,title: "d"},]}
var QuestionView = Backbone.View.extend({
events: {
'click #next': 'showNextQuestion'
},
collection: quizs,
initialize: function () {
_.bindAll(this, "showNextQuestion", "render");
this.currentIndex = 0;
this.render();
},
showNextQuestion: function () {
this.currentIndex++;
if (this.currentIndex < this.collection.length) {
this.render();
}
},
render: function () {
var template = _.template($("#quizTemplate").html(),
this.collection.at(this.currentIndex));
this.$el.html(template);
},
});
var app = new QuestionView({});
})
How do I bind collection to view? When I debug I can't use
this.collection.get() or this.collection.at() in QuizView
My code - http://jsfiddle.net/zQYh5/
HTML
<div class="row" id="quizs">
<script type="text/template" id="quizTemplate">
< h1 ><%= title %>< /h1>
</script>
</div>
<button id="next">Next</button>
Javascript
$(function () {
var Quiz = Backbone.Model.extend({});
var QuizList = Backbone.Collection.extend({
model: Quiz
});
var quizs = {[{id: 1, title: "a"},{id: 2,title: "b"},{id: 3,title:
"c"},{id: 4,title: "d"},]}
var QuestionView = Backbone.View.extend({
events: {
'click #next': 'showNextQuestion'
},
collection: quizs,
initialize: function () {
_.bindAll(this, "showNextQuestion", "render");
this.currentIndex = 0;
this.render();
},
showNextQuestion: function () {
this.currentIndex++;
if (this.currentIndex < this.collection.length) {
this.render();
}
},
render: function () {
var template = _.template($("#quizTemplate").html(),
this.collection.at(this.currentIndex));
this.$el.html(template);
},
});
var app = new QuestionView({});
})
Submit a paper to a conference where co-authors are in the committee=?iso-8859-1?Q?=3F_=96_academia.stackexchange.com?=
Submit a paper to a conference where co-authors are in the committee? –
academia.stackexchange.com
I recently read a paper whose co-authors are found in the conference
committee. Although they are not in the executive committee, they are in
organizing committee and all the committee people know …
academia.stackexchange.com
I recently read a paper whose co-authors are found in the conference
committee. Although they are not in the executive committee, they are in
organizing committee and all the committee people know …
Tuesday, 27 August 2013
WE THOUGHT WE WERE WORKING ON A "CARREER" THIS TROLL SHOWED UP AND RUINED EVERYTHING.
WE THOUGHT WE WERE WORKING ON A "CARREER" THIS TROLL SHOWED UP AND RUINED
EVERYTHING.
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1: you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
a=`xclip -o`
b=`echo "$a" | sed -e 's/^ *//g' -e 's/ *$//g'`
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool type "$b"
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest. ....... ................... .................
................ . ............... .............................
...................... ....................... ................
EVERYTHING.
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1: you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
a=`xclip -o`
b=`echo "$a" | sed -e 's/^ *//g' -e 's/ *$//g'`
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool type "$b"
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest. ....... ................... .................
................ . ............... .............................
...................... ....................... ................
Why can you set the stack size on CUDA GPU devices with compute capability 2.0+ only?
Why can you set the stack size on CUDA GPU devices with compute capability
2.0+ only?
I guess I have a couple questions related to the call stack, but my main
one would be,
"Why can you set the stack size on devices with compute capability 2.0+
only?"
Also, why can I only view the call stack using nvidia Nsight for devices
with compute capability 2.0 and above only? What's so special about 2.0+
devices that allows them to do this, but not 1.x devices?
I know this is a pretty broad question, but any insight into the above
questions' answers or even information on the stack call on CUDA devices
in general would be highly appreciated.
2.0+ only?
I guess I have a couple questions related to the call stack, but my main
one would be,
"Why can you set the stack size on devices with compute capability 2.0+
only?"
Also, why can I only view the call stack using nvidia Nsight for devices
with compute capability 2.0 and above only? What's so special about 2.0+
devices that allows them to do this, but not 1.x devices?
I know this is a pretty broad question, but any insight into the above
questions' answers or even information on the stack call on CUDA devices
in general would be highly appreciated.
Does a Synchronous Queue create a thread on each offer/put?
Does a Synchronous Queue create a thread on each offer/put?
I can not understand how the Synchronous Queue works.
I understand that the idea is that the handover of tasks is to threads
directly but the constructor does not have a bound e.g max number of
threads like the other APIs.
So when a put or offer is done it is essentially passed to another thread
or not?
So if I do e.g. 100 put it will be passed to 100 threads?
I tried to read the source code but could not figure out what happens. It
seems to create a linked list of nodes where each node encapsulates a
thread but how this list is maintained e.g. expand/shrink etc and how the
treads run the tasks is not clear to me.
So does this list expand as we offer tasks? And as a result the consumer
threads (waiters) increases constantly?
And are any of these reused? Or just execute something and stop?
I can not understand how the Synchronous Queue works.
I understand that the idea is that the handover of tasks is to threads
directly but the constructor does not have a bound e.g max number of
threads like the other APIs.
So when a put or offer is done it is essentially passed to another thread
or not?
So if I do e.g. 100 put it will be passed to 100 threads?
I tried to read the source code but could not figure out what happens. It
seems to create a linked list of nodes where each node encapsulates a
thread but how this list is maintained e.g. expand/shrink etc and how the
treads run the tasks is not clear to me.
So does this list expand as we offer tasks? And as a result the consumer
threads (waiters) increases constantly?
And are any of these reused? Or just execute something and stop?
sum values from inputs and selects in form
sum values from inputs and selects in form
Hi i was looking for a script in jquery to sum values from inputs and
select options and i found this script:
SOURCE: Jquery checkbox and select - sum the values and add in var
DEMO: http://jsfiddle.net/H4d7W/
The only problem is that my form contains multiple inputs and multiple
selects.
I was thinking something like this:
REPLACE:
tot+=parseInt($('#more').val());
$('#usertotal').html(tot)
});
$('#more').change(function(){
$('input:checkbox').trigger('change');
});
FOR:
tot+=parseInt($('select > option:selected'').val());
$('#usertotal').html(tot)
});
$('select > option:selected'').change(function(){
$('input:checkbox').trigger('change');
});
Any idea of how can i edit that code to accomplish this.
Hi i was looking for a script in jquery to sum values from inputs and
select options and i found this script:
SOURCE: Jquery checkbox and select - sum the values and add in var
DEMO: http://jsfiddle.net/H4d7W/
The only problem is that my form contains multiple inputs and multiple
selects.
I was thinking something like this:
REPLACE:
tot+=parseInt($('#more').val());
$('#usertotal').html(tot)
});
$('#more').change(function(){
$('input:checkbox').trigger('change');
});
FOR:
tot+=parseInt($('select > option:selected'').val());
$('#usertotal').html(tot)
});
$('select > option:selected'').change(function(){
$('input:checkbox').trigger('change');
});
Any idea of how can i edit that code to accomplish this.
Remove number of bytes from begining of file
Remove number of bytes from begining of file
I want to copy a file without the first 256 bytes.
Is there a nice way to do it in python?
I guessing that the simple way is to read byte-byte with a counter and
then start copy only when it get to 256.
I was hoping for more elegant way.
Thanks.
I want to copy a file without the first 256 bytes.
Is there a nice way to do it in python?
I guessing that the simple way is to read byte-byte with a counter and
then start copy only when it get to 256.
I was hoping for more elegant way.
Thanks.
(3d object to json to webgl). Will I be able to manipulate skin of that 3d from webgl/javascript?
(3d object to json to webgl). Will I be able to manipulate skin of that 3d
from webgl/javascript?
Currently I don't have much experience on webgl that's why I'm asking this
question.people may be angry with me for this, my apology to them in
advance.
Let's say I have a 3d object like a car or a human body. I then convert
that 3d object to json for webgl. Now if I do that (3d object to json to
webgl). Will I be able to manipulate skin of that 3d from
webgl/javascript?
from webgl/javascript?
Currently I don't have much experience on webgl that's why I'm asking this
question.people may be angry with me for this, my apology to them in
advance.
Let's say I have a 3d object like a car or a human body. I then convert
that 3d object to json for webgl. Now if I do that (3d object to json to
webgl). Will I be able to manipulate skin of that 3d from
webgl/javascript?
ActionScript 3 Button CLICK event not firing
ActionScript 3 Button CLICK event not firing
So right now after tirelessly working with my restart button in my flash
game the button still will not register the click.
Here is the code for the button: Why I think the problem is with the
MouseEvent.CLICK because the trace() flag doesn't show up.
package
{
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Mouse;
/**
* ...
* @author Andrew Xia
*/
public class RestartButton extends SimpleButton
{
public function RestartButton(setX:Number, setY:Number)
{
this.x = setX;
this.y = setY;
addEventListener(MouseEvent.CLICK, onClick);
}
public function onClick(event:MouseEvent):void
{
trace("HELLO!");
dispatchEvent( new NavigationEvent( NavigationEvent.RESTART ));
}
}
}
And here is the code for the screen that I added the button to:
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Mouse;
/**
* ...
* @author Andrew Xia
*/
public class GameOverScreen extends MovieClip
{
public var restartButton:RestartButton;
public var scoreLabel:TextField;
public var scoreBox:TextField;
public function GameOverScreen()
{
Mouse.show();
restartButton = new RestartButton(0, 108);
addChild(restartButton);
var textFormat = new TextFormat();
textFormat.size = 54;
scoreLabel = new TextField();
scoreLabel.x = -185;
scoreLabel.y = -36.75;
scoreLabel.height = 73.5;
scoreLabel.width = 185;
scoreLabel.text = "SCORE: ";
scoreLabel.textColor = 0xFFFFFF;
scoreLabel.setTextFormat(textFormat);
addChild(scoreLabel);
scoreBox = new TextField();
scoreBox.x = 0;
scoreBox.y = -36.75;
scoreBox.height = 73.5;
scoreBox.width = 143;
scoreBox.text = (String)(Main.playerScore);
scoreBox.textColor = 0xFFFFFF;
scoreBox.setTextFormat(textFormat);
addChild(scoreBox);
}
}
}
Please help, this problem has been driving me crazy and I'm sure its
probably just a really stupid error on my part but I would appreciate it
immensely if you guys can help me out.
So right now after tirelessly working with my restart button in my flash
game the button still will not register the click.
Here is the code for the button: Why I think the problem is with the
MouseEvent.CLICK because the trace() flag doesn't show up.
package
{
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Mouse;
/**
* ...
* @author Andrew Xia
*/
public class RestartButton extends SimpleButton
{
public function RestartButton(setX:Number, setY:Number)
{
this.x = setX;
this.y = setY;
addEventListener(MouseEvent.CLICK, onClick);
}
public function onClick(event:MouseEvent):void
{
trace("HELLO!");
dispatchEvent( new NavigationEvent( NavigationEvent.RESTART ));
}
}
}
And here is the code for the screen that I added the button to:
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Mouse;
/**
* ...
* @author Andrew Xia
*/
public class GameOverScreen extends MovieClip
{
public var restartButton:RestartButton;
public var scoreLabel:TextField;
public var scoreBox:TextField;
public function GameOverScreen()
{
Mouse.show();
restartButton = new RestartButton(0, 108);
addChild(restartButton);
var textFormat = new TextFormat();
textFormat.size = 54;
scoreLabel = new TextField();
scoreLabel.x = -185;
scoreLabel.y = -36.75;
scoreLabel.height = 73.5;
scoreLabel.width = 185;
scoreLabel.text = "SCORE: ";
scoreLabel.textColor = 0xFFFFFF;
scoreLabel.setTextFormat(textFormat);
addChild(scoreLabel);
scoreBox = new TextField();
scoreBox.x = 0;
scoreBox.y = -36.75;
scoreBox.height = 73.5;
scoreBox.width = 143;
scoreBox.text = (String)(Main.playerScore);
scoreBox.textColor = 0xFFFFFF;
scoreBox.setTextFormat(textFormat);
addChild(scoreBox);
}
}
}
Please help, this problem has been driving me crazy and I'm sure its
probably just a really stupid error on my part but I would appreciate it
immensely if you guys can help me out.
Monday, 26 August 2013
Bash - some commands don't display quotation marks correctly
Bash - some commands don't display quotation marks correctly
I'm ssh'ing into a remote server (using bash). Some commands (e.g. cp, rm,
etc.) display quotations incorrectly:
$ rm ./test
rm: remove regular file â˜./test™?
Why does it do this, and how can I fix it?
I'm ssh'ing into a remote server (using bash). Some commands (e.g. cp, rm,
etc.) display quotations incorrectly:
$ rm ./test
rm: remove regular file â˜./test™?
Why does it do this, and how can I fix it?
Programatically get memory usage in Chrome
Programatically get memory usage in Chrome
How can I programatically get memory usage (JS and total) of my website in
Google Chrome?
I looked at doing it from a Chrome extension using the undocumented
HeapProfiler (see here), but I can't find a way to get data from that.
I want to measure the memory consumption it at every release, so this
needs to be programmatic.
Thanks.
How can I programatically get memory usage (JS and total) of my website in
Google Chrome?
I looked at doing it from a Chrome extension using the undocumented
HeapProfiler (see here), but I can't find a way to get data from that.
I want to measure the memory consumption it at every release, so this
needs to be programmatic.
Thanks.
Delphi compare 2 similar images
Delphi compare 2 similar images
Is there anyway to compare 2 similar images (not the same) in Delphi.
here are some examples:
&
Its obvious here that we cant compare pixel by pixel, So my idea was to
sum the pixels values of each image, the compare them:
function CalcPix( img : TImage) : longint;
var
s : longint;
i, j : integer;
begin
s := 0;
for i := 0 to img.Height do
begin
for j := 0 to img.Width do
begin
if img.Canvas.Pixels[i,j] <> clWhite then
s := s + img.Canvas.Pixels[i, j];
end;
end;
Result := S;
end;
the results are:
1)14836072057
2)16750850318
as you see they are not that close, and if i do this process with 4 - 5
image at a time it always give me wrong results.
Is there anyother way? like changing the color or contrast etc.
Is there anyway to compare 2 similar images (not the same) in Delphi.
here are some examples:
&
Its obvious here that we cant compare pixel by pixel, So my idea was to
sum the pixels values of each image, the compare them:
function CalcPix( img : TImage) : longint;
var
s : longint;
i, j : integer;
begin
s := 0;
for i := 0 to img.Height do
begin
for j := 0 to img.Width do
begin
if img.Canvas.Pixels[i,j] <> clWhite then
s := s + img.Canvas.Pixels[i, j];
end;
end;
Result := S;
end;
the results are:
1)14836072057
2)16750850318
as you see they are not that close, and if i do this process with 4 - 5
image at a time it always give me wrong results.
Is there anyother way? like changing the color or contrast etc.
Alternative to a Reflection-Based Event System?
Alternative to a Reflection-Based Event System?
Currently I'm creating a mod for a game. I am using a reflection-based
event system at the moment. I want to get rid of the system because
frankly.. reflection is bad. What this reflection-based event system did
however would do something like this:
class Mod extends ModBase implements EventListener{
@EventHandler
void runCode(Event event){ // When a Event object is created...
}
}
I still want to use an event system, however, I just don't want it to use
reflection. Does anyone have an suggestions?
Currently I'm creating a mod for a game. I am using a reflection-based
event system at the moment. I want to get rid of the system because
frankly.. reflection is bad. What this reflection-based event system did
however would do something like this:
class Mod extends ModBase implements EventListener{
@EventHandler
void runCode(Event event){ // When a Event object is created...
}
}
I still want to use an event system, however, I just don't want it to use
reflection. Does anyone have an suggestions?
RoR - Testing POST of file chunk
RoR - Testing POST of file chunk
My rails app contains code to handle large file uploads, which basically
consists of splitting up the file in javascript and making a number of
posts for each chunk to a route where they are then reconstructed back to
the original file.
I'm trying to figure out how to write tests for this logic, as up until
now I've simply used fixture_file_upload for posting files.
I basically need to split a given file up into a range of bytes, and post
that in a way that my route would handle it just as though it has been
posted by my javascript.
Anyone know of a way to accomplish this in a rails test?
My rails app contains code to handle large file uploads, which basically
consists of splitting up the file in javascript and making a number of
posts for each chunk to a route where they are then reconstructed back to
the original file.
I'm trying to figure out how to write tests for this logic, as up until
now I've simply used fixture_file_upload for posting files.
I basically need to split a given file up into a range of bytes, and post
that in a way that my route would handle it just as though it has been
posted by my javascript.
Anyone know of a way to accomplish this in a rails test?
using requirejs within a firefox xul extension
using requirejs within a firefox xul extension
I would like to use requirejs to manage my code within a firefox xul
plugin, and I can't get it to find my modules.
I know that xul doesn't play nice with the data-main attribute, so I have
my main.js script as a second script:
<script src="chrome://myPackage/content/require.js"
type="application/x-javascript"></script>
<script src="chrome://myPackage/content/main.js"
type="application/x-javascript"></script>
This successfully calls the script, and the require function is available
within main.js, but when I run
require(['lib1'], function(lib1){
alert(lib1.val1);
})
the alert never gets popped (lib1 is in the same directory as main.js).
I have tried this within and without setting the baseUrl as
require.config({
baseUrl: "chrome://myPackage/content/"
})
and it does not work either way.
Does anyone know how I can get require.js to look in the right place for
my modules?
I would like to use requirejs to manage my code within a firefox xul
plugin, and I can't get it to find my modules.
I know that xul doesn't play nice with the data-main attribute, so I have
my main.js script as a second script:
<script src="chrome://myPackage/content/require.js"
type="application/x-javascript"></script>
<script src="chrome://myPackage/content/main.js"
type="application/x-javascript"></script>
This successfully calls the script, and the require function is available
within main.js, but when I run
require(['lib1'], function(lib1){
alert(lib1.val1);
})
the alert never gets popped (lib1 is in the same directory as main.js).
I have tried this within and without setting the baseUrl as
require.config({
baseUrl: "chrome://myPackage/content/"
})
and it does not work either way.
Does anyone know how I can get require.js to look in the right place for
my modules?
Populating js array in blade template
Populating js array in blade template
I'm trying to build a javascript array of data for use in flot from the
result of a php DB query.
When I'm outputting numbers ($lic->Users) it's fine, but whenever I try to
output a string I get a completely blank page in the browser.
I've tried:
{{ $lic->CompanyName }}
"<?php echo $lic->CompanyName; ?>"
{{{ $lic->CompanyName }}}
'"'+ <?php echo $lic->CompanyName; ?> +'"'
But when I hard-code it (to say, 'CompanyName'), it builds the bar graph
(& displays the page) just fine.
var data =
[
@foreach($licdata as $lic)
{
'label': "{{ $lic->CompanyName }}",
'data': [
["{{ $lic->CompanyName }}", {{ $lic->Users }}],
["{{ $lic->CompanyName }}", {{ $lic->Emps }}]
]
},
@endforeach
];
I think it must be something to do with quoting/escaping the string in js,
but I can't work out what, does anyone know what the correct syntax is?
I'm trying to build a javascript array of data for use in flot from the
result of a php DB query.
When I'm outputting numbers ($lic->Users) it's fine, but whenever I try to
output a string I get a completely blank page in the browser.
I've tried:
{{ $lic->CompanyName }}
"<?php echo $lic->CompanyName; ?>"
{{{ $lic->CompanyName }}}
'"'+ <?php echo $lic->CompanyName; ?> +'"'
But when I hard-code it (to say, 'CompanyName'), it builds the bar graph
(& displays the page) just fine.
var data =
[
@foreach($licdata as $lic)
{
'label': "{{ $lic->CompanyName }}",
'data': [
["{{ $lic->CompanyName }}", {{ $lic->Users }}],
["{{ $lic->CompanyName }}", {{ $lic->Emps }}]
]
},
@endforeach
];
I think it must be something to do with quoting/escaping the string in js,
but I can't work out what, does anyone know what the correct syntax is?
Using a relative URL scheme effectively
Using a relative URL scheme effectively
Using has all of the issues on anchor-tags that were described in this
question on base tags making it hard to use on my site.
I have a navigation menu in my site which references different parts of my
site
for example
main/
|_index.html
|_section1/
|_1a.html
|_1b.html
and the navigation section on each page looks like
<div id="nav">
<ul>
<li><a href="index.html">home</a></li>
<li><a href="section1/1a.html">1a</a></li>
<li><a href="section1/1b.html">1b</a></li>
</ul>
</div>
This works fine for all the pages on in the main folder but for pretty
obvious reasons fails when I'm viewing a page in the section1 folder. I
can't use <base> because I have a large number of anchors in documents
(and I'm using markdown so I cant change the reference format easily).
I'm concerned that if I use absolute references on all my pages, when I
upload this site to a server it will be a huge amount of work to replace
the absolute reference on each page with a different one.
In addition main is a few levels down in my /home/ directory and I would
prefer not to have to type a long path-name each time I refer to something
if possible
I guess if I was pushed I could use sed to change all instances of the
absolute path with something else but I wondered if there was an easier,
obvious way of dealing with this in html that I'm missing. thanks
Using has all of the issues on anchor-tags that were described in this
question on base tags making it hard to use on my site.
I have a navigation menu in my site which references different parts of my
site
for example
main/
|_index.html
|_section1/
|_1a.html
|_1b.html
and the navigation section on each page looks like
<div id="nav">
<ul>
<li><a href="index.html">home</a></li>
<li><a href="section1/1a.html">1a</a></li>
<li><a href="section1/1b.html">1b</a></li>
</ul>
</div>
This works fine for all the pages on in the main folder but for pretty
obvious reasons fails when I'm viewing a page in the section1 folder. I
can't use <base> because I have a large number of anchors in documents
(and I'm using markdown so I cant change the reference format easily).
I'm concerned that if I use absolute references on all my pages, when I
upload this site to a server it will be a huge amount of work to replace
the absolute reference on each page with a different one.
In addition main is a few levels down in my /home/ directory and I would
prefer not to have to type a long path-name each time I refer to something
if possible
I guess if I was pushed I could use sed to change all instances of the
absolute path with something else but I wondered if there was an easier,
obvious way of dealing with this in html that I'm missing. thanks
How to build tv remote app in android
How to build tv remote app in android
Any help highly appreciated,I really don't have any idea about this
topic,how to control TV through android app for example changing channels
and changing volumes,
Any help highly appreciated,I really don't have any idea about this
topic,how to control TV through android app for example changing channels
and changing volumes,
Sunday, 25 August 2013
Printing a table somewhat complex MYSQL query in PHP
Printing a table somewhat complex MYSQL query in PHP
Ok this is going to be a long winded question...
I have a database with 2 tables User, Contact_List.
The User table for example looks like this:
U_id | U_email | U_password | U_mobileNo | U_name |
1 | a@b.c | aaa | 1234567 | Adam |
2 | b@b.c | bbb | 1234567 | Ben |
3 | c@b.c | ccc | 1234567 | Carl |
The Contact_list table looks like this. This table is table just
consisting of foreign keys that relate two users together
U_id | U_contact_id
1 | 2
2 | 3
Now the problem is my SQL/PHP query to display a table that consists of a
specific users list of contacts.
This SQL query works fine and gives the results I want:
"SELECT cu.u_name, cu.u_email
FROM contact_list >= c, user = u, user = cu
WHERE c.u_id = 2
AND c.u_contactId >= c.u_id
AND c.u_id = >u.u_id"
But this PHP code:
$con = mysqli_connect("dbname","dbuser","pbpass","db");
//Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT cu.u_name, cu.u_email
FROM contact_list = c, user = u, user = cu
WHERE c.u_id = 2
AND c.u_contactId = c.u_id
AND c.u_id = u.u_id" ) or die(mysql_error());
echo "<table border='1'>
<th>Contact List</th>
<tr>
<th>Name</th>
<th>E-mail</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['u_name'] . "</td>";
echo "<td>" . $row['u_email'] . "</td>";
echo "</tr>";
mysqli_free_result($result);
}
echo "</table>";
mysqli_close($con);
?>
That code just prints a blank table on the page.
What am I doing wrong here?
I am a complete noob using PHP any help or suggestions would be appreciated.
Ok this is going to be a long winded question...
I have a database with 2 tables User, Contact_List.
The User table for example looks like this:
U_id | U_email | U_password | U_mobileNo | U_name |
1 | a@b.c | aaa | 1234567 | Adam |
2 | b@b.c | bbb | 1234567 | Ben |
3 | c@b.c | ccc | 1234567 | Carl |
The Contact_list table looks like this. This table is table just
consisting of foreign keys that relate two users together
U_id | U_contact_id
1 | 2
2 | 3
Now the problem is my SQL/PHP query to display a table that consists of a
specific users list of contacts.
This SQL query works fine and gives the results I want:
"SELECT cu.u_name, cu.u_email
FROM contact_list >= c, user = u, user = cu
WHERE c.u_id = 2
AND c.u_contactId >= c.u_id
AND c.u_id = >u.u_id"
But this PHP code:
$con = mysqli_connect("dbname","dbuser","pbpass","db");
//Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT cu.u_name, cu.u_email
FROM contact_list = c, user = u, user = cu
WHERE c.u_id = 2
AND c.u_contactId = c.u_id
AND c.u_id = u.u_id" ) or die(mysql_error());
echo "<table border='1'>
<th>Contact List</th>
<tr>
<th>Name</th>
<th>E-mail</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['u_name'] . "</td>";
echo "<td>" . $row['u_email'] . "</td>";
echo "</tr>";
mysqli_free_result($result);
}
echo "</table>";
mysqli_close($con);
?>
That code just prints a blank table on the page.
What am I doing wrong here?
I am a complete noob using PHP any help or suggestions would be appreciated.
[ Mobile Phones & Plans ] Open Question : How to hide/lock photos on iphone?
[ Mobile Phones & Plans ] Open Question : How to hide/lock photos on iphone?
Is there an app or any privacy setting that will require a password to
view my camera roll/photo folders? So that if a friend is accessing my
phone they don't have access to my photos
Is there an app or any privacy setting that will require a password to
view my camera roll/photo folders? So that if a friend is accessing my
phone they don't have access to my photos
run console task asynchronously
run console task asynchronously
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NewTask
{
class Program
{
static void Main(string[] args)
{
NewTask.Combine taskcombine = new NewTask.Combine();
ProfileClient profilesws = new ProfileClient();
var profileRecords = profilesws.GetAllProfiles();
foreach (var profile in profileRecords.ProfileRecords)
{
var testProfile = new NewTask.Profile();
testProfile.Id = profile.Id;
testProfile.Name = profile.Name;
var result = taskcombine.TestProfile(testProfile);
}
profilesws.Close();
taskcombine.Close();
}
}
}
I want a way to run this async. I want to hit the ruslt and once it goes
through all the records into result I want it to end the task. This will
be a consol app and once the results are filled with the required records
I would like it to close the app asynchronously.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NewTask
{
class Program
{
static void Main(string[] args)
{
NewTask.Combine taskcombine = new NewTask.Combine();
ProfileClient profilesws = new ProfileClient();
var profileRecords = profilesws.GetAllProfiles();
foreach (var profile in profileRecords.ProfileRecords)
{
var testProfile = new NewTask.Profile();
testProfile.Id = profile.Id;
testProfile.Name = profile.Name;
var result = taskcombine.TestProfile(testProfile);
}
profilesws.Close();
taskcombine.Close();
}
}
}
I want a way to run this async. I want to hit the ruslt and once it goes
through all the records into result I want it to end the task. This will
be a consol app and once the results are filled with the required records
I would like it to close the app asynchronously.
Unity3d 4.2 with Android Plugins run fail
Unity3d 4.2 with Android Plugins run fail
the project in Unity 4.1 was well.in Unity3D 4.2 ,exlipse show these:
08-25 19:32:42.659: E/Unity(12469): Unable to locate player settings.
bin/Data/settings.xml
08-25 19:32:42.699: E/proxy(12469): file not found :
'assets/libs/armeabi-v7a/libmono.so'
08-25 19:32:42.699: E/linker(12469): ERROR: Library
'/assets/libs/armeabi-v7a/libmono.so' not found
08-25 19:32:42.699: E/dalvikvm(12469): VM aborting
08-25 19:32:42.699: A/libc(12469): Fatal signal 11 (SIGSEGV) at 0xdeadd00d
(code=1)
I try to copy armeabi-v7a floder to Libs floder. still wrong.
the project in Unity 4.1 was well.in Unity3D 4.2 ,exlipse show these:
08-25 19:32:42.659: E/Unity(12469): Unable to locate player settings.
bin/Data/settings.xml
08-25 19:32:42.699: E/proxy(12469): file not found :
'assets/libs/armeabi-v7a/libmono.so'
08-25 19:32:42.699: E/linker(12469): ERROR: Library
'/assets/libs/armeabi-v7a/libmono.so' not found
08-25 19:32:42.699: E/dalvikvm(12469): VM aborting
08-25 19:32:42.699: A/libc(12469): Fatal signal 11 (SIGSEGV) at 0xdeadd00d
(code=1)
I try to copy armeabi-v7a floder to Libs floder. still wrong.
Saturday, 24 August 2013
What are the authentic traditional ingredients for Naan bread?
What are the authentic traditional ingredients for Naan bread?
I would like to know what the authentic and traditional ingredients for
Naan bread are. There are many recipes that use some ingredients but not
others and the cooking method are not always the same. These are the
ingredients which usually differ from what I have seen:
Milk
Yogurt
Water
Baking Powder
Yeast
Eggs
This recipe here does not use yogurt, this one here uses no baking powder
or milk or yogurt, this one here uses no baking powder or yogurt. I can
understand substitutions and variations, but I would like to know how it
is originally made and what the ingredients are.
Also the cooking method varies. Some use a pan to fry the Naans prepared,
some use only the oven, and some use the oven and then are grilled at the
end for a short time.
I would like to know what the authentic and traditional ingredients for
Naan bread are. There are many recipes that use some ingredients but not
others and the cooking method are not always the same. These are the
ingredients which usually differ from what I have seen:
Milk
Yogurt
Water
Baking Powder
Yeast
Eggs
This recipe here does not use yogurt, this one here uses no baking powder
or milk or yogurt, this one here uses no baking powder or yogurt. I can
understand substitutions and variations, but I would like to know how it
is originally made and what the ingredients are.
Also the cooking method varies. Some use a pan to fry the Naans prepared,
some use only the oven, and some use the oven and then are grilled at the
end for a short time.
Is there a way to create a stream for people I know and a separate stream for pages on Google+?
Is there a way to create a stream for people I know and a separate stream
for pages on Google+?
Not sure what the correct terms are for what I want to do, so please allow
for that!
I can see two columns of items on Google+. I see an awful lot of posts
from pages and communities - most of it irrelevant - that crowds out much
more 'valuable' items from people I know. It feels like G+ hasn't really
got right the display frequency of items from pages and communities, in a
way that Facebook seems to be better (eg, some pages just seem to be
regurgitating RSS feeds that update as much as every hour).
Is there a way to use one of the columns for items from the people I know
and the other column for items from pages and communities?
for pages on Google+?
Not sure what the correct terms are for what I want to do, so please allow
for that!
I can see two columns of items on Google+. I see an awful lot of posts
from pages and communities - most of it irrelevant - that crowds out much
more 'valuable' items from people I know. It feels like G+ hasn't really
got right the display frequency of items from pages and communities, in a
way that Facebook seems to be better (eg, some pages just seem to be
regurgitating RSS feeds that update as much as every hour).
Is there a way to use one of the columns for items from the people I know
and the other column for items from pages and communities?
How to get TX/RX bytes without ifconfig?
How to get TX/RX bytes without ifconfig?
Since ifconfig is apparently being deprecated in major Linux
distributions, I thought I'd learn something about the ip tool that's
supposed to be used instead of ifconfig.
And here I ran into a problem: when run on its own, ifconfig shows the
number of bytes received/transmitted on each interface besides other info.
I couldn't find a way to get this from ip. Is there no such function in
this tool? What other built-in tools could I use for getting those stats?
Since ifconfig is apparently being deprecated in major Linux
distributions, I thought I'd learn something about the ip tool that's
supposed to be used instead of ifconfig.
And here I ran into a problem: when run on its own, ifconfig shows the
number of bytes received/transmitted on each interface besides other info.
I couldn't find a way to get this from ip. Is there no such function in
this tool? What other built-in tools could I use for getting those stats?
What is a good forum for asking about code structure and organizational practices in a team?
What is a good forum for asking about code structure and organizational
practices in a team?
What is a good forum for asking about code structure and organizational
practices in a team? I know stackoverflow isn't really meant for that.
practices in a team?
What is a good forum for asking about code structure and organizational
practices in a team? I know stackoverflow isn't really meant for that.
web spider for facebook
web spider for facebook
I just subscribed to a facebook page which post links to different open
source projects or code archives. I'll like to save those links and
descriptions to a local db.
How can I do that? I heard something about the concept of web spiders and
I know some php and java but I don't know how can I solve the problem from
above.
Thank you!
I just subscribed to a facebook page which post links to different open
source projects or code archives. I'll like to save those links and
descriptions to a local db.
How can I do that? I heard something about the concept of web spiders and
I know some php and java but I don't know how can I solve the problem from
above.
Thank you!
Symfony2 - Embeding a File Form
Symfony2 - Embeding a File Form
I have two Entities
- Kitchen
- KitchenSubImage
Each kitchen has a main image but also has many sub images (KitchenSubImage).
I have implemented both the entities and their form types. At this moment
I have the form displayed and have implemented everything from How to
Handle File Uploads with Symfony2 to handle the file upload.
The issue I have is that I have no idea how to handle both file uploads at
once. It's made more complicated by the fact that the kitchen can have
many sub images.
I also have the following error at the top of the form when I submit the
form:
This value should be of type PWD\WebsiteBundle\Entity\KitchenSubImage.
Controller
<?php
namespace PWD\AdminBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use PWD\WebsiteBundle\Entity\Kitchen;
use PWD\AdminBundle\Form\Type\KitchenType;
use PWD\WebsiteBundle\Entity\KitchenSubImage;
use PWD\AdminBundle\Form\Type\KitchenSubImageType;
class KitchenController extends Controller
{
public function indexAction()
{
return 'index';
}
public function addAction(Request $request)
{
$kitchen = new Kitchen();
$image = new KitchenSubImage();
$kitchen->addSubImage($image);
$form = $this->createForm(new KitchenType(), $kitchen);
$form->handleRequest($request);
if ($form->isValid()) {
$kitchen->upload();
return $this->render('PWDWebsiteBundle:Pages:home.html.twig');
}
return $this->render('PWDAdminBundle:Pages:form-test.html.twig',
array(
'form' => $form->createView(),
));
}
}
Kitchen Entity
<?php
namespace PWD\WebsiteBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="kitchen")
*/
class Kitchen
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=100)
* @Assert\NotBlank()
*/
protected $name;
/**
* @ORM\Column(type="text")
* @Assert\NotBlank()
*/
protected $description;
/**
* @Assert\File(maxSize="6000000")
* @Assert\Image(
* minWidth = 800,
* maxWidth = 800,
* minHeight = 467,
* maxHeight = 467
* )
*/
protected $mainImage;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $mainImagePath;
/**
* @Assert\Type(type="PWD\WebsiteBundle\Entity\KitchenSubImage")
* @ORM\OneToMany(targetEntity="KitchenSubImage", mappedBy="kitchen")
*/
protected $subImage;
public function __construct()
{
$this->subImage = new ArrayCollection();
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getMainImage()
{
return $this->mainImage;
}
public function setMainImage(UploadedFile $mainImage = null)
{
$this->mainImage = $mainImage;
}
public function getSubImage()
{
return $this->subImage;
}
public function setSubImage(KitchenSubImage $subImage = null)
{
$this->subImage = $subImage;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set mainImagePath
*
* @param string $mainImagePath
* @return Kitchen
*/
public function setMainImagePath($mainImagePath)
{
$this->mainImagePath = $mainImagePath;
return $this;
}
/**
* Get mainImagePath
*
* @return string
*/
public function getMainImagePath()
{
return $this->mainImagePath;
}
public function getAbsolutePath()
{
return null === $this->mainImagePath
? null
: $this->getUploadRootDir().'/'.$this->mainImagePath;
}
public function getWebPath()
{
return null === $this->mainImagePath
? null
: $this->getUploadDir().'/'.$this->mainImagePath;
}
public function getUploadRootDir()
{
return __DIR__.'/../../../../web/'.$this->getUploadDir();
}
public function getUploadDir()
{
return 'uploads/our-work';
}
public function upload()
{
if (null === $this->getMainImage()) {
return;
}
$this->getMainImage()->move(
$this->getUploadRootDir(),
$this->getMainImage()->getClientOriginalName()
);
$this->mainImagePath =
$this->getMainImage()->getClientOriginalName();
$this->mainImage = null;
}
/**
* Add subImage
*
* @param \PWD\WebsiteBundle\Entity\KitchenSubImage $subImage
* @return Kitchen
*/
public function addSubImage(\PWD\WebsiteBundle\Entity\KitchenSubImage
$subImage)
{
$this->subImage[] = $subImage;
$subImage->setKitchen($this); # used for persisting
return $this;
}
/**
* Remove subImage
*
* @param \PWD\WebsiteBundle\Entity\KitchenSubImage $subImage
*/
public function
removeSubImage(\PWD\WebsiteBundle\Entity\KitchenSubImage $subImage)
{
$this->subImage->removeElement($subImage);
}
}
KitchenSubImage Entity
<?php
namespace PWD\WebsiteBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="kitchenImages")
*/
class KitchenSubImage
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Assert\Image(
* minWidth = 800,
* maxWidth = 800,
* minHeight = 467,
* maxHeight = 467
* )
*/
public $image;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
public $imagePath;
/**
* @ORM\ManyToOne(targetEntity="Kitchen", inversedBy="subImage")
* @ORM\JoinColumn(name="kitchen_id", referencedColumnName="id")
**/
protected $kitchen;
public function getImage()
{
return $this->image;
}
public function setImage(UploadedFile $image = null)
{
$this->image = $image;
}
public function getAbsolutePath()
{
return null === $this->imagePath
? null
: $this->getUploadRootDir().'/'.$this->imagePath;
}
public function getWebPath()
{
return null === $this->imagePath
? null
: $this->getUploadDir().'/'.$this->imagePath;
}
public function getUploadRootDir()
{
return __DIR__.'/../../../../web/'.$this->getUploadDir();
}
public function getUploadDir()
{
return 'uploads/our-work';
}
public function upload()
{
if (null === $this->getImage()) {
return;
}
$this->getImage()->move(
$this->getUploadRootDir(),
$this->getImage()->getClientOriginalName()
);
$this->mainImagePath = $this->getImage()->getClientOriginalName();
$this->mainImage = null;
}
/**
* Set imagePath
*
* @param string $imagePath
* @return KitchenSubImage
*/
public function setImagePath($imagePath)
{
$this->imagePath = $imagePath;
return $this;
}
/**
* Get imagePath
*
* @return string
*/
public function getImagePath()
{
return $this->imagePath;
}
/**
* Set kitchen
*
* @param \PWD\WebsiteBundle\Entity\Kitchen $kitchen
* @return KitchenSubImage
*/
public function setKitchen(\PWD\WebsiteBundle\Entity\Kitchen $kitchen
= null)
{
$this->kitchen = $kitchen;
return $this;
}
/**
* Get kitchen
*
* @return \PWD\WebsiteBundle\Entity\Kitchen
*/
public function getKitchen()
{
return $this->kitchen;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
}
KitchenType:
<?php
namespace PWD\AdminBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class KitchenType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name');
$builder->add('description', 'textarea');
$builder->add('mainImage', 'file');
$builder->add('subImage', 'collection', array(
'type' => new KitchenSubImageType(),
'label' => false,
'allow_add' => true,
'by_reference' => false,
));
$builder->add('submit', 'submit');
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'PWD\WebsiteBundle\Entity\Kitchen',
'cascade_validation' => true,
));
}
public function getName()
{
return 'kitchen';
}
}
KitchenSubImageType:
<?php
namespace PWD\AdminBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class KitchenSubImageType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('image', 'file', array('label' => 'Sub Images'));
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'PWD\WebsiteBundle\Entity\KitchenSubImage',
));
}
public function getName()
{
return 'kitchensubimage';
}
}
I have two Entities
- Kitchen
- KitchenSubImage
Each kitchen has a main image but also has many sub images (KitchenSubImage).
I have implemented both the entities and their form types. At this moment
I have the form displayed and have implemented everything from How to
Handle File Uploads with Symfony2 to handle the file upload.
The issue I have is that I have no idea how to handle both file uploads at
once. It's made more complicated by the fact that the kitchen can have
many sub images.
I also have the following error at the top of the form when I submit the
form:
This value should be of type PWD\WebsiteBundle\Entity\KitchenSubImage.
Controller
<?php
namespace PWD\AdminBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use PWD\WebsiteBundle\Entity\Kitchen;
use PWD\AdminBundle\Form\Type\KitchenType;
use PWD\WebsiteBundle\Entity\KitchenSubImage;
use PWD\AdminBundle\Form\Type\KitchenSubImageType;
class KitchenController extends Controller
{
public function indexAction()
{
return 'index';
}
public function addAction(Request $request)
{
$kitchen = new Kitchen();
$image = new KitchenSubImage();
$kitchen->addSubImage($image);
$form = $this->createForm(new KitchenType(), $kitchen);
$form->handleRequest($request);
if ($form->isValid()) {
$kitchen->upload();
return $this->render('PWDWebsiteBundle:Pages:home.html.twig');
}
return $this->render('PWDAdminBundle:Pages:form-test.html.twig',
array(
'form' => $form->createView(),
));
}
}
Kitchen Entity
<?php
namespace PWD\WebsiteBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="kitchen")
*/
class Kitchen
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=100)
* @Assert\NotBlank()
*/
protected $name;
/**
* @ORM\Column(type="text")
* @Assert\NotBlank()
*/
protected $description;
/**
* @Assert\File(maxSize="6000000")
* @Assert\Image(
* minWidth = 800,
* maxWidth = 800,
* minHeight = 467,
* maxHeight = 467
* )
*/
protected $mainImage;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $mainImagePath;
/**
* @Assert\Type(type="PWD\WebsiteBundle\Entity\KitchenSubImage")
* @ORM\OneToMany(targetEntity="KitchenSubImage", mappedBy="kitchen")
*/
protected $subImage;
public function __construct()
{
$this->subImage = new ArrayCollection();
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getMainImage()
{
return $this->mainImage;
}
public function setMainImage(UploadedFile $mainImage = null)
{
$this->mainImage = $mainImage;
}
public function getSubImage()
{
return $this->subImage;
}
public function setSubImage(KitchenSubImage $subImage = null)
{
$this->subImage = $subImage;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set mainImagePath
*
* @param string $mainImagePath
* @return Kitchen
*/
public function setMainImagePath($mainImagePath)
{
$this->mainImagePath = $mainImagePath;
return $this;
}
/**
* Get mainImagePath
*
* @return string
*/
public function getMainImagePath()
{
return $this->mainImagePath;
}
public function getAbsolutePath()
{
return null === $this->mainImagePath
? null
: $this->getUploadRootDir().'/'.$this->mainImagePath;
}
public function getWebPath()
{
return null === $this->mainImagePath
? null
: $this->getUploadDir().'/'.$this->mainImagePath;
}
public function getUploadRootDir()
{
return __DIR__.'/../../../../web/'.$this->getUploadDir();
}
public function getUploadDir()
{
return 'uploads/our-work';
}
public function upload()
{
if (null === $this->getMainImage()) {
return;
}
$this->getMainImage()->move(
$this->getUploadRootDir(),
$this->getMainImage()->getClientOriginalName()
);
$this->mainImagePath =
$this->getMainImage()->getClientOriginalName();
$this->mainImage = null;
}
/**
* Add subImage
*
* @param \PWD\WebsiteBundle\Entity\KitchenSubImage $subImage
* @return Kitchen
*/
public function addSubImage(\PWD\WebsiteBundle\Entity\KitchenSubImage
$subImage)
{
$this->subImage[] = $subImage;
$subImage->setKitchen($this); # used for persisting
return $this;
}
/**
* Remove subImage
*
* @param \PWD\WebsiteBundle\Entity\KitchenSubImage $subImage
*/
public function
removeSubImage(\PWD\WebsiteBundle\Entity\KitchenSubImage $subImage)
{
$this->subImage->removeElement($subImage);
}
}
KitchenSubImage Entity
<?php
namespace PWD\WebsiteBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="kitchenImages")
*/
class KitchenSubImage
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Assert\Image(
* minWidth = 800,
* maxWidth = 800,
* minHeight = 467,
* maxHeight = 467
* )
*/
public $image;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
public $imagePath;
/**
* @ORM\ManyToOne(targetEntity="Kitchen", inversedBy="subImage")
* @ORM\JoinColumn(name="kitchen_id", referencedColumnName="id")
**/
protected $kitchen;
public function getImage()
{
return $this->image;
}
public function setImage(UploadedFile $image = null)
{
$this->image = $image;
}
public function getAbsolutePath()
{
return null === $this->imagePath
? null
: $this->getUploadRootDir().'/'.$this->imagePath;
}
public function getWebPath()
{
return null === $this->imagePath
? null
: $this->getUploadDir().'/'.$this->imagePath;
}
public function getUploadRootDir()
{
return __DIR__.'/../../../../web/'.$this->getUploadDir();
}
public function getUploadDir()
{
return 'uploads/our-work';
}
public function upload()
{
if (null === $this->getImage()) {
return;
}
$this->getImage()->move(
$this->getUploadRootDir(),
$this->getImage()->getClientOriginalName()
);
$this->mainImagePath = $this->getImage()->getClientOriginalName();
$this->mainImage = null;
}
/**
* Set imagePath
*
* @param string $imagePath
* @return KitchenSubImage
*/
public function setImagePath($imagePath)
{
$this->imagePath = $imagePath;
return $this;
}
/**
* Get imagePath
*
* @return string
*/
public function getImagePath()
{
return $this->imagePath;
}
/**
* Set kitchen
*
* @param \PWD\WebsiteBundle\Entity\Kitchen $kitchen
* @return KitchenSubImage
*/
public function setKitchen(\PWD\WebsiteBundle\Entity\Kitchen $kitchen
= null)
{
$this->kitchen = $kitchen;
return $this;
}
/**
* Get kitchen
*
* @return \PWD\WebsiteBundle\Entity\Kitchen
*/
public function getKitchen()
{
return $this->kitchen;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
}
KitchenType:
<?php
namespace PWD\AdminBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class KitchenType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name');
$builder->add('description', 'textarea');
$builder->add('mainImage', 'file');
$builder->add('subImage', 'collection', array(
'type' => new KitchenSubImageType(),
'label' => false,
'allow_add' => true,
'by_reference' => false,
));
$builder->add('submit', 'submit');
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'PWD\WebsiteBundle\Entity\Kitchen',
'cascade_validation' => true,
));
}
public function getName()
{
return 'kitchen';
}
}
KitchenSubImageType:
<?php
namespace PWD\AdminBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class KitchenSubImageType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('image', 'file', array('label' => 'Sub Images'));
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'PWD\WebsiteBundle\Entity\KitchenSubImage',
));
}
public function getName()
{
return 'kitchensubimage';
}
}
how can i convert postscript files (ps) to pdf with hyperref
how can i convert postscript files (ps) to pdf with hyperref
ps (postscript) file to pdf document with hyperref and without hyperref
can any one help me to find good tool to convert ps to pdf with hyperref.
i wants my files
(ps) to be converted as pdf file with hyperref
Im using winedt 8.0 now ,
ps (postscript) file to pdf document with hyperref and without hyperref
can any one help me to find good tool to convert ps to pdf with hyperref.
i wants my files
(ps) to be converted as pdf file with hyperref
Im using winedt 8.0 now ,
All Blacks vs Wallabies Live Streaming Coverage
All Blacks vs Wallabies Live Streaming Coverage
Watch All Blacks vs Wallabies Live Streaming Link
All blacks face the rugby championship & bledisloe cup 2013 second test
match in home ground against Australia Wallabies in Westpac Stadium,
Wellington. All blacks won the first test by 47-29 goal. They also want to
win the home test. the rugby championship & bledisloe cup 2013 all blacks
vs australia live streaming test mach will kick of 10.05 GMT on Saturday
in Westpac Stadium, Wellington. No body don't miss that rugby game. It is
the most exiting game for Australia, because they already loss the first
test in Sydney.
Schedule: all blacks vs australia
Venue: Westpac Stadium, Wellington
Kick Off Time: 10.05 GMT
Watch All Blacks vs Wallabies Live Streaming Link
Watch All Blacks vs Wallabies Live Streaming Link
All blacks face the rugby championship & bledisloe cup 2013 second test
match in home ground against Australia Wallabies in Westpac Stadium,
Wellington. All blacks won the first test by 47-29 goal. They also want to
win the home test. the rugby championship & bledisloe cup 2013 all blacks
vs australia live streaming test mach will kick of 10.05 GMT on Saturday
in Westpac Stadium, Wellington. No body don't miss that rugby game. It is
the most exiting game for Australia, because they already loss the first
test in Sydney.
Schedule: all blacks vs australia
Venue: Westpac Stadium, Wellington
Kick Off Time: 10.05 GMT
Watch All Blacks vs Wallabies Live Streaming Link
Friday, 23 August 2013
Configuring Syslog(unix) with Apache Flume
Configuring Syslog(unix) with Apache Flume
Looking for a step by step config of syslog with apache flume. Done with
HDFS, mapred, hbase and hive. Any help will be really helpful and eagerly
waiting for your inputs.
Thanks Dwarak
Looking for a step by step config of syslog with apache flume. Done with
HDFS, mapred, hbase and hive. Any help will be really helpful and eagerly
waiting for your inputs.
Thanks Dwarak
IE 10 works locally with @font-face, but not when viewing page from server
IE 10 works locally with @font-face, but not when viewing page from server
I'm using a custom created web font from icomoon that's hosted on my own
server. Was amazed at how easy everything was. Tested locally on all
browsers. Works great (even down to IE7 and firefox 4)! Tested again from
my server and it doesn't work in IE10.
Pretty sure I'm declaring the fonts right:
@font-face {
font-family: 'icomoon';
src:url('../fonts/icomoon.eot');
src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('../fonts/icomoon.woff') format('woff'),
url('../fonts/icomoon.ttf') format('truetype'),
url('../fonts/icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
Here's a link to the test site http://www.corysgrilledcheese.com/store/ if
you want to take a look.
And here's a link to screenshots
http://www.corysgrilledcheese.com/store/fontsBroken.png of what it looks
like when I load the page locally, and then with the same browser viewing
the page from a server.
I've been scouring the web, but no luck so far. Any suggestions on a
solution would be much appreciated.
I'm using a custom created web font from icomoon that's hosted on my own
server. Was amazed at how easy everything was. Tested locally on all
browsers. Works great (even down to IE7 and firefox 4)! Tested again from
my server and it doesn't work in IE10.
Pretty sure I'm declaring the fonts right:
@font-face {
font-family: 'icomoon';
src:url('../fonts/icomoon.eot');
src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('../fonts/icomoon.woff') format('woff'),
url('../fonts/icomoon.ttf') format('truetype'),
url('../fonts/icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
Here's a link to the test site http://www.corysgrilledcheese.com/store/ if
you want to take a look.
And here's a link to screenshots
http://www.corysgrilledcheese.com/store/fontsBroken.png of what it looks
like when I load the page locally, and then with the same browser viewing
the page from a server.
I've been scouring the web, but no luck so far. Any suggestions on a
solution would be much appreciated.
Where does Ghostscript need to be installed if I want to use it with imagemagick in XAMPP
Where does Ghostscript need to be installed if I want to use it with
imagemagick in XAMPP
So I am using the local installed server XAMPP with imagemagick to convert
pdf files into images, but I need Ghostscript too .. Installing
ghostscript , does it need to be installed in the XAMPP folder too in
order for imagemagick to communicate with it or can I just install it
normally by clicking here
http://sourceforge.net/projects/ghostscript/?source=dlp and install it
Because for imagemagick , I had to install it , placed the folder in the
xampp directory , then add the php_imagick.dll file in the php/ext folder
, then edit php.ini, which it worked.. what should be done about
ghostscript though ? just download it normally and it will work wherever
it's placed ?
imagemagick in XAMPP
So I am using the local installed server XAMPP with imagemagick to convert
pdf files into images, but I need Ghostscript too .. Installing
ghostscript , does it need to be installed in the XAMPP folder too in
order for imagemagick to communicate with it or can I just install it
normally by clicking here
http://sourceforge.net/projects/ghostscript/?source=dlp and install it
Because for imagemagick , I had to install it , placed the folder in the
xampp directory , then add the php_imagick.dll file in the php/ext folder
, then edit php.ini, which it worked.. what should be done about
ghostscript though ? just download it normally and it will work wherever
it's placed ?
Oracle SQL Statement Order By
Oracle SQL Statement Order By
I have got this following query:
COLUMN INDEX_NAME FORMAT A15 HEADING "INDEX_NAME"
COLUMN COLUMN_NAME FORMAT A15 HEADING "COLUMN_NAME"
COLUMN COLUMN_POSITION FORMAT 999999 HEADING "COLUMN_POSITION"
SELECT INDEX_NAME, COLUMN_NAME, COLUMN_POSITION
FROM ALL_IND_COLUMNS
WHERE TABLE_OWNER = 'ABC'
The returned result is as follows:
INDEX_NAME COLUMN_NAME COLUMN_POSITION
--------------- --------------- ---------------
SYS_C007963 C_UNAME 1
ORDER_LINE_PKEY OL_ID 1
ORDER_LINE_PKEY OL_O_ID 2
ORDERS_PKEY O_ID 1
ITEM_PKEY I_ID 1
CUSTOMER_PKEY C_ID 1
COUNTRY_PKEY CO_ID 1
CC_XACTS_PKEY CX_O_ID 1
AUTHOR_PKEY A_ID 1
ADDRESS_PKEY ADDR_ID 1
10 rows selected
How do i change the sql statement such that it will sort according to the
number of repeated INDEX_NAME in ascending order?
For example like this:
INDEX_NAME COLUMN_NAME COLUMN_POSITION
--------------- --------------- ---------------
SYS_C007963 C_UNAME 1
ORDERS_PKEY O_ID 1
ITEM_PKEY I_ID 1
CUSTOMER_PKEY C_ID 1
COUNTRY_PKEY CO_ID 1
CC_XACTS_PKEY CX_O_ID 1
AUTHOR_PKEY A_ID 1
ADDRESS_PKEY ADDR_ID 1
ORDER_LINE_PKEY OL_ID 1
ORDER_LINE_PKEY OL_O_ID 2
10 rows selected
I have got this following query:
COLUMN INDEX_NAME FORMAT A15 HEADING "INDEX_NAME"
COLUMN COLUMN_NAME FORMAT A15 HEADING "COLUMN_NAME"
COLUMN COLUMN_POSITION FORMAT 999999 HEADING "COLUMN_POSITION"
SELECT INDEX_NAME, COLUMN_NAME, COLUMN_POSITION
FROM ALL_IND_COLUMNS
WHERE TABLE_OWNER = 'ABC'
The returned result is as follows:
INDEX_NAME COLUMN_NAME COLUMN_POSITION
--------------- --------------- ---------------
SYS_C007963 C_UNAME 1
ORDER_LINE_PKEY OL_ID 1
ORDER_LINE_PKEY OL_O_ID 2
ORDERS_PKEY O_ID 1
ITEM_PKEY I_ID 1
CUSTOMER_PKEY C_ID 1
COUNTRY_PKEY CO_ID 1
CC_XACTS_PKEY CX_O_ID 1
AUTHOR_PKEY A_ID 1
ADDRESS_PKEY ADDR_ID 1
10 rows selected
How do i change the sql statement such that it will sort according to the
number of repeated INDEX_NAME in ascending order?
For example like this:
INDEX_NAME COLUMN_NAME COLUMN_POSITION
--------------- --------------- ---------------
SYS_C007963 C_UNAME 1
ORDERS_PKEY O_ID 1
ITEM_PKEY I_ID 1
CUSTOMER_PKEY C_ID 1
COUNTRY_PKEY CO_ID 1
CC_XACTS_PKEY CX_O_ID 1
AUTHOR_PKEY A_ID 1
ADDRESS_PKEY ADDR_ID 1
ORDER_LINE_PKEY OL_ID 1
ORDER_LINE_PKEY OL_O_ID 2
10 rows selected
Not able to access MSSQL analysis services cubes
Not able to access MSSQL analysis services cubes
I am using the following code to access mssql analysis services cubes from
java using OLAP4j 1.1.0
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
OlapConnection con = (OlapConnection)
DriverManager.getConnection("jdbc:xmla:Server=http://mssql.com/mssql/msmdpump.dll;"+
"Cache=org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache;"+
"Cache.Name=MyNiftyConnection;Cache.Mode=LFU;Cache.Timeout=600;Cache.Size=100",
"username", "password");
OlapWrapper wrapper = (OlapWrapper) con;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement stmt = olapConnection.createStatement();
CellSet cellSet = stmt.executeOlapQuery("SELECT {" +
" [Measures].[LoginTime_Format]," +
"[Measures].[EngageTime_Format]," +
"[Measures].[ChatTime_Format]," +
"[Measures].[AverageHandleTime_Format]," +
"[Measures].[MultipleChatTime_Format]," +
"[Measures].[NonEngagedTime_Format]," +
"[Measures].[TimeAvailable_Format]," +
"[Measures].[TimeAvailableNotChatting_Format]," +
"[Measures].[TimeNotAvailable_Format]," +
"[Measures].[TimeNotAvailableChatting_Format]," +
"[Measures].[AcdTimeouts]," +
"[Measures].[AvgConcurrency]," +
"[Measures].[OperatorUtilization]} ON 0," +
" NON EMPTY ([DimTime].[CalenderDayHour].[CalenderDayHour],
[DimAgent].[Agent]."+
"[Agent],[DimAgent].[Agent Name].[Agent Name]) ON 1" +
" FROM (SELECT [DimClient].[Client].&[4] ON 0 FROM" +
" (SELECT [DimTime].[CalenderDayHour].[CalenderDayHour].&[2013010100]:"+
"[DimTime].[CalenderDayHour].[CalenderDayHour].&[2013121216] ON 0 FROM
[247OLAP]))");
When I run this code I get the following exception at executeOlapQuery line-
Exception in thread "main" java.lang.RuntimeException: [FATAL]:1:1:
Content is not allowed in prolog.
at
org.olap4j.driver.xmla.XmlaOlap4jUtil.checkForParseError(XmlaOlap4jUtil.java:134)
at org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:83) at
org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:884)
at
org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:137)
at
org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:67)
at
org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getDatabaseProperties(XmlaOlap4jDatabaseMetaData.java:1044)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.makeConnectionPropertyList(XmlaOlap4jConnection.java:324)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.generateRequest(XmlaOlap4jConnection.java:1037)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:849)
at
org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:136)
at
org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:90)
at
org.olap4j.driver.xmla.DeferredNamedListImpl.size(DeferredNamedListImpl.java:116)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapDatabase(XmlaOlap4jConnection.java:451)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapCatalog(XmlaOlap4jConnection.java:501)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.getCatalog(XmlaOlap4jConnection.java:496)
at
org.olap4j.driver.xmla.XmlaOlap4jStatement.executeOlapQuery(XmlaOlap4jStatement.java:291)
at com.tfsc.ilabs.olap4j.POC.main(POC.java:28) Caused by:
org.xml.sax.SAXParseException: Content is not allowed in prolog. at
org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at
org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:80)
Any help will be much appreciated.
I am using the following code to access mssql analysis services cubes from
java using OLAP4j 1.1.0
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
OlapConnection con = (OlapConnection)
DriverManager.getConnection("jdbc:xmla:Server=http://mssql.com/mssql/msmdpump.dll;"+
"Cache=org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache;"+
"Cache.Name=MyNiftyConnection;Cache.Mode=LFU;Cache.Timeout=600;Cache.Size=100",
"username", "password");
OlapWrapper wrapper = (OlapWrapper) con;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement stmt = olapConnection.createStatement();
CellSet cellSet = stmt.executeOlapQuery("SELECT {" +
" [Measures].[LoginTime_Format]," +
"[Measures].[EngageTime_Format]," +
"[Measures].[ChatTime_Format]," +
"[Measures].[AverageHandleTime_Format]," +
"[Measures].[MultipleChatTime_Format]," +
"[Measures].[NonEngagedTime_Format]," +
"[Measures].[TimeAvailable_Format]," +
"[Measures].[TimeAvailableNotChatting_Format]," +
"[Measures].[TimeNotAvailable_Format]," +
"[Measures].[TimeNotAvailableChatting_Format]," +
"[Measures].[AcdTimeouts]," +
"[Measures].[AvgConcurrency]," +
"[Measures].[OperatorUtilization]} ON 0," +
" NON EMPTY ([DimTime].[CalenderDayHour].[CalenderDayHour],
[DimAgent].[Agent]."+
"[Agent],[DimAgent].[Agent Name].[Agent Name]) ON 1" +
" FROM (SELECT [DimClient].[Client].&[4] ON 0 FROM" +
" (SELECT [DimTime].[CalenderDayHour].[CalenderDayHour].&[2013010100]:"+
"[DimTime].[CalenderDayHour].[CalenderDayHour].&[2013121216] ON 0 FROM
[247OLAP]))");
When I run this code I get the following exception at executeOlapQuery line-
Exception in thread "main" java.lang.RuntimeException: [FATAL]:1:1:
Content is not allowed in prolog.
at
org.olap4j.driver.xmla.XmlaOlap4jUtil.checkForParseError(XmlaOlap4jUtil.java:134)
at org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:83) at
org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:884)
at
org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:137)
at
org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:67)
at
org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getDatabaseProperties(XmlaOlap4jDatabaseMetaData.java:1044)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.makeConnectionPropertyList(XmlaOlap4jConnection.java:324)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.generateRequest(XmlaOlap4jConnection.java:1037)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:849)
at
org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:136)
at
org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:90)
at
org.olap4j.driver.xmla.DeferredNamedListImpl.size(DeferredNamedListImpl.java:116)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapDatabase(XmlaOlap4jConnection.java:451)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapCatalog(XmlaOlap4jConnection.java:501)
at
org.olap4j.driver.xmla.XmlaOlap4jConnection.getCatalog(XmlaOlap4jConnection.java:496)
at
org.olap4j.driver.xmla.XmlaOlap4jStatement.executeOlapQuery(XmlaOlap4jStatement.java:291)
at com.tfsc.ilabs.olap4j.POC.main(POC.java:28) Caused by:
org.xml.sax.SAXParseException: Content is not allowed in prolog. at
org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at
org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:80)
Any help will be much appreciated.
Accessing fields with '@' symbol of object in dGrid
Accessing fields with '@' symbol of object in dGrid
I have an issue to set fields of layer in dGrid.
store = new Memory({data: someData});
grid = new Grid({
store: store
});
layout = {[label: 'ID', field: '@attributes', formatter: getId]};
grid.set('columns', layout);
the someData is an object with the following structure
someData = {
@attributes: {
id: someId
}
};
getId = function (value, rowId) {
return value.id;
};
well, it cannot get the Id or anything.
I appreciate any suggestion. Thanks in advance :)
I have an issue to set fields of layer in dGrid.
store = new Memory({data: someData});
grid = new Grid({
store: store
});
layout = {[label: 'ID', field: '@attributes', formatter: getId]};
grid.set('columns', layout);
the someData is an object with the following structure
someData = {
@attributes: {
id: someId
}
};
getId = function (value, rowId) {
return value.id;
};
well, it cannot get the Id or anything.
I appreciate any suggestion. Thanks in advance :)
Thursday, 22 August 2013
Kendo UI line chart sort order
Kendo UI line chart sort order
I can't work out how to get the categories ordering correctly on the
x-axis in a kendo UI line chart. Here's my example:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div id="chart"></div>
<script src="js/thirdParty/jquery.js"></script>
<script src="js/thirdParty/kendo.all.min.js"></script>
<script>
$(function () {
var data,
dataSource;
data = [{
type: "C1",
amount: 100,
year: 2008
}, {
type: "C2",
amount: 120,
year: 2008
}, {
type: "C2",
amount: 50,
year: 2009
}, {
type: "C1",
amount: 10,
year: 2010
}, {
type: "C1",
amount: 120,
year: 2011
}, {
type: "C2",
amount: 50,
year: 2011
}];
dataSource = new kendo.data.DataSource({
data: data,
group: {field: "type"},
sort: { field: "year" }
});
$("#chart").kendoChart({
dataSource: dataSource,
series: [{
type: "line",
field: "amount",
categoryField: "year",
name: "#= group.value #"
}],
})
});
</script>
</body>
</html>
and here's a screen shot of what the output looks like:
As you can see the years are ordered incorrectly even though the data is
in year order and I've specified to sort on year in the kendo data source.
Any help would be appreciated.
I can't work out how to get the categories ordering correctly on the
x-axis in a kendo UI line chart. Here's my example:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div id="chart"></div>
<script src="js/thirdParty/jquery.js"></script>
<script src="js/thirdParty/kendo.all.min.js"></script>
<script>
$(function () {
var data,
dataSource;
data = [{
type: "C1",
amount: 100,
year: 2008
}, {
type: "C2",
amount: 120,
year: 2008
}, {
type: "C2",
amount: 50,
year: 2009
}, {
type: "C1",
amount: 10,
year: 2010
}, {
type: "C1",
amount: 120,
year: 2011
}, {
type: "C2",
amount: 50,
year: 2011
}];
dataSource = new kendo.data.DataSource({
data: data,
group: {field: "type"},
sort: { field: "year" }
});
$("#chart").kendoChart({
dataSource: dataSource,
series: [{
type: "line",
field: "amount",
categoryField: "year",
name: "#= group.value #"
}],
})
});
</script>
</body>
</html>
and here's a screen shot of what the output looks like:
As you can see the years are ordered incorrectly even though the data is
in year order and I've specified to sort on year in the kendo data source.
Any help would be appreciated.
Google Play Beta: Is there a way to offer the beta to all your users?
Google Play Beta: Is there a way to offer the beta to all your users?
Given that Google no longer provides customer email data through Wallet,
how is one to go about gathering a beta group? Seems like a huge oversight
not to have a Google sponsored way for users to opt in. Do I really need
to build the list/group myself starting at 0?
Given that Google no longer provides customer email data through Wallet,
how is one to go about gathering a beta group? Seems like a huge oversight
not to have a Google sponsored way for users to opt in. Do I really need
to build the list/group myself starting at 0?
std::map compare function function and NULL
std::map compare function function and NULL
I've written a compare function for a std::map so I can have custom key
types.
class GGDictionaryMapCompare
{
public:
bool operator()(GGString * lhs, GGString * rhs)
{
return strcmp(lhs->str(), rhs->str()) < 0;
}
};
The issue is that the lhs is coming in NULL. I never insert a NULL into
the map, so this should not be happening. Any idea why? Or am I just doing
the compare function wrong? I can protect against getting NULL, but it
seems like something is wrong and I don't want to cure a symptom and not
the problem.
Thanks
I've written a compare function for a std::map so I can have custom key
types.
class GGDictionaryMapCompare
{
public:
bool operator()(GGString * lhs, GGString * rhs)
{
return strcmp(lhs->str(), rhs->str()) < 0;
}
};
The issue is that the lhs is coming in NULL. I never insert a NULL into
the map, so this should not be happening. Any idea why? Or am I just doing
the compare function wrong? I can protect against getting NULL, but it
seems like something is wrong and I don't want to cure a symptom and not
the problem.
Thanks
, KB2844285 Security Update .NET 2.0 will not install
, KB2844285 Security Update .NET 2.0 will not install
KB2844285 Security Update .NET 2.0 will not install it will download, but
will not install using automatic Windows updates, I have tried all the
"fix it" tools MS has suggested, should I just wait till next month when
next updates arrive, and hope MS is aware of the problem and have a patch
ready to fix the problem?
KB2844285 Security Update .NET 2.0 will not install it will download, but
will not install using automatic Windows updates, I have tried all the
"fix it" tools MS has suggested, should I just wait till next month when
next updates arrive, and hope MS is aware of the problem and have a patch
ready to fix the problem?
How to make octopress use system version of ruby
How to make octopress use system version of ruby
I am trying to setup octopress on my mac. The default version of ruby on
my mac was 1.8.7 but I have upgraded it to 2.0.0. If I do
'which ruby'
it prints
'/Users/liqiushi/.rvm/rubies/ruby-2.0.0-p247/bin/ruby'.
After cloning my existed sources from github and 'cd' into that folder, I
got the following error:
'You are using '.rvmrc', it requires trusting, it is slower and it is not
compatible with other ruby managers, you can switch to '.ruby-version'
using 'rvm rvmrc to [.]ruby-version' or ignore this warning with 'rvm
rvmrc warning ignore
/Users/liqiushi/Documents/photosynthesiis.github.com/.rvmrc', '.rvmrc'
will continue to be the default project file in RVM 1 and RVM 2, to ignore
the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
ruby-1.9.3-p448 is not installed. To install do: 'rvm install
ruby-1.9.3-p448''
if I do
'ruby -v'
in the octopress folder it prints
'ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]'
, and if I do
'which ruby'
it prints
'/usr/bin/ruby'
Can anyone tell how to make octopress to use ruby I just upgraded in my
mac instead of using 1.8.7. thanks
I am trying to setup octopress on my mac. The default version of ruby on
my mac was 1.8.7 but I have upgraded it to 2.0.0. If I do
'which ruby'
it prints
'/Users/liqiushi/.rvm/rubies/ruby-2.0.0-p247/bin/ruby'.
After cloning my existed sources from github and 'cd' into that folder, I
got the following error:
'You are using '.rvmrc', it requires trusting, it is slower and it is not
compatible with other ruby managers, you can switch to '.ruby-version'
using 'rvm rvmrc to [.]ruby-version' or ignore this warning with 'rvm
rvmrc warning ignore
/Users/liqiushi/Documents/photosynthesiis.github.com/.rvmrc', '.rvmrc'
will continue to be the default project file in RVM 1 and RVM 2, to ignore
the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
ruby-1.9.3-p448 is not installed. To install do: 'rvm install
ruby-1.9.3-p448''
if I do
'ruby -v'
in the octopress folder it prints
'ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]'
, and if I do
'which ruby'
it prints
'/usr/bin/ruby'
Can anyone tell how to make octopress to use ruby I just upgraded in my
mac instead of using 1.8.7. thanks
Change String in another Class as Parameter in Sub
Change String in another Class as Parameter in Sub
I have Class1 where i set a String: Public Str as String. The Form1_Load
event fills the string with a default value "C:". If the user wants to
change this default path he can use a FolderBrowserDialog. I have a sub
(in Class From1) since there are 5 Paths the user is able to change.
I want the Str variable to be filled with the new string, so i tried
Public Sub DialogOpener(ByRef SetTextbox As TextBox, newstring as String)
FolderBrowserDialog1.ShowDialog()
Dim Path As String = FolderBrowserDialog1.SelectedPath
SetTextbox.Text = Nothing
Dim RIm As New RImport
RIm.newstring = newstring
SetTextbox.Text = Path
End Sub
But "RIm.str = newstring" is not working. And i have no idea what i do wrong.
I have Class1 where i set a String: Public Str as String. The Form1_Load
event fills the string with a default value "C:". If the user wants to
change this default path he can use a FolderBrowserDialog. I have a sub
(in Class From1) since there are 5 Paths the user is able to change.
I want the Str variable to be filled with the new string, so i tried
Public Sub DialogOpener(ByRef SetTextbox As TextBox, newstring as String)
FolderBrowserDialog1.ShowDialog()
Dim Path As String = FolderBrowserDialog1.SelectedPath
SetTextbox.Text = Nothing
Dim RIm As New RImport
RIm.newstring = newstring
SetTextbox.Text = Path
End Sub
But "RIm.str = newstring" is not working. And i have no idea what i do wrong.
Wednesday, 21 August 2013
How to get part of HTML using Jsoup
How to get part of HTML using Jsoup
I've got the String full of HTML. How can I get some text from it?
For example:
</div></div></td>
<td class="searchresult__cell b-vacancy-list-logo
m-vacancy-list-logo_premium m-searchresult__premium">
<table>
<tr>
<td class="b-employerlogo-container"><a
class="b-employerlogo-link" href="/employer/950853"><img
class="b-employerlogo-img" src="/employer-logo/724337.jpeg"
alt="Ñáåðáàíê-Òåõíîëîãèè"/></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="searchresult__cell m-searchresult_star"/>
<td class="searchresult__cell m-searchresult__premium">
<div class="">
<div class="searchresult__name"><span class="b-marker"><a
class="b-vacancy-list-link b-marker-link"
href="http://hh.ru/vacancy/7870357?query=java" target="_blank">Java
developer</a></span></div>
<div class="b-vacancy-list-salary">
And so I need to get Java developer which between <a
class="b-vacancy-list-link b-marker-link"
href="http://hh.ru/vacancy/7870357?query=java" target="_blank"> and </a>
tags. How to do this?
I've got the String full of HTML. How can I get some text from it?
For example:
</div></div></td>
<td class="searchresult__cell b-vacancy-list-logo
m-vacancy-list-logo_premium m-searchresult__premium">
<table>
<tr>
<td class="b-employerlogo-container"><a
class="b-employerlogo-link" href="/employer/950853"><img
class="b-employerlogo-img" src="/employer-logo/724337.jpeg"
alt="Ñáåðáàíê-Òåõíîëîãèè"/></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="searchresult__cell m-searchresult_star"/>
<td class="searchresult__cell m-searchresult__premium">
<div class="">
<div class="searchresult__name"><span class="b-marker"><a
class="b-vacancy-list-link b-marker-link"
href="http://hh.ru/vacancy/7870357?query=java" target="_blank">Java
developer</a></span></div>
<div class="b-vacancy-list-salary">
And so I need to get Java developer which between <a
class="b-vacancy-list-link b-marker-link"
href="http://hh.ru/vacancy/7870357?query=java" target="_blank"> and </a>
tags. How to do this?
AngularJs $watch function n,o doesn't work
AngularJs $watch function n,o doesn't work
I haven't been able to find an answer to this, mostly because wording it
is kind of hard. What I have is my new change and old change. I know for a
fact that the old change should be different but it randomly is the same
as the new change. Here is my code:
$scope.$watch(function() { return partNumber }, function(n,o) {
$http.get(afHttp.baseUrl + "/" + $scope.partName + "/" + n)
.success(function(data) {
console.log(n);
console.log(o);
$scope.grid.data = data;
});
});
So I know for a fact the old part is different and I guess updating too
fast perhaps? If I was on part 1 and changed to part 2 it would console
log 2 2. I don't know why can anyone help?
I haven't been able to find an answer to this, mostly because wording it
is kind of hard. What I have is my new change and old change. I know for a
fact that the old change should be different but it randomly is the same
as the new change. Here is my code:
$scope.$watch(function() { return partNumber }, function(n,o) {
$http.get(afHttp.baseUrl + "/" + $scope.partName + "/" + n)
.success(function(data) {
console.log(n);
console.log(o);
$scope.grid.data = data;
});
});
So I know for a fact the old part is different and I guess updating too
fast perhaps? If I was on part 1 and changed to part 2 it would console
log 2 2. I don't know why can anyone help?
What sort of events could end up consuming 'sys' time on OSX and not on Linux?
What sort of events could end up consuming 'sys' time on OSX and not on
Linux?
A program of mine that 'computes', on OS/X, shows a time like:
real 0m10.883s
user 0m6.924s
sys 0m3.957s
On a nearby Linux system, in contrast, I see:
real 0m7.480s
user 0m7.172s
sys 0m0.280s
To make matters worse, this situation arrived after rewriting one
particular algorithm, and neither the new nor the old does any obvious
system-call-ish stuff.
Some poking around with dapptrace and iprofiler failed to turn up
anything. This is all 10.8.2, xcode 4.2. The code in question is C++.
Linux?
A program of mine that 'computes', on OS/X, shows a time like:
real 0m10.883s
user 0m6.924s
sys 0m3.957s
On a nearby Linux system, in contrast, I see:
real 0m7.480s
user 0m7.172s
sys 0m0.280s
To make matters worse, this situation arrived after rewriting one
particular algorithm, and neither the new nor the old does any obvious
system-call-ish stuff.
Some poking around with dapptrace and iprofiler failed to turn up
anything. This is all 10.8.2, xcode 4.2. The code in question is C++.
async PHP cron job? is it possible?
async PHP cron job? is it possible?
I need to write a cron (php) script to get the html result from several
websites.
Let's say my database has 50 websites records (ie.
http://www.somewebsite.com/page.php). So the cron job will be set to run
every x mins. When it's running, it will load the records from database,
check the status of each websites then get the HTML result back from it
then analysis it.
My concern is, if the website from n'th record is not responding, or it
takes some time to load (ie. oversea website), then n+1's record won't be
run, not until n'th record is finished, then this cron job will take a
while to finish.
If I execute the script on a browser, then it can be easily handled by
using ajax async, however it's a cron job, so I have no idea how to handle
this situation.
I need to write a cron (php) script to get the html result from several
websites.
Let's say my database has 50 websites records (ie.
http://www.somewebsite.com/page.php). So the cron job will be set to run
every x mins. When it's running, it will load the records from database,
check the status of each websites then get the HTML result back from it
then analysis it.
My concern is, if the website from n'th record is not responding, or it
takes some time to load (ie. oversea website), then n+1's record won't be
run, not until n'th record is finished, then this cron job will take a
while to finish.
If I execute the script on a browser, then it can be easily handled by
using ajax async, however it's a cron job, so I have no idea how to handle
this situation.
SVN to GIT migration resulting in Huge SIze of GIT Repo
SVN to GIT migration resulting in Huge SIze of GIT Repo
I executed the below commands in git server to migrate a SVN repo to GIT repo
mkdir xyz.git
git init --bare xyz.git
svn git clone http://x.y.x.y/svn/CLF xyz.git
du -sh xyz.git
After doing this the size of GIT repo is showing double the size of
subversion repo. Can you please guide whether the steps that i am
following for migration is right or wrong.
I executed the below commands in git server to migrate a SVN repo to GIT repo
mkdir xyz.git
git init --bare xyz.git
svn git clone http://x.y.x.y/svn/CLF xyz.git
du -sh xyz.git
After doing this the size of GIT repo is showing double the size of
subversion repo. Can you please guide whether the steps that i am
following for migration is right or wrong.
Spring data - hadoop connectivity
Spring data - hadoop connectivity
I'm trying out Spring Data - Hadoop for executing the MR code on a remote
cluster from my local machine's IDE
My bean configuration file viz. applicationContext.xml is as follows :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hdp="http://www.springframework.org/schema/hadoop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/hadoop
http://www.springframework.org/schema/hadoop/spring-hadoop.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:property-placeholder location="resources/hadoop.properties" />
<hdp:configuration>
fs.default.name=${hd.fs}
</hdp:configuration>
<hdp:job id="wc-job" mapper="com.hadoop.basics.WordCounter.WCMapper"
reducer="com.hadoop.basics.WordCounter.WCReducer"
input-path="${wordcount.input.path}"
output-path="${wordcount.output.path}">
</hdp:job>
</beans>
hadoop.properties
hd.fs=hdfs://cloudx-843-770:9000
wordcount.input.path=/scratchpad/input/Childhood_days.txt
wordcount.output.path=/scratchpad/output
The java class which I'm doing 'Run as ...'
package com.hadoop.basics;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class WordCounter {
private static IntWritable one = new IntWritable(1);
public class WCMapper extends Mapper<Text, Text, Text, IntWritable> {
@Override
protected void map(
Text key,
Text value,
org.apache.hadoop.mapreduce.Mapper<Text, Text, Text,
IntWritable>.Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
StringTokenizer strTokenizer = new
StringTokenizer(value.toString());
Text token = new Text();
while (strTokenizer.hasMoreTokens()) {
token.set(strTokenizer.nextToken());
context.write(token, one);
}
}
}
public class WCReducer extends
Reducer<Text, IntWritable, Text, IntWritable> {
@Override
protected void reduce(
Text key,
Iterable<IntWritable> values,
org.apache.hadoop.mapreduce.Reducer<Text, IntWritable,
Text, IntWritable>.Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
int sum = 0;
for (IntWritable value : values) {
sum += value.get();
}
context.write(key, new IntWritable(sum));
}
}
public static void main(String[] args) {
AbstractApplicationContext context = new
ClassPathXmlApplicationContext(
"applicationContext.xml", WordCounter.class);
System.out.println("Word Count Application Running");
context.registerShutdownHook();
}
}
Obviously, I get an error on the cluster :
2013-08-21 17:53:57,110 WARN
org.apache.hadoop.security.ShellBasedUnixGroupsMapping: got exception
trying to get groups for user 298790
org.apache.hadoop.util.Shell$ExitCodeException: id: 298790: No such user
at org.apache.hadoop.util.Shell.runCommand(Shell.java:255)
at org.apache.hadoop.util.Shell.run(Shell.java:182)
at
org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:375)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:461)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:444)
at
org.apache.hadoop.security.ShellBasedUnixGroupsMapping.getUnixGroups(ShellBasedUnixGroupsMapping.java:68)
at
org.apache.hadoop.security.ShellBasedUnixGroupsMapping.getGroups(ShellBasedUnixGroupsMapping.java:45)
at org.apache.hadoop.security.Groups.getGroups(Groups.java:79)
at
org.apache.hadoop.security.UserGroupInformation.getGroupNames(UserGroupInformation.java:1054)
at
org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.<init>(FSPermissionChecker.java:50)
at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(FSNamesystem.java:5464)
at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkTraverse(FSNamesystem.java:5447)
at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:2168)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.getFileInfo(NameNode.java:888)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:578)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1393)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1389)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1149)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1387)
2013-08-21 17:53:57,113 WARN
org.apache.hadoop.security.UserGroupInformation: No groups available for
user 298790
2013-08-21 17:53:57,179 WARN
org.apache.hadoop.security.ShellBasedUnixGroupsMapping: got exception
trying to get groups for user 298790
As per the docs., a resource loader must be used for using a different
user, accordingly, I reached to the class HdfsResourceLoader spring data
api but the "user" element isn't recognized by the JobFactoryBean.
How should I proceed ???
I'm trying out Spring Data - Hadoop for executing the MR code on a remote
cluster from my local machine's IDE
My bean configuration file viz. applicationContext.xml is as follows :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hdp="http://www.springframework.org/schema/hadoop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/hadoop
http://www.springframework.org/schema/hadoop/spring-hadoop.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:property-placeholder location="resources/hadoop.properties" />
<hdp:configuration>
fs.default.name=${hd.fs}
</hdp:configuration>
<hdp:job id="wc-job" mapper="com.hadoop.basics.WordCounter.WCMapper"
reducer="com.hadoop.basics.WordCounter.WCReducer"
input-path="${wordcount.input.path}"
output-path="${wordcount.output.path}">
</hdp:job>
</beans>
hadoop.properties
hd.fs=hdfs://cloudx-843-770:9000
wordcount.input.path=/scratchpad/input/Childhood_days.txt
wordcount.output.path=/scratchpad/output
The java class which I'm doing 'Run as ...'
package com.hadoop.basics;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class WordCounter {
private static IntWritable one = new IntWritable(1);
public class WCMapper extends Mapper<Text, Text, Text, IntWritable> {
@Override
protected void map(
Text key,
Text value,
org.apache.hadoop.mapreduce.Mapper<Text, Text, Text,
IntWritable>.Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
StringTokenizer strTokenizer = new
StringTokenizer(value.toString());
Text token = new Text();
while (strTokenizer.hasMoreTokens()) {
token.set(strTokenizer.nextToken());
context.write(token, one);
}
}
}
public class WCReducer extends
Reducer<Text, IntWritable, Text, IntWritable> {
@Override
protected void reduce(
Text key,
Iterable<IntWritable> values,
org.apache.hadoop.mapreduce.Reducer<Text, IntWritable,
Text, IntWritable>.Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
int sum = 0;
for (IntWritable value : values) {
sum += value.get();
}
context.write(key, new IntWritable(sum));
}
}
public static void main(String[] args) {
AbstractApplicationContext context = new
ClassPathXmlApplicationContext(
"applicationContext.xml", WordCounter.class);
System.out.println("Word Count Application Running");
context.registerShutdownHook();
}
}
Obviously, I get an error on the cluster :
2013-08-21 17:53:57,110 WARN
org.apache.hadoop.security.ShellBasedUnixGroupsMapping: got exception
trying to get groups for user 298790
org.apache.hadoop.util.Shell$ExitCodeException: id: 298790: No such user
at org.apache.hadoop.util.Shell.runCommand(Shell.java:255)
at org.apache.hadoop.util.Shell.run(Shell.java:182)
at
org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:375)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:461)
at org.apache.hadoop.util.Shell.execCommand(Shell.java:444)
at
org.apache.hadoop.security.ShellBasedUnixGroupsMapping.getUnixGroups(ShellBasedUnixGroupsMapping.java:68)
at
org.apache.hadoop.security.ShellBasedUnixGroupsMapping.getGroups(ShellBasedUnixGroupsMapping.java:45)
at org.apache.hadoop.security.Groups.getGroups(Groups.java:79)
at
org.apache.hadoop.security.UserGroupInformation.getGroupNames(UserGroupInformation.java:1054)
at
org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.<init>(FSPermissionChecker.java:50)
at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(FSNamesystem.java:5464)
at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkTraverse(FSNamesystem.java:5447)
at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:2168)
at
org.apache.hadoop.hdfs.server.namenode.NameNode.getFileInfo(NameNode.java:888)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:578)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1393)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1389)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1149)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1387)
2013-08-21 17:53:57,113 WARN
org.apache.hadoop.security.UserGroupInformation: No groups available for
user 298790
2013-08-21 17:53:57,179 WARN
org.apache.hadoop.security.ShellBasedUnixGroupsMapping: got exception
trying to get groups for user 298790
As per the docs., a resource loader must be used for using a different
user, accordingly, I reached to the class HdfsResourceLoader spring data
api but the "user" element isn't recognized by the JobFactoryBean.
How should I proceed ???
Tuesday, 20 August 2013
Class should be declared in Hstudent.java
Class should be declared in Hstudent.java
import java.util.Scanner;
public interface StudentFee
{
int HFee=10000;
int getAmount();
void getFirstName();
void getLastName();
void getAddress();
void getContact();
}
public class HStudent implements StudentFee
{
String FName,LName,Add;
int Cnc,Am;
public void getFirstName()
{
FName=s.nextLine();
}
public void getLastName()
{
LName=s.nextLine();
}
public void getAddresss()
{
Add=s.nextLine();
}
public void getContact()
{
Cnc=s.nextInt();
}
public int getAmount()
{int x=s.nextInt;
return(x);
}
}
class J43
{
public static void main (String args[])
{
Scanner s=new Scanner(System.in);
HStudent S1=new HStudent();
System.out.println("Enter the First Name of the student:");
S1.getFirstName();
System.out.println("Enter the Last Name of the student:");
S1.getLastName();
System.out.println("Enter the Address of the student:");
S1.getAddress();
System.out.println("Enter the Contact of the student:");
S1.getContact();
System.out.println("Enter the Amount of the Fee:");
int Am = S1.getAmount();
System.out.println("Is the student \"HOSTLER\" if yes press y/Y:");
char y=s.nextChar();
if(y=='y'||y=='Y')
{
System.out.println("Total Amount student should Pay is:"+
(Am+HStudent.HFee));
}
else
{
System.out.println("Sudent Has To Pay :"+Am);
}
}
}
gives error class HStudent is public , should be declared in
HStudent.java... Also says symbol not found for s
import java.util.Scanner;
public interface StudentFee
{
int HFee=10000;
int getAmount();
void getFirstName();
void getLastName();
void getAddress();
void getContact();
}
public class HStudent implements StudentFee
{
String FName,LName,Add;
int Cnc,Am;
public void getFirstName()
{
FName=s.nextLine();
}
public void getLastName()
{
LName=s.nextLine();
}
public void getAddresss()
{
Add=s.nextLine();
}
public void getContact()
{
Cnc=s.nextInt();
}
public int getAmount()
{int x=s.nextInt;
return(x);
}
}
class J43
{
public static void main (String args[])
{
Scanner s=new Scanner(System.in);
HStudent S1=new HStudent();
System.out.println("Enter the First Name of the student:");
S1.getFirstName();
System.out.println("Enter the Last Name of the student:");
S1.getLastName();
System.out.println("Enter the Address of the student:");
S1.getAddress();
System.out.println("Enter the Contact of the student:");
S1.getContact();
System.out.println("Enter the Amount of the Fee:");
int Am = S1.getAmount();
System.out.println("Is the student \"HOSTLER\" if yes press y/Y:");
char y=s.nextChar();
if(y=='y'||y=='Y')
{
System.out.println("Total Amount student should Pay is:"+
(Am+HStudent.HFee));
}
else
{
System.out.println("Sudent Has To Pay :"+Am);
}
}
}
gives error class HStudent is public , should be declared in
HStudent.java... Also says symbol not found for s
Informix sql update command error 746
Informix sql update command error 746
I tried to update the field "contract_id" in the table
"contract_scan_image". However, the update was failed and an error "746:
Field contract_id and type of contract_scan_image cannot be updated!" was
shown.
My sql command is:
update contract_scan_image
set contract_id = '14864730'
where contract_id = '1486473'
and type = 'RM'
and account = '00193400944'
Anyone knows what happened and how to fix it?
Thank you.
I tried to update the field "contract_id" in the table
"contract_scan_image". However, the update was failed and an error "746:
Field contract_id and type of contract_scan_image cannot be updated!" was
shown.
My sql command is:
update contract_scan_image
set contract_id = '14864730'
where contract_id = '1486473'
and type = 'RM'
and account = '00193400944'
Anyone knows what happened and how to fix it?
Thank you.
How to pause windows shut-down
How to pause windows shut-down
I need to Mute/Un-Mute the sound card at start-up and shut-down.
I have found some code to do the work, but often windows slams through the
shutdown and the sound never gets muted.
Can someone please tell me how to pause the shut-down long enough for my
app to mute the sound. I can use a simple TTimer to pause the app long
enough for it to run the Muting and then let windows get on with shutting
down.
How do I tell windows to wait though?
I notice that if I leave Firefox running and try to shut-down, windows
stops with a message, "These programs are preventing windows closing..."
and needs a click to force Firefox to close. I need to find that.
Thanks
I need to Mute/Un-Mute the sound card at start-up and shut-down.
I have found some code to do the work, but often windows slams through the
shutdown and the sound never gets muted.
Can someone please tell me how to pause the shut-down long enough for my
app to mute the sound. I can use a simple TTimer to pause the app long
enough for it to run the Muting and then let windows get on with shutting
down.
How do I tell windows to wait though?
I notice that if I leave Firefox running and try to shut-down, windows
stops with a message, "These programs are preventing windows closing..."
and needs a click to force Firefox to close. I need to find that.
Thanks
Who sings The dragon born comes song in Skyrim more beautiful [on hold]
Who sings The dragon born comes song in Skyrim more beautiful [on hold]
In all of Skyrim's inns and roads, who sings "The dragon Born Comes" the
most beautiful?
In all of Skyrim's inns and roads, who sings "The dragon Born Comes" the
most beautiful?
How to save data from textboxes with a savefiledialog to a file? C#
How to save data from textboxes with a savefiledialog to a file? C#
I want to create a button, and if someone press the button, the
savefiledialog will appear.
But I am not a PRO in C# so can someone who knows about saving write a
little bit of code for me?
when they browse and click "save", all the text in textboxes will be saved
in a .txt file.
1 textbox per line.
(I have 13 textboxes, named textbox1 to textbox13)
and is it possible to put some standart text between the textbox lines?
Sorry, I can't explain it good. I hope you understand it :D
I want to create a button, and if someone press the button, the
savefiledialog will appear.
But I am not a PRO in C# so can someone who knows about saving write a
little bit of code for me?
when they browse and click "save", all the text in textboxes will be saved
in a .txt file.
1 textbox per line.
(I have 13 textboxes, named textbox1 to textbox13)
and is it possible to put some standart text between the textbox lines?
Sorry, I can't explain it good. I hope you understand it :D
Converting NULL values to "UNKNOWN" without knowing column type
Converting NULL values to "UNKNOWN" without knowing column type
I've got several databases that I'm trying to query on my website with the
same SQL code. I'm passing the column names/table that I'd like to use via
URL to a new page. For example:
/some/url.php?table=tableName&c1=ColumnOne&c2=ColumnTwo&c3=ColumnThree&n=3
I have several of these URLs that all link to the same page (but with
different table names and columns). On the next page, the PHP code would
be something like this
for ($j = 1; $j <= $n; $j++) {
// Since the number of column variables varies (there could be c1 and
c2, or c1 -> c5), you need to save this part of the query in a
variable
$variables .= ${'c' . $j} . ', ';
}
SELECT $variables
FROM db.dbo.tableName
So the actual query for these 3 columns would be
SELECT ColumnOne, ColumnTwo, ColumnThree
FROM db.dbo.tableName
The problem is that some of the columns are float and some are
nvarchar(254). In the float columns, the null values are 0. In the
nvarchar(254) columns, null values are just NULL. I need the NULL values
in nvarchar(254) columns to be "UNKNOWN", and the 0 values in float
columns to also be "UNKNOWN".
This is an example of what I mean. ColumnOne and ColumnTwo are float,
while ColumnThree is nvarchar(254).
---------------------------------------------
|ColumnOne |ColumnTwo |ColumnThree |
---------------------------------------------
|0 |142563 |Insert |
---------------------------------------------
|1 |348 |Some |
---------------------------------------------
|2 |2535 |NULL |
---------------------------------------------
|3 |0 |Value |
---------------------------------------------
|0 |82536 |NULL |
---------------------------------------------
|5 |0 |Here |
---------------------------------------------
Here is what I would like it to look like
---------------------------------------------
|ColumnOne |ColumnTwo |ColumnThree |
---------------------------------------------
|UNKNOWN |142563 |Insert |
---------------------------------------------
|1 |348 |Some |
---------------------------------------------
|2 |2535 |UNKNOWN |
---------------------------------------------
|3 |UNKNOWN |Value |
---------------------------------------------
|UNKNOWN |82536 |UNKNOWN |
---------------------------------------------
|5 |UNKNOWN |Here |
---------------------------------------------
I've tried this
SELECT ISNULL(ColumnOne, 'UNKNOWN'), ISNULL(ColumnTwo, 'UNKNOWN'),
ISNULL(ColumnThree, 'UNKNOWN')
FROM db.dbo.tableName
However, I'm getting this error: Error converting data type varchar to float
Can someone help me out? It would be greatly appreciated!
I've got several databases that I'm trying to query on my website with the
same SQL code. I'm passing the column names/table that I'd like to use via
URL to a new page. For example:
/some/url.php?table=tableName&c1=ColumnOne&c2=ColumnTwo&c3=ColumnThree&n=3
I have several of these URLs that all link to the same page (but with
different table names and columns). On the next page, the PHP code would
be something like this
for ($j = 1; $j <= $n; $j++) {
// Since the number of column variables varies (there could be c1 and
c2, or c1 -> c5), you need to save this part of the query in a
variable
$variables .= ${'c' . $j} . ', ';
}
SELECT $variables
FROM db.dbo.tableName
So the actual query for these 3 columns would be
SELECT ColumnOne, ColumnTwo, ColumnThree
FROM db.dbo.tableName
The problem is that some of the columns are float and some are
nvarchar(254). In the float columns, the null values are 0. In the
nvarchar(254) columns, null values are just NULL. I need the NULL values
in nvarchar(254) columns to be "UNKNOWN", and the 0 values in float
columns to also be "UNKNOWN".
This is an example of what I mean. ColumnOne and ColumnTwo are float,
while ColumnThree is nvarchar(254).
---------------------------------------------
|ColumnOne |ColumnTwo |ColumnThree |
---------------------------------------------
|0 |142563 |Insert |
---------------------------------------------
|1 |348 |Some |
---------------------------------------------
|2 |2535 |NULL |
---------------------------------------------
|3 |0 |Value |
---------------------------------------------
|0 |82536 |NULL |
---------------------------------------------
|5 |0 |Here |
---------------------------------------------
Here is what I would like it to look like
---------------------------------------------
|ColumnOne |ColumnTwo |ColumnThree |
---------------------------------------------
|UNKNOWN |142563 |Insert |
---------------------------------------------
|1 |348 |Some |
---------------------------------------------
|2 |2535 |UNKNOWN |
---------------------------------------------
|3 |UNKNOWN |Value |
---------------------------------------------
|UNKNOWN |82536 |UNKNOWN |
---------------------------------------------
|5 |UNKNOWN |Here |
---------------------------------------------
I've tried this
SELECT ISNULL(ColumnOne, 'UNKNOWN'), ISNULL(ColumnTwo, 'UNKNOWN'),
ISNULL(ColumnThree, 'UNKNOWN')
FROM db.dbo.tableName
However, I'm getting this error: Error converting data type varchar to float
Can someone help me out? It would be greatly appreciated!
update records ajax jquery isn't working
update records ajax jquery isn't working
I'm writing a script that can update a status in the database.
My php code is:
<?php
include ('../model/incentives.class.php');
$change = new Incentives;
$change_status = $change->change_status($_GET['id'], $_GET['status']);
?>
this works, (i tested it without ajax)
my ajax is:
function change_status(id, status) {
$.ajax({
type: 'GET',
url:('control/change_status.control.php'),
data: 'id='+id+'&status='+status,
cache: false,
})
window.location.reload(true);
}
and i call the function with
<a href="javascript:change_function(1, 0);">Change Status</a>
But this won't work. is there anybody who knows how to fix this ?
thx!
I'm writing a script that can update a status in the database.
My php code is:
<?php
include ('../model/incentives.class.php');
$change = new Incentives;
$change_status = $change->change_status($_GET['id'], $_GET['status']);
?>
this works, (i tested it without ajax)
my ajax is:
function change_status(id, status) {
$.ajax({
type: 'GET',
url:('control/change_status.control.php'),
data: 'id='+id+'&status='+status,
cache: false,
})
window.location.reload(true);
}
and i call the function with
<a href="javascript:change_function(1, 0);">Change Status</a>
But this won't work. is there anybody who knows how to fix this ?
thx!
Monday, 19 August 2013
use of undeclared identifier in objective-c
use of undeclared identifier in objective-c
I'm new to programing and I am making a simple game. Xcode found a bug in
my program and it says use of undeclared 'gameStatePlayNormal . Any help
would be amazing!! This is my .m file where it is finding the bug.
-(void)viewDidLoad
{
[super viewDidLoad];
gameState = kStateRunning;
[NSTimer scheduledTimerWithTimeInterval: 1.0/60 target:self
selector:@selector(gameLoop) userInfo:nil repeats:YES];
rockVelocity = CGPointMake (0, 0);
gravity = CGPointMake (0, kGravity);
}
- (void)gameLoop
{
if (gameState == kStateRunning) {
[self gameStatePlayNormal];
} else if (gameState == kStateGameOver) {
}
}
-(void)gameStatePlayNormal
{
rockVelocity.y += gravity.y;
rock.center = CGPoint(rock.center.x + ballVelocity.x,rock.center.y +
rockVelocity.y);
}
here is my .h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
// Image View for the game mode
UIImageView *bg;
UIImageView *rock;
UIImageView *platform1;
UIImageView *platform2;
UIImageView *platform3;
UIImageView *platform4;
UIImageView *platform5;
UIImageView *platform6;
UIImageView *platform7;
NSInteger gameState;
CGPoint rockVelocity;
CGPoint gravity;
}
@property (nonatomic, retain) IBOutlet UIImageView *bg;
@property (nonatomic, retain) IBOutlet UIImageView *rock;
@property (nonatomic, retain) IBOutlet UIImageView *platform1;
@property (nonatomic, retain) IBOutlet UIImageView *platform2;
@property (nonatomic, retain) IBOutlet UIImageView *platform3;
@property (nonatomic, retain) IBOutlet UIImageView *platform4;
@property (nonatomic, retain) IBOutlet UIImageView *platform5;
@property (nonatomic, retain) IBOutlet UIImageView *platform6;
@property (nonatomic, retain) IBOutlet UIImageView *platform7;
@property (nonatomic) NSInteger gameState;
@property (nonatomic) CGPoint rockVelocity;
@property (nonatomic) CGPoint gravity;
- (void)gameStatePlayNormal;
@end
I'm new to programing and I am making a simple game. Xcode found a bug in
my program and it says use of undeclared 'gameStatePlayNormal . Any help
would be amazing!! This is my .m file where it is finding the bug.
-(void)viewDidLoad
{
[super viewDidLoad];
gameState = kStateRunning;
[NSTimer scheduledTimerWithTimeInterval: 1.0/60 target:self
selector:@selector(gameLoop) userInfo:nil repeats:YES];
rockVelocity = CGPointMake (0, 0);
gravity = CGPointMake (0, kGravity);
}
- (void)gameLoop
{
if (gameState == kStateRunning) {
[self gameStatePlayNormal];
} else if (gameState == kStateGameOver) {
}
}
-(void)gameStatePlayNormal
{
rockVelocity.y += gravity.y;
rock.center = CGPoint(rock.center.x + ballVelocity.x,rock.center.y +
rockVelocity.y);
}
here is my .h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
// Image View for the game mode
UIImageView *bg;
UIImageView *rock;
UIImageView *platform1;
UIImageView *platform2;
UIImageView *platform3;
UIImageView *platform4;
UIImageView *platform5;
UIImageView *platform6;
UIImageView *platform7;
NSInteger gameState;
CGPoint rockVelocity;
CGPoint gravity;
}
@property (nonatomic, retain) IBOutlet UIImageView *bg;
@property (nonatomic, retain) IBOutlet UIImageView *rock;
@property (nonatomic, retain) IBOutlet UIImageView *platform1;
@property (nonatomic, retain) IBOutlet UIImageView *platform2;
@property (nonatomic, retain) IBOutlet UIImageView *platform3;
@property (nonatomic, retain) IBOutlet UIImageView *platform4;
@property (nonatomic, retain) IBOutlet UIImageView *platform5;
@property (nonatomic, retain) IBOutlet UIImageView *platform6;
@property (nonatomic, retain) IBOutlet UIImageView *platform7;
@property (nonatomic) NSInteger gameState;
@property (nonatomic) CGPoint rockVelocity;
@property (nonatomic) CGPoint gravity;
- (void)gameStatePlayNormal;
@end
ggplot box plot confusion
ggplot box plot confusion
How do I make a boxplot in ggplot where my whiskers, box and middle are
located at specified quantiles? For instance, I want the top whisker to be
at the 95 percentile of my dataset and my bottom whisker to be at the 5%
of my dataset. I saw in the documentation for geom_boxplot, the aesthetics
include ymin, lower, middle, etc. but it didn't say if these should be
give as actual values or as quantiles.
How do I make a boxplot in ggplot where my whiskers, box and middle are
located at specified quantiles? For instance, I want the top whisker to be
at the 95 percentile of my dataset and my bottom whisker to be at the 5%
of my dataset. I saw in the documentation for geom_boxplot, the aesthetics
include ymin, lower, middle, etc. but it didn't say if these should be
give as actual values or as quantiles.
Don't reload Activity orientation change but still reload Fragments
Don't reload Activity orientation change but still reload Fragments
Im using a MainActivity with a few Fragments.
In the Activity I connect to a server.
I used: android:configChanges="orientation|screenSize" in my Manifest.
So that the Activity keeps the connection on orientation change.
But now I cant use different layout for port/land (Fragments).
Is there a way to force the Fragments to reload on change without the
Activity reloading?
Im using a MainActivity with a few Fragments.
In the Activity I connect to a server.
I used: android:configChanges="orientation|screenSize" in my Manifest.
So that the Activity keeps the connection on orientation change.
But now I cant use different layout for port/land (Fragments).
Is there a way to force the Fragments to reload on change without the
Activity reloading?
PHP Select with PDO Call to a member function prepare() on a non-object error
PHP Select with PDO Call to a member function prepare() on a non-object error
I'm getting a Call to a member function prepare() on a non-object error in
my PHP when using PDO to select data that was sent via an AJAX call.
Searching around on StackOverflow I've found many answers to this error,
but none work to fix my problem.
The weird part is that the other PHP files use the same PDO calls and work
successfully, but this one is giving me the non-object error only.
To note, the PDO connection is identical to the other pages where it
works, so I know that's not causing the problem.
Also, I have tested that the AJAX data sent is being received, and that is
working too.
PHP Code header('Content-Type: application/json'); $mysql_user =
"NotTelling"; $mysql_password = "DefinatelyNotThis"; try { $dbh = new
PDO("mysql:host=somehost;dbname=somename", $mysql_user, $mysql_password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$username = $_POST['username'];
$inPword = $_POST['password'];
$lat = $_POST['lat'];
$lon = $_POST['lon'];
$loggedin = "";
$password_hash = "";
$loggedinstatus = "";
$pts = "";
function getLoginInfo()
{
$sth = $dbh -> prepare('SELECT pword, loggedin, points FROM login
WHERE uname = :uname');
$sth->bindParam(':uname', $username, PDO::PARAM_STR);
while($row = $sth->fetch(PDO::FETCH_ASSOC))
{
echo $row['pword'];
echo $row['loggedin'];
echo $row['points'];
}
$password_hash = $fetch['pword'];
$loggedinstatus = $fetch['loggedin'];
$pts = $fetch["points"];
if($password_hash === null || $loggedinstatus === null || $pts ===
null)
{
die(json_encode(array("message" => "none")));
}
else
{
return "more";
}
}
function checkLoginCreds()
{
if(crypt($inPword, $password_hash) === $password_hash)
{
switch($loggedinstatus)
{
case "no":
$sel = $dbh->prepare("UPDATE login SET loggedin='yes'
WHERE uname = ?");
$sel->execute(array($username));
return "AllGood";
break;
defaut:
return "alreadyin";
break;
}
}
else
{
return "BadLogin";
}
}
if(getLoginInfo() === "more")
{
echo json_encode(array("message" => checkLoginCreds()));
}
getLoginInfo();
}
catch(PDOException $e)
{
echo $e->getMessage();
file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND);
}
Finally, here's the output when I var_dump() the PDO connection.
object(PDO)#1 (0) {}
I'm getting a Call to a member function prepare() on a non-object error in
my PHP when using PDO to select data that was sent via an AJAX call.
Searching around on StackOverflow I've found many answers to this error,
but none work to fix my problem.
The weird part is that the other PHP files use the same PDO calls and work
successfully, but this one is giving me the non-object error only.
To note, the PDO connection is identical to the other pages where it
works, so I know that's not causing the problem.
Also, I have tested that the AJAX data sent is being received, and that is
working too.
PHP Code header('Content-Type: application/json'); $mysql_user =
"NotTelling"; $mysql_password = "DefinatelyNotThis"; try { $dbh = new
PDO("mysql:host=somehost;dbname=somename", $mysql_user, $mysql_password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$username = $_POST['username'];
$inPword = $_POST['password'];
$lat = $_POST['lat'];
$lon = $_POST['lon'];
$loggedin = "";
$password_hash = "";
$loggedinstatus = "";
$pts = "";
function getLoginInfo()
{
$sth = $dbh -> prepare('SELECT pword, loggedin, points FROM login
WHERE uname = :uname');
$sth->bindParam(':uname', $username, PDO::PARAM_STR);
while($row = $sth->fetch(PDO::FETCH_ASSOC))
{
echo $row['pword'];
echo $row['loggedin'];
echo $row['points'];
}
$password_hash = $fetch['pword'];
$loggedinstatus = $fetch['loggedin'];
$pts = $fetch["points"];
if($password_hash === null || $loggedinstatus === null || $pts ===
null)
{
die(json_encode(array("message" => "none")));
}
else
{
return "more";
}
}
function checkLoginCreds()
{
if(crypt($inPword, $password_hash) === $password_hash)
{
switch($loggedinstatus)
{
case "no":
$sel = $dbh->prepare("UPDATE login SET loggedin='yes'
WHERE uname = ?");
$sel->execute(array($username));
return "AllGood";
break;
defaut:
return "alreadyin";
break;
}
}
else
{
return "BadLogin";
}
}
if(getLoginInfo() === "more")
{
echo json_encode(array("message" => checkLoginCreds()));
}
getLoginInfo();
}
catch(PDOException $e)
{
echo $e->getMessage();
file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND);
}
Finally, here's the output when I var_dump() the PDO connection.
object(PDO)#1 (0) {}
Subscribe to:
Comments (Atom)