I have a TargetProcess machine, and my developers keep committing code to SVN. How can I have TP automatically group builds so that I can know which bugs, were committed during which builds?
Thank you.
I'm trying to create a set of overloaded templates for arrays/pointers where one template will be used when the compiler knows the size of the array and the other template will be used when it doesn't:
template <typename T, size_t SZ>
void moo(T (&arr)[SZ])
{ ... }
template <typename T>
void moo(T *ptr)
{ ... }
The problem is that when the compiler knows the size of the array, the overloads are ambiguous and the compile fails.
Is there some way to resolve the ambiguity (perhaps via SFINAE) or is this just not possible.
I was wondering, is there a way to detect if a certain image / div is loaded?
For example when i am loading two heavy images and showing a loading sign at the two places the images will later occupy, is there a way to already display the first image when it's loaded while still loading the second one?
Google App Engine provides a image API for storing / retrieving images. We are currently not in a position to deploy our application on top of App Engine because of limitations in the java frameworks (jboss seam 2.2.0) we are using to build our j2ee application.
We would eventually want to deploy our production application on top of Google App Engine, but what are the short term options (java based open source products) which provides comparable functionality to Google App Engine's Image API and will have an easier migration path at a later point in time.
How do I figure out the font family and the font size of the words in a pdf document? We are actually trying to generate a pdf document programmatically using iText, but we are not sure how to find out the font family and the font size of the original document which needs to be generated. document properties doesn't seem to contain this information
I'm developing a PHP App on IIS 7.5, which uses PHP FTP commands.
These all work, apart from ftp_size().
I've tested:
cmd.exe > ftp host > username > password > SIZE filename = Invalid Command
However, if I access the FTP site through an Internet Browser, the filesize is displayed.
Do I need to install FTP Extensions, and if so, which ones and where do I get them?
Here is the PHP Code:
<?php
// FTP Credentials
$ftpServer = "www.domain.com";
$ftpUser = "username";
$ftpPass = "password";
// Unlimited Time
set_time_limit(0);
// Connect to FTP Server
$conn = @ftp_connect($ftpServer)
or die("Couldn't connect to FTP server");
// Login to FTP Site
$login = @ftp_login($conn, $ftpUser, $ftpPass)
or die("Login credentials were rejected");
// Set FTP Passive Mode = True
ftp_pasv ($conn, true);
// Build the file list
$ftp_nlist = ftp_nlist($conn, ".");
// Alphabetical sorting
sort($ftp_nlist);
// Display Output
foreach ($ftp_nlist as $raw_file) {
// Get the last modified time
$mod = ftp_mdtm($conn, $raw_file);
// Get the file size
$size = ftp_size($conn, $raw_file);
// Size is not '-1' => file
if (!(ftp_size($conn, $raw_file) == -1)) {
//output as file
echo "Filename: $raw_file<br />";
echo "FileSize: ".number_format($size, '')."Kb</br>";
echo "Last Modified: ".date("d/m/Y H:i", $mod)."</br>";
}
}
?>
While debugging a crash, I came across this issue in some code:
int func()
{
char *p1 = malloc(...);
if (p1 == NULL)
goto err_exit;
char *p2 = malloc(...);
if (p2 == NULL)
goto err_exit;
...
err_exit:
free(p2);
free(p1);
return -1;
}
The problem occurs when the first malloc fails. Because we jump across the initialization of p2, it contains random data and the call to free(p2) can crash.
I would expect/hope that this would be treated the same way as in C++ where the compiler does not allow a goto to jump across an initialization.
My question: is jumping across an initialization allowed by the standard or is this a bug in gcc's implementation of c99?
Most of the sites capture the date (e.g. birth date) information as either a single entity (i.e via a calendar control) or instead as separate fields (date, month, year).
Are there any benefits in showing them as separate fields?
Are they represented in the database as DATE data type or as separate fields.
I am just trying to understand the pros & cons of representing the date field.
I'm getting this error no matter what with python and sqlite.
File "addbooks.py", line 77, in saveBook
conn.commit()
sqlite3.OperationalError: cannot commit transaction - SQL statements in progress
The code looks like this:
conn = sqlite3.connect(fname)
cread = conn.cursor()
cread.execute('''select book_text from table''')
while True:
row = cread.fetchone()
if row is None:
break
....
for entry in getEntries(doc):
saveBook(entry, conn)
Can't do a fetchall() because table and column size are big, and the memory is scarce.
What can be done without resorting to dirty tricks(as getting the rowids in memory, which would probably fit, and then selecting the rows one by one)?.
We are designing an online application (college admission form) which mandates the user to upload a scanned copy of his photo along with his signature, so that this information can be used to cross verify the applicant when he appears for a exam + personal interview at a later point in time. This entire process requires a scanner for the applicant to scan his photo / signature into an appropriate size. Is there a better way to capture user identity for such purposes as usage of scanner for capturing signature, photo is a painful process.
Hello World!
For an assignment at university we program in a pretty unknown language Modula 2, which lacks major graphic support.
I was wondering how to achieve a 'transparency' effect on images, i figured it would work like this:
Create a 2D array for the background area of the image filled with the colours of the different pixels in that area, create another 2D array of the image with again the colours of every picture and than merge the pixel colours and draw the different "new colours" on their appropriate place.
What i was wondering about: how do i merge the colours (hexadecimals) just:
( colour1 + colour2 ) / 2
?
Thanks for your help!!
Hi guys,
I have a PHP form validation function that I developed in chrome and now will not work in firefox or Opera.
The function checks to see if a section of the form is blank and shows and error message. If there is no error then then the form submits through document.events.submit();
CODE:
function submit_events()
{
//Check to see if a number is entered if the corosponding textbox is checked
if (document.events.dj_card.checked == true && dj_amount.value==""){
//Error Control Method
//alert ('You didn\'t enetr an Amount for DJ\'s Card!');
var txt=document.getElementById("error")
txt.innerHTML="<p><font color=\"#FF0000\"> You didn\'t enetr an Amount for DJ\'s Card!</font></p>";
window.document.getElementById("dj_card_label").style.color = '#FF0000';
//Reset
window.document.getElementById("company_amount_label").style.color = '#000000';
window.document.getElementById("own_amount_label").style.color = '#000000';
}else{
document.events.submit();
}
The document.events.submit();does work across all my browsers however the check statements do not.
If the box is not ticked the form submits. If the box is ticked it does not matter whether there is data in the dj_amount.value or not. The form will not submit and no error messages are displayed.
Thanks guys.
Environment: JPA 1, Hibernate 3.3.x
I have an JPA entity class (User), how do I selectively fetch member variables say (first_name, last_name) instead of fetching all user attributes using the JPA api.
Hi,
I want to use a Scheduler like Telerik Scheduler in my Mvc project. The problem is that the Scheduler is a Asp.Net WebForm control. For this reason, I must create a WebForm page in my Mvc project to put the Scheduler control.
When I show the page, it work fine to render the layout of the control but if I try to interact with it; click for change date, change to day view to week view, the control don't change.
I know that postback doesn't work in mvc project but does it work in a WebForm page in a Mvc project? If it doesn't work, it is the reason why when I try to interact with the control, the control don't respond.
I think it's because the postback don't work and the Scheduler use 100 % Databinding where when I change date, the postback don't contain any data that I have changed and for this reason, the control can't change is layout.
Have you any ideas about postback with WebForm in mvc project?
What type of design can I adopt? (Two differents projets: One for my Scheduler with WebForm and another for all the rest of my website in Mvc project)
Any other control easily to use with Scheduler?
Tips and tricks when needing both WebForm control and Mvc control in Mvc project?
Thank you very much.
This is a bit of an open ended question but we have a problem with a web application that on the final step of completing an order, multiple post requests are being made, sometimes up to 10 and all within a couple of seconds to the page.
Theirs nothing unusual about the page, the user fills out a form which is then validated using the jQuery form validation plugin. We've seen this behavior exhibited over a couple of different browser types, notably IE6 but also IE8.
We've also managed to trigger the bug ourselves but nothing out of the ordinary seems to occur on the browsers end, everything progresses as normal.
Apache logs show that multiple post requests where made at the same time and the Rails logs show that multiple posts requests were also received by the application, leading me to think it's a problem with the browser.
I've exhausted all avenues that I can think of for debugging so I'm throwing this out there to see if anyone has some ideas of what we could try or look for next.
We have some JPA entity classes which are currently under development and wouldn't want them as part of the testing cycle. We tried commenting out the relevant entity classes in META-INF\persistence.xml but the hbm2ddl reverse engineering tool still seems to generate SQL for those entities. How do I tell my code to ignore these classes? Are there any annotations for these or should I have to comment out the @Entity annotation along with my changes in persistence.xml file.
Ok so I want to conditionally add this line of code;
<!--[if ! IE]> <embed src="logo.svg" type="image/svg+xml" /> <![endif]-->
Using:
document.getElementById("logo") .innerHTML='...';
In a if()/else() statement and it don't write it!
If i get rid of the selective comment ( <!--[if ! IE]><![endif]-->) and only put the SVG ( <embed src="logo.svg" type="image/svg+xml" /> ) it work! what should I do?
I found a way around but i think in the Android browser the thing will pop up twice.
here's what I've done ( and its Validated stuff!);
<!DOCTYPE html>
<html>
<head>
<META CHARSET="UTF-8">
<title>SVG Test</title>
<script type="text/javascript">
//<![CDATA[
onload=function()
{
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid) {
document.getElementById("logo").innerHTML='<img src="fin_palais.png"/>';
}
}
//]]>
</script>
</head>
<body>
<div id="logo">
<!--[if lt IE 9]>
<img src="fin_palais.png"/>
<![endif]-->
<!--[if gte IE 9]><!-->
<embed src="fin_palais.svg" type="image/svg+xml" />
<!--<![endif]-->
</div>
</body>
I'm building a simple weather widget. The current weather conditions are read out of the National Weather Service xml file and then I want to parse and store the relevant data in the model but the callback for the $.ajax won't connect (the way I'm doing it).
var Weather = Backbone.Model.extend({
initialize: function(){
_.bindAll( this, 'update', 'startLoop', 'stopLoop' );
this.startLoop();
},
startLoop: function(){
this.update();
this.interval = window.setInterval( _.bind( this.update, this ), 1000 * 60 * 60 );
},
stopLoop: function(){
this.interval = window.clearInterval( this.interval );
},
store: function( data ){
this.set({
icon : $( data ).find( 'icon_url_name' ).text()
});
},
update: function(){
$.ajax({
type: 'GET',
url: 'xml/KROC.xml',
datatype: 'xml'
})
.done( function( data ) {
var that = this;
that.store( $( data ).find( 'current_observation' )[ 0 ] );
});
}
});
var weather = new Weather();
The data is read correctly but I can't get the done function of the call back to call the store function. (I would be happy if the "done" would just parse and then do "this.set".
Thanks in advance for your help.
I'm having a problem with the code below. When I run it the progress bar will pulse for around 10 secs as meant to and then move on to downloading and will show the progress but when finished it will not move on to the next step it just locks up.
import sys
import time
import pygtk
import gtk
import gobject
import threading
import urllib
import urlparse
class WorkerThread(threading.Thread):
def __init__ (self, function, parent, arg = None):
threading.Thread.__init__(self)
self.function = function
self.parent = parent
self.arg = arg
self.parent.still_working = True
def run(self): # when does "run" get executed?
self.parent.still_working = True
if self.arg == None:
self.function()
else:
self.function(self.arg)
self.parent.still_working = False
def stop(self):
self = None
class MainWindow:
def __init__(self):
gtk.gdk.threads_init()
self.wTree = gtk.Builder()
self.wTree.add_from_file("gui.glade")
self.mainWindows()
def mainWindows(self):
self.mainWindow = self.wTree.get_object("frmMain")
dic = {
"on_btnNext_clicked" : self.mainWindowNext,
}
self.wTree.connect_signals(dic)
self.mainWindow.show()
self.installerStep = 0 # 0 = none, 1 = preinstall, 2 = download, 3 = install info, 4 = install
#gtk.main()
self.mainWindowNext()
def pulse(self):
self.wTree.get_object("progress").pulse()
if self.still_working == False:
self.mainWindowNext()
return self.still_working
def preinstallStep(self):
self.wTree.get_object("progress").set_fraction(0)
self.wTree.get_object("btnNext").set_sensitive(0)
self.wTree.get_object("notebook1").set_current_page(0)
self.installerStep = 1
WT = WorkerThread(self.heavyWork, self) #Would do a heavy function here like setup some thing
WT.start()
gobject.timeout_add(75, self.pulse)
def downloadStep(self):
self.wTree.get_object("progress").set_fraction(0)
self.wTree.get_object("btnNext").set_sensitive(0)
self.wTree.get_object("notebook1").set_current_page(0)
self.installerStep = 2
urllib.urlretrieve('http://mozilla.mirrors.evolva.ro//firefox/releases/3.6.3/win32/en-US/Firefox%20Setup%203.6.3.exe', '/tmp/firefox.exe', self.updateHook)
self.mainWindowNext()
def updateHook(self, blocks, blockSize, totalSize):
percentage = float ( blocks * blockSize ) / totalSize
if percentage > 1:
percentage = 1
self.wTree.get_object("progress").set_fraction(percentage)
while gtk.events_pending():
gtk.main_iteration()
def installInfoStep(self):
self.wTree.get_object("btnNext").set_sensitive(1)
self.wTree.get_object("notebook1").set_current_page(1)
self.installerStep = 3
def installStep(self):
self.wTree.get_object("progress").set_fraction(0)
self.wTree.get_object("btnNext").set_sensitive(0)
self.wTree.get_object("notebook1").set_current_page(0)
self.installerStep = 4
WT = WorkerThread(self.heavyWork, self) #Would do a heavy function here like setup some thing
WT.start()
gobject.timeout_add(75, self.pulse)
def mainWindowNext(self, widget = None):
if self.installerStep == 0:
self.preinstallStep()
elif self.installerStep == 1:
self.downloadStep()
elif self.installerStep == 2:
self.installInfoStep()
elif self.installerStep == 3:
self.installStep()
elif self.installerStep == 4:
sys.exit(0)
def heavyWork(self):
time.sleep(10)
if __name__ == '__main__':
MainWindow()
gtk.main()
I have a feeling that its something to do with:
while gtk.events_pending():
gtk.main_iteration()
Is there a better way of doing this?
I've been working on sending text to an input element in Chrome and I noticed that, unlike in IE or FF, calling .focus() does not put the cursor in the text area. So does anyone know of an alternative for placing the cursor on a Chrome input element?
I have a array of integer numbers (say 1,2,3,4,5 or 1,2,3, ... 10 or 1,2,3, ... 50) from which I would like to get a random set of numbers ordered differently every time. Is there a utility method to do this?
e.g. for 1,2,3,4,5 post randomization it might be either [1,5,4,2,3 or 2,1,3,5,4 or 3,1,2,4,5 or ...]
I would like to know if there is a java utility method / class which already provides this capability?
We have a requirement to control access to our SaaS based web application based on IP addresses (i.e. We will have to limit access to Company A users only if the request originates from the PCs in their subnet). How do you solve this issue?
Why when I try to access a variable that don't exist, javascript throw an exception but when I try to access a property that don't exist in an object, javascript returns an undefined object?
For example, this case returns an undefined object:
function Foo(){
console.log(this.bar);
}
Foo();
But, in this other example, javascript throw an exception:
function Foo(){
console.log(bar);
}
Foo();
ReferenceError: bar is not defined