Saturday, 31 August 2013

Is there a symbol table container in c++?

Is there a symbol table container in c++?

I have been thinking about this all day. I am looking for a simple way to
implement a symbol table in C++. The problem is that input that is coming
in is in the format "string_a string_b int_1 int_2" where strings form an
edge and integers are the properties of that edge. I am thinking about
using a vector to associate a string and integer values for the strings so
I can build an adjacency linked list implementation representing edges,
but then I am not sure how to proceed with assigning properties of those
edges. I am thinking about making a Graph class with vector and two ints
to represent vertices which are string_a and string_b but I need to
translate them into ints first, hence the reason for the vector, then
Graph will call makeEdge(vector[int], vector[int]) method to make the
edges. The Edges class will the contain two ints for the vertices and two
ints for the properties so then I can associate int_1 and int_2 with each
edge. Does what I plan to do make sense or am I going about this a totally
wrong way?

Should I throw an exception or print out an error statement in a program?

Should I throw an exception or print out an error statement in a program?

I have my program working and all done (java). It's a short and easy
program for a job interview. I handle stuff like improper input format by
throwing a custom exception. Is that the best way to do it or should I
just make a print statement?

Application Exception in tapestry subforms - Parameter is bound to null

Application Exception in tapestry subforms - Parameter is bound to null

I want to create a subform with tapestry5:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<t:TextField t:id="name" />
</html>
and use it like this:
<form t:type="form" t:id="testForm">
<t:testComponent name="name" />
<input type="submit"/>
</form>
TestComponent.java:
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
public class TestComponent {
@Parameter(required = true, allowNull = false)
@Property
private String name;
}
so that i can use the value of 'name' like:
@Property
private String name;
void onSuccessFromTestForm() {
System.out.println(name);
}
But all i get is an application exception:
Render queue error in BeginRender[Index:testcomponent.name]: Failure
reading parameter 'value' of component Index:testcomponent.name: Parameter
'name' of component Index:testcomponent is bound to null. This parameter
is not allowed to be null.
Whats the problem?

How do I add jquery selectable to a custom jquery ui?

How do I add jquery selectable to a custom jquery ui?

Any object I try to apply the .selectable() I get the following error:
Object doesn't support property or method 'selectable'. Assuming this is
happening because the selectable ui feature wasn't downloaded when I made
my custom jquery-ui-1.9.2.custom.js script, I opened my
jquery-ui-1.9.2.custom.js file and sure enough at the top the selectable
feature is not shown
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js,
jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.resizable.js,
jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js,
jquery.ui.tooltip.js
I downloaded the full jqueryui (1.9.2) package, opened selectable.js and
copied the contentents and pasted them into my custom jquery script. I
still get the same error. I tried closing/opening Visual Studio and doing
a rebuild.
Here is how I'm attempting to apply the selectable UI property.
$("#myList").selectable(); //apply to <ol> object
Here is how I'm loading the script in my page:
<script type="text/javascript" src="Scripts/jquery-1.8.3.js"></script>
<script type="text/javascript"
src="Scripts/jquery-ui-1.9.2.custom.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="Scripts/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
Thank for looking.

SLIM Optional Parameter Issue

SLIM Optional Parameter Issue

I trying to achieve something like this in Slim PHP:
page/p1/p2/p3/p4
I want that If I leave out params from the right(obviously) then I want to
do my stuff based on whatever params I've received.
$app->get('/page(/)(:p1/?)(:p2/?)(:p3/?)(:p4/?)',
function ($p1 = null, $p2 = null, $p3 = null, $p4 = null) {
print empty($p1)? : '' . "p1: $p1/<br/>";
print empty($p2)? : '' . "p2: $p2/<br/>";
print empty($p3)? : '' . "p3: $p3/<br/>";
print empty($p4)? : '' . "id: $p4<br/>";
});
Everything works as expected but the problem is whenever i remove a param
from the end, it prints 1 for every param I remove. why is it doing so?
what am I doing wrong here?

How to show a progress bar on screen programatically in Android?

How to show a progress bar on screen programatically in Android?

I have a class named BookAdder. It extends AsyncTask and it should add a
list of books on the app. Also some activities call it and I want to show
a progress bar on center of screen when it is called.
Now, I don't know how can show a progress bar without it defines in XML
file of activities? Are there any way to create a progress bar then add it
for showing or not?
Thanks

string parsing for C++

string parsing for C++

I have a text file that has #'s in it...It looks something like this.
#Stuff
1
2
3
#MoreStuff
a
b
c
I am trying to use std::string::find() function to get the positions of
the # and then go from there, but I'm not sure how to actually code this.
This is my attempt:
int pos1=0;
while(i<string.size()){
int next=string.find('#', pos1);
i++;}

Friday, 30 August 2013

C++/CLI marshalingl/aliasing of memory and struct intropbability

C++/CLI marshalingl/aliasing of memory and struct intropbability

I've wrapped Christophe Devine's FIPS-197 compliant AES implementation in
a managed C++/CLI class. I'm running into trouble after
encrypting/decrypting anywhere from 20 to 52 blocks of 4096 bytes each.
I've been able to narrow the issue down to this:
If I declare a native pointer to the aes_context struct and just new up
the aes_context in the constructor, like so
Aes::Aes()
: m_Context(new aes_context)
{
}
Then the code will run fine.
But when I attempt to declare the aes_context as array<System::Byte>^ and
then in the constructor do this
Aes::Aes()
: m_Context(gcnew array<System::Byte>(sizeof(aes_context)))
{
}
While it does compile and in theory should work, this now doesn't
pin_ptr<System::Byte> pinned_context = &m_Context[0];
auto context = (aes_context*)pinned_context;
aes_crypt_cbc(context, ...);
Effectively and in my limited experience, this should work just fine. The
only difference is that the memory was allocated by the GC and that I have
to pin the memory before I pass it to the AES library.
I was unable to reproduce this issue any other way and all tests that I
have run against other reference implementation doesn't reveal any issues
with implementation. I've even set up two exactly identical test cases,
one in C and one in C++/CLI (that uses the managed wrapper to call into
the AES library), the managed wrapper doesn't work when backed by a
managed byte array!?
Since the problem doesn't reveal itself after you've run through a fair
deal of data, I've been thinking it's a truncation or alignment issue, but
regardless of how much I overallocate I get the same result.
I'm using the Visual Studio 2012 C++ compiler.
Anyone know anything that might suggest why this is the case?

Thursday, 29 August 2013

Asp.NET: How to install CoolControls?

Asp.NET: How to install CoolControls?

I cannot seem to install this control. I use Visual Studi 2012, I
downloaded the dll. I put it in my project folder, I added a reference of
it, and I added this line to my aspx site:
<%@ Register Assembly="IdeaSparx.CoolControls.Web"
Namespace="IdeaSparx.CoolControls.Web" TagPrefix="cc" %>
But when I add a control, it says there was an error rendering this
control. What can be the problem?

How to make a txt/doc/pdf/html file as we want to view in PostgreSQL

How to make a txt/doc/pdf/html file as we want to view in PostgreSQL

