Thursday, 3 October 2013

Laravel setup failed to open stream

Laravel setup failed to open stream

I'm trying to setup laravel but its proving to be a right mere! I've
cloned it from github and also used composer to clone laravel and I've got
both of these techniques working which is good because its something I
really wanted to learn. Simpler than I thought.
However when I try to navigate to my laravel directory which is called
iProject so I type into my browser localhost/iProject I get a list of
directories which is not what I expected, I expected to be directed to at
least the hello.php page.
I've tired another technique as described in a Net-tuts tutorial which is
setting up a listening port and there I am then going through
localhost:8888, but when using this technique the following error message
appears:
Warning: Unknown: failed to open stream: No such file or directory in
Unknown on line 0
Fatal error: Unknown: Failed opening required 'public/'
include_path='.;C:\xampp\php\PEAR') in Unknown on line 0

Wednesday, 2 October 2013

Is it possible to pass a string from Java to JSP with Java Class?

Is it possible to pass a string from Java to JSP with Java Class?

Good Evening, I need to create a string (sql statement) which might be
pass to 2 or more jsp files. Recommended method is "by accessing the
ServletContext attributes via Java scriptlet or the applicationScope via
EL". But, is there a simple way to pass the string from java class to the
jsp? Something like below?
Java
public class SharedSQL extends HttpServlet{
public String example() {
String sqlstmt = "select ABC from ABC";
return sqlstmt;
}
}
JSP
<%
SharedSQL sqlStatement = new SharedSQL() ;
String sqlstmt = sqlStatement.example();
db4.query ( sqlstmt ) ;
%>
I am new to servlet/JSP 'things', need some hints and tips...Thanks in
advanced^^

Accessing data in nested arrays & objects with Go

Accessing data in nested arrays & objects with Go

I'm doing my best to unmarshall some json data into usable form in Go, but
can't seem to get it. The data is:
{
"series": [
{
"series_id": "PET.EMD_EPD2D_PTE_NUS_DPG.W",
"name": "U.S. No 2 Diesel Retail Prices, Weekly",
"units": "Dollars per Gallon",
"updated": "2013-09-27T07:21:57-0400",
"data": [
[
"20130923",
"3.949"
],
[
"20130916",
"3.974"
]
]
}
]
}
I'm trying to get the arrays under data into a variable, so I can loop
through them and do something like:
if data[i][0] == "20130923" {
fuelPrice.Price == data[i][1]
}
I'm definitely a beginner. Thanks for your time and effort.

File Image to Servlet Fails

File Image to Servlet Fails

