on-internet

Use of frame_max in RabbitMQ

I've read about the frame_max for rabbitMQ, it said frame_max is "Maximum permissible size of a frame (in bytes) to negotiate with clients. Setting to 0 means "unlimited" but will trigger a bug in some QPid clients. Setting a larger value may improve throughput; setting a smaller value may improve latency." Why the default value is 128 KB. I think in production environment, there is no case in which one wants to have high latency, then why the default value is set so much low. It can be set by default as very high, so as one can have high throughput always. Is there any harm in having high val

Join the discussion →

Resize pdf pages in Python

I am using python to crop pdf pages. Everything works fine, but how do I change the page size(width)? This is my crop code: input = PdfFileReader(file('my.pdf', 'rb')) p = input.getPage(1) (w, h) = p.mediaBox.upperRight p.mediaBox.upperRight = (w/4, h) output.addPage(p) When I crop pages, I need to resize them as well, how can I do this?

Join the discussion →

Django low level cache views

I have an index view which validates a form containing various data. Even though the thankyou.html page doesn't have complex calculations to kill the server, I would like to render a slightly different html page if thankyou.html is already low level cached. To tell you the truth, I don't know what key to pass it... Here is the code: def index(request): form = UserForm() message = 'Incorrect data!' if request.method == 'POST': form = UserForm(request.POST) if form.is_valid(): try: User.objects.get(code=form.cleaned_data['code']) except (KeyError, ObjectDoesNotExist): u = User(lastname=form.clea

Join the discussion →

How to simulate PC's Esc key on android

I'm writing an app that can play flash on android, but I can't simulate ESC key, since a lot of flash games need ESC key to return to the main menu, without this key the app I made will be useless. So who could tell me how to simulate this? Can I just send a keycode? but I don't know the keycode too...

Join the discussion →

How to Play Video from URL in Android?

I wrote code for play video from URL. But I am getting UNABLE TO PLAY VIDEO message. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView videoView = (VideoView) findViewById(R.id.video); MediaController mc = new MediaController(this); mc.setAnchorView(videoView); mc.setMediaPlayer(videoView); Uri video = Uri.parse("http://www.youtube.com/watch?v=qvtCk1wZ7LM&feature=player_detailpage"); videoView.setMediaController(mc); videoView.setVideoURI(video); videoView.start(); } <VideoView android:layout_width="match_parent" andr

Join the discussion →

java output html code to file

I have a chunk of html code that should be outputted as a .html file, in java. The pre-written html code is the header and table for a page, and i need to generate some data, and output it to the same .html file. Is there an easier way to print the html code than to do prinln() line by line? Thanks

Join the discussion →

Export DataGridView data to excel

In my application I'm exporting DataGridView data to excel sheet now I want to pass the combobox and textbox selected values to excel sheet and I have to give title to my excel sheet as Report for my windows application how can I do that? Can anyone help me on this? I have code for exporting datagridview data to excel: private void btnexcel_Click(object sender, EventArgs e) { Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.ApplicationClass(); xlWorkBook = xlApp.Workbooks.Add(misValue); xlWorkS

Join the discussion →

How to get the value before or between certain unchanging symbols in a dynamic string in JavaScript

I have a string which contains: abc: def - 01:00, ghi - 02:00 Any part of this string can change, except the order of the dividers in the string i.e. :, -, :, ,, -, and : How do I get the text before the first : and stick it into a variable for later use? And also, how do I get the text between the first - and , and stick that into a different variable?

Join the discussion →

finding index of max value in an array in C

I want to find index of max value in array in C. I write this code example: maks=0; for(i=0;i< N * N;i++) { if(array[i]>maks) { maks=(int) array[i]; k=i; } } But this isn't work properly.Could you advise me another example?

Join the discussion →

Comparing Bitfields of Different Sizes

What happens if you use a bitwise operator (&, |, etc.) to compare two bitfields of different sizes? For example, comparing 0 1 1 0 with 0 0 1 0 0 0 0 1: 0 1 1 0 0 0 0 0 The smaller one is extended with zeros and pushed to the 0 0 1 0 0 0 0 1 most-significant side. Or... 0 0 0 0 0 1 1 0 The smaller one is extended with zeros and pushed to the 0 0 1 0 0 0 0 1 least-significant side. Or... 0 1 1 0 The longer one is truncated from its least-significant side, 0 0 1 0 keeping its most significant side. Or... 0 1 1 0 The longer one is truncated from its most-significant side, 0 0 0 1 keeping its lea

Join the discussion →

how to uniqify a list of dict in python

I have a list: d = [{'x':1, 'y':2}, {'x':3, 'y':4}, {'x':1, 'y':2}] {'x':1, 'y':2} comes more than once I want to remove it from the list.My result should be: d = [{'x':1, 'y':2}, {'x':3, 'y':4} ] Note: list(set(d)) is not working here throwing an error.

Join the discussion →

How to decode URL-encoded string in shell?

I have a file with a list of user-agents which are encoded. E.g.: Mozilla%2F5.0%20%28Macintosh%3B%20U%3B%20Intel%20Mac%20OS%20X%2010.6%3B%20en I want a shell script which can read this file and write to a new file with decoded strings. Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en I have been trying to use this example to get it going but it is not working so far. $ echo -e "$(echo "%31+%32%0A%33+%34" | sed 'y/+/ /; s/%/\\x/g')" My script looks like: #!/bin/bash for f in *.log; do echo -e "$(cat $f | sed 'y/+/ /; s/%/\x/g')" > y.log done

