on-internet

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 →

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 →

Best way to give a variable a default value (simulate Perl ||, ||= )

I love doing this sort of thing in Perl: $foo = $bar || $baz to assign $baz to $foo if $bar is empty or undefined. You also have $foo ||= $bletch which will only assign $bletch to $foo if $foo is not defined or empty. The ternary operator in this situation is tedious and tiresome. Surely there's a simple, elegant method available in PHP? Or is the only answer a custom function that uses isset()?

Join the discussion →

How to detect disassociation by AP reboot within station in PS mode

I'm writing a fairly low-level driver for a wireless card, and while most of the spec is fairly straightforward, I haven't wrapped my head around a single question yet: If my station is in power-save mode and its receiver is turned off for an extended period (say, 10 seconds) between DTIM frames, and the access point is rebooted in the meantime so my association is lost, how can I detect this? I'm aware that the most common case will be that synchronisation is lost thoroughly enough that I will miss a number of beacons and simply go back to the AP search afterwards, but if by some lucky chance

Join the discussion →

Unable to cast object of type 'Org.BouncyCastle.Asn1.DerSequence' to type 'Org.BouncyCastle.Asn1.DerInteger'

in my c # project, I put this piece of code : initially, I recovered from the certificate that I created with bouncy castle, the key pair, then I extract the private key, my goal is that , it is in a format. pem, AsymmetricKeyParameter private_RSA = keyPair2.Private; PrivateKeyInfo k_RSA = PrivateKeyInfoFactory.CreatePrivateKeyInfo(private_RSA); byte[] serializedKey_priv_RSA = k_RSA.ToAsn1Object().GetDerEncoded(); // byte[] clé = Org.BouncyCastle.Utilities.Encoders.Hex.Decode(serializedKey); string data_priv_RSA = Convert.ToBase64String(serializedKey_priv_RSA); using (fluxInfos2 = new StreamWr

Join the discussion →

Can an android app be installed/converted to run on an iPhone?

I have an android project that targets Android 2.2 (developing in Eclipse). Exporting the android project to the Droid Incredible works perfectly. Is it possible to export the project to a file suitable for installing on an iphone? I know that most iPhone apps are developed using xCode, but I'm not sure if xCode packages into a .apk or other file format that's equivalent. Thanks in advance.

Join the discussion →

Compare date only (without time) in JPA2 (JPQL)

I'm trying to compare Calendars with JPA2. The query looks somewhat like that: TypedQuery<X> q = em.createQuery("select r from Record r where r.calendar= :calendar", X.class); Calendar c = foo(); // setting fields and stuff q.setParameter("calendar", c); This, however, compares the date + time. I want to know if MM:DD:YYYY is equal and do not care about the time. Is there a nice way to do that in JPA2 or do I have to create a native query? I tried setting HH:MM:SS:... to zero before saving it in the db but I don't know if this is very wise, regarding time zones and daylight saving and stuff.

Join the discussion →

PHP script - detect whether running under linux or Windows?

I have a PHP script that may be placed on a windows system or a linux system. I need to run different commands in either case. How can I detect which environment I am in? (preferably something PHP rather than clever system hacks) Update To clarify, the script is running from the command line.

Join the discussion →

ManagementObjectSearcher Get() Method throws an exception

I'm attempting to run the following code: ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_Processor"); // This line throws the exception ManagementObjectCollection moc = mos.Get(); and I get the following excpetion: System.Management.ManagementException: Invalid class at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() at LicenseCheckThingy.Form1.button1_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e

Join the discussion →

How to test or mock "if __name__ == '__main__'" contents

