Monday, 30 September 2013

Evaluate $ \lim=?iso-8859-1?Q?=5F{x\rightarrow{\frac\pi2_}}_?=(\sec(x) \tan(x))^{\cos(x)}$ without L'Hôpital's rule – math.stackexchange.com

Evaluate $ \lim_{x\rightarrow{\frac\pi2 }} (\sec(x) \tan(x))^{\cos(x)}$
without L'Hôpital's rule – math.stackexchange.com

I have tried changing limit to $\lim_{x\rightarrow0}$ and use some
trigonometry identity ($\sin^2(x)+\cos^2(x) = 1$ and $\sin (x+\pi/2) =
\cos(x)$) but doesn't work I have no idea on how to do this …

How to show that $(\delta'f)(e)=\delta(\phi^* f)(e)$?

How to show that $(\delta'f)(e)=\delta(\phi^* f)(e)$?

I am reading linear algebraic groups.
I have a question in line 4 of the third paragraph of Page 66. How to show
that $(\delta'f)(e)=\delta(\phi^* f)(e)$ for all $f\in K[G]$? Here $G$ is
an algebraic group, $K$ is an algebraic closed field, $\delta' =
\operatorname{Ad} x(\delta) = d(\operatorname{Int} x(\delta))$,
$\phi=\operatorname{Int} x$, $\operatorname{Int} x(y) = xyx^{-1}$, $x, y
\in G$. Thank you very much.
I think that $\delta'f = d(\operatorname{Int} x(\delta))f$.

Remove x amount of elements with .remove()

Remove x amount of elements with .remove()

I am not seeing any clear documentation on removing a certain amount of
elements without it being in a specific order, of course there are many
ways to remove a list of say 5 items, if they are in that order. What if
there is elements that you don't want removed in between? Let me show you
an example
FIDDLE: Below is just pieces from this fiddle, it would be easier just
taking a look at the fiddle.
HTML
<div class="item empty">Empty</div>
<div class="item empty">Empty</div>
<div class="item editable">Editable</div>
<div class="item empty">Empty</div>
</div>
<button class="demo">Demo</button>
jQuery
$('.demo').click(function() {
var length = $('.item').length,
columns = 12/6,
addColumn = columns - length
//Set this for subtracting elements if addColumn is a negitive
if(addColumn < 0) {
//Want to remove the amount of items which is -2 in this case
$('.item.empty').eq(/*Remove whatever amount of addColumn */ ).remove()
}
//Equals -2
alert(addColumn)
});
So just to be clear, I am trying to remove the amount of .empty items
based on whatever the amount is passed into the addColumn variable in this
case its static set at -2.
So I ask if addColumn < 0 is a negative number then we do subtraction
using .remove() and I need to remove the amount of .empty items equal to
the addColumn variable.
12/6 comes from a 12 column grid and the 6 is a two column layout span6
span6 and so if the layout is set at 4 columns we need to remove 2
columns, which is where the -2 comes from.

Getting div id by GET in Javascript

Getting div id by GET in Javascript

Ciao
I need to create a dynamic form based on user selections.
I.e. in the first form field I select "John Smith", this will populate
(through an external php/mysql file ) the second select field "Artist,
Carpenter, Other", if I choose Artist I populate the third select field
with "Singer, Painter, Sculptor" and so on
Giving my incompetence on javascript, I spent the morning googling for
scripts and I found a cool tutorial here
It works, it's clean, but it updates only the div with id txtResult, which
is statically included in the js file (see lines 19 and 31 of
ajax_req.js). I thought I could pass the id name by GET, but I don't know
how to make the script recognize the variable.
This is the code:
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtResult").innerHTML=
xmlHttp.responseText;
}
}
I had in mind to pass by GET the id name and have something like this:
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("GET[idName]").innerHTML=
xmlHttp.responseText;
}
}
Can you please help me? I could change script too if you happen to know
something better
Ciao and thank you,
Ed

Sunday, 29 September 2013

Visited every section of the FAQ (retired)

Visited every section of the FAQ (retired)

The way to earn the 'Analytical' badge is: Visited every section of the
FAQ (retired). What does (retired) mean? Does it mean that it is no longer
available?

SQL- Getting maximum value along with all other columns?

SQL- Getting maximum value along with all other columns?

I have a table, which can be seen as a evaluation of two courses in
several classroom tests, like this:
student_ID Evaluation Course1 Course2
------------------------------------------------------
1 5 88 93
2 4 70 87
1 5 93 90
2 5 99 91
3 3 65 60
3 4 88 70
I need to get the result of the Evaluation=5 for each student, if any. If
that student has more than one Evaluation=5, the query only show any one
of them. So for the above example table, the query result will be
student_ID Evaluation Course1 Course2
------------------------------------------------------
1 5 88 93
2 5 99 91
Of course in my real table, the "Courses" number is more than 2.
Thanks for the help.

How to create FlexSlider with flipping content

How to create FlexSlider with flipping content