Join the discussion →

Converting (any) PDF to black (K)-only CMYK

This is related to: Converting PDF to CMYK (with identify recognizing CMYK). Script (or some other means) to convert RGB to CMYK in PDF? ... but a bit more specific here: say I have an RGB PDF, where the text color is "rich black" (R:0 G:0 B:0 gone to C:100 M:100 Y:100 K:100), and diverse images and vector graphics. I would like to convert this to a CMYK PDF, using a free command line tool (so it is batch scriptable under Linux), which has contents only in the black (K) channel: Preserves vector graphics (+ text glyphs) - colors become grayscale in black (K) channel only Images get converted t

Join the discussion →

Converting PDF to CMYK (with identify recognizing CMYK)

I am having much trouble to get ImageMagick's identify to, well, identify a PDF as CMYK. Essentially, let's say I'm building this file, test.tex, with pdflatex: \documentclass[a4paper,12pt]{article} %% https://tex.stackexchange.com/questions/13071 \pdfcompresslevel=0 %% http://compgroups.net/comp.text.tex/Making-a-cmyk-PDF %% ln -s /usr/share/color/icc/sRGB.icm . % \immediate\pdfobj stream attr{/N 4} file{sRGB.icm} % \pdfcatalog{% % /OutputIntents [ << % /Type /OutputIntent % /S/GTS_PDFA1 % /DestOutputProfile \the\pdflastobj\space 0 R % /OutputConditionIdentifier (sRGB IEC61966-2.1) % /Info(sR

Join the discussion →

Automatically generate a uml diagram of my c++ code

Some time ago I was a TA in a introductory programming course on Java. We used an IDE called BlueJ which had the nice feature that the overview of your development files was a light-weight UML diagram with 'usage' pointers and inheritance pointers drawn in, this made it easy to see the structure of the program. My question is the following, Is there a similar framework for c++? or at least a tool that I can have running next to my editor to keep a clear view of my files and how they are organized. My development platform is a Mac with emacs as my main editor.

Join the discussion →

Low level capabilities of high level languages [closed]

I would like to know some low-level capabilities of high-level languages. Off the top of my head I could point out: bitwise operations bit fields pointer arithmetic inline assembly interrupt functions I would appreciate if you pointed out some, that aren't in my list. It would be nice if C or Pascal had them, but basically any high-level language will do.

Join the discussion →

java.nio.channels.ClosedChannelException -Client shuts down SSL

HI, I have a webservice running on glassfish3.1 server on one machine. On second machine I have a java (GUI) app, that is running and calls the above mentioned web service. In my webservice call, i send a file as SOAP attachment. It reaches the server, the file is then processed and then it is returned back to my client machine over https. If my file is too large and takes more than 15 mins, the operation fails and I get the following error: On Client side: Couldn't create SOAP message due to exception: org.jvnet.mimepull.MIMEParsingException: javax.net.ssl.SSLException: SSL peer shut down inc

Join the discussion →

Could not find a part of the path while trying to retrieve a path in ASP.NET

I have the following code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; public partial class view4 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string strheadlinesid = string.Empty; if (!IsPostBack) { if (!string.IsNullOrEmpty(Convert.ToString( Request.QueryString["folder"].ToString()))) { strheadlinesid = Request.QueryString["folder"].ToString(); } } Response.Write("<table style='width: 10px; height: 10px; margin-left: 100px; margin-top: 10px'>"); Dir

Join the discussion →

sqlalchemy: how to join several tables by one query?

I have the following SQLAlchemy mapped classes: class User(Base): __tablename__ = 'users' email = Column(String, primary_key=True) name = Column(String) class Document(Base): __tablename__ = "documents" name = Column(String, primary_key=True) author = Column(String, ForeignKey("users.email")) class DocumentsPermissions(Base): __tablename__ = "documents_permissions" readAllowed = Column(Boolean) writeAllowed = Column(Boolean) document = Column(String, ForeignKey("documents.name")) I need to get a table like this for user.email = "[email protected]": email | name | document_name | document_readAllo

Join the discussion →

Using a4j:support to update the model and view, ready for the next button/submit action

The Problem We have a swing based front end for an enterprise application and now are implementing a (for now simpler) JSF/Seam/Richfaces front end for it. Some of the pages include fields that, when edited, should cause other fields to change as a result. We need this change to be shown to the user immediately (i.e. they should not have to press a button or anything). I have implemented this successfully using h:commandButton and by adding onchange="submit()" to the fields that cause other fields to change. That way, a form submit occurs when they edit the field, and the other fields are upda

Join the discussion →

Need to add username and password to SOAP header in VB.NET Web Service Client

I need to query a web service that basic authentication, putting the username and password in the request header. My client is written in VB.NET Visual Basic Express Edition 2010. I've added the web service to the Service References. It has auto-generated the appropriate classes for me. I've written the following very simple code: Dim imageService As AverittWebServices.SendWebImageClient = New AverittWebServices.SendWebImageClient("SendWebImagePort") Dim imageResult As String imageResult = imageService.getAvailableImages("") DisplayLabel.Text = imageResult I get a response back from the servic

Join the discussion →
Older stories