python consecutive urllib2 POST gives 404
The problem that I have - and try to solve with Python - is to make
consecutive POST requests (completing an online form) for a website
(specifically, a free online demo of an api at
demo.travelportuniversalapi.com). I am not able to acquire the results
page so far - been at this for two days now.
The code I employ is:
import sys
import urllib, urllib2, cookielib
from BeautifulSoup import BeautifulSoup
import re
class website:
def __init__(self):
self.host = 'demo.travelportuniversalapi.com'
self.ua = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0)
Gecko/20100101 Firefox/23.0'
self.session = cookielib.CookieJar() #session devine o
instanta a obiectului cookielib
pass
def get(self):
try:
url =
'http://demo.travelportuniversalapi.com/(S(cexfuhghvlzyzx5n0ysesra1))/Search'
#this varies every 20 minutes
data = None
headers = {'User-Agent': self.ua}
request = urllib2.Request(url, data, headers)
self.session.add_cookie_header(request)
response = urllib2.urlopen(request)
self.session.extract_cookies(response, request)
url = response.geturl()
data = {'From': 'lhr', 'To': 'ams', 'Departure' :
'9/4/2013','Return' : '9/6/2013'}
headers = {'User-Agent': self.ua, "Content-type":
"application/x-www-form-urlencoded; charset=UTF-8",
}
request = urllib2.Request(url, urllib.urlencode(data),
headers, 20)
self.session.add_cookie_header(request)
response = urllib2.urlopen(request, timeout=30) #HTTP
Error 404: Not Found - aici am eroare
self.session.extract_cookies(response, request)
except urllib2.URLError as e:
print >> sys.stderr, e
return None
rt = website()
rt.get()
The error that i receive at the last urllib2.Request is HTTP Error 404:
Not Found. I am not sure my cookies are working. Monitoring HTTP packets
with an addon in the browser I noticed the following header when the POST
is sent in a broswer: 'X-Requested-With XMLHttpRequest' - is this
relevant?
Thank you, Regards, Nicoara
Saturday, 31 August 2013
UnauthorizedAccessException Accessing XSD In Windows Store App
UnauthorizedAccessException Accessing XSD In Windows Store App
My Windows Store app uses the FileOpenPicker to allow the user to browse
to an XML document. I can open the XML document as a stream and load it
with XDocument.Load([stream]).
But now, as I parse the XML document, I want to process schema
declarations that I find. I want to open a referenced XSD and parse it,
too, using an XDocument. The referenced XSD is in the same folder as the
main XML document. How do I open the referenced XSD? If I try to access it
by its full path name, an UnauthorizedAccessException object is thrown. I
don't want to use the FileOpenPicker again and force the user to select
the XSD ... that would make for a bad UI. I know where the XSD is ... it's
with the XML.
So how do I call XDocument.Load() on the referenced XSD without an
UnauthorizedAccessException object being thrown?
My Windows Store app uses the FileOpenPicker to allow the user to browse
to an XML document. I can open the XML document as a stream and load it
with XDocument.Load([stream]).
But now, as I parse the XML document, I want to process schema
declarations that I find. I want to open a referenced XSD and parse it,
too, using an XDocument. The referenced XSD is in the same folder as the
main XML document. How do I open the referenced XSD? If I try to access it
by its full path name, an UnauthorizedAccessException object is thrown. I
don't want to use the FileOpenPicker again and force the user to select
the XSD ... that would make for a bad UI. I know where the XSD is ... it's
with the XML.
So how do I call XDocument.Load() on the referenced XSD without an
UnauthorizedAccessException object being thrown?
PDO not inserting - what's wrong..?
PDO not inserting - what's wrong..?
I'm stumped as to why it's not inserting into the database...
PHP Code:
$insert_user = $db->prepare("INSERT INTO `users(`deposit_address`,
`date_assigned`) VALUES (:deposit_address, :date_assigned)");
$insert_user->execute(array(':deposit_address' =>
$_SESSION['deposit_address'], ':date_assigned'=> time() ));
I did a var_dump and it returned:
object(PDOStatement)#3 (1) { ["queryString"]=> string(96) "INSERT INTO
`users(`deposit_address`, `date_assigned`) VALUES (:deposit_address,
:date_assigned)" }
I'm stumped as to why it's not inserting into the database...
PHP Code:
$insert_user = $db->prepare("INSERT INTO `users(`deposit_address`,
`date_assigned`) VALUES (:deposit_address, :date_assigned)");
$insert_user->execute(array(':deposit_address' =>
$_SESSION['deposit_address'], ':date_assigned'=> time() ));
I did a var_dump and it returned:
object(PDOStatement)#3 (1) { ["queryString"]=> string(96) "INSERT INTO
`users(`deposit_address`, `date_assigned`) VALUES (:deposit_address,
:date_assigned)" }
Can't get QT 5.1.1 working on OS X 10.6.8
Can't get QT 5.1.1 working on OS X 10.6.8
System Info
I am running Mac OS X 10.6.8 and I have XCode 3.2.5 installed.
Running which gcc outputs /usr/bin/gcc
What I've Tried
I've tried installing qt using both the offline and online installers:
qt-mac-opensource-1.4.0-2-x86_64-online.dmg
qt-mac-opensource-5.1.1-clang-offline.dmg
However in the middle of Installing component Essential modules, both of
these give me the following errors (no matter how many times I hit Retry):
Error during installation process (qt.511.clang_64.essentials):
Command install_name_tool failed.
Arguments: -change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQuickTest.framework/Versions/5/QtQuickTest
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQuickTest.framework/Versions/5/QtQuickTest
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtWidgets.framework/Versions/5/QtWidgets
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtGui.framework/Versions/5/QtGui
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtGui.framework/Versions/5/QtGui
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtCore.framework/Versions/5/QtCore
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQml.framework/Versions/5/QtQml
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQml.framework/Versions/5/QtQml
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/bin/qmltestrunner
Output:
And during Installing component Add-On modules, I get the errors:
Error during installation process (qt.511.clang_64.addons):
Command install_name_tool failed.
Arguments: -change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQuickTest.framework/Versions/5/QtQuickTest
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQuickTest.framework/Versions/5/QtQuickTest
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtWidgets.framework/Versions/5/QtWidgets
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtGui.framework/Versions/5/QtGui
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtGui.framework/Versions/5/QtGui
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtCore.framework/Versions/5/QtCore
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQml.framework/Versions/5/QtQml
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQml.framework/Versions/5/QtQml
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/bin/qmltestrunner
Output:
After hitting Ignore on both, the installation continues fine, but then I
try using Qt Creator and get the following message under Preferences: Qt
version is not properly installed, please run make install
After installation, running which qmake outputs
/usr/local/qt/5.1.1/5.1.1/clang_64/bin/qmake
System Info
I am running Mac OS X 10.6.8 and I have XCode 3.2.5 installed.
Running which gcc outputs /usr/bin/gcc
What I've Tried
I've tried installing qt using both the offline and online installers:
qt-mac-opensource-1.4.0-2-x86_64-online.dmg
qt-mac-opensource-5.1.1-clang-offline.dmg
However in the middle of Installing component Essential modules, both of
these give me the following errors (no matter how many times I hit Retry):
Error during installation process (qt.511.clang_64.essentials):
Command install_name_tool failed.
Arguments: -change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQuickTest.framework/Versions/5/QtQuickTest
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQuickTest.framework/Versions/5/QtQuickTest
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtWidgets.framework/Versions/5/QtWidgets
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtGui.framework/Versions/5/QtGui
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtGui.framework/Versions/5/QtGui
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtCore.framework/Versions/5/QtCore
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQml.framework/Versions/5/QtQml
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQml.framework/Versions/5/QtQml
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/bin/qmltestrunner
Output:
And during Installing component Add-On modules, I get the errors:
Error during installation process (qt.511.clang_64.addons):
Command install_name_tool failed.
Arguments: -change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQuickTest.framework/Versions/5/QtQuickTest
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQuickTest.framework/Versions/5/QtQuickTest
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtWidgets.framework/Versions/5/QtWidgets
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtGui.framework/Versions/5/QtGui
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtGui.framework/Versions/5/QtGui
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtCore.framework/Versions/5/QtCore
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtQml.framework/Versions/5/QtQml
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtQml.framework/Versions/5/QtQml
-change
/Users/bld.qt/bamboo-agent-home/xml-data/build-dir/DQTC-LGPLRELEASEBUILD510-OSX106/______________________________PADDING______________________________/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork
/usr/local/qt/5.1.1/5.1.1/clang_64/bin/qmltestrunner
Output:
After hitting Ignore on both, the installation continues fine, but then I
try using Qt Creator and get the following message under Preferences: Qt
version is not properly installed, please run make install
After installation, running which qmake outputs
/usr/local/qt/5.1.1/5.1.1/clang_64/bin/qmake
C Programming - Reading from stdin and storing \n and whitespace
C Programming - Reading from stdin and storing \n and whitespace
I've been trying to use scanf to get input from stdin but it truncates the
string after seeing whitespace or after hitting return.
What I'm trying to get is a way to read keyboard input that stores in the
buffer linebreaks as well as whitespace. And ending when ctrl-D is
pressed.
Should I try using fgets? I figured that wouldn't be optimal either since
fgets returns after reading in a \n
I've been trying to use scanf to get input from stdin but it truncates the
string after seeing whitespace or after hitting return.
What I'm trying to get is a way to read keyboard input that stores in the
buffer linebreaks as well as whitespace. And ending when ctrl-D is
pressed.
Should I try using fgets? I figured that wouldn't be optimal either since
fgets returns after reading in a \n
Code igniter routes making internal server error
Code igniter routes making internal server error
Been stuck on this for hours, hope it is not something to simple.
So I'm trying to route 3 vars from one URL to another with this code:
$route['activate_email/(:any)/(:any)/(:any)'] = "user/activate/$1/$2/$3";
and the user controller code:
public function activate($code='', $email='', $id=''){
die("1");
//Check vars
if(empty($code) || empty($email) || empty($id) ||
!is_numeric(ceil($id))){
die("BAD");
}
//Check details in DB
$result = $this->db->query("SELECT * FROM `companies` WHERE `id` = ?",
array($id))->result_array();
print_r($result);
exit;
}
Thanks for any help
Been stuck on this for hours, hope it is not something to simple.
So I'm trying to route 3 vars from one URL to another with this code:
$route['activate_email/(:any)/(:any)/(:any)'] = "user/activate/$1/$2/$3";
and the user controller code:
public function activate($code='', $email='', $id=''){
die("1");
//Check vars
if(empty($code) || empty($email) || empty($id) ||
!is_numeric(ceil($id))){
die("BAD");
}
//Check details in DB
$result = $this->db->query("SELECT * FROM `companies` WHERE `id` = ?",
array($id))->result_array();
print_r($result);
exit;
}
Thanks for any help
Friday, 30 August 2013
Draggable no longer working after content made dynamic
Draggable no longer working after content made dynamic
I'm new to JQuery and I broke my draggable/droppable functionality after
the content moved to an AJAX call.
When I had the HTML table with the data loaded on page load, everything
worked fine. Now that I'm injecting it with AJAX, that functionality has
stopped working.
Can someone please tell me what I need to do to get this working with
everything being dynamic?
I'm new to JQuery and I broke my draggable/droppable functionality after
the content moved to an AJAX call.
When I had the HTML table with the data loaded on page load, everything
worked fine. Now that I'm injecting it with AJAX, that functionality has
stopped working.
Can someone please tell me what I need to do to get this working with
everything being dynamic?
Combined ISetProperty
Combined ISetProperty
Question
Is there a way to combine to ISetProperties together to get observable
flat superset implementing ISetProperty again?
Context
My model often looks like:
Parent
\Children
\Grandchildren
Being an EMF model it has ISetProperty for Children and Grandchildren of a
single Child.
I want to following GUI representations of the model.
A list of all Gradchildren for a Parent:
GrandchildA
GrandchildB
GrandchildC
GrandchildD
GrandchildE
A table of all Parents with a column containing all unique Grandchildren
Parent1 GrandchildA,GrandchildB
Parent2 GrandchildC,GrandchildD
Parent3 GrandchildE
Both should handle model updates.
Databinding
Jface dataproviders for these usecases have different interfaces and
implementations, model differ in details, so I've thought databinding will
help me to abstract over these.
For the first case it would be very nice to use
ObservableSetContentProvider if there was a way to get ISetProperty for
all Grandchildren for Parent.
For second case ColumnLabelProvider could create an IObservableSet to
watch Grandchildren of each parent in a similar way.
Question
Is there a way to combine to ISetProperties together to get observable
flat superset implementing ISetProperty again?
Context
My model often looks like:
Parent
\Children
\Grandchildren
Being an EMF model it has ISetProperty for Children and Grandchildren of a
single Child.
I want to following GUI representations of the model.
A list of all Gradchildren for a Parent:
GrandchildA
GrandchildB
GrandchildC
GrandchildD
GrandchildE
A table of all Parents with a column containing all unique Grandchildren
Parent1 GrandchildA,GrandchildB
Parent2 GrandchildC,GrandchildD
Parent3 GrandchildE
Both should handle model updates.
Databinding
Jface dataproviders for these usecases have different interfaces and
implementations, model differ in details, so I've thought databinding will
help me to abstract over these.
For the first case it would be very nice to use
ObservableSetContentProvider if there was a way to get ISetProperty for
all Grandchildren for Parent.
For second case ColumnLabelProvider could create an IObservableSet to
watch Grandchildren of each parent in a similar way.
Thursday, 29 August 2013
error: initializer expression list treated as compound expression
error: initializer expression list treated as compound expression
I'm having trouble finding a solution to this error.. I have tried
everything I could think of and looks at a number of examples on the web.
But I'm still stuck!
Thanks
error: initializer expression list treated as compound expression
unsigned char mbuffer[16];
int bcd_encode(32768UL, &mbuffer[0], 4); <---- error is on this line
-------------------------------------------------
/* Encode the input number into BCD into the output buffer, of
* the specified length. The BCD encoded number is right-justified
* in the field. Return the number of digits converted, or -1 if the
* buffer was not big enough for the whole conversion.
*/
int bcd_encode(unsigned long number, unsigned char *cbuffer, int length)
{
unsigned char *p;
unsigned char n, m, bval, digit;
n = 0; /* nibble count */
m = 0; /* converted digit count */
bval = 0; /* the bcd encoded value */
/* Start from the righthand end of the buffer and work
* backwards
*/
p = cbuffer + length - 1;
while (p >= cbuffer) {
if (number != 0) {
digit = number % 10;
number = number / 10;
m++;
} else
digit = 0;
/* If we have an odd-numbered digit position
* then save the byte and move to the next buffer
* position. Otherwise go convert another digit
*/
if (n & 1) {
bval |= digit << 4;
*p-- = bval;
bval = 0;
} else
bval = digit;
n++;
}
/* If number is not zero, then we have run out of room
* and the conversion didn't fit. Return -1;
*/
if (number)
return(-1);
/* return the number of converted digits
*/
return(m);
}
I'm having trouble finding a solution to this error.. I have tried
everything I could think of and looks at a number of examples on the web.
But I'm still stuck!
Thanks
error: initializer expression list treated as compound expression
unsigned char mbuffer[16];
int bcd_encode(32768UL, &mbuffer[0], 4); <---- error is on this line
-------------------------------------------------
/* Encode the input number into BCD into the output buffer, of
* the specified length. The BCD encoded number is right-justified
* in the field. Return the number of digits converted, or -1 if the
* buffer was not big enough for the whole conversion.
*/
int bcd_encode(unsigned long number, unsigned char *cbuffer, int length)
{
unsigned char *p;
unsigned char n, m, bval, digit;
n = 0; /* nibble count */
m = 0; /* converted digit count */
bval = 0; /* the bcd encoded value */
/* Start from the righthand end of the buffer and work
* backwards
*/
p = cbuffer + length - 1;
while (p >= cbuffer) {
if (number != 0) {
digit = number % 10;
number = number / 10;
m++;
} else
digit = 0;
/* If we have an odd-numbered digit position
* then save the byte and move to the next buffer
* position. Otherwise go convert another digit
*/
if (n & 1) {
bval |= digit << 4;
*p-- = bval;
bval = 0;
} else
bval = digit;
n++;
}
/* If number is not zero, then we have run out of room
* and the conversion didn't fit. Return -1;
*/
if (number)
return(-1);
/* return the number of converted digits
*/
return(m);
}
Entity Framework/Database First Build takes forever
Entity Framework/Database First Build takes forever
i am using: Visual Studio 2012 Entity Framework 5
I created my model from an Oracle Database with 1000 Tables. All of these
are in one big edmx-file. (Not a good idea, i know, but at the moment no
other way).
The problem is building the project. In VS the build takes 20 minutes (!).
VS is unresponsive for that time. After that suddenly the report shows up
in Output. Compiling the same project with MSBuild takes 4 seconds...
I could not find anything on the web on why this is happening. Any help
much appreciated.
i am using: Visual Studio 2012 Entity Framework 5
I created my model from an Oracle Database with 1000 Tables. All of these
are in one big edmx-file. (Not a good idea, i know, but at the moment no
other way).
The problem is building the project. In VS the build takes 20 minutes (!).
VS is unresponsive for that time. After that suddenly the report shows up
in Output. Compiling the same project with MSBuild takes 4 seconds...
I could not find anything on the web on why this is happening. Any help
much appreciated.
Wednesday, 28 August 2013
Powershell: Force immediate evaluation of backreference during replace
Powershell: Force immediate evaluation of backreference during replace
I am running into an error where I am concatenating strings together to
obtain the field I want replaced.
Below is an example of what my script is doing:
$TEXTTOREPLACEWITH= '6Q'
(Get-Content testfile.html) | ForEach-Object { $_ -replace
'(.)\$(STRINGTOREPLACE)(.)', ('$1' +$TEXTTOREPLACEWITH+'$2')
If I ran this against a file that had a line input as follows:
abc$(STRINGTOREPLACE)xyz
I would expect the following output:
abc6Qxyz
Instead, When I run this script the output looks as follows:
$16Qxyz
I'm assuming this is due to the fact that backreferences must not be
resolved until string concatentation is complete. Is there any way in
powershell to go ahead and resolve these backreferences immediately and
avoid the output that I am seeing?
Thanks,
Josh
I am running into an error where I am concatenating strings together to
obtain the field I want replaced.
Below is an example of what my script is doing:
$TEXTTOREPLACEWITH= '6Q'
(Get-Content testfile.html) | ForEach-Object { $_ -replace
'(.)\$(STRINGTOREPLACE)(.)', ('$1' +$TEXTTOREPLACEWITH+'$2')
If I ran this against a file that had a line input as follows:
abc$(STRINGTOREPLACE)xyz
I would expect the following output:
abc6Qxyz
Instead, When I run this script the output looks as follows:
$16Qxyz
I'm assuming this is due to the fact that backreferences must not be
resolved until string concatentation is complete. Is there any way in
powershell to go ahead and resolve these backreferences immediately and
avoid the output that I am seeing?
Thanks,
Josh
401 No Cert Chain error with Two-Way SSL
401 No Cert Chain error with Two-Way SSL
I've been tasked with replacing the current username/password-based login
on our application with a two-way SSL handshake to identify the user on
JBoss AS 7.11. I am stuck with a "401 no cert chain" error that occurs
whenever an attempt is made to access a secured resource. I'm using my own
self-certified key as the root ca, and the server has a key that is
certified by my root ca. The user would also be certified by my root ca,
but the failure occurs before I have a chance to present their cert to the
server.
This is what I'm trying to accomplish: User goes to index.html (which is
not secure), clicks on a link. Link leads to test.html (which in web.xml,
is secured by CLIENT-CERT).
401 error occurs after clicking the link, but before selecting the cert to
present.
The dump from my keystore is as follows (with some elements scrubbed):
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: localhost
Creation date: Aug 28, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 2
Certificate[1]:
Owner: CN=localhost, OU=SRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Issuer: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Serial number: SCRUBBED
Valid from: SCRUBBED until: SCRUBBED
Certificate fingerprints:
MD5: 57:B9:8D:3F:28:A0:C7:B7:1B:8B:38:B9:F9:A3:26:FF
SHA1: EF:A3:51:BB:54:81:11:CF:91:B1:E9:93:5A:2E:43:F7:50:19:6B:5D
Signature algorithm name: SHA1withRSA
Version: 1
Certificate[2]:
Owner: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=Ohio, C=US
Issuer: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=Ohio, C=US
Serial number: e8a494cce4d26b5f
Valid from: SCRUBBED until: SCRUBBED
Certificate fingerprints:
MD5: 31:48:E3:D4:21:38:FE:85:A2:06:A9:2C:84:43:1C:E7
SHA1: 34:D8:A0:13:BE:02:A7:1E:56:B7:28:E7:C1:9E:1B:63:26:65:92:92
Signature algorithm name: SHA1withRSA
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:true
PathLen:2147483647
]
#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
*******************************************
*******************************************
This is the dump from my truststore:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: root
Creation date: Aug 28, 2013
Entry type: trustedCertEntry
Owner: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Issuer: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Serial number: SCRUBBED
Valid from: SCRUBBED until: SCRUBBED
Certificate fingerprints:
MD5: 31:48:E3:D4:21:38:FE:85:A2:06:A9:2C:84:43:1C:E7
SHA1: 34:D8:A0:13:BE:02:A7:1E:56:B7:28:E7:C1:9E:1B:63:26:65:92:92
Signature algorithm name: SHA1withRSA
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:true
PathLen:2147483647
]
#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
*******************************************
*******************************************
Web.xml:
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>other</realm-name>
</login-config>
And finally, here are the relevant parts of my standalone.xml
<server xmlns="urn:jboss:domain:1.2">
<profile>
...
<subsystem>
<security-domains>
<security-domain name="other" cache-type="default">
<authentication>
...
<!-- login-modules, including BaseCertLoginModule>
...
</authentication>
<jsse keystore-password="mypass"
keystore-url="../standalone/configuration/keystore.jks"
truststore-password="mypass"
truststore-url="../standalone/configuration/truststore.jks"/>
...
</security-domains>
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:web:1.1"
default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http"
socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https"
socket-binding="https" secure="true">
<ssl name="ssl" key-alias="localhost"
password="mypass"
certificate-key-file="../standalone/configuration/keystore.jks"
verify-client="true"
ca-certificate-file="../standalone/configuration/truststore.jks"
ca-certificate-password="mypass" keystore-type="jks"
truststore-type="jks"/>
</connector>
...
</subsystem>
...
</profile>
...
</server>
Why am I getting a 401 No Client Certificate Chain error? I suspect an
issue involving the cert in my server keys, but the chain seems to be
present.
I've been tasked with replacing the current username/password-based login
on our application with a two-way SSL handshake to identify the user on
JBoss AS 7.11. I am stuck with a "401 no cert chain" error that occurs
whenever an attempt is made to access a secured resource. I'm using my own
self-certified key as the root ca, and the server has a key that is
certified by my root ca. The user would also be certified by my root ca,
but the failure occurs before I have a chance to present their cert to the
server.
This is what I'm trying to accomplish: User goes to index.html (which is
not secure), clicks on a link. Link leads to test.html (which in web.xml,
is secured by CLIENT-CERT).
401 error occurs after clicking the link, but before selecting the cert to
present.
The dump from my keystore is as follows (with some elements scrubbed):
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: localhost
Creation date: Aug 28, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 2
Certificate[1]:
Owner: CN=localhost, OU=SRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Issuer: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Serial number: SCRUBBED
Valid from: SCRUBBED until: SCRUBBED
Certificate fingerprints:
MD5: 57:B9:8D:3F:28:A0:C7:B7:1B:8B:38:B9:F9:A3:26:FF
SHA1: EF:A3:51:BB:54:81:11:CF:91:B1:E9:93:5A:2E:43:F7:50:19:6B:5D
Signature algorithm name: SHA1withRSA
Version: 1
Certificate[2]:
Owner: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=Ohio, C=US
Issuer: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=Ohio, C=US
Serial number: e8a494cce4d26b5f
Valid from: SCRUBBED until: SCRUBBED
Certificate fingerprints:
MD5: 31:48:E3:D4:21:38:FE:85:A2:06:A9:2C:84:43:1C:E7
SHA1: 34:D8:A0:13:BE:02:A7:1E:56:B7:28:E7:C1:9E:1B:63:26:65:92:92
Signature algorithm name: SHA1withRSA
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:true
PathLen:2147483647
]
#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
*******************************************
*******************************************
This is the dump from my truststore:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: root
Creation date: Aug 28, 2013
Entry type: trustedCertEntry
Owner: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Issuer: CN=Root Key, OU=SCRUBBED, O=SCRUBBED, L=SCRUBBED, ST=SCRUBBED, C=US
Serial number: SCRUBBED
Valid from: SCRUBBED until: SCRUBBED
Certificate fingerprints:
MD5: 31:48:E3:D4:21:38:FE:85:A2:06:A9:2C:84:43:1C:E7
SHA1: 34:D8:A0:13:BE:02:A7:1E:56:B7:28:E7:C1:9E:1B:63:26:65:92:92
Signature algorithm name: SHA1withRSA
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:true
PathLen:2147483647
]
#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
SCRUBBED
]
]
*******************************************
*******************************************
Web.xml:
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>other</realm-name>
</login-config>
And finally, here are the relevant parts of my standalone.xml
<server xmlns="urn:jboss:domain:1.2">
<profile>
...
<subsystem>
<security-domains>
<security-domain name="other" cache-type="default">
<authentication>
...
<!-- login-modules, including BaseCertLoginModule>
...
</authentication>
<jsse keystore-password="mypass"
keystore-url="../standalone/configuration/keystore.jks"
truststore-password="mypass"
truststore-url="../standalone/configuration/truststore.jks"/>
...
</security-domains>
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:web:1.1"
default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http"
socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https"
socket-binding="https" secure="true">
<ssl name="ssl" key-alias="localhost"
password="mypass"
certificate-key-file="../standalone/configuration/keystore.jks"
verify-client="true"
ca-certificate-file="../standalone/configuration/truststore.jks"
ca-certificate-password="mypass" keystore-type="jks"
truststore-type="jks"/>
</connector>
...
</subsystem>
...
</profile>
...
</server>
Why am I getting a 401 No Client Certificate Chain error? I suspect an
issue involving the cert in my server keys, but the chain seems to be
present.
Can I add cookie with Spring SockJs websocket implementation
Can I add cookie with Spring SockJs websocket implementation
Can I add custom cookies over websocket in Spring SockJS implementation?
The way we can add it with http request/ response?
Forget to mention that I see way to read cookie from headers ::
HttpHeaders headers= session.getHandshakeHeaders(); -But I do not see a
way to set headers. With headers I can read the cookies -but how to set
it?
Can I add custom cookies over websocket in Spring SockJS implementation?
The way we can add it with http request/ response?
Forget to mention that I see way to read cookie from headers ::
HttpHeaders headers= session.getHandshakeHeaders(); -But I do not see a
way to set headers. With headers I can read the cookies -but how to set
it?
hadoop fs -put command
hadoop fs -put command
I have constructed a signal-node Hadoop environment on CentOS using the
Cloudera CDH repository.When I want to copy a local file to HDFS,I used
the command:
sudo -u hdfs hadoop fs -put /root/MyHadoop/file1.txt /
But,the result depressed me:
put: '/root/MyHadoop/file1.txt': No such file or directory
I'm sure this file does exits.Please help me,Thanks!
I have constructed a signal-node Hadoop environment on CentOS using the
Cloudera CDH repository.When I want to copy a local file to HDFS,I used
the command:
sudo -u hdfs hadoop fs -put /root/MyHadoop/file1.txt /
But,the result depressed me:
put: '/root/MyHadoop/file1.txt': No such file or directory
I'm sure this file does exits.Please help me,Thanks!
Joomla PHP Page Fully Controllable Through Joomla Administration Tool
Joomla PHP Page Fully Controllable Through Joomla Administration Tool
I have a xml data which holds football match results fixtures etc. I have
created xsl files in order to display them on our joomla pages without any
problem. Now we try to achieve creating new pop-ups whenever a match score
is clicked. So a user can click any match's score and track them on new
windows. I would implement such a system with php easily but important
thing is those new match view pages should be fully modifiable through
joomla administration page (I guess it is called Poweradmin). In my case
whenever you click on match score a new php page is openining which is
completely independent of Joomla since as far as I know you can not create
any php page on joomla.
Since I am completely new to joomla, I don't know If I better programm a
new component for joomla or add the modules into this match view window by
iframe. Any approach would be appreciated.
I have a xml data which holds football match results fixtures etc. I have
created xsl files in order to display them on our joomla pages without any
problem. Now we try to achieve creating new pop-ups whenever a match score
is clicked. So a user can click any match's score and track them on new
windows. I would implement such a system with php easily but important
thing is those new match view pages should be fully modifiable through
joomla administration page (I guess it is called Poweradmin). In my case
whenever you click on match score a new php page is openining which is
completely independent of Joomla since as far as I know you can not create
any php page on joomla.
Since I am completely new to joomla, I don't know If I better programm a
new component for joomla or add the modules into this match view window by
iframe. Any approach would be appreciated.
Tuesday, 27 August 2013
Issues with CanCan authorization - Author edits Post
Issues with CanCan authorization - Author edits Post
I'm working on a Rails app, authorization using CanCan. The app has the db
models User and PositionGameStat. The PositionGameStat has a foreign key
of user_id. The index page for position_game_stat shows a list of Stats
that the user has submitted, each one with an edit button. Currently it is
vulnerable to injection (... /position_game_stats/130/edit)
I would like the user to only be able to edit position_game_stat entries
equal to current user.
In other words if someone tried to inject into the url
.../position_game_stats/129/edit and they did not enter those stats, it
would be denied access by CanCan
Below is my code.
My Code: app/controllers/position_game_stats_controller.rb
class PositionGameStatsController < ApplicationController
before_filter :authenticate_user!
...
def edit
authorize! :manage, @position_game_stat
@position_game_stat = PositionGameStat.find(params[:id])
end
...
end
app/models/ability.rb
class Ability
include CanCan::Ability
def initialize(user)
can :show, User, :id => user.id
can :manage, PositionGameStat do |t|
t.user_id == user.id
end
end
end
Any suggestions are well appreciated.
I'm working on a Rails app, authorization using CanCan. The app has the db
models User and PositionGameStat. The PositionGameStat has a foreign key
of user_id. The index page for position_game_stat shows a list of Stats
that the user has submitted, each one with an edit button. Currently it is
vulnerable to injection (... /position_game_stats/130/edit)
I would like the user to only be able to edit position_game_stat entries
equal to current user.
In other words if someone tried to inject into the url
.../position_game_stats/129/edit and they did not enter those stats, it
would be denied access by CanCan
Below is my code.
My Code: app/controllers/position_game_stats_controller.rb
class PositionGameStatsController < ApplicationController
before_filter :authenticate_user!
...
def edit
authorize! :manage, @position_game_stat
@position_game_stat = PositionGameStat.find(params[:id])
end
...
end
app/models/ability.rb
class Ability
include CanCan::Ability
def initialize(user)
can :show, User, :id => user.id
can :manage, PositionGameStat do |t|
t.user_id == user.id
end
end
end
Any suggestions are well appreciated.
NEON intrinsic types work in C but throw invalid arguments error in C++
NEON intrinsic types work in C but throw invalid arguments error in C++
I have problems with using NEON intrinsics and inline assembly in Android
NDK.
NEON types like float32x4_t give an "invalid arguments" error when
compiling C++ code with GCC 4.6 and 4.8, however, the code compiles fine
if compiled as C.
For example, here's some code:
inline float32x4_t VectorAdd(float32x4_t a, float32x4_t b)
{
return vaddq_f32(a, b);
}
I get two errors here:
In the function itself: Invalid arguments ' Candidates are: ? vmlaq_f32(?,
?, ?) '.
Where the function is called: Invalid arguments ' Candidates are: ?
VectorAdd(?, ?) '.
All NEON types are displayed as ? in the error message, while non-NEON
types are displayed correctly.
What is also strange is that functions which only use NEON types as return
values (for example, vld1q_f32 and my abstract wrapper of it) don't suffer
from the error.
I tried the same code in GCC Explorer 4.6 and 4.5, and there is no error,
and correct and optimized assembly is generated, however, it doesn't work
with Android NDK.
I have problems with using NEON intrinsics and inline assembly in Android
NDK.
NEON types like float32x4_t give an "invalid arguments" error when
compiling C++ code with GCC 4.6 and 4.8, however, the code compiles fine
if compiled as C.
For example, here's some code:
inline float32x4_t VectorAdd(float32x4_t a, float32x4_t b)
{
return vaddq_f32(a, b);
}
I get two errors here:
In the function itself: Invalid arguments ' Candidates are: ? vmlaq_f32(?,
?, ?) '.
Where the function is called: Invalid arguments ' Candidates are: ?
VectorAdd(?, ?) '.
All NEON types are displayed as ? in the error message, while non-NEON
types are displayed correctly.
What is also strange is that functions which only use NEON types as return
values (for example, vld1q_f32 and my abstract wrapper of it) don't suffer
from the error.
I tried the same code in GCC Explorer 4.6 and 4.5, and there is no error,
and correct and optimized assembly is generated, however, it doesn't work
with Android NDK.
Default clause before case sections in the switch statement
Default clause before case sections in the switch statement
Found this in linux/kernel/signal.c
switch (_NSIG_WORDS) {
default:
for (i = 1; i < _NSIG_WORDS; ++i) {
x = *++s &~ *++m;
if (!x)
continue;
sig = ffz(~x) + i*_NSIG_BPW + 1;
break;
}
break;
case 2:
x = s[1] &~ m[1];
if (!x)
break;
sig = ffz(~x) + _NSIG_BPW + 1;
break;
case 1:
/* Nothing to do */
break;
}
Maybe this is not quite good example, but I can't understand how it works
and what prompted Linus to put default-section at front of switch
statement.
Found this in linux/kernel/signal.c
switch (_NSIG_WORDS) {
default:
for (i = 1; i < _NSIG_WORDS; ++i) {
x = *++s &~ *++m;
if (!x)
continue;
sig = ffz(~x) + i*_NSIG_BPW + 1;
break;
}
break;
case 2:
x = s[1] &~ m[1];
if (!x)
break;
sig = ffz(~x) + _NSIG_BPW + 1;
break;
case 1:
/* Nothing to do */
break;
}
Maybe this is not quite good example, but I can't understand how it works
and what prompted Linus to put default-section at front of switch
statement.
any tool/script to import a file listing / directory structure into a relational database?
any tool/script to import a file listing / directory structure into a
relational database?
...along with some basic metadata like dates and sizes
Should work on windows, otherwise DB and platform/language does not matter
much.
Just need it to do some analysis on structure/space usage, and although I
can and earlier have scripted stuff like this, I do not have the time now
:-)
relational database?
...along with some basic metadata like dates and sizes
Should work on windows, otherwise DB and platform/language does not matter
much.
Just need it to do some analysis on structure/space usage, and although I
can and earlier have scripted stuff like this, I do not have the time now
:-)
regex string contains max one '#'
regex string contains max one '#'
Need regex to match strings by pattern exclude if '#' more then 1 times in
string
var srg = new RegExp(/([a-z0-9#]+[\s])/g);
Strings:
fdsffmsd,fmsd
qwjswkds03sj
ewew
rfekwjkr#jfkdlsf
wiru0ksd#erjk#jkls
#
casdw##kfdl
Result
fdsffmsd,fmsd
qwjswkds03sj
ewew
rfekwjkr#jfkdlsf
wiru0ksd#erjk#jkls
#
casdw##kfdl
Fiddle
Thanks
Need regex to match strings by pattern exclude if '#' more then 1 times in
string
var srg = new RegExp(/([a-z0-9#]+[\s])/g);
Strings:
fdsffmsd,fmsd
qwjswkds03sj
ewew
rfekwjkr#jfkdlsf
wiru0ksd#erjk#jkls
#
casdw##kfdl
Result
fdsffmsd,fmsd
qwjswkds03sj
ewew
rfekwjkr#jfkdlsf
wiru0ksd#erjk#jkls
#
casdw##kfdl
Fiddle
Thanks
Excel Conditional Formatting if one column equal to another
Excel Conditional Formatting if one column equal to another
This should be the simplest example of conditional formatting but I can't
figure it out. I havave two columns seperated by several dozen other
columns ('C'-original data, 'BO'- calculated value) and I need to
highlight the calculated value if it is not equal to the original value. I
can do this on a cell by cell basis but can't see how to apply it to a
whole column withoug adding a rule for every row (there are many 1000s of
rows).
What am I missing?
This should be the simplest example of conditional formatting but I can't
figure it out. I havave two columns seperated by several dozen other
columns ('C'-original data, 'BO'- calculated value) and I need to
highlight the calculated value if it is not equal to the original value. I
can do this on a cell by cell basis but can't see how to apply it to a
whole column withoug adding a rule for every row (there are many 1000s of
rows).
What am I missing?
Monday, 26 August 2013
CSS3 transition doesn't work in Firefox, Safari and IE
CSS3 transition doesn't work in Firefox, Safari and IE
I was playing with image swap hover effect with CSS3 transitions.
Unfortunately, it only works in Chrome. I have seen lots of examples from
CSS3 transition that works flawless in Chrome, Firefox and Safari, but not
this time... :( Where is the problem?
http://jsfiddle.net/kYZ9Y/
.logo {
float: left;
z-index: 1;
width: 325px;
height: 73px;
background: url(../img/logo.png) no-repeat;
position: absolute;
-moz-transition: all .4s ease;
-webkit-transition: all .4s ease;
-ms-transition: all .4s ease;
-o-transition: all .4s ease;
transition: all .4s ease;
}
.logo:hover {
z-index: 2;
opacity: 1;
background: url(../img/logo1.png) no-repeat;
}
Cheers!
I was playing with image swap hover effect with CSS3 transitions.
Unfortunately, it only works in Chrome. I have seen lots of examples from
CSS3 transition that works flawless in Chrome, Firefox and Safari, but not
this time... :( Where is the problem?
http://jsfiddle.net/kYZ9Y/
.logo {
float: left;
z-index: 1;
width: 325px;
height: 73px;
background: url(../img/logo.png) no-repeat;
position: absolute;
-moz-transition: all .4s ease;
-webkit-transition: all .4s ease;
-ms-transition: all .4s ease;
-o-transition: all .4s ease;
transition: all .4s ease;
}
.logo:hover {
z-index: 2;
opacity: 1;
background: url(../img/logo1.png) no-repeat;
}
Cheers!
Echo two $variables without space?
Echo two $variables without space?
I got a text file [list_of_files.txt] contaning list of files without
extension e.g.
image_23.
image_24.
image_25.
I'm using POST method to add a single word to all of the lines e.g "jpg"
and display the results:
image_23.jpg
image_24.jpg
image_25.jpg
The problem is that echo displays:
image_23. jpg
image_24. jpg
image_25. jpg
How i can remove spaces?
$files=file('list_of_files.txt');
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
foreach($files as $list)
{
$extension = $_POST['extension'];
echo "$list",$exstension,"";
echo "</div>";
}
}else{
?>
I got a text file [list_of_files.txt] contaning list of files without
extension e.g.
image_23.
image_24.
image_25.
I'm using POST method to add a single word to all of the lines e.g "jpg"
and display the results:
image_23.jpg
image_24.jpg
image_25.jpg
The problem is that echo displays:
image_23. jpg
image_24. jpg
image_25. jpg
How i can remove spaces?
$files=file('list_of_files.txt');
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
foreach($files as $list)
{
$extension = $_POST['extension'];
echo "$list",$exstension,"";
echo "</div>";
}
}else{
?>
Cannot link my twitter posts to my Facebook business page
Cannot link my twitter posts to my Facebook business page
I have set up a new account and added a business page. When logged in to
the business page I searched the twitter app and logged in to Twitter. I
allowed twitter account to post to Facebook. I can only see the tweets
though in the main Facebook account, not in the business page feed where I
want them. HELP?
I have set up a new account and added a business page. When logged in to
the business page I searched the twitter app and logged in to Twitter. I
allowed twitter account to post to Facebook. I can only see the tweets
though in the main Facebook account, not in the business page feed where I
want them. HELP?
Set visual studio to not remember opened files?
Set visual studio to not remember opened files?
I have a particular legacy project that crashes the first time I load it
every time. It's something about the main aspx file that causes it, but I
can't remember to close that file every time before closing the solution.
After loading the solution the first time, VS locks up and crashes.
Launching it a second time, I get a message saying the project could not
be loaded previously and to see the log for details. The log says
something about the file not opening and just opens the project with no
documents open. I can then open the files I need without problem.
So the question is, is there a setting somewhere to open projects without
opening any files automatically? I've scoured the settings and can't find
anything. Perhaps an extension that does something similar?
I have a particular legacy project that crashes the first time I load it
every time. It's something about the main aspx file that causes it, but I
can't remember to close that file every time before closing the solution.
After loading the solution the first time, VS locks up and crashes.
Launching it a second time, I get a message saying the project could not
be loaded previously and to see the log for details. The log says
something about the file not opening and just opens the project with no
documents open. I can then open the files I need without problem.
So the question is, is there a setting somewhere to open projects without
opening any files automatically? I've scoured the settings and can't find
anything. Perhaps an extension that does something similar?
Colorbox html from a function
Colorbox html from a function
i have a html code
<html>
<body>
<div id="bag">CLICK ME</div>
</body>
</html>
<script type="text/javascript">
$("#bag").click(function{
$.colorbox({html:function(){alert("HELLO")}});
});
</script>
When i click on CLICK ME, alert pop up comes 2 times rather it should come
only once. Please tell me
i have a html code
<html>
<body>
<div id="bag">CLICK ME</div>
</body>
</html>
<script type="text/javascript">
$("#bag").click(function{
$.colorbox({html:function(){alert("HELLO")}});
});
</script>
When i click on CLICK ME, alert pop up comes 2 times rather it should come
only once. Please tell me
pancake sorting using decrease and conquer
pancake sorting using decrease and conquer
Please help me to solve my problem. This is one of our case studies.
Here's my code and I dont know what's the error here. It doesn't sort all
the pancakes according to their sizes. the largest one should be at the
bottom place or at the last position in array. Here's my code.
package pancake;
import java.io.*;
import java.util.*;
import static pancake.Pancake.processStack;
public class Pancake
{
public static void main (String args[]) // entry point from OS
{
Scanner s, ls;
int pancakes[] = new int[300];
int k;
s = new Scanner(System.in); // create new input Scanner
while(s.hasNextLine()) /* While there's more data to process... */
{
/* Read the integers */
ls = new Scanner(s.nextLine());
k = 0;
while (ls.hasNextInt())
pancakes[k++] = ls.nextInt();
processStack(pancakes, k);
}
}
public static void processStack(int pancakes[], int L)
{
int bottom, max_so_far, index, i, j, k;
/* Print out the stack again */
System.out.print("Flip sequence: ");
for (bottom = L-1; bottom > 0; bottom--)
{ /* First, find a maximum of the
substack of elements
pancakes[0], pancakes[bottom]*/
index = bottom;
max_so_far = pancakes[bottom];
for (i = bottom - 1; i >= 0; i--)
if (pancakes[i] > max_so_far)
{
max_so_far = pancakes[i];
index = i;
}
/* Now, if we have to flip anything... */
if (index != bottom)
{
if (index != 0) /* if we have to flip something
other than the one on top */
System.out.print( (index+1) + " ");
/* then we flip this one */
System.out.print( (bottom+1) + " ");
/* Now construct the new stack. Note that I'm
not explicitly performing the flip(s) that
would be performed, but am directly
constructing it by copying portions of
the stack of pancakes.
If you carefully study what I'm doing here,
you should be able to follow along and see
that it's correct, i.e., that I end up with
the stack that would be present after performing
the one or two flips to bring the next
largest pancake into position.
*/
int temp[] = new int[L];
j = 0;
for (i = bottom; i > index; i--, j++)
temp[j] = pancakes[i];
for (i = 0; i < index; i++, j++)
temp[j] = pancakes[i];
temp[j++] = pancakes[index];
/* Having constructed the new (top) portion,
insert it back into the array for the next
time through the loop.
*/
for (i = 0; i <= bottom; i++)
pancakes[i] = temp[i];
} /* end of performing the next flip(s), if
necessary */
}
System.out.println`enter code here`();
}
}
Please help me to solve my problem. This is one of our case studies.
Here's my code and I dont know what's the error here. It doesn't sort all
the pancakes according to their sizes. the largest one should be at the
bottom place or at the last position in array. Here's my code.
package pancake;
import java.io.*;
import java.util.*;
import static pancake.Pancake.processStack;
public class Pancake
{
public static void main (String args[]) // entry point from OS
{
Scanner s, ls;
int pancakes[] = new int[300];
int k;
s = new Scanner(System.in); // create new input Scanner
while(s.hasNextLine()) /* While there's more data to process... */
{
/* Read the integers */
ls = new Scanner(s.nextLine());
k = 0;
while (ls.hasNextInt())
pancakes[k++] = ls.nextInt();
processStack(pancakes, k);
}
}
public static void processStack(int pancakes[], int L)
{
int bottom, max_so_far, index, i, j, k;
/* Print out the stack again */
System.out.print("Flip sequence: ");
for (bottom = L-1; bottom > 0; bottom--)
{ /* First, find a maximum of the
substack of elements
pancakes[0], pancakes[bottom]*/
index = bottom;
max_so_far = pancakes[bottom];
for (i = bottom - 1; i >= 0; i--)
if (pancakes[i] > max_so_far)
{
max_so_far = pancakes[i];
index = i;
}
/* Now, if we have to flip anything... */
if (index != bottom)
{
if (index != 0) /* if we have to flip something
other than the one on top */
System.out.print( (index+1) + " ");
/* then we flip this one */
System.out.print( (bottom+1) + " ");
/* Now construct the new stack. Note that I'm
not explicitly performing the flip(s) that
would be performed, but am directly
constructing it by copying portions of
the stack of pancakes.
If you carefully study what I'm doing here,
you should be able to follow along and see
that it's correct, i.e., that I end up with
the stack that would be present after performing
the one or two flips to bring the next
largest pancake into position.
*/
int temp[] = new int[L];
j = 0;
for (i = bottom; i > index; i--, j++)
temp[j] = pancakes[i];
for (i = 0; i < index; i++, j++)
temp[j] = pancakes[i];
temp[j++] = pancakes[index];
/* Having constructed the new (top) portion,
insert it back into the array for the next
time through the loop.
*/
for (i = 0; i <= bottom; i++)
pancakes[i] = temp[i];
} /* end of performing the next flip(s), if
necessary */
}
System.out.println`enter code here`();
}
}
get xml node with most of childrens SimpleXMLObject
get xml node with most of childrens SimpleXMLObject
With the following snippet I retrieve nodes from xml with php simple xml
object feed than on a given parent I retrieve the first sub-element and I
convert it to array. My problem: I want to get that sub-element which has
the most of children in the hole XML object and than the targeted should
be converted to array
/*
* Retrive XML Nodes from Feed
*
*/
public function getXMLNodes() {
$xml = simplexml_load_file($this->config[0]->link);
switch (strtolower($this->config[0]->affiliate)) {
case 'case1':
$nodes = $xml->product[0]; //here stead of first object I
should get that one which has most of chlidren
break;
case 'case2':
$nodes = $xml->productItems->productItem[0];
break;
default :
break;
}
$nodes = $this->xml2array($nodes);
return $nodes;
}
/*
* Convert Simple XML Object to array
*
* @xml SimpleXMLObject
*
*/
function xml2array($xml) {
$arr = array();
foreach ($xml as $element) {
$tag = $element->getName();
$e = get_object_vars($element);
if (!empty($e)) {
$arr[$tag] = $element instanceof SimpleXMLElement ?
$this->xml2array($element) : $e;
} else {
$arr[$tag] = trim($element);
}
}
return $arr;
}
example XML //in this case the second has the most of childrens
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<name></name>
<productUrl></productUrl>
<warranty/>
<availability></availability>
<inStock/>
<shippingCost></shippingCost>
<deliveryTime></deliveryTime>
<weight/>
<size/>
<brand/>
<model/>
<ean/>
<upc/>
<isbn/>
<condition></condition>
<mpn/>
<techSpecs/>
<manufacturer></manufacturer>
<programName></programName>
<programLogoPath></programLogoPath>
<programId></programId>
<fields>
<AlsoIncludes></AlsoIncludes>
<Carrier></Carrier>
<modelID></modelID>
<Offertype></Offertype>
<Processor></Processor>
<Service></Service>
<ShippingTax></ShippingTax>
<StandardImage155x155></StandardImage155x155>
<StandardImage200x200></StandardImage200x200>
<Systemtype></Systemtype>
</fields>
</product>
<product>
<name></name>
<productUrl></productUrl>
<imageUrl></imageUrl>
<description></description>
<price></price>
<currency></currency>
<merchantCategoryName></merchantCategoryName>
<sku></sku>
<shortDescription/>
<promoText/>
<previousPrice></previousPrice>
<warranty/>
<availability></availability>
<inStock/>
<shippingCost></shippingCost>
<deliveryTime></deliveryTime>
<weight/>
<size/>
<brand/>
<model/>
<ean/>
<upc/>
<isbn/>
<condition></condition>
<mpn/>
<techSpecs/>
<manufacturer>Dell</manufacturer>
<programName></programName>
<programLogoPath></programLogoPath>
<programId></programId>
<fields>
<AlsoIncludes></AlsoIncludes>
<Carrier></Carrier>
<modelID></modelID>
<Offertype></Offertype>
<Processor></Processor>
<Service></Service>
<ShippingTax></ShippingTax>
<StandardImage155x155></StandardImage155x155>
<StandardImage200x200></StandardImage200x200>
<Systemtype></Systemtype>
</fields>
</product>
</products>
With the following snippet I retrieve nodes from xml with php simple xml
object feed than on a given parent I retrieve the first sub-element and I
convert it to array. My problem: I want to get that sub-element which has
the most of children in the hole XML object and than the targeted should
be converted to array
/*
* Retrive XML Nodes from Feed
*
*/
public function getXMLNodes() {
$xml = simplexml_load_file($this->config[0]->link);
switch (strtolower($this->config[0]->affiliate)) {
case 'case1':
$nodes = $xml->product[0]; //here stead of first object I
should get that one which has most of chlidren
break;
case 'case2':
$nodes = $xml->productItems->productItem[0];
break;
default :
break;
}
$nodes = $this->xml2array($nodes);
return $nodes;
}
/*
* Convert Simple XML Object to array
*
* @xml SimpleXMLObject
*
*/
function xml2array($xml) {
$arr = array();
foreach ($xml as $element) {
$tag = $element->getName();
$e = get_object_vars($element);
if (!empty($e)) {
$arr[$tag] = $element instanceof SimpleXMLElement ?
$this->xml2array($element) : $e;
} else {
$arr[$tag] = trim($element);
}
}
return $arr;
}
example XML //in this case the second has the most of childrens
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<name></name>
<productUrl></productUrl>
<warranty/>
<availability></availability>
<inStock/>
<shippingCost></shippingCost>
<deliveryTime></deliveryTime>
<weight/>
<size/>
<brand/>
<model/>
<ean/>
<upc/>
<isbn/>
<condition></condition>
<mpn/>
<techSpecs/>
<manufacturer></manufacturer>
<programName></programName>
<programLogoPath></programLogoPath>
<programId></programId>
<fields>
<AlsoIncludes></AlsoIncludes>
<Carrier></Carrier>
<modelID></modelID>
<Offertype></Offertype>
<Processor></Processor>
<Service></Service>
<ShippingTax></ShippingTax>
<StandardImage155x155></StandardImage155x155>
<StandardImage200x200></StandardImage200x200>
<Systemtype></Systemtype>
</fields>
</product>
<product>
<name></name>
<productUrl></productUrl>
<imageUrl></imageUrl>
<description></description>
<price></price>
<currency></currency>
<merchantCategoryName></merchantCategoryName>
<sku></sku>
<shortDescription/>
<promoText/>
<previousPrice></previousPrice>
<warranty/>
<availability></availability>
<inStock/>
<shippingCost></shippingCost>
<deliveryTime></deliveryTime>
<weight/>
<size/>
<brand/>
<model/>
<ean/>
<upc/>
<isbn/>
<condition></condition>
<mpn/>
<techSpecs/>
<manufacturer>Dell</manufacturer>
<programName></programName>
<programLogoPath></programLogoPath>
<programId></programId>
<fields>
<AlsoIncludes></AlsoIncludes>
<Carrier></Carrier>
<modelID></modelID>
<Offertype></Offertype>
<Processor></Processor>
<Service></Service>
<ShippingTax></ShippingTax>
<StandardImage155x155></StandardImage155x155>
<StandardImage200x200></StandardImage200x200>
<Systemtype></Systemtype>
</fields>
</product>
</products>
Why am I getting java.util.ConcurrentModificationException?
Why am I getting java.util.ConcurrentModificationException?
As I run the following code :
import java.util.LinkedList;
class Tester {
public static void main(String args[]) {
LinkedList<String> list = new LinkedList<String>();
list.add(new String("suhail"));
list.add(new String("gupta"));
list.add(new String("ghazal"));
list.add(new String("poetry"));
list.add(new String("music"));
list.add(new String("art"));
try {
for(String s : list) {
list.add(0,"art");
list.remove(6);
System.out.println(list);
}
}catch(Exception exc) {
exc.printStackTrace();
}
}
}
I get an exception that says :
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(Unknown Source)
at java.util.LinkedList$ListItr.next(Unknown Source)
at Tester.main(Tester.java:14)
Why am I getting this exception ?
As I run the following code :
import java.util.LinkedList;
class Tester {
public static void main(String args[]) {
LinkedList<String> list = new LinkedList<String>();
list.add(new String("suhail"));
list.add(new String("gupta"));
list.add(new String("ghazal"));
list.add(new String("poetry"));
list.add(new String("music"));
list.add(new String("art"));
try {
for(String s : list) {
list.add(0,"art");
list.remove(6);
System.out.println(list);
}
}catch(Exception exc) {
exc.printStackTrace();
}
}
}
I get an exception that says :
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(Unknown Source)
at java.util.LinkedList$ListItr.next(Unknown Source)
at Tester.main(Tester.java:14)
Why am I getting this exception ?
Machine epsilon (eps) scicomp.stackexchange.com
Machine epsilon (eps) – scicomp.stackexchange.com
The wiki for machine epsilon says: "Machine epsilon gives an upper bound
on the relative error due to rounding in floating point arithmetic" If
machine epsilon is the upper bound on the relative ...
The wiki for machine epsilon says: "Machine epsilon gives an upper bound
on the relative error due to rounding in floating point arithmetic" If
machine epsilon is the upper bound on the relative ...
Sunday, 25 August 2013
FactoryGirls randomly fails with 'Factory not registered', why?
FactoryGirls randomly fails with 'Factory not registered', why?
I've some tests that randomly fail, approx. 20% of times. It means that
WITHOUT changing the code, each time that I run the tests 1 time out of 5
will fail with "Factory not registered" error. It's very weird.. :(
This is the consone output:
Failures:
1) Unit#new_from_string returns factor for metric conversions
Failure/Error: FactoryGirl.create :taza
ArgumentError:
Factory not registered: taza
# ./spec/models/unit_spec.rb:29:in `block (2 levels) in <top
(required)>'
Finished in 0.29619 seconds
4 examples, 1 failure
Failed examples:
rspec ./spec/models/unit_spec.rb:22 # Unit#new_from_string returns factor
for metric conversions
Randomized with seed 61727
And this is the code:
file: "unit_spec.rb"
require 'spec_helper'
describe Unit, "#new_from_string" do
it "parses the string and returns a Unit object" do
[some tests...]
FactoryGirl.find_definitions
u = FactoryGirl.create :taza
FactoryGirl.create :tbsp
[tests...]
end
it "returns factor for metric conversions" do
[tests not involving factory girl...]
# the following is line 29, that fails
FactoryGirl.create :taza
[tests...]
end
end
file "spec/factories/units.rb":
FactoryGirl.define do
factory :taza , :class => CustomUnit do
singular 'taza'
plural 'tazas'
physical_type Unit::VOLUME
equivalence_factor 200
equivalence_unit 'ml'
end
[other factories...]
end
I've some tests that randomly fail, approx. 20% of times. It means that
WITHOUT changing the code, each time that I run the tests 1 time out of 5
will fail with "Factory not registered" error. It's very weird.. :(
This is the consone output:
Failures:
1) Unit#new_from_string returns factor for metric conversions
Failure/Error: FactoryGirl.create :taza
ArgumentError:
Factory not registered: taza
# ./spec/models/unit_spec.rb:29:in `block (2 levels) in <top
(required)>'
Finished in 0.29619 seconds
4 examples, 1 failure
Failed examples:
rspec ./spec/models/unit_spec.rb:22 # Unit#new_from_string returns factor
for metric conversions
Randomized with seed 61727
And this is the code:
file: "unit_spec.rb"
require 'spec_helper'
describe Unit, "#new_from_string" do
it "parses the string and returns a Unit object" do
[some tests...]
FactoryGirl.find_definitions
u = FactoryGirl.create :taza
FactoryGirl.create :tbsp
[tests...]
end
it "returns factor for metric conversions" do
[tests not involving factory girl...]
# the following is line 29, that fails
FactoryGirl.create :taza
[tests...]
end
end
file "spec/factories/units.rb":
FactoryGirl.define do
factory :taza , :class => CustomUnit do
singular 'taza'
plural 'tazas'
physical_type Unit::VOLUME
equivalence_factor 200
equivalence_unit 'ml'
end
[other factories...]
end
writing a second query based on results of the first - Not working
writing a second query based on results of the first - Not working
Gentlemen and Ladies,
*Mysql will be upgraded later.
Preface: Authors can register in two languages and, for various additional
reasons, that meant 2 databases. We realize that the setup appears odd in
the use of multiple databases but it is more this abbreviated explanation
that makes it seem so. So please ignore that oddity.
Situation: My first query produces a recordset of authors who have
cancelled their subscription. It finds them in the first database.
require_once('ConnString/FirstAuth.php');
mysql_select_db($xxxxx, $xxxxxx);
$query_Recordset1 = "SELECT auth_email FROM Authors WHERE Cancel = 'Cancel'";
$Recordset1 = mysql_query($query_Recordset1, $xxxxxx) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
In the second db where they are also listed, (table and column names are
identical) I want to update them because they cancelled. To select their
records for updating, I want to take the first recordset, put it into an
array, swap out the connStrings, then search using that array.
These also work.
$results = array();
do {
results[] = $row_Recordset1;
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
print_r($results);
gives me an array. Array ( [0] => Array ( [auth_email] =>
renault@autxxx.com ) [1] => Array ( [auth_email] => rinaldi@autxxx.com )
[2] => Array ( [auth_email] => hemingway@autxxx.com )) ...so I know it is
finding the first set of data.
Here's the problem: The query of the second database looks for the author
by auth_email if it is 'IN' the $results array, but it is not finding the
authors in the 2nd database as I expected. Please note the different
connString
require_once('ConnString/SecondAuth.php');
mysql_select_db($xxxxx, $xxxxxx);
$query_Recordset2 = "SELECT auth_email FROM Authors WHERE auth_email
IN('$results')";
$Recordset2 = mysql_query($query_Recordset2, $xxxxxx) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
The var_dump is 0 but I know that there are two records in there that
should be found. I've tried various combinations of IN like {$results},
but when I got to "'$results'", it was time to ask for help. I've checked
all the available posts and none resolve my problem though I am now more
familiar with the wild goose population.
I thought that since I swapped out the connection string, maybe $result
was made null so I re-set it to the original connString and it still
didn't find auth_email in $results in the same database where it certainly
should have done.
Further, I've swapped out connStrings before with positive results, so...
hmmm...
My goal, when working, is to echo the Recordset2 into a form with a
do/while loop that will permit me to update their record in the 2nd db.
Since the var_dump is 0, obviously this below isn't giving me a list of
authors in the second table whose email addresses appear in the $results
array, but I include it as example of what I want use to start the form in
the page.
do {
$row_Recordset2['auth_email_addr '];
} while($row_Recordset2 = mysql_fetch_assoc($Recordset2));
As always, any pointer you can give are appreciated and correct answers
are Accepted.
Thank you.
Gentlemen and Ladies,
*Mysql will be upgraded later.
Preface: Authors can register in two languages and, for various additional
reasons, that meant 2 databases. We realize that the setup appears odd in
the use of multiple databases but it is more this abbreviated explanation
that makes it seem so. So please ignore that oddity.
Situation: My first query produces a recordset of authors who have
cancelled their subscription. It finds them in the first database.
require_once('ConnString/FirstAuth.php');
mysql_select_db($xxxxx, $xxxxxx);
$query_Recordset1 = "SELECT auth_email FROM Authors WHERE Cancel = 'Cancel'";
$Recordset1 = mysql_query($query_Recordset1, $xxxxxx) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
In the second db where they are also listed, (table and column names are
identical) I want to update them because they cancelled. To select their
records for updating, I want to take the first recordset, put it into an
array, swap out the connStrings, then search using that array.
These also work.
$results = array();
do {
results[] = $row_Recordset1;
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
print_r($results);
gives me an array. Array ( [0] => Array ( [auth_email] =>
renault@autxxx.com ) [1] => Array ( [auth_email] => rinaldi@autxxx.com )
[2] => Array ( [auth_email] => hemingway@autxxx.com )) ...so I know it is
finding the first set of data.
Here's the problem: The query of the second database looks for the author
by auth_email if it is 'IN' the $results array, but it is not finding the
authors in the 2nd database as I expected. Please note the different
connString
require_once('ConnString/SecondAuth.php');
mysql_select_db($xxxxx, $xxxxxx);
$query_Recordset2 = "SELECT auth_email FROM Authors WHERE auth_email
IN('$results')";
$Recordset2 = mysql_query($query_Recordset2, $xxxxxx) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
The var_dump is 0 but I know that there are two records in there that
should be found. I've tried various combinations of IN like {$results},
but when I got to "'$results'", it was time to ask for help. I've checked
all the available posts and none resolve my problem though I am now more
familiar with the wild goose population.
I thought that since I swapped out the connection string, maybe $result
was made null so I re-set it to the original connString and it still
didn't find auth_email in $results in the same database where it certainly
should have done.
Further, I've swapped out connStrings before with positive results, so...
hmmm...
My goal, when working, is to echo the Recordset2 into a form with a
do/while loop that will permit me to update their record in the 2nd db.
Since the var_dump is 0, obviously this below isn't giving me a list of
authors in the second table whose email addresses appear in the $results
array, but I include it as example of what I want use to start the form in
the page.
do {
$row_Recordset2['auth_email_addr '];
} while($row_Recordset2 = mysql_fetch_assoc($Recordset2));
As always, any pointer you can give are appreciated and correct answers
are Accepted.
Thank you.
Integral of $\sqrt{a-x^2}$
Integral of $\sqrt{a-x^2}$
I know how to integrate stuff like $\sqrt{a-x^2}$, though I haven't done
this in a while. So I wanted to check the answer after calculating. My
calculations go like this ($\theta=sin^{-1}(\frac{x}{\sqrt{a}})$):
$$\int_{A}^{B}{\sqrt{a-x^2}}dx=\int_{A}^{B}{\sqrt{a-x^2}}\frac{1}{\frac{1}{\sqrt{a}}\frac{1}{\sqrt{1-\frac{x^2}{a}}}}d(sin^{-1}(\frac{x}{\sqrt{a}}))=\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{(a-x^2)d\theta}=\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{(a-((sin\theta)\sqrt{a})^2)d\theta}=[a\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}-a\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{(\frac{1}{2}-\frac{1}{2}cos2\theta)d\theta}=[a\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}-[a\frac{1}{2}\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}+\frac{1}{2}a\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{cos2\theta\frac{1}{2}d(2\theta)}=[\frac{1}{2}a\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}+\frac{1}{2}a[\frac{1}{2}sin2\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}=[\frac{1}{2}a\theta]_{s
in^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}+[\frac{1}{2}a
sin\theta
cos\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}=[\frac{1}{2}asin^{-1}(\frac{x}{\sqrt{a}})+\frac{1}{2}x\sqrt{a-x^2}]_{A}^{B}$$
However this doesn't seem to be right after I checked it multiple times
with Wolfram Integrator and my calculator. Where did I go wrong?
I know how to integrate stuff like $\sqrt{a-x^2}$, though I haven't done
this in a while. So I wanted to check the answer after calculating. My
calculations go like this ($\theta=sin^{-1}(\frac{x}{\sqrt{a}})$):
$$\int_{A}^{B}{\sqrt{a-x^2}}dx=\int_{A}^{B}{\sqrt{a-x^2}}\frac{1}{\frac{1}{\sqrt{a}}\frac{1}{\sqrt{1-\frac{x^2}{a}}}}d(sin^{-1}(\frac{x}{\sqrt{a}}))=\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{(a-x^2)d\theta}=\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{(a-((sin\theta)\sqrt{a})^2)d\theta}=[a\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}-a\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{(\frac{1}{2}-\frac{1}{2}cos2\theta)d\theta}=[a\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}-[a\frac{1}{2}\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}+\frac{1}{2}a\int_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}{cos2\theta\frac{1}{2}d(2\theta)}=[\frac{1}{2}a\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}+\frac{1}{2}a[\frac{1}{2}sin2\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}=[\frac{1}{2}a\theta]_{s
in^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}+[\frac{1}{2}a
sin\theta
cos\theta]_{sin^{-1}(\frac{A}{\sqrt{a}})}^{sin^{-1}(\frac{B}{\sqrt{a}})}=[\frac{1}{2}asin^{-1}(\frac{x}{\sqrt{a}})+\frac{1}{2}x\sqrt{a-x^2}]_{A}^{B}$$
However this doesn't seem to be right after I checked it multiple times
with Wolfram Integrator and my calculator. Where did I go wrong?
Posting to a Facebook user's wall from Django (already have access token)
Posting to a Facebook user's wall from Django (already have access token)
I have a django project setup using the django-allauth package. This
package stores a Facebook user's access token in the backend, so I can
presumably access this token for other Facebook related tasks.
My question is, I'm unfamiliar with the Facebook Open Graph API and unsure
how I go about provoking a post to a user's wall based on their use of my
website.
So, like I said, I have their access token.
I already have a custom action and object setup for my Facebook app. I've
tried various ways of implementing calls to Facebook's graph api via http
and their JS SDK, with no avail.
For instance, In my django project users can vote on a topic. I would like
when they vote for a post to be published to their wall using the
predefined custom action/object I created.
What steps do I need to take next in order to post to a user's wall?
Other django packages are welcome in order to solve this problem.
I have a django project setup using the django-allauth package. This
package stores a Facebook user's access token in the backend, so I can
presumably access this token for other Facebook related tasks.
My question is, I'm unfamiliar with the Facebook Open Graph API and unsure
how I go about provoking a post to a user's wall based on their use of my
website.
So, like I said, I have their access token.
I already have a custom action and object setup for my Facebook app. I've
tried various ways of implementing calls to Facebook's graph api via http
and their JS SDK, with no avail.
For instance, In my django project users can vote on a topic. I would like
when they vote for a post to be published to their wall using the
predefined custom action/object I created.
What steps do I need to take next in order to post to a user's wall?
Other django packages are welcome in order to solve this problem.
Saturday, 24 August 2013
Would this pump water up? and if so, how far?
Would this pump water up? and if so, how far?
I had this idea of an osmotic pump way back in high school and I never got
a satisfactory answer if it would work. If I had this configuration:
Would it continually pump water up given ambient heat so long as the
bottom reservoir is full?
EDIT To explain what is happening, there is pure water in each of the dark
blue reservoirs, saline in the cyan containers (same concentration of
saline in each container) and a semipermeable membrane at the bottom and
near the top of each container.
The pure water in each reservoir would be sucked up into each container
directly above it due to osmotic pressure (high water concentration flows
to lower water concentration), and then dumped out at the top also due to
osmotic pressure (saline to air which is almost 0% water concentration).
Since the membrane is not permeable to salt, only the water is released
from the container into the next higher reservoir. END EDIT
If enough were stacked, would this allow for transporting water higher
than the maximum that trees can transport (about 138m according to this
article)?
I had this idea of an osmotic pump way back in high school and I never got
a satisfactory answer if it would work. If I had this configuration:
Would it continually pump water up given ambient heat so long as the
bottom reservoir is full?
EDIT To explain what is happening, there is pure water in each of the dark
blue reservoirs, saline in the cyan containers (same concentration of
saline in each container) and a semipermeable membrane at the bottom and
near the top of each container.
The pure water in each reservoir would be sucked up into each container
directly above it due to osmotic pressure (high water concentration flows
to lower water concentration), and then dumped out at the top also due to
osmotic pressure (saline to air which is almost 0% water concentration).
Since the membrane is not permeable to salt, only the water is released
from the container into the next higher reservoir. END EDIT
If enough were stacked, would this allow for transporting water higher
than the maximum that trees can transport (about 138m according to this
article)?
Update if(condition) or produce an error
Update if(condition) or produce an error
I need do an update a table via php. I need the response will be Ok or
Error. Basically, i need substract 1 to the field value, if field value is
not zero. If the field value is zero, i try to force produce an error,
replacing the numeric field with a string value
The SQL statement is:
$query = "Update mytable set myfield = if( myfield > 0 , myfield - 1 ,
'AAA') where cliente_id = $cual_ID";
After this, the php code is:
if (mysql_query($query))
{
echo "OK";
}
else
{
echo "Error 4";
}
mysql_close($link);
When I run the php, it always return OK, also when myfield is greater than
zero.
Any ideas?
I need do an update a table via php. I need the response will be Ok or
Error. Basically, i need substract 1 to the field value, if field value is
not zero. If the field value is zero, i try to force produce an error,
replacing the numeric field with a string value
The SQL statement is:
$query = "Update mytable set myfield = if( myfield > 0 , myfield - 1 ,
'AAA') where cliente_id = $cual_ID";
After this, the php code is:
if (mysql_query($query))
{
echo "OK";
}
else
{
echo "Error 4";
}
mysql_close($link);
When I run the php, it always return OK, also when myfield is greater than
zero.
Any ideas?
py3 issue swaping 2 elements in same list
py3 issue swaping 2 elements in same list
So i know there are predefined functions but im still practicing the basics.
I want to sort a bunch of integers in a list from lowest to bigest number.
I defined this function:
def swap(a, b):
c = a
a = b
b = c
return a, b
And this is what im trying:
def low_to_big_sort():
n = [2, 1, 63, 6, 8, 5, 12]
swap(n[0], n[1])
return n
Returns the same list as defined. What is wrong in my code?
So i know there are predefined functions but im still practicing the basics.
I want to sort a bunch of integers in a list from lowest to bigest number.
I defined this function:
def swap(a, b):
c = a
a = b
b = c
return a, b
And this is what im trying:
def low_to_big_sort():
n = [2, 1, 63, 6, 8, 5, 12]
swap(n[0], n[1])
return n
Returns the same list as defined. What is wrong in my code?
What do observers do in eSports?
What do observers do in eSports?
What does the observer do in Starcraft II eSports productions? As far as
current events goes, I've heard the WCS Season II Finals casters
repeatedly refer to "the observer" behind the scenes.
Does the observer spectate the game looking for hacks being used? Do they
watch the players to see if they're getting signals? Are they a spectator
that's under more direct control by the show's director that gets mixed
into the stream in addition to the casters?
What does the observer do in Starcraft II eSports productions? As far as
current events goes, I've heard the WCS Season II Finals casters
repeatedly refer to "the observer" behind the scenes.
Does the observer spectate the game looking for hacks being used? Do they
watch the players to see if they're getting signals? Are they a spectator
that's under more direct control by the show's director that gets mixed
into the stream in addition to the casters?
Delete known character?
Delete known character?
new to python and having a mind block here. I have two sets of data:
word = Boat
char = B
'char' will always be the first letter of 'word', that letter should be
deleted. How could I go about doing this? All I've got so far is which I'm
not even sure about either is...
def new_word('word', 'char'):
if name[0].lower() is str(con):
new to python and having a mind block here. I have two sets of data:
word = Boat
char = B
'char' will always be the first letter of 'word', that letter should be
deleted. How could I go about doing this? All I've got so far is which I'm
not even sure about either is...
def new_word('word', 'char'):
if name[0].lower() is str(con):
Applying the top hat filter to the inner and outer edges of a region
Applying the top hat filter to the inner and outer edges of a region
I'm looking forward to applying the top hat filtering to some region using
MATLAB. The region will have borders. If we imagine the borders, there is
an inside to the border, and an outside.
So, when I want to apply the filter, how can I determine that I want to do
that to the inside of the border for instance?
Thanks.
I'm looking forward to applying the top hat filtering to some region using
MATLAB. The region will have borders. If we imagine the borders, there is
an inside to the border, and an outside.
So, when I want to apply the filter, how can I determine that I want to do
that to the inside of the border for instance?
Thanks.
How can I reduce the sliminiess of okra?
How can I reduce the sliminiess of okra?
I don't particularly mind the slime in okra, but my wife hates it. Is
there a proven technique for reducing the sliminess?
I do wish to make an Indian simmered curry (Bhindi) with it, so frying is
out.
I don't particularly mind the slime in okra, but my wife hates it. Is
there a proven technique for reducing the sliminess?
I do wish to make an Indian simmered curry (Bhindi) with it, so frying is
out.
Friday, 23 August 2013
How can I load a model and immediately have access to it
How can I load a model and immediately have access to it
Say that when I load the page I include a json hash of the current user's
info
in an injection I load the info:
user_data = JSON.parse(user_json)
App.Model.load(user_data['id'], user_data)
container.typeInjection('controller', 'currentUser',
'controller:currentUser')
App.set('currentUserController', controller)
But I'd like to set the value of that currentUserController right here as
well - App.Model.load doesn't return the actual model instance!
to get it, I need to run App.Model.find(user_data['id']) and because this
is done at start up, it seems that ember-model always ends up querying the
database for this model rather than using the json I've preloaded.
Because I use this model in the startup of my app I can't defer the
loading - how can I get access to the loaded model without needing to do
an ajax request?
Say that when I load the page I include a json hash of the current user's
info
in an injection I load the info:
user_data = JSON.parse(user_json)
App.Model.load(user_data['id'], user_data)
container.typeInjection('controller', 'currentUser',
'controller:currentUser')
App.set('currentUserController', controller)
But I'd like to set the value of that currentUserController right here as
well - App.Model.load doesn't return the actual model instance!
to get it, I need to run App.Model.find(user_data['id']) and because this
is done at start up, it seems that ember-model always ends up querying the
database for this model rather than using the json I've preloaded.
Because I use this model in the startup of my app I can't defer the
loading - how can I get access to the loaded model without needing to do
an ajax request?
Random mac-address every time I turn on my laptop?
Random mac-address every time I turn on my laptop?
I would like to get a random mac-address automatically every time I turn
on my Ubuntu laptop. Any help is appreciated.
P.S. If at all possible a random hostname every startup would be great.
I would like to get a random mac-address automatically every time I turn
on my Ubuntu laptop. Any help is appreciated.
P.S. If at all possible a random hostname every startup would be great.
More elegant way to create a list of lines from BeautifulSoup.findAll
More elegant way to create a list of lines from BeautifulSoup.findAll
I am writing a web parser using BeautifulSoup. I create a list of lines
generated with bs.findAll(text=True), and then split line for line and
apply my logic there. html_payload is an arbitrary webpage.
The code I've got so far works, but it's not very pretty, and makes me
think there must be a better, more elagant way of writing it.
data_to_parse = BeautifulSoup(html_payload)
lines_to_parse = []
d = data_to_parse.findAll(text=True)
for line in d:
for line2 in line.strip().split('\n'):
if line2:
lines_to_parse.append(line2)
for line in lines_to_parse:
pass # here's where I start analyzing results
Is there anyone who can suggest a better way of solving this?
I am writing a web parser using BeautifulSoup. I create a list of lines
generated with bs.findAll(text=True), and then split line for line and
apply my logic there. html_payload is an arbitrary webpage.
The code I've got so far works, but it's not very pretty, and makes me
think there must be a better, more elagant way of writing it.
data_to_parse = BeautifulSoup(html_payload)
lines_to_parse = []
d = data_to_parse.findAll(text=True)
for line in d:
for line2 in line.strip().split('\n'):
if line2:
lines_to_parse.append(line2)
for line in lines_to_parse:
pass # here's where I start analyzing results
Is there anyone who can suggest a better way of solving this?
How to send a Javascript/Ajax variable to a php page using AJAX
How to send a Javascript/Ajax variable to a php page using AJAX
function runGetIperfSpeedAjax(speedVar, actualIp) {
var xmlhttp = getAjaxObject();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status ==
200) {
processIperfRequest(xmlhttp.responseText,
speedVar);
}
}
xmlhttp.open('GET', 'lib/getIperfSpeed.php', true);
xmlhttp.setRequestHeader('Content-type',
'application/x-www-form-urlencoded');
xmlhttp.send();
}
function processIperfRequest(response, speedVar){
alert("proccess");
document.getElementById(speedVar).style.display = 'none';
document.getElementById('displaySpeedTest').style.display
= 'block';
document.getElementById('displaySpeedTest').innerHTML
= response;
}
NOTE: getAjaxObject() is not included as it is just standard. I am making
an onclick javascript call that calls runGetIperfSpeedAjax. This all works
properly if I hard set the IP in lib/getIperfSpeed.php. But I cannot seem
to pass the actualIp to lib/getIperfSpeed.php. I tried
'lib/getIperfSpeed.php'+actualIp to attempt to pass it and access it
through post.
All help is appreciated.
function runGetIperfSpeedAjax(speedVar, actualIp) {
var xmlhttp = getAjaxObject();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status ==
200) {
processIperfRequest(xmlhttp.responseText,
speedVar);
}
}
xmlhttp.open('GET', 'lib/getIperfSpeed.php', true);
xmlhttp.setRequestHeader('Content-type',
'application/x-www-form-urlencoded');
xmlhttp.send();
}
function processIperfRequest(response, speedVar){
alert("proccess");
document.getElementById(speedVar).style.display = 'none';
document.getElementById('displaySpeedTest').style.display
= 'block';
document.getElementById('displaySpeedTest').innerHTML
= response;
}
NOTE: getAjaxObject() is not included as it is just standard. I am making
an onclick javascript call that calls runGetIperfSpeedAjax. This all works
properly if I hard set the IP in lib/getIperfSpeed.php. But I cannot seem
to pass the actualIp to lib/getIperfSpeed.php. I tried
'lib/getIperfSpeed.php'+actualIp to attempt to pass it and access it
through post.
All help is appreciated.
not passing List of String as single parameters inside preparedStatement.setObject()
not passing List of String as single parameters inside
preparedStatement.setObject()
I want to pass a List of String coming from request parameter to the
preparedStatement.setObject() as a single parameter. Here I am coverting
list of Objects to a single String.
So while passing this converted String to setObject method it is
converting ' to \'.
So my query is like :
select * from category where category IN (?)
for (int counter = 0; (!sqlParams.isEmpty()) && counter <
sqlParams.size(); counter++) {
System.out.println(sqlParams.get(counter));
stmt.setObject(counter + 1, sqlParams.get(counter));
System.out.println(stmt.toString());
}
here sqlParams.get(counter) is giving following value to me.
'Adult', 'Classic', 'Fantasy', 'Mystery'
but when i am using stmt.setObject(), and printing the value of stmt, it
is showing following values:
'\'Adult\', \'Classic\', \'Fantasy\', \'Mystery\'
There are other ways to solve these approach too but they are increasing
time complexity for my code. Can anyone Suggest me solution to this?
preparedStatement.setObject()
I want to pass a List of String coming from request parameter to the
preparedStatement.setObject() as a single parameter. Here I am coverting
list of Objects to a single String.
So while passing this converted String to setObject method it is
converting ' to \'.
So my query is like :
select * from category where category IN (?)
for (int counter = 0; (!sqlParams.isEmpty()) && counter <
sqlParams.size(); counter++) {
System.out.println(sqlParams.get(counter));
stmt.setObject(counter + 1, sqlParams.get(counter));
System.out.println(stmt.toString());
}
here sqlParams.get(counter) is giving following value to me.
'Adult', 'Classic', 'Fantasy', 'Mystery'
but when i am using stmt.setObject(), and printing the value of stmt, it
is showing following values:
'\'Adult\', \'Classic\', \'Fantasy\', \'Mystery\'
There are other ways to solve these approach too but they are increasing
time complexity for my code. Can anyone Suggest me solution to this?
Poly(L-lysine trifluoroacetate) [on hold]
Poly(L-lysine trifluoroacetate) [on hold]
Is Poly-L-lysine trifluoroacetate comes under types of poly amino acid ?
Is Poly-L-lysine trifluoroacetate comes under types of poly amino acid ?
Thursday, 22 August 2013
Is it possible to stream live video (m3u8 link) on Windows Phone 7?
Is it possible to stream live video (m3u8 link) on Windows Phone 7?
The question says it all.
I need my app to stream live video coming from a server in m3u8 format -
AFAIK m3u8 is a playlist file
According to the following links I can use SMF player framework - but I am
not able to get it to work
SmoothStreamingMediaElement (.m3u8 ) in Windows phone
http://phonesm.codeplex.com/
This link says Windows Phone doesnt support m3u8
How to streams video file from m3u8 file in windows phone 7
Ive also heard that I need to open the m3u8 link with the phone's default
video app - is it possible?? if so, how???
The question says it all.
I need my app to stream live video coming from a server in m3u8 format -
AFAIK m3u8 is a playlist file
According to the following links I can use SMF player framework - but I am
not able to get it to work
SmoothStreamingMediaElement (.m3u8 ) in Windows phone
http://phonesm.codeplex.com/
This link says Windows Phone doesnt support m3u8
How to streams video file from m3u8 file in windows phone 7
Ive also heard that I need to open the m3u8 link with the phone's default
video app - is it possible?? if so, how???
64-bit install of ubuntu 12.04.2 won't boot
64-bit install of ubuntu 12.04.2 won't boot
The disk drive on my 64-bit ubuntu 12.04 system stopped booting (2TB drive
w/o EFI boot). I am able to boot up the same OS on another hard-disk (3TB
drive with EFI boot), and determined my the contents of the /boot
directory on the 2TB drive is damaged (hence the problem). So I purchased
a new 2TB drive (WD red drive) and have been trying to install 64-bit
ubuntu 12.04.2 to create a new system.
Everything works as expected during the installation process, but the disk
won't boot when the system is restarted. The black screen displays the
following, then nothing further:
Loading Operating System ... Boot from CD/DVD : Boot from CD/DVD : _
I have two DVD drives in my system, hence those two lines. I have removed
the DVD at this point, so it is not trying to boot off the DVD.
I only have the one disk drive connected during this process. The SATA
cables to the other drives in this computer are removed during this
install and boot process, just because that makes me feel 100% safe.
I have downloaded and burned two 12.04.2 DVDs and installed both of them
with identical results. So the DVDs are fine. Every time I install, I
manually specify partitions. Three times I did not format with EFI boot,
and twice I did format with EFI boot (which should not be necessary with
this 2TB drive). Exact same results both times.
My partitioning is quite vanilla, and similar to what I've done before
many times. Basically, something like this:
16GB /boot
16GB swap
64GB /
rest /home
/ and /home were made ext4 while /boot was made ext2 (when EFI not
specified).
When I install again, and get to the partition step, it says the
partitions are what I made them previously, and shows a reasonable amount
of the space as consumed by files.
Any ideas why this is happening?
The disk drive on my 64-bit ubuntu 12.04 system stopped booting (2TB drive
w/o EFI boot). I am able to boot up the same OS on another hard-disk (3TB
drive with EFI boot), and determined my the contents of the /boot
directory on the 2TB drive is damaged (hence the problem). So I purchased
a new 2TB drive (WD red drive) and have been trying to install 64-bit
ubuntu 12.04.2 to create a new system.
Everything works as expected during the installation process, but the disk
won't boot when the system is restarted. The black screen displays the
following, then nothing further:
Loading Operating System ... Boot from CD/DVD : Boot from CD/DVD : _
I have two DVD drives in my system, hence those two lines. I have removed
the DVD at this point, so it is not trying to boot off the DVD.
I only have the one disk drive connected during this process. The SATA
cables to the other drives in this computer are removed during this
install and boot process, just because that makes me feel 100% safe.
I have downloaded and burned two 12.04.2 DVDs and installed both of them
with identical results. So the DVDs are fine. Every time I install, I
manually specify partitions. Three times I did not format with EFI boot,
and twice I did format with EFI boot (which should not be necessary with
this 2TB drive). Exact same results both times.
My partitioning is quite vanilla, and similar to what I've done before
many times. Basically, something like this:
16GB /boot
16GB swap
64GB /
rest /home
/ and /home were made ext4 while /boot was made ext2 (when EFI not
specified).
When I install again, and get to the partition step, it says the
partitions are what I made them previously, and shows a reasonable amount
of the space as consumed by files.
Any ideas why this is happening?
editing java script for dynamic tabs
editing java script for dynamic tabs
I'm pretty new to coding particular to javascript, so sorry upfront for
this newbie question.
what I'm trying to do is redesigning an template. I need to edit the tabs
length of the navigation menu. I have this java script which is
automatically scaling the length of the tab measured on the number of the
letters, I guess. Question is first: Is this the right script? Second: If
so, how can I set the length of the tabs similar, even when the word
changes in the number of letters. Thank you in advance for your help!
tabs = {
init : function(){
$('.tabs').each(function(){
var th=$(this),
tContent=$('.tab-content',th),
navA=$('.nav a',th)
tContent.not(tContent.eq(0)).hide()
navA.click(function(){
var th=$(this),
tmp=th.attr('href')
tContent.not($(tmp.slice(tmp.indexOf('#'))).fadeIn(1000)).hide()
$(th).parent().addClass('selected').siblings().removeClass('selected').find('span').stop().animate({opacity:'0'},600);
Cufon.refresh();
return false;
});
});
}
}
I'm pretty new to coding particular to javascript, so sorry upfront for
this newbie question.
what I'm trying to do is redesigning an template. I need to edit the tabs
length of the navigation menu. I have this java script which is
automatically scaling the length of the tab measured on the number of the
letters, I guess. Question is first: Is this the right script? Second: If
so, how can I set the length of the tabs similar, even when the word
changes in the number of letters. Thank you in advance for your help!
tabs = {
init : function(){
$('.tabs').each(function(){
var th=$(this),
tContent=$('.tab-content',th),
navA=$('.nav a',th)
tContent.not(tContent.eq(0)).hide()
navA.click(function(){
var th=$(this),
tmp=th.attr('href')
tContent.not($(tmp.slice(tmp.indexOf('#'))).fadeIn(1000)).hide()
$(th).parent().addClass('selected').siblings().removeClass('selected').find('span').stop().animate({opacity:'0'},600);
Cufon.refresh();
return false;
});
});
}
}
setcontent view in thread
setcontent view in thread
I wont to make a thread witch it change the layout of my activity ... I
have 2 layouts : welcomepage and activity_main ... The goal of thread:
when I lunch my application , the welcomepage layout will be visible in
only 5 sec and after that the layout will be activity_main ...
I write the code below:
package com.example.tripolimazad;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
public TextView counter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcomepage);
counter = (TextView) findViewById(R.id.Counter);
Thread th=new Thread(){
@Override
public void run(){
try
{
Thread.sleep(10000);
setContentView(R.layout.activity_main);
}catch (InterruptedException e) {
}
}
};
th.start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
but it doesnt work !!! have anyone any solution plz !
I wont to make a thread witch it change the layout of my activity ... I
have 2 layouts : welcomepage and activity_main ... The goal of thread:
when I lunch my application , the welcomepage layout will be visible in
only 5 sec and after that the layout will be activity_main ...
I write the code below:
package com.example.tripolimazad;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
public TextView counter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcomepage);
counter = (TextView) findViewById(R.id.Counter);
Thread th=new Thread(){
@Override
public void run(){
try
{
Thread.sleep(10000);
setContentView(R.layout.activity_main);
}catch (InterruptedException e) {
}
}
};
th.start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
but it doesnt work !!! have anyone any solution plz !
jScrollPane stops to work after the 2nd ajax call
jScrollPane stops to work after the 2nd ajax call
I'm working on a website project written in html5/css/jQuery, which uses
ajax navigation.
You can find it here:
meltingmedia.it/works/alfala
Apart from design, which is awful at the moment because I started today to
code the project.
I coded many sites like this, and the combination between jScrollPane and
ajax calls never gave me problems.
In this specific site, as you can see, for animation needs requested by
the client (every new page has to appear from the right side of the screen
and go near the logo, in a 980px–grid), I had to use two <article>
elements, one which gets "incoming" class and another which gets "current"
class.
Well, when I load the page everything works fine, but when I make the
third click on a menu element (doesn't matter which one), jScrollPane
stops to be casted.
For sure there's a matter of logic or of ordering the events, but I can't
really find it.
Thanks in advance!
PS The layout at the moment is not responsive, and the home page is not
populated yet.
I'm working on a website project written in html5/css/jQuery, which uses
ajax navigation.
You can find it here:
meltingmedia.it/works/alfala
Apart from design, which is awful at the moment because I started today to
code the project.
I coded many sites like this, and the combination between jScrollPane and
ajax calls never gave me problems.
In this specific site, as you can see, for animation needs requested by
the client (every new page has to appear from the right side of the screen
and go near the logo, in a 980px–grid), I had to use two <article>
elements, one which gets "incoming" class and another which gets "current"
class.
Well, when I load the page everything works fine, but when I make the
third click on a menu element (doesn't matter which one), jScrollPane
stops to be casted.
For sure there's a matter of logic or of ordering the events, but I can't
really find it.
Thanks in advance!
PS The layout at the moment is not responsive, and the home page is not
populated yet.
lambda expression and Messagebox in C#
lambda expression and Messagebox in C#
private void SimpleLambda()
{
dynamic showMessage = x => MessageBox.Show(x);
showMessage("Hello World!");
}
The Error message is : Can't convert lambda expression to dynamic type ,
because it is not a delegate type
Any help,
private void SimpleLambda()
{
dynamic showMessage = x => MessageBox.Show(x);
showMessage("Hello World!");
}
The Error message is : Can't convert lambda expression to dynamic type ,
because it is not a delegate type
Any help,
How to check as to in which file is a variable declared while debugging in gdb?
How to check as to in which file is a variable declared while debugging in
gdb?
I am going through code which is spread across multiple files. I have a
variable x which i am using in file A.c and its declared in B.h. I am
debugging using gdb under emacs. While in file A.c how do i check as to in
which file is my variable x declared?
gdb?
I am going through code which is spread across multiple files. I have a
variable x which i am using in file A.c and its declared in B.h. I am
debugging using gdb under emacs. While in file A.c how do i check as to in
which file is my variable x declared?
Wednesday, 21 August 2013
Placing sprites in back or front
Placing sprites in back or front
I understand the "z" function can be used to send sprites either backward
or forward, and in this case I am trying to place the stars in my game at
the very back. Below is my code, and the following is an example I picked
up online: [layer addChild:dog z:0];
- (void)addStar
{
SGGSprite * star = [[SGGSprite alloc] initWithFile:@"Star.png"
effect:self.effect];
[self.children addObject:star];
int minY = star.contentSize.height/2;
int maxY = 5000 - star.contentSize.height/2;
int rangeY = maxY - minY;
int actualY = (arc4random() % rangeY) + minY;
star.position = GLKVector2Make(480 + (star.contentSize.width/2), actualY);
int minVelocity = 10.0/4.0;
int maxVelocity = 200.0/2.0;
int rangeVelocity = maxVelocity - minVelocity;
int actualVelocity = (arc4random() % rangeVelocity) + minVelocity;
star.moveVelocity = GLKVector2Make(-actualVelocity, 0);
[self.stars addObject:star];
}
I understand the "z" function can be used to send sprites either backward
or forward, and in this case I am trying to place the stars in my game at
the very back. Below is my code, and the following is an example I picked
up online: [layer addChild:dog z:0];
- (void)addStar
{
SGGSprite * star = [[SGGSprite alloc] initWithFile:@"Star.png"
effect:self.effect];
[self.children addObject:star];
int minY = star.contentSize.height/2;
int maxY = 5000 - star.contentSize.height/2;
int rangeY = maxY - minY;
int actualY = (arc4random() % rangeY) + minY;
star.position = GLKVector2Make(480 + (star.contentSize.width/2), actualY);
int minVelocity = 10.0/4.0;
int maxVelocity = 200.0/2.0;
int rangeVelocity = maxVelocity - minVelocity;
int actualVelocity = (arc4random() % rangeVelocity) + minVelocity;
star.moveVelocity = GLKVector2Make(-actualVelocity, 0);
[self.stars addObject:star];
}
Unable to use GAE Datastore test helper and User service test helper together
Unable to use GAE Datastore test helper and User service test helper together
I am trying to write JUnit4 tests for my java app that uses both data
store and users service. I followed the code sample from here and added a
user service test helper.
My code is pasted below.
public class LocalDatastoreTest {
private final LocalServiceTestHelper userserviceTestHelper =
new LocalServiceTestHelper(new LocalUserServiceTestConfig())
.setEnvIsAdmin(true).setEnvIsLoggedIn(true);
private final LocalServiceTestHelper datastoreTestHelper =
new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());
@Before
public void setUp() {
userserviceTestHelper.setUp();
datastoreTestHelper.setUp();
}
@After
public void tearDown() {
datastoreTestHelper.tearDown();
userserviceTestHelper.tearDown();
}
// run this test twice to prove we're not leaking any state across tests
private void doTest() {
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
assertEquals(0, ds.prepare(new
Query("yam")).countEntities(withLimit(10)));
ds.put(new Entity("yam"));
ds.put(new Entity("yam"));
assertEquals(2, ds.prepare(new
Query("yam")).countEntities(withLimit(10)));
}
@Test
public void testInsert1() {
doTest();
}
@Test
public void testInsert2() {
doTest();
}
}
When I run the tests it I get a null pointer exception when calling the
tearDown method.
Has anyone used both the data store and user service test helpers together
? Any tips/suggestions would be appreciated.
Regards,
Sathya
I am trying to write JUnit4 tests for my java app that uses both data
store and users service. I followed the code sample from here and added a
user service test helper.
My code is pasted below.
public class LocalDatastoreTest {
private final LocalServiceTestHelper userserviceTestHelper =
new LocalServiceTestHelper(new LocalUserServiceTestConfig())
.setEnvIsAdmin(true).setEnvIsLoggedIn(true);
private final LocalServiceTestHelper datastoreTestHelper =
new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());
@Before
public void setUp() {
userserviceTestHelper.setUp();
datastoreTestHelper.setUp();
}
@After
public void tearDown() {
datastoreTestHelper.tearDown();
userserviceTestHelper.tearDown();
}
// run this test twice to prove we're not leaking any state across tests
private void doTest() {
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
assertEquals(0, ds.prepare(new
Query("yam")).countEntities(withLimit(10)));
ds.put(new Entity("yam"));
ds.put(new Entity("yam"));
assertEquals(2, ds.prepare(new
Query("yam")).countEntities(withLimit(10)));
}
@Test
public void testInsert1() {
doTest();
}
@Test
public void testInsert2() {
doTest();
}
}
When I run the tests it I get a null pointer exception when calling the
tearDown method.
Has anyone used both the data store and user service test helpers together
? Any tips/suggestions would be appreciated.
Regards,
Sathya
Using PHP $_SESSION, users not staying logged in.
Using PHP $_SESSION, users not staying logged in.
I'm using $_SESSION to keep my users logged in after they have logged in.
When they return to the homepage, they at first appear to be logged in,
but after refreshing the page once, they are no longer logged in.
NOTE: I'm still learning PHP programming so please don't mind that most of
my code is rather, noobish.
Index.php Code:
<?php
session_start();
if (empty($_SESSION['username'])) {
$UserOnline = "Guest";
} else {
$UserOnline = $_SESSION['username'];
}
echo $UserOnline
//Using echo to test what user is logged in (Either Guest or a User)
?>
Login.php Code:
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username)) {
header ('Location: http://localhost/practice/loginAttempt.php?try=empty');
} elseif (empty($password)) {
header ('Location: http://localhost/practice/loginAttempt.php?try=empty');
}
require 'required/connect.php';
$result = mysqli_query($con, "SELECT * FROM users WHERE
username='$username'");
$row = mysqli_fetch_array($result);
$DBPassword = $row['password'];
if ($password != $DBPassword) {
header ('Location: http://localhost/practice/loginAttempt.php?try=failed');
} else {
$_SESSION['username'] = $username;
header ('Location: http://localhost/practice/');
}
?>
I have tested on the login.php page if the user is in a session there, and
I always get the correct return value. The issue is that after I refresh
once on the Index.php page, the user is no longer in a session.
Is there something I'm forgetting or am I not using the $_SESSION
correctly or is another error that I simply do not know about?
Thanks, Justin
I'm using $_SESSION to keep my users logged in after they have logged in.
When they return to the homepage, they at first appear to be logged in,
but after refreshing the page once, they are no longer logged in.
NOTE: I'm still learning PHP programming so please don't mind that most of
my code is rather, noobish.
Index.php Code:
<?php
session_start();
if (empty($_SESSION['username'])) {
$UserOnline = "Guest";
} else {
$UserOnline = $_SESSION['username'];
}
echo $UserOnline
//Using echo to test what user is logged in (Either Guest or a User)
?>
Login.php Code:
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username)) {
header ('Location: http://localhost/practice/loginAttempt.php?try=empty');
} elseif (empty($password)) {
header ('Location: http://localhost/practice/loginAttempt.php?try=empty');
}
require 'required/connect.php';
$result = mysqli_query($con, "SELECT * FROM users WHERE
username='$username'");
$row = mysqli_fetch_array($result);
$DBPassword = $row['password'];
if ($password != $DBPassword) {
header ('Location: http://localhost/practice/loginAttempt.php?try=failed');
} else {
$_SESSION['username'] = $username;
header ('Location: http://localhost/practice/');
}
?>
I have tested on the login.php page if the user is in a session there, and
I always get the correct return value. The issue is that after I refresh
once on the Index.php page, the user is no longer in a session.
Is there something I'm forgetting or am I not using the $_SESSION
correctly or is another error that I simply do not know about?
Thanks, Justin
How to split a new window horizontally but keep both windows the same width?
How to split a new window horizontally but keep both windows the same width?
My window originally was 80 chars wide, and when I C-x 3 I have to windows
both 40 chars wide. Is it possible that when you split the window it
automatically widens the whole program so that both windows are 80 chars
wide. I'm tired to resizing window every time.
The same applies to C-x 2 when I need two windows both 24 chars tall.
My window originally was 80 chars wide, and when I C-x 3 I have to windows
both 40 chars wide. Is it possible that when you split the window it
automatically widens the whole program so that both windows are 80 chars
wide. I'm tired to resizing window every time.
The same applies to C-x 2 when I need two windows both 24 chars tall.
Save content rich text editor to blob field in mysql database
Save content rich text editor to blob field in mysql database
I'm trying to save the content from a rich text editor (ckeditor in my
case) to my a blob field in my database.
This is my ViewModel:
public class ArticleViewModel
{
[Required]
[Display(Name = "Title")]
public string Title { get; set; }
[Required]
[Display(Name = "Description")]
public string Description { get; set; }
[Required]
[Display(Name = "Article Body")]
public string ArticleBody { get; set; }
}
The Article Body is my rich text field like this in my view:
<div class="editor-label">
@Html.LabelFor(model => model.ArticleBody)
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.ArticleBody, new { placeholder =
"Type the content of the article", @class = "ckeditor" })
@Html.ValidationMessageFor(model => model.ArticleBody, string.Empty)
</div>
In my Action in my Controller:
[HttpPost]
public ActionResult Create(ArticleViewModel model)
{
if (ModelState.IsValid)
{
try
{
// Get the userID who created the article
User usr = userrepo.FindByUsername(User.Identity.Name);
model.UsernameID = usr.user_id;
repository.AddArticle(model.Title, model.Description,
model.ArticleBody);
}
catch (ArgumentException ae)
{
ModelState.AddModelError("", ae.Message);
}
return RedirectToAction("Index");
}
return View(model);
}
But in my repository I get : Cannot convert type 'string' to 'byte[]'
Can somebody give me a start or help me with this?
I'm trying to save the content from a rich text editor (ckeditor in my
case) to my a blob field in my database.
This is my ViewModel:
public class ArticleViewModel
{
[Required]
[Display(Name = "Title")]
public string Title { get; set; }
[Required]
[Display(Name = "Description")]
public string Description { get; set; }
[Required]
[Display(Name = "Article Body")]
public string ArticleBody { get; set; }
}
The Article Body is my rich text field like this in my view:
<div class="editor-label">
@Html.LabelFor(model => model.ArticleBody)
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.ArticleBody, new { placeholder =
"Type the content of the article", @class = "ckeditor" })
@Html.ValidationMessageFor(model => model.ArticleBody, string.Empty)
</div>
In my Action in my Controller:
[HttpPost]
public ActionResult Create(ArticleViewModel model)
{
if (ModelState.IsValid)
{
try
{
// Get the userID who created the article
User usr = userrepo.FindByUsername(User.Identity.Name);
model.UsernameID = usr.user_id;
repository.AddArticle(model.Title, model.Description,
model.ArticleBody);
}
catch (ArgumentException ae)
{
ModelState.AddModelError("", ae.Message);
}
return RedirectToAction("Index");
}
return View(model);
}
But in my repository I get : Cannot convert type 'string' to 'byte[]'
Can somebody give me a start or help me with this?
How to use twitter
How to use twitter
I joined twitter to make comments to Sports addresses (i.e. Televised
Ashes) -- and cannot find any SIMPLE directions to lead me to that
solution !! - Can you assist ??
I joined twitter to make comments to Sports addresses (i.e. Televised
Ashes) -- and cannot find any SIMPLE directions to lead me to that
solution !! - Can you assist ??
Google calendar by PHP cURL returned strings in German
Google calendar by PHP cURL returned strings in German
I'm trying to retrieve the Google calendar XML using cURL to display it in
my application.
The calender is public and it can be directly accessed via browser:
https://www.google.com/calendar/feeds/en.usa%23holiday%40group.v.calendar.google.com/public/basic
When I tried to get it from my program, it is strangely returned in
German. Here it is
Below is my code:
$xml = NULL;
$url =
'https://www.google.com/calendar/feeds/en.usa%23holiday%40group.v.calendar.google.com/public/basic';
$crl = curl_init();
curl_setopt ($crl, CURLOPT_URL, $url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, 15);
$xml = curl_exec($crl);
curl_close($crl);
echo '<pre>';
print_r($xml);
exit;
if($xml){
$xml = simplexml_load_string($xml);
}
When the URL is run from the browser, it is returned in English. I thought
that it is because of the cURL proxy settings on the server, then I tried
to add those two lines, but it did not make sense.
curl_setopt ($crl, CURLOPT_HTTPGET, TRUE);
curl_setopt ($crl, CURLOPT_HTTPPROXYTUNNEL, FALSE);
Any idea? Please help.
I'm trying to retrieve the Google calendar XML using cURL to display it in
my application.
The calender is public and it can be directly accessed via browser:
https://www.google.com/calendar/feeds/en.usa%23holiday%40group.v.calendar.google.com/public/basic
When I tried to get it from my program, it is strangely returned in
German. Here it is
Below is my code:
$xml = NULL;
$url =
'https://www.google.com/calendar/feeds/en.usa%23holiday%40group.v.calendar.google.com/public/basic';
$crl = curl_init();
curl_setopt ($crl, CURLOPT_URL, $url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, 15);
$xml = curl_exec($crl);
curl_close($crl);
echo '<pre>';
print_r($xml);
exit;
if($xml){
$xml = simplexml_load_string($xml);
}
When the URL is run from the browser, it is returned in English. I thought
that it is because of the cURL proxy settings on the server, then I tried
to add those two lines, but it did not make sense.
curl_setopt ($crl, CURLOPT_HTTPGET, TRUE);
curl_setopt ($crl, CURLOPT_HTTPPROXYTUNNEL, FALSE);
Any idea? Please help.
Tuesday, 20 August 2013
Apply columns to sections without explicitly bracketing each section
Apply columns to sections without explicitly bracketing each section
Background
Creating a document that can have zero-, two-, or three-column layouts,
depending on user preferences. I would like to keep the content clean of
\columnsets by redefining only the sections (both section and chapter
pages have independent styles).
For example, this produces the desired outcome, but requires duplicating
the \startcolumnset for each \startsection, which I'd like to avoid:
\definecolumnset[StyleColumns][n=2,
%rule=on,
]
\startsection[title={Section1},reference=sec:section1,]
\startcolumnset[StyleColumns]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopcolumnset
\stopsection
\startsection[title={Section2},reference=sec:section2,]
\startcolumnset[StyleColumns]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopcolumnset
\stopsection
(The vertical rules don't work for me yet, but that's a separate issue.)
Problem
There are potentially hundreds of sections in the book that gets
automatically generated. I would like to define whether or not multiple
columns are used outside of the main content in a single location within
the document (i.e., before the first \startbodymatter).
Forgiving my accent, I would like to do something such as:
% <CODE BLOCK>
\let\OldSection\section
\define\section{%
\startsection
\startcolumnset[StyleColumns]
\OldSection
\stopcolumnset
\stopsection
% </CODE BLOCK>
\startsection[title={Section1},reference=sec:section1,]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopsection
\startsection[title={Section2},reference=sec:section2,]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopsection
That way when the document is generated, if the <CODE BLOCK> is not
included then the document won't use multiple columns.
Alternative Approach
I considered using conditional modes, but that would lead to either messy
or duplicated content.
Question
How do you create a document using ConTeXt such that the
\startsection...\stopsection code blocks can be made columnar without
actually embedding \startcolumnset[X]...\stopcolumnset within each
section's code block?
Related
http://wiki.contextgarden.net/Columns
http://www.pragma-ade.com/general/manuals/columns.pdf
Background
Creating a document that can have zero-, two-, or three-column layouts,
depending on user preferences. I would like to keep the content clean of
\columnsets by redefining only the sections (both section and chapter
pages have independent styles).
For example, this produces the desired outcome, but requires duplicating
the \startcolumnset for each \startsection, which I'd like to avoid:
\definecolumnset[StyleColumns][n=2,
%rule=on,
]
\startsection[title={Section1},reference=sec:section1,]
\startcolumnset[StyleColumns]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopcolumnset
\stopsection
\startsection[title={Section2},reference=sec:section2,]
\startcolumnset[StyleColumns]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopcolumnset
\stopsection
(The vertical rules don't work for me yet, but that's a separate issue.)
Problem
There are potentially hundreds of sections in the book that gets
automatically generated. I would like to define whether or not multiple
columns are used outside of the main content in a single location within
the document (i.e., before the first \startbodymatter).
Forgiving my accent, I would like to do something such as:
% <CODE BLOCK>
\let\OldSection\section
\define\section{%
\startsection
\startcolumnset[StyleColumns]
\OldSection
\stopcolumnset
\stopsection
% </CODE BLOCK>
\startsection[title={Section1},reference=sec:section1,]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopsection
\startsection[title={Section2},reference=sec:section2,]
\placefigure[left]{}{%
\externalfigure[7b104cc5c6.jpg][width=\textwidth]}
This is a sentence that is really, really, really and very long.
\stopsection
That way when the document is generated, if the <CODE BLOCK> is not
included then the document won't use multiple columns.
Alternative Approach
I considered using conditional modes, but that would lead to either messy
or duplicated content.
Question
How do you create a document using ConTeXt such that the
\startsection...\stopsection code blocks can be made columnar without
actually embedding \startcolumnset[X]...\stopcolumnset within each
section's code block?
Related
http://wiki.contextgarden.net/Columns
http://www.pragma-ade.com/general/manuals/columns.pdf
Which CodeIgniter Template Library fits requirements?
Which CodeIgniter Template Library fits requirements?
I would like to use tags like {{headline}} in the CodeIgniter views
instead of PHP and I'm looking for a template parser. CodeIgniter has a
built-in template parser:
http://www.ellislab.com/codeigniter/user-guide/libraries/parser.html
The question is if it's better to use the built-in parser or another
parser? Are there any limitations with the CI template parser like not
supporting loops, if statements, etc.?
If so, there are a number of other parsers but it seems that a developer
works on them for some time and then it falls into a numb state when it's
not supported any more. I'm looking for a parser which will also be
supported in a year:
Bucket http://backstack.ca/projects/bucket/
Comper Template Parser http://parser.comper.sk/en/
Ocular-Template-Library http://github.com/lonnieezell/Ocular-Template-Library
Phil Sturgeon Template library
http://philsturgeon.co.uk/code/codeigniter-template
PyroCMS Lex Parser http://github.com/pyrocms/lex
Template Library for CodeIgniter
http://www.williamsconcepts.com/ci/codeigniter/libraries/template/
The most active seem to be Comper and Lex Parser. What is the difference
between Phil Sturgeon Template library and PyroCMS Lex Parser because it's
the same developer?
What I am looking for is: - Separation of PHP and HTML/CSS in views -
Solidly supported so that it's not stalled within a year - Use of simple
tags but also loops, if statements and other functions
Can anyone give me a tip? The existing information on the CI forum or
elsewhere have not been really useful.
Many thanks!
Philip
I would like to use tags like {{headline}} in the CodeIgniter views
instead of PHP and I'm looking for a template parser. CodeIgniter has a
built-in template parser:
http://www.ellislab.com/codeigniter/user-guide/libraries/parser.html
The question is if it's better to use the built-in parser or another
parser? Are there any limitations with the CI template parser like not
supporting loops, if statements, etc.?
If so, there are a number of other parsers but it seems that a developer
works on them for some time and then it falls into a numb state when it's
not supported any more. I'm looking for a parser which will also be
supported in a year:
Bucket http://backstack.ca/projects/bucket/
Comper Template Parser http://parser.comper.sk/en/
Ocular-Template-Library http://github.com/lonnieezell/Ocular-Template-Library
Phil Sturgeon Template library
http://philsturgeon.co.uk/code/codeigniter-template
PyroCMS Lex Parser http://github.com/pyrocms/lex
Template Library for CodeIgniter
http://www.williamsconcepts.com/ci/codeigniter/libraries/template/
The most active seem to be Comper and Lex Parser. What is the difference
between Phil Sturgeon Template library and PyroCMS Lex Parser because it's
the same developer?
What I am looking for is: - Separation of PHP and HTML/CSS in views -
Solidly supported so that it's not stalled within a year - Use of simple
tags but also loops, if statements and other functions
Can anyone give me a tip? The existing information on the CI forum or
elsewhere have not been really useful.
Many thanks!
Philip
when binding two .on "click" functions, one overwrites the other
when binding two .on "click" functions, one overwrites the other
These two links, when clicked:
<a
href="/modals.cfm?action=record_payment&script=%2Fmanager%5Fpro%2Ecfm%2Fleague%2F268%2Faction%2Fregistration%2Fcontent%5Faction%2Fmanagedues%2Ftabindex%2F3&player_id=41363&dues_id=199&league=268&f_division_id=1014&price2pay=10"
class="btn btn-mini facebox ttLT btn-success" alt="Record Manual Payment
for ashley wilkes" data-hasqtip="329" oldtitle="">Record Payment</a>
<a
href="/manager_pro.cfm/league/268/action/registration/content_action/managedues/tabindex/3/m0dal_update/manageleague/submethod/manageusersdrop_members/player_id/40454"
class="btn btn-mini btn-danger" data-confirm="Are you sure you want to
drop this member?">Drop Player</a>
trigger these functions:
$(document).on("click", "a[data-confirm]", function(event){
var href = $(this).attr('href');
if (!$('#dataConfirmModal').length) {
$('body').append('<div id="dataConfirmModal" class="modal"
role="dialog" aria-labelledby="dataConfirmLabel"
aria-hidden="true"><div class="modal-header"><button type="button"
class="close" data-dismiss="modal"
aria-hidden="true">×</button><h3 id="dataConfirmLabel">Please
Confirm</h3></div><div class="modal-body"></div><div
class="modal-footer"><button class="btn btn-info"
data-dismiss="modal" aria-hidden="true">Cancel</button><a
class="btn btn-warning" id="dataConfirmOK">I wish to
continue</a></div></div>');
}
$('#dataConfirmModal').find('.modal-body').text($(this).attr('data-confirm'));
$('#dataConfirmOK').attr('href', href);
$('#dataConfirmModal').modal({show:true});
event.preventDefault();
});
$(document).on("click", ".facebox", function(event){
var $link = $(this);
if ($(".modal").dialog( "isOpen" )===true) {
event.preventDefault();
} else {
new BootstrapDialog({
title : '<h3>' + $link.attr('alt') + '</h3>',
content : $('<div>Loading...</div>').load($link.attr('href')),
buttons : [
{
label : 'Cancel',
onclick : function(dialog){dialog.close();}
}
]
}).open();
event.preventDefault();
}
});
Each of them work individually but as soon as I click one, the other opens
up the link to the full screen. Its as if one is overwriting or negating
the binding of the other.
Is there a way to prevent this from happening?
These two links, when clicked:
<a
href="/modals.cfm?action=record_payment&script=%2Fmanager%5Fpro%2Ecfm%2Fleague%2F268%2Faction%2Fregistration%2Fcontent%5Faction%2Fmanagedues%2Ftabindex%2F3&player_id=41363&dues_id=199&league=268&f_division_id=1014&price2pay=10"
class="btn btn-mini facebox ttLT btn-success" alt="Record Manual Payment
for ashley wilkes" data-hasqtip="329" oldtitle="">Record Payment</a>
<a
href="/manager_pro.cfm/league/268/action/registration/content_action/managedues/tabindex/3/m0dal_update/manageleague/submethod/manageusersdrop_members/player_id/40454"
class="btn btn-mini btn-danger" data-confirm="Are you sure you want to
drop this member?">Drop Player</a>
trigger these functions:
$(document).on("click", "a[data-confirm]", function(event){
var href = $(this).attr('href');
if (!$('#dataConfirmModal').length) {
$('body').append('<div id="dataConfirmModal" class="modal"
role="dialog" aria-labelledby="dataConfirmLabel"
aria-hidden="true"><div class="modal-header"><button type="button"
class="close" data-dismiss="modal"
aria-hidden="true">×</button><h3 id="dataConfirmLabel">Please
Confirm</h3></div><div class="modal-body"></div><div
class="modal-footer"><button class="btn btn-info"
data-dismiss="modal" aria-hidden="true">Cancel</button><a
class="btn btn-warning" id="dataConfirmOK">I wish to
continue</a></div></div>');
}
$('#dataConfirmModal').find('.modal-body').text($(this).attr('data-confirm'));
$('#dataConfirmOK').attr('href', href);
$('#dataConfirmModal').modal({show:true});
event.preventDefault();
});
$(document).on("click", ".facebox", function(event){
var $link = $(this);
if ($(".modal").dialog( "isOpen" )===true) {
event.preventDefault();
} else {
new BootstrapDialog({
title : '<h3>' + $link.attr('alt') + '</h3>',
content : $('<div>Loading...</div>').load($link.attr('href')),
buttons : [
{
label : 'Cancel',
onclick : function(dialog){dialog.close();}
}
]
}).open();
event.preventDefault();
}
});
Each of them work individually but as soon as I click one, the other opens
up the link to the full screen. Its as if one is overwriting or negating
the binding of the other.
Is there a way to prevent this from happening?
Wordpress get cat id - >change class
Wordpress get cat id - >change class
I am trying to find an solution for this.
I want to change the class of the post with php in the loop.
So i get the cat ID of the post and make an if function for the
corresponding id, where the class should be changed accordingly.
But somehow he only gets the id one time and prints the same for every post.
Somebody know why?
<?php query_posts('cat=23,29,30,31'.'&showposts=50'.'&orderby=rand'); if
(have_posts()) : while (have_posts()) : the_post(); ?>
<?php $cat = get_cat_ID( single_cat_title("",false) );
print_r($cat);
if ( $cat= "23" ) {
$size="poststart";
}
else if ( $cat= "29" ) {
$size="postcp2";
}
else if ( in_array("30", $category_id) ) {
$size="postcp3";
}
else if ( in_array("31", $category_id) ) {
$size="postfast";
}
unset ($cat);
print_r($cat);
?>
<div class="<?php echo $size ?>" id="post-<?php the_ID(); ?>">
I am trying to find an solution for this.
I want to change the class of the post with php in the loop.
So i get the cat ID of the post and make an if function for the
corresponding id, where the class should be changed accordingly.
But somehow he only gets the id one time and prints the same for every post.
Somebody know why?
<?php query_posts('cat=23,29,30,31'.'&showposts=50'.'&orderby=rand'); if
(have_posts()) : while (have_posts()) : the_post(); ?>
<?php $cat = get_cat_ID( single_cat_title("",false) );
print_r($cat);
if ( $cat= "23" ) {
$size="poststart";
}
else if ( $cat= "29" ) {
$size="postcp2";
}
else if ( in_array("30", $category_id) ) {
$size="postcp3";
}
else if ( in_array("31", $category_id) ) {
$size="postfast";
}
unset ($cat);
print_r($cat);
?>
<div class="<?php echo $size ?>" id="post-<?php the_ID(); ?>">
Incredibly simple Log4j 2.0 example not working
Incredibly simple Log4j 2.0 example not working
This is a stupidly simple example, and yet for some reason it's not
working. I must be missing something obvious.
I am trying to make a very simple log4j 2.0 example program. I have added
these two jars to the classpath:
log4j-api-2.0-beta8.jar
log4j-core-2.0-beta8.jar
And have done the simplest example possible, using the default configuration:
package testlog;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TestLog {
static Logger logger = LogManager.getLogger(TestLog.class.getName());
public static void main(String[] args) {
logger.trace("Hello World");
System.out.println("Test over");
}
}
But for some reason, all I get is 'Test over', I never get the Hello
World, anywhere I can find anyway. Am I looking in the wrong place? It;s
my understanding that with the default configuration it should be printed
to the console, with the 'Test Over'. I have changed the log level to
info, still the same. I have tried pulling out the Logger functionality
into a class, still the same. I am following this tutorial on the log4j
documentation page:
http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration
I can't understand what could possibly be wrong. Could anyone shed any
light on what I've done wrong? Thanks in advance.
This is a stupidly simple example, and yet for some reason it's not
working. I must be missing something obvious.
I am trying to make a very simple log4j 2.0 example program. I have added
these two jars to the classpath:
log4j-api-2.0-beta8.jar
log4j-core-2.0-beta8.jar
And have done the simplest example possible, using the default configuration:
package testlog;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TestLog {
static Logger logger = LogManager.getLogger(TestLog.class.getName());
public static void main(String[] args) {
logger.trace("Hello World");
System.out.println("Test over");
}
}
But for some reason, all I get is 'Test over', I never get the Hello
World, anywhere I can find anyway. Am I looking in the wrong place? It;s
my understanding that with the default configuration it should be printed
to the console, with the 'Test Over'. I have changed the log level to
info, still the same. I have tried pulling out the Logger functionality
into a class, still the same. I am following this tutorial on the log4j
documentation page:
http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration
I can't understand what could possibly be wrong. Could anyone shed any
light on what I've done wrong? Thanks in advance.
What's wrong in my code to search and display the record in labells from access db
What's wrong in my code to search and display the record in labells from
access db
Public Class Emp
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
Dim inc As Integer
Dim MaxRows As Integer
Private Sub Emp_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dbProvider = "Provider=Microsoft.Ace.OLEDB.12.0;"
dbSource = "Data Source = C:\Users\Blessing\Documents\IBCARIP.accdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * From Employees"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "IBCARIP")
'con.Close()
txtID.Text = ds.Tables("IBCARIP").Rows(0).Item(0)
txtName.Text = ds.Tables("IBCARIP").Rows(0).Item(1)
MaxRows = ds.Tables("IBCARIP").Rows.Count
inc = -1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
dbProvider = "Provider=Microsoft.Ace.OLEDB.12.0;"
dbSource = "Data Source = C:\Users\Blessing\Documents\IBCARIP.accdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = ("SELECT * From Calculator WHERE ID_Number like '%" + txtID.Text
+ "%'")
da = New OleDb.OleDbDataAdapter(sql, con)
con.Close()
da.Fill(ds, "IBCARIP")
lblSAI.Text = ds.Tables("IBCARIP").Rows(inc).Item(0) &
ds.Tables("IBCARIP").Rows(inc).Item(1)
lblRate.Text = ds.Tables("IBCARIP").Rows(inc).Item("NRate")
lblOT.Text = ds.Tables("IBCARIP").Rows(inc).Item(7)
End Sub
access db
Public Class Emp
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
Dim inc As Integer
Dim MaxRows As Integer
Private Sub Emp_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dbProvider = "Provider=Microsoft.Ace.OLEDB.12.0;"
dbSource = "Data Source = C:\Users\Blessing\Documents\IBCARIP.accdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * From Employees"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "IBCARIP")
'con.Close()
txtID.Text = ds.Tables("IBCARIP").Rows(0).Item(0)
txtName.Text = ds.Tables("IBCARIP").Rows(0).Item(1)
MaxRows = ds.Tables("IBCARIP").Rows.Count
inc = -1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
dbProvider = "Provider=Microsoft.Ace.OLEDB.12.0;"
dbSource = "Data Source = C:\Users\Blessing\Documents\IBCARIP.accdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = ("SELECT * From Calculator WHERE ID_Number like '%" + txtID.Text
+ "%'")
da = New OleDb.OleDbDataAdapter(sql, con)
con.Close()
da.Fill(ds, "IBCARIP")
lblSAI.Text = ds.Tables("IBCARIP").Rows(inc).Item(0) &
ds.Tables("IBCARIP").Rows(inc).Item(1)
lblRate.Text = ds.Tables("IBCARIP").Rows(inc).Item("NRate")
lblOT.Text = ds.Tables("IBCARIP").Rows(inc).Item(7)
End Sub
Mentor and Mentoring
Mentor and Mentoring
Would someone who is not a professional but knows a subject in depth (such
as automotive repair) and offers advise and hands on assistance with
repair procedures be considered a Mentor? Is the act of giving advise in
this context Mentoring?
Would someone who is not a professional but knows a subject in depth (such
as automotive repair) and offers advise and hands on assistance with
repair procedures be considered a Mentor? Is the act of giving advise in
this context Mentoring?
Monday, 19 August 2013
I have two points p1:(x1,y1) and p2:(x2,y2) and a curve(sometimes an arc, no specific shape) is drawn from p1 to p2
I have two points p1:(x1,y1) and p2:(x2,y2) and a curve(sometimes an arc,
no specific shape) is drawn from p1 to p2
I want to find the tangent angle at p2. I think y2-y1 / x2-x1 will give
the slope, if the points p1 and p2 are on a line. And is tan
((y2-y2)/(x2-x1)) gives the tangent angle ?? And also if p1 and p2 are on
an arc how can i get the angle of the tangent of the arc at p2 ?
Can anyone help me on this please ??
no specific shape) is drawn from p1 to p2
I want to find the tangent angle at p2. I think y2-y1 / x2-x1 will give
the slope, if the points p1 and p2 are on a line. And is tan
((y2-y2)/(x2-x1)) gives the tangent angle ?? And also if p1 and p2 are on
an arc how can i get the angle of the tangent of the arc at p2 ?
Can anyone help me on this please ??
SERVICE_NOT_AVAILABLE some devices on Android GCM
SERVICE_NOT_AVAILABLE some devices on Android GCM
I made an app using GCM for notifications. I used this tutorial and my
code is pretty much identical
http://developer.android.com/google/gcm/client.html
I'm testing on physical devices and on some of the devices I am getting a
SERVICE_NOT_AVAILABLE error when I try to register the device with GCM.
I have an exponential backoff setup so it does retry over time.
It works on about half of my test devices the others get a
SERVICE_NOT_AVAILABLE error. Looked all over and haven't found a solution
yet.
Any help would be greatly appreciated. Thank You!
I made an app using GCM for notifications. I used this tutorial and my
code is pretty much identical
http://developer.android.com/google/gcm/client.html
I'm testing on physical devices and on some of the devices I am getting a
SERVICE_NOT_AVAILABLE error when I try to register the device with GCM.
I have an exponential backoff setup so it does retry over time.
It works on about half of my test devices the others get a
SERVICE_NOT_AVAILABLE error. Looked all over and haven't found a solution
yet.
Any help would be greatly appreciated. Thank You!
Adding data attributes to elements not yet inserted into DOM in jquery
Adding data attributes to elements not yet inserted into DOM in jquery
So I'm basically adding some elements to the DOM on the fly. I can use
method like .addClass on them before they exist, and the class is appended
to the DOM along with the element, but when I use the .data() method to
add a data attribute, the data isn't appended to the DOM with the element.
Am I missing something here or do I really have to wait until the element
exists in the DOM to add data to it?
PS. Using jquery 1.9.1
HERES A FIDDLE FOR YOU TO PLAY WITH
JS
var widget = $("<div>");
widget.addClass("banana");
widget.data('color', 'brown');
widget.appendTo('#container');
HTML
<div id="container">
</div>
And theres some nice css there so you know where to click to inspect and
see the data attribute isn't(or hopefully is) added.
Cheers.
So I'm basically adding some elements to the DOM on the fly. I can use
method like .addClass on them before they exist, and the class is appended
to the DOM along with the element, but when I use the .data() method to
add a data attribute, the data isn't appended to the DOM with the element.
Am I missing something here or do I really have to wait until the element
exists in the DOM to add data to it?
PS. Using jquery 1.9.1
HERES A FIDDLE FOR YOU TO PLAY WITH
JS
var widget = $("<div>");
widget.addClass("banana");
widget.data('color', 'brown');
widget.appendTo('#container');
HTML
<div id="container">
</div>
And theres some nice css there so you know where to click to inspect and
see the data attribute isn't(or hopefully is) added.
Cheers.
Can't connect to localhost
Can't connect to localhost
I am learning PHP and am working on a script that connects to my DB and
pulls some data.
The website I have running on my localhost is a PHP driven CMS.
A segment of the script is here
DEFINE ('DB_USER','myname');
DEFINE ('DB_PASSWORD','somepass123');
DEFINE ('DB_HOST','localhost');
DEFINE ('DB_NAME','sitename');
// make the db connection
$dbc = @mysqli_connect('DB_HOST','DB_USER','DB_PASSWORD','DB_NAME')
OR die ('Could not connect to mysql: ' . mysqli_connect_error());
When I load a page that draws on the PHP I receive the following error
where the output data is meant to be:
Could not connect to mysql: Unknown MySQL server host 'DB_HOST' (1)
I did some research on SO and some googling around. A suspect issue could
be that DB_HOST is defined elsewhere. Is that plausible? I'm not
experienced enough to know if this is the right path.
I did find this in the config/database.php file, I'm not sure if it's
relevant:
$config['default'] = array(
'benchmark' => TRUE,
'persistent' => FALSE,
'connection' => array(
'type' => 'mysqli',
'user' => 'myname',
'pass' => 'somepass123',
'host' => 'localhost',
'port' => FALSE,
'socket' => FALSE,
'database' => 'sitename',
How would I approach figuring out next steps? Is this a common error? Does
anyone have any pointers?
I am learning PHP and am working on a script that connects to my DB and
pulls some data.
The website I have running on my localhost is a PHP driven CMS.
A segment of the script is here
DEFINE ('DB_USER','myname');
DEFINE ('DB_PASSWORD','somepass123');
DEFINE ('DB_HOST','localhost');
DEFINE ('DB_NAME','sitename');
// make the db connection
$dbc = @mysqli_connect('DB_HOST','DB_USER','DB_PASSWORD','DB_NAME')
OR die ('Could not connect to mysql: ' . mysqli_connect_error());
When I load a page that draws on the PHP I receive the following error
where the output data is meant to be:
Could not connect to mysql: Unknown MySQL server host 'DB_HOST' (1)
I did some research on SO and some googling around. A suspect issue could
be that DB_HOST is defined elsewhere. Is that plausible? I'm not
experienced enough to know if this is the right path.
I did find this in the config/database.php file, I'm not sure if it's
relevant:
$config['default'] = array(
'benchmark' => TRUE,
'persistent' => FALSE,
'connection' => array(
'type' => 'mysqli',
'user' => 'myname',
'pass' => 'somepass123',
'host' => 'localhost',
'port' => FALSE,
'socket' => FALSE,
'database' => 'sitename',
How would I approach figuring out next steps? Is this a common error? Does
anyone have any pointers?
How to show loader if a has data-ajax="false"?
How to show loader if a has data-ajax="false"?
I need to show loader before the page is opened. If I remove
data-ajax="false" is works. But I need to have data-ajax attribute.
<a href="..." data-ajax="false" class="show-page-loading-msg">
Home
</a>
I need to show loader before the page is opened. If I remove
data-ajax="false" is works. But I need to have data-ajax attribute.
<a href="..." data-ajax="false" class="show-page-loading-msg">
Home
</a>
Sunday, 18 August 2013
LOOK=?iso-8859-1?Q?=3D=3D=3D=3EWATCH_WE=92RE_THE_MILLERS_ONLINE?=
LOOK===>WATCH WE'RE THE MILLERS ONLINE
WATCH WE'RE THE MILLERS ONLINE FREE, WATCH WE'RE THE MILLERS ONLINE, WATCH
WE'RE THE MILLERS ONLINE 2013 FULL MOVIE,DOWNLOAD WE'RE THE MILLERS MOVIE
FREE, DOWNLOAD WE'RE THE MILLERS MOVIE
CLICK HERE >>>>http://www.moviesmonster.biz/were-the-millers.html
CLICK HERE >>>>http://www.moviesmonster.biz/were-the-millers.html
Watch We're the Millers Online or Download We're the Millers Movie Free
you recognize you are certain a pleasantly off-kilter crazy. (We're the
Millers picture show Watch) once Jennifer Aniston as a small-fry rod
dancer writhes around a rod in underclothing and a wig inside the primary
5 minutes. once putting her outfits returning on, she is convinced (er,
bribed) by her pot-dealing next entrance neighbor, Jerr Sudeikis, to
require AN recreational vehicle to South america and traffick marijuana
returning to the U.S. His reasoning? (We're the Millers Full picture show
Watch) If they cause as suburbanites on a visit, no one at the boundary
are going to be dubious. (Emma Roberts and can Poulter circular out the
"family.")
Watch We're the Millers Full Lenght picture show on-line. Naturally, there
ar hurdles in abundance on their trip house. however the windy film
continues to be one distance forward with regards to tale and impact
collections. It permits that Sudeikis has a gorgeous unction regarding him
as he name-drops dextral and Fairly girl and Wiki-searches on his
intelligent phone.
We're the Millers transfer picture show currently. His quick, SNL-honed
distribution works well with Aniston. At age 44, she offers her juvenile
"son" French-kissing coaching, then works a Flashdance-style saltation.
this can be quickly a number of her best crazy perform since Buddies.
Discussing of which: stay for the credits! there'll be approval.
Download we are the Millers Movie: The antic here is that a assortment of
misfits — a unimportant drug bargainer, a stripper, a road urchin
associated a slack-jawed younker — successfully impersonate AN
all-American atomic family exploring the West during a} very big, gleaming
camper.
Watch we are the Millers Online: inside the course of a mission to
maneuver one or 2 of different prohibited marijuana from North yankee
nation to capital of Colorado, these four become the really issue they are
mocking. David Clark (Jason Sudeikis), a shaggy nonworker, shaves his
chaff and deals jeans and T-shirts for polos and khakis. His imagine
husband, exaggerated O'Reilly (Jennifer Aniston), World Health
Organization wears number seventy eight wigs and cowhide G-strings at
work, goes for ponytails and pedal pushers.
Watch we are the Millers picture show Online: though they and their
"kids," Casey and Kenny (played by Emma Roberts and may Poulter), ar
primarily in it for the cash, once a brief whereas they start, predictably
and nearly convincingly, to stress regarding one another.watch We're the
Millers on-line. watch We're the Millers on-line.comical, "We're the
Millers" ought to at just the once exaggerate and minimize the
dissimilarities between its major individual choices and every person
more.
Watch We're the Millers Online Free Watch We're the Millers Online Watch
We're the Millers Online 2013 Full MovieDownload We're the Millers
WATCH WE'RE THE MILLERS ONLINE FREE, WATCH WE'RE THE MILLERS ONLINE, WATCH
WE'RE THE MILLERS ONLINE 2013 FULL MOVIE,DOWNLOAD WE'RE THE MILLERS MOVIE
FREE, DOWNLOAD WE'RE THE MILLERS MOVIE
CLICK HERE >>>>http://www.moviesmonster.biz/were-the-millers.html
CLICK HERE >>>>http://www.moviesmonster.biz/were-the-millers.html
Watch We're the Millers Online or Download We're the Millers Movie Free
you recognize you are certain a pleasantly off-kilter crazy. (We're the
Millers picture show Watch) once Jennifer Aniston as a small-fry rod
dancer writhes around a rod in underclothing and a wig inside the primary
5 minutes. once putting her outfits returning on, she is convinced (er,
bribed) by her pot-dealing next entrance neighbor, Jerr Sudeikis, to
require AN recreational vehicle to South america and traffick marijuana
returning to the U.S. His reasoning? (We're the Millers Full picture show
Watch) If they cause as suburbanites on a visit, no one at the boundary
are going to be dubious. (Emma Roberts and can Poulter circular out the
"family.")
Watch We're the Millers Full Lenght picture show on-line. Naturally, there
ar hurdles in abundance on their trip house. however the windy film
continues to be one distance forward with regards to tale and impact
collections. It permits that Sudeikis has a gorgeous unction regarding him
as he name-drops dextral and Fairly girl and Wiki-searches on his
intelligent phone.
We're the Millers transfer picture show currently. His quick, SNL-honed
distribution works well with Aniston. At age 44, she offers her juvenile
"son" French-kissing coaching, then works a Flashdance-style saltation.
this can be quickly a number of her best crazy perform since Buddies.
Discussing of which: stay for the credits! there'll be approval.
Download we are the Millers Movie: The antic here is that a assortment of
misfits — a unimportant drug bargainer, a stripper, a road urchin
associated a slack-jawed younker — successfully impersonate AN
all-American atomic family exploring the West during a} very big, gleaming
camper.
Watch we are the Millers Online: inside the course of a mission to
maneuver one or 2 of different prohibited marijuana from North yankee
nation to capital of Colorado, these four become the really issue they are
mocking. David Clark (Jason Sudeikis), a shaggy nonworker, shaves his
chaff and deals jeans and T-shirts for polos and khakis. His imagine
husband, exaggerated O'Reilly (Jennifer Aniston), World Health
Organization wears number seventy eight wigs and cowhide G-strings at
work, goes for ponytails and pedal pushers.
Watch we are the Millers picture show Online: though they and their
"kids," Casey and Kenny (played by Emma Roberts and may Poulter), ar
primarily in it for the cash, once a brief whereas they start, predictably
and nearly convincingly, to stress regarding one another.watch We're the
Millers on-line. watch We're the Millers on-line.comical, "We're the
Millers" ought to at just the once exaggerate and minimize the
dissimilarities between its major individual choices and every person
more.
Watch We're the Millers Online Free Watch We're the Millers Online Watch
We're the Millers Online 2013 Full MovieDownload We're the Millers
How to exclude cookies from the HTTP request?
How to exclude cookies from the HTTP request?
Let's say your server-side architecture never needs to know about a user's
cookies. Only the front-end JavaScript files ever look at them... all the
storing/retrieving of cookie values is done in the JavaScript.
Is there a way to keep these cookies from being sent in the HTTP request?
The reason I ask is because sometimes these cookies are very large, and
can cause 413 HTTP errors since they exceed the maximum buffer size for
our server.
There's no need to send cookies to the server when the server never uses
them... especially when they cause problems!
Let's say your server-side architecture never needs to know about a user's
cookies. Only the front-end JavaScript files ever look at them... all the
storing/retrieving of cookie values is done in the JavaScript.
Is there a way to keep these cookies from being sent in the HTTP request?
The reason I ask is because sometimes these cookies are very large, and
can cause 413 HTTP errors since they exceed the maximum buffer size for
our server.
There's no need to send cookies to the server when the server never uses
them... especially when they cause problems!
Getting warning in download.php file
Getting warning in download.php file
I am running this file:
$file_name = "WEL_log_".date('Y_m');
$url = 'http://www.welserver.com/WEL0521/'.$file_name.'.xls';
$base_path = '/Applications/XAMPP/xamppfiles/htdocs/website/';
$tmp_path = $base_path.'tmp_'.$file_name.'.tsv';
$path = $base_path.$file_name.'.tsv';
$current_month_path = $base_path.'current_month.tsv';
$latest_path = $base_path.'latest.tsv';
function downloadFile ($url, $path) {
global $latest_path;
global $tmp_path;
global $current_month_path;
global $base_path;
$newfname = $tmp_path;
$file = fopen ($url, "rb");
if ($file) {
The line below is line 37 in coding:
$newf = fopen ($newfname, "wb");
if ($newf){
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
}
}
}
if ($file) {
fclose($file);
}
if ($newf) {
copy($tmp_path, $current_month_path);
rename($tmp_path, $path);
fclose($newf);
write_latest_data($path, $latest_path);
}
}
function write_latest_data($read_file_path, $write_file_path,
$no_of_new_lines=10){
$file = file($read_file_path);
$write_f = fopen ($write_file_path, "wb");
$line_count = count($file) > $no_of_new_lines ? $no_of_new_lines :
count($file);
if ($write_f){
fwrite($write_f, $file[0], 1024 * 8 );
$file = array_reverse($file);
for($i=0; $i < $line_count; $i++){
fwrite($write_f, $file[$i], 1024 * 8 );
}
fclose($write_f);
}
and getting this warning
Warning:
fopen(/Applications/XAMPP/xamppfiles/htdocs/website/tmp_WEL_log_2013_08.tsv):
failed to open stream: Permission denied in
/Applications/XAMPP/xamppfiles/htdocs/website/download.php on line 37
Please tell me what am I doing wrong?
I am running this file:
$file_name = "WEL_log_".date('Y_m');
$url = 'http://www.welserver.com/WEL0521/'.$file_name.'.xls';
$base_path = '/Applications/XAMPP/xamppfiles/htdocs/website/';
$tmp_path = $base_path.'tmp_'.$file_name.'.tsv';
$path = $base_path.$file_name.'.tsv';
$current_month_path = $base_path.'current_month.tsv';
$latest_path = $base_path.'latest.tsv';
function downloadFile ($url, $path) {
global $latest_path;
global $tmp_path;
global $current_month_path;
global $base_path;
$newfname = $tmp_path;
$file = fopen ($url, "rb");
if ($file) {
The line below is line 37 in coding:
$newf = fopen ($newfname, "wb");
if ($newf){
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
}
}
}
if ($file) {
fclose($file);
}
if ($newf) {
copy($tmp_path, $current_month_path);
rename($tmp_path, $path);
fclose($newf);
write_latest_data($path, $latest_path);
}
}
function write_latest_data($read_file_path, $write_file_path,
$no_of_new_lines=10){
$file = file($read_file_path);
$write_f = fopen ($write_file_path, "wb");
$line_count = count($file) > $no_of_new_lines ? $no_of_new_lines :
count($file);
if ($write_f){
fwrite($write_f, $file[0], 1024 * 8 );
$file = array_reverse($file);
for($i=0; $i < $line_count; $i++){
fwrite($write_f, $file[$i], 1024 * 8 );
}
fclose($write_f);
}
and getting this warning
Warning:
fopen(/Applications/XAMPP/xamppfiles/htdocs/website/tmp_WEL_log_2013_08.tsv):
failed to open stream: Permission denied in
/Applications/XAMPP/xamppfiles/htdocs/website/download.php on line 37
Please tell me what am I doing wrong?
Subscribe to:
Comments (Atom)