I'm starting to get in to web development. I'm keenly interested on
minimal designs and flat UIs.
I was googling around and found some interested sites. This particular
site caught my eye which has a unique slideshow. I did a bit of snooping
with dev tools and found that the site uses Flexslider.
I would really like to know how to achieve this kind of effect.
A sample on Fiddle with 2 image slides with flipping content would be
really appreciated if possible to be provided.
URL for the site: http://skincollective.net/
[ This is not an advertisement if it's against the rules ]

How to increment a single number in a text file with PHP

How to increment a single number in a text file with PHP

I am writing a VoteBox (like/dislike box) in html and I cannot find how to
do this anywhere.
Basically, there will be a like and a dislike button. When one of them
gets clicked, it will forward the user to a page. And in that, I want some
PHP code that will increase the number in upvotes.txt/downvotes.txt
I have tried doing it with a database but the problem is I want anyone to
be able to use this without any setup.
i also want the front page to display the number of upvotes and the number
of downvotes
so its kinda like this (most of this isn't real code BTW im new to PHP):
//this is the code for upvote.html
$upvotes = get_data_from_TXT_file
$changedupvotes = $upvotes + 1
set_data_in_txt_file_to_$changedupvotes
Sorry if i havent explained this very well
Any help appreciated

Saturday, 28 September 2013

Pretty new to Java, how to insert user-inputted string to direct a reference?

Pretty new to Java, how to insert user-inputted string to direct a reference?

(In java,) This may or may not be possible, I assume it is because it
seems to short-cutty/easy to not exist. Basically what I want to do is
have the user insert the name of a state, then it add one to that state's
counter, which is stored in a different class. I want to do this without
creating 50 if/else statements. Here's pseudocode which represents how I
would expect it to be done. (this code would be encapsuled in a while loop
in mainclass.java and the counters and state names are in a class named
state.java.)
Scanner userstate = new Scanner(System.in);
String statename = userstate.nextLine();
state.(statename).counter++;
in state.java:
public state(int counter){
}
public static state Alabama = new state(0);
For time's sake, I hope there is a shortcut similar to the above.

Android change text in textview on swipe with animation

Android change text in textview on swipe with animation

I am developing an android application and i have set of messages to show
on a display page. At a given time only one message will be shown, but if
user swipes the screen i want to change the message on textview on swipe.
I want animation direction based on swipe direction meaning if user swipe
left to right then left-right textview animation, similarly right-left and
bottom-top animation. Please advise me how to achieve this.

ASP.NET MVC application that needs reading from SQL server not working on IIS but on visual studio, while ASP.NET Web Applicatopn worked for...

ASP.NET MVC application that needs reading from SQL server not working on
IIS but on visual studio, while ASP.NET Web Applicatopn worked for...

I followed an example of using SQL databse from an ASP.NET MVC application
and can get it work on Visual Studio, but when I tried to deploy it on the
local IIS and provide the values on the URL it was said "... The resource
cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure
that it is spelled correctly. ..."
I can access the same SQL database from APS.NET Web application but not MVC.
Can you tell me why this happens and how to solve the problem?

Communication Bluetooth android-arduino

Communication Bluetooth android-arduino

I have modified the android app "Bluetooth Chat" that you can find in
android sdk examples version 2.1 The app estabilished a bluetooth
connection with arduino, and, when with the app I send 0 or 1, arduino
send a simple message "You have pressed 0 or 1". It works if I test with
eclipse's debug, but when I test with my smartphone, the result in the
display is different, arduino's string is fragmented
example: smartphone: 0 -> arduino "You have pressed 0 or 1" smartphone
display: "y" "ou pr"
The rest of the string was lost or not shown in the display. Can you help
me? No error in logcat, only this bug.
This is the code:
public class BluetoothLampService {
// Debugging
private static final String TAG = "BluetoothLampService";
private static final boolean D = true;
// Name for the SDP record when creating server socket
private static final String NAME = "BluetoothLamp";
// Unique UUID for this application - Standard SerialPortService ID
private static final UUID MY_UUID =
UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
// Member fields
private final BluetoothAdapter Adapter;
private final Handler Handler;
// private AcceptThread AcceptThread;
private ConnectThread ConnectThread;
private ConnectedThread ConnectedThread;
private int State;
// Constants that indicate the current connection state
public static final int STATE_NONE = 0; // we're doing nothing
public static final int STATE_LISTEN = 1; // now listening for
incoming connections
public static final int STATE_CONNECTING = 2; // now initiating an
outgoing connection
public static final int STATE_CONNECTED = 3; // now connected to a
remote device
/**
* Constructor. Prepares a new BluetoothChat session.
* @param context The UI Activity Context
* @param handler A Handler to messages back to the UI Activity
*/
public BluetoothLampService(Context context, Handler handler) {
Adapter = BluetoothAdapter.getDefaultAdapter();
State = STATE_NONE;
Handler = handler;
}
/**
* Set the current state of the chat connection
* @param state An integer defining the current connection state
*/
private synchronized void setState(int state) {
State = state;
// Give the new state to the Handler so the UI Activity can update
Handler.obtainMessage(MainActivity.MESSAGE_STATE_CHANGE, state,
-1).sendToTarget();
}
/**
* Return the current connection state. */
public synchronized int getState() {
return State;
}
/**
* Start the chat service. Specifically start AcceptThread to begin a
* session in listening (server) mode. Called by the Activity
onResume() */
public synchronized void start() {
// Cancel any thread attempting to make a connection
if (ConnectThread != null) {ConnectThread.cancel(); ConnectThread
= null;}
// Cancel any thread currently running a connection
if (ConnectedThread != null) {ConnectedThread.cancel();
ConnectedThread = null;}
// Start the thread to listen on a BluetoothServerSocket
// if (AcceptThread == null) {
// AcceptThread = new AcceptThread();
// AcceptThread.start();
// }
setState(STATE_LISTEN);
}
/**
* Start the ConnectThread to initiate a connection to a remote device.
* @param device The BluetoothDevice to connect
*/
public synchronized void connect(BluetoothDevice device) {
// Cancel any thread attempting to make a connection
if (State == STATE_CONNECTING) {
if (ConnectThread != null) {ConnectThread.cancel();
ConnectThread = null;}
}
// Cancel any thread currently running a connection
if (ConnectedThread != null) {ConnectedThread.cancel();
ConnectedThread = null;}
// Start the thread to connect with the given device
ConnectThread = new ConnectThread(device);
ConnectThread.start();
setState(STATE_CONNECTING);
}
/**
* Start the ConnectedThread to begin managing a Bluetooth connection
* @param socket The BluetoothSocket on which the connection was made
* @param device The BluetoothDevice that has been connected
*/
public synchronized void connected(BluetoothSocket socket,
BluetoothDevice device) {
// Cancel the thread that completed the connection
if (ConnectThread != null) {ConnectThread.cancel(); ConnectThread
= null;}
// Cancel any thread currently running a connection
if (ConnectedThread != null) {ConnectedThread.cancel();
ConnectedThread = null;}
// Cancel the accept thread because we only want to connect to one
device
// if (AcceptThread != null) {AcceptThread.cancel(); AcceptThread =
null;}
// Start the thread to manage the connection and perform
transmissions
ConnectedThread = new ConnectedThread(socket);
ConnectedThread.start();
// Send the name of the connected device back to the UI Activity
Message msg =
Handler.obtainMessage(MainActivity.MESSAGE_DEVICE_NAME);
Bundle bundle = new Bundle();
bundle.putString(MainActivity.DEVICE_NAME, device.getName());
msg.setData(bundle);
Handler.sendMessage(msg);
setState(STATE_CONNECTED);
}
/**
* Stop all threads
*/
public synchronized void stop() {
if (ConnectThread != null) {ConnectThread.cancel(); ConnectThread
= null;}
if (ConnectedThread != null) {ConnectedThread.cancel();
ConnectedThread = null;}
// if (AcceptThread != null) {AcceptThread.cancel(); AcceptThread =
null;}
setState(STATE_NONE);
}
/**
* Write to the ConnectedThread in an unsynchronized manner
* @param out The bytes to write
* @see ConnectedThread#write(byte[])
*/
public void write(byte[] out) {
// Create temporary object
ConnectedThread r;
// Synchronize a copy of the ConnectedThread
synchronized (this) {
if (State != STATE_CONNECTED) return;
r = ConnectedThread;
}
// Perform the write unsynchronized
r.write(out);
}
/**
* Indicate that the connection attempt failed and notify the UI
Activity.
*/
private void connectionFailed() {
setState(STATE_LISTEN);
// Send a failure message back to the Activity
Message msg = Handler.obtainMessage(MainActivity.MESSAGE_TOAST);
Bundle bundle = new Bundle();
bundle.putString(MainActivity.TOAST, "Unable to connect device");
msg.setData(bundle);
Handler.sendMessage(msg);
}
/**
* Indicate that the connection was lost and notify the UI Activity.
*/
private void connectionLost() {
setState(STATE_LISTEN);
// Send a failure message back to the Activity
Message msg = Handler.obtainMessage(MainActivity.MESSAGE_TOAST);
Bundle bundle = new Bundle();
bundle.putString(MainActivity.TOAST, "Device connection was lost");
msg.setData(bundle);
Handler.sendMessage(msg);
}
/**
* This thread runs while listening for incoming connections. It behaves
* like a server-side client. It runs until a connection is accepted
* (or until cancelled).
*/
/*
private class AcceptThread extends Thread {
// The local server socket
private final BluetoothServerSocket ServerSocket;
public AcceptThread() {
BluetoothServerSocket tmp = null;
// Create a new listening server socket
try {
tmp = Adapter.listenUsingRfcommWithServiceRecord(NAME,
MY_UUID);
} catch (IOException e) {
}
ServerSocket = tmp;
}
public void run() {
//Looper.prepare();
setName("AcceptThread");
BluetoothSocket socket = null;
// Listen to the server socket if we're not connected
while (State != STATE_CONNECTED) {
try {
// This is a blocking call and will only return on a
// successful connection or an exception
socket = ServerSocket.accept();
} catch (IOException e) {
break;
}
// If a connection was accepted
if (socket != null) {
synchronized (BluetoothLampService.this) {
switch (State) {
case STATE_LISTEN:
case STATE_CONNECTING:
// Situation normal. Start the
connected thread.
connected(socket,
socket.getRemoteDevice());
break;
case STATE_NONE:
case STATE_CONNECTED:
// Either not ready or already
connected. Terminate new
socket.
try {
socket.close();
} catch (IOException e) {
}
break;
}
}
}
}
// Looper.loop();
}
public void cancel() {
try {
ServerSocket.close();
} catch (IOException e) {
}
}
}
*/
/**
* This thread runs while attempting to make an outgoing connection
* with a device. It runs straight through; the connection either
* succeeds or fails.
*/
private class ConnectThread extends Thread {
private final BluetoothSocket Socket;
private final BluetoothDevice Device;
public ConnectThread(BluetoothDevice device) {
Device = device;
BluetoothSocket tmp = null;
// Get a BluetoothSocket for a connection with the
// given BluetoothDevice
try {
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
} catch (IOException e) {
}
Socket = tmp;
}
public void run() {
Looper.prepare();
setName("ConnectThread");
// Always cancel discovery because it will slow down a connection
Adapter.cancelDiscovery();
// Make a connection to the BluetoothSocket
try {
// This is a blocking call and will only return on a
// successful connection or an exception
Socket.connect();
} catch (IOException e) {
connectionFailed();
// Close the socket
try {
Socket.close();
} catch (IOException e2) {}
// Start the service over to restart listening mode
BluetoothLampService.this.start();
return;
}
// Reset the ConnectThread because we're done
synchronized (BluetoothLampService.this) {
ConnectThread = null;
}
// Start the connected thread
connected(Socket, Device);
Looper.loop();
}
public void cancel() {
try {
Socket.close();
} catch (IOException e) {
}
}
}
/**
* This thread runs during a connection with a remote device.
* It handles all incoming and outgoing transmissions.
*/
private class ConnectedThread extends Thread {
private final BluetoothSocket Socket;
private final InputStream InStream;
private final OutputStream OutStream;
public ConnectedThread(BluetoothSocket socket) {
Socket = socket;
InputStream tmpIn = null;
OutputStream tmpOut = null;
// Get the BluetoothSocket input and output streams
try {
tmpIn = socket.getInputStream();
tmpOut = socket.getOutputStream();
} catch (IOException e) {
}
InStream = tmpIn;
OutStream = tmpOut;
}
public void run() {
Looper.prepare();
byte[] buffer = new byte[1024];
int bytes;
// Keep listening to the InputStream while connected
while (true) {
try {
// Read from the InputStream
// FUNZIONANTE
bytes = InStream.read(buffer);
Log.i("BYTES", Integer.toString(bytes));
//String dati = new String(buffer);
//fine aggiunto da me
// Send the obtained bytes to the UI Activity
Handler.obtainMessage(MainActivity.MESSAGE_READ, 27, -1,
buffer).sendToTarget();//buffer
} catch (IOException e) {
connectionLost();
break;
}
}
Looper.loop();
}
/**
* Write to the connected OutStream.
* @param buffer The bytes to write
*/
public void write(byte[] buffer) {
try {
OutStream.write(buffer);
// Share the sent message back to the UI Activity
Handler.obtainMessage(MainActivity.MESSAGE_WRITE, -1, -1,
buffer).sendToTarget();
} catch (IOException e) {
}
}
public void cancel() {
try {
Socket.close();
} catch (IOException e) {
}
}
}
}