Say I have a module with the following: def main(): pass if __name__ == "__main__": main() I want to write a unit test for the bottom half (I'd like to achieve 100% coverage). I discovered the runpy builtin module that performs the import/__name__-setting mechanism, but I can't figure out how to mock or otherwise check that the main() function is called. This is what I've tried so far: import runpy import mock @mock.patch('foobar.main') def test_main(self, main): runpy.run_module('foobar', run_name='__main__') main.assert_called_once_with()

Join the discussion →

Insert monthly payroll records per employee

I need to make a stored procedure to insert employees monthly salary in there payroll table. Can anybody give example? There are two tables Employees (EmployeeID, EmployeeName, EmployeeStatus, BasicSalary) and EmployeePayroll (PayrollID, EmployeeID, VoucherNo, BasicSalary, SalaryMonth) Get Total Employees From Employees Table WHERE EmployeeStatus IN ('Active')............for example let's say (50 employees) Make a Loop for all these 50 employees and Insert salary payment voucher in table (EmployeePayroll). In EmployeePayroll table it will be inserted with auto generated voucher no for example:

Join the discussion →

Can't seem to get jQuery slidetoggle to start off closed

I am using a jQuery slidetoggle on a single page website. I have been trying to figure out where I went wrong in my script but can't seem to resolve this issue. I am trying to get the slide toggle effect to start off closed when the page opens and open/close only on click. Right now, when the page opens each section of the slide toggle is already open. <script type="text/javascript"> jQuery(function($) { var openText = 'Open'; var closeText = 'Close'; $('.item-util .more-toggle').toggle( function() { $(this).html(closeText); $(this).parent().siblings('div').slideToggle('slow'); }, function() {

Join the discussion →

How do I use AppPool credentials?

Our webapp is able to download files from Sharepoint and surface them to the user, but only if I provide my personal username and password to the process. I received a suggestion that: we "should use the credentials of the AppPool (UseDefaultCredentials=True.)" What changes do I make to for this to work with UseDefaultCredentials=True? And what is UseDefaultCredentials=true? string documentName = null; string contentType = "unknown"; // We don't want to use this method of credentials System.Net.NetworkCredential cred = new System.Net.NetworkCredential("USERNAME", "PASSWORD"); ClientContext cli

Join the discussion →

LibSVM turns all my training vectors into support vectors, why?

I am trying to use SVM for News article classification. I created a table that contains the features (unique words found in the documents) as rows. I created weight vectors mapping with these features. i.e if the article has a word that is part of the feature vector table that location is marked as 1 or else 0. Ex:- Training sample generated... 1 1:1 2:1 3:1 4:1 5:1 6:1 7:1 8:1 9:1 10:1 11:1 12:1 13:1 14:1 15:1 16:1 17:1 18:1 19:1 20:1 21:1 22:1 23:1 24:1 25:1 26:1 27:1 28:1 29:1 30:1 As this is the first document all the features are present. I am using 1, 0 as class labels. I am using svm.Ne

Join the discussion →

How can I write an assembly ISR in a C program (AVR)?

Following on from my other question, Help optimising this C (AVR) code? :), I just realised that I don't really know the mechanics of how to implement an ISR in assembly within my C program. I googled, but I didn't find anything too useful. Basically, I want to set up everything else in my C project (including the registers to get the interrupt to fire), but I want the interrupt to execute some assembly code that I've written. I'm using AVR Studio 6 on Windows if that helps. I've been told I need to use .s files, but apart from that I'm not really sure what to do. Is the basic structure just t

Join the discussion →

How to write "not in ()" sql query using join

Could some one please provide how to write following sql query using joins. I do not want use not in as well as if possible I would like to replace where condition as well. SELECT d1.Short_Code FROM domain1 d1 WHERE d1.Short_Code NOT IN ( SELECT d2.Short_Code FROM Domain2 d2 ) I am using SQL Server 2008

Join the discussion →

Restart log shipping when out of sync

The scenario is. A database secondary server are for different reason out of sync or is suspected that is not sync. Someone has made the secondary databases online by mistake or other mishaps. If you now want to make sure that they are set back on track. How do you do that? Preferably swiftly and for many databases at once. When you set up a log shipping between two servers using the guide it takes care of the initial backup and copying of backup file and then the initial restore. If I have to redo that I have to unable/enble and redo the loghipping and fill all the parameters again. Is there

Join the discussion →

How to "pull" from a local branch into another one?

This sounds so simple, but I just can't figure it out. I made an experimental branch a while ago, and now I'd like to pull in all the changes that happened on master since I made it. This is all local. I want to pull from local master into local my_branch, but I can't do it. This doesn't seem to work, telling me that master isn't a git repository: git pull master

Join the discussion →

How is Object.GetHashCode() implemented in CLR & JVM?

I've been musing about this for some time: how exactly is Object.GetHashCode implemented in the CLR or Java? The contract for this method is that if it is called on the same object instance, it should always return the same value. Note that I'm talking about the default implementation of GetHashCode(). Derived classes are not required to override this method. If they choose not to do so, they will in essence have reference semantics: equality equals "pointer equality" by default when used in hash tables &c. This means that somehow, the runtime has to provide a constant hashcode for the object

Join the discussion →

How do I print to stderr in Python?

There are several ways to write to stderr: print >> sys.stderr, "spam" # Python 2 only. sys.stderr.write("spam\n") os.write(2, b"spam\n") from __future__ import print_function print("spam", file=sys.stderr) What are the differences between these methods? Which method should be preferred?

Join the discussion →
Older stories