I had a Java developer new to PHP ask me this question the other day, so I thought I'd document the answer here.
Question: are PHP variables passed by value or by reference?
How could i add to a blog or site in general a feature that let users export the content to epub format or some other open ebook formats?
It's not a feature that i normally see on most of the site i browse every day (some has export to pdf that is not great as ebook format), do you think it is feasible?
Hi,
I/m developing JSP/Servlets App,and I want to execute a service at a specific time , for example :
For each day at 10:00 AM , delete any
attachment from the "attachment" table
in the database where column X== NULL.
How can I do this in JSP/Servlets application ?
I use Glassfish as a server .
I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
The Python datetime.isocalendar() method returns a tuple (ISO_year, ISO_week_number, ISO_weekday) for the given datetime object. Is there a corresponding inverse function? If not, is there an easy way to compute a date given a year, week number and day of the week?
For example :
input = 360 seconds
output = 6 minutes
input = 86400
output = 1 day
Is there a built-in method for this.
I did find something similar here.
Just want to know if there is a built-in method?
When initializing a new Date object in JavaScript using the below call, I found out that the month argument counts starting from zero.
new Date(2010, 3, 1); // that's the 1st April 2010!
Why does the month argument start from 0? On the other hand, the day of the month argument (last one) is a number from 1 to 31. Are there good reasons for this?
Hi,
does anyone know of a good profiling tool or library for Clojure?
I would prefer something that could be used from the REPL, along the lines of (with-profiling ...) in Allegro Common Lisp back in the day.
Is there anything along those lines?
Or do you have any experience with (non-commercial) Java profilers that work well with Clojure?
I'm developing a LoB application in Java after a long absence from the platform (having spent the last 8 years or so entrenched in Fortran, C, a smidgin of C++ and latterly .Net).
Java, the language, is not much changed from how I remember it. I like it's strengths and I can work around its weaknesses - the platform has grown and deciding upon the myriad of different frameworks which appear to do much the same thing as one another is a different story; but that can wait for another day - all-in-all I'm comfortable with Java. However, over the last couple of weeks I've become enamoured with Groovy, and purely from a selfish point of view: but not just because it makes development against the JVM a more succinct and entertaining (and, well, "groovy") proposition than Java (the language).
What strikes me most about Groovy is its inherent maintainability. We all (I hope!) strive to write well documented, easy to understand code. However, sometimes the languages we use themselves defeat us. An example: in 2001 I wrote a library in C to translate EDIFACT EDI messages into ANSI X12 messages. This is not a particularly complicated process, if slightly involved, and I thought at the time I had documented the code properly - and I probably had - but some six years later when I revisited the project (and after becoming acclimatised to C#) I found myself lost in so much C boilerplate (mallocs, pointers, etc. etc.) that it took three days of thoughtful analysis before I finally understood what I'd been doing six years previously.
This evening I've written about 2000 lines of Java (it is the day of rest, after all!). I've documented as best as I know how, but, but, of those 2000 lines of Java a significant proportion is Java boiler plate.
This is where I see Groovy and other dynamic languages winning through - maintainability and later comprehension. Groovy lets you concentrate on your intent without getting bogged down on the platform specific implementation; it's almost, but not quite, self documenting. I see this as being a huge boon to me when I revisit my current project (which I'll port to Groovy asap) in several years time and to my successors who will inherit it and carry on the good work.
So, are there any reasons not to use Groovy?
Here is my data model from my application:
id :integer(4) not null, primary key
spam :boolean(1) not null
duplicate :boolean(1) not null
ignore :boolean(1) not null
brand_id :integer(4) not null
attitude :string not null
posted_at :datetime not null
Attitude could have 3 states: negative, positive, neutral.
I want to generate resultset in table, this way, for each day between start and end date:
date | total | positive | neutral | negative
2009-10-10 | 12 | 4 | 7 | 1
(...)
2009-10-30 | 5 | 2 | 1 | 1
And ignore all records which have:
duplicate = true
ignore = true
spam = true
How it's could be done?
My first day using this IDE...
is there a way to configure the IDE to open files in the project by double click? It is rather painful having to drag files from the project overview into the editor window.
I need to know how to wait at set amount of time (about 10 seconds), for a user to input a key or set of keys, before proceeding with an 'auto run' portion of the application.
This is bugging me because I can't quite figure out how the timer works, or threading.sleep, what should I use? Been googling all day.
Using Visual studio 2012, C#.net 4.5 , SQL Server 2008, Feefo, Nopcommerce
Hey guys I have Recently implemented a new review service into a current site we have.
When the change went live the first day all worked fine.
Since then though the sending of sales to Feefo hasnt been working, There are no logs either of anything going wrong.
In the OrderProcessingService.cs in Nop Commerce's Service, i call a HttpWebrequest when an order has been confirmed as completed. Here is the code.
var email = HttpUtility.UrlEncode(order.Customer.Email.ToString());
var name = HttpUtility.UrlEncode(order.Customer.GetFullName().ToString());
var description = HttpUtility.UrlEncode(productVariant.ProductVariant.Product.MetaDescription != null ? productVariant.ProductVariant.Product.MetaDescription.ToString() : "product");
var orderRef = HttpUtility.UrlEncode(order.Id.ToString());
var productLink = HttpUtility.UrlEncode(string.Format("myurl/p/{0}/{1}", productVariant.ProductVariant.ProductId, productVariant.ProductVariant.Name.Replace(" ", "-")));
string itemRef = "";
try
{
itemRef = HttpUtility.UrlEncode(productVariant.ProductVariant.ProductId.ToString());
}
catch
{
itemRef = "0";
}
var url = string.Format("feefo Url",
login, password,email,name,description,orderRef,productLink,itemRef);
var request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = false;
request.Timeout = 5000;
request.Proxy = null;
using (var response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusDescription == "OK")
{
var stream = response.GetResponseStream();
if(stream != null)
{
using (var reader = new StreamReader(stream))
{
var content = reader.ReadToEnd();
}
}
}
}
So as you can see its a simple webrequest that is processed on an order, and all product variants are sent to feefo.
Now:
this hasnt been happening all week since the 15th (day of the
implementation)
the site has been grinding to a halt recently.
The stream and reader in the the var content is there for debugging.
Im wondering does the code redflag anything to you that could relate to the process of website?
Also note i have run some SQL statements to see if there is any deadlocks or large escalations, so far seems fine, Logs have also been fine just the usual logging of Bots.
Any help would be much appreciated!
EDIT: also note that this code is in a method that is called and wrapped in A try catch
UPDATE: well forget about the "not sending", thats because i was just told my code was rolled back last week
I have been accumulating points all afternoon, but seem to be stuck at 176. Seems an odd number to get stuck on, but I know the reputation limit is 200 a day. Any ideas?
I'm trying to create an array which will hold the hours in a day so I can loop through it for a clock.
I have:
int hourArray[24] = {12, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 01, 02,
03, 04, 05, 06, 07, 08, 09, 10, 11};
I am getting the error on the following numbers in order 08, 09, 08, 09.
It tells me:
Error: invalid octal digit
I've never run into this before and I'm wondering if there is any way around it?
Good Day!
i want to add a subview in another view in iphone. and i want that child view to be of size which i want like if i want to change its height/width i can. Can somebody please suggest me something or help me out in this regard.
Thanks in advance
Hi,
Astonished to see today morning when logined, My point was 4453 or 4553 when leaving on last working day friday, but now 4153, 300 or 400 lost.
How ?
I've noticed that the icon belonging to the Calendar app on the iPhone updates to show the latest day. Is there anything in the SDK that will let me do this in my apps?
Good day,
I have an application written using the Symfony framework. The application works on my development server, where I have shell access. However, I am unable to load my application on my host, as I need to run symfony doctrine::build on the command line on the host.
Is there another way to load the database after or during symfony project:deploy?
Currently I am working and running my first Open-Source project and though I am quite happy how things are working so far, I have the feeling that a lot of things could be done better.
So, what books about Open-Source would you recommend me in order to help filling this gap and making things better every day? What are the books that influenced you the most?
I am especially interested in:
- How to organize and run an Open-Source project
- Best practices
- Manage and involve users and developers
- How to announce and do the releases
- Legal issues
Every so often (at least a couple of times a day), my VS2008 windows are rearranging themselves.
Team/Solution/Server Explorer - They jump from the right sidebar down to the bottom, or suddenly become free-floating.
Same with Errors/Pending Changes/etc. free-floating or suddenly gone, as if they've been closed.
It is very strange behaviour. Has anyone else experienced it? Am I doing something silly that would account for this?
I'm building multiple countdown clocks on one page. The number of countdown clocks varies from day to day so I need to call javascript several times from within "while" code in php to produce different clocks. The following code works but it's based on knowing how many clocks are needed before I start:
<script language="javascript" src="countdown.js"></script>
<script language="javascript">
var cd1 = new countdown('cd1');
cd1.Div = "clock1";
cd1.TargetDate = "<?php echo "$clocktime"; ?>";
cd1.DisplayFormat = "%%D%% days, %%H%% hours, %%M%% minutes, %%S%% seconds until event AAA happens";
</script>
<div id="clockwrapper"><div id="clock1">[clock]</div></div>
<script language="javascript" src="countdown.js"></script>
<script language="javascript">
var cd2 = new countdown('cd2');
cd2.Div = "clock2";
cd2.TargetDate = "02/01/2011 5:30:30 PM";
cd2.DisplayFormat = "%%D%% days, %%H%% hours, %%M%% minutes, %%S%% seconds until event BBB happens...";
</script>
<div id="clockwrapper"><div id="clock2">[clock]</div></div>
So if I keep on calling the javascript above (the code with cd1 in it) all previous "cd1" clocks change to the latest clock because it is being overwritten. Somehow I need to call javascript from within my "while" loop in php and have cd1 become cd2, then cd3 so that the clocks work as they're supposed to.
How do I go about doing this? I don't know how to call the javascript several times and increment the variable cd1 within the javascript. I tried something like this but couldn't get it to work.
$id=mysql_result($result,$i,"id");
while($id){
$cd = ("$cd"."$id");
?>
<script language="javascript" src="countdown.js"></script>
<script language="javascript">
var <?php echo "$cd"; ?> = new countdown('<?php echo "$cd"; ?>');
....
</script>
<div id="clockwrapper"><div id="<?php echo "$cd"; ?>">[clock]</div></div>
<?php
$id=mysql_result($result,$i,"id");
}
?>
Surely there is some easy way of getting around this that I don't know about.
Thanks
Back in the day, there was a standard that I was taught a standard for modelling database entities using text only, I can't remember the name of the standard but it looked somehing like
TableName, Key, Column
Anybody know what that form was called?
Soon I'll be launching my new site and i was planning on using gmail as the email server for things like registration and lost password.
I'll be using google apps (free version) so I can have [email protected].
Besides the 500/day limit are there any other potential problems with using gmail for this service?
Hi,
considering I have experience with Java SE: which language should I learn(and is best for that purpose) in order to build web applications some day with it? I have been contemplating PHP and Java EE. The latter does indeed seems as an obvious choice given my Java SE knowledge. But how does it fares in comparison with PHP and how good is it for the aforementioned purpose?
If there is a better language for this purpose, feel free to recommend it.
Thank you.