Friday, 27 September 2013

Facebook API: best way to get like, share, comment count for a page/group post?

Facebook API: best way to get like, share, comment count for a page/group
post?

What's the best way to get the like, share, comment count for a post?
I'm trying via FQL but it doesn't seem to give any data when the URL is a
FB post URL:
SELECT like_count, comment_count, share_count FROM link_stat WHERE
url="https://www.facebook.com/Macklemore/posts/10153256675935268"
When I get the post info via the Graph API Explorer:
386050065267_10153256675935268
It gives me the like count and share count and I can get the comment count
via 386050065267_10153256675935268/comments?summary=true
{
"id": "386050065267_10153256675935268",
"from": {
"category": "Musician/band",
"name": "Macklemore",
"id": "386050065267"
},
"message": "We're playing a FREE show in November to celebrate the new
Microsoft Store opening in Jacksonville, Florida. Come see us! Info
here: http://msft.it/STJevent\n\nThursday, November 21, 2013\n10:00
p.m.\nStart lining up for your chance to attend the show on
Saturday.\nLocation: Outdoors behind Oakley, near Dick's Sporting
Goods.",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/386050065267/posts/10153256675935268"
},
{
"name": "Like",
"link": "https://www.facebook.com/386050065267/posts/10153256675935268"
}
],
"privacy": {
"value": ""
},
"type": "status",
"status_type": "mobile_status_update",
"created_time": "2013-09-26T16:30:23+0000",
"updated_time": "2013-09-27T20:39:45+0000",
**"shares": {
"count": 274
},**
"likes": {
"data": [
{
"name": "Jabson Ramos",
"id": "100005418486411"
},
{
"name": "Sophia Belen Parada Andrades",
"id": "100002552653152"
},
{
"name": "Oli Barrera",
"id": "100001718791443"
},
{
"name": "Viktoria Martinez",
"id": "1697663024"
}
],
**"count": 3345**
},
"comments": {
"data": [
{
"id": "10153256675935268_43537841",
"from": {
"name": "Vu Thai",
"id": "1338690172"
},
"message": "Sean Viray Matt Win Soo... about my birthday weekend...",
"message_tags": [
{
"id": "75311036",
"name": "Sean Viray",
"type": "user",
"offset": 0,
"length": 10
},
{
"id": "25113189",
"name": "Matt Win",
"type": "user",
"offset": 11,
"length": 8
}
],
"can_remove": false,
"created_time": "2013-09-26T16:31:03+0000",
"like_count": 4,
"user_likes": false
},
.....
],
"paging": {
"cursors": {
"after": "MjY=",
"before": "MQ=="
},
"next":
"https://graph.facebook.com/386050065267_10153256675935268/comments?limit=25&after=MjY="
}
}
}
Weird thing is when I run that query in my app I don't get the share count
or like count. Am I doing something wrong? Is the data in the explorer
different from what apps have access to?
I know I can get the like count via
386050065267_10153256675935268/likes?summary=true
Biggest thing would be the missing share count.
So summary,
Can you get these stats via FQL? If not, how can you obtain the share
count via the graph API?
Thx.

