How can I do the equivalent of the Ruby snippet below using Java?
require 'net/http'
res = Net::HTTP.get_response(URI.parse("http://somewhere.com/isalive")).body
in my portal i call a pdf file, path looks like
http://www.mysite.com/filespath/books/online_bliss_in_five_simple_steps_1339668056/live/online_dating_bliss_in_five_simple_steps_1339668056.php
for user acceptance i need to reduce this url. then i add a code in .htaccess file. after adding this line only a white page is displaying when i call my portal
the code is
RewriteEngine On
RewriteRule ^book/([A-Za-z0-9-]+_.)/?$ /live/$1.php [NC,L]
please help me
i have a problem about phpexcel and joomla. I'm developing some filter form to load excel reports, so i used phpexcel library to do this. Right now i have only a report, it works fine, but after that i upload inside joomla using PHP pages component that allows me to put php files inside joomla and call it.
When i put them, i change a little bit the form that calls the php that generates the excel report, i call the php using a link like this:
h**p://www.whiblix.com/index.php?option=com_php&Itemid=24
That is, calling it from Joomla, not directly the php. If i wanna call the php directly i could use this path:
h**p://www.whiblix.com/components/com_php/files/repImportaciones.php
What's the problem? The problem is, when i call the php that generates the excel through joomla, the excel that is downloaded is corrupt and only shows symbols in one cell when i open it. But if i call the php directly the report is generated fine. I could call the php directly, the problem is that if i call it directly i can't use this line of code:
defined( '_JEXEC' ) or die( 'Restricted access' );
That is used to deny the direct access to php from call it directly, because it doesn' work because the security.
Where's the problem? This is the code of php that generates the report (ommiting the code where generates the rows and cells):
<?php
//defined( '_JEXEC' ) or die( 'Restricted access' );
/** Error reporting */
error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
require_once 'Classes/PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set properties
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("Office 2007 XLSX Test Document")
->setSubject("Office 2007 XLSX Test Document")
->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
->setKeywords("office 2007 openxml php")
->setCategory("Test result file");
// Rename sheet
$objPHPExcel->getActiveSheet()->setTitle('Reporte de Importaciones');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="repPrueba.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
Hi! I need to post a status update of one of my facebook page when I create a model into my django project, but I don't know how to do it using the new facebook graph api:
http://github.com/facebook/python-sdk/blob/master/src/facebook.py
can you explain to me how to do it?
Thanks in advance :)
I followed Apple's example for creating a managed object which btw was great...
http://developer.apple.com/cocoa/coredatatutorial/index.html
However I now want to know what "name" (filename) the user saved his data as. Does anyone know how to pull the filename from the core data object.
something like this would be great...
NSLog (@"the filename is %@", [coreData filename]);
Any ideas?
I have the following page (http://www.workingstorage.com/Sample.htm) that has a footer that I can't make sit at the bottom of the page.
The CSS is inherited and befuddles me; I can't seem to change it properly to put a minimum height on the content or make the footer go to the bottom.
Hi i am developing an app for my QA department. I need to programically get how many phone numbers are there in the entire address book. No user input. Just click a button and then get how many phonenumbers are there in the ENTIRE addressbook.
Please email me at [email protected]
Given the following situation (UML below),
If Y has the method:
public void PrintWs();
and X has:
ArrayList <P> myPs = new ArrayList();
Y y = new Y();
Z z = new Z();
myPs.add(y);
myPs.add(z);
How do I loop through each myPs object and call all Ys PrintWs (without using instanceof)?
http://starbucks.mirror.waffleimages.com/files/68/68c26b815e913acd00307bf27bde534c0f1f8bfb.jpg
I have a print function on a page in my website. the problem is, when it hits this line:
<script type="text/javascript" src="http://cdn.powerreviews.com/repos/12564/pr/pwr/engine/js/full.js"></script>, it tries to load it, and just never finishes.
Any ideas on how to get around that?
I need to set a cookie in IE to execute some specific flow. I tried using the following code
ieb = Watir::IE.new
ieb.document.cookie="rememberme=foobar;Path=/; Domain=sometestdomain.com"
# Bring up browser and do bunch of stuff
However, I see that when the IE comes up, rememberme cookie is not set. Am I doing something wrong here?
Posting a video on tumblr.com allows you to just paste the URL of the video on youtube, vimeo, whatever and tumblr automatically does the embedding for you.
I assume that this would be nothing more than a mapping between an URL-regex and the belonging HTML construct for embedding the video. Or it is just parsing the response of the URL and getting the construct from there.
Is there already any utility, preferably in Java, for doing this? If not, how would you do it?
I am trying to use facebook API and some functions/objects used in tutorials are NOT defined in facebook.php (downloaded from github.com).
Am I so silly or is there some other think I should know?
Thanks for help,
Roman
You can get a list of friends of an authenticated user with:
https://graph.facebook.com/me/friends
Anyone have any idea how to order the list by user name? Because it doesn't by default. There's nothing in the documentation.
How to trasfer a file greater than 100mb using spring mvc.
I have been through the post http://stackoverflow.com/questions/214888/how-to-handle-100mb-uploads-for-users, that tells to use ftp api. But want to know an alternative with springs.
While i'm sure i can write a CRON to do this and some how open the ports on a network hd in my house, to be honest i'd rather spend a bit of money on some good software with a nice visual interface!
are there any such all-in-one server backup systems?
nightly backups of the MYSQL db
weekly backups of entire site (images etc)
my server is a VPS hosted by https://www.memset.com.
I am using CodeProject's well known Open Session in View to handle NHibernate Sessions. Does it works well with Level 2 Cache? Anyone has succeeded doing it? Should I use NH.Burrow instead? Any advice on l2 cache in asp.net best practices is appreciated.
Edit: link to CodeProject's article: http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
I have compiled and jarred the various projects in my Java application, generating serialVersionUIDs automatically through Eclipse for all my classes derived from Serializable.
I read the answers to this question, and verified that serialVersionUids are all private static final long.
Nevertheless, I get an error like this when I try to run:
java.io.InvalidClassException: com.acme.product.Widget; local class
incompatible: stream classdesc serialVersionUID = 5226096973188250357, local
class serialVersionUID = -5432967318654384362
What am I missing?
Hello,
I'd like an input to control that :
jQuery.ajax({
type: "get",
dataType: "jsonp",
url: "http://www.foo.com/something.php",
data: {numberInput: "NUMBER I WANT TO CONTROL" },
On the HTML side I've
<input type="text" id="jqueryControl" />
I want when a user enters a number into the jqueryControl to insert it in the .ajax function and reload the data according to the new value entered.
Any idea to do that please ?
Thanks
I would like it to display non-flickery animation like this awesome Linux command; sl
http://www.youtube.com/watch?v=9GyMZKWjcYU
I would appreciate a small & stupid example of say ... a fly.
Thanks!
I currently have a PHP form that uses AJAX to connect to MySQL and display records matching a user's selection (http://stackoverflow.com/questions/2593317/ajax-display-mysql-data-with-value-from-multiple-select-boxes)
As well as displaying the data, I also place an 'Edit' button next to each result which displays a form where the data can be edited. My problem is editing unique records since currently I only use the selected values for 'name' and 'age' to find the record. If two (or more) records share the same name and age, I am only able to edit the first result.
Hey all,
I'm trying to make a system call in Python and store the output to a string that I can manipulate in the Python program.
#!/usr/bin/python
import subprocess
p = subprocess.Popen("pwd")
# edit - actual command I want to store output of
p2 = subprocess.Popen("ntpq -p")
I've tried a few things including some of the suggestions here:
http://stackoverflow.com/questions/1996518/retrieving-the-output-of-subprocess-call
but without any luck.
Many thanks!
I have multiple image galleries that use the following code (simply view the demo at the following link).
http://www.sohtanaka.com/web-design/fancy-thumbnail-hover-effect-w-jquery/
However, when one clicks on the thumbnails of one gallery to change the large image preview - all the galleries change automatically to that large preview as well.
In short, the question is:
"How do I seperate each gallery from each other so when the user clicks on the thumbnails of one specific gallery the large image preview of that gallery changes and not any other?"