I have text objects on a Crystal Report in Visual Studio with an initial capital. When I print the report, the text is all lower case.
And the reason is?
Example scenario in an ASP.NET application using SQL Server membership provider :
1) a user can't remember their exact password, and tries many times in a short space of time to login with an invalid password (say 5 times in a 10 minute window). This locks out the user (i.e. sets the IsLockedOut flag of the aspnet_Membership table to 1).
2) user goes to the "forgot my password" screen to try to get a new password emailed to them. This screen uses the PasswordRecovery control. User enters their correct user id, but then cannot go further in the password recovery process, since the IsLockedOut flag is 1. (They don't even get to see their security question).
3) The user would then have to phone tech support to get themselves unlocked etc.
To reduce the burden on support staff, we are trying to eliminate step 3) if possible, by making the PasswordRecovery control (if possible), work with locked out users. i.e. when they enter their login ID, the security question comes up, and IF they enter the correct answer, the system will unlock the user, then send the new email to them. I'm wondering if it is possible to tweak the PasswordRecovery control to do this. Or maybe I'm approaching this the wrong way ?
Im using like this:
def child_render
super_render {
print GridModule.new.render
}
end
def super_render
@yield_value = yield
end
and got: Cannot yield from a Proc type filter. The Proc must take two arguments and execute #call on the second argument.
How would I create my own XP printer driver which will do the following:
print to file (probably XPS
format)
put this file into a password
protected ZIP file
email the zip file to a configured
email address
Do existing printer driver already offer something like this anyway?
I have a MainView that contains a navigation bar which selects one of many XAML pages to be displayed in the page view pane. The MainView contains a ScrollViewer around the pages. This allows the pages to be whatever size they need to be and the MainView's ScrollViewer scrolls them. This all works great.
On one of the pages, I need to (sometimes) center a TextBox in the middle of the page view pane (over the top of the page content). This was easily done by placing both the page content and the TextBox overlapping each other in a Grid (and I hide the TextBox as necessary). This all seems to work great.
However, if the page content grows to be larger than the pane, the TextBox is centered not on the pane, but on the full page content. Thus, it moves from center screen down and/or to the right (and eventually off the screen). Bummer.
Options:
Remove the ScrollViewer from the MainView. This would require placing one on every page! Argh.
Do option #1, and create a ScrolledPage base class. This is a lot of work, and I'm worried about tools issues (Blend issues). It also requires changing every page (to subclass this page).
Somehow override the ScrollViewer on just this page. Then, place another ScrollViewer on the page content to Scroll it.
Option 3 seems preferable, because it contains the issue to just modifying this page (instead of changing the rest of the pages). However, I can't figure out how to do it. Ideas?
Thanks in advance!
Eric
I`d like to know how I could unit-test the following module.
def download_distribution(url, tempdir):
""" Method which downloads the distribution from PyPI """
print "Attempting to download from %s" % (url,)
try:
url_handler = urllib2.urlopen(url)
distribution_contents = url_handler.read()
url_handler.close()
filename = get_file_name(url)
file_handler = open(os.path.join(tempdir, filename), "w")
file_handler.write(distribution_contents)
file_handler.close()
return True
except ValueError, IOError:
return False
I am trying to get Update queries from a list of files using this script.I need to take lines containing "Update" alone and not "Updated" or "UpdateSQL"As we know all update queries contain set I am using that as well.But I need to remove cases like Updated and UpdatedSQL can anyone help?
nawk -v file="$TEST" 'BEGIN{RS=";"}
/[Uu][Pp][Dd][Aa][Tt][Ee] .*[sS][eE][tT]/{ gsub(/.*UPDATE/,"UPDATE");gsub(/.*Update/,"Update");gsub(/.*update/,"update");gsub(/\n+/,"");print file,"#",$0;}
' "$TEST" >> $OUT
I've obviously been spoiled by Visual Studio, because although I'm just learning Android and the Eclipse environment, debugging apps in Eclipse is becoming a serious detriment to further development.
For example, Eclipse will compile this divide by zero just fine:
public class Lesson2Main extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate (savedInstanceState);
int i = 1 / 0;
TextView tv = new TextView (this);
tv.setText ("Hello, Android!");
setContentView (tv);
}
}
And then, when it executes it under the debugger, I will get a full screen of useless debug info, non of which actually points me to the specific line containing the error.
The stackTrace is null within the exception ('e') info tree, and it simply states a message stating 'ArithmeticException'. (that's nice, how about you point me in the direction of where you found it!?)
I've looked all over the screen and am baffled that this IDE can't get this right. Does developing with Eclipse resort everyone back to 1991 with printf() like logging at every interval then to track down bugs? Seriously.
Is there a configuration or plug-in that I'm missing to help with this?
I haven't tested this case with XCode, but if the iPhone dev. IDE handles this more like Visual Studio, then no wonder the Android marketplace has so few apps.
I'm excited about Android, but it seems that Eclipse is getting in the way.
Hi,
Im trying to load a remote image into a pdf generated by tcpdf however I can't seem to get it to work?
The rest of the pdf loads fine and it looks like to trying to retrieve the image however it just does print to the page?
The code I am using is:
$pdf->Image("http://media.domain.com/logo.jpg", 0, 0, 100, 150, 'JPEG', '', 'T', true, 72,'','','','','','','');
Any help on this would be a massive help,
Thanks,
There are a few open source projects I would really like to read through the code of to understand better / improve on. The problem is, for me, reading for a long time on the computer screen is tedious. I would love to be able to read code while lounging around and on a screen that was better on my eyes. Has anyone ever tried reading code on an ebook reader? It seems like the e-ink would make it easy on the eyes, plus it would be portable, plus it wouldn't kill any trees. In other words, it sounds perfect, but before I drop a couple benjamins on an ebook reader, I'd like to hear if anyone else has tried this and how it went.
It seems Scott Hanselman discussed using the Kindle to read code, but I wouldn't necessarily want a Kindle. Has anyone had a positive experience with some other device?
I realize this is not directly about programming, but it relates directly to my ability to improve my skills. I think if a good portable reading device for code exists, it could help a lot of programmers.
Hi, how do i order a given set of colors from the rainbow in VIBGYOR order. say i input the seven colors in the following order { red, blue, green, yellow, indigo, violet, orange} and i should print the output as {violet, indigo, blue, green, yellow, orange, red}, irrespective of the order i give the output should be as above. Can someone suggest me about implementing this in java program?
Thanks,
-Vijay
Can I configure mod_php, XDebug, or Eclipse (or some other free program) to print to file the code that is executed? And if so can I limit it to function calls to keep it somewhat readable?
I have a document that I want to be flipped / rotated 180 degrees when printed.
(This is due to the orientation of label stock in the printer).
There is a property PrintDocument.PrinterSettings.LandscapeAngle but it is read only.
I think this property is influenced by the printer driver and therefore not 'settable'.
Is there a nice way i can rotate the print by 180 degrees without having to do anything too nasty?
Consider a tuple v = (a,b,c) and a generator function generate(x) which receives an item from the tuple and generates several options for each item.
What is the pythonic way of generating a set of all the possible combinations of the result of generate(x) on each item in the tuple?
I could do this:
v = (a,b,c)
for d in generate(v[0]):
for e in generate(v[1]):
for f in generate(v[2]):
print d,e,f
but that's just ugly, plus I need a generic solution.
coinCount = [2 for i in range(4)]
total = sum(coinCount)
This gives me
TypeError: 'int' object is not callable
I don't understand why because
print type(coinCount)
Gives me
type <'list'>
I'm writing an application (A juggling pattern animator) in PLT Scheme that accepts Scheme expressions as values for some fields. I'm attempting to write a small text editor that will let me "explode" expressions into expressions that can still be eval'd but contain the data as literals for manual tweaking.
For example,
(4hss->sexp "747")
is a function call that generates a legitimate pattern. If I eval and print that, it becomes
(((7 3) - - -) (- - (4 2) -) (- (7 2) - -) (- - - (7 1)) ((4 0) - - -) (- - (7 0) -) (- (7 2) - -) (- - - (4 3)) ((7 3) - - -) (- - (7 0) -) (- (4 1) - -) (- - - (7 1)))
which can be "read" as a string, but will not "eval" the same as the function. For this statement, of course, what I need would be as simple as
(quote (((7 3...
but other examples are non-trivial. This one, for example, contains structs which print as vectors:
pair-of-jugglers
; -->
(#(struct:hand #(struct:position -0.35 2.0 1.0) #(struct:position -0.6 2.05 1.1) 1.832595714594046) #(struct:hand #(struct:position 0.35 2.0 1.0) #(struct:position 0.6 2.0500000000000003 1.1) 1.308996938995747) #(struct:hand #(struct:position 0.35 -2.0 1.0) #(struct:position 0.6 -2.05 1.1) -1.3089969389957472) #(struct:hand #(struct:position -0.35 -2.0 1.0) #(struct:position -0.6 -2.05 1.1) -1.8325957145940461))
I've thought of at least three possible solutions, none of which I like very much.
Solution A is to write a recursive eval-able output function myself for a reasonably large subset of the values that I might be using. There (probably...) won't be any circular references by the nature of the data structures used, so that wouldn't be such a long job. The output would end up looking like
`(((3 0) (... ; ex 1
`(,(make-hand (make-position ... ; ex 2
Or even worse if I could't figure out how to do it properly with quasiquoting.
Solution B would be to write out everything as
(read (open-input-string "(big-long-s-expression)"))
which, technically, solves the problem I'm bringing up but is... ugly.
Solution C might be a different approach of giving up eval and using only read for parsing input, or an uglier approach where the s-expression is used as directly data if eval fails, but those both seem unpleasant compared to using scheme values directly.
Undiscovered Solution D would be a PLT Scheme option, function or library I haven't located that would match Solution A.
Help me out before I start having bad recursion dreams again.
In the dealloc method for a class how would I print out the ID (or some other unique identifier) for the instance being deallocated?
- (void)dealloc {
NSLog(@"_deallocing: ??");
[super dealloc];
}
Is this possible? I am just trying to get a little more feedback in the console as an aid to learning.
many thanks -gary-
I have a Drupal module, that I want to present in a clean page - with no headers, menus, footer ect. I think all I need is a version of page.tpl.php that contains HTML page headers and <?php print $content ?> How can I point my module to such a page?
I have a readline-based application with a prompt, however I'd like it to not show when the input is not interactive.
$ ./readline-app < command-list > result
$ cat result
prompt> Output line 1
prompt> Output line 2
prompt>
$
How can I make the prompt to not print in this case?
#include<stdio.h>
int main()
{
printf("He %c llo",65);
}
Output: He A llo
#include<stdio.h>
int main()
{
printf("He %c llo",13);
}
Output: llo. It doesnt print He.
I can understand that 65 is ascii value for A and hence A is printed in first case but why llo in second case.
Thanks
I have a list that has some chapter numbers in string.
When I sort the keys using keys function, it gives me wrong results.
keys = ['1.1', '1.2', '2.1', '10.1']
keys.sort()
print keys
['1.1', '1.2', '10.1', '2.1']
How can I use the sort function to get
['1.1', '1.2', '2.1', '10.1']
What if the array has something like this?
['1.1.1', '1.2.1', '10.1', '2.1'] - ['1.1.1','1.2.1','2.1','10.1']
I'm talking about ASP.NET AJAX library. I'm using HoverMenuBehavior to display a tooltip. What I'm missing however is to display it left from tooltip referece or to the right depending on tooltip image position. I was thinking about using "showing" event I found through firebug, but can't figure out how to register it through ASP.NET
I found showing event mentioned on this page:
http://www.asp.net/ajaxlibrary/Print.aspx?Page=HOW%20TO%20Use%20the%20HoverMenu%20Control
Search as I may I have not found a solution to my problem here and I'm hoping the combined minds of StackOverflow will push me in the right direction.
My problem is as follows, I'm developing a print and print preview portion of a messaging system's user agent. I was given specific XSLT templates that after transforming XML will produce a Formatting Objects document. With Apache FOP I've been able to render the FO document into PDF which is all fine and good, but I would also like to display it in a print preview dialog. Apache FOP contains such a class called PreviewDialog which requires in its constructor a FOUserAgent, which I can generate, and an object implementing the Renderable Interface.
The Renderable Interface has one implementing class in the FOP package which is called InputHandler which takes in its constructor a standard io File object. Now here is where the trouble begins. I'm currently storing the FO document as a temp file and pass this as a File object to an InputHandler instance which is then passed to the PreviewDialog. I see the dialog appear on my screen and along the bottom in a status bar it says that it is generating the document, and that is all it does.
Here is the code I'm trying to use. It isn't production code so it's not pretty:
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.cli.InputHandler;
import org.apache.fop.render.awt.viewer.PreviewDialog;
public class PrintPreview {
public void showPreview(final File xslt, final File xmlSource) {
boolean err = false;
OutputStream out = null;
Transformer transformer = null;
final String tempFileName = this.getTempDir()
+ this.generateTempFileName();
final String tempFoFile = tempFileName + ".fo";
final String tempPdfFile = tempFileName + ".pdf";
System.out.println(tempFileName);
final TransformerFactory transformFactory = TransformerFactory
.newInstance();
final FopFactory fopFactory = FopFactory.newInstance();
try {
transformer = transformFactory
.newTransformer(new StreamSource(xslt));
final Source src = new StreamSource(xmlSource);
out = new FileOutputStream(tempFoFile);
final Result res = new StreamResult(out);
transformer.transform(src, res);
System.out.println("XSLT Transform Completed");
} catch (final TransformerConfigurationException e) {
err = true;
e.printStackTrace();
} catch (final FileNotFoundException e) {
err = true;
e.printStackTrace();
} catch (final TransformerException e) {
err = true;
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
System.out.println("Initializing Preview");
transformer = null;
out = null;
final File fo = new File(tempFoFile);
final File pdf = new File(tempPdfFile);
if (!err) {
final FOUserAgent ua = fopFactory.newFOUserAgent();
try {
transformer = transformFactory.newTransformer();
out = new FileOutputStream(pdf);
out = new BufferedOutputStream(out);
final Fop fop = fopFactory.newFop(
MimeConstants.MIME_PDF, ua,
out);
final Source foSrc = new StreamSource(fo);
final Result foRes = new SAXResult(fop.getDefaultHandler());
transformer.transform(foSrc, foRes);
System.out.println("Transformation Complete");
} catch (final FOPException e) {
err = true;
e.printStackTrace();
} catch (final FileNotFoundException e) {
err = true;
e.printStackTrace();
} catch (final TransformerException e) {
err = true;
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if (!err) {
System.out.println("Attempting to Preview");
final InputHandler inputHandler = new InputHandler(fo);
PreviewDialog.createPreviewDialog(ua, inputHandler, true);
}
}
// perform the clean up
// f.delete();
}
private String getTempDir() {
final String p = "java.io.tmpdir";
return System.getProperty(p);
}
private String generateTempFileName() {
final String charset = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
final StringBuffer sb = new StringBuffer();
Random r = new Random();
int seed = r.nextInt();
r = new Random(seed);
for (int i = 0; i < 8; i++) {
final int n = r.nextInt(71);
seed = r.nextInt();
sb.append(charset.charAt(n));
r = new Random(seed);
}
return sb.toString();
}
}
Any help on this would be appreciated.