How to put command include ("/path/public_html/file.php"); inside a variable?

How to put command include ("/path/public_html/file.php"); inside a variable?

I have something like
$example['description']="print this text: *** " ;
and instead of * I like to include a file /home/path/public_html/list.php
where is stored the html text (php formatted).
How to implement the function
include ("/home/path/public_html/list.php");
inside the variable? Thank you for help.

get php posted id on ajax

get php posted id on ajax

I added two buttons, 1 on html and one on php .... by getting second
button with ajax..
but when i add event to the buttons the one on the html page works only
... need some help....
HTML
<input type="button" value="button 1" class="btn">
<div id="div"><div>
<script>
$.ajax({
url:"btn2.php", success:function(data){
$('#div').html(data);}
});
$('.btn').click(function(){
alert("button is wrking");
});
</script>
PHP
<?php
echo"<input type='button' value='button 2' class='btn'>";
?>
can any one help me on this

Javascript string concatenation with a function behaves strange

Javascript string concatenation with a function behaves strange

I am trying to concate something like "string"+function(){return "string"}
in document.write() in javascript.
For example:
document.write("I don't know "+function(){if(true){return "why does it
concat?"}});
And it prints something like this bellow (see it running in the jsfiddle:
http://jsfiddle.net/sadaf2605/3AuLD/):
I don't know function (){if(true){return "why does it concat?"}}
I know I have written something very very silly but still why should it
print something like this? I am curious about that!

VBScript read digital signature of file

VBScript read digital signature of file

Is there any way to read Digital Signature of file using VBScript? I need
to read property: "Name of signer"... I need to check if tested java.exe
file is signed by Oracle.

change the submit method of a jquery POST form

change the submit method of a jquery POST form

i have 2 jquery codes. How can i put this toghether.
example
if checkbox is checked use
<script>
$(document).ready(LoadMe);
function LoadMe()
{
$('#msg_text').bind('keypress', function(e){
var code = e.keyCode ? e.keyCode : e.which;
if(code == 13 && !e.shiftKey) // Enter key is pressed
{
var msg = $("#msg_text").val();
var ontvanger = $("#ontvanger").val();
if ( $.trim( $('#msg_text').val() ) == '')
{
}
else
{
$("#send_msg").hide();
$("#dis_sub").show();
$.ajax({
type: "POST",
url: "post_message.php",
data: { msg: msg, ontvanger: ontvanger},
cache: false,
success: function(html){
$("#msg_text").val('');
$("#content").prepend(html);
$("#dis_sub").hide();
$("#send_msg").show();
}
});
}return false;
}
});
}
else use
<script type="text/javascript">
$(function() {
$("#send_msg").click(function()
{
var msg = $("#msg_text").val();
var ontvanger = $("#ontvanger").val();
if ( $.trim( $('#msg_text').val() ) == '')
{
}
else
{
$("#send_msg").hide();
$("#dis_sub").show();
$.ajax({
type: "POST",
url: "post_message.php",
data: { msg: msg, ontvanger: ontvanger},
cache: false,
success: function(html){
$("#msg_text").val('');
$("#content").prepend(html);
$("#dis_sub").hide();
$("#send_msg").show();
}
});
}return false;
}); });
</script>
if checkbox is checked i want to submit my form with a enter key else
submit the form with click on a button

Thursday, 26 September 2013

Location manager delegate not getting called

Location manager delegate not getting called

I am using location service to keep my app alive for longer, its working
fine in my iOS6 (Device and Simulator), but in iOS7 its not calling this
delegate function of CLLocationManager,
-(void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation
*)oldLocation
How to make this work in iOS7?

Skip before_filter defined with block

Skip before_filter defined with block

Is it possible to skip a before filter in using skip_before_filter when
the before_filter is defined with a block. For example:
class ApplicationController < ActionController::Base
before_filter do |controller|
# filter stuff
end
end
I know, that is it possible using the "normal" way of defining the filter
with a method name.

Thursday, 19 September 2013

how to filter list using linq windows phone ListPicker

how to filter list using linq windows phone ListPicker

I have List< Parameter > = App.ViewModel.Items where Parameter has a
string Category. In the List, there are 30 Parameters with 4 distinct
Category (Head, Neck, Ears and Throat). The list populates the
MainLongListSelector on the main page.
I have a _categorySelector (ListPicker) populated using :
_categorySelector.ItemsSource = App.ViewModel.Items.Select(m =>
m.Category).Distinct().ToList();
On the SelectionChanged event handler, I want to filter to
MainLongListSelector with the selected value of the ListPicker.
I have this so far, that doesn't work:
private void _categorySelector_SelectionChanged(object sender,
SelectionChangedEventArgs e)
{
var query = (from jj in App.ViewModel.Items
where (_categorySelector.SelectedItem as
Parameter).Category == jj.Category
select jj).ToList(); //doesn't work
var qq = App.ViewModel.Items.Select(mm => mm.Category).Distinct();
//doesn't connect selected item content to query
MainLongListSelector.ItemsSource = query;
}

Keyframe rules not working on firefox

Keyframe rules not working on firefox

Animations not working on firefox but working on chrome and IE. please
help Keyframe rules are set for moz @-moz-keyframes cf4FadeInOut the
problem is that all keyframes rules are set for webkit moz and -o- but
still not working.
http://jsfiddle.net/eVULR/1/
/* full image slider */
@-webkit-keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
@-moz-keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
@-o-keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
@keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
#cf4a
{
overflow:hidden;
position: fixed;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background-color:black;
}
#cf4a img
{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 50%;
min-height: 50%;
}
#cf4a img {
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
}
#page-wrap, #cf4a img:nth-of-type(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
z-index:4;
}
#page-wrap{
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-o-animation-delay: 3s;
animation-delay: 3s;
z-index:5;
}
#page-wrap1,#cf4a img:nth-of-type(2) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
z-index:3;
}
#page-wrap1{
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
z-index:3;
}
#page-wrap2,#cf4a img:nth-of-type(3) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-o-animation-delay: 8s;
animation-delay: 8s;
z-index:2;
}
#page-wrap2{
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
z-index:2;
}
#page-wrap,#cf4a img:nth-of-type(4) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
z-index:1;
}

sending mass email using java mail API

sending mass email using java mail API

I have a requirement of sending emails to approximately 15,000 email
addresses. Content of the email is same for all. I talked to my mail
server administrator and according to him I can send only 500 emails/
hour. I wrote an utility using java mail API to achieve this. I am
creating a connection(transport.connect()) and then reusing it. My utility
will be running for approx 30 hours to send all 15,000 emails. The
question I have "Is there any limit on number of emails being sent per
connection? And is there any time out issues I could run into? Should I
close the connection and get a new connection at some interval? like after
sending 100 emails or after 1 hour?"

Hide disqus features like rss and email

Hide disqus features like rss and email

How can you hide rss & email function on disqus? I don't wan't it to
display! Eventually delete the DISQUS logo too? PLEASE HELP!!! if you want
this is the link for disqus, http://disqus.com

Tomcat possible memory leak