I have the tables and data .
What i want is, to generate a report of all the students sorted by there
names..
--student table
create table student(
sid int,
sname text
);
--student details
insert into student(sid,sname)
values(101,'John'),
(102,'barbie'),
(103,'britney'),
(104,'jackson'),
(105,'abraham')
;
--questions table all the questions for the test
create table questions(
questionid serial,
question text
);
--i have the questions in my table
insert into questions(question)
values('How much is 1+1'),('What is the value of PI'),('Whose dimensions
are all equal');
--the test table it contains the details of the test attebdee by every
student..
create table test(
sno serial,
sid int,
questionid int,
answer text,
marks int
);
--insert into test table the answers and the marks ..should be updated here..
insert into test(sid,questionid,answer,marks)
values(101,1,'2',10),
(102,2,' 3 ',0),
(103,3,' ring ',0),
(104,1,' 1 ',0),
(105,1,' 1 ',0),
(101,2,'3.7',0),
(101,3,' square',10);
My Requirement:
My txt/doc/pdf/html file which is generated should be in a view as below

live sql fiddle demo i tried

Wednesday, 28 August 2013

clear OS Block all outgoing traffic unless out to VPN

clear OS Block all outgoing traffic unless out to VPN

In clear OS I can block all outgoing traffic. Using Block Mode "Block all
outgoing traffic".
This is exactly what I want. However with this mode on I cannot connect to
SQL Server via a VPN. I can ping the server by host name, URL, and IP and
it responds. But I cannot connect using SSMS until I turned block mode
off.
Any thoughts on allowing the SQL server to talk back to VPN clients.
|Internet|
[Me] -> (VPN)--|--------|--> [ClearOS (VPN)] -> [SQL Server]
More info: Clear OS 5.2 PPTP VPN

Extra lazy fetching through two collections

Extra lazy fetching through two collections

I have an Object A which has a collection of B objects (many B objects to
one A object), which, at the same time, have a collection of C items (many
C objects to one B object).
I want to be able to list objects of A class with a count number of C
objects that are (traversing both collections) associated to A.
So in this case:
A ---- B1------C1
------C2
B2------C3
B3------C4
------C5
A would have a C object count of 5.
I know extra lazy fetching allows to get the number of objects in a
collection without actually bringing the whole collection (internally
using a SELECT count()), but since I have to traverse through two
collections, what would be the optimal way to do this?
Keep in mind that I'm fetching a collection of A objects, so I would
prefer not having to go through all A elements manually querying for the
count.

Fiddler Not Capturing Traffic from my C# Application in Windows 8

Fiddler Not Capturing Traffic from my C# Application in Windows 8

I have recently upgraded to a new computer with Windows 8. I have
installed Fiddler, yet I am having problems capturing traffic sent and
received from my C# application. I never had this issue on Windows 7, so I
assume its a Windows 8 issue.
The application is an ordinary WinForms application using C# 5.0 and .NET
4.5. I am using Visual Studio 2012.
Any ideas how to get around this as I'm having a hard time debugging my
application without it.
Fiddler captures traffic from Chrome and Firefox with no issues, just not
my application. I have also loaded another application that I developed,
and that works fine.
It may be worth noting that this is the first application I've developed
that uses HttpClient to make Http requests. Could that be causing any
issues?

Tuesday, 27 August 2013

Thread to handle Large List of objects in Java

Thread to handle Large List of objects in Java

I have a very large ArrayList of object, it executes smoothly in a single
thread. but execution time is the factor.
Let my list has 50 elements, and I have 3 threads,
I would like 1st thread will process 0 to 15 and 2nd thread will process
16 to 31 and rest of the process will process by the third thread.
Is it possible?

AJAX login working sporadically in IE

AJAX login working sporadically in IE

Oh joy, another thing IE apparently does poorly.
I say "working sporadically" in the title because I've actually been able
to get the code to work in IE, but there have been times (without any code
changes) where it hasn't worked, and apparently the same is true for one
of my clients.
My interim solution was to tell him to "stop using IE," but in the
meantime, I feel it's my duty to investigate.
The problem: The login process seems to churn for a bit and then halt,
without throwing the error message that would typically accompany a bad
username or password. This is in IE only (my version is IE9, but I can't
guarantee this issue is confined to that version alone). The login works
perfectly in all other tested browsers, including mobile ones.
Javascript:
$('#login-box > form').submit(function(){
$('#login-response').html("<img src='assets/images/wait.gif'
height='32' />");
var str = $(this).serialize();
$.ajax({
type: 'POST',
url: 'lib/check-login.php',
data: str,
cache: false,
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(errorThrown + '\n' + textStatus);
},
success: function(msg) {
var output = msg.split('|');
var delay = 1600;
if (output[0] == 'OK') {
if (output[1] == '') { //no referrer, redirect to home page
window.location = home_page;
}
else { //referrer set, redirect back to referring page
console.log('saying referer');
//window.location = output[1].substring(1);
window.location = home_page;
}
}
else {
$('#login-response').html('no, denied');
$('#login-box input').val('');
$('#login-box input#username').focus();
}
}
});
PHP:
<?php
$sess = session_id();
if ($sess == '')
session_start();
require_once('config.php');
try_login($_POST['username'], $_POST['password']);
/****** user has submitted credentials, check them and return value to
javascript (AJAX) ***/
function try_login($u, $p) {
global $mysqli;
$res = $mysqli->query(' select u.user_id, u.user_name, u.user_pass,
s.salt, ifnull(u.team_id,0) team_id
from users u left join seasoning s on
u.user_id = s.user_id
where u.user_name = \'' .
$mysqli->real_escape_string($u) . '\'
limit 1;') or die($mysqli->error);
$row = $res->fetch_assoc();
if($row['user_pass'] == crypt($p,$row['salt'])) { //correct
password, log user in
if (isset($_POST['remember'])) //keep user logged in
$duration = time()+60*60*24*365;
else //end user session when he closes browser
$duration = false;
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['team_id'] = $row['team_id'];
$mysqli->query("update users
set
last_login = '" . date('Y-m-d H:i:s') . "',
login_qty = login_qty + 1
where user_id = " . $_SESSION['user_id'] . ";") or
die($mysqli->error);
$mysqli->query("insert into
activity ( activity_type_id,
user_id)
values (8,
" . $_SESSION['user_id'] . ");") or
die($mysqli->error);
echo 'OK|' . $_SESSION['last_page'];
}
else { //login failed
echo 'FAIL';
}
}
?>

UploadControl not adding file to HttpPostedFile so that it can be sent via email

UploadControl not adding file to HttpPostedFile so that it can be sent via
email

The rest of the form works as intended, on button click, the email is sent
but the attachments never make it. the code is posted below.
//FileUpload Control on applicant.aspx
<td><asp:FileUpload ID="FileUpload3" runat="server" /></td>
Here is the Server side code I"m using to send the email:
protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string fileName = Server.MapPath("~/App_Data/ContactForm.txt");
string mailBody = File.ReadAllText(fileName);
mailBody = mailBody.Replace("##firstName##", firstName.Text);
mailBody = mailBody.Replace("##lastName##", lastName.Text);
mailBody = mailBody.Replace("##Email##", emailAddress.Text);
mailBody = mailBody.Replace("##streetAddress##", streetAddress.Text);
mailBody = mailBody.Replace("##City##", City.Text);
mailBody = mailBody.Replace("##State##", State.Text);
mailBody = mailBody.Replace("##zipCode##", zipCode.Text);
mailBody = mailBody.Replace("##Phone##", phoneNumber.Text);
mailBody = mailBody.Replace("##birthDay##", birthDate.Text);
mailBody = mailBody.Replace("##Hobbies##", Hobbies.Text);
mailBody = mailBody.Replace("##Interests##", Interests.Text);
mailBody = mailBody.Replace("##aboutYourSelf##", aboutYourSelf.Text);
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Response from web site";
myMessage.Body = mailBody;
myMessage.From = new MailAddress("oarango30@gmail.com", "Oscar
Arango");
myMessage.To.Add(new MailAddress("oscar@1000wattsmagazine.com",
"Oscar Budz"));
//myMessage.ReplyToList.Add(new MailAddress(EmailAddress.Text));
//Not sure if this is needed!
this.FileUpload1.SaveAs("c:\\" + this.FileUpload1.FileName);
foreach (string file in Request.Files)
{
HttpPostedFile hFile = Request.Files[file] as HttpPostedFile;
if (hFile.ContentLength > 0)
{
//Build an array with the file path, so we can get the
file name later.
string[] strAttachname = hFile.FileName.Split('\\');
//Create a new attachment object from the posted data and
the file name
Attachment mailAttach = new Attachment(
hFile.InputStream,
strAttachname[strAttachname.Length - 1] //Filename
(from end of our array)
);
//Add the attachment to our mail object
myMessage.Attachments.Add(mailAttach);
}
}
//if (FileUpload1.HasFile)
//{
// string headshot =
Path.GetFileName(FileUpload1.PostedFile.FileName);
// Attachment myAttachment = new
Attachment(FileUpload1.FileContent, headshot);
// myMessage.Attachments.Add(myAttachment);
//}
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
Message.Visible = true;
basicinfo.Visible = false;
personalinfo.Visible = false;
FormTable1.Visible = false;
FormTable2.Visible = false;
System.Threading.Thread.Sleep(5000);
thanks.Visible = true;
}
}
Any input on this is much appreciated, I"ve spent hours and kind any
reason why this code shouldn't work, but apparently it doesn't.
thanks in advance.

Current directory is invalid when running batch file

Current directory is invalid when running batch file

This is my run.bat file:
@echo off
start compactau.exe
"c:\program files\java\jre7\bin\java" -Xms512m -Xmx768m -cp
jio.jar;log4j-1.2.9.jar;auagent.jar Auagent auagent.conf
Pause
When I run this file, I get the error the current directory is invalid. I
uninstalled and reinstalled Java, then changed my Java location to
c:\java\bin\java and adjusted my batch file like this:
@echo off
start compactau.exe
"c:\java\bin\java" -Xms512m -Xmx768m -cp
jio.jar;log4j-1.2.9.jar;auagent.jar Auagent auagent.conf
Pause
But I still get the the current directory is invalid. How is this possible
when I created the destination and folder name?

sql division same result on every row

sql division same result on every row

I have a problem with my sql query i got the following data and want to
divide the first column with the second one, these data is calculated in
an earlier query and then inserted to a temp table like this with the
following data:
table #temp:
--------------------------------------------------
| col1 | col2
--------------------------------------------------
| 0.00039572307609997499 |0.00036532140661635839
--------------------------------------------------
| 0.00041192187019791974 | 0.00038027571836302763
--------------------------------------------------
| 0.01844205591109206314 | 0.01702523358692274461
--------------------------------------------------
select valuefirstdate/valueseconddate from #temp
gives the first rows result on every row:
-----------
| col1 |
-----------
| 1.083218|
-----------
| 1.083218|
-----------
| 1.083218|
Sorry for that mistake :D I still had a problem with this code below the
"RESULT" column always gave 1.0000 as result.
ValueFirstDate ValueSecondDate RESULT
43.02206800000000000000 | 56.14522500000000000000 | 1.00000
103.03634500000000000000 | 104.92580000000000000000 | 1.00000
368.20601600000000000000 | 409.45000300000000000000 | 1.00000
declare @FromDate as date
declare @ToDate as date
declare @SymbolId as int
set @FromDate ='2013-08-20'
set @ToDate='2013-08-27'
set @SymbolId=14
SET NOCOUNT ON;
with currenciesByFirstDate as (
select * from Currencies join CurrencySymbols cs on
cs.Id=Currencies.CurrencySymbolId
where Date=@FromDate
),
currenciesBySecondDate as (
select * from Currencies join CurrencySymbols cs on
cs.Id=Currencies.CurrencySymbolId
where Date=@ToDate
),
currencyByFirstDateAndSymbol as (
select * from currenciesByFirstDate
where currenciesByFirstDate.CurrencySymbolId=@SymbolId
),
currencyBySecondDateAndSymbol as (
select * from currenciesBySecondDate
where currenciesBySecondDate.CurrencySymbolId=@SymbolId
)
select
case when @SymbolId!=147 then
currenciesByFirstDate.Value/currencyByFirstDateAndSymbol.Value else
currenciesByFirstDate.Value end as ValueFirstDate,
case when @SymbolId!=147 then
currenciesByFirstDate.Value/currencyBySecondDateAndSymbol.Value else
currenciesBySecondDate.Value end as ValueSecondDate,
currenciesByFirstDate.CurrencySymbolId,
currenciesBySecondDate.Description as CurrencyDescription,
currenciesBySecondDate.SymbolName as CurrencySymbol,
(currenciesByFirstDate.Value/currencyByFirstDateAndSymbol.Value)/(currenciesByFirstDate.Value/currencyBySecondDateAndSymbol.Value)
as RESULT
from currenciesByFirstDate
join currenciesBySecondDate on
currenciesByFirstDate.Id=currenciesBySecondDate.Id
join CurrencySymbols cs on cs.Id=currenciesByFirstDate.CurrencySymbolId
join currencyByFirstDateAndSymbol on
currencyByFirstDateAndSymbol.CurrencySymbolId=currencyByFirstDateAndSymbol.CurrencySymbolId
join currencyBySecondDateAndSymbol on
currencyBySecondDateAndSymbol.CurrencySymbolId=currencyBySecondDateAndSymbol.CurrencySymbolId
I solved this by making a subquery and calculate this instead;
declare @FromDate as date
declare @ToDate as date
declare @SymbolId as int
set @FromDate ='2011-01-20'
set @ToDate='2013-08-27'
set @SymbolId=147
SET NOCOUNT ON;
with currenciesByFirstDate as (
select * from Currencies join CurrencySymbols cs on
cs.Id=Currencies.CurrencySymbolId
where Date=@FromDate
),
currenciesBySecondDate as (
select * from Currencies join CurrencySymbols cs on
cs.Id=Currencies.CurrencySymbolId
where Date=@ToDate
),
currencyByFirstDateAndSymbol as (
select * from currenciesByFirstDate
where currenciesByFirstDate.CurrencySymbolId=@SymbolId
),
currencyBySecondDateAndSymbol as (
select * from currenciesBySecondDate
where currenciesBySecondDate.CurrencySymbolId=@SymbolId
), a as (
select
case when @SymbolId!=147 then
currenciesByFirstDate.Value/currencyByFirstDateAndSymbol.Value else
currenciesByFirstDate.Value end as ValueFirstDate,
case when @SymbolId!=147 then
currenciesByFirstDate.Value/currencyBySecondDateAndSymbol.Value else
currenciesBySecondDate.Value end as ValueSecondDate,
currenciesByFirstDate.CurrencySymbolId,
currenciesBySecondDate.Description as CurrencyDescription,
currenciesBySecondDate.SymbolName as CurrencySymbol,
(currenciesByFirstDate.Value/currencyByFirstDateAndSymbol.Value)/(currenciesByFirstDate.Value/currencyBySecondDateAndSymbol.Value)
as RESULT
from currenciesByFirstDate
join currenciesBySecondDate on
currenciesByFirstDate.Id=currenciesBySecondDate.Id
join CurrencySymbols cs on cs.Id=currenciesByFirstDate.CurrencySymbolId
join currencyByFirstDateAndSymbol on
currencyByFirstDateAndSymbol.CurrencySymbolId=currencyByFirstDateAndSymbol.CurrencySymbolId
join currencyBySecondDateAndSymbol on
currencyBySecondDateAndSymbol.CurrencySymbolId=currencyBySecondDateAndSymbol.CurrencySymbolId)
select ValueFirstDate/ValueSecondDate from a
And now it works! :)

Monday, 26 August 2013

Encryption between .NET and Iphone

Encryption between .NET and Iphone

I am converting my .NET encryption code to Objective C. Here is my code in
.NET to create Key:
byte[] _corrpassword = Encoding.UTF8.GetBytes("1234567891123456");
PasswordDeriveBytes DerivedPassword = new
PasswordDeriveBytes(_corrpassword, salt, "SHA1",
_passwordIterations);
byte[] KeyBytes = DerivedPassword.GetBytes(_keySize / 8);
I am looking for equivelent of this into Objective C.
I tried creating this but both gives different results if I convert them
to base64 string:
-(NSData *)AESKeyForPassword:(NSString *)password salt:(NSData *)salt {
NSMutableData * derivedKey = [NSMutableData
dataWithLength:kCCKeySizeAES256];
int result = CCKeyDerivationPBKDF(kCCPBKDF2, // algorithm
password.UTF8String, // password
password.length, // passwordLength
salt.bytes, // salt
salt.length, // saltLen
kCCPRFHmacAlgSHA1, // PRF
2, // rounds
derivedKey.mutableBytes, // derivedKey
derivedKey.length); // derivedKeyLen
NSAssert(result == kCCSuccess,
@"Unable to create AES key for password: %d", result);
return derivedKey;
}
If I compare [derivedKey base64EncodingWithLineLength:0] in objective C
with string passKey = Convert.ToBase64String(KeyBytes); in .NET both gives
different results.

Apache POI autoSizeColumn() is not working

Apache POI autoSizeColumn() is not working

I've created an excel sheet using apache poi library and tried so much to
change column width with respect to the content length by using
autoSizeColumn() method, but no luck. I've used poi 2.5.1 and jdk 1.6.
This is my code segment.
for (int columnIndex = 0; columnIndex < 8; columnIndex++) {
sheet.autoSizeColumn(columnIndex);
}
I've used this code segment after inserting data to the excel sheet. The
error message said that "cannot find symbol"
Any help would be appreciated.
Thanks in advance.

Reviews - Scientific writing

Reviews - Scientific writing

I am Graduate student from Umaine and will be writing my Master's thesis.
Since English is not my primary language, I am not very confident about my
writing skills.
I would like to know If there are any reviewers/websites/freelancers who
would be interested in reading my thesis and providing corrections.

What are the valid content types for Controller.File()?

What are the valid content types for Controller.File()?

I'm using MVC 4 in Visual Studio. I want to know how to create a file with
the Controller.File() method. I understand I need to pass a file type.
What are the valid file types? I'm not seeing this in the documentation
(http://msdn.microsoft.com/en-us/library/dd492492(v=vs.108).aspx).
Example code:
return File(answers, "txt",filename);
Is there a list of content types that someone can reference me? I need to
know format of the "txt" argument (or whatever I'm supposed to be putting
there) basically (e.g. "txt" or ".txt" or "text/html" or "*.txt", etc.).

Compiling with unused and unavailable classes (like StageText on web)

Compiling with unused and unavailable classes (like StageText on web)

I have a common codebase which I am using to export for mobile
(iOS+Android) desktop (OSX+Windows) and web (SWF)
99% of the code is compatible everywhere, and it just works
However, there are a couple instances (like StageText), where it won't
work. In those cases, I want to use a different class (like TextField or
TLFTextField). Logically, this is fine... however it won't compile
I have something like-
var myStageText:StageText;
var myRegularText:TextField;
if(isAIR) {
myStageText = new StageText();
} else {
myRegularText = new TextField();
}
How can I let this compile everywhere, without turning off error checking?

Wrong time format fetched

Wrong time format fetched

I am using Node for fetching data from MySQL. In database, i got record
like : 2013-08-13 15:44:53 . But when Node fetches from Database , it
assigns value like 2013-08-19T07:54:33.000Z.
I just need to get time format as in MySQL table. Btw ( My column format
is DateTime in MySQL)
In Node :
connection.query(post, function(error, results, fields) {
userSocket.emit('history :', {
'dataMode': 'history',
msg: results,
});
});

How to submit changes in LinqPad

How to submit changes in LinqPad

I have a problem with committing changes in LinqPad. I am using Orcale
database over IQ driver in LinqPad. I can retrieve data but I don't know
how to submit changes to database. Do you have any suggestion?

Sunday, 25 August 2013

return object from parent class function to children class function

return object from parent class function to children class function

well... after so long days i am in big problem.. i did research in this
before posting here..
here it is..
<?php
class a
{
public function loadFile($file)
{
include $file . ".php";
$f = new $file();
//$f -> get(); i can access this
return $f;
}
}
class b extends a
{
public function getData()
{
$abc = $this -> loadFile("abc");
$abc -> get();//object is not returning here.. so not able to
access this function
}
}
?>
i have no idea whats wrong with this? do i am violating some oops rule? if
it so, how can i get this done in similar way.

Wordpress category specific months list in sidebar.php

Wordpress category specific months list in sidebar.php



What have made me pulling my hair apart for while, how to output category
specific month list. 've been searching for the same problem and solution
cannot find any lucky so far...
Anyway, I have two POST type pages in my web site.
One is NEWS page(http://mysite.com/news/) and the other is BLOG
page(http://mysite.com/blog/).
I use archive.php to show my NEWS and BLOG page.
Where I want to output month list with post countis in sidebar.php.
I could output lists by using wp_get_archives('cat=0')
however this outputs like this
2013/05(20)
2013/06(12)
2013/07(18)
2013/08(6)
HTML:
<li><a href="http://xxxxxxxx.com/wp/2013/05/"></a></li>
<li><a href="http://xxxxxxxx.com/wp/2013/06/"></a></li>
<li><a href="http://xxxxxxxx.com/wp/2013/07/"></a></li>
<li><a href="http://xxxxxxxx.com/wp/2013/08/"></a></li>
When I click one of these, this leads to the page where all the posts
happened in that specific month.
What I'd like to output if I am in NEWS page for example is:
HTML:
<li><a href="http://xxxxxxxx.com/wp/news/2013/05/"></a></li>
<li><a href="http://xxxxxxxx.com/wp/news/2013/06/"></a></li>
<li><a href="http://xxxxxxxx.com/wp/news/2013/07/"></a></li>
<li><a href="http://xxxxxxxx.com/wp/news/2013/08/"></a></li>
Category specific.
Any idea?
Thanks.

MU Domain mapping

MU Domain mapping

I've installed the mu domain mapping, but i can't make it work. I have two
different domains, one is point to the other domain (set up at mediatemple
to point to the other domain's folder). That's working.
But when i use wordpress (not a simple php test), it's redirect to the
primary domain. (I added the domain, set up cname primary.com.)
So: www.secondary.com redirects to www.primary.com/secondary.
P.s.: Using lastest WP 3.6; from a domain/server dummy

Saturday, 24 August 2013

JavaFX TableView sections

JavaFX TableView sections

On JavaFX, I want to create a TableView with sections on it, like the
Address Book of Android or iOS, in which you have a section for every
letter of the alphabet.
I've tried using TableRow with setGraphic() or setText(), but as they get
reused, every row ends up being a section after I scroll a bit, even after
trying to reset the graphic/text to null.

Can't access instance variables with menus in MainMenu.xib

Can't access instance variables with menus in MainMenu.xib

For some reason I keep getting null values when using menu items in the
MainMenu.xib. I think I understand First Responder and the responder chain
(maybe), and my menus are firing the methods I want them to fire in
various controllers. Unfortunately, the instance variables in the
controllers always are null when called from a menu. But when the same
method is called by a button, the values of the instance variables are as
expected. I have made sure that the controllers and their instance
variables are alloc/inited before using the menu, and they are. I can fire
a method with a button and watch it work, and then in the same runtime
fire it with a menu and watch it come up null. Obviously I am missing
something major about menus.

Has anyone seen this and how can I remove it?

Has anyone seen this and how can I remove it?

I have a folder which I'm not able to delete or open. when I check its
properties, it seems like I have a drive beneath my folder:

C:backup is the name of the folder. Although I have a C drive, working
fine, but what about this ? Does anyone know how to overcome/delete this
folder? Normal delete process not working and neither is any tool. When I
try to open this, it shows an error like this:

Mysql/php: Select file extension types simple query?

Mysql/php: Select file extension types simple query?

I am trying to select all images from table. My column is file_ext and
contains jpg, jpeg, mp3, avi and so on extensions.
How can i create SQL query like this?: AND file_ext = 'jpg, jpeg' or to
select all extensions AND file_ext = '*' Because I do not want to write
AND file_ext = 'jpg' AND file_ext = 'jpeg' ....
How do you guys solve problems like this? Thanks!

Gmail Address List Sender POP Up

Gmail Address List Sender POP Up

Is there a method (Way) to turn off the Pop Up Box as I move the cursor
over email sender's id as I browse emails. I suffer headaches from
flashing objects (like blinking red lights) in one or two seconds. As I
review the emails I must often stop and recover.

Figure going too much into right in xelatex, not in latex

Figure going too much into right in xelatex, not in latex

My problem is somewhat similar to another question on this site . I tried
the answer given there but it didn't solve my problem.
The problem is that my figure goes too much into right, even though I have
used \centering command. This problem only comes on compiling with XeLaTex
and not with Latex; I don't know why. The MWE will illustrate this. Here
is code:
\documentclass[14pt,a4paper]{extbook}
\usepackage{float}
\usepackage{graphicx}
\usepackage[top=2.7cm, bottom=2.7cm, left=2.2cm, right=2.2cm]{geometry}
\begin{document}
\date{}
123456789123456789123456789123456789123456789
\begin{figure*}[htbp]
\centering
\includegraphics [scale=0.5] {MWE.eps}
\caption{Using centering}
\end{figure*}
123456789123456789123456789123456789123456789
\begin{figure*}[htbp]
\centering
\vbox{\vspace{1.8em}\includegraphics [scale=0.5] {MWE.eps}}
\caption{Using centering and vbox and vspace\{1.8em\}}
\end{figure*}
123456789123456789123456789123456789123456789
\begin{figure*}[htbp]
\centering
\hbox{\hspace{-0.4em}\includegraphics [scale=0.5] {MWE.eps}}
\caption{Using centering and hbox and hspace\{-4em\}}
\end{figure*}
\end{document}
Here is the output using XeLatex (on windows)
Here is the output using Latex (on linux)

Friday, 23 August 2013

C check for number of divisors

C check for number of divisors

I am trying to find the number of divisors for each number from 1 to 100,
but i do not understand why it is not working. The compiler said that the
error is in line 18, 21 and 24.
#include <stdio.h>
#include <math.h>
#define N 100
int main()
{
float n;
float l
for (n=1; n<=N; n++) { //genertate a list of numbers
int a;
for (a=n; a>=n; a--) { //genarate a list of numbers less than "n"
l = n/a; //divide each number less than "n"
if (l == round(l)) { //see is "l" is a divisor of "n"
l=l+1; //if it finds a divisor it will add it
printf(n, l); //prints the number as well as the number of
divisors
}
}
}
}

Prove $ g | f $ and $ f | g \iff $ when $ f = c \cdot g $

Prove $ g | f $ and $ f | g \iff $ when $ f = c \cdot g $

Let $ f, g \in F[x] $, where $ F $ is a field. Prove that, $ g | f $ and $
f | g \iff $ when $ f = c \cdot g $ for $ c \in F^*$. I don't know nothing
about it, so I please at help.

_doPostBack not defined

_doPostBack not defined

I have written the script dynamically using string builder as follows
public static void ShowMessage1(ENUM_MessageType pMessageType, string
pMessage, Button c)
{
StringBuilder strScript = new StringBuilder();
strScript.Append("<script type=\"text/javascript\"
src=\"").Append("/Scripts/jquery-1.4.1.js").Append("\"></script>");
strScript.Append("<script type=\"text/javascript\"
src=\"").Append("/Scripts/jquery.msgBox.js").Append("\"></script>");
strScript.Append("<link rel=\"stylesheet\" type=\"text/css\"
href=\"").Append("/Styles/msgBoxLight.css").Append("\" />");
strScript.Append("<script type=\"text/javascript\">");
strScript.Append("(function example()");
strScript.Append("{");
strScript.Append("$.msgBox({");
strScript.Append("title:'" + lMessageType + "'");
strScript.Append(",");
strScript.Append("content:'" + pMessage + "'");
strScript.Append(",");
strScript.Append("type:'" + lOptionType + "'");
strScript.Append(",");
strScript.Append("buttons: [{ value: 'Yes' }, { value: 'No'}],");
strScript.Append("success: function (result) {");
strScript.Append("if(result == 'Yes'){");
strScript.Append("javascript:_doPostBack('" + c.ClientID + "','');");
strScript.Append("}");
strScript.Append("}");
strScript.Append("});");
strScript.Append("})();");
strScript.Append("</script>");
if (page != null &&
!page.ClientScript.IsClientScriptBlockRegistered("alert"))
{
page.ClientScript.RegisterClientScriptBlock(typeof(enumClass),
"info", strScript.ToString());
}
}
I am getting the exception as ReferenceError: _doPostBack is not defined
can some one help me

extending built-in python dict class

extending built-in python dict class

I want to create a class that would extend dict's functionalities. This is
my code so far:
class Masks(dict):
def __init__(self, positive=[], negative=[]):
self['positive'] = positive
self['negative'] = negative
I want to have two predefined arguments in the constructor: a list of
positive and negative masks. When I execute the following code, I can run
m = Masks()
and a new masks-dictionary object is created - that's fine. But I'd like
to be able to create this masks objects just like I can with dicts:
d = dict(one=1, two=2)
But this fails with Masks:
>>> n = Masks(one=1, two=2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'two'
I should call the parent constructor init somewhere in Masks.init
probably. I tried it with **kwargs and passing them into the parent
constructor, but still - something went wrong. Could someone point me on
what should I add here?

`Editable-Changable` Variable in a delete statement

`Editable-Changable` Variable in a delete statement

think about this with me and tell me if it´s possible:
Lets say u have a simple delete statement like this one:
<?php
$con=mysqli_connect("localhost","root","admin","inventarisdb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if (!mysqli_query($con,"DELETE FROM BCD WHERE LastName='Griffin'");
{
echo "Succesfully Deleted <br/> ";
echo "<a href='Reports.php'>View Result</a>";
}
mysqli_close($con);
?>
This statement deletes everything in the table row that matches that given
Lastname. Great! but now:
Lets say that Ur table gets updated a lot and ur adding names and U get
more entries with the same LastName , but U don't want all of them Rows to
get deleted with this LastName.
Is it possible to write the Delete statement in such a way that the
variable for LastName is Editable or Changeable? What I mean is for
example: being able to Change LastName to Age for example or Any other
variable I have in the table that I want to use instead to execute delete
with, without having to do so in my php script, but simply from the app.
page itself.
So the actions u would take with such a code would be navigating to the
Delete tab in this app, Changing the variable u want to use to make ur
search for delete with, through typing or a drop down list for example and
eventually press delete for execute.
I'm thinking something like this for example:
if (!mysqli_query($con,"DELETE FROM persons WHERE (variable)='<a href:
Select2Delete.php>'");
And so I would be able to fill in the variable corresponding to my table
collumns I want to search by to delete.
I have been looking @ checkboxes and auto increment and ways about doing
this differently, but I want to know if this is possible first since I
find it an easy way to make the script work compared to having to set up a
table that first looks up the data and then add checkboxes with a delete
button with a load of If Statements to execute a delete by selecting a box
feel me?
Any advice, comment, remark is welcome! This is a Pure thought that I want
to share and ask ur opinion about!
Thank you in advanced! Cheers to this forum!

Using unique_ptr to release XMLString, XERCES

Using unique_ptr to release XMLString, XERCES

unique_ptr <XMLString, the release function> uPtr I want to use unique_ptr
to release the XMLString class of XERCES.
For those who dont know XML parser XERCES, How can i use the unique_ptr so
that i can use a function of that class to release the object. instead of
new or delete.
Is this correct, unique_ptr <XMLString, XMLString::release> uPtr

Thursday, 22 August 2013

Call Java functions dynamically based on strings

Call Java functions dynamically based on strings

I am building a java unit converter for an android application. I am
offering the user a lot of different unit conversions, it ends up being
220 total conversions possible, 110 if you only count going in one
direction. I.E. meters -> feet and feet -> meters would be two different
conversions.
As of right now, I am planning on writing small methods for each
conversion, so 220 in total ( I think this is probably the easiest way to
go about it, even thought it will take some time). Now my question is,
once I set 2 variables (convertFrom and convertTo) I want to know if it is
possible to call the proper method dynamically? I could just create
if/else if blocks, but that would just end up being an insane amount of
code, and was hoping there was a better way to go about calling the
correct method based off the 2 variables mentioned above. Any advice?
P.S. Sorry about no code here, I am only just getting started here and am
just in the planning phase for this one.

Why are questions that can be easily be googled, still asked here?

Why are questions that can be easily be googled, still asked here?

I was wondering why are still questions that really easy to be googled
still appears to be in here. In some ways, we can actually google it first
before posting it so that it would appears to be meaningful here.

Submit form to another page within the same domain which has no form ID

Submit form to another page within the same domain which has no form ID

How to submit form to another page within the same domain which has no
form ID or name?
Form that needs to submit to another page:
<form id="login_form" action="afterlogic" method="post">
<div class="input-req-login"><label
for="user">Email Address</label></div>
<div class="input-field-login icon
username-container">
<input id="email" autofocus="autofocus"
data-bind="value: email, hasfocus: emailFocus,
valueUpdate: 'afterkeydown'"
placeholder="Enter your email address."
class="std_textbox" type="text" tabindex="1"
required>
</div>
<div style="margin-top:30px;"
class="input-req-login"><label
for="pass">Parola</label></div>
<div class="input-field-login icon
password-container">
<input id="password" data-bind="value:
password, hasfocus: passwordFocus,
valueUpdate: 'afterkeydown'"
placeholder="Enter your email password."
class="std_textbox" type="password"
tabindex="2" required>
</div>
<div class="controls">
<div class="login-btn">
<button type="submit"
onclick="document.getElementById('Mail_LayoutSidePane_Toolbar').submit()"
data-bind="text: signInButtonText,
command: loginCommand"
tabindex="3">Autentificare</button>
</div>
</div>
<div class="clear" id="push"></div>
</form>
Target form:
<form class="form fields" action="#/" onsubmit="return false;"
data-bind="command: loginCommand"> <div class="fieldset"> <div class="row
email" data-bind="visible: emailVisible, css: {'focused': emailFocus(),
'filled': email().length > 0}"> <label for="email" class="title
placeholder" data-i18n="LOGIN/LABEL_EMAIL" data-bind="i18n:
'text'"></label> <span class="value"> <input id="email" class="input"
type="text" autocomplete="off" data-bind="value: email, hasfocus:
emailFocus, valueUpdate: 'afterkeydown'" /> </span> </div> <!--<div
class="row login" data-bind="visible: loginVisible, css: {'focused':
loginFocus(), 'filled': login().length > 0}"> <label for="login"
class="title placeholder" data-i18n="LOGIN/LABEL_LOGIN" data-bind="i18n:
'text'"></label> <span> <input id="login" class="input" type="text"
data-bind="value: login, hasfocus: loginFocus, valueUpdate:
'afterkeydown'" /> </span> </div>--> <div class="row password"
data-bind="css: {'focused': passwordFocus(), 'filled': password().length >
0}"> <label for="password" class="title placeholder"
data-i18n="LOGIN/LABEL_PASSWORD" data-bind="i18n: 'text'"></label> <span
class="value"> <input id="password" class="input" type="password"
data-bind="value: password, hasfocus: passwordFocus, valueUpdate:
'afterkeydown'" /> </span> </div> </div> <div class="row buttons"> <button
type="submit" class="button login" data-bind="text: signInButtonText,
command: loginCommand"></button> </div> <div class="row signme"
data-bind="visible: signMeType() !== Enums.LoginSignMeType.Unuse"> <span>
<label class="custom_checkbox" data-bind="css: {'checked': signMe}"> <span
class="icon"></span> <input id="signme" type="checkbox"
data-bind="checked: signMe" /> </label> <label class="title" for="signme"
data-i18n="LOGIN/LABEL_REMEMBER_ME" data-bind="i18n: 'text'"></label>
</span> </div> </form>
Actully we are taling about this page http://webmail.adresemail.com/
trying to submit to this page http://webmail.adresemail.com/afterlogic/

Validating radio elements in a form not by the name

Validating radio elements in a form not by the name

i have to validate the radio elements in a form with javascript, but i
cannot do it by the name (getElementByName), for many reasons that it's
long explaining. Actually i'm trying to validate them symply with:
for (var i=0; i<document.forms[0].elements.length; i++){
element = document.forms[0].elements[i];
if(element.checked){}
else {alert("whatever");}
}
But in the form there is an element which is a button, and it counts linke
a not checked element and always returns the else statement. So this code
is not useful to validate the form. Is there a manner to select only the
radio elements of a form? Like type[radio] or something like that? Thanks
in advance for your time. Agnese

PHPexcel: Combine two variables into one cell

PHPexcel: Combine two variables into one cell

I'm trying to create an excel sheet with data from a mysql database.
At some point I want to combine two variables into one cell.
EXAMPLE:
$customer = $row["city"].' '.$row["name"]; // Doesn't work
$rowNumber = 2;
while ($row = mysql_fetch_assoc($result)) {
$col = 'A';
$sheet->setCellValueExplicit('A'.$rowNumber, $row['routenr']);
$sheet->setCellValueExplicit('C'.$rowNumber, $date);
$sheet->setCellValueExplicit('D'.$rowNumber, $customer);
$rowNumber++;
}
Any ideas?

Wednesday, 21 August 2013

What is mod(a,b)?

What is mod(a,b)?

I was reading the AKS Primality Test. AKS. I could not understand the line :
$(x - a)^{n} = (x^{n} - a) \pmod{(n,x^{r}-1)}$
What is $\mod{(a,b)}$ in it ?

Cannot remove on mongodb using mongoose?

Cannot remove on mongodb using mongoose?

Hi im trying to simply remove a document from a collection using mongoose
but for some strange reason I cannot get it to work.
Here is the code:
function deleteUserevent()
{console.log('in delete User Event');
models.Userevent.remove({ _id: "5214f4050acb53fe31000004"},
function(err) {
if (!err){
console.log('deleted user event!');
}
else {
console.log('error');
}
});
}
Can anyone help me out on my syntax? I know the _id is stored as new
ObjectId("5214f4050acb53fe31000004") but I have tried this with no joy?
Thanks.

How to know current time from internet from command line in Linux?

How to know current time from internet from command line in Linux?

How to know current time from internet from command line in Linux?
For example, with ntpq program?
Note: not from computer or operating system clock, but from internet?
Note: I don't want to CHANGE or to SYNC time. Just KNOW it.

Nodejs Google Drive API

Nodejs Google Drive API

I am trying to understand how the authorization(particular the refresh
tokens) working for nodejs Google Drive API.
Here it's the code from https://github.com/google/google-api-nodejs-client.
oauth2Client.credentials = {
access_token: 'ACCESS TOKEN HERE',
refresh_token: 'REFRESH TOKEN HERE'
};
client
.plus.people.get({ userId: 'me' })
.withAuthClient(oauth2Client)
.execute(callback);
General Question: How does refresh tokens actually work together with
access token?
Background: As what I interpret is that each access token has a limited
timespan (~1 hr). So when a user FIRST connect to my server (which the
server provides mechanism for user authentication), the server receives
limited-life access token and ONE-TIME refresh token. After 1 hour, the
access token is expired.
Specific question: Here comes to the key questions. After the expiration,
my server stills send request to the Google Drive Api with the EXPIRED
access token and refresh token (Server uses session to store those
values). Will this still be able to access the content in Google Drive?
What I am guessing is that the nodejs lib + google drive api is SMART
enough to detect the access token is expired & refresh token is identified
& api replace the expired access token with new access token blindly (like
server does not need to do anything; just google drive api). Will the api
response the server with a new Access Code?
I need to figure this out because I need to organize my code in Nodejs
effectively.
Thanks!

Vlooukp issue with Excel using Macro

Vlooukp issue with Excel using Macro

I am trying to run a Vlooukp on a Table in Excel.
I want to save this as a macro.
It works fine but when I run the macro again, the headers of my new
columns get messed up and go to different places.
This does not always happen, sometimes it works ok.
Any ideas?

Loading indicator stays in Firefox after iframe finished loading

Loading indicator stays in Firefox after iframe finished loading

I have an iframe placed in my page's body like this:
<iframe src="about:blank" onload="this.contentWindow.document.write('some
text')">
It works well enough, the onload event replaces iframe's content with
"some text" and thats it.
BUT in Firefox it causes the spinning wheel "loading indicator" which
shows you that the page is being loaded to never go away. There is only
text being inserted into the iframe, so there is no other content hanging
around, waiting to be loaded. When I remove the iframe from the page it
removes the problem, so I know, it is the said iframe which is causing it.
It works correctly in IE and Chrome.
Now, I can do something like this:
<iframe src="about:blank" onload="this.contentWindow.document.write('some
text'); t.contentWindow.stop();">
Which fixes the problem in Firefox, but it prevents any images in the
iframe from loading (i don't use any in the example insert text, but they
will be added later on).
So, how do i go about fixing this?
Thanks

Tuesday, 20 August 2013

Retrieve a row using a function similar to like

Retrieve a row using a function similar to like

In case I have a row as 12345^abc^xyz in Hbase, is it possible to retrieve
all the rows containing abc?
Example :
Row 1 :789^abc^www Row 2 :890^abc^yyy Row 3 :800^abc^xxx
I need to retrieve all rows which contain the String abc

JAVA reuse onTouchListener, setOnFocusChangeListener Events for editText

JAVA reuse onTouchListener, setOnFocusChangeListener Events for editText

dateField.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus &&
TextUtils.isEmpty(dateField.getText().toString())){
dateField.setText(DateDefaultValue);
} else if (hasFocus &&
dateField.getText().toString().equals(DateDefaultValue)){
dateField.setText("");
}
else
{btnShowHide.setVisibility(RelativeLayout.VISIBLE);}
if (!hasFocus)
{
if (dateField.getText().length() >0)
btnShowHide.setVisibility(RelativeLayout.INVISIBLE);
}
}
});
I want to reuse my event for setOnFocusChangeListener and onTouchListener
and for all of my events for my editText Fields without doing copy paste.

Accessing logging functionality from a class library

Accessing logging functionality from a class library

I have a solution with two projects, my WPF application project which
references the second project, a class library. The WPF application uses
Caliburn.Micro. I would like some classes in the library to log messages
through Caliburn.Micro's logging facility (which I've set up with log4net,
but that should be irrelevant).
To see if this would work, I put the following class into my library to
see if anything would show up in my log, and called it from one of my
viewmodels:
public class TempClass {
private static ILog Log = LogManager.GetLog(typeof(TempClass));
public static void LogSomething(string something) {
Log.Info(something);
}
}
It didn't work.
The class library can't reference my WPF application's project because
that would cause a circular reference. I figure I could have a static
object in the library that holds a reference to the WPF app's LogManager,
and I could set that up in my bootstrapper, but that doesn't feel like the
right solution.
What is a good solution to this problem?

passing parameters to controller from iterable component

passing parameters to controller from iterable component

How can I pass parameters to my controller from an iterable component? I'm
using actionSupport with an input checkbox to call an action method in my
controller. I need to pass two values back to the controller that I can
reference in my inner class and set the values on two of my properties in
the inner class.
Here is the relevant section of my VF page:
<apex:pageBlock id="participantBlock">
<apex:pageBlockButtons location="top" id="topBtnParticipant">
<apex:commandButton id="btnParticipant" value="Add
Participant" action="{!addParticipant}"
reRender="participantTable" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Participants" columns="1"
id="participantSection">
<apex:pageBlockTable id="participantTable"
value="{!participantLinesForPage}" var="part">
<apex:column style="white-space:nowrap;text-align:center;"
width="4%">
<apex:commandLink rerender="participantTable"
action="{!deleteParticipant}">
<apex:param name="del" value="{!part.iterate}"/>
<apex:image id="deleteImage"
value="{!URLFOR($Resource.Icons, 'delete.png')}"
width="16" height="16"/>
</apex:commandLink>
</apex:column>
<apex:column headerValue="Contact" width="30%">
<apex:inputHidden value="{!part.contactId}"
id="targetContactId" />
<apex:inputText value="{!part.contactName}"
id="targetContactName" onFocus="this.blur()"
disabled="false" style="width:175px;" />
<a href="#"
onclick="openContactLookupPopup('{!$Component.targetContactName}',
'{!$Component.targetContactId}',
'userLookupIcon{!part.iterate}',
'accountLookupIcon{!part.iterate}'); return false"
><img onmouseover="this.className =
'lookupIconOn';this.className = 'lookupIconOn';"
onmouseout="this.className =
'lookupIcon';this.className = 'lookupIcon';"
onfocus="this.className = 'lookupIconOn';"
onblur="this.className = 'lookupIcon';"
class="lookupIcon" src="/s.gif"
id="contactLookupIcon{!part.iterate}" /></a>
</apex:column>
<apex:column headerValue="Add Task" width="6%"
headerClass="columnAlignment"
styleClass="columnAlignment">
<apex:inputCheckbox value="{!part.selected}"
disabled="{!IF(part.selected == true, true, false)}" >
<apex:actionSupport event="onchange"
action="{!addTaskFromParticipant}"
oncomplete="this.disabled=true;"
rerender="taskTable" />
<apex:param value="{!part.contactId}"
assignTo="{!whoid}" />
<apex:param value="{!part.contactName}"
assignTo="{!whoname}" />
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="User" width="30%">
<apex:inputHidden value="{!part.userId}"
id="targetUserId" />
<apex:inputText value="{!part.userName}"
id="targetUserName" onFocus="this.blur()"
disabled="false" style="width:175px;" />
<a href="#"
onclick="openUserLookupPopup('{!$Component.targetUserName}',
'{!$Component.targetUserId}',
'contactLookupIcon{!part.iterate}',
'accountLookupIcon{!part.iterate}'); return false"
><img onmouseover="this.className =
'lookupIconOn';this.className = 'lookupIconOn';"
onmouseout="this.className =
'lookupIcon';this.className = 'lookupIcon';"
onfocus="this.className = 'lookupIconOn';"
onblur="this.className = 'lookupIcon';"
class="lookupIcon" src="/s.gif"
id="userLookupIcon{!part.iterate}" /></a>
</apex:column>
<apex:column headerValue="Account" width="30%">
<apex:inputHidden value="{!part.accountId}"
id="targetAccountId" />
<apex:inputText value="{!part.accountName}"
id="targetAccountName" onFocus="this.blur()"
disabled="false" style="width:175px;" />
<a href="#"
onclick="openAccountLookupPopup('{!$Component.targetAccountName}',
'{!$Component.targetAccountId}',
'contactLookupIcon{!part.iterate}',
'userLookupIcon{!part.iterate}'); return false" ><img
onmouseover="this.className =
'lookupIconOn';this.className = 'lookupIconOn';"
onmouseout="this.className =
'lookupIcon';this.className = 'lookupIcon';"
onfocus="this.className = 'lookupIconOn';"
onblur="this.className = 'lookupIcon';"
class="lookupIcon" src="/s.gif"
id="accountLookupIcon{!part.iterate}" /></a>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
I was trying to use the <apex:param> component and the assignTo attribute.
But, that never fires.
When the user selects the checkbox, I want to pass the contactId and
contactName for that particular record in the <apex:pageBlockTable> and
set it equal to the properties whoid and whoname
I can then reference those properties in my inner class and set the values
equal to a couple of properties that I have defined in my inner class that
is used elsewhere in my VF page. Is there a way to do this?
Thanks for any help. Regards.

Issue reading hidden column using VBA in Excel 2013

Issue reading hidden column using VBA in Excel 2013

I am currently having issues with a Macro I am programming for Excel 2013
regarding reading hidden columns. I am trying to utilize Column A as a row
of unique keys to allow me to quickly develop logic that hides and shows a
row based on the key value in column A. When I hide column A manually in
the sheet for visual purposes I am then unable to read from that column,
aka my code returns an error. If I show the column the code executes
clearly. Thanks in advance for the help!
Public Sub hideRow(findId As String, sheetName As String)
Dim lastRow As Long
Dim foundCell As Range
Dim hideThisRowNum As Integer
'Get Last Row
lastRow = Worksheets(sheetName).Range("A" & Rows.Count).End(xlUp).Row
'Find ID
With Worksheets(sheetName).Range("a1:a1000") 'This needs to be A1 to AxlDown
Set foundCell = Worksheets(sheetName).Range("A1:A" &
lastRow).Find(What:=findId, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
End With
'Get Row # to Hide
hideThisRowNum = Val(foundCell.Row)
'Hide row
Worksheets(sheetName).Rows(hideThisRowNum).Hidden = True
'Set Add To Action Plan = No
Worksheets(sheetName).Range("G" & hideThisRowNum).Value = "No"
End Sub

Numpy array: concatenate arrays and integers

Numpy array: concatenate arrays and integers

In my Python program I concatenate several integers and an array. It would
be intuitive if this would work:
x,y,z = 1,2,np.array([3,3,3])
np.concatenate((x,y,z))
However, instead all ints have to be converted to np.arrays:
x,y,z = 1,2,np.array([3,3,3])
np.concatenate((np.array([x]),np.array([y]),z))
Especially if you have many variables this manual converting is tedious.
The problem is that x and y are 0-dimensional arrays, while z is
1-dimensional. Is there any way to do the concatenation without the
converting?

Getter and Setter Java AWT-EventQueue-0 java.lang.NullPointerException

Getter and Setter Java AWT-EventQueue-0 java.lang.NullPointerException

Got a little Problem with my getter and setters. I want to open a new
window useing a Menu Item and want to commit my Path to the new Window.
Now I get NullPointerException but I don't know why.
Here is my Code:
@SuppressWarnings("serial")
public class Gui extends JFrame implements ActionListener {
private JTextField txt_filepath;
private JButton btn_search, btn_scale, btn_delete;
private JRadioButton rb_low, rb_med, rb_high;
private JLabel lbl_outpath;
@SuppressWarnings("rawtypes")
private JList filelist;
@SuppressWarnings("rawtypes")
private DefaultListModel selectedFiles;
//JMenü
JMenuItem mitem_outpath, mitem_inpath, mitem_close, mitem_help;
//File Output
private String outpath; <- This is the String i want to commit
.
.
.
Gui() {
..
..
..
//OutPut Path
outpath=System.getProperty("user.home")+"\\Desktop\\bilder bearbeitet";
..
..
..
}
@Override
public void actionPerformed(ActionEvent arg0) {
//MENÜ Items
if(arg0.getSource()==mitem_inpath) {
//INput Path ändern
}
if(arg0.getSource()==mitem_outpath) {
//Output Path ändern
Settings settings = new Settings();
}
if(arg0.getSource()==mitem_close) {
System.exit(0);
}
if(arg0.getSource()==mitem_help) {
//Help
}
}
}
public String getOutpath() {
return outpath;
}
public void setOutpath(String outpath) {
this.outpath = outpath;
}
and the class where i want to use the Path:
@SuppressWarnings("serial")
public class Settings extends JFrame implements ActionListener {
private String newPath;
private JButton btn_ok, btn_abort, btn_edit;
private JTextField txt_file;
private Gui gui;
Settings()
{
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
JLabel lbl_file = new JLabel("Settings");
btn_edit = new JButton("ändern");
btn_edit.addActionListener(this);
btn_ok = new JButton("speichern");
btn_ok.addActionListener(this);
btn_abort = new JButton("abbrechen");
btn_abort.addActionListener(this);
txt_file = new JTextField(gui.getOutpath());
this.setLayout(new GridLayout(5, 2, 5, 5));
this.add(lbl_file);
this.add(txt_file);
this.add(btn_edit);
this.add(btn_ok);
this.add(btn_abort);
this.pack();
this.setLocationRelativeTo(null);
this.setSize(200, 200);
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent arg0) {
if(arg0.getSource()==btn_ok) {
gui.setOutpath(newPath);
}
if(arg0.getSource()==btn_edit){
newPath = txt_file.getText();
}
}
}
And this is the Error Massage
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at de.patrickt.fotoscaler.Settings.<init>(Settings.java:27)
at de.patrickt.fotoscaler.Gui.actionPerformed(Gui.java:259)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
What am I doing wrong?

Monday, 19 August 2013

ANTLR v3 catch all unknown functions

ANTLR v3 catch all unknown functions

I'm wringing a parsing app for lisp like language using antlr v3 but I
need the tool to handle all the functions that it doesn't know how to
handle yet and I'm struggling on how to implement it correctly here is the
basic structure I have:
wrapPrimary
: '(' primary ')'
;
primary
: 'a'^ secondary+
| 'b'^ secondary+
| 'c'^ secondary+
| unknown
;
secondary
: '(' tertiary ')'
| final
;
tertiary
: 'd'^ secondary secondary
| 'e'^ secondary secondary
| unknown
;
unknown
: ~('a'|'b'|'c'|'d'|'e') (~('('|')')|wrapPrimary)*
;
// Basic type
final
: varible
| string
| number
;
So code would be handle something like
(blah VAR (a VAR "STRING"))
(b (blah VAR VAR) VAR)
Where var or string are correct basic types However code fails on (blah
VAR (d VAR "STRING")) Changing unknown to
unknown
: ~('a'|'b'|'c'|'d'|'e') (~('('|')')|wrapPrimary|secondary)*
;
ANTLR complaints about multiple alternatives for matching Joining primary
and tertiary together breaks the language structure i.e 'a' needs to be
followed by 'd' or 'e' Is there easy way to implement sort of catch all in
antlar?
Thank you in advance! I'm quite new to ANTLR

Switch statement in non-anonymous private OnClickListener class not working?

Switch statement in non-anonymous private OnClickListener class not working?

I've tried quite a few different tactics to achieve my desired result, but
nothing is making these buttons do what they're 'sposed to... Basically I
have 14 buttons. Four with the text "X", digitOne, digitTwo, digitThree
and digitFour. Then, there are 10 with "1", "2", etc, named "one", "two",
etc. All the buttons are tied to the same OnClickListener that will use a
switch statement to determine which button was pressed, then find the
soonest display button (buttons initially marked "X"), and change that
buttons text to the entered digit. What I want to happen is:
Say someone clicks the "5" button. If its the first button pressed, the
first "digit" button will change from displaying "X" to "5", and so-on,
so-forth. This is not what is happening... In fact, nomatter what I've
tried, nothing is happening. Not even an error... An error would be nice,
at least I'd know where my logical flaw is -_-. Here's the code:
The button declarations:
one=(Button)findViewById(R.id.button1);
two=(Button)findViewById(R.id.Button2);
three=(Button)findViewById(R.id.Button3);
four=(Button)findViewById(R.id.Button4);
five=(Button)findViewById(R.id.Button5);
six=(Button)findViewById(R.id.Button6);
seven=(Button)findViewById(R.id.Button7);
eight=(Button)findViewById(R.id.Button8);
nine=(Button)findViewById(R.id.Button9);
zero=(Button)findViewById(R.id.Button0);
add=(Button)findViewById(R.id.buttonAdd);
digitOne=(Button)findViewById(R.id.Number1);
digitTwo=(Button)findViewById(R.id.Number2);
digitThree=(Button)findViewById(R.id.Number3);
digitFour=(Button)findViewById(R.id.Number4);
one.setOnClickListener(listener);
two.setOnClickListener(listener);
three.setOnClickListener(listener);
four.setOnClickListener(listener);
five.setOnClickListener(listener);
six.setOnClickListener(listener);
seven.setOnClickListener(listener);
eight.setOnClickListener(listener);
nine.setOnClickListener(listener);
zero.setOnClickListener(listener);
The OnClickListener private inner class (I guess that's what you'd call
it. It's inside Activity class):
private OnClickListener listener = new OnClickListener(){
public void onClick(View button) {
switch(button.getId()){
case R.id.Button0:
addANumber(0);
break;
case R.id.button1:
addANumber(1);
break;
case R.id.Button2:
addANumber(2);
break;
case R.id.Button3:
addANumber(3);
break;
case R.id.Button4:
addANumber(4);
break;
case R.id.Button5:
addANumber(5);
break;
case R.id.Button6:
addANumber(6);
break;
case R.id.Button7:
addANumber(7);
break;
case R.id.Button8:
addANumber(8);
break;
case R.id.Button9:
addANumber(9);
break;
}
}
};
And finally, the "addANumber" method being called:
public void addANumber(int i){
if(digitOne.getText()=="X"){
digitOne.setText(i);
}else if(digitTwo.getText()=="X"){
digitTwo.setText(i);
}else if(digitThree.getText()=="X"){
digitThree.setText(i);
}else if(digitFour.getText()=="X"){
digitFour.setText(i);
}
}
I've done this before... I know I'm missing something so blatantly stupid
it deserves a smack in the head...

Anyone knows a free Drupal theme with jquery Masonry?

Anyone knows a free Drupal theme with jquery Masonry?

I can not find a free drupal theme that uses jquery Masonry and I tried
more Masonry modules but no effect, so I hope someone knows a free Drupal
theme with jquery Masonry.

Public variable isnt changed properly

Public variable isnt changed properly

excuse me if this is on a Topic that already exists, but I don't really
know what I should really search for my problem.
I try to receive a Id from a Parse.com Database within a Function:
getHighestObjektId = function(objekt) {
var objektData = Parse.Object.extend(objekt);
var id__objekt_query = new Parse.Query(objektData);
id__objekt_query.exists("ID");
id__objekt_query.descending("ID");
id__objekt_query.first({
success: function(object) {
objektId = parseInt(object.get('ID')) + 1;
console.log(objektId);
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
});
console.log(objektId);
return objektId;
},
Now my problem. The value objektId is received correctly. The log output
within the query.first function returns the correct value in the console.
But the second log returns null and the whole function too. I just don't
get why the public variable is changed in the function but afterwards null
again.
Any Idea?

Sunday, 18 August 2013

Web app outgrowing current framework

Web app outgrowing current framework

I have quite a bit of experience with using Django for websites and so
when I started a new project I naturally chose to use Django for it.
Everything went well for a time but now the application is really starting
to rub up against what Django can comfortably cope with and I fighting all
the time to ensure that things work as intended.
I've been considering moving the site over to Java EE 7 now that it has
been released. It certainly seems to provide the features I require as
well as also being less forceful in the way that a project is layed out
and maintained. I guess now that I have a good idea of how the application
should be structured development should be much faster.
Have you felt the need to change the web framework you are using simply
because it doesn't lend itself well to the type of project you are trying
to produce?

How much memory will this PHP Script need?

How much memory will this PHP Script need?

I'm trying to use a WordPress Plugin to backup my database and files but
it keeps running out of memory. How much memory will this script need to
finish and how much should I ask for from my hosting provider? Here is the
log output: (the script has 3 minutes to run before my hosting provider
kills it but that is more than enough) [INFO] BackWPup version 3.0.13;
WordPress version 3.6; A project of Inpsyde GmbH developed by Daniel
Hüsken [INFO] This program comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it under certain conditions.
[INFO] Blog url: http://www.nsuchy.tk/ [INFO] BackWPup job: Back It Up
Before It Is Too Late; DBDUMP+FILE [INFO] BackWPup cron: 0 3 * * *; Sun,
18 Aug 2013 @ 20:15 [INFO] BackWPup job started manually [INFO] PHP ver.:
5.3.27-nfsn1; apache2handler; FreeBSD [INFO] Maximum script execution time
is 180 seconds [INFO] MySQL ver.: 5.3.12-MariaDB [INFO] curl ver.: 7.31.0;
OpenSSL/1.0.1e [INFO] Temp folder is:
/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/ [INFO] Logfile
folder is: /f5/nsuchy/public/wp-content/uploads/backwpup-eb255-logs/
[INFO] Backup type is: archive [INFO] Backup file is:
/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/backwpup_24fe7a_2013-08-18_20-15-56.tar.gz
[18-Aug-2013 20:15:56] 1. Try to dump database … [18-Aug-2013 20:15:56]
Connected to database nsuchy on nsuchy.db [18-Aug-2013 20:15:56] Dump
database table "sendmail_lordlinus" [18-Aug-2013 20:15:57] Dump database
table "wp_commentmeta" [18-Aug-2013 20:15:57] Dump database table
"wp_comments" [18-Aug-2013 20:15:57] Dump database table "wp_links"
[18-Aug-2013 20:15:57] Dump database table "wp_options" [18-Aug-2013
20:15:57] Dump database table "wp_postmeta" [18-Aug-2013 20:15:57] Dump
database table "wp_posts" [18-Aug-2013 20:15:57] Dump database table
"wp_term_relationships" [18-Aug-2013 20:15:57] Dump database table
"wp_term_taxonomy" [18-Aug-2013 20:15:57] Dump database table "wp_terms"
[18-Aug-2013 20:15:57] Dump database table "wp_usermeta" [18-Aug-2013
20:15:57] Dump database table "wp_users" [18-Aug-2013 20:15:57] Dump
database table "wp_wfBadLeechers" [18-Aug-2013 20:15:57] Dump database
table "wp_wfBlocks" [18-Aug-2013 20:15:57] Dump database table
"wp_wfBlocksAdv" [18-Aug-2013 20:15:57] Dump database table "wp_wfConfig"
[18-Aug-2013 20:15:57] Dump database table "wp_wfCrawlers" [18-Aug-2013
20:15:57] Dump database table "wp_wfFileMods" [18-Aug-2013 20:15:57] Dump
database table "wp_wfHits" [18-Aug-2013 20:15:57] Dump database table
"wp_wfHoover" [18-Aug-2013 20:15:57] Dump database table "wp_wfIssues"
[18-Aug-2013 20:15:57] Dump database table "wp_wfLeechers" [18-Aug-2013
20:15:57] Dump database table "wp_wfLockedOut" [18-Aug-2013 20:15:57] Dump
database table "wp_wfLocs" [18-Aug-2013 20:15:57] Dump database table
"wp_wfLogins" [18-Aug-2013 20:15:57] Dump database table "wp_wfNet404s"
[18-Aug-2013 20:15:57] Dump database table "wp_wfReverseCache"
[18-Aug-2013 20:15:57] Dump database table "wp_wfScanners" [18-Aug-2013
20:15:57] Dump database table "wp_wfStatus" [18-Aug-2013 20:15:57] Dump
database table "wp_wfThrottleLog" [18-Aug-2013 20:15:57] Dump database
table "wp_wfVulnScanners" [18-Aug-2013 20:15:57] Added database dump
"nsuchy.sql.gz" with 294.56 kB to backup file list [18-Aug-2013 20:15:57]
Database dump done! [18-Aug-2013 20:15:57] 1. Trying to make a list of
folders to back up … [18-Aug-2013 20:16:03] 501 folders to back up.
[18-Aug-2013 20:16:03] 1. Trying to create backup archive … [18-Aug-2013
20:16:03] Compression method is TarGz [18-Aug-2013 20:16:40] Backup
archive created. [18-Aug-2013 20:16:40] Archive size is 23.65 MB.
[18-Aug-2013 20:16:40] 3910 Files with 49.24 MB in Archive. [18-Aug-2013
20:16:40] 1. Trying to send backup with e-mail… [18-Aug-2013 20:16:40]
Sending e-mail to theusernameiwantistaken@gmail.com… [18-Aug-2013
20:16:40] WARNING: fopen() [function.fopen]: SAFE MODE Restriction in
effect. The script whose uid/gid is 219666/219666 is not allowed to access
/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/521163e8dbb11
owned by uid/gid 25000/25000 [18-Aug-2013 20:16:40] WARNING:
fopen(/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/521163e8dbb11/body)
[function.fopen]: failed to open stream: No such file or directory
[18-Aug-2013 20:16:40] WARNING: fseek() expects parameter 1 to be
resource, boolean given [18-Aug-2013 20:16:40] WARNING: fwrite() expects
parameter 1 to be resource, boolean given [18-Aug-2013 20:16:40] WARNING:
fclose() expects parameter 1 to be resource, boolean given [18-Aug-2013
19:16:41 America/Chicago] PHP Fatal error: Allowed memory size of 33554432
bytes exhausted (tried to allocate 3407873 bytes) in
/f5/nsuchy/public/wp-content/plugins/backwpup/sdk/SwiftMailer/classes/Swift/Mime/SimpleMimeEntity.php
on line 706 [18-Aug-2013 20:16:41] ERROR: Allowed memory size of 33554432
bytes exhausted (tried to allocate 3407873 bytes) [18-Aug-2013 20:16:41]
Script stopped! Will start again. [18-Aug-2013 20:16:41] 2. Trying to send
backup with e-mail… [18-Aug-2013 20:16:41] Sending e-mail to
theusernameiwantistaken@gmail.com… [18-Aug-2013 20:16:42] WARNING: fopen()
[function.fopen]: SAFE MODE Restriction in effect. The script whose
uid/gid is 219666/219666 is not allowed to access
/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/521163e9f41b5
owned by uid/gid 25000/25000 [18-Aug-2013 20:16:42] WARNING:
fopen(/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/521163e9f41b5/body)
[function.fopen]: failed to open stream: No such file or directory
[18-Aug-2013 20:16:42] WARNING: fseek() expects parameter 1 to be
resource, boolean given [18-Aug-2013 20:16:42] WARNING: fwrite() expects
parameter 1 to be resource, boolean given [18-Aug-2013 20:16:42] WARNING:
fclose() expects parameter 1 to be resource, boolean given [18-Aug-2013
19:16:42 America/Chicago] PHP Fatal error: Allowed memory size of 33554432
bytes exhausted (tried to allocate 3932161 bytes) in
/f5/nsuchy/public/wp-content/plugins/backwpup/sdk/SwiftMailer/classes/Swift/Mime/SimpleMimeEntity.php
on line 706 [18-Aug-2013 20:16:42] ERROR: Allowed memory size of 33554432
bytes exhausted (tried to allocate 3932161 bytes) [18-Aug-2013 20:16:42]
Script stopped! Will start again. [18-Aug-2013 20:16:43] 3. Trying to send
backup with e-mail… [18-Aug-2013 20:16:43] Sending e-mail to
theusernameiwantistaken@gmail.com… [18-Aug-2013 20:16:43] WARNING: fopen()
[function.fopen]: SAFE MODE Restriction in effect. The script whose
uid/gid is 219666/219666 is not allowed to access
/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/521163eb57dbc
owned by uid/gid 25000/25000 [18-Aug-2013 20:16:43] WARNING:
fopen(/f5/nsuchy/public/wp-content/uploads/backwpup-ee3f5-temp/521163eb57dbc/body)
[function.fopen]: failed to open stream: No such file or directory
[18-Aug-2013 20:16:43] WARNING: fseek() expects parameter 1 to be
resource, boolean given [18-Aug-2013 20:16:43] WARNING: fwrite() expects
parameter 1 to be resource, boolean given [18-Aug-2013 20:16:43] WARNING:
fclose() expects parameter 1 to be resource, boolean given [18-Aug-2013
19:16:43 America/Chicago] PHP Fatal error: Allowed memory size of 33554432
bytes exhausted (tried to allocate 3932161 bytes) in
/f5/nsuchy/public/wp-content/plugins/backwpup/sdk/SwiftMailer/classes/Swift/Mime/SimpleMimeEntity.php
on line 706 [18-Aug-2013 20:16:43] ERROR: Allowed memory size of 33554432
bytes exhausted (tried to allocate 3932161 bytes) [18-Aug-2013 20:16:43]
Script stopped! Will start again. [18-Aug-2013 20:16:44] Job has ended
with errors in 48 seconds. You must resolve the errors for correct
execution.

JPA (Hibernate) issue with OneToOne mappedBy annotation

JPA (Hibernate) issue with OneToOne mappedBy annotation

I have two tables for while I setup a oneToOne relationship. Bill and
BillSimpleEntry. (Each Bill has one BillSimpleEntry
Here is their structure
CREATE TABLE `bill` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
..
..
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
KEY `fk_bill_groups1_idx` (`groupId`),
KEY `fk_bill_user1_idx` (`billPayerId`),
CONSTRAINT `fk_b...` FOREIGN KEY (`groupId`) REFERENCES `groups` (`id`)
ON D ELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_b...` FOREIGN KEY (`billPayerId`) REFERENCES `user`
(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `billsimpleentry`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `billsimpleentry` (
`..` varchar(200) DEFAULT NULL,
`..` text,
`billId` bigint(20) DEFAULT NULL,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `fk_bill_idx` (`billId`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
JPA config (snippet from the bill Entity for the oneToOne relationship
attribute).
@OneToOne(cascade=CascadeType.ALL,mappedBy="billId",fetch = FetchType.EAGER)
private BillSimpleEntry billSimpleEntry;
I'm trying to do a Join between Bill and BillSimpleEntry by
billSimpleEntry.billId and bill.Id. But I seem to get an error.
Here is the error I get-
Caused by: org.hibernate.AnnotationException: Referenced property not a
(One|Many)ToOne:
com.uh.br.domain.BillSimpleEntry.billId in mappedBy of
com.uh.br.domain.Bill.billSimpleEntryry
Here are the entities
Bill.java
@Entity
@Table(name = "bill")
public class Bill implements GenericObject {
/**
*
*/
private static final long serialVersionUID = -5660869020353250221L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
...
..
@OneToOne(cascade=CascadeType.ALL,fetch = FetchType.EAGER)
@JoinColumn(name="billId")
private BillSimpleEntry billSimpleEntry;
...
getters & setters
...
}
BillSimpleEntry.java
@Entity
@Table(name="billsimpleentry")
public class BillSimpleEntry implements GenericObject{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Long billId;
@Column(columnDefinition="TEXT")
private String itemDescription;//napkin
...
...
...
getters & setters
...

Multiple Wordpress installations on Nginx?

Multiple Wordpress installations on Nginx?

I have multiple Wordpress installations on my Nginx server, meaning in my
web root folder i have 1 and then another in a folder called /en/.
On both Wordpress installs i want to use a custom permalink structure like
this:
http://domain.com/%category%/%postname%/ and
http://domain.com/en/%category%/%postname%/
The strange thing is that the "en" install works fine for the home page
like this; http://domain.com/eng/
However if i go to for example; http://domain.com/eng/test-page
I get redirected to; http://domain.com/test-page
This is what my nginx config looks like:
location / {
try_files $uri $uri/ /index.php?$args;
}
Any ideas how i can fix this?
Edit:
If i use the normal permalink structure like so:
http://domain.com/en/?page_id=568
It works just fine