parsing inline variables from string from file in php
I'm localizing a website that I've built. I'm doing this by having a .lang
file read and each line (syntax: key=string) is placed in a variable
depending on the chosen language.
This array is then used to place the strings in the correct places.
The problem I'm having is that certain strings need to have hyperlinks in
the middle of them for example someplace I've put my name that links to my
contact page. Or a lot of the readouts of the website need to be in the
strings.
To solve this I've defined a variable that holds the Forecaster and the
localization file contains the $Forecaster variable for the strings that
need tags.
The problem with this as I promptly discovered is that it stubbornly
refuses to parse the inline variables in the strings from the file.
Instead it prints the string and variable name as it looks in the file.
And I have yet to find a way to make it parse the variables.
For example "Heating up took $str_time" would be printed on the page
exactly like that, instead of inputting the previously defined value of
$str_time.
I currently use fopen() and fgets() to open and read the lines. I then
explode them to separate the key and the string and then place these into
the array.
Is there a way to make it parse the variables, or alternatively is there
another way of reading the lines that allows for parsing the inline
variables?
Thursday, 3 October 2013
Wednesday, 2 October 2013
Getting the elements selected of a jlist into a string list
Getting the elements selected of a jlist into a string list
I have a jlist which has some elements and works properly. Then I am
trying to add the selected jlist elements to string list, but it wont show
any results (no errors though). Whats wrong?
final JList list = new JList(arraylist.toArray());
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
JOptionPane.showMessageDialog(
null, list, "Select",
JOptionPane.QUESTION_MESSAGE);
ListSelectionListener listSelectionListener = new
ListSelectionListener() {
public void valueChanged (ListSelectionEvent e) {
String lstr = list.getSelectedValue().toString();
List<String> tolist = Arrays.asList(lstr);
System.out.println(tolist);
}
};
I have a jlist which has some elements and works properly. Then I am
trying to add the selected jlist elements to string list, but it wont show
any results (no errors though). Whats wrong?
final JList list = new JList(arraylist.toArray());
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
JOptionPane.showMessageDialog(
null, list, "Select",
JOptionPane.QUESTION_MESSAGE);
ListSelectionListener listSelectionListener = new
ListSelectionListener() {
public void valueChanged (ListSelectionEvent e) {
String lstr = list.getSelectedValue().toString();
List<String> tolist = Arrays.asList(lstr);
System.out.println(tolist);
}
};
AngularJS Controller Not Registering
AngularJS Controller Not Registering
I am exploring the AngularJS framework. I can't seem to add a controller
after I bootstrap AngularJS. I realize that I am not using the declarative
style of initializing AngularJS, I am exploring the framework. The
exception I get indicates that the passed controller function is not a
function. However, in the Chrome debugger it shows as the expected
function.
Exeception
Error: Argument 'MediaLoaderController' is not a function, got undefined
at Error (<anonymous>)
at $a
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:16:453)
at qa
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:17:56)
at $get
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:52:219)
at
http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:43:348
at m
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:6:494)
at i
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:43:213)
at e
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:307)
at e
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:324)
at e
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:324)
angular.min.js:62
(anonymous function) angular.min.js:62
$get angular.min.js:52
$get.e.$apply angular.min.js:88
(anonymous function) angular.min.js:16
d angular.min.js:27
c angular.min.js:16
rb angular.min.js:16
Bootstrapper.instance.bootstrapAngularJS bootstrapper.js:19
(anonymous function) slide_template_angularjs.jsp:20
x.Callbacks.c jquery.js:3048
x.Callbacks.p.fireWith jquery.js:3160
x.extend.ready jquery.js:433
q
HTML
<html>
<head>
<title></title>
<script
src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="/js/bootstrapper.js"></script>
<script language="JavaScript">
var bootstrapper = null;
var controllerLibrary = null;
$(document).ready( function(){
bootstrapper = new Bootstrapper();
controllerLibrary = new ControllerLibrary();
bootstrapper.bootstrapAngularJS();
bootstrapper.myModule.controller( "MediaLoaderController",
controllerLibrary.MediaLoaderController );
});
</script>
</head>
<body>
<div ng-controller="MediaLoaderController">
{{status}}
</div>
</body>
</html>
JavaScript
function Bootstrapper() {
var instance = new Object();
instance.myModule = null;
/*
* Bootstrap AngularJS and initialize myModule
*/
instance.bootstrapAngularJS = function() {
instance.myModule = angular.module('myModule', []);
angular.bootstrap(document, ['myModule']);
};
return instance;
}
function ControllerLibrary() {
}
ControllerLibrary.prototype.MediaLoaderController = function($scope) {
$scope.status = "loading";
};
I am exploring the AngularJS framework. I can't seem to add a controller
after I bootstrap AngularJS. I realize that I am not using the declarative
style of initializing AngularJS, I am exploring the framework. The
exception I get indicates that the passed controller function is not a
function. However, in the Chrome debugger it shows as the expected
function.
Exeception
Error: Argument 'MediaLoaderController' is not a function, got undefined
at Error (<anonymous>)
at $a
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:16:453)
at qa
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:17:56)
at $get
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:52:219)
at
http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:43:348
at m
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:6:494)
at i
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:43:213)
at e
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:307)
at e
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:324)
at e
(http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js:39:324)
angular.min.js:62
(anonymous function) angular.min.js:62
$get angular.min.js:52
$get.e.$apply angular.min.js:88
(anonymous function) angular.min.js:16
d angular.min.js:27
c angular.min.js:16
rb angular.min.js:16
Bootstrapper.instance.bootstrapAngularJS bootstrapper.js:19
(anonymous function) slide_template_angularjs.jsp:20
x.Callbacks.c jquery.js:3048
x.Callbacks.p.fireWith jquery.js:3160
x.extend.ready jquery.js:433
q
HTML
<html>
<head>
<title></title>
<script
src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="/js/bootstrapper.js"></script>
<script language="JavaScript">
var bootstrapper = null;
var controllerLibrary = null;
$(document).ready( function(){
bootstrapper = new Bootstrapper();
controllerLibrary = new ControllerLibrary();
bootstrapper.bootstrapAngularJS();
bootstrapper.myModule.controller( "MediaLoaderController",
controllerLibrary.MediaLoaderController );
});
</script>
</head>
<body>
<div ng-controller="MediaLoaderController">
{{status}}
</div>
</body>
</html>
JavaScript
function Bootstrapper() {
var instance = new Object();
instance.myModule = null;
/*
* Bootstrap AngularJS and initialize myModule
*/
instance.bootstrapAngularJS = function() {
instance.myModule = angular.module('myModule', []);
angular.bootstrap(document, ['myModule']);
};
return instance;
}
function ControllerLibrary() {
}
ControllerLibrary.prototype.MediaLoaderController = function($scope) {
$scope.status = "loading";
};
iOS Developer Program or entreprise programe
iOS Developer Program or entreprise programe
What is the solution to test an application on a remote iPad?
My idea is to Host my application on a web server that is accessible by my
customer,And he can then download the application and test it on his
device.
The problem is that the customer must have a Provisioning Profile
installed in their devices.
Which is the solution so that I install the profile on distant devices
without needing xocde ?
For this situation which is the most effective, the iOS Developer
Enterprise Program or iOS Developer Program ?
How I have to proceed ?
Thank you .
What is the solution to test an application on a remote iPad?
My idea is to Host my application on a web server that is accessible by my
customer,And he can then download the application and test it on his
device.
The problem is that the customer must have a Provisioning Profile
installed in their devices.
Which is the solution so that I install the profile on distant devices
without needing xocde ?
For this situation which is the most effective, the iOS Developer
Enterprise Program or iOS Developer Program ?
How I have to proceed ?
Thank you .
Class cast exception - TextView cannot be casted to ImageView
Class cast exception - TextView cannot be casted to ImageView
I could not get why I am getting the class cast exception as I am only
assigning the Imageview to Imageview but it states that can't cast the
ImageView to TextView.
Below is the code for my xml and Activity class
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:id="@+id/review_tbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingTop="10dp" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp" >
<TextView
android:id="@+id/toi_lbl"
android:background="@color/titlebackgroundcolor"
android:text="Times Of India :"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/toi_txt"
android:background="@color/titlebackgroundcolor"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<ImageView
android:id="@+id/txt1"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/star"
android:textDirection="firstStrong" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp" >
<TextView
android:id="@+id/imdb_lbl"
android:background="@color/titlebackgroundcolor"
android:text="Imdb.com :"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/imdb_txt"
android:background="@color/titlebackgroundcolor"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/txt1"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/star"
android:gravity="center"
android:text=""
android:textAlignment="center"
android:textColor="@color/titlebackgroundcolor"
android:textDirection="firstStrong" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp" >
<TextView
android:id="@+id/in_lbl"
android:background="@color/titlebackgroundcolor"
android:text="In.com :"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/in_txt"
android:background="@color/titlebackgroundcolor"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/txt1"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/star"
android:gravity="center"
android:text=""
android:textAlignment="center"
android:textColor="@color/titlebackgroundcolor"
android:textDirection="firstStrong" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
<ImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:src="@drawable/loading" />
<TextView
android:id="@+id/movieName_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Ranjhana"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/reldate_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/movieName_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Released On : 12 June 2013"
android:textColor="@color/titletextcolor" />
<TextView
android:id="@+id/starring_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/reldate_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Cast : Sonam Kapoor,Dhanush"
android:textColor="@color/titletextcolor" />
<TextView
android:id="@+id/director_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/starring_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Director : Koi Hai"
android:textColor="@color/titletextcolor" />
<TextView
android:id="@+id/producer_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/director_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Producer : Koi Hai"
android:textColor="@color/titletextcolor" />
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a151e2b670cd233"
android:layout_below="@+id/producer_txt"
ads:loadAdOnCreate="true" />
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/adView" >
<TextView
android:id="@+id/description_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textAlignment="gravity"
android:layout_below="@+id/producer_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:textSize="15dip"
android:text=" Raanjhanaa is an upcoming 2013 Hindi romance
film, directed by Anand L. Rai and written by Himanshu Sharma.
The film is produced by Krishika Lulla under the banner Eros
International. The film stars Tamil film actor Dhanush in his
Bollywood debut and Sonam Kapoor in the lead roles.[2] The
film is scheduled to release on June 21, 2013 along with a
dubbed Tamil version called Ambikapathy"
android:textColor="@color/titletextcolor" />
</ScrollView>
<ImageButton
android:id="@+id/share_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignTop="@+id/movieName_txt"
android:layout_toRightOf="@+id/movieName_txt"
android:onClick="shareIt"
android:src="@drawable/shareicon" />
</RelativeLayout>
And my activity :
super.onCreate(savedInstanceState);
setContentView(R.layout.film_detail);
ImageView movieImage = (ImageView)findViewById(R.id.imageView1);
I am getting exception on this line.
ImageView movieImage = (ImageView)findViewById(R.id.imageView1);
Thanks, Amandeep
I could not get why I am getting the class cast exception as I am only
assigning the Imageview to Imageview but it states that can't cast the
ImageView to TextView.
Below is the code for my xml and Activity class
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:id="@+id/review_tbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingTop="10dp" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp" >
<TextView
android:id="@+id/toi_lbl"
android:background="@color/titlebackgroundcolor"
android:text="Times Of India :"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/toi_txt"
android:background="@color/titlebackgroundcolor"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<ImageView
android:id="@+id/txt1"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/star"
android:textDirection="firstStrong" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp" >
<TextView
android:id="@+id/imdb_lbl"
android:background="@color/titlebackgroundcolor"
android:text="Imdb.com :"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/imdb_txt"
android:background="@color/titlebackgroundcolor"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/txt1"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/star"
android:gravity="center"
android:text=""
android:textAlignment="center"
android:textColor="@color/titlebackgroundcolor"
android:textDirection="firstStrong" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp" >
<TextView
android:id="@+id/in_lbl"
android:background="@color/titlebackgroundcolor"
android:text="In.com :"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/in_txt"
android:background="@color/titlebackgroundcolor"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="@+id/txt1"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/star"
android:gravity="center"
android:text=""
android:textAlignment="center"
android:textColor="@color/titlebackgroundcolor"
android:textDirection="firstStrong" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
<ImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:src="@drawable/loading" />
<TextView
android:id="@+id/movieName_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Ranjhana"
android:textColor="@color/titletextcolor"
android:textSize="15dip"
android:textStyle="bold"
/>
<TextView
android:id="@+id/reldate_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/movieName_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Released On : 12 June 2013"
android:textColor="@color/titletextcolor" />
<TextView
android:id="@+id/starring_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/reldate_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Cast : Sonam Kapoor,Dhanush"
android:textColor="@color/titletextcolor" />
<TextView
android:id="@+id/director_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/starring_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Director : Koi Hai"
android:textColor="@color/titletextcolor" />
<TextView
android:id="@+id/producer_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/director_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:text="Producer : Koi Hai"
android:textColor="@color/titletextcolor" />
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a151e2b670cd233"
android:layout_below="@+id/producer_txt"
ads:loadAdOnCreate="true" />
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/adView" >
<TextView
android:id="@+id/description_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textAlignment="gravity"
android:layout_below="@+id/producer_txt"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:textSize="15dip"
android:text=" Raanjhanaa is an upcoming 2013 Hindi romance
film, directed by Anand L. Rai and written by Himanshu Sharma.
The film is produced by Krishika Lulla under the banner Eros
International. The film stars Tamil film actor Dhanush in his
Bollywood debut and Sonam Kapoor in the lead roles.[2] The
film is scheduled to release on June 21, 2013 along with a
dubbed Tamil version called Ambikapathy"
android:textColor="@color/titletextcolor" />
</ScrollView>
<ImageButton
android:id="@+id/share_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignTop="@+id/movieName_txt"
android:layout_toRightOf="@+id/movieName_txt"
android:onClick="shareIt"
android:src="@drawable/shareicon" />
</RelativeLayout>
And my activity :
super.onCreate(savedInstanceState);
setContentView(R.layout.film_detail);
ImageView movieImage = (ImageView)findViewById(R.id.imageView1);
I am getting exception on this line.
ImageView movieImage = (ImageView)findViewById(R.id.imageView1);
Thanks, Amandeep
Tuesday, 1 October 2013
need help in populating the datatables using ajax calls
need help in populating the datatables using ajax calls
I was working on datatables(jquery javascript) for the first time and i
want to pull the data from the database using ajax calls and display it in
the datatable when the page load. I want to now little bit of stucture of
how to work on that. any suggestions??
I was working on datatables(jquery javascript) for the first time and i
want to pull the data from the database using ajax calls and display it in
the datatable when the page load. I want to now little bit of stucture of
how to work on that. any suggestions??
Is it possible to update angularjs expressions inside of an iframe?
Is it possible to update angularjs expressions inside of an iframe?
So...for example, I am trying to pull in an email "template" into an
iframe as a "preview" for the user inside of an angularjs app. The iframe
lives inside of the controller area (let's call it MainCtrl). The user
would then be able to, using the form elements provided inside MainCtrl,
update the preview based on their input. So for example let's say our
template being pulled into the iframe looks something like this:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1,
maximum-scale=1">
<style type="text/css">
.some {styles: here};
</style>
</head>
<body>
<h1></p>
</body>
</html>
So inside our index.html (angularjs app), we would have form elements
bound to {{header}} and {{body}}...
<div ng-controller="MainCtrl">
<input type="text" ng-model="header" placeholder="header text" />
<input type="text" ng-model="body" placeholder="body text" />
<iframe src="template.html" width="800" height="1500"></iframe>
</div>
is that possible? Is it possible for angularjs to update that information,
and if so, how?
So...for example, I am trying to pull in an email "template" into an
iframe as a "preview" for the user inside of an angularjs app. The iframe
lives inside of the controller area (let's call it MainCtrl). The user
would then be able to, using the form elements provided inside MainCtrl,
update the preview based on their input. So for example let's say our
template being pulled into the iframe looks something like this:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1,
maximum-scale=1">
<style type="text/css">
.some {styles: here};
</style>
</head>
<body>
<h1></p>
</body>
</html>
So inside our index.html (angularjs app), we would have form elements
bound to {{header}} and {{body}}...
<div ng-controller="MainCtrl">
<input type="text" ng-model="header" placeholder="header text" />
<input type="text" ng-model="body" placeholder="body text" />
<iframe src="template.html" width="800" height="1500"></iframe>
</div>
is that possible? Is it possible for angularjs to update that information,
and if so, how?
nginx node.js & socket.io 504 timeout
nginx node.js & socket.io 504 timeout
Nginx config
server {
listen *:80;
server_name live.domain.com;
server_tokens off;
charset utf-8;
error_log /var/log/nginx/live-error.log info;
access_log /var/log/nginx/live-access.log;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:1337;
proxy_redirect off;
}
}
When node.js is working everything is okay, but if node.js not started and
I try to load page http://live.domain.com/socket.io/socket.io.js it makes
me wait 30 seconds (read_timeout).
I want make it so, that if node.js not running I'm getting 404 or 502
error right away without 30 seconds waiting for timeout.
In other words: I need to check node.js on client side right away.
Nginx config
server {
listen *:80;
server_name live.domain.com;
server_tokens off;
charset utf-8;
error_log /var/log/nginx/live-error.log info;
access_log /var/log/nginx/live-access.log;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:1337;
proxy_redirect off;
}
}
When node.js is working everything is okay, but if node.js not started and
I try to load page http://live.domain.com/socket.io/socket.io.js it makes
me wait 30 seconds (read_timeout).
I want make it so, that if node.js not running I'm getting 404 or 502
error right away without 30 seconds waiting for timeout.
In other words: I need to check node.js on client side right away.
mod rewrite is not affected for domain without www?
mod rewrite is not affected for domain without www?
i have this setting for apache :
<VirtualHost mysite.co.id:80>
ServerAdmin admin@mysite.co.id
DocumentRoot /var/www/html/main
ServerName mysite.co.id
ErrorLog logs/mysite.co.id.error
CustomLog logs/mysite.co.id.access common
<Directory "/var/www/html/main/">
Options +Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^/sub1(.*) http://sub1.mysite.co.id$1 [NC,R,L]
</VirtualHost>
<VirtualHost beta.mysite.co.id:80>
ServerAdmin admin@beta.mysite.co.id
DocumentRoot /var/www/html/beta
ServerName beta.mysite.co.id
ErrorLog logs/beta.mysite.co.id.error
CustomLog logs/beta.mysite.co.id.access common
<Directory "/var/www/html/beta/">
Options +Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^/sub1(.*) http://sub1.beta.mysite.co.id$1 [NC,R,L]
</VirtualHost>
<VirtualHost www.mysite.co.id:80>
ServerAdmin admin@www.mysite.co.id
DocumentRoot /var/www/html/main
ServerName www.mysite.co.id
ErrorLog logs/www.mysite.co.id.error
CustomLog logs/www.mysite.co.id.access common
<Directory "/var/www/html/main/">
Options +Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^/sub1(.*) http://sub1.www.mysite.co.id$1 [NC,R,L]
</VirtualHost>
this condition will redirect for all sub1 folder accessed will be redirect
to our new subdomain sub1.
all work for beta.mysite.co.id and www.mysite.co.id but failed for
mysite.co.id
what i miss from here? i have check my /var/log/mysite.co.id but only my
php error listed there and it's one month ago :
[Mon Sep 02 10:28:10 2013] [error] [client 128.21.30.30] File does not
exist: /v
ar/www/html/favicon.ico
[Mon Sep 02 10:29:10 2013] [error] [client 128.21.30.30] Directory index
forbidd
en by Options directive: /var/www/html/
[Mon Sep 02 10:29:29 2013] [error] [client 128.21.30.30] File does not
exist: /v
ar/www/html/mysite
[Mon Sep 02 10:29:34 2013] [error] [client 128.21.30.30] Directory index
forbidd
en by Options directive: /var/www/html/
[Mon Sep 02 10:30:15 2013] [error] [client 128.21.30.30] Directory index
forbidd
en by Options directive: /var/www/html/
my system :
PHP Version 5.3.3
Apache/2.2.15 (CentOS)
Linux my.centos 2.6.32-358.18.1.el6.x86_64
update:
everything changing line inside mysite.co.id will not affected the page,
but i ping all mysite.co.id, www.mysite.co.id and beta.mysite.co.id will
refer to the same IP
i have this setting for apache :
<VirtualHost mysite.co.id:80>
ServerAdmin admin@mysite.co.id
DocumentRoot /var/www/html/main
ServerName mysite.co.id
ErrorLog logs/mysite.co.id.error
CustomLog logs/mysite.co.id.access common
<Directory "/var/www/html/main/">
Options +Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^/sub1(.*) http://sub1.mysite.co.id$1 [NC,R,L]
</VirtualHost>
<VirtualHost beta.mysite.co.id:80>
ServerAdmin admin@beta.mysite.co.id
DocumentRoot /var/www/html/beta
ServerName beta.mysite.co.id
ErrorLog logs/beta.mysite.co.id.error
CustomLog logs/beta.mysite.co.id.access common
<Directory "/var/www/html/beta/">
Options +Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^/sub1(.*) http://sub1.beta.mysite.co.id$1 [NC,R,L]
</VirtualHost>
<VirtualHost www.mysite.co.id:80>
ServerAdmin admin@www.mysite.co.id
DocumentRoot /var/www/html/main
ServerName www.mysite.co.id
ErrorLog logs/www.mysite.co.id.error
CustomLog logs/www.mysite.co.id.access common
<Directory "/var/www/html/main/">
Options +Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^/sub1(.*) http://sub1.www.mysite.co.id$1 [NC,R,L]
</VirtualHost>
this condition will redirect for all sub1 folder accessed will be redirect
to our new subdomain sub1.
all work for beta.mysite.co.id and www.mysite.co.id but failed for
mysite.co.id
what i miss from here? i have check my /var/log/mysite.co.id but only my
php error listed there and it's one month ago :
[Mon Sep 02 10:28:10 2013] [error] [client 128.21.30.30] File does not
exist: /v
ar/www/html/favicon.ico
[Mon Sep 02 10:29:10 2013] [error] [client 128.21.30.30] Directory index
forbidd
en by Options directive: /var/www/html/
[Mon Sep 02 10:29:29 2013] [error] [client 128.21.30.30] File does not
exist: /v
ar/www/html/mysite
[Mon Sep 02 10:29:34 2013] [error] [client 128.21.30.30] Directory index
forbidd
en by Options directive: /var/www/html/
[Mon Sep 02 10:30:15 2013] [error] [client 128.21.30.30] Directory index
forbidd
en by Options directive: /var/www/html/
my system :
PHP Version 5.3.3
Apache/2.2.15 (CentOS)
Linux my.centos 2.6.32-358.18.1.el6.x86_64
update:
everything changing line inside mysite.co.id will not affected the page,
but i ping all mysite.co.id, www.mysite.co.id and beta.mysite.co.id will
refer to the same IP
Subscribe to:
Comments (Atom)