Tomcat possible memory leak

The university I work at uses a Tomcat/Railo server to render ColdFusion
pages. For about 6 months (before I was hired) the servers have been
randomly crashing at different times, usually runnign service railo_ctl
restart has fixed hte issue, however lately this hasn't been working as
well.
Over the past two weeks I've narrowed the issue down, and I'm fairly sure
Tomcat where the issue is coming from. I've never used Tomcat, so I'm not
sure where to start. I have reviewed the Catalina.out files, and looked at
the time when the servers crashed and found this error message:
Sep 18, 2013 3:17:12 PM org.apache.catalina.core.StandardServer await.
INFO: A valid shutdown command was received via the shutdown port.
Stopping the Server instanc
Sep 18, 2013 3:17:12 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8888"]
Sep 18, 2013 3:17:13 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Sep 18, 2013 3:17:14 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Sep 18, 2013 3:17:19 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [] is still processing a request that has yet
to finish. This is very likely to create a memory leak. You can control
the time allowed for requests to finish by using the unloadDelay attribute
of the standard Context implementation.
This SEVERE error prints a probably 200 times
Sep 18, 2013 11:19:26 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8888"]
Sep 18, 2013 11:19:26 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Sep 18, 2013 11:19:26 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8888"]
Sep 18, 2013 11:19:26 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Sep 18, 2013 11:19:35 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path:
/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
I also noticed that this error came up, but it doesn't seem to pop up the
same time the servers crashed
Sep 18, 2013 11:06:39 AM org.apache.catalina.loader.WebappClassLoader
findResourceInternal
INFO: Illegal access: this web application instance has been stopped
already. Could not load
META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration.
The eventual following stack trace is caused by an error thrown for
debugging purposes as well as to attempt to terminate the thread which
caused the illegal access, and has no functional impact.
Sep 18, 2013 11:06:39 AM org.apache.catalina.loader.WebappClassLoader
loadClass
INFO: Illegal access: this web application instance has been stopped
already. Could not load
org.apache.xerces.parsers.XIncludeAwareParserConfiguration. The eventual
following stack trace is caused by an error thrown for debugging purposes
as well as to attempt to terminate the thread which caused the illegal
access, and has no functional impact.
java.lang.IllegalStateException
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1564)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.apache.xerces.parsers.ObjectFactory.findProviderClass(Unknown
Source)
at org.apache.xerces.parsers.ObjectFactory.newInstance(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(Unknown
Source)
at railo.runtime.text.xml.XMLUtil.setAttributeEL(XMLUtil.java:270)
at railo.runtime.text.xml.XMLUtil.parse(XMLUtil.java:221)
at railo.runtime.functions.decision.IsXML.call(IsXML.java:22)
at
content.feed.feedmanager_cfc$cf._2(/var/www/vhosts/my_web_app/requirements/mura/content/feed/feedManager.cfc:346)
at
content.feed.feedmanager_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/feed/feedManager.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
fsu.includes.display_objects.dsp_feed_cfm$cf.call(/var/www/vhosts/my_web_app/fsu/includes/display_objects/dsp_feed.cfm:132)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:799)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:746)
at
content.contentrenderer_cfc$cf._5(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc:956)
at
content.contentrenderer_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:738)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
content.contentrenderer_cfc$cf._5(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc:902)
at
content.contentrenderer_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:377)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774)
at
railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1495)
at
content.contentrenderer_cfc$cf._call000069(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc:1113)
at
content.contentrenderer_cfc$cf._5(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc:1113)
at
content.contentrenderer_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:738)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
formbuilder_21.eventhandlers.contentrenderer_cfm$cf.udfCall(/var/www/vhosts/my_web_app/plugins/FormBuilder_21/eventHandlers/contentRenderer.cfm:27)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:738)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
ldapsurvey_25.eventhandlers.contentrenderer_cfm$cf.udfCall(/var/www/vhosts/my_web_app/plugins/LDAPSurvey_25/eventHandlers/contentRenderer.cfm:73)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:721)
at
railo.runtime.util.VariableUtilImpl.callFunction(VariableUtilImpl.java:706)
at railo.runtime.interpreter.ref.func.UDFCall.getValue(UDFCall.java:52)
at
railo.runtime.interpreter.CFMLExpressionInterpreter.interpret(CFMLExpressionInterpreter.java:187)
at
railo.runtime.functions.dynamicEvaluation.Evaluate._call(Evaluate.java:76)
at
railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:69)
at
railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:22)
at
content.contentrenderer_cfc$cf._8(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc:1817)
at
content.contentrenderer_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:738)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
content.contentrenderer_cfc$cf._9(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc:2141)
at
content.contentrenderer_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
in_contexteditor_16135.incontexteditor.eventhandler_cfc$cf.udfCall(/var/www/vhosts/my_web_app/plugins/In-ContextEditor_16/inContextEditor/EventHandler.cfc:120)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:377)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:616)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at
railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1830)
at railo.runtime.tag.Invoke.doComponent(Invoke.java:210)
at railo.runtime.tag.Invoke.doEndTag(Invoke.java:183)
at
plugin.pluginmanager_cfc$cf._call000020(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginManager.cfc:1478)
at
plugin.pluginmanager_cfc$cf._3(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginManager.cfc:1391)
at
plugin.pluginmanager_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginManager.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:738)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
plugin.pluginmanager_cfc$cf._3(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginManager.cfc:1219)
at
plugin.pluginmanager_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginManager.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
content.contentrenderer_cfc$cf._6(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc:1268)
at
content.contentrenderer_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentRenderer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:377)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:616)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at
railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1830)
at railo.runtime.tag.Invoke.doComponent(Invoke.java:210)
at railo.runtime.tag.Invoke.doEndTag(Invoke.java:183)
at
murascope_cfc$cf._1(/var/www/vhosts/my_web_app/requirements/mura/MuraScope.cfc:110)
at
murascope_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/MuraScope.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl.onMissingMethod(ComponentImpl.java:539)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:504)
at
railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1834)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:769)
at
railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1495)
at
fsu.includes.themes.fsu.templates.default_cfm$cf.call(/var/www/vhosts/my_web_app/fsu/includes/themes/fsu/templates/default.cfm:109)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:799)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:746)
at
translator.standardhtmltranslator_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/Translator/standardHTMLTranslator.cfc:80)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:377)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:616)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at
railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1834)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:769)
at
railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1495)
at
plugin.pluginstandardeventwrapper_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginStandardEventWrapper.cfc:121)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
handler.standardeventshandler_cfc$cf._1(/var/www/vhosts/my_web_app/requirements/mura/Handler/standardEventsHandler.cfc:60)
at
handler.standardeventshandler_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/Handler/standardEventsHandler.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:377)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:616)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at
railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1830)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:755)
at
railo.runtime.util.VariableUtilImpl.callFunction(VariableUtilImpl.java:705)
at railo.runtime.interpreter.ref.func.UDFCall.getValue(UDFCall.java:52)
at
railo.runtime.interpreter.CFMLExpressionInterpreter.interpret(CFMLExpressionInterpreter.java:187)
at
railo.runtime.functions.dynamicEvaluation.Evaluate._call(Evaluate.java:76)
at
railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:69)
at
railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:22)
at
plugin.pluginstandardeventwrapper_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginStandardEventWrapper.cfc:84)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
handler.standardeventshandler_cfc$cf._2(/var/www/vhosts/my_web_app/requirements/mura/Handler/standardEventsHandler.cfc:311)
at
handler.standardeventshandler_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/Handler/standardEventsHandler.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:377)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:616)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at
railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1830)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:755)
at
railo.runtime.util.VariableUtilImpl.callFunction(VariableUtilImpl.java:705)
at railo.runtime.interpreter.ref.func.UDFCall.getValue(UDFCall.java:52)
at
railo.runtime.interpreter.CFMLExpressionInterpreter.interpret(CFMLExpressionInterpreter.java:187)
at
railo.runtime.functions.dynamicEvaluation.Evaluate._call(Evaluate.java:76)
at
railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:69)
at
railo.runtime.functions.dynamicEvaluation.Evaluate.call(Evaluate.java:22)
at
plugin.pluginstandardeventwrapper_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/plugin/pluginStandardEventWrapper.cfc:84)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
servlet_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/servlet.cfc:85)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
mura_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/Mura.cfc:84)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
content.contentserver_cfc$cf._1(/var/www/vhosts/my_web_app/requirements/mura/content/contentServer.cfc:225)
at
content.contentserver_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentServer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:738)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at
content.contentserver_cfc$cf._1(/var/www/vhosts/my_web_app/requirements/mura/content/contentServer.cfc:271)
at
content.contentserver_cfc$cf.udfCall(/var/www/vhosts/my_web_app/requirements/mura/content/contentServer.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:215)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:434)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:384)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:615)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:502)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1815)
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:733)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1480)
at index_cfm$cf.call(/var/www/vhosts/my_web_app/index.cfm:53)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:799)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:751)
at
railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:179)
at
railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:23)
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2035)
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2002)
at
railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:297)
at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Any thoughts or suggestions on this would be greatly appreciated.