I am trying to upload an image to a servlet, but every once and a while
during automated testing, it silently fails. It looks like the number of
bytes available to be read is zero.
Do you guys know what would cause this?
Here is the code:
List<FileItem> items = new ServletFileUpload(
new DiskFileItemFactory()).parseRequest(request);
Logger.log(LogLevel.INFO, "Upload contains "+items.size()+" items.");
int i=0;
for (FileItem item : items){
Logger.log(LogLevel.INFO, "\tItem "+(i++)+".
Name:\t"+item.getName()+", Type:\t"+item.getContentType());
// File is of type "file"
if (!item.isFormField())
{
InputStream inputStream = item.getInputStream();
if (inputStream.available()==0){
Logger.log(LogLevel.WARN, "Item shows file type, but no
bytes are available");
}
try {
image = ImageIO.read(inputStream);
if (image!=null){
break;
}
} catch (Exception e) {
Logger.log(LogLevel.ERROR, "There was an error reading the
image. "+ExceptionUtils.getFullStackTrace(e));
throw new InternalValidationException("imageSource",
"ImageInvalid",
"Image provided is not a valid image");
} finally {
IOUtils.closeQuietly(inputStream);
}
}
}
if (image == null) {
Logger.log(LogLevel.ERROR, "Image was supposedly read correctly,
but was null afterwards");
throw new InternalValidationException("imageSource",
"ImageInvalid",
"Image provided is not a valid image");
}
Here is the output:
2013/10/02 05-53-32,287::LOG:INFO[com.example#upload:L130 -- Upload
contains 2 items.]
2013/10/02 05-53-32,288::LOG:INFO[com.example#upload:L133 -- Item
0. Name: Dog.jpg, Type: application/octet-stream]
2013/10/02 05-53-32,288::LOG:WARN[com.example#upload:L140 -- Item shows
file type, but no bytes are available]
2013/10/02 05-53-32,289::LOG:INFO[com.example#upload:L133 -- Item
1. Name: null, Type: text/plain; charset=ISO-8859-1]
2013/10/02 05-53-32,290::LOG:ERROR[com.example#upload:L159 -- Image was
supposedly read correctly, but was null afterwards]

glutTimerFunc() callback function isn't executed if time threshold is under a certain number of msecs

glutTimerFunc() callback function isn't executed if time threshold is
under a certain number of msecs

I am working with an application which requires an engine to be executed
in the lowest amount of time as possible by a GLUT GUI using the
glutTimerFunc():
void SetGLUTTimer(void);
void callback(int value)
{
Engine* pEngine;
pEngine = (Engine*) value;
pEngine->Process();
pEngine->SetGLUTTimer();
}
void Engine::SetGLUTTimer(void)
{
glutTimerFunc(50, callback, (int)this);
}
bool Engine::Run(void)
{
if (m_pViewer != NULL)
m_pViewer->Run();
else
return false;
return true;
}
If I set the time threshold to 1000 msecs or more the engine callback will
be regularly called, while any other interval below a second (like in the
example above) will cause the GUI to run indefinitely never executing the
engine Process() function.

Tuesday, 1 October 2013

Sort PHP multidimensional array [Value1],[Value2]

Sort PHP multidimensional array [Value1],[Value2]

I have this Array:
[0] => Array
(
[video_id] => SimpleXMLElement Object
(
[0] => 75071886
)
[tags] => SimpleXMLElement Object
(
[0] => #20, MusicVideos
)
)
[1] => Array
(
[video_id] => SimpleXMLElement Object
(
[0] => 74212195
)
[tags] => SimpleXMLElement Object
(
[0] => #5, MusicVideos
)
)
[2] => Array
(
[video_id] => SimpleXMLElement Object
(
[0] => 37274070
)
[tags] => SimpleXMLElement Object
(
[0] => #9, MusicVideos
)
)
[3] => Array
(
[video_id] => SimpleXMLElement Object
(
[0] => 37277922
)
[tags] => SimpleXMLElement Object
(
[0] => #12, MusicVideos
)
)
Now I would like to sort this array by [tags] How do I do this this PHP?
Using the Online tool [Tags] use to order in my website by i want "#1",
"#2"
But i have one more than one [Tags] Like "#1" and "Category"
Thanks

R matrix and cooccurrence analysis

R matrix and cooccurrence analysis

I'm really newbie in R and I'd like to use it to carry out a co-occurrence
analysis of microbial taxa. I have a table like this (tab-separated) with
the relative abundance of taxa: Taxon Sample1 Sample2
Sample3.......Sample54 OTU1 0.2 0.005 0.009 0.12 OTU2 0.62..... OTU3 ....
OTU136
I'd like to obtain a Spearman's rank correlation matrix of the taxa and
then plot it in some nice graph. I'm supposed to have to convert my table
in matrix, before running the corr.test command, right?? So, I tryed to
convert it and it didn't give me any error, but when I tryed to tun the
corr.test, it says that the matrix is not numeric....
Can anyone help me to figure out how to do??
Thanks Francesca

Hosted 2008 SBS, DNS over Site to Site VPN Issues

Hosted 2008 SBS, DNS over Site to Site VPN Issues

Been having a little bit of a headache recently with DNS over site to site
VPN.
We have a SBS within a hosted environment and an RDS. The SBS is of course
hosting DNS for the internal domain. The office has all Domain
Workstations running Windows 7. All seems to run fine until DNS lookups
fail internally, I changed the SBS to have only 127.0.0.1 as primary DNS
(took out a public secondary) and changed the RDS to have only the
internal IP for SBS (again took out a public DNS secondary) and this seems
to have fixed the issue.
My question is why? My thoughts on DNS are:
Workstation - DNS Lookup - DNS Server replies with IP - Workstation can
find machine via IP
So how would changing IP address (secondary) on the Servers affect what
the workstations get as a reply from a DNS query?
Sorry hope this makes sense I tried my best not to waffle!
Thanks,
Charlie H

Requests masking server name / DAPPER-HOST-IP

Requests masking server name / DAPPER-HOST-IP

For the last few days, I've been having a lot of requests to unexisting
pages on my server.
The worrying part about it is that, when I look at the 404 error log I've
built for my site, these requests seem to mask my server name: when asking
for CGI.SERVER_NAME (that's ColdFusion's equivalent to PHP's
$_SERVER['SERVER_NAME']), it doesn't return my server name as expected,
but other external domain names (some of them from kind of "dodgy"
websites).
Having a look at apache's access log, all the requests follow the same
pattern:
[root@myserver]# grep DAPPER-HOST-IP access_log | head -n 1
XXX.XX.XXX.XX - - [30/Sep/2013:02:11:28 +0100] "GET
/page-completely-unrelated-to-my-website.cfm HTTP/1.1" 404 1826 "-"
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT
6.1)DAPPER-HOST-IP:YY.YYY.YY.YYY"
where XXX.XX.XXX.XX are always IPs of a certain search engine (which I'm
not especially keen on keeping). The user agent always have the string
"DAPPER-HOST-IP" and YY.YYY.YY.YYY is always a different random-ish IP,
unrelated to both my server and the above-mentioned search engine. I
suspect this IP has something to do with the server name masking issue.
The only action I've taken is to block some of the search engine's IP. I
hope this is enough, though I'm still worried about the fact that some
requests generated in my server appear as being originated from other
servers.
Any other suggestions would be appreciated. The only useful reference I've
found online up until now is:
http://www.webmasterworld.com/search_engine_spiders/4612980.htm

Monday, 30 September 2013

Intermittent DNS failures depending on user's DNS setings

Intermittent DNS failures depending on user's DNS setings

I manage a VPS which hosts a forum and recently we migrated from one
physical VPS host to another in the same company, with a downtime of about
48h and all configuration was made with cpanel full account backups.
Since then, our users reported intermittent DNS failures. Most of them
report things like normal behaviour from midnight until noon and DNS
failures from noon to midnight. They are also under corporate networks and
are unable to change their DNS server settings. (And I also believe that
solving this kind of problems by suggesting client-side settings changes
isn't an elegant solution for a large-ish website)
One of the moderators is experiencing this kind of error and sent me the
following dig output:
; <<>> DiG 9.7.0-P1 <<>> clubecetico.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56625
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;clubecetico.org. IN A
;; ANSWER SECTION:
clubecetico.org. 7246 IN A 193.164.133.22
;; AUTHORITY SECTION:
clubecetico.org. 70536 IN NS ns2.ns-serve.net.
clubecetico.org. 70536 IN NS ns1.ns-serve.net.
clubecetico.org. 70536 IN NS ns2.ns-service.de.
clubecetico.org. 70536 IN NS ns.ns-service.de.
;; ADDITIONAL SECTION:
ns.ns-service.de. 82917 IN A 194.126.239.242
ns1.ns-serve.net. 56831 IN A 193.254.189.162
ns2.ns-serve.net. 56831 IN A 83.243.59.34
ns2.ns-service.de. 82917 IN A 213.203.228.195
;; Query time: 744 msec
;; SERVER: 200.198.34.81#53(200.198.34.81)
;; WHEN: Fri Sep 20 16:20:53 2013
;; MSG SIZE rcvd: 209
Here, using google's 8.8.8.8 and 8.8.4.4 the error never occurs and the
output is
; <<>> DiG 9.9.3-P2 <<>> clubecetico.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8975
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;clubecetico.org. IN A
;; ANSWER SECTION:
clubecetico.org. 11061 IN A 193.164.133.22
;; AUTHORITY SECTION:
clubecetico.org. 34589 IN NS ns1.clubecetico.org.
clubecetico.org. 34589 IN NS ns2.clubecetico.org.
;; ADDITIONAL SECTION:
ns1.clubecetico.org. 19614 IN A 193.164.133.22
ns2.clubecetico.org. 34589 IN A 193.164.133.22
;; Query time: 16 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Sat Sep 28 13:56:36 BRT 2013
;; MSG SIZE rcvd: 128
The only DNS configuration I have access to is that the nameservers I
should use are ns1.clubecetico.org and ns2.clubecetico.org. In thecpanel`
DNS setup, I added an A record with the server's IP.
But I really think that there's something missing because I'm not sure if
the DNS client can query ns1.clubecetico.org to obtain the IP of
clubecetico.org.
I also have no idea where these ns-service.net come from and why some DNS
servers reply with them.
Is there any server-side thing I can do about this issue? Why do these
servers reply so differently?
Thanks in advance

Low wireless range on ubuntu 13.04

Low wireless range on ubuntu 13.04

I put ubuntu 13.04 on my Asus S300ca. The issue is with the wireless. The
range is much smaller than on windows. I have 10+ feet range from the
router on wireless, then on ubuntu I have about 3 feet before it becomes
unstable, 5 feet and it doesn't even see the router. Is there any way to
increase power to the card or increase the range of the card? Thank You.

if an oracle datafile gets too big for the directory what does one do

if an oracle datafile gets too big for the directory what does one do

if I have a datafile in a directory and it is getting too big for the
directory what command in Oracle can I use to move that file, or do I make
another datafile into another directory?
ALTER TABLESPACE
users
ADD DATAFILE
'/ora01/oracle/oradata/booktst_users_02.dbf'
size 100m

Live streaming with Jquery image slider

Live streaming with Jquery image slider

I am having a situation like how can I run a slideshow as live streaming.
Like if I have two screen at a time and both having same page of image
slider opens in the browser and when I click on the next or previous
button slide will change on both the screen simultaneously. Is there any
way to do that, If then please give me any suggestion how to do that.

Sunday, 29 September 2013

PHP Pear Mail not working

PHP Pear Mail not working

I have been able to use the PEAR package code on a godaddy server that has
PEAR installed and everything works as intended, however when I try to
execute the code on my local machine I receive no emails and no error
messages that gives me any indication of what is going wrong.
From what I have gathered from numerous sources on the web is that once I
have installed PEAR I need to setup the include_path in the "php.ini"
Also in the php.ini file I have added
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = myemail@gmail.com ****[Hidding real email address]****
PHP installation as followed:
php installation path c:\php
pear installation path c:\php\pear
php.ini include_path = ".;c:\php\pear"
Pear packages c:\php\pear - gathered from pear list
mail
mail_Mime
Net_SMTP
Net_Socket
PEAR
Any help on this matter will be greatly appreciated.

Binding a VB.net label.text to an object property

Binding a VB.net label.text to an object property

I want to have label in a form who's text value changes depending upon the
value of a instance of a class. It looks like I can bind the text value of
the label to an object dataSource. When I try this it does not seem to
work.
Me.Label4.DataBindings.Add(New System.Windows.Forms.Binding("Text",
Me.ItemInfoBindingSource, "ItemNumber", True,
System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
My itemInfoBindingSource:
Me.ItemInfoBindingSource.DataSource = GetType(CFP.ItemInfo)
and the class definition:
Public Class ItemInfo
Public Property ItemNumber As String = "rename"
Public Property Description As String
Public Property FileLocation As String
Public Property CompileHistory As List(Of CompileHistory)
End Class
I think what I have done is bind to a class not an instance of a class.
Thinking about it what I really want to do is bind an instance of a class
to a label...how? Is this possible?

Sockets ClassCastException HashMap

Sockets ClassCastException HashMap

I've created a serverSocket and accept a client connection. However when I
try to read from the client, it is throwing the following exception. If I
change HashMap to ArrayList, it does not work either.
Exception in thread "Thread-3" java.lang.ClassCastException:
java.awt.Point cannot be cast to java.util.HashMap
at ServerSide.Server.getPoints(Server.java:112)
at ServerSide.Server.run(Server.java:69)
//...
public void getPoints() throws IOException, ClassNotFoundException {
points = (HashMap<Point, Boolean>) objectInputStream.readObject();
Iterator iterator = points.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Point, Boolean> currentPoint = (Map.Entry<Point,
Boolean>) iterator.next();
currentPoint.setValue(firgure.isHit(currentPoint.getKey().x,
currentPoint.getKey().y));
}
objectOutputStream.writeObject(points);
}
P.s. Sorry for my English.

Left and Right Panel Navigation

Left and Right Panel Navigation

Im attempting to work on a jquery navigation. the navigation will be fixed
open on desktop but will close on mobile device and opened on request.
My aim.
1) left panel to open and push the body content aside when on mobile device.
2) right panel to do exact same but on right side too.
I have created the html but im cant seem to find a jquery solution.
any ideas?
Cheers
Paul
http://jsfiddle.net/x3Rpk/
<div id="leftnav"> click to close and open on mobile device</div>
<div id="main-content">content her</div>
<div id="rightnav"> click close and open on mobile device</div>

Saturday, 28 September 2013

Finish button not responding in Project Creation

Finish button not responding in Project Creation

I have ticket and filled all the necessary fields in the Project Creation
window, I am creating an Android Application Project and when I come to
the last screen of the project creation window, the finish button doesn't
do any thing and I am stuck inside the window, if I exit it, the project
remains empty and blank and when I restart Eclipse and retry nothing
happens yet again! I have even re-installed it several times and also
restarted my computer several times, but yet nothing happens! I don't even
get a bug notification, error message or project change inside the project
window! Nothing happens! Does any body know what my problem is and how I
can fix it ?!
Thank you!

Scalatra charset error

Scalatra charset error

I'm facing a charset encoding issue I cannot figure out how to resolve.
Here's what I'm doing:
I have a Scalatra Action calling a Apache Solr instance. The action in
Scalatra just opens a Strem on the Url where Solr responds, it takes the
output and prints it in the response
The response has invalid UTF-8 bytes
What do I miss?
The data in Solr's indexes are UTF-8 encoded: calling Solr directly from
Advanced Rest Client for Google Chrome I see everything is OK (I get a
utf-8 contentType response)
When reading the stream from Solr, I force UTF-8 decoding
val urlCon = url.openConnection()
Some(fromInputStream( urlCon.getInputStream, "utf8" ).getLines.mkString)
The Java options variable is ok (as defined in my project's sbt file)
declare -r default_jvm_opts="-Dfile.encoding=UTF8"
All my Eclipse project files are UTF-8 encoded
I force contentType to UTF-8 in the HTTP response
response.setCharacterEncoding("utf-8")
Here's the configuration of the software stack I'm running on:
Mac OS X Snow Leopard
Java 1.6.0_51
Apache Solr 4.3.0 deployed on Tomcat 7.0.41
Scalatra 2.2.1 using Scala 2.10.2, SBT 0.12.3, running on Jetty
8.1.8.v20121106
I'm quite sure the issue is in one of the software related to Scalatra
(Scalatra, SBT, Jetty, Scala) because as I told earlier, calling Solr
directly I see everything is correctly encoded.
Any idea?

Play Iteratee throttling

Play Iteratee throttling

I'm writing a streaming web radio framework using scala and Play. I'm
relying on Iteratees for the actual streaming, but I'm running into an
issue trying to prevent a greedy client from downloading data too quickly,
and consuming the stream for all the clients. To do so I've been trying to
create an Enumeratee that will throttle how quickly the Enumerator
produces data. Here's what my Enumeratee looks like
val throttlingIteratee = Iteratee.foldM[Array[Byte], Array[Byte]](new
Array[Byte](0)) {
(result, chunk) =>
val prom = Promise[Array[Byte]]()
timer.schedule(new TimerTask{
def run() = prom.success(result ++ chunk)
},1000)
prom.future
}
private val chunker = Enumeratee.grouped(
Traversable.take[Array[Byte]](31792) &>> throttlingIteratee
)
The idea is that I use the timer task to create a throttlingIteratee and
pair that with the Enumeratee.grouped function. This seems to work fairly
well, but I'm having trouble figuring out what value to use for the chunk
size. I want to have this produce chunks at about the same rate as the
audio plays. My audio file is encoded at 82kpbs, and I've tried to
calculate that in terms of bytes, but the values I come up with seem to be
too small, and the audio plays faster than the data is streamed.
My question is two fold. Is the basic approach I have in place a good one?
And if it is, how do I go about setting the chunk size in terms of the
audio file's bit rate.