How to store html files on an XAMPP test server?
I'm trying to test out some basic AJAX programs but I can't figure out
where to put them or how to set up a file directory to run them on XAMPP
(MAC). Could anyone provide some clarity on this issue? Thanks.
Saturday, 31 August 2013
Constructors overloading in Java
Constructors overloading in Java
class parent {
String s;
parent() {
this(10);
this.s = "First";
}
parent(int a){
this(10.00f);
this.s += "Second";
}
parent(float b){
this("sss");
this.s += "Third";
}
parent(String c){
this('a');
this.s += "Fourth";
}
parent(char d){
this.s = "Fifth";
System.out.println(this.s);
}
}
class chain {
static public void main(String[] string) {
parent p = new parent();
}
}
The output is
Fifth
I expected the following would be the flow
parent()->parent(int a)->parent(float b)->parent(String c)->parent(char d).
This happens but once the last constructor is executed I thought the
remaining String, float, int and no-arg constructor variants would be
executed because they do have code to process and is it not how they work.
I assume that constructors' execution is stack based (correct me if I am
wrong).
class parent {
String s;
parent() {
this(10);
this.s = "First";
}
parent(int a){
this(10.00f);
this.s += "Second";
}
parent(float b){
this("sss");
this.s += "Third";
}
parent(String c){
this('a');
this.s += "Fourth";
}
parent(char d){
this.s = "Fifth";
System.out.println(this.s);
}
}
class chain {
static public void main(String[] string) {
parent p = new parent();
}
}
The output is
Fifth
I expected the following would be the flow
parent()->parent(int a)->parent(float b)->parent(String c)->parent(char d).
This happens but once the last constructor is executed I thought the
remaining String, float, int and no-arg constructor variants would be
executed because they do have code to process and is it not how they work.
I assume that constructors' execution is stack based (correct me if I am
wrong).
Java Graphics.drawRect being filled?
Java Graphics.drawRect being filled?
Im making a rectangle selector using the mouse, and i have a normal
drawRect rectangle surrounding it. When the width or height goes negative,
The Rectangle is filled. Is there any way to fix this? here is my code:
@SuppressWarnings("serial")
public class Pie extends JPanel{
public boolean running = true;
public Rectangle mouseRect;
public Rectangle rectBounds;
public int x1,y1,x2,y2;
public boolean showRect = false;
public Pie(){
setFocusable(true);
MAdapter mama = new MAdapter();
setDoubleBuffered(true);
this.addMouseListener(new MAdapter());
this.addMouseMotionListener(mama);
setBackground(Color.black);
Thread update = new Thread(){
public void run(){
while(running){
repaint();
try{Thread.sleep(2);}catch(InterruptedException e){}
}
}
};
update.start();
}
public void paintComponent(Graphics g){
super.paintComponent(g);
//if(y2 < y1) y2 = y1;
if(showRect){
g.setColor(new Color(0,250,0,50));
g.fillRect(x1,y1,x2 - x1,y2 - y1);
g.setColor(new Color(0,255,0));
g.drawRect(x1 - 1,y1 - 1,x2 - x1 + 1,y2 - y1 + 1);
}
}
class MAdapter extends MouseAdapter{
public void mousePressed(MouseEvent e){
showRect = true;
x1 = e.getX();
y1 = e.getY();
x2 = e.getX();
y2 = e.getY();
}
public void mouseDragged(MouseEvent e){
x2 = e.getX();
y2 = e.getY();
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
}
public void mouseReleased(MouseEvent e){
showRect = false;
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
}
}
public static void main(String[] args){
JFrame f = new JFrame("Aber");
f.setSize(500,500);
f.setResizable(true);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLocationRelativeTo(null);
f.add(new Pie());
}
}
Is there anything im doing wrong? thanks in advance.
Im making a rectangle selector using the mouse, and i have a normal
drawRect rectangle surrounding it. When the width or height goes negative,
The Rectangle is filled. Is there any way to fix this? here is my code:
@SuppressWarnings("serial")
public class Pie extends JPanel{
public boolean running = true;
public Rectangle mouseRect;
public Rectangle rectBounds;
public int x1,y1,x2,y2;
public boolean showRect = false;
public Pie(){
setFocusable(true);
MAdapter mama = new MAdapter();
setDoubleBuffered(true);
this.addMouseListener(new MAdapter());
this.addMouseMotionListener(mama);
setBackground(Color.black);
Thread update = new Thread(){
public void run(){
while(running){
repaint();
try{Thread.sleep(2);}catch(InterruptedException e){}
}
}
};
update.start();
}
public void paintComponent(Graphics g){
super.paintComponent(g);
//if(y2 < y1) y2 = y1;
if(showRect){
g.setColor(new Color(0,250,0,50));
g.fillRect(x1,y1,x2 - x1,y2 - y1);
g.setColor(new Color(0,255,0));
g.drawRect(x1 - 1,y1 - 1,x2 - x1 + 1,y2 - y1 + 1);
}
}
class MAdapter extends MouseAdapter{
public void mousePressed(MouseEvent e){
showRect = true;
x1 = e.getX();
y1 = e.getY();
x2 = e.getX();
y2 = e.getY();
}
public void mouseDragged(MouseEvent e){
x2 = e.getX();
y2 = e.getY();
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
}
public void mouseReleased(MouseEvent e){
showRect = false;
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
}
}
public static void main(String[] args){
JFrame f = new JFrame("Aber");
f.setSize(500,500);
f.setResizable(true);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLocationRelativeTo(null);
f.add(new Pie());
}
}
Is there anything im doing wrong? thanks in advance.
Delete Function from List
Delete Function from List
I'm having trouble implementing the delete function, any help would be
appreciated. I have a list called memberlist that stores the persons name
and number. I have everything working except the delete function. Any help
would be appreciated.
public class Person
{
private string name;
private string phoneNumber;
public string Name
{
set { name = value; }
get { return name; }
}
public string PhoneNumber
{
set { phoneNumber = value; }
get { return phoneNumber; }
}
public void PrintInfo()
{
Console.WriteLine();
Console.WriteLine(" Name: {0}", name);
Console.WriteLine(" Phone Number: {0}", phoneNumber);
Console.WriteLine();
}
public void SaveASCII(ref StreamWriter output)
{
output.WriteLine(name);
output.WriteLine(phoneNumber);
}
public void LoadASCII(ref StreamReader input)
{
name = input.ReadLine();
phoneNumber = input.ReadLine();
}
}
public class membershipList
{
public Person[] ML = null;
public void AddMember(Person p)
{
if (ML == null)
{
ML = new Person[1];
ML[0] = p;
}
else
{
Person[] temp = ML;
ML = new Person[temp.Length + 1];
for (int i = 0; i < temp.Length; ++i)
{
ML[i] = new Person();
ML[i] = temp[i];
}
ML[temp.Length] = new Person();
ML[temp.Length] = p;
temp = null;
}
}
public void DeleteMember(string name)
{
if (ML == null)
{
Console.WriteLine(name + " had not been added before.");
}
else
{
int memberIndex = ML.MembershipList().FindIndex(p => p.Name ==
name);
if (memberIndex = -1)
{
Console.WriteLine(name + " had not been added before.");
return;
}
List<Person> tmp = new List<Person>(ML);
tmp.RemoveAt(memberIndex);
ML = tmp.ToArray();
}
}
public void PrintAll()
{
if (ML != null)
foreach (Person pers in ML)
pers.PrintInfo();
else Console.WriteLine("Then list is empty");
}
public void Search(string p)
{
if (ML != null)
{
foreach (Person pers in ML)
{
if (pers.Name.ToLower().CompareTo(p.ToLower()) == 0)
{
Console.WriteLine("1 Record Found:");
pers.PrintInfo();
break;
}
}
Console.WriteLine("Record not found.");
}
else Console.WriteLine("Then list is empty.");
}
public void ReadASCIIFile()
{
StreamReader input = new StreamReader("memberlist.dat"); ;
try
{
int num = Convert.ToInt32(input.ReadLine());
ML = new Person[num];
for (int i = 0; i < num; ++i)
{
ML[i] = new Person();
ML[i].LoadASCII(ref input);
}
input.Close();
}
catch (FormatException e)
{
Console.WriteLine(e.Message);
input.Close();
}
}
public void SaveASCIIFile()
{
StreamWriter output = new StreamWriter("memberlist.dat");
output.WriteLine(ML.Length);
foreach (Person pers in ML)
{
pers.SaveASCII(ref output);
}
output.Close();
}
}
class Program
{
static void Main(string[] args)
{
membershipList ML = new membershipList();
ML.ReadASCIIFile();
string option;
do
{
// Console.Clear();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("MemberShip List MENU");
Console.WriteLine();
Console.WriteLine(" a. Add");
Console.WriteLine(" b. Seach");
Console.WriteLine(" c. Delete");
Console.WriteLine(" d. Print All");
Console.WriteLine(" e. Exit");
Console.WriteLine();
Console.Write("option: ");
option = Console.ReadLine().ToLower();
switch (option)
{
case "a":
Person np = new Person();
Console.Write("Enter Name: ");
np.Name = Console.ReadLine();
Console.Write("Enter PhoneNumber: ");
np.PhoneNumber = Console.ReadLine();
ML.AddMember(np);
break;
case "b":
Console.Write("Enter Name: ");
string name = Console.ReadLine();
ML.Search(name);
break;
case "c":
Console.Write("Enter Name to be Deleted:");
ML.DeleteMember(name);
break;
case "d":
ML.PrintAll();
break;
case "e":
ML.SaveASCIIFile();
Console.WriteLine("BYE...... ");
break;
default:
Console.WriteLine("Invalid Option");
break;
}
} while (option.ToLower() != "d");
}
}
I'm having trouble implementing the delete function, any help would be
appreciated. I have a list called memberlist that stores the persons name
and number. I have everything working except the delete function. Any help
would be appreciated.
public class Person
{
private string name;
private string phoneNumber;
public string Name
{
set { name = value; }
get { return name; }
}
public string PhoneNumber
{
set { phoneNumber = value; }
get { return phoneNumber; }
}
public void PrintInfo()
{
Console.WriteLine();
Console.WriteLine(" Name: {0}", name);
Console.WriteLine(" Phone Number: {0}", phoneNumber);
Console.WriteLine();
}
public void SaveASCII(ref StreamWriter output)
{
output.WriteLine(name);
output.WriteLine(phoneNumber);
}
public void LoadASCII(ref StreamReader input)
{
name = input.ReadLine();
phoneNumber = input.ReadLine();
}
}
public class membershipList
{
public Person[] ML = null;
public void AddMember(Person p)
{
if (ML == null)
{
ML = new Person[1];
ML[0] = p;
}
else
{
Person[] temp = ML;
ML = new Person[temp.Length + 1];
for (int i = 0; i < temp.Length; ++i)
{
ML[i] = new Person();
ML[i] = temp[i];
}
ML[temp.Length] = new Person();
ML[temp.Length] = p;
temp = null;
}
}
public void DeleteMember(string name)
{
if (ML == null)
{
Console.WriteLine(name + " had not been added before.");
}
else
{
int memberIndex = ML.MembershipList().FindIndex(p => p.Name ==
name);
if (memberIndex = -1)
{
Console.WriteLine(name + " had not been added before.");
return;
}
List<Person> tmp = new List<Person>(ML);
tmp.RemoveAt(memberIndex);
ML = tmp.ToArray();
}
}
public void PrintAll()
{
if (ML != null)
foreach (Person pers in ML)
pers.PrintInfo();
else Console.WriteLine("Then list is empty");
}
public void Search(string p)
{
if (ML != null)
{
foreach (Person pers in ML)
{
if (pers.Name.ToLower().CompareTo(p.ToLower()) == 0)
{
Console.WriteLine("1 Record Found:");
pers.PrintInfo();
break;
}
}
Console.WriteLine("Record not found.");
}
else Console.WriteLine("Then list is empty.");
}
public void ReadASCIIFile()
{
StreamReader input = new StreamReader("memberlist.dat"); ;
try
{
int num = Convert.ToInt32(input.ReadLine());
ML = new Person[num];
for (int i = 0; i < num; ++i)
{
ML[i] = new Person();
ML[i].LoadASCII(ref input);
}
input.Close();
}
catch (FormatException e)
{
Console.WriteLine(e.Message);
input.Close();
}
}
public void SaveASCIIFile()
{
StreamWriter output = new StreamWriter("memberlist.dat");
output.WriteLine(ML.Length);
foreach (Person pers in ML)
{
pers.SaveASCII(ref output);
}
output.Close();
}
}
class Program
{
static void Main(string[] args)
{
membershipList ML = new membershipList();
ML.ReadASCIIFile();
string option;
do
{
// Console.Clear();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("MemberShip List MENU");
Console.WriteLine();
Console.WriteLine(" a. Add");
Console.WriteLine(" b. Seach");
Console.WriteLine(" c. Delete");
Console.WriteLine(" d. Print All");
Console.WriteLine(" e. Exit");
Console.WriteLine();
Console.Write("option: ");
option = Console.ReadLine().ToLower();
switch (option)
{
case "a":
Person np = new Person();
Console.Write("Enter Name: ");
np.Name = Console.ReadLine();
Console.Write("Enter PhoneNumber: ");
np.PhoneNumber = Console.ReadLine();
ML.AddMember(np);
break;
case "b":
Console.Write("Enter Name: ");
string name = Console.ReadLine();
ML.Search(name);
break;
case "c":
Console.Write("Enter Name to be Deleted:");
ML.DeleteMember(name);
break;
case "d":
ML.PrintAll();
break;
case "e":
ML.SaveASCIIFile();
Console.WriteLine("BYE...... ");
break;
default:
Console.WriteLine("Invalid Option");
break;
}
} while (option.ToLower() != "d");
}
}
Nested ForEach with afterRender callbacks in knockout.js
Nested ForEach with afterRender callbacks in knockout.js
What i want: access to a custom afterRender from my nested foreach.
What i have:
I am building a collapsible list of podcasts that each have multiple
categories. What i currently have is the list of podcasts being generated
using foreach, with a categories element inside being generated using
another foreach.
<div id="content-programs">
<!-- content -->
<div data-role="collapsible-set" data-bind="foreach: { data:
entries }">
<div class="entry" data-role="collapsible"
data-collapsed="false">
<h3 data-bind="text: title"></h3>
<b>Author:</b> <span data-bind="text: author"></span><p>
<b>Published:</b> <span data-bind="text:
publishedDate"></span><p>
<p>
<span data-bind="text: contentSnippet"></span>
<a data-bind="attr: {href: link}" >Full Story</a>
</p>
<b>Categories:</b>
<div data-bind="foreach: categories">
<span data-bind="text: $data"></span>
</div>
</div>
</div>
</div>
My request is pretty simple actually, i just want to comma delimit the
categories. I can do this on the data, or something similar, but im also
exploring knockout, and interested in what it can offer.
Here is what i've tried:
feed = ko.mapping.fromJS(response.responseData.feed);
ko.applyBindings
(
{
entries: feed.entries,
arCategories:
function(categories, data)
{
alert(data);
}
}
);
HTML
<b>Categories:</b>
<div data-bind="foreach: {data: categories, afterRender: arCategories}">
<span data-bind="text: $data"></span>
</div>
What i want: access to a custom afterRender from my nested foreach.
What i have:
I am building a collapsible list of podcasts that each have multiple
categories. What i currently have is the list of podcasts being generated
using foreach, with a categories element inside being generated using
another foreach.
<div id="content-programs">
<!-- content -->
<div data-role="collapsible-set" data-bind="foreach: { data:
entries }">
<div class="entry" data-role="collapsible"
data-collapsed="false">
<h3 data-bind="text: title"></h3>
<b>Author:</b> <span data-bind="text: author"></span><p>
<b>Published:</b> <span data-bind="text:
publishedDate"></span><p>
<p>
<span data-bind="text: contentSnippet"></span>
<a data-bind="attr: {href: link}" >Full Story</a>
</p>
<b>Categories:</b>
<div data-bind="foreach: categories">
<span data-bind="text: $data"></span>
</div>
</div>
</div>
</div>
My request is pretty simple actually, i just want to comma delimit the
categories. I can do this on the data, or something similar, but im also
exploring knockout, and interested in what it can offer.
Here is what i've tried:
feed = ko.mapping.fromJS(response.responseData.feed);
ko.applyBindings
(
{
entries: feed.entries,
arCategories:
function(categories, data)
{
alert(data);
}
}
);
HTML
<b>Categories:</b>
<div data-bind="foreach: {data: categories, afterRender: arCategories}">
<span data-bind="text: $data"></span>
</div>
Adding hyperlinks to index array in javascript
Adding hyperlinks to index array in javascript
How do I add a link in the description of an index array in javascript? My
code is below, thanks. I tried using push method, but I think I had a
conflict with the showpic function. I really don't know, so I would
appreciate any help.
<script type="text/javascript">
mypic = new Array();
mypic[0] = ["images/Lg_image1.jpg", "Large image 1 description."] //I
want to add an HTML link to a website at the end of this array
mypic[1] = ["images/Lg_image2.jpg", "Large image 2 description."] //I
want to add an HTML link to a website at the end of this array
function showpic2(n) {
document.getElementById("mainpic2").src = mypic[n][0]
document.getElementById("mycaption2").innerHTML = mypic[n][1]
count = n
}
count = 0;
function next() {
count++
if (count == mypic2.length) {
count = 0
}
document.getElementById("mainpic2").src = mypic2[count][0]
document.getElementById("mycaption2").innerHTML = mypic2[count][1]
}
function prev() {
count--
if (count < 0) {
count = mypic2.length - 1
}
document.getElementById("mainpic2").src = mypic2[count][0]
document.getElementById("mycaption2").innerHTML = mypic2[count][1]
}
</script>
<body>
<div id="container">
<div class="menu1">
<ul>
<li><a href="#">Link 1</a> </li>
</ul>
<ul>
<li><a href="#">Link 2</a> </li>
</ul>
</div>
<div id="large"> <img src="images/Lg_image1.jpg" class="mainpic2"
id="mainpic2"> </div>
<div id="thumbs2"> <a href="javascript:showpic2(0)"><img
src="images/sm_image1.jpg" alt="image1"/></a> <a
href="javascript:showpic2(1)"><img src="images/sm_image2.jpg"
alt="image2"/></a> </div>
<div id="mycaption2">Large image default description. </div>
<div id="logohome"> <img src="images/#.png" alt="" /> </div>
<div id="homebox"> <img src="images/homebox1.png" alt="" /> </div>
</div>
</body>
</html>
How do I add a link in the description of an index array in javascript? My
code is below, thanks. I tried using push method, but I think I had a
conflict with the showpic function. I really don't know, so I would
appreciate any help.
<script type="text/javascript">
mypic = new Array();
mypic[0] = ["images/Lg_image1.jpg", "Large image 1 description."] //I
want to add an HTML link to a website at the end of this array
mypic[1] = ["images/Lg_image2.jpg", "Large image 2 description."] //I
want to add an HTML link to a website at the end of this array
function showpic2(n) {
document.getElementById("mainpic2").src = mypic[n][0]
document.getElementById("mycaption2").innerHTML = mypic[n][1]
count = n
}
count = 0;
function next() {
count++
if (count == mypic2.length) {
count = 0
}
document.getElementById("mainpic2").src = mypic2[count][0]
document.getElementById("mycaption2").innerHTML = mypic2[count][1]
}
function prev() {
count--
if (count < 0) {
count = mypic2.length - 1
}
document.getElementById("mainpic2").src = mypic2[count][0]
document.getElementById("mycaption2").innerHTML = mypic2[count][1]
}
</script>
<body>
<div id="container">
<div class="menu1">
<ul>
<li><a href="#">Link 1</a> </li>
</ul>
<ul>
<li><a href="#">Link 2</a> </li>
</ul>
</div>
<div id="large"> <img src="images/Lg_image1.jpg" class="mainpic2"
id="mainpic2"> </div>
<div id="thumbs2"> <a href="javascript:showpic2(0)"><img
src="images/sm_image1.jpg" alt="image1"/></a> <a
href="javascript:showpic2(1)"><img src="images/sm_image2.jpg"
alt="image2"/></a> </div>
<div id="mycaption2">Large image default description. </div>
<div id="logohome"> <img src="images/#.png" alt="" /> </div>
<div id="homebox"> <img src="images/homebox1.png" alt="" /> </div>
</div>
</body>
</html>
Advanced Learning Resources for Windows Phone 8
Advanced Learning Resources for Windows Phone 8
I followed the video series on Channel9 "Windows Phone 8 Development for
Absolute Beginners"
(http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners?page=3)
and I've found myself to know a lot of the materials covered there.
However I still find myself to be an intermediate Windows Phone
programmer. Are there good learning resources (books, videos, ...) that
could help me to know things better (I've watched the last video of the
series but it didn't help me so much...)? I'm particularly interested in
understanding how things work under the hood, I'm interested in advanced
topics (in the video series it was mentioned something about Streams,
Serialization/Deserialization...) and I would like to be challenged with
excercises while learning. Can anyone help me? Thanks.
I followed the video series on Channel9 "Windows Phone 8 Development for
Absolute Beginners"
(http://channel9.msdn.com/Series/Windows-Phone-8-Development-for-Absolute-Beginners?page=3)
and I've found myself to know a lot of the materials covered there.
However I still find myself to be an intermediate Windows Phone
programmer. Are there good learning resources (books, videos, ...) that
could help me to know things better (I've watched the last video of the
series but it didn't help me so much...)? I'm particularly interested in
understanding how things work under the hood, I'm interested in advanced
topics (in the video series it was mentioned something about Streams,
Serialization/Deserialization...) and I would like to be challenged with
excercises while learning. Can anyone help me? Thanks.
include jquery in rails 3
include jquery in rails 3
In my rails application I am trying to include jquery focus effect for a
search button. When the mouse is over that button it should change the
color. But the jquery code is not working ,although I tried using
search.js,search.js.erb.In the gems file I have also included jquery rails
in Gem file and also tried bundle install.
<!DOCTYPE html>
<html>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("text_field_tag").focus(function(){
$(this).css("background-color","#cccccc");
});
$("text_field_tag").blur(function(){
$(this).css("background-color", "#ffffff");
});
});
</script>
<body>
<%=form_tag({controller: 'tweets', action:'index'}, method: "get")
do %>
<%=label_tag(:search, "Search for:") %>
<%=text_field_tag(:text) %>
<%=label_tag(:show, "Show for:") %>
<%=text_field_tag(:show) %>
<%= submit_tag( "GO" ) %>
<% end %>
</body>
</html>
I also tried by removing the "script src" tag even then its not
working.Anybody please help..
In my rails application I am trying to include jquery focus effect for a
search button. When the mouse is over that button it should change the
color. But the jquery code is not working ,although I tried using
search.js,search.js.erb.In the gems file I have also included jquery rails
in Gem file and also tried bundle install.
<!DOCTYPE html>
<html>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("text_field_tag").focus(function(){
$(this).css("background-color","#cccccc");
});
$("text_field_tag").blur(function(){
$(this).css("background-color", "#ffffff");
});
});
</script>
<body>
<%=form_tag({controller: 'tweets', action:'index'}, method: "get")
do %>
<%=label_tag(:search, "Search for:") %>
<%=text_field_tag(:text) %>
<%=label_tag(:show, "Show for:") %>
<%=text_field_tag(:show) %>
<%= submit_tag( "GO" ) %>
<% end %>
</body>
</html>
I also tried by removing the "script src" tag even then its not
working.Anybody please help..
Friday, 30 August 2013
Undefined variable or method when adding answers to questions
Undefined variable or method when adding answers to questions
I'm trying to add answers to questions. Each questions has_one answer. I'm
showing them on the comment page through partials except I keep getting
this error:
undefined local variable or method `answer'
Here is part of my answers_controller.rb
class AnswersController < ApplicationController
before_action :set_answer, only: [:show, :edit, :update, :destroy]
def index
@question = Question.find params[:question_id]
@question.answers
end
def show
end
def new
@question = Question.find params[:question_id]
end
def edit
end
def create
@question = Question.find(params[:question_id])
@answer = @question.answers.create(answer_params)
respond_to do |format|
if @answer.save
format.html { redirect_to @comment, notice: 'Answer was successfully
created.' }
format.json { render action: 'show', status: :created, location:
@answer }
else
format.html { render action: 'new' }
format.json { render json: @answer.errors, status:
:unprocessable_entity }
end
end
end
Here is my _question.html.erb partial where the answer partial is called:
<%=div_for(question) do %>
<div class="questioncontainer">
<p>
<%= question.body %>
<%= render :partial => @question.answers %>
<% if current_user == @comment.user %>
<div class="answercontainer">
<%= link_to 'Answer', new_question_answer_path(question)%>
</div>
</div>
</p>
<% end %>
<% end %>
Last, here is my _answer.html.erb partial:
<%=div_for(answer) do %>
<div class="questioncontainer">
<p>
<%= answer.body %>
</p>
</div>
<% end %>
Thanks for the help :)
I'm trying to add answers to questions. Each questions has_one answer. I'm
showing them on the comment page through partials except I keep getting
this error:
undefined local variable or method `answer'
Here is part of my answers_controller.rb
class AnswersController < ApplicationController
before_action :set_answer, only: [:show, :edit, :update, :destroy]
def index
@question = Question.find params[:question_id]
@question.answers
end
def show
end
def new
@question = Question.find params[:question_id]
end
def edit
end
def create
@question = Question.find(params[:question_id])
@answer = @question.answers.create(answer_params)
respond_to do |format|
if @answer.save
format.html { redirect_to @comment, notice: 'Answer was successfully
created.' }
format.json { render action: 'show', status: :created, location:
@answer }
else
format.html { render action: 'new' }
format.json { render json: @answer.errors, status:
:unprocessable_entity }
end
end
end
Here is my _question.html.erb partial where the answer partial is called:
<%=div_for(question) do %>
<div class="questioncontainer">
<p>
<%= question.body %>
<%= render :partial => @question.answers %>
<% if current_user == @comment.user %>
<div class="answercontainer">
<%= link_to 'Answer', new_question_answer_path(question)%>
</div>
</div>
</p>
<% end %>
<% end %>
Last, here is my _answer.html.erb partial:
<%=div_for(answer) do %>
<div class="questioncontainer">
<p>
<%= answer.body %>
</p>
</div>
<% end %>
Thanks for the help :)
Thursday, 29 August 2013
php convert png to svg [on hold]
php convert png to svg [on hold]
Any one suggest code for php. I want to create svg zoom-able image from
png images regarding for PDF highly zoom-able like 6000%. please give me
idea about php code or php command line code.
Thanks, Pushparaj
Any one suggest code for php. I want to create svg zoom-able image from
png images regarding for PDF highly zoom-able like 6000%. please give me
idea about php code or php command line code.
Thanks, Pushparaj
Alignment in DOJO table
Alignment in DOJO table
I am a beginner in DOJO. I have the following DOJO table.
{ name: "I/P Voltage (V)", classes: "title",field: "mainsVoltage",
width: "80px" },
{ name: "I/P Charging Current (A)", classes: "title",field:
"gridchargingcurrent", width: "150px" },
{ name: "I/P Frequency (Hz)", classes: "title",field: "mainsFreq",
width: "120px" }
How do I make the units{(v),(A),(Hz)} appear in the center of next line?
I am a beginner in DOJO. I have the following DOJO table.
{ name: "I/P Voltage (V)", classes: "title",field: "mainsVoltage",
width: "80px" },
{ name: "I/P Charging Current (A)", classes: "title",field:
"gridchargingcurrent", width: "150px" },
{ name: "I/P Frequency (Hz)", classes: "title",field: "mainsFreq",
width: "120px" }
How do I make the units{(v),(A),(Hz)} appear in the center of next line?
PHP uksort function using global variable fails after PHP upgrade to 5.3.3
PHP uksort function using global variable fails after PHP upgrade to 5.3.3
I have a user defined sort function which uses a 'global' declaration in
order to refer to a multi-dimensional array when deciding on the correct
sort order. It used to work fine under PHP 5.1.6 but now fails under
5.3.3.
The code throws PHP warning: PHP Warning: uksort(): Array was modified by
the user comparison function
But the code definitely does not modify the array.
This code duplicates the problem:
$arr = array();
$arr['i1']['val1'] = 99;
$arr['i1']['val2'] = 100;
$arr['i2']['val1'] = 89;
$arr['i2']['val2'] = 101;
function cmp($a, $b)
{
global $arr;
if ($arr[$a]['val2'] > $arr[$b]['val2']) { return 1; }
if ($arr[$q]['val2'] < $arr[$b]['val2']) { return -1; }
return 0;
}
if (uksort($arr, 'cmp'))
{
echo "success";
}
else
{
echo "failure";
}
I have a user defined sort function which uses a 'global' declaration in
order to refer to a multi-dimensional array when deciding on the correct
sort order. It used to work fine under PHP 5.1.6 but now fails under
5.3.3.
The code throws PHP warning: PHP Warning: uksort(): Array was modified by
the user comparison function
But the code definitely does not modify the array.
This code duplicates the problem:
$arr = array();
$arr['i1']['val1'] = 99;
$arr['i1']['val2'] = 100;
$arr['i2']['val1'] = 89;
$arr['i2']['val2'] = 101;
function cmp($a, $b)
{
global $arr;
if ($arr[$a]['val2'] > $arr[$b]['val2']) { return 1; }
if ($arr[$q]['val2'] < $arr[$b]['val2']) { return -1; }
return 0;
}
if (uksort($arr, 'cmp'))
{
echo "success";
}
else
{
echo "failure";
}
Wednesday, 28 August 2013
Download to root directory
Download to root directory
Okay, so I have been searching for ages to find this but no luck.
I am using:
Me.downloader.DownloadFileAsync(New Uri(fileUrl),
Path.GetFileName(fileUrl), Stopwatch.StartNew)
To download a file but I want it to save to the root directory of my
program in a file called launcher.
So for example, if my program is on the desktop and I open it and click
start I want it to create the launcher folder if it's missing then
download the files into that and if it's not then just download the files
into it.
I've been looking everywhere to find code which would allow me to do this
and I have tried lots of different things.
At the moment, it justs saves in the root directory of where the program is.
Thanks.
Okay, so I have been searching for ages to find this but no luck.
I am using:
Me.downloader.DownloadFileAsync(New Uri(fileUrl),
Path.GetFileName(fileUrl), Stopwatch.StartNew)
To download a file but I want it to save to the root directory of my
program in a file called launcher.
So for example, if my program is on the desktop and I open it and click
start I want it to create the launcher folder if it's missing then
download the files into that and if it's not then just download the files
into it.
I've been looking everywhere to find code which would allow me to do this
and I have tried lots of different things.
At the moment, it justs saves in the root directory of where the program is.
Thanks.
Using bp-members/bp-members-functions.php in child theme
Using bp-members/bp-members-functions.php in child theme
I am altering bp-members/bp-members-functions.php bp_core_signup_user
where if user type is 'XXX', sending out a mail with activation link. If
user type is 'YYY', sending out a mail without activation link. It is
working fine after coding.
I just wanted to check is it possible we could create bp-members in child
theme? The only worry I have is, if I take an update of buddypress, I
shouldn't loose what's been coded in bp-members-functions.php. Also, I do
not want to block the updates.
Is there any other better way of doing this?
I am altering bp-members/bp-members-functions.php bp_core_signup_user
where if user type is 'XXX', sending out a mail with activation link. If
user type is 'YYY', sending out a mail without activation link. It is
working fine after coding.
I just wanted to check is it possible we could create bp-members in child
theme? The only worry I have is, if I take an update of buddypress, I
shouldn't loose what's been coded in bp-members-functions.php. Also, I do
not want to block the updates.
Is there any other better way of doing this?
Using [not] in xpath to retrieve content that does not match given values (PLSQL)
Using [not] in xpath to retrieve content that does not match given values
(PLSQL)
I'm trying to use the following code to filter out xml return tags that do
not contain a given status code:
l_xml_return :=
(xmltype(l_xml_response).extract('//return[not(issueStatusId=84388)]|
//return[not(issueStatusId=73630)]|
//return[not(issueStatusId=67539)]|
//return[not(issueStatusId=42527)]|
//return[not(issueStatusId=22702)]|
//return[not(issueStatusId=20643)]|
//return[not(issueStatusId=4368)]|
//return[not(issueStatusId=4363)]|
//return[not(issueStatusId=4364)]
').getclobval());
My xml is comprised of the following:
<results>
<return>
<issueStatusId>84388</issueStatusId>
<name>Test 1</name>
</return>
<return>
<issueStatusId>4364</issueStatusId>
<name>Test 2</name>
</return>
<return>
<issueStatusId>999999</issueStatusId>
<name>Test 3</name>
</return>
</results>
With this xml code and xpath statement, only the return tag with an issue
status of 999999 should be returned however this is not the case.
Does anyone know why this is?
Cheers,
Jezzipin
(PLSQL)
I'm trying to use the following code to filter out xml return tags that do
not contain a given status code:
l_xml_return :=
(xmltype(l_xml_response).extract('//return[not(issueStatusId=84388)]|
//return[not(issueStatusId=73630)]|
//return[not(issueStatusId=67539)]|
//return[not(issueStatusId=42527)]|
//return[not(issueStatusId=22702)]|
//return[not(issueStatusId=20643)]|
//return[not(issueStatusId=4368)]|
//return[not(issueStatusId=4363)]|
//return[not(issueStatusId=4364)]
').getclobval());
My xml is comprised of the following:
<results>
<return>
<issueStatusId>84388</issueStatusId>
<name>Test 1</name>
</return>
<return>
<issueStatusId>4364</issueStatusId>
<name>Test 2</name>
</return>
<return>
<issueStatusId>999999</issueStatusId>
<name>Test 3</name>
</return>
</results>
With this xml code and xpath statement, only the return tag with an issue
status of 999999 should be returned however this is not the case.
Does anyone know why this is?
Cheers,
Jezzipin
Php - detect which form was posted
Php - detect which form was posted
I have a single page with multiple forms which may appear on it. Is there
anyway of distinguishing between these forms in php (some kind of form
iding system)?
I have a single page with multiple forms which may appear on it. Is there
anyway of distinguishing between these forms in php (some kind of form
iding system)?
Tuesday, 27 August 2013
No "My Work" in visual studio 2012 team explorer
No "My Work" in visual studio 2012 team explorer
I'm using Visual Studio 2012 Premium, and in my team explorer, all I see
is Work Items, there's no My Work where I can suspend and resume tasks.
Under Home, all I see are:
Changes
Work Items
Builds
Web Access
Settings
I'm connected to team foundation service (the cloud edition, not server),
with Git as my source control.
I'm looking through this exercise here:
http://msdn.microsoft.com/en-us/library/vstudio/hh474795.aspx
I understand that My Work is available only on premium & ultimate, so I
should be able to access it, right?
How do I get My Work to show up?
I'm using Visual Studio 2012 Premium, and in my team explorer, all I see
is Work Items, there's no My Work where I can suspend and resume tasks.
Under Home, all I see are:
Changes
Work Items
Builds
Web Access
Settings
I'm connected to team foundation service (the cloud edition, not server),
with Git as my source control.
I'm looking through this exercise here:
http://msdn.microsoft.com/en-us/library/vstudio/hh474795.aspx
I understand that My Work is available only on premium & ultimate, so I
should be able to access it, right?
How do I get My Work to show up?
Cannot make Java Package on an OpenVZ container
Cannot make Java Package on an OpenVZ container
I'm trying to install Sun's Java SDK 7 by following the Debian Wiki
instructions using java-package. But it won't work on an OpenVZ proxmox
container.
I'm running Debian Wheezy 7.0-2 64bit on all my environments.
java-package works fine on my local machine and on other virtualized
Debian machines ( KVM or VirtualBox) but not on my container.
When I try to make-jpkg jdk-7u25-linux-x64.tar.gz I get the following error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Anyone know how to solve this or is it just one of those things that
cannot be done in a container?
I'm trying to install Sun's Java SDK 7 by following the Debian Wiki
instructions using java-package. But it won't work on an OpenVZ proxmox
container.
I'm running Debian Wheezy 7.0-2 64bit on all my environments.
java-package works fine on my local machine and on other virtualized
Debian machines ( KVM or VirtualBox) but not on my container.
When I try to make-jpkg jdk-7u25-linux-x64.tar.gz I get the following error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Anyone know how to solve this or is it just one of those things that
cannot be done in a container?
two uses of jquery conflict with eachother
two uses of jquery conflict with eachother
on this site, I have 2 uses of jquery, one for "anything slider" and
another for a toggle for hide show.
http://www.worklightrpo.com/
If I remove the toggle's link to jquery, the slider works, but the toggle
doesn't... this is the link for the toggle's jquery.
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.7.2.js"></script>
Does anyone know how I can get them BOTH to work and play nicely?
Thanks
on this site, I have 2 uses of jquery, one for "anything slider" and
another for a toggle for hide show.
http://www.worklightrpo.com/
If I remove the toggle's link to jquery, the slider works, but the toggle
doesn't... this is the link for the toggle's jquery.
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.7.2.js"></script>
Does anyone know how I can get them BOTH to work and play nicely?
Thanks
Important problem: Ubuntu 9.04 does not aknoledge my USB-Does not appear on the Desktop, at my Personal Folder and at Places [on hold]
Important problem: Ubuntu 9.04 does not aknoledge my USB-Does not appear
on the Desktop, at my Personal Folder and at Places [on hold]
I have a very important problem with my system (Ubuntu 9.04). When i
connect my USB flash disk on my system, the system DOES NOT appear on the
Desktop and on my personal folder(in other words the system DOES NOT
aknowledge the USB). At USB i have important files like UBUNTU 13.04
ISO(that i really want to install on my system with this USB) and more
files.... which are very important for me. Now, what should i do to fix
this problem?
on the Desktop, at my Personal Folder and at Places [on hold]
I have a very important problem with my system (Ubuntu 9.04). When i
connect my USB flash disk on my system, the system DOES NOT appear on the
Desktop and on my personal folder(in other words the system DOES NOT
aknowledge the USB). At USB i have important files like UBUNTU 13.04
ISO(that i really want to install on my system with this USB) and more
files.... which are very important for me. Now, what should i do to fix
this problem?
i getting segment fault due to string data type variable in PROTOBUF server and clent communcation through sockets on recv end in cpp
i getting segment fault due to string data type variable in PROTOBUF
server and clent communcation through sockets on recv end in cpp
/* when i am sending a protobuf variable through socket communication on
recv end i am trying to display the string variable of protobuf i got
segmentation in this remaining Data type other than String they are
working fine but string variable case i got sementation How can i over
come in Protobuf string datatype sementation fault other than we have any
other data type for store the string data type */
i create a example.proto with in string variable name is there i am
compile example.proto with protoc compiler( protoc example.proto --cpp_out
) it create two files two files example.pb.h, example.pb.cc By using these
files i create a test_server.cpp and test_client.cpp And compile it. but
at the time of both programms runing i sent a protobuf variable on recv
side it give segmentation fault due to trying to display string variable
How can i over come this problem
example.proto
/package data; message star { optional string name=1;}/ This my file
server and clent communcation through sockets on recv end in cpp
/* when i am sending a protobuf variable through socket communication on
recv end i am trying to display the string variable of protobuf i got
segmentation in this remaining Data type other than String they are
working fine but string variable case i got sementation How can i over
come in Protobuf string datatype sementation fault other than we have any
other data type for store the string data type */
i create a example.proto with in string variable name is there i am
compile example.proto with protoc compiler( protoc example.proto --cpp_out
) it create two files two files example.pb.h, example.pb.cc By using these
files i create a test_server.cpp and test_client.cpp And compile it. but
at the time of both programms runing i sent a protobuf variable on recv
side it give segmentation fault due to trying to display string variable
How can i over come this problem
example.proto
/package data; message star { optional string name=1;}/ This my file
Using DOMDocument in Zendframework2
Using DOMDocument in Zendframework2
I would like to use DOMDocument in ZendFramework 2 but I don't know how.
My normal script (non-zf2) looks as follows:
<?php
...
$response = $client->$webservice($variables);
$dom = new DOMDocument();
$dom->loadXML($response->$property);
return $dom;
And it works fine. But I want to use this in my ZendFramework 2
Application. But this line:
$dom = new DOMDocument();
gives me this error: Fatal error: Class 'Sols\Model\DOMDocument' not found
in... I thought mayby I should use Zend\Dom\Query but that won't work
either. How to be able to use the "standard" DOMDocument in
ZendFramework2?
By the way, DOMDocument works fine on my server (if I don't use it within
ZendFramework2)...
Thank you very much :-)
I would like to use DOMDocument in ZendFramework 2 but I don't know how.
My normal script (non-zf2) looks as follows:
<?php
...
$response = $client->$webservice($variables);
$dom = new DOMDocument();
$dom->loadXML($response->$property);
return $dom;
And it works fine. But I want to use this in my ZendFramework 2
Application. But this line:
$dom = new DOMDocument();
gives me this error: Fatal error: Class 'Sols\Model\DOMDocument' not found
in... I thought mayby I should use Zend\Dom\Query but that won't work
either. How to be able to use the "standard" DOMDocument in
ZendFramework2?
By the way, DOMDocument works fine on my server (if I don't use it within
ZendFramework2)...
Thank you very much :-)
Monday, 26 August 2013
Fatal and NullPointerException in MapView
Fatal and NullPointerException in MapView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.MapFragment" />
</RelativeLayout>
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.MapFragment" />
</RelativeLayout>
change cursor in Windows 8/Windows 8.1 c# in Webview control
change cursor in Windows 8/Windows 8.1 c# in Webview control
im trying to implement cursor changes in webview control but this solution
(Change cursor in Metro Style Apps) doesnt seem to work. helpful tips are
much appreciated. thanks!
im trying to implement cursor changes in webview control but this solution
(Change cursor in Metro Style Apps) doesnt seem to work. helpful tips are
much appreciated. thanks!
How to select all elements between two h2
How to select all elements between two h2
I am using jQuery. I have the following html fragment:
<h1>Main Title</h1>
<h2>One header</h2>
<p>some text</p>
<p>more text</p>
<ul><li>a list</li></ul>
<h2>Another header</h2>
<a href="######">one link</a>
<h3>ddd</h3>
<p>eee</p>
<h2>Header 3<h2>
<p>This is a Paragraph</p>
I need to get the content that is between every h2 element, in order to do
something like this:
First Section text
some text
more text
Second section text
one link
ddd
eee
Third section text
This is a Paragraph
I've read this resource:
http://www.tutorialspoint.com/jquery/jquery-selectors.htm
but still cannot figure how to do what I need.
Thanks in advance!
I am using jQuery. I have the following html fragment:
<h1>Main Title</h1>
<h2>One header</h2>
<p>some text</p>
<p>more text</p>
<ul><li>a list</li></ul>
<h2>Another header</h2>
<a href="######">one link</a>
<h3>ddd</h3>
<p>eee</p>
<h2>Header 3<h2>
<p>This is a Paragraph</p>
I need to get the content that is between every h2 element, in order to do
something like this:
First Section text
some text
more text
Second section text
one link
ddd
eee
Third section text
This is a Paragraph
I've read this resource:
http://www.tutorialspoint.com/jquery/jquery-selectors.htm
but still cannot figure how to do what I need.
Thanks in advance!
FATAL EXCEPTION: NullPointerException at x_button.setOnClickListener
FATAL EXCEPTION: NullPointerException at x_button.setOnClickListener
For some unknown reason I'm getting FATAL EXCEPTION: main -
java.lang.NullPointerException on the line:
x_button.setOnClickListener(new View.OnClickListener() {
but I'm not sure why this is happening. The button is there - so I'm not
sure why a null pointer would occur at this point - but it is.
Any input is greatly appreciated.
SOURCE:
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
// Show updated screen if table was successfully updated
// Or alert indicating settings are not updated
if (result.equals("success")) {
setContentView(R.layout.completion);
} else
setContentView(R.layout.error);
Button x_button = (Button) findViewById(R.id.x_button);
x_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finishAll(v);
}
});
}
LOGCAT:
08-26 15:49:42.419: W/System.err(5998): java.io.IOException: Stream is closed
08-26 15:49:42.429: W/System.err(5998): at
java.util.zip.GZIPInputStream.read(GZIPInputStream.java:161)
08-26 15:49:42.429: W/System.err(5998): at
java.io.DataInputStream.read(DataInputStream.java:95)
08-26 15:49:42.429: W/System.err(5998): at
java.io.InputStreamReader.read(InputStreamReader.java:255)
08-26 15:49:42.429: W/System.err(5998): at
java.io.BufferedReader.fillBuf(BufferedReader.java:128)
08-26 15:49:42.429: W/System.err(5998): at
java.io.BufferedReader.readLine(BufferedReader.java:357)
08-26 15:49:42.429: W/System.err(5998): at
com.tracfone.straighttalk.networktasklibrary.NetworkTask.doInBackground(NetworkTask.java:37)
08-26 15:49:42.429: W/System.err(5998): at
com.tracfone.straighttalk.networktasklibrary.NetworkTask.doInBackground(NetworkTask.java:1)
08-26 15:49:42.429: W/System.err(5998): at
android.os.AsyncTask$2.call(AsyncTask.java:185)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.FutureTask.run(FutureTask.java:138)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
08-26 15:49:42.429: W/System.err(5998): at
java.lang.Thread.run(Thread.java:1019)
08-26 15:49:46.299: W/dalvikvm(5998): threadid=1: thread exiting with
uncaught exception (group=0x4016e560)
08-26 15:49:46.299: E/AndroidRuntime(5998): FATAL EXCEPTION: main
08-26 15:49:46.299: E/AndroidRuntime(5998): java.lang.NullPointerException
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.project.new.datasettings.ConfigFinalActivity$TableUpdateRequestTask.onPostExecute(ConfigFinalActivity.java:552)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.project.new.datasettings.ConfigFinalActivity$TableUpdateRequestTask.onPostExecute(ConfigFinalActivity.java:1)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.AsyncTask.finish(AsyncTask.java:417)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.AsyncTask.access$300(AsyncTask.java:127)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.Looper.loop(Looper.java:130)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.app.ActivityThread.main(ActivityThread.java:3821)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
java.lang.reflect.Method.invokeNative(Native Method)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
java.lang.reflect.Method.invoke(Method.java:507)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
dalvik.system.NativeStart.main(Native Method)
For some unknown reason I'm getting FATAL EXCEPTION: main -
java.lang.NullPointerException on the line:
x_button.setOnClickListener(new View.OnClickListener() {
but I'm not sure why this is happening. The button is there - so I'm not
sure why a null pointer would occur at this point - but it is.
Any input is greatly appreciated.
SOURCE:
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
// Show updated screen if table was successfully updated
// Or alert indicating settings are not updated
if (result.equals("success")) {
setContentView(R.layout.completion);
} else
setContentView(R.layout.error);
Button x_button = (Button) findViewById(R.id.x_button);
x_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finishAll(v);
}
});
}
LOGCAT:
08-26 15:49:42.419: W/System.err(5998): java.io.IOException: Stream is closed
08-26 15:49:42.429: W/System.err(5998): at
java.util.zip.GZIPInputStream.read(GZIPInputStream.java:161)
08-26 15:49:42.429: W/System.err(5998): at
java.io.DataInputStream.read(DataInputStream.java:95)
08-26 15:49:42.429: W/System.err(5998): at
java.io.InputStreamReader.read(InputStreamReader.java:255)
08-26 15:49:42.429: W/System.err(5998): at
java.io.BufferedReader.fillBuf(BufferedReader.java:128)
08-26 15:49:42.429: W/System.err(5998): at
java.io.BufferedReader.readLine(BufferedReader.java:357)
08-26 15:49:42.429: W/System.err(5998): at
com.tracfone.straighttalk.networktasklibrary.NetworkTask.doInBackground(NetworkTask.java:37)
08-26 15:49:42.429: W/System.err(5998): at
com.tracfone.straighttalk.networktasklibrary.NetworkTask.doInBackground(NetworkTask.java:1)
08-26 15:49:42.429: W/System.err(5998): at
android.os.AsyncTask$2.call(AsyncTask.java:185)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.FutureTask.run(FutureTask.java:138)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
08-26 15:49:42.429: W/System.err(5998): at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
08-26 15:49:42.429: W/System.err(5998): at
java.lang.Thread.run(Thread.java:1019)
08-26 15:49:46.299: W/dalvikvm(5998): threadid=1: thread exiting with
uncaught exception (group=0x4016e560)
08-26 15:49:46.299: E/AndroidRuntime(5998): FATAL EXCEPTION: main
08-26 15:49:46.299: E/AndroidRuntime(5998): java.lang.NullPointerException
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.project.new.datasettings.ConfigFinalActivity$TableUpdateRequestTask.onPostExecute(ConfigFinalActivity.java:552)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.project.new.datasettings.ConfigFinalActivity$TableUpdateRequestTask.onPostExecute(ConfigFinalActivity.java:1)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.AsyncTask.finish(AsyncTask.java:417)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.AsyncTask.access$300(AsyncTask.java:127)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.os.Looper.loop(Looper.java:130)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
android.app.ActivityThread.main(ActivityThread.java:3821)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
java.lang.reflect.Method.invokeNative(Native Method)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
java.lang.reflect.Method.invoke(Method.java:507)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
08-26 15:49:46.299: E/AndroidRuntime(5998): at
dalvik.system.NativeStart.main(Native Method)
Video.js in Modal - Too much recursion error
Video.js in Modal - Too much recursion error
Im using video.js and bootstrap 3 modal plugins to play a video in a modal
window.
My problem is when I try to pause/stop the video using the video.js api on
modal hide event I receive a too much recursion error from jQuery.
The Error
too much recursion
...1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){i...
This is the problematic part of my script.
videojs("example_video_1").ready(function(){
var myPlayer = this;
myPlayer.pause();
});
HTML
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<div class="modal-body">
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="960" height="399"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{"example_option":true}'>
<source src="http://video-js.zencoder.com/oceans-clip.mp4"
type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm"
type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv"
type='video/ogg' />
</video>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
jQuery
<script>
$(document).ready(function(){
var myPlayer = videojs("example_video_1");
$('.modal').on('show.bs.modal', function () {
$('.modal').css('visibility','hidden');
console.log('show');
})
$('.modal').on('shown.bs.modal', function () {
CalcHeight();
$('.modal').css('visibility','visible');
})
$('.modal').on('hide.bs.modal', function () {
videojs("example_video_1").ready(function(){
var myPlayer = this;
myPlayer.pause();
});
})
function CalcHeight(){
var modalHeight = $('.modal-dialog').height();
var newModalHeight = modalHeight / 2;
$('.modal').css('top','50%');
$('.modal').css('margin-top', -newModalHeight);
});
</script>
Im using video.js and bootstrap 3 modal plugins to play a video in a modal
window.
My problem is when I try to pause/stop the video using the video.js api on
modal hide event I receive a too much recursion error from jQuery.
The Error
too much recursion
...1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){i...
This is the problematic part of my script.
videojs("example_video_1").ready(function(){
var myPlayer = this;
myPlayer.pause();
});
HTML
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<div class="modal-body">
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="960" height="399"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{"example_option":true}'>
<source src="http://video-js.zencoder.com/oceans-clip.mp4"
type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm"
type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv"
type='video/ogg' />
</video>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
jQuery
<script>
$(document).ready(function(){
var myPlayer = videojs("example_video_1");
$('.modal').on('show.bs.modal', function () {
$('.modal').css('visibility','hidden');
console.log('show');
})
$('.modal').on('shown.bs.modal', function () {
CalcHeight();
$('.modal').css('visibility','visible');
})
$('.modal').on('hide.bs.modal', function () {
videojs("example_video_1").ready(function(){
var myPlayer = this;
myPlayer.pause();
});
})
function CalcHeight(){
var modalHeight = $('.modal-dialog').height();
var newModalHeight = modalHeight / 2;
$('.modal').css('top','50%');
$('.modal').css('margin-top', -newModalHeight);
});
</script>
changing http headers after output
changing http headers after output
I have a few questions regarding headers and output buffering.
I know headers must be send before output or they will not work, and that
output buffering stores all HTML into a buffer and sends it as one as
opposed to PHP processes sent bits at a time.
So does this mean when output buffering is on, all content is collected
into one variable and where ever the headers were defined in the script
they will be placed at the top/first?
And if output buffering is off you have to declare headers before any output?
And also to use any output buffering functions such as ob_clean() you need
output buffering to be on? as if output buffering was off, you couldn't
clean, 'take back', anything as it would of already been sent?
Finally is output buffering turned on/off within php.ini? as my XAMPP
local host server seems to have output buffering on and my VPS doesn't,
meaning I need to go to my VPS php.ini?
I have a few questions regarding headers and output buffering.
I know headers must be send before output or they will not work, and that
output buffering stores all HTML into a buffer and sends it as one as
opposed to PHP processes sent bits at a time.
So does this mean when output buffering is on, all content is collected
into one variable and where ever the headers were defined in the script
they will be placed at the top/first?
And if output buffering is off you have to declare headers before any output?
And also to use any output buffering functions such as ob_clean() you need
output buffering to be on? as if output buffering was off, you couldn't
clean, 'take back', anything as it would of already been sent?
Finally is output buffering turned on/off within php.ini? as my XAMPP
local host server seems to have output buffering on and my VPS doesn't,
meaning I need to go to my VPS php.ini?
Ajax requests for php queries
Ajax requests for php queries
I am using cache plugin for wordpress website, Well I have few questions,
actually I don't want plugin to cache the following php codes (the code is
for ratings, download counts and page views.
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
<?php setPostViews($post->ID); ?>
<?php echo getDownloadCounter(get_the_ID()); ?>
The owner of plugin suggested to use Ajax requests.
Can anybody please how to adjust the above code in ajax? I am new to such
things.
Thanks.
I am using cache plugin for wordpress website, Well I have few questions,
actually I don't want plugin to cache the following php codes (the code is
for ratings, download counts and page views.
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
<?php setPostViews($post->ID); ?>
<?php echo getDownloadCounter(get_the_ID()); ?>
The owner of plugin suggested to use Ajax requests.
Can anybody please how to adjust the above code in ajax? I am new to such
things.
Thanks.
What does "matched by" mean here?
What does "matched by" mean here?
I have a question about the following article.
http://www.newyorker.com/online/blogs/comment/2013/08/obama-surveillance-and-the-legacy-of-the-march-on-washington.html
I don't understand "matched only by" as used in this sentence. It means to
be on the same level...but it doesn't make sense here.
Thank you in advance.
"We've compressed the grand scale of the March on Washington—which took
place on August 28, 1963, fifty years ago this coming Wednesday—into
succinct quotes, a vine of grainy footage of Martin Luther King, Jr., at
the crowded dais, and a dream metaphor whose ubiquity is matched only by
its anodyne appeal."
I have a question about the following article.
http://www.newyorker.com/online/blogs/comment/2013/08/obama-surveillance-and-the-legacy-of-the-march-on-washington.html
I don't understand "matched only by" as used in this sentence. It means to
be on the same level...but it doesn't make sense here.
Thank you in advance.
"We've compressed the grand scale of the March on Washington—which took
place on August 28, 1963, fifty years ago this coming Wednesday—into
succinct quotes, a vine of grainy footage of Martin Luther King, Jr., at
the crowded dais, and a dream metaphor whose ubiquity is matched only by
its anodyne appeal."
Sunday, 25 August 2013
Openflow: Redirect TCP Flow only for Controller
Openflow: Redirect TCP Flow only for Controller
i'm new in openflow, i create with mininet a open flow toplogy with 1
controller (POX), one switch, and 3 hosts.
My question is, how can i create one rule in switch to redirect to
controller only tcp flow?
*sorry for my poor english
i'm new in openflow, i create with mininet a open flow toplogy with 1
controller (POX), one switch, and 3 hosts.
My question is, how can i create one rule in switch to redirect to
controller only tcp flow?
*sorry for my poor english
[ Women's Health ] Open Question : Do women really care about Penis Size?
[ Women's Health ] Open Question : Do women really care about Penis Size?
I see all these ads and stuff saying to get a bigger penis. So it seems
like guys care but what about women? I would really like to know. Thanks!
I see all these ads and stuff saying to get a bigger penis. So it seems
like guys care but what about women? I would really like to know. Thanks!
Finding local and global extrema even when the determinant of the Hessian zero
Finding local and global extrema even when the determinant of the Hessian
zero
I am trying to solve the following problem:
Let $f: \mathbb R^2\rightarrow\mathbb R$ be a function defined by $$
f(x,y) = x^{2n} + y^{2n} - nx^2 + 2nxy - ny^2, $$ where $n$ is a natural
number greater than 1. Decide whether $f$ has a (global) minimum. Also
find all the points at which $f$ attains its local maxima and local
minima.
I calculated the partial derivatives $f_x = 2nx^{2n-1}-2nx+2ny$, $f_{xx} =
2n(2n-1)x^{2n-2}-2n$, $f_{xy} = 2n$, and so on. But I got an equation
system $f_x = f_y = 0$ of degree three, which I had hard times solving it.
I found out that $(x,y) = (0,0)$ is one of its solutions, but at that
point the the determinant of the Hessian is zero, from which I could not
conclude whether it was a local extremum.
I was not sure about how to prove that the minimum value of $f$ exists,
either.
I would be most grateful if you could help me solve this problem.,
zero
I am trying to solve the following problem:
Let $f: \mathbb R^2\rightarrow\mathbb R$ be a function defined by $$
f(x,y) = x^{2n} + y^{2n} - nx^2 + 2nxy - ny^2, $$ where $n$ is a natural
number greater than 1. Decide whether $f$ has a (global) minimum. Also
find all the points at which $f$ attains its local maxima and local
minima.
I calculated the partial derivatives $f_x = 2nx^{2n-1}-2nx+2ny$, $f_{xx} =
2n(2n-1)x^{2n-2}-2n$, $f_{xy} = 2n$, and so on. But I got an equation
system $f_x = f_y = 0$ of degree three, which I had hard times solving it.
I found out that $(x,y) = (0,0)$ is one of its solutions, but at that
point the the determinant of the Hessian is zero, from which I could not
conclude whether it was a local extremum.
I was not sure about how to prove that the minimum value of $f$ exists,
either.
I would be most grateful if you could help me solve this problem.,
Saturday, 24 August 2013
Proper $_SESSION authentication
Proper $_SESSION authentication
What is the proper way to authenticate users? As in, setting a page
whereby only logged in users can view?
Does this work?
<?php
session_start();
if(!isset($_SESSION[username]) || empty($_SESSION[username]) ||
!isset($_SESSION[id]) || empty($_SESSION[id]))
{
session_destroy();
session_unset();
die('You\'re not authorized to view this page!');
}
?>
<?php
echo"Can I freely, and safely write my content here? Will it be properly
authenticated with my code above?";
?>
But my question is, if I use the above code, can I freely add my content
below the code? And is there any other better way to do this?
I have another code whereby I do a
session_destroy();
header("Location: logout.php");
{and then I echo my content below; where logged in users can see}
But I'm just wondering if, once I do that, does it mean users will not be
able to see my content below?
Thanks!
What is the proper way to authenticate users? As in, setting a page
whereby only logged in users can view?
Does this work?
<?php
session_start();
if(!isset($_SESSION[username]) || empty($_SESSION[username]) ||
!isset($_SESSION[id]) || empty($_SESSION[id]))
{
session_destroy();
session_unset();
die('You\'re not authorized to view this page!');
}
?>
<?php
echo"Can I freely, and safely write my content here? Will it be properly
authenticated with my code above?";
?>
But my question is, if I use the above code, can I freely add my content
below the code? And is there any other better way to do this?
I have another code whereby I do a
session_destroy();
header("Location: logout.php");
{and then I echo my content below; where logged in users can see}
But I'm just wondering if, once I do that, does it mean users will not be
able to see my content below?
Thanks!
What are the fields for Low-rank approximation and Principal component analysis
What are the fields for Low-rank approximation and Principal component
analysis
I would like to start with practical applications of:
Principal component analysis
Low-rank approximation matrices
the problem that I found is that with some internet researches I can't
really place this 2 topics in a specific branch of the math, and this
means that I can't even find good resources about this 2 arguments.
I work primarily with 3d geometry, so nothing related to applied
statistics or other fields.
analysis
I would like to start with practical applications of:
Principal component analysis
Low-rank approximation matrices
the problem that I found is that with some internet researches I can't
really place this 2 topics in a specific branch of the math, and this
means that I can't even find good resources about this 2 arguments.
I work primarily with 3d geometry, so nothing related to applied
statistics or other fields.
Edited Typescript Code in Type Towel not reflected in corresponding js file
Edited Typescript Code in Type Towel not reflected in corresponding js file
I had Edited the Typescript code of home.ts in Type towel project
downloaded from following URL:
https://github.com/Svakinn/TypeTowel/trunk/TypeTowel
I had just added a new variable in view model and tried to display it on
my home page it does not reflect on home page. and also no reflected in
the corresponding js file.
I am sharing my view model
old viewmodel:
export class ViewModel {
title: string = 'Home View';
public activate() {
_logger.logger.log('We are home now', null, 'home', true);
return true;
}
}
export var vm = new ViewModel();
//The Durandal plugin-interface variables
export var activate = function () { return vm.activate(); };
new View model:
export class ViewModel {
title: string = 'Home View';
titleS: string = "my view";
public activate() {
_logger.logger.log('We are home now', null, 'home', true);
return true;
}
}
export var vm = new ViewModel();
//The Durandal plugin-interface variables
export var activate = function () { return vm.activate(); };
My Html line that I added to home.html is:
<span data-bind="text: vm.titleS"></span>
As I am new to type script please let me what is wrong that I am doing?
I had Edited the Typescript code of home.ts in Type towel project
downloaded from following URL:
https://github.com/Svakinn/TypeTowel/trunk/TypeTowel
I had just added a new variable in view model and tried to display it on
my home page it does not reflect on home page. and also no reflected in
the corresponding js file.
I am sharing my view model
old viewmodel:
export class ViewModel {
title: string = 'Home View';
public activate() {
_logger.logger.log('We are home now', null, 'home', true);
return true;
}
}
export var vm = new ViewModel();
//The Durandal plugin-interface variables
export var activate = function () { return vm.activate(); };
new View model:
export class ViewModel {
title: string = 'Home View';
titleS: string = "my view";
public activate() {
_logger.logger.log('We are home now', null, 'home', true);
return true;
}
}
export var vm = new ViewModel();
//The Durandal plugin-interface variables
export var activate = function () { return vm.activate(); };
My Html line that I added to home.html is:
<span data-bind="text: vm.titleS"></span>
As I am new to type script please let me what is wrong that I am doing?
AngularJs and Laravel application structure
AngularJs and Laravel application structure
I recently started to build a large social network, and i tought my
structure is good but it turned out i built this logic up badly.
I mixed my views with AngularJs (bad idea), skiped blade extension, but
since im using lot of block, and sidebar includes it came a pain in the
butt.
Currently i am just handeling form validations with angular, but actually
all of my site pages will require ajax, data pulling, ect.
I was searching around the net i saw that angular views are stored in the
public folder, but since all my pages will use angular is it a good idea,
to store all my views in the public, and actually just use Laravel as a
back end?
I know silly question but im confused a bit.
any help hint appreciated
Thank you
I recently started to build a large social network, and i tought my
structure is good but it turned out i built this logic up badly.
I mixed my views with AngularJs (bad idea), skiped blade extension, but
since im using lot of block, and sidebar includes it came a pain in the
butt.
Currently i am just handeling form validations with angular, but actually
all of my site pages will require ajax, data pulling, ect.
I was searching around the net i saw that angular views are stored in the
public folder, but since all my pages will use angular is it a good idea,
to store all my views in the public, and actually just use Laravel as a
back end?
I know silly question but im confused a bit.
any help hint appreciated
Thank you
text with sharp shadow around
text with sharp shadow around
I want to achieve the text appearance like in the pictures below:
Now I'm working on shadow around the letters and I can't figure out how to
do that.
What I've tried so far:
- The solution with:
label.shadowColor = [UIColor blackColor];
label.shadowOffset = CGSizeMake(1, 2);
gives a nice sharp shadow, but it doesn't fit to my needs by two reasons:
It gives a shadow only from one side, set up by shadowOffset, whereas I
need a "wrapping" shadow;
This solution doesn't give the soft part of the shadow (gradient) as there
is in the pictures;
-The solution with:
label.layer.shadowOffset = CGSizeMake(0, 0);
label.layer.shadowRadius = 5.0;
label.layer.shouldRasterize = YES;
label.layer.shadowOpacity = 1;
label.layer.shadowColor = [UIColor blackColor].CGColor;
label.layer.masksToBounds = NO;
Works great, but it gives too soft shadow even though the shadowOpacity is
set to 1 and the shadowColor is set to black:
Obviously it's not enough and I already think about drawing in labels'
context. But it is not clear to me how would I achieve the goal even
through context drawing.
Any idea would be much appreciated.
I want to achieve the text appearance like in the pictures below:
Now I'm working on shadow around the letters and I can't figure out how to
do that.
What I've tried so far:
- The solution with:
label.shadowColor = [UIColor blackColor];
label.shadowOffset = CGSizeMake(1, 2);
gives a nice sharp shadow, but it doesn't fit to my needs by two reasons:
It gives a shadow only from one side, set up by shadowOffset, whereas I
need a "wrapping" shadow;
This solution doesn't give the soft part of the shadow (gradient) as there
is in the pictures;
-The solution with:
label.layer.shadowOffset = CGSizeMake(0, 0);
label.layer.shadowRadius = 5.0;
label.layer.shouldRasterize = YES;
label.layer.shadowOpacity = 1;
label.layer.shadowColor = [UIColor blackColor].CGColor;
label.layer.masksToBounds = NO;
Works great, but it gives too soft shadow even though the shadowOpacity is
set to 1 and the shadowColor is set to black:
Obviously it's not enough and I already think about drawing in labels'
context. But it is not clear to me how would I achieve the goal even
through context drawing.
Any idea would be much appreciated.
Updating 300 million records in a collection
Updating 300 million records in a collection
I have collection called TimeSheet having few thousands records now. This
will eventually increase to 300 million records in a year. In this
collection I embed few fields from another collection called Department
which is mostly won't get any updates and only rarely some records will be
updated. By rarely I mean only once or twice in a year and also not all
records, only less than 1% of the records in the collection.
Mostly once a department is created there won't any update, even if there
is an update, it will be done initially (when there are not many related
records in TimeSheet)
Now if someone updates a department after a year, in a worst case scenario
there are chances collection TimeSheet will have about 300 million records
totally and about 5 million matching records for the department which gets
updated. The update query condition will be on a index field.
Since this update is time consuming and creates locks, I'm wondering is
there any better way to do it? One option that I'm thinking is run update
query in batches by adding extra condition like UpdatedDateTime> somedate
&& UpdatedDateTime < somedate.
Other details:
A single document size could be about 3 or 4 KB We have a replica set
containing three replicas.
Is there any other better way to do this? What do you think about this
kind of design? What do you think if there numbers I given are less like
below?
1) 100 million total records and 100,000 matching records for the update
query
2) 10 million total records and 10,000 matching records for the update query
3) 1 million total records and 1000 matching records for the update query
Note: The collection names department and timesheet, and their purpose are
fictional, not the real collections but the statistics that I have given
are true.
I have collection called TimeSheet having few thousands records now. This
will eventually increase to 300 million records in a year. In this
collection I embed few fields from another collection called Department
which is mostly won't get any updates and only rarely some records will be
updated. By rarely I mean only once or twice in a year and also not all
records, only less than 1% of the records in the collection.
Mostly once a department is created there won't any update, even if there
is an update, it will be done initially (when there are not many related
records in TimeSheet)
Now if someone updates a department after a year, in a worst case scenario
there are chances collection TimeSheet will have about 300 million records
totally and about 5 million matching records for the department which gets
updated. The update query condition will be on a index field.
Since this update is time consuming and creates locks, I'm wondering is
there any better way to do it? One option that I'm thinking is run update
query in batches by adding extra condition like UpdatedDateTime> somedate
&& UpdatedDateTime < somedate.
Other details:
A single document size could be about 3 or 4 KB We have a replica set
containing three replicas.
Is there any other better way to do this? What do you think about this
kind of design? What do you think if there numbers I given are less like
below?
1) 100 million total records and 100,000 matching records for the update
query
2) 10 million total records and 10,000 matching records for the update query
3) 1 million total records and 1000 matching records for the update query
Note: The collection names department and timesheet, and their purpose are
fictional, not the real collections but the statistics that I have given
are true.
Friday, 23 August 2013
How to access file from blackberry 10 device document directory through the native SDK?
How to access file from blackberry 10 device document directory through
the native SDK?
I have sample.xml file in my BB10 device document directory, I want to use
that file in my app using c++ and QML.
Does anyone knows how well it is happening.
Thanks in advance.
the native SDK?
I have sample.xml file in my BB10 device document directory, I want to use
that file in my app using c++ and QML.
Does anyone knows how well it is happening.
Thanks in advance.
Doesn't Safari cache pages?
Doesn't Safari cache pages?
Whenever I go back or forward in the safari navigation history, it reload
the pages even when I just visited the page two seconds ago.
I mean using the back/forward navigation button, or swiping back and forth.
It always reloads the page from the internet.
Doesnt Safari cache the pages I just visited ?
Whenever I go back or forward in the safari navigation history, it reload
the pages even when I just visited the page two seconds ago.
I mean using the back/forward navigation button, or swiping back and forth.
It always reloads the page from the internet.
Doesnt Safari cache the pages I just visited ?
Combine Data from Two Tables-Help Needed
Combine Data from Two Tables-Help Needed
I have developed a web site with a mysql backend, but am not satisfied
with how I am getting one set of data and do not know how to get another
dataset.
The page in question is at:
http://whistclub.org/test/ajax.php?vichill/results/1
The results are shown through October so there is some data to use.
I am pulling the results from two mysql tables (see below), but the code I
have used is too ugly for me to tolerate. Yeah, it works, but I have some
standards! Think calls to the database for each team. I think joins should
be used, but I can't get it to work.
Ideally (I think) the result array would convert the teamIDs to team names
and use names for the winner and loser VP columns.
The standings table on the page is not working at all--what you see is
hand coded just to show what is needed.
The tables are:
teams:
id--autoincremented teamID--Asssigned to each team as part of the game
teamName
games:
id--autoincremented gameID--I suspect this is not needed since it
duplicates id. teamA teamB date winner IMPmargin winnersVPs losersVPS
The game is bridge and IMP and VP are scores. VPs are derived from IMPs
and the loser often gets a few VPs. See the webpage for the details, but I
do not think that is relevant to my issue.
Here is some data from the games table:
id gameID teamA teamB date winner IMPmargin winnersVPs losersVPs 1 1 11 18
2013-09-25 18 12 20 10 2 2 12 17 2013-09-25 12 22 22 8 3 3 13 16
2013-09-25 13 20 21 9 4 4 14 15 2013-09-25 14 0 15 15 5 5 19 99 2013-09-25
NULL NULL NULL NULL
Lousy formatting!
Team 99 is a dummy for a bye week for a team.
If the tables are designed too badly, let me know how to make them work
better.
Hopefully, that is enough for someone to point me in the right direction.
If more is needed, let me know.
Thanks
Bill
I have developed a web site with a mysql backend, but am not satisfied
with how I am getting one set of data and do not know how to get another
dataset.
The page in question is at:
http://whistclub.org/test/ajax.php?vichill/results/1
The results are shown through October so there is some data to use.
I am pulling the results from two mysql tables (see below), but the code I
have used is too ugly for me to tolerate. Yeah, it works, but I have some
standards! Think calls to the database for each team. I think joins should
be used, but I can't get it to work.
Ideally (I think) the result array would convert the teamIDs to team names
and use names for the winner and loser VP columns.
The standings table on the page is not working at all--what you see is
hand coded just to show what is needed.
The tables are:
teams:
id--autoincremented teamID--Asssigned to each team as part of the game
teamName
games:
id--autoincremented gameID--I suspect this is not needed since it
duplicates id. teamA teamB date winner IMPmargin winnersVPs losersVPS
The game is bridge and IMP and VP are scores. VPs are derived from IMPs
and the loser often gets a few VPs. See the webpage for the details, but I
do not think that is relevant to my issue.
Here is some data from the games table:
id gameID teamA teamB date winner IMPmargin winnersVPs losersVPs 1 1 11 18
2013-09-25 18 12 20 10 2 2 12 17 2013-09-25 12 22 22 8 3 3 13 16
2013-09-25 13 20 21 9 4 4 14 15 2013-09-25 14 0 15 15 5 5 19 99 2013-09-25
NULL NULL NULL NULL
Lousy formatting!
Team 99 is a dummy for a bye week for a team.
If the tables are designed too badly, let me know how to make them work
better.
Hopefully, that is enough for someone to point me in the right direction.
If more is needed, let me know.
Thanks
Bill
Pig Multi-Query Optimization issue
Pig Multi-Query Optimization issue
We are running into issues on Pig's Multiquery Optimizer does not work as
expected.
As I understood, the below script should be run as one MR job, but it runs
as two jobs on our cluster. I think the Multiquery Optimization should be
on by default, am I missing anything here? If I replace the group by by
"filter" statement then it works as one single MR job.
data = LOAD 'input' AS (a:chararray, b:int, c:int);
A = GROUP data BY b;
B = GROUP data BY c;
STORE A INTO 'output1';
STORE B INTO 'output2';
I'm using CDH packed pig 0.1.0 and Hadoop 2.0.0.
We are running into issues on Pig's Multiquery Optimizer does not work as
expected.
As I understood, the below script should be run as one MR job, but it runs
as two jobs on our cluster. I think the Multiquery Optimization should be
on by default, am I missing anything here? If I replace the group by by
"filter" statement then it works as one single MR job.
data = LOAD 'input' AS (a:chararray, b:int, c:int);
A = GROUP data BY b;
B = GROUP data BY c;
STORE A INTO 'output1';
STORE B INTO 'output2';
I'm using CDH packed pig 0.1.0 and Hadoop 2.0.0.
Installing uTorrent on ubuntu 12.4
Installing uTorrent on ubuntu 12.4
I have just install Ubuntu 12.4 and I want to install uTorrent. It's was
easy on Windows. As you can see on the official web-site, there is no GUI
version for Linux.
So how can I install uTorrent on ubuntu 12.4
NOTE: if I have to use command line(Terminal) for it, please tell me how
to open it.
Thanks.
I have just install Ubuntu 12.4 and I want to install uTorrent. It's was
easy on Windows. As you can see on the official web-site, there is no GUI
version for Linux.
So how can I install uTorrent on ubuntu 12.4
NOTE: if I have to use command line(Terminal) for it, please tell me how
to open it.
Thanks.
Update LongListSelector item DataTemplate dynamically
Update LongListSelector item DataTemplate dynamically
I have a longlistselector control which shows a list of items. My items
are custom, just like in this code:
<toolkit:LongListSelector x:Name="RecentiList" IsFlatList="True">
<toolkit:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Hold="Hold_Item">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch">
<StackPanel Width="10" Margin="0,10,10,0"
Background="{StaticResource
PhoneAccentBrush}">
</StackPanel>
<StackPanel Width="340"
Orientation="Vertical"
Margin="15,0,0,0">
<StackPanel Height="10" />
<TextBlock Text="{Binding
Preview}" Margin="0,0,0,0"
TextWrapping="Wrap" Width="340"
Height="Auto" FontSize="20"
FontWeight="Bold"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="da "
Margin="0,0,0,0" FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
<TextBlock Text="{Binding
Username}" Margin="0,0,0,0"
FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
<TextBlock Text=" - "
Margin="0,0,0,0" FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
<TextBlock Text="{Binding
DataCalc}" Margin="0,0,0,0"
FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
</StackPanel>
<StackPanel Height="10" />
</StackPanel>
<StackPanel
HorizontalAlignment="Stretch"
Margin="15,0,0,0"
Orientation="Horizontal" Width="80">
<Image Width="40" Height="40"
Source="/Assets/AppBar/appbar.reply.people.png"></Image>
<TextBlock Text="{Binding
Risposte}" FontSize="27"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Portable User
Interface"/>
</StackPanel>
</StackPanel>
<Border x:Name="SecBord"
BorderBrush="{StaticResource
PhoneAccentBrush}" BorderThickness="2"
Height="1" Margin="0,0,0,0"
VerticalAlignment="Top" />
</StackPanel>
</DataTemplate>
</toolkit:LongListSelector.ItemTemplate>
</toolkit:LongListSelector>
The item layout is not so important, but have a look to the root
StackPanel element inside DataTemplate tag: I added a listener to the Hold
gesture. I'd like to have a StackPanel overlayed on the item I've just
pressed on, and have the possibilty to return to the hold item layout as
well. I really can't figure out how to switch between two layouts.
This is my first - and wrong - attempt of updating the item layout:
Private Sub Hold_Item(sender As Object, e As
System.Windows.Input.GestureEventArgs)
'root StackPanel element
Dim SP As StackPanel = DirectCast(sender, StackPanel)
SP = New StackPanel() With {.Height = 30, .Width = 100,
.Background = New SolidColorBrush(Colors.Green)}
End Sub
I have a longlistselector control which shows a list of items. My items
are custom, just like in this code:
<toolkit:LongListSelector x:Name="RecentiList" IsFlatList="True">
<toolkit:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Hold="Hold_Item">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch">
<StackPanel Width="10" Margin="0,10,10,0"
Background="{StaticResource
PhoneAccentBrush}">
</StackPanel>
<StackPanel Width="340"
Orientation="Vertical"
Margin="15,0,0,0">
<StackPanel Height="10" />
<TextBlock Text="{Binding
Preview}" Margin="0,0,0,0"
TextWrapping="Wrap" Width="340"
Height="Auto" FontSize="20"
FontWeight="Bold"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="da "
Margin="0,0,0,0" FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
<TextBlock Text="{Binding
Username}" Margin="0,0,0,0"
FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
<TextBlock Text=" - "
Margin="0,0,0,0" FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
<TextBlock Text="{Binding
DataCalc}" Margin="0,0,0,0"
FontSize="20"
Foreground="{StaticResource
PhoneAccentBrush}"/>
</StackPanel>
<StackPanel Height="10" />
</StackPanel>
<StackPanel
HorizontalAlignment="Stretch"
Margin="15,0,0,0"
Orientation="Horizontal" Width="80">
<Image Width="40" Height="40"
Source="/Assets/AppBar/appbar.reply.people.png"></Image>
<TextBlock Text="{Binding
Risposte}" FontSize="27"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Portable User
Interface"/>
</StackPanel>
</StackPanel>
<Border x:Name="SecBord"
BorderBrush="{StaticResource
PhoneAccentBrush}" BorderThickness="2"
Height="1" Margin="0,0,0,0"
VerticalAlignment="Top" />
</StackPanel>
</DataTemplate>
</toolkit:LongListSelector.ItemTemplate>
</toolkit:LongListSelector>
The item layout is not so important, but have a look to the root
StackPanel element inside DataTemplate tag: I added a listener to the Hold
gesture. I'd like to have a StackPanel overlayed on the item I've just
pressed on, and have the possibilty to return to the hold item layout as
well. I really can't figure out how to switch between two layouts.
This is my first - and wrong - attempt of updating the item layout:
Private Sub Hold_Item(sender As Object, e As
System.Windows.Input.GestureEventArgs)
'root StackPanel element
Dim SP As StackPanel = DirectCast(sender, StackPanel)
SP = New StackPanel() With {.Height = 30, .Width = 100,
.Background = New SolidColorBrush(Colors.Green)}
End Sub
Objective-c SDK for ios application to analyse the number of active users load the application.
Objective-c SDK for ios application to analyse the number of active users
load the application.
Is there are any recommended SDK to analyse the number of active user of
my ios application. I need to analyse the number of users load the
application per day and also it would be great if we able to analyse the
maximum use of functionality in the application(For example like if the
application as 10 functionality and the active users most often use the 5
out of 10 functionality).
load the application.
Is there are any recommended SDK to analyse the number of active user of
my ios application. I need to analyse the number of users load the
application per day and also it would be great if we able to analyse the
maximum use of functionality in the application(For example like if the
application as 10 functionality and the active users most often use the 5
out of 10 functionality).
Thursday, 22 August 2013
Biblatex + Xetex + memoir in Urdu: how to modify headings
Biblatex + Xetex + memoir in Urdu: how to modify headings
Although a Newbie, I have been using XeteX, bidi and BiblateX with great
success in Urdu. I have alphabetical footnotes with most of the secondary
sources in the endnotes. The endnotes and bibliography are in English,
whereas the rest is in Urdu. Modifying headers and footers works great as
well.
However, I would like to get rid of the Chapter Heading including the
number above the Urdu title äæŠÓ. And I would like to center the
subheadings. Modifying with enoteheadings doesn't seem to do the trick
(problem with memoir + XeteX?
Any ideas?
My minimal example:
% !TEX TS-program = xelatex
\TeXXeTstate=1
\documentclass[12pt,a4paper]{memoir}
\usepackage[a5paper, left=.915in,right=.915in,top=1.651cm,bottom=1.524cm]
{geometry}
\usepackage{fontspec}% font selecting commands
\usepackage{xunicode}% unicode character macros
\usepackage{wrapfig}
\usepackage[footnotesize,justification=centering]{caption}
\usepackage{float}
\usepackage{framed}
\usepackage{libertine}
\usepackage{bidi}
\usepackage{perpage}
\defaultfontfeatures{Scale=MatchLowercase, Mapping=tex-text}
\setmainfont[Script=Arabic,Scale=1.3, WordSpace=1]{Jameel Noori Nastaleeq}
\newfontfamily\latin[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\greek[Script=Greek]{Linux Libertine O}
\fontspec[Script=Arabic,Scale=1.0,WordSpace=1]{Nafees}
\rightfootnoterule
\usepackage[perpage,bottom]{footmisc}
\usepackage{csquotes}
\pretitle{\begin{center}\LARGE}
\posttitle{\par\end{center}\vskip 6em}
%%% ToC (table of contents)APPEARANCE
\maxtocdepth{subsection} % include subsections
\renewcommand{\cftchapterpagefont}{}
\renewcommand{\cftchapterfont}{} % no bold!
\renewcommand*{\contentsname}{ÝÀÑÓÊ ö ãÖÇãیä}
\chapterstyle{ger}
\renewcommand*{\chaptername}{ÈÇÈ}
\renewcommand{\thepart}{}
\renewcommand{\printpartname}{}
\let\origfootnote\footnote
\renewcommand{\footnote}[1]{\kern-.2em\origfootnote{#1}}
\renewcommand*{\thefootnote}{\alph{footnote}}
\makepagenote
\renewcommand*{\pagenotesubhead}[3]{\section*{#2 #1}}
\renewcommand*{\notesname}{äæŠÓ}
\renewcommand*{\notenuminnotes}[1]{\latin #1.\space}
\renewcommand*{\prenoteinnotes}{\par\noindent\hangindent 2em}
\usepackage[backend=biber,autocite=footnote,sortcites=true,
style=authortitle-icomp,block=space,notetype=endonly,firstinits=true,language=british]{biblatex}
\addbibresource{bibliography.bib}
\title
{˜ÊÇÈ\\
{æÛیÑÀ}}
\author{ÎÇä}
\begin{document}
\setRL
\maketitle
\newpage
\tableofcontents*
\newpage
\chapter
 ÇیãÇä ˜ی Ïæš ãیŸ Ǫی ÊÑÞی ˜Ñ ÑÀÿ ʪÿ! Êæ
ªÑ ˜Ó äÿ  ˜æ ÓÇÆی ˜ی یÑæی ˜Ñäÿ Óÿ Ñæ˜
áیÇ¿
\footnote{áÊیæŸ 5:\! 7}
ÒÀÑ ˜ÿ یÇáÿ ˜æ ÀæäŠæŸ ʘ ÇõŠªÇ ˜Ñ ÇõÓ äÿ ÈáÇ̪̘ ÇæÑ ÒäÏÀ Ïáی
Óÿ ÒÀÑ ˜æ ی áیÇ۔ یÀÇŸ ʘ Àã Ìæ ÓÇʪ ʪÿ
ÒیÇÏÀ ÊÑ ÓäȪáÿ ÀæÆÿ ʪÿ۔ áی˜ä ÌÈ Ïی˜ªÇ
\autocite[56--78]{Najim}
˜À æÀ ÒÀÑ ˜æ ی ˜Ñ ÊÀÀ ʘ Àä یÇ Àÿ Êæ Àã Çäÿ ÂäÓæÄŸ ˜æ Ñæ˜
äÀ Ó˜ÿ۔ ãیŸ Ȫی Çäÿ Â Ñ ÞÇÈæ äÀ Ç Ó˜Ç Èá˜À ÒÇÑ æ
ÞØÇÑ Ñæäÿ áÇ۔
\autocite[33--34]{Murray1974}
%%print endnote
\newpage
\setLR{\printpagenotes*}
%%print endnote
\newpage
\printbibliography%[heading=bibliography]%
\end{document}
The bibliography.bib file linked to this:
@ARTICLE{Murray1974,
author = {Robert Murray},
title = {The Exhortation to Candidates for Ascetical Vows at Baptism in
the Ancient Syrian Church},
journal = {New Testament Studies},
year = {1974–75},
volume = {21},
pages = {58–79},
timestamp = {2013.03.13}
}
@BOOK{Najim,
title = {Antioch and Syrian Christianity},
author = {Najim, Michel},
editor = {Frazer, Terry},
subtitle = {A Chalcedonian Perspective on a Spiritual Heritage},
timestamp = {2011.08.29},
url = {www.stnicholasla.com/frmichel/antiochandsyriacchristianity.pdf},
urldate = {2011-08-31}
}
The font Jameel Noori Nastaleeq is found here http://urdu.ca/1 (Other
Operating Systems).
Please don't be bothered by the longer line in endnote 1. This is just due
to the minimized code.
Although a Newbie, I have been using XeteX, bidi and BiblateX with great
success in Urdu. I have alphabetical footnotes with most of the secondary
sources in the endnotes. The endnotes and bibliography are in English,
whereas the rest is in Urdu. Modifying headers and footers works great as
well.
However, I would like to get rid of the Chapter Heading including the
number above the Urdu title äæŠÓ. And I would like to center the
subheadings. Modifying with enoteheadings doesn't seem to do the trick
(problem with memoir + XeteX?
Any ideas?
My minimal example:
% !TEX TS-program = xelatex
\TeXXeTstate=1
\documentclass[12pt,a4paper]{memoir}
\usepackage[a5paper, left=.915in,right=.915in,top=1.651cm,bottom=1.524cm]
{geometry}
\usepackage{fontspec}% font selecting commands
\usepackage{xunicode}% unicode character macros
\usepackage{wrapfig}
\usepackage[footnotesize,justification=centering]{caption}
\usepackage{float}
\usepackage{framed}
\usepackage{libertine}
\usepackage{bidi}
\usepackage{perpage}
\defaultfontfeatures{Scale=MatchLowercase, Mapping=tex-text}
\setmainfont[Script=Arabic,Scale=1.3, WordSpace=1]{Jameel Noori Nastaleeq}
\newfontfamily\latin[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\greek[Script=Greek]{Linux Libertine O}
\fontspec[Script=Arabic,Scale=1.0,WordSpace=1]{Nafees}
\rightfootnoterule
\usepackage[perpage,bottom]{footmisc}
\usepackage{csquotes}
\pretitle{\begin{center}\LARGE}
\posttitle{\par\end{center}\vskip 6em}
%%% ToC (table of contents)APPEARANCE
\maxtocdepth{subsection} % include subsections
\renewcommand{\cftchapterpagefont}{}
\renewcommand{\cftchapterfont}{} % no bold!
\renewcommand*{\contentsname}{ÝÀÑÓÊ ö ãÖÇãیä}
\chapterstyle{ger}
\renewcommand*{\chaptername}{ÈÇÈ}
\renewcommand{\thepart}{}
\renewcommand{\printpartname}{}
\let\origfootnote\footnote
\renewcommand{\footnote}[1]{\kern-.2em\origfootnote{#1}}
\renewcommand*{\thefootnote}{\alph{footnote}}
\makepagenote
\renewcommand*{\pagenotesubhead}[3]{\section*{#2 #1}}
\renewcommand*{\notesname}{äæŠÓ}
\renewcommand*{\notenuminnotes}[1]{\latin #1.\space}
\renewcommand*{\prenoteinnotes}{\par\noindent\hangindent 2em}
\usepackage[backend=biber,autocite=footnote,sortcites=true,
style=authortitle-icomp,block=space,notetype=endonly,firstinits=true,language=british]{biblatex}
\addbibresource{bibliography.bib}
\title
{˜ÊÇÈ\\
{æÛیÑÀ}}
\author{ÎÇä}
\begin{document}
\setRL
\maketitle
\newpage
\tableofcontents*
\newpage
\chapter
 ÇیãÇä ˜ی Ïæš ãیŸ Ǫی ÊÑÞی ˜Ñ ÑÀÿ ʪÿ! Êæ
ªÑ ˜Ó äÿ  ˜æ ÓÇÆی ˜ی یÑæی ˜Ñäÿ Óÿ Ñæ˜
áیÇ¿
\footnote{áÊیæŸ 5:\! 7}
ÒÀÑ ˜ÿ یÇáÿ ˜æ ÀæäŠæŸ ʘ ÇõŠªÇ ˜Ñ ÇõÓ äÿ ÈáÇ̪̘ ÇæÑ ÒäÏÀ Ïáی
Óÿ ÒÀÑ ˜æ ی áیÇ۔ یÀÇŸ ʘ Àã Ìæ ÓÇʪ ʪÿ
ÒیÇÏÀ ÊÑ ÓäȪáÿ ÀæÆÿ ʪÿ۔ áی˜ä ÌÈ Ïی˜ªÇ
\autocite[56--78]{Najim}
˜À æÀ ÒÀÑ ˜æ ی ˜Ñ ÊÀÀ ʘ Àä یÇ Àÿ Êæ Àã Çäÿ ÂäÓæÄŸ ˜æ Ñæ˜
äÀ Ó˜ÿ۔ ãیŸ Ȫی Çäÿ Â Ñ ÞÇÈæ äÀ Ç Ó˜Ç Èá˜À ÒÇÑ æ
ÞØÇÑ Ñæäÿ áÇ۔
\autocite[33--34]{Murray1974}
%%print endnote
\newpage
\setLR{\printpagenotes*}
%%print endnote
\newpage
\printbibliography%[heading=bibliography]%
\end{document}
The bibliography.bib file linked to this:
@ARTICLE{Murray1974,
author = {Robert Murray},
title = {The Exhortation to Candidates for Ascetical Vows at Baptism in
the Ancient Syrian Church},
journal = {New Testament Studies},
year = {1974–75},
volume = {21},
pages = {58–79},
timestamp = {2013.03.13}
}
@BOOK{Najim,
title = {Antioch and Syrian Christianity},
author = {Najim, Michel},
editor = {Frazer, Terry},
subtitle = {A Chalcedonian Perspective on a Spiritual Heritage},
timestamp = {2011.08.29},
url = {www.stnicholasla.com/frmichel/antiochandsyriacchristianity.pdf},
urldate = {2011-08-31}
}
The font Jameel Noori Nastaleeq is found here http://urdu.ca/1 (Other
Operating Systems).
Please don't be bothered by the longer line in endnote 1. This is just due
to the minimized code.
There are $N$ chess players of different strengths. If two of them play, the stronger one always wins.
There are $N$ chess players of different strengths. If two of them play,
the stronger one always wins.
What is the minimum number of games they need to play for us to determine
the order of their strengths?
I was asked this question for $N=5$ and I got 5 rounds, but I'm not sure
how to generalize it to any $N$. Thanks for any help.
the stronger one always wins.
What is the minimum number of games they need to play for us to determine
the order of their strengths?
I was asked this question for $N=5$ and I got 5 rounds, but I'm not sure
how to generalize it to any $N$. Thanks for any help.
perl regular expression to give back parts of debian/ubuntu package names
perl regular expression to give back parts of debian/ubuntu package names
is there any perl regex trick that will correctly recognize and give back
1. package name 2. package upstream 3. package maintainer version
and will work with all ubuntu/debian packages?
for example: sipcalc-1.2.3-1 would be parsed like:
$1 = sipcalc
$2 = 1.2.3
$3 = 1
libapache2-mod_perl-2.3.4-ubuntu5 would be parsed like
$1 = libapache2-mod_perl
$2 = 2.3.4
$3 = ubuntu5
etc.
package names and version numbers are fictious, and are here just give an
idea of what i need. and, this could use split// as well.
thanks.
is there any perl regex trick that will correctly recognize and give back
1. package name 2. package upstream 3. package maintainer version
and will work with all ubuntu/debian packages?
for example: sipcalc-1.2.3-1 would be parsed like:
$1 = sipcalc
$2 = 1.2.3
$3 = 1
libapache2-mod_perl-2.3.4-ubuntu5 would be parsed like
$1 = libapache2-mod_perl
$2 = 2.3.4
$3 = ubuntu5
etc.
package names and version numbers are fictious, and are here just give an
idea of what i need. and, this could use split// as well.
thanks.
Specs2 - close JDBC connection after each test case
Specs2 - close JDBC connection after each test case
I implemented specs2 specification that looks something like this:
class MySpec extends Specification {
"My database query" should {
"return some results " in {
val conn = createJdbcConn()
try {
// matcher here...
} finally {
conn.close()
}
}
}
This ugly boilerplate is repeated in all my test cases. I have to open
(and then close) a new connection for each in.
What is the idiomatic way in Specs2 close resources such as in this case -
perhaps using the After (or BeforeAfter) trait to properly close the
connection?
I implemented specs2 specification that looks something like this:
class MySpec extends Specification {
"My database query" should {
"return some results " in {
val conn = createJdbcConn()
try {
// matcher here...
} finally {
conn.close()
}
}
}
This ugly boilerplate is repeated in all my test cases. I have to open
(and then close) a new connection for each in.
What is the idiomatic way in Specs2 close resources such as in this case -
perhaps using the After (or BeforeAfter) trait to properly close the
connection?
how to map an mvc action parameter with a value of null correctly
how to map an mvc action parameter with a value of null correctly
I'm posting a serialized string to an MVC action in C# where an empty
parameter (i.e. &test=&another=10) maps to a value of 0.0. I need it to
evaluate to null. Many thanks,
The jquery is below:
$.ajax({
type: method,
url: url,
data: data,
dataType: 'json',
success: settings.success,
error: settings.error,
async: !options.sync
});
MVC Controller
[AcceptVerbs(HttpVerbs.Post)]
[NoCache]
[JsonContractExceptionFilter]
public ActionResult Save(Query query, ViewModel data)
{
data.test == 0.0 // should be null
Query
public double? Test
{
get { return obj.RateValue; }
set { obj.RateValue = value; }
}
I'm posting a serialized string to an MVC action in C# where an empty
parameter (i.e. &test=&another=10) maps to a value of 0.0. I need it to
evaluate to null. Many thanks,
The jquery is below:
$.ajax({
type: method,
url: url,
data: data,
dataType: 'json',
success: settings.success,
error: settings.error,
async: !options.sync
});
MVC Controller
[AcceptVerbs(HttpVerbs.Post)]
[NoCache]
[JsonContractExceptionFilter]
public ActionResult Save(Query query, ViewModel data)
{
data.test == 0.0 // should be null
Query
public double? Test
{
get { return obj.RateValue; }
set { obj.RateValue = value; }
}
customizing simple membership to use existing tables
customizing simple membership to use existing tables
I have a User table in my repository pattern database and I am looking to
connect the Roles. What is the best way to customize simple membership?
I have a User table in my repository pattern database and I am looking to
connect the Roles. What is the best way to customize simple membership?
Wednesday, 21 August 2013
Does Ubuntu 12.04 has support for Sony vaio pro series
Does Ubuntu 12.04 has support for Sony vaio pro series
I have installed Ubuntu 12.10 on a Sony Vaio Pro 13. The keyboard layout
(US_en) is completely wrong. If I press "i" for example, "5" appears.
Wi-Fi on the other hand is also broken as it's not detecting on-board WLAN
network adapter.
I have installed Ubuntu 12.10 on a Sony Vaio Pro 13. The keyboard layout
(US_en) is completely wrong. If I press "i" for example, "5" appears.
Wi-Fi on the other hand is also broken as it's not detecting on-board WLAN
network adapter.
Using a Boolean OnChange to control & disable other Boolean
Using a Boolean OnChange to control & disable other Boolean
Today I was asked to implement a new field Boolean field for Ex-Admin but
if this field was true then two other fields
System Admin & Main Admin
Note: All three fields are Bit or Boolean
This had to be a unique selection so that there couldn't be a system admin
set to yes & it also be an Ex-Admin as well. and if the user selected
Ex-admin = Yes then the Main & System admin were defaulted to no and
marked as read only.
So I'm not sure if this is the best way but it worked for me. This was
implemented as a OnChange Only event.
If I added this Script to the OnLoad or OnSave it would clear any
Pre-Selections that had been marked & it also forced the System admin to
yes and greyed out the field when added to the OnLoad piece.
Lastly the alerts at the end was how I figured out what was being sent to
the specific field "true, false, null"
I currently use Microsoft Dynamics 4.0 (Using the Web-Version - I'm not on
the server) Internet Explorer 10
So my question to you all is:
Is there a better way?
Can I implement this for the OnSave or OnLoad with-out changing existing
values?
Can I implement this without making fields greyed out when the ReadOnly
doesn't apply?
Can this be done even when there is a "null" value selected for Ex-Admin?
My Code
//OnChange ExAdmin
//Added by Jeromie Kirchoff 8/21/2013 6:11 PM
var new_FieldDisabled = "";
var new_FieldReadOnly = "";
var new_FieldAdmin = "";
var new_Mainadmin = "";
switch (crmForm.all.new_exadmin.DataValue) {
case false:
new_MainAdmin = false;
new_FieldAdmin = false;
new_FieldDisabled = false;
new_FieldReadOnly = false;
break;
case true:
new_FieldAdmin = false;
new_MainAdmin = false;
new_FieldDisabled = true;
new_FieldReadOnly = true;
break;
}
crmForm.all.new_mainadmin.DataValue = new_MainAdmin;
crmForm.all.new_mainadmin.Disabled = new_FieldDisabled;
crmForm.all.new_mainadmin.ReadOnly = new_FieldReadOnly;
crmForm.all.new_systemadministrator.DataValue = new_FieldAdmin;
crmForm.all.new_systemadministrator.Disabled = new_FieldDisabled;
crmForm.all.new_systemadministrator.ReadOnly = new_FieldReadOnly;
crmForm.all.new_systemadministrator.ForceSubmit = true;
crmForm.all.new_mainadmin.ForceSubmit = true;
//alert( 'Broadbean DataValue: end statement' &
crmForm.all.new_mainadmin.DataValue);
//alert( ("Broadbean Disabled: end statement") &
crmForm.all.new_mainadmin.Disabled);
//alert( "Broadbean DataValue: end statement " &
crmForm.all.new_systemadministrator.DataValue);
//alert( "Broadbean Disabled: end statement " &
crmForm.all.new_systemadministrator.Disabled);
//alert( "Broadbean ReadOnly: end statement " &
crmForm.all.new_systemadministrator.ReadOnly);
Today I was asked to implement a new field Boolean field for Ex-Admin but
if this field was true then two other fields
System Admin & Main Admin
Note: All three fields are Bit or Boolean
This had to be a unique selection so that there couldn't be a system admin
set to yes & it also be an Ex-Admin as well. and if the user selected
Ex-admin = Yes then the Main & System admin were defaulted to no and
marked as read only.
So I'm not sure if this is the best way but it worked for me. This was
implemented as a OnChange Only event.
If I added this Script to the OnLoad or OnSave it would clear any
Pre-Selections that had been marked & it also forced the System admin to
yes and greyed out the field when added to the OnLoad piece.
Lastly the alerts at the end was how I figured out what was being sent to
the specific field "true, false, null"
I currently use Microsoft Dynamics 4.0 (Using the Web-Version - I'm not on
the server) Internet Explorer 10
So my question to you all is:
Is there a better way?
Can I implement this for the OnSave or OnLoad with-out changing existing
values?
Can I implement this without making fields greyed out when the ReadOnly
doesn't apply?
Can this be done even when there is a "null" value selected for Ex-Admin?
My Code
//OnChange ExAdmin
//Added by Jeromie Kirchoff 8/21/2013 6:11 PM
var new_FieldDisabled = "";
var new_FieldReadOnly = "";
var new_FieldAdmin = "";
var new_Mainadmin = "";
switch (crmForm.all.new_exadmin.DataValue) {
case false:
new_MainAdmin = false;
new_FieldAdmin = false;
new_FieldDisabled = false;
new_FieldReadOnly = false;
break;
case true:
new_FieldAdmin = false;
new_MainAdmin = false;
new_FieldDisabled = true;
new_FieldReadOnly = true;
break;
}
crmForm.all.new_mainadmin.DataValue = new_MainAdmin;
crmForm.all.new_mainadmin.Disabled = new_FieldDisabled;
crmForm.all.new_mainadmin.ReadOnly = new_FieldReadOnly;
crmForm.all.new_systemadministrator.DataValue = new_FieldAdmin;
crmForm.all.new_systemadministrator.Disabled = new_FieldDisabled;
crmForm.all.new_systemadministrator.ReadOnly = new_FieldReadOnly;
crmForm.all.new_systemadministrator.ForceSubmit = true;
crmForm.all.new_mainadmin.ForceSubmit = true;
//alert( 'Broadbean DataValue: end statement' &
crmForm.all.new_mainadmin.DataValue);
//alert( ("Broadbean Disabled: end statement") &
crmForm.all.new_mainadmin.Disabled);
//alert( "Broadbean DataValue: end statement " &
crmForm.all.new_systemadministrator.DataValue);
//alert( "Broadbean Disabled: end statement " &
crmForm.all.new_systemadministrator.Disabled);
//alert( "Broadbean ReadOnly: end statement " &
crmForm.all.new_systemadministrator.ReadOnly);
Finding joomla module as wordpress plugin
Finding joomla module as wordpress plugin
This is a Joomla website and has a slider plugin which I cannot find
anywhere for WordPress. Is there anybody knows a wordpress plugin that
does this? Basically, I need to have this slider on a wordpress site.
http://goo.gl/EHmj5k
This is a Joomla website and has a slider plugin which I cannot find
anywhere for WordPress. Is there anybody knows a wordpress plugin that
does this? Basically, I need to have this slider on a wordpress site.
http://goo.gl/EHmj5k
Could the following code produce a crash on older devices?
Could the following code produce a crash on older devices?
pI have this bit of code relating to my in app purchases for an
codeSKProductRequest/code:/p precoderequest.delegate = self; [request
start]; [request release]; /code/pre pOne of my users is getting a crash
on an iPod4 and I think it might be from this, however, all other devices
are able to run this code OK. Should request be saved in a property while
its loading, could that be the issue? I would think with [request start],
that request would be retained somewhere else./p
pI have this bit of code relating to my in app purchases for an
codeSKProductRequest/code:/p precoderequest.delegate = self; [request
start]; [request release]; /code/pre pOne of my users is getting a crash
on an iPod4 and I think it might be from this, however, all other devices
are able to run this code OK. Should request be saved in a property while
its loading, could that be the issue? I would think with [request start],
that request would be retained somewhere else./p
How can I send push notification to selected Users iphone?
How can I send push notification to selected Users iphone?
I have selected 5 users from my mobile contacts and uploaded them to server.
Now which use among five installs this application, has to fill phone
number which also be saved on server.
If I press a button "Send Notification" , a push notification will be send
to those five which I saved.
Is it possible to send PUSH NOTIFICATION to particular persons to whom I
have added in my list and on server?
If yes, then how?
I have selected 5 users from my mobile contacts and uploaded them to server.
Now which use among five installs this application, has to fill phone
number which also be saved on server.
If I press a button "Send Notification" , a push notification will be send
to those five which I saved.
Is it possible to send PUSH NOTIFICATION to particular persons to whom I
have added in my list and on server?
If yes, then how?
mysql cross-updating a table
mysql cross-updating a table
I can't figure out how to solve this problem. I have a table (A) I need to
update, with a structure like this:
CODE VALUE
1 a
2 null
3 null
etc...
Then I have another table (B) with the same structure but with every value
set:
CODE VALUE
1 a
2 b
3 c
What I need to do is to copy data from table B to table A where A.CODE =
B.CODE but only if A.VALUE is not set. What's the best query to do so?
Can't do it by hand since I'm dealing with 2000ish rows.
I wrote something like this but it doesn't seem to work:
update A set VALUE =
(select b.VALUEfrom B b, A a where b.CODE = a.CODE)
Thanks in advance!
I can't figure out how to solve this problem. I have a table (A) I need to
update, with a structure like this:
CODE VALUE
1 a
2 null
3 null
etc...
Then I have another table (B) with the same structure but with every value
set:
CODE VALUE
1 a
2 b
3 c
What I need to do is to copy data from table B to table A where A.CODE =
B.CODE but only if A.VALUE is not set. What's the best query to do so?
Can't do it by hand since I'm dealing with 2000ish rows.
I wrote something like this but it doesn't seem to work:
update A set VALUE =
(select b.VALUEfrom B b, A a where b.CODE = a.CODE)
Thanks in advance!
Tuesday, 20 August 2013
Print to PDF on a virtual machine
Print to PDF on a virtual machine
I am using the "Bullzip PDF Printer" virtual printer to print my files to
PDF from a .net application. The object that I am converting is of type
System.Drawing.Printing.PrintDocument. So,all I am doing is :
theobject myObj = new myObj();
myObj.Print();
This works on my machine.But when I deploy the service on a server,it
fails to print.The service is hosted on IIS 7.5 and it is running at
ApplicationPoolIdentity. Is there something I'm missing here? Should I run
the service as some other identity?
I am using the "Bullzip PDF Printer" virtual printer to print my files to
PDF from a .net application. The object that I am converting is of type
System.Drawing.Printing.PrintDocument. So,all I am doing is :
theobject myObj = new myObj();
myObj.Print();
This works on my machine.But when I deploy the service on a server,it
fails to print.The service is hosted on IIS 7.5 and it is running at
ApplicationPoolIdentity. Is there something I'm missing here? Should I run
the service as some other identity?
Devise and HTTP Auth
Devise and HTTP Auth
I've been using Devise in a RoR application, but never fully understood
how the entire authentication system works.
After users sends account and password to the server, what happens?
My guess is that the server sends back some data to the client, and client
saves it in the cookie. For additional requests client makes, client also
sends the data, and the server can identify who is sending the requests
from the data.
Is this true? If so, what is the data server sends back to the client? How
is it protected?
If it is not true, could you help me understand it?
Thanks!
I've been using Devise in a RoR application, but never fully understood
how the entire authentication system works.
After users sends account and password to the server, what happens?
My guess is that the server sends back some data to the client, and client
saves it in the cookie. For additional requests client makes, client also
sends the data, and the server can identify who is sending the requests
from the data.
Is this true? If so, what is the data server sends back to the client? How
is it protected?
If it is not true, could you help me understand it?
Thanks!
problems with android maps apiv2 after signing apk
problems with android maps apiv2 after signing apk
I'm having a serious problem
When i build the apk via Eclipse everithing fine and the map is working
very well
But when i sign my apk with Eclipse and move the signed apk to my phone
the map activity not working, its not collapse it just show gray screen
I don't know what im doing wrong
I made all by using guides and i think everithing is fine
Does it happens to somebody that can help me solve this problem?
I pass the dead line that i should upload my app and i'm really nervous
Please help me.
Thanks for all answers
I'm having a serious problem
When i build the apk via Eclipse everithing fine and the map is working
very well
But when i sign my apk with Eclipse and move the signed apk to my phone
the map activity not working, its not collapse it just show gray screen
I don't know what im doing wrong
I made all by using guides and i think everithing is fine
Does it happens to somebody that can help me solve this problem?
I pass the dead line that i should upload my app and i'm really nervous
Please help me.
Thanks for all answers
Repacked proprietary software keeps updating the same deb
Repacked proprietary software keeps updating the same deb
I repacked a proprietary program delivered as tar file to a deb file for
having a company wide repository.
I used reprepro to set up a repository and signed it. A unix timestamp is
faking a versioning numbering, so I can have different (real) versions
installed at the same time. Almost everything works as expected. The deb
file looks like this: mysoft8.0v6_1366455181_amd64.deb
Only problem on a client machine it tries to install the same deb file
over and over again because it thinks its an update. What do I miss:
control file in deb package looks like this:
Package: mysoft8.0v6
Version: 1366455181
Section: base
Priority: optional
Architecture: amd64
Installed-Size: 1272572
Depends:
Maintainer: me
Description: mysoft 8.0v6 dpkg repackaging
/mirror/mycompany.inc/conf/distributions:
Origin: apt.mycompany.inc
Label: apt repository
Codename: precise
Architectures: amd64 i386
Components: main
Description: Mycompany debian/ubuntu package repo
SignWith: yes
Pull: precise
Help much appreciated
I repacked a proprietary program delivered as tar file to a deb file for
having a company wide repository.
I used reprepro to set up a repository and signed it. A unix timestamp is
faking a versioning numbering, so I can have different (real) versions
installed at the same time. Almost everything works as expected. The deb
file looks like this: mysoft8.0v6_1366455181_amd64.deb
Only problem on a client machine it tries to install the same deb file
over and over again because it thinks its an update. What do I miss:
control file in deb package looks like this:
Package: mysoft8.0v6
Version: 1366455181
Section: base
Priority: optional
Architecture: amd64
Installed-Size: 1272572
Depends:
Maintainer: me
Description: mysoft 8.0v6 dpkg repackaging
/mirror/mycompany.inc/conf/distributions:
Origin: apt.mycompany.inc
Label: apt repository
Codename: precise
Architectures: amd64 i386
Components: main
Description: Mycompany debian/ubuntu package repo
SignWith: yes
Pull: precise
Help much appreciated
counting records in one table that occur before and after a max date in another table
counting records in one table that occur before and after a max date in
another table
(MySql engine) I have a table that records contacts between staff and
members of a club called "Contacts". I need to know whether the latest
contact made a positive effect on a members attendance by comparing the
average number of times the member logged before and after that contact
during an overall time period. Logins are stored in the logins table. User
info is stored in the users table.
The following sql statement pulls individual lines out with a line for
each login (1 per day) per club member for club members who had at least
one contact during the period. What I'm stuck with is finding the total
number of logins for pre and post maxcontactdate per member.
So I want the resulting table to have columns with rows grouped on recid,
fk_staff_users_recid
"recid", "maxcontactdate", "fk_staff_users_recid",
"pre_maxcontactdate_login_count", "post_maxcontactdate_login_count"
Can somebody help please?
SELECT
recid,
maxcontactdate,
fk_staff_users_recid,
logtime
FROM
(
/* Selects user id, with the staff that made the contact, and the max
contact date for that member of staff */
SELECT fk_users_recid,
fk_staff_users_recid,
MAX(contactdate) AS maxcontactdate
FROM
contacts
WHERE
contactdate BETWEEN '2013-07-20' AND '2013-08-20'
GROUP BY fk_users_recid, fk_staff_users_recid
)contacts,
users
JOIN
(
/* Selects all login dates between the dates specified */
SELECT fk_users_recid,
DATE(logins.logintime) AS logtime
FROM
logins
WHERE
logintime BETWEEN '2013-07-20' AND '2013-08-20'
GROUP BY fk_users_recid, logtime
)logins
ON logins.fk_users_recid = users.recid
/* Only pull the members who had contacts during the period */
WHERE
users.recid = contacts.fk_users_recid
another table
(MySql engine) I have a table that records contacts between staff and
members of a club called "Contacts". I need to know whether the latest
contact made a positive effect on a members attendance by comparing the
average number of times the member logged before and after that contact
during an overall time period. Logins are stored in the logins table. User
info is stored in the users table.
The following sql statement pulls individual lines out with a line for
each login (1 per day) per club member for club members who had at least
one contact during the period. What I'm stuck with is finding the total
number of logins for pre and post maxcontactdate per member.
So I want the resulting table to have columns with rows grouped on recid,
fk_staff_users_recid
"recid", "maxcontactdate", "fk_staff_users_recid",
"pre_maxcontactdate_login_count", "post_maxcontactdate_login_count"
Can somebody help please?
SELECT
recid,
maxcontactdate,
fk_staff_users_recid,
logtime
FROM
(
/* Selects user id, with the staff that made the contact, and the max
contact date for that member of staff */
SELECT fk_users_recid,
fk_staff_users_recid,
MAX(contactdate) AS maxcontactdate
FROM
contacts
WHERE
contactdate BETWEEN '2013-07-20' AND '2013-08-20'
GROUP BY fk_users_recid, fk_staff_users_recid
)contacts,
users
JOIN
(
/* Selects all login dates between the dates specified */
SELECT fk_users_recid,
DATE(logins.logintime) AS logtime
FROM
logins
WHERE
logintime BETWEEN '2013-07-20' AND '2013-08-20'
GROUP BY fk_users_recid, logtime
)logins
ON logins.fk_users_recid = users.recid
/* Only pull the members who had contacts during the period */
WHERE
users.recid = contacts.fk_users_recid
Assigning pixel values to a specific region
Assigning pixel values to a specific region
Say that I select a region in ImageJ. How can I for instance for the
pixels in that region, give them the value of 1?
Thanks.
Say that I select a region in ImageJ. How can I for instance for the
pixels in that region, give them the value of 1?
Thanks.
Monday, 19 August 2013
how to read selected image bytes data from UIImagePickerController without using uiimage
how to read selected image bytes data from UIImagePickerController without
using uiimage
How to read UIImagePickerController selected image bytes to NSData ? If I
use the below code with
UIImageJPEGRepresentation/UIImagePNGRepresentation, I am not getting the
total image bytes.
For example my source image is having 1000bytes of data, in that last 10
bytes are my encryption data which is not related to image. By using the
below code i am not able to read all the 1000bytes. I am only getting 990
bytes.
-(void)imagePickerController:(UIImagePickerController*)picker
didFinishPickingMediaWithInfo:(NSDictionary*)info
{
NSData dataImage = UIImageJPEGRepresentation([info
objectForKey:@"UIImagePickerControllerOriginalImage"],1);
}
I also tried the option of Convert UIImage to NSData without using
UIImagePngrepresentation or UIImageJpegRepresentation. But failed to
achieve this scenario.
Can somebody guide me how to proceed on this?
using uiimage
How to read UIImagePickerController selected image bytes to NSData ? If I
use the below code with
UIImageJPEGRepresentation/UIImagePNGRepresentation, I am not getting the
total image bytes.
For example my source image is having 1000bytes of data, in that last 10
bytes are my encryption data which is not related to image. By using the
below code i am not able to read all the 1000bytes. I am only getting 990
bytes.
-(void)imagePickerController:(UIImagePickerController*)picker
didFinishPickingMediaWithInfo:(NSDictionary*)info
{
NSData dataImage = UIImageJPEGRepresentation([info
objectForKey:@"UIImagePickerControllerOriginalImage"],1);
}
I also tried the option of Convert UIImage to NSData without using
UIImagePngrepresentation or UIImageJpegRepresentation. But failed to
achieve this scenario.
Can somebody guide me how to proceed on this?
Checking username on local server using jquery, ajax and php ajax() not connecting
Checking username on local server using jquery, ajax and php ajax() not
connecting
So I am have a mysql database on my local system and connecting to that
using PHP. I know there is nothing wrong with the the server (Apache)
because I have used it in another calls using just php.
The problem I think is with the "ajax() request
I have only just started using ajax. I followed a tutorial to implement a
way to check if a username already exists on the DB asynchronously.
All the code works up until the ajax() request.
I don't get any errors. All that I see on screen is the result of this code:
$("#availability_status").html(' Checking availability...'); //Add a
loading image in the span id="availability_status"
I have been searching for a solution all day and it's driving me mad.
Thank you in advance!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Register</title>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() { //When the dom is ready
alert("ready!");
$("#username").change(function() { //if therezs a change
in the username textbox
var username = $("#username").val();//Get the value in
the username textbox
if(username.length > 3)
{
$("#availability_status").html('<img
src="loader.gif" align="absmiddle"> Checking
availability...');
//Add a loading image in the span
id="availability_status"
$.ajax({
type: "POST",
url: "http://localhost/ajax_check_username.php",
data: {username: username},
success: function(server_response){
if(server_response == '0')//if
ajax_check_username.php return value
"0"
{
$("#availability_status").html('<img
src="available.png"
align="absmiddle"> <font
color="Green"> Available </font>
');
//add this image to the span with
id "#availability_status"
}
else if(server_response == '1')//if
it returns "1"
{
$("#availability_status").html('<img
src="not_available.png"
align="absmiddle"> <font
color="red">Not Available
</font>');
}
}
});
}
else
{
$("#availability_status").html('<font
color="#cc0000">Username too short</font>');
//if in case the username is less than or equal 3
characters only
}
return false;
});
});
</script>
</head>
<body>
<div id="content">
<strong>Register</strong>
<form action="http://localhost/register2a.php" method="get">
<div class="style_form">
<label for="username">Username :</label>
<input type="text" name="username" id="username"
class="form_element"/>
<span id="availability_status"></span> </div>
<div class="style_form">
<label for="full_name">Full Name :</label>
<input type="text" name="full_name" id="full_name"
class="form_element"/>
</div>
<div class="style_form">
<label for="email">Email :</label>
<input type="text" name="email" id="email" class="form_element"/>
</div>
<div class="style_form">
<input name="submit" type="submit" value="submit"
id="submit_btn" />
</div>
</form>
</div>
</body>
</html>
////here is the php file
<?php
$conn = mysqli_connect('localhost', 'root', 'sherly743759', 'login');
//Include the Database connection file
if(isset($_POST['username']))//If a username has been submitted
{
//check username not taken
$conn = mysqli_connect('localhost', 'root', 'sherly743759', 'login');
$username = mysql_real_escape_string($username);
$query = "SELECT username FROM member WHERE username = '$username';";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0)
{
echo '1'; //Not Available
}
else
{
echo '0'; // Username is available
}
}
?>
connecting
So I am have a mysql database on my local system and connecting to that
using PHP. I know there is nothing wrong with the the server (Apache)
because I have used it in another calls using just php.
The problem I think is with the "ajax() request
I have only just started using ajax. I followed a tutorial to implement a
way to check if a username already exists on the DB asynchronously.
All the code works up until the ajax() request.
I don't get any errors. All that I see on screen is the result of this code:
$("#availability_status").html(' Checking availability...'); //Add a
loading image in the span id="availability_status"
I have been searching for a solution all day and it's driving me mad.
Thank you in advance!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Register</title>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() { //When the dom is ready
alert("ready!");
$("#username").change(function() { //if therezs a change
in the username textbox
var username = $("#username").val();//Get the value in
the username textbox
if(username.length > 3)
{
$("#availability_status").html('<img
src="loader.gif" align="absmiddle"> Checking
availability...');
//Add a loading image in the span
id="availability_status"
$.ajax({
type: "POST",
url: "http://localhost/ajax_check_username.php",
data: {username: username},
success: function(server_response){
if(server_response == '0')//if
ajax_check_username.php return value
"0"
{
$("#availability_status").html('<img
src="available.png"
align="absmiddle"> <font
color="Green"> Available </font>
');
//add this image to the span with
id "#availability_status"
}
else if(server_response == '1')//if
it returns "1"
{
$("#availability_status").html('<img
src="not_available.png"
align="absmiddle"> <font
color="red">Not Available
</font>');
}
}
});
}
else
{
$("#availability_status").html('<font
color="#cc0000">Username too short</font>');
//if in case the username is less than or equal 3
characters only
}
return false;
});
});
</script>
</head>
<body>
<div id="content">
<strong>Register</strong>
<form action="http://localhost/register2a.php" method="get">
<div class="style_form">
<label for="username">Username :</label>
<input type="text" name="username" id="username"
class="form_element"/>
<span id="availability_status"></span> </div>
<div class="style_form">
<label for="full_name">Full Name :</label>
<input type="text" name="full_name" id="full_name"
class="form_element"/>
</div>
<div class="style_form">
<label for="email">Email :</label>
<input type="text" name="email" id="email" class="form_element"/>
</div>
<div class="style_form">
<input name="submit" type="submit" value="submit"
id="submit_btn" />
</div>
</form>
</div>
</body>
</html>
////here is the php file
<?php
$conn = mysqli_connect('localhost', 'root', 'sherly743759', 'login');
//Include the Database connection file
if(isset($_POST['username']))//If a username has been submitted
{
//check username not taken
$conn = mysqli_connect('localhost', 'root', 'sherly743759', 'login');
$username = mysql_real_escape_string($username);
$query = "SELECT username FROM member WHERE username = '$username';";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0)
{
echo '1'; //Not Available
}
else
{
echo '0'; // Username is available
}
}
?>
How to restrict number of fraction digits when parsing number from string?
How to restrict number of fraction digits when parsing number from string?
I want to restrict the number of fraction digits a user is allowed to
enter into a UITextField that only accepts (localized) numeric input.
Example with 4 fraction digits allowed:
Good: 10.123, 12345.2345
Bad: 0.12345, 6.54321
Right now, I'm using NSNumberFormatter's numberFromString: in the
UITextField delegate's
textField:shouldChangeCharactersInRange:replacementString: to determine
whether it's a legal numeric value.
Unfortunately, NSNumberFormatter seems to ignore maximumFractionDigits in
numberFromString:. In tests using getObjectValue:forString:range:error: I
had the same problem, and range also was the full length of the string
afterwards (unless I start entering letters; then range indicates only the
part of the string with digits).
How to best restrict the number of fraction digits in user input?
I want to restrict the number of fraction digits a user is allowed to
enter into a UITextField that only accepts (localized) numeric input.
Example with 4 fraction digits allowed:
Good: 10.123, 12345.2345
Bad: 0.12345, 6.54321
Right now, I'm using NSNumberFormatter's numberFromString: in the
UITextField delegate's
textField:shouldChangeCharactersInRange:replacementString: to determine
whether it's a legal numeric value.
Unfortunately, NSNumberFormatter seems to ignore maximumFractionDigits in
numberFromString:. In tests using getObjectValue:forString:range:error: I
had the same problem, and range also was the full length of the string
afterwards (unless I start entering letters; then range indicates only the
part of the string with digits).
How to best restrict the number of fraction digits in user input?
Computing a differential
Computing a differential
I would like to compute the following differential:
dH/dBd, where:
H = power(10.0, (log10(x)*A + B))
Bd = exp(C + D*ln(x))*exp(E + F/x)
Here, A,B,C,D,E and F are constants. log10 is log to base 10 and ln is log
to base e.
Can I do the following: dH/dBd = (dH/dx)*(dx/dBd) = (dH/dx)/(dBd/dx)
thanks!
I would like to compute the following differential:
dH/dBd, where:
H = power(10.0, (log10(x)*A + B))
Bd = exp(C + D*ln(x))*exp(E + F/x)
Here, A,B,C,D,E and F are constants. log10 is log to base 10 and ln is log
to base e.
Can I do the following: dH/dBd = (dH/dx)*(dx/dBd) = (dH/dx)/(dBd/dx)
thanks!
How to get certificate common name from PEM file
How to get certificate common name from PEM file
Various articles online have lead me to believe that a server
certificate's common name must be an exact match to the root URL it is
valid for. However, when I look at a bunch of the files in /etc/ssl/certs,
via the command openssl x509 -inform PEM -in <certfile.pem> -text, I see
that the CN value is generally a human readable description of the site
(e.g. "Google Internet Authority"), not a domain name. In fact, I can't
see anything in any of the files that looks like a domain name or ip
address, either in them or in the output from openssl s_client -connect
<ip>.
So, is my understanding of 'common name' incorrect? How do I retrieve the
url from the certificate, for which the certificate is valid?
Various articles online have lead me to believe that a server
certificate's common name must be an exact match to the root URL it is
valid for. However, when I look at a bunch of the files in /etc/ssl/certs,
via the command openssl x509 -inform PEM -in <certfile.pem> -text, I see
that the CN value is generally a human readable description of the site
(e.g. "Google Internet Authority"), not a domain name. In fact, I can't
see anything in any of the files that looks like a domain name or ip
address, either in them or in the output from openssl s_client -connect
<ip>.
So, is my understanding of 'common name' incorrect? How do I retrieve the
url from the certificate, for which the certificate is valid?
Sunday, 18 August 2013
Show that $X$ is separable.
Show that $X$ is separable.
I'm working through Kunen's Set Theory and I'm not sure how to proceed on
part of one exercise. Let $X$ be compact Hausdorff and $\mathbb{O}_X$ be
the poset of nonempty open sets of $X$ ordered by inclusion. I want to
show that all of
$X$ is separable.
$\mathbb{O}_X$ is $\sigma$-centered.
$\mathbb{O}_X$ is a countable union of filters.
are equivalent. I have 3 $\Rightarrow$ 2 and 1 $\Rightarrow$ 3. For 2
$\Rightarrow$ 1, we have that $\mathbb{O}_X=\bigcup_{n\in\Bbb N} C_n$
where each $C_n$ is centered, but I'm not sure how from these I should
pick the points in the countable dense subset. Also, I haven't used the
compact Hausdorff hypotheses yet and I am not sure how they will come into
play.
I'm working through Kunen's Set Theory and I'm not sure how to proceed on
part of one exercise. Let $X$ be compact Hausdorff and $\mathbb{O}_X$ be
the poset of nonempty open sets of $X$ ordered by inclusion. I want to
show that all of
$X$ is separable.
$\mathbb{O}_X$ is $\sigma$-centered.
$\mathbb{O}_X$ is a countable union of filters.
are equivalent. I have 3 $\Rightarrow$ 2 and 1 $\Rightarrow$ 3. For 2
$\Rightarrow$ 1, we have that $\mathbb{O}_X=\bigcup_{n\in\Bbb N} C_n$
where each $C_n$ is centered, but I'm not sure how from these I should
pick the points in the countable dense subset. Also, I haven't used the
compact Hausdorff hypotheses yet and I am not sure how they will come into
play.
Memoization of multi-parameter function in Haskell
Memoization of multi-parameter function in Haskell
The following example of a function using memoization is presented on this
page:
memoized_fib :: Int -> Integer
memoized_fib = (map fib [0..] !!)
where fib 0 = 0
fib 1 = 1
fib n = memoized_fib (n-2) + memoized_fib (n-1)
What if we wanted to memoize a multi-parameter function, though? We could
create a 'multiplied Fibonacci', for example, that would be defined f(m,n)
= m*f(m,n-2) + m*f(m,n-1). I modified the code above for this 'multiplied
Fibonacci' function as follows:
mult_fib :: Integer -> Int -> Integer
mult_fib mult = (map (m_fib mult) [0..] !!)
where m_fib _ 0 = 0
m_fib _ 1 = 1
m_fib m n = m*(mult_fib m (n-2)) + m*(mult_fib m (n-1))
The runtime of the modified function is exponential, even though the
original is linear. Why does this technique not work in the second case?
Also, how could the function be modified to make use of memoization
(without using library functions)?
The following example of a function using memoization is presented on this
page:
memoized_fib :: Int -> Integer
memoized_fib = (map fib [0..] !!)
where fib 0 = 0
fib 1 = 1
fib n = memoized_fib (n-2) + memoized_fib (n-1)
What if we wanted to memoize a multi-parameter function, though? We could
create a 'multiplied Fibonacci', for example, that would be defined f(m,n)
= m*f(m,n-2) + m*f(m,n-1). I modified the code above for this 'multiplied
Fibonacci' function as follows:
mult_fib :: Integer -> Int -> Integer
mult_fib mult = (map (m_fib mult) [0..] !!)
where m_fib _ 0 = 0
m_fib _ 1 = 1
m_fib m n = m*(mult_fib m (n-2)) + m*(mult_fib m (n-1))
The runtime of the modified function is exponential, even though the
original is linear. Why does this technique not work in the second case?
Also, how could the function be modified to make use of memoization
(without using library functions)?
EmberJS transitionTo / linkTo callbacks
EmberJS transitionTo / linkTo callbacks
I'd like to have a callback that is fired every time that a link is
followed or a transitionTo is called in EmberJS. The reason I want to do
this is to hide menus/dropdowns that might be open when the transition is
made. I haven't the foggiest idea of where to start with this. My
Google-fu might be weak so apologies if this is a silly question.
I'd like to have a callback that is fired every time that a link is
followed or a transitionTo is called in EmberJS. The reason I want to do
this is to hide menus/dropdowns that might be open when the transition is
made. I haven't the foggiest idea of where to start with this. My
Google-fu might be weak so apologies if this is a silly question.
wordpress ajax relationship query
wordpress ajax relationship query
Using the relationship field from Advanced Custom Fields I link artists to
events. Both these artist and events are custom post types. For each
event, the post IDs of the related artists are stored in an array as a
custom meta field (lineup_artists).
On each event page I list all the artists. When you click on an artist,
I'd like to show all the events where you can find this artist (through an
AJAX call which shows the results in a bootstrap modal). I've tested the
AJAX call and it's working, but there's something wrong with the query
(takes very long to complete).
In my function I have:
$ArtistID = $_POST['ArtistID']; // Gets the ArtistID from the AJAX call
$meta_query = array(
'key' => 'lineup_artists',
'value' => '"' . $ArtistID .'"',
'compare' => 'LIKE'
);
$args = array(
'post_type' => 'events',
'meta_query' => array($meta_query),
'posts_per_page' => 5,
'post_status' => 'publish',
);
If I dump the results of wp_query, I get the following sql query:
SELECT SQL_CALC_FOUND_ROWS yt_posts.ID FROM yt_posts
INNER JOIN yt_postmeta ON (yt_posts.ID = yt_postmeta.post_id)
WHERE 1=1
AND yt_posts.post_type = 'events'
AND (yt_posts.post_status = 'publish')
AND ( (yt_postmeta.meta_key = 'lineup_artists' AND
CAST(yt_postmeta.meta_value AS CHAR) LIKE '%\"17497\"%') )
GROUP BY yt_posts.ID ORDER BY yt_posts.post_date DESC LIMIT 0, 5
When I paste this query in phpmyadmin it takes very long to complete (I've
never seen it finish because it takes so long).
Is this because the artist IDs are stored as an array? Someone told me
that this is not very efficient and that these relations should be stored
in a separate table (which I don't know how to do). Is there something
wrong with my query or is this a very inefficient way of querying
relations?
Using the relationship field from Advanced Custom Fields I link artists to
events. Both these artist and events are custom post types. For each
event, the post IDs of the related artists are stored in an array as a
custom meta field (lineup_artists).
On each event page I list all the artists. When you click on an artist,
I'd like to show all the events where you can find this artist (through an
AJAX call which shows the results in a bootstrap modal). I've tested the
AJAX call and it's working, but there's something wrong with the query
(takes very long to complete).
In my function I have:
$ArtistID = $_POST['ArtistID']; // Gets the ArtistID from the AJAX call
$meta_query = array(
'key' => 'lineup_artists',
'value' => '"' . $ArtistID .'"',
'compare' => 'LIKE'
);
$args = array(
'post_type' => 'events',
'meta_query' => array($meta_query),
'posts_per_page' => 5,
'post_status' => 'publish',
);
If I dump the results of wp_query, I get the following sql query:
SELECT SQL_CALC_FOUND_ROWS yt_posts.ID FROM yt_posts
INNER JOIN yt_postmeta ON (yt_posts.ID = yt_postmeta.post_id)
WHERE 1=1
AND yt_posts.post_type = 'events'
AND (yt_posts.post_status = 'publish')
AND ( (yt_postmeta.meta_key = 'lineup_artists' AND
CAST(yt_postmeta.meta_value AS CHAR) LIKE '%\"17497\"%') )
GROUP BY yt_posts.ID ORDER BY yt_posts.post_date DESC LIMIT 0, 5
When I paste this query in phpmyadmin it takes very long to complete (I've
never seen it finish because it takes so long).
Is this because the artist IDs are stored as an array? Someone told me
that this is not very efficient and that these relations should be stored
in a separate table (which I don't know how to do). Is there something
wrong with my query or is this a very inefficient way of querying
relations?
How to put a comparison in a multidatatrigger
How to put a comparison in a multidatatrigger
How can we put a comparison in a MultiDataTrigger? Ina normal DataTrigger,
we could put it as such:
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding Count}" Comparison="LessThan"
Value="5">
<ei:ChangePropertyAction PropertyName="IsEnabled" Value="False"/>
</ei:DataTrigger>
</i:Interaction.Triggers>
But how do we put a comparison like this in a MultiDataTrigger condition?
I searched, but couldn't find any solution. Please help. Thanks.
How can we put a comparison in a MultiDataTrigger? Ina normal DataTrigger,
we could put it as such:
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding Count}" Comparison="LessThan"
Value="5">
<ei:ChangePropertyAction PropertyName="IsEnabled" Value="False"/>
</ei:DataTrigger>
</i:Interaction.Triggers>
But how do we put a comparison like this in a MultiDataTrigger condition?
I searched, but couldn't find any solution. Please help. Thanks.
Using the switch statement instead of if
Using the switch statement instead of if
so I just started programming and I started with c#. In the book I'm
reading (learning c# 3.0), one of the exercises was this.
Exercise 5-2. Create a program that prompts a user for input, accepts an
integer, then
evaluates whether that input is zero, odd or even, a multiple of 10, or
too large (more
than 100) by using multiple levels of if statements.
I managed to to this but the next exercise was
Exercise 5-3. Rewrite the program from Exercise 5-2 to do the same work
with a
switch statement.
I understand how switch statements work, but, I'm not sure how to work out
if the user input number is odd/even, multiple of 10 and so on, and not
use an if statement. Thank you for any help.
so I just started programming and I started with c#. In the book I'm
reading (learning c# 3.0), one of the exercises was this.
Exercise 5-2. Create a program that prompts a user for input, accepts an
integer, then
evaluates whether that input is zero, odd or even, a multiple of 10, or
too large (more
than 100) by using multiple levels of if statements.
I managed to to this but the next exercise was
Exercise 5-3. Rewrite the program from Exercise 5-2 to do the same work
with a
switch statement.
I understand how switch statements work, but, I'm not sure how to work out
if the user input number is odd/even, multiple of 10 and so on, and not
use an if statement. Thank you for any help.
python max function using 'key' and lambda expression
python max function using 'key' and lambda expression
I come from OOP background and trying to learn python. I am using the max
function which uses a lambda expression to return the instance of type
Player having maximum totalScore.
def winner():
w = max(players, key=lambda p: p.totalScore)
The function correctly returns instance of type Player having maximum
totalScore. I am confused about the following three things:
How does the max function work? What are the arguments it is taking? I
looked at the documentation but failed to understand.
What is use of the keyword key in max function? I know it is also used in
context of sort function
Meaning of the lambda expression? How to read them? How do they work?
These are all very noobish conceptual questions but will help me
understand the language. It would help if you could give examples to
explain. Thanks
I come from OOP background and trying to learn python. I am using the max
function which uses a lambda expression to return the instance of type
Player having maximum totalScore.
def winner():
w = max(players, key=lambda p: p.totalScore)
The function correctly returns instance of type Player having maximum
totalScore. I am confused about the following three things:
How does the max function work? What are the arguments it is taking? I
looked at the documentation but failed to understand.
What is use of the keyword key in max function? I know it is also used in
context of sort function
Meaning of the lambda expression? How to read them? How do they work?
These are all very noobish conceptual questions but will help me
understand the language. It would help if you could give examples to
explain. Thanks
Saturday, 17 August 2013
mysql_fetch_array() expects parameter 1 to be resource, boolean given in displaying special character [duplicate]
mysql_fetch_array() expects parameter 1 to be resource, boolean given in
displaying special character [duplicate]
This question already has an answer here:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in
select 18 answers
i have an error in diplaying data with special character on it. i want to
display this word "C'har" then mysql_fetch_array() error occur.
here is my full code:
<?php
header('Content-Type:text/html; charset=UTF-8');
$con = mysql_connect("localhost","root","") or die ("Cannot Connect to
Server");
mysql_select_db("sarangani",$con) or die ("Cannot Connect to database");
$result = mysql_query("SELECT * from fes_category");
echo "<form method=\"post\" id=\"selct\" name=\"selct\">";
while($row = mysql_fetch_array($result))
{
$new = "<input type=\"submit\" id=\"ss\" name=\"ss\"
value='".htmlspecialchars($row['fes_name'], ENT_QUOTES)."'
class=\"ss\">";
echo $new;
}
echo "<input type=\"text\" name=\"subs\" id=\"subs\">";
echo "<input type=\"submit\" name=\"sub\" id=\"sub\">";
echo "</form>";
if(isset($_POST['ss']))
{
$sel = $_POST['ss'];
$results = mysql_query("SELECT fes_name from fes_category WHERE
fes_name='".$sel."'");
$row = mysql_fetch_array($results);
if($sel == $row['fes_name'])
{
echo $sel;
}
}
?>
displaying special character [duplicate]
This question already has an answer here:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in
select 18 answers
i have an error in diplaying data with special character on it. i want to
display this word "C'har" then mysql_fetch_array() error occur.
here is my full code:
<?php
header('Content-Type:text/html; charset=UTF-8');
$con = mysql_connect("localhost","root","") or die ("Cannot Connect to
Server");
mysql_select_db("sarangani",$con) or die ("Cannot Connect to database");
$result = mysql_query("SELECT * from fes_category");
echo "<form method=\"post\" id=\"selct\" name=\"selct\">";
while($row = mysql_fetch_array($result))
{
$new = "<input type=\"submit\" id=\"ss\" name=\"ss\"
value='".htmlspecialchars($row['fes_name'], ENT_QUOTES)."'
class=\"ss\">";
echo $new;
}
echo "<input type=\"text\" name=\"subs\" id=\"subs\">";
echo "<input type=\"submit\" name=\"sub\" id=\"sub\">";
echo "</form>";
if(isset($_POST['ss']))
{
$sel = $_POST['ss'];
$results = mysql_query("SELECT fes_name from fes_category WHERE
fes_name='".$sel."'");
$row = mysql_fetch_array($results);
if($sel == $row['fes_name'])
{
echo $sel;
}
}
?>
Subscribe to:
Comments (Atom)