Program prints an extra row with value 10 after each input

Program prints an extra row with value 10 after each input

I've got this simple program:
#include <stdio.h>
int main()
{
int c;
while ( ( c = getchar()) != EOF)
printf("%d %c\n", c, c);
return 1;
}
However for some reason when executing i get an extra value ten at the end:
a
97 a
10
b
98 b
10
abc
97 a
98 b
99 c
10
What is the value 10 and where does it come from? How do I stop it from
occurring?

Tomcat Server permission issue

Tomcat Server permission issue

I'm trying to deploy a simple Spring MVC app on a tomcat-hosting site. The
problem is that when I try to start the application I get the following
error:
19-set-2013 11.44.55 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet dispatcher
java.security.AccessControlException: access denied
(java.util.PropertyPermission * read,write)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1252)
at java.lang.System.getProperties(System.java:580)
at
org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:467)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:427)
at
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:341)
at
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
at
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:270)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:302)
at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:163)
at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:117)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1200)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at it.ilz.hostingjava.valves.AccessLogValve.invoke(AccessLogValve.java:531)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
it.ilz.hostingjava.valves.StartContextValve.invoke(StartContextValve.java:163)
at it.ilz.hostingjava.valves.DBLogValve.invoke(DBLogValve.java:84)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:448)
at
org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:399)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
at java.lang.Thread.run(Thread.java:662)
I know it's due to the policy restrictions imposed by the hosting service,
but I don't know how to solve this, how to modify the application (it's a
sample Spring MVC app you can download here) to work correctly.
Here are the permissions granted by the hosting file. Tomcat version is 6.
grant codebase "file:/home/hostingjava.it/" {
permission java.util.PropertyPermission "*", "read";
permission java.lang.RuntimePermission "getAttribute";
permission java.io.FilePermission "/home/hostingjava.it//-",
"read,write,delete";
permission java.lang.RuntimePermission
"accessClassInPackage.org.apache.tomcat.util.*";
}
Any idea?

Simple application to read username, password from mysql and displaying the next activity after verification

Simple application to read username, password from mysql and displaying
the next activity after verification

" In android i'm trying to read username and password from mysql database
and displaying the next window using the 'intent' " There are two
activities, the main activity and the userpage.class the first one will
verify the username and password and using the 'intent' it will call the
second 'userpage'
import package com.example.loginform;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity implements OnClickListener {
Button login;
EditText username,password;
TextView status;
HttpPost httppost;
StringBuffer buffer;
HttpResponse response;
HttpClient httpclient;
TextView tv;
List<NameValuePair> nameValuePairs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setup();
}
private void setup() {
// TODO Auto-generated method stub
username = (EditText) findViewById(R.id.username);
password = (EditText) findViewById(R.id.password);
login = (Button)findViewById(R.id.login);
status = (TextView)findViewById(R.id.tvstatus);
tv = (TextView)findViewById(R.id.editText1);
login.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch(arg0.getId())
{
case R.id.login:
login();
break;
}
}
private void login() {
// TODO Auto-generated method stub
try{
httpclient = new DefaultHttpClient();
httppost = new HttpPost("localhost/android/index.php");
nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new
BasicNameValuePair("username",username.getText().toString().trim()));
nameValuePairs.add(new
BasicNameValuePair("password",password.getText().toString().trim()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
response = httpclient.execute(httppost);
ResponseHandler<String>responseHandler = new
BasicResponseHandler();
final String response =
httpclient.execute(httppost,responseHandler);
tv.setText(""+response);
if(response.equalsIgnoreCase("User Found"))
{
startActivity(new Intent(this,UserPage.class));
}
}catch(Exception e)
{
e.printStackTrace();
Toast.makeText(getBaseContext(),"Sorry error in the
connection!!",Toast.LENGTH_SHORT).show();
}
}
}
Error log:
09-19 12:59:11.367: E/Trace(2634): error opening trace file: No such file
or directory (2)

Wednesday, 18 September 2013

Generate WSDL from WCF DataService implementing OData

Generate WSDL from WCF DataService implementing OData

I am currently creating WCF Dataservice by implementing OData. I am trying
to generate the WSDl file not working.
i have tried this one: http://dbn:80/Product.svc?wsdl
and i tried using wsdl.exe http://dbn:80/Product.svc got the error: The
document at http://dbn:80/Product.svc?wsdl was not recognised as a known
document type
Thank you

Moving Around A Canvas Without Using Scrollbars

Moving Around A Canvas Without Using Scrollbars

Background:
I have a program using Tkinter as the basis of the GUI. The program has a
canvas which is populated with a large number of objects. Currently, in
order to move all objects on the screen I am simply binding a movement
function to the tag 'all' which of course moves all objects on the screen.
However, it is vital for me to keep track of all canvas object positions-
i.e. after every move I log the new position, which seems unnecessarily
complicated.

Question:
What is the best way to effectively scroll/drag around the whole canvas
(several times the size of the screen) using only the mouse (not using
scrollbars)?

My Attempts:
Apologies if this is a trivial question, I have implemented scrollbars and
found several guides to setting up scrollbars, but none that deal with
this particular requirement.

Thank you for any help!

Example of disused scrollbar method:


from Tkinter import *
class Canvas_On:
def __init__(self, master):
self.master=master
self.master.title( "Example")
self.c=Canvas(self.master, width=find_res_width-20,
height=find_res_height, bg='black', scrollregion=(0,0,5000,5000))
horizontalbar=Scrollbar(self.master,orient=HORIZONTAL)
horizontalbar.pack(side=BOTTOM,fill=X)
horizontalbar.config(command=self.c.xview)
verticalbar=Scrollbar(self.master,orient=VERTICAL)
verticalbar.pack(side=RIGHT,fill=Y)
verticalbar.config(command=self.c.yview)
self.c.config(xscrollcommand=horizontalbar.set,
yscrollcommand=verticalbar.set)
self.c.pack(side=LEFT,expand=True,fill=BOTH)
draw=Drawing_Utility(self.c)
draw.drawer(self.c)
class Drawing_Utility:
def __init__(self, canvas):
self.canvas=canvas
self.canvas.focus_set()
def drawer(self, canvas):
self.canvas.create_oval(50,50,150,150, fill='orange')
self.canvas.create_oval(1000,1000,1100,1100, fill='orange')
root=Tk()
find_res_width=root.winfo_screenwidth()
find_res_height=root.winfo_screenheight()
run_it=Canvas_On(root)
root.mainloop()

Can I use AngularJS 'ng-view' in TideSDK 1.3.1beta?

Can I use AngularJS 'ng-view' in TideSDK 1.3.1beta?

I've got a simple TideSDK application going, using AngularJS. Works nicely.
Recently as I started adding features, I replaced my single ng-include
with ng-view and Angular routing. It works great in Chrome, but errors
galore in TideSDK.
Is it possible to use ng-view in an application built with TideSDK 1.3.1beta?

Attach CSV created with fputcsv to email

Attach CSV created with fputcsv to email

I have a function that compiles a custom CSV file using fputcsv. I also
have it email to an address submitted through a prior form via POST. I'm
sending headers so that way when the function is called, it just downloads
the CSV, but I'm unsure how to have it email AND attach the CSV, then
download the CSV.
Here is the entire function -
//SEND EMAIL
$emailTo = $_POST['$submitemail'];
$mailHeader = "From: **********r\n";
$mailHeader .= "Reply-To: ***********\r\n";
$mailHeader .= "MIME-Version: 1.0" . "\r\n";
$mailHeader .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$message = "Here is an email.... attach CSV too!";
$subject = "Email with text and CSV";
mail($emailTo, $subject, $message, $mailHeader);
//GATHER DATA
$user_ID = $id;
$query = "SELECT * FROM hours WHERE user_ID = '$user_ID' ORDER BY date ASC";
$query2 = "SELECT * FROM users WHERE ID = '$user_ID'";
$result = $db->query($query);
$result2 = $db->query($query2);
$row2 = $result2->fetch_object();
$full_name = $row2->full_name;
$organization = $row2->organization;
$importantstuff = array('Hours for - ' . $full_name, 'Site - ' .
$organization);
if (!$result) die('Couldn\'t fetch records');
$headers = $result->fetch_fields();
foreach($headers as $header) {
$head[] = ucfirst($header->name);
}
//START GENERATING CSV
$fp = fopen('php://output', 'w');
if ($fp && $result) {
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="report-'.
$full_name .'.csv"');
header('Pragma: no-cache');
header('Expires: 0');
fputcsv($fp, array_values($importantstuff));
fputcsv($fp, array_values($head));
while ($row = $result->fetch_array(MYSQLI_NUM)) {
$row[1] = $full_name;
fputcsv($fp, array_values($row));
}
die;
}
So, this is where I get a little lost because I am sending the headers
before I actually have the entire CSV created, hence I can't attach them
to an email before everything is done. I'm not sure how I would accomplish
both in the same function. Can I?

How to do wildcard bean mapping in Spring MVC?

How to do wildcard bean mapping in Spring MVC?

I'm trying to do RESTful URL mapping in Spring 2.5. This essentially
means: /fetch/(something) should all be matched to controller fetch
And the controller will do something according the parameter (something)
I add this to my spring config:
<bean id="fetchController" class="(package).fetchController"
scope="singleton"/>
<bean id="fetchService"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/fetch/*">fetchController</prop>
</props>
</property>
</bean>
and add the following to my web.xml
<servlet-mapping>
<servlet-name>springGlobal</servlet-name>
<url-pattern>/fetch/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>springGlobal</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
But this doesn't seem to be correct. The log says:
org.springframework.web.servlet.PageNotFound - No mapping found for HTTP
request with URI [/fetch/charts] in DispatcherServlet with name
'springGlobal'

Angular.js - re-open and add dependencies to an already bootstrapped application

Angular.js - re-open and add dependencies to an already bootstrapped
application

Is there a way to inject a late dependency to an already bootstrapped
angular module? Here's what I mean:
Say that I have a site-wide angular app, defined as:
// in app.js
var App = angular.module("App", []);
App.directive("fancy-table", ...)
And in every page:
<html ng-app="App">
Later on, I'm reopening the app to add logic based on the needs of the
current page:
// in reports.js
var App = angular.module("App")
App.controller("ReportsController", ['$scope', function($scope) {
// .. reports controller code
}])
Now, say that one of those on-demand bits of logic also requires their own
dependencies (like ngTouch, ngAnimate, ngResource, etc). How can I attach
them to the base App? This doesn't seem to work:
// in reports.js
var App = angular.module("App", ['ui.event', 'ngResource']); // <-- raise
error when App was already bootstrapped
I realize I can do everything in advance, i.e -
// in app.js
var App = angular.module("App", ['ui.event', 'ngResource', 'ngAnimate',
...]);
Or define every module on its own and then inject everything into the main
app (see here for more):
// in reports.js
angular.module("Reports", ['ui.event', 'ngResource'])
.controller("ReportsController", ['$scope', function($scope) {
// .. reports controller code
}])
// in home.js
angular.module("Home", ['ngAnimate'])
.controller("HomeController", ['$scope', '$http', function($scope, $http){
// ...
}])
// in app.js, loaded last into the page (different for every page that
varies in dependencies)
var App = angular.module("App", ['Reports', 'Home'])
But this will require I initialize the App everytime with the current
page's dependencies.
I prefer to include the basic app.js in every page and simply introduce
the required extensions to each page (reports.js, home.js, etc), without
having to revise the bootstrapping logic everytime I add or remove
something.
Is there a way to introduce dependencies when the App is already
bootstrapped? What is considered the idiomatic way (or ways) to do this?
I'm leaning towards the latter solution, but wanted to see if the way I
described could also be done. thanks.

Exposing CORBA Services as Web Services with Apache CXF?

Exposing CORBA Services as Web Services with Apache CXF?

With Axis2 you can expose a CORBA Service as Web Service as described in
the docs: http://axis.apache.org/axis2/java/core/docs/corba-deployer.html
Is this possible with CXF, too? There are Corba samples, but as I
understand, they are a Web Service clients that internally go to a Corba
Server, which is never exposed as Web Service, is it?
http://svn.apache.org/repos/asf/cxf/trunk/distribution/src/main/release/samples/corba/

How to get ns records that are registered to ip adress

How to get ns records that are registered to ip adress

I have ip ranges.
I would like to find ns records that are registered to ip adress
I'm looking for a command to do over nslookup or dig
Expected result
http://reports.internic.net/cgi/whois?whois_nic=70.84.87.146&type=nameserver
http://dnsquery.org/nswhois/85.17.137.148
How can I do that over nslookup or dig?
Or are there any solution to have such results

Tuesday, 17 September 2013

how to detect if FTP is working or not onremote machine?

how to detect if FTP is working or not onremote machine?

I have 3 machines(A, B & C) connected to a Router. A,B & C are in same
subnet. All these three machines are interconnected using STAF. I am using
machine A as an FTP server & machine B as an FTP client. Using STAF
command from machine C I am starting FTP program (TCL script) on machine
B.
Now the question is, How C will know whether FTP traffic is flowing
between A & B?

how to use bootstrap's modal dialog only, instead of the whole bootstrap.css to aviod conflicting with my own css

how to use bootstrap's modal dialog only, instead of the whole
bootstrap.css to aviod conflicting with my own css

how to use bootstrap's modal dialog only, instead of the whole
bootstrap.css to aviod conflicting with my own css.
I know maybe using fancybox is a better solution, but I just want the
bootstrap's modal window's style..

using and overloading a template member function of a base class?

using and overloading a template member function of a base class?

In the following, struct Y overloads X's member function f. Both overloads
are template functions, but take different arguments (typename and int),
to be explicitly specified:
struct X
{
template <typename> static bool f() { return true; }
};
struct Y : public X
{
using X::f;
template <int> static bool f() { return false; }
};
int main()
{
std::cout << Y::f <void>() << " " << Y::f <0>() << std::endl;
}
This prints 1 0 using gcc, as expected. However, clang (3.3) complains that
[...] error: no matching function for call to 'f'
std::cout << Y::f <void>() << " " << Y::f <0>() << std::endl;
^~~~~~~~~~~
[...] note: candidate template ignored: invalid explicitly-specified argument
for 1st template parameter
template <int> static bool f() { return false; }
^
i.e., can only see Y's version. I've tried
using X::template f;
instead, with no success. The same happens for non-static (template)
member functions. So is this a bug?

Adding callback to jquery .submit() to read error responses from uploads

Adding callback to jquery .submit() to read error responses from uploads

I've got an iframe #uploadTarget which I'm using for image uploads:
function uploadImage(){
if ($('#imageUploader').val().length > 0){
$('#uploadingIndicator').show();
// set form params such that it uploads image
$('#uploadForm').attr("action", uploadUrl);
$('#uploadForm').attr("enctype", "multipart/form-data");
$('#uploadForm').attr("target", 'uploadTarget');
// submit for image upload
$('#uploadForm').submit();
resetFormAttributes();
//console.log($('#uploadTarget').contents().find('body').text());
} else {
resetFormAttributes();
$('#uploadForm').submit();
}
}
When image upload is done, the page inside the iframe executes javascript
which calls doneUploading outside the iframe.
In the event where the file is too big or an error occurred and an error
page is displayed in the iframe, the doneUpload function is not called.
Is it possible to have some sort of a callback function that triggers
after $('#uploadForm').submit() completed (in which case I'll read the
page for error responses)?
If not, how would I read error responses being returned inside the iframe?

With a JS Regex matching exact word but not hypenated words starting with said word

With a JS Regex matching exact word but not hypenated words starting with
said word

I could not find a match to this question.
I have a string like so
var s="one two one-two one-three one one_for"
and my function is as follows
function replaceMatches( str, word )
{
var pattern=new RegExp( '\\b('+word+')\\b','g' )
return str.replace( pattern, '' )
}
the problem is if I run the function like
var problem=replaceMatches( s,'one' )
it
returns two -two -three one_four"
the function replaces every "one" like it should but treats words with a
hyphen as two words replacing the "one" before the hyphen.
My question is not about the function but about the regex. What literal
regex will match only the words "one" in my string and not "one-two" or
"one-\w"<--you know what I mean lol
basically
var pat=/\b(one)\b/g
"one one-two one".replace( pat, '')
only replace the exact match "one" and not the one in "one-two" the "one"
on the end is important to, the regex must work if the match is at the
very end Thank you, sorry if my question is relatively confusing. I am
just trying to get my learn on, and expand my personal library.

Specific PhpStorm and XAMPP configuration?

Specific PhpStorm and XAMPP configuration?

I want to move from Netbeans 7 to PhpStorm 6 (Windows7 x64) due to some
reasons but cannot arrange in the same 'netbeans' manner my configuration,
in which my source files live outside of htdocs folder of XAMPP and every
time I change sources I expect them to be immdediately uploaded to htdocs
for preview in browser at localhost. Up to this time I have seen only
those PhpStorm+XAMPP configurations, which define source folder inside of
c:\xampp\htdocs, which is not my preferred style, sorry. Articles I have
seen so far:
http://wiki.jetbrains.net/intellij/Installing_and_configuring_XAMPP ,
http://confluence.jetbrains.com/display/PhpStorm/Installing+and+Configuring+XAMPP+with+PhpStorm+IDE
, Setting up phpstorm 4 with XAMPP on Windows 7

Sunday, 15 September 2013

Prevent double submission of form using jQuery

Prevent double submission of form using jQuery

Problem:
I have a script where the user can press the keys C or M to choose an
option. Once either key is pressed the form will be submitted. Since there
is a strict rule that each option can be submitted once, some press
multiple times.
Question:
How can I prevent users from submitting the form again after they have
pressed the C or M key? I want them to be able to press either key once
the page refresh after submission.
Code in PHP / jQuery:
if (in_array($checkstring, $footer))
{
echo '
<script type="text/javascript">
$(document).ready(function()
{
$(window).keypress(function(e)
{
if (e.which == 99)
{
$("input#left").val( 1 );
$("form").submit();
}
else if (e.which == 109)
{
$("input#right").val( 1 );
$("form").submit();
}
});
'.$warning.'
});
</script>
';
}

Chess moving in Java

Chess moving in Java

for(y=0;y
grid[x][y]=new JButton(" ");
grid[x][y].addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
((JButton)e.getSource()).setBorder(border);;
System.out.println("Where do you want to move this piece");
}
});
grid[x][y].addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent r){
grid[x][y]=grid[x][y-1];
((JButton)r.getSource()).setBorder(border);;
System.out.println("Derp");
}
});
frame.add(grid[x][y]);
}
} I want to click a piece and then when you click a different square, the
piece will move up one. I know this is wrong and I will show the legal
moves but for right now I need to get the pieces moving. Please help!!
I want e(the JButton I originally selected) to go to r(the JButton that I
selected second)

How I can make a Sqlite Database in PC for use in my app?

How I can make a Sqlite Database in PC for use in my app?

Sorry for my english, i'm trying to improve it.
Im new in the Android develpment world but i know the basics.
My question is, How I can make a Sqlite Database in my PC for use in my app?
For example: I would like to make a table whit many names, second names,
adress, and fill those field in my pc for before use that database in my
app for find my contacts, for example. I want to make something like this
for another purpose.
Where should I start?