Daily Archives

Articles indexed Monday January 3 2011

Page 1/33 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Print to File in Black and White (not in greyscale)

    - by user2413
    Hi all, I have these pdf files of c++code and they are colored which would be cool, except that the network printer here is b&w and the printed out codes come in various shades of pale grey which makes them essentially unreadable (specially the comments). I would like everything (text, codes, commands,...) to be printed in the same (black) color. i've tried fuddling with the printer's properties, but the closest thing i see is the 'level of grey' tab, and there i have the choice between 'enhanced' and 'normal' (and it doesn't make a difference in my case). i've tried 'print to file', but i don't see any options there to print to b&w, I've tried installing the 'generic cups printer', but again no options to print to b&w. any idea ? (i'm on 10.10)

    Read the article

  • loading content from php file with jQuery

    - by Billa
    The following code fetch all data (by clicking a.info link) from a php file "info.php" and prints in the #content div. The problem is that it prints everything from info.php file. Can I possibly select only some part of data from info.php file to load in #content? The reason to ask this question is that, I want to load different data from the same php file for the different links. $("a.info").click(function(){ var id=$(this).attr("id"); $("#box").slideDown("slow"); $.ajax({ type: "POST", data: "id="+$(this).attr("id"), url: "info.php", success: function(html){ $("#content").html(html); } }); }); Html where content is loading: <div id="box"> <div id="content"></div> </div> info.php paragraph1. paragraph2. For example, In the above info.php file, i only want to load paragraph1 in the #content. I hope my question is clear. Any help will be appreciated.

    Read the article

  • How to get a file path from c drive in android

    - by Thomas Mathew
    I was trying to extract the content of a pdf file and display its content in android. I tired the code in java and it worked.But when i am coding it in android, its not displaying anything. I think, its not getting the file path. Is there any way by which i could get a file stored in c drive and store its path in a string? The code is given below: public class hello extends Activity { /** Called when the activity is first created. */ private static String INPUTFILE = "FirstPdf.pdf"; String str; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { Document document = new Document(); document.open(); PdfReader reader = new PdfReader(INPUTFILE); int n = reader.getNumberOfPages(); str=PdfTextExtractor.getTextFromPage(reader, 2); } catch (IOException e) { //e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } TextView tv = new TextView(this); tv.setText(str); setContentView(tv); } } I would be very grateful if the problem is solved.

    Read the article

  • How to write an iphone application to control a device that exposes a telnet api

    - by MAC
    Hi! I have to write an iphone application that controls a device. This device exposes a telnet based interface. The application should ideally have user access control and customizability for each user. I was thinking of writing C++ classes that would communicate with the device using sockets. This functionality can then be exposed through web-services that can be called by the iphone application. However as i looked into it deeper, the api allows you to register for events using telnet and then you can receive notification when those events occur. That kinda put a spanner in the works for me. I for one dont know a "push" scenario can work with webservices. First off i have never programmed for the iphone so far. So i am not really sure what can be done. So i was thinking if instead of having a webserver to go through, why not have the application independently running on the iphone, directly communicating with the device using sockets. The question though is, is that possible and second i am thinking it would raise a security aspect. First we could control security as everything was going through our central server. Is there a way to handle security (in the sense who has access to the device) without having a central server. I am sorry that this seems like an unorganized post, but iam trying to brainstorm here. Looking forward to hear your opinions.

    Read the article

  • Large scale storage for incrementally-appended documents?

    - by Ben Dilts
    I need to store hundreds of thousands (right now, potentially many millions) of documents that start out empty and are appended to frequently, but never updated otherwise or deleted. These documents are not interrelated in any way, and just need to be accessed by some unique ID. Read accesses are some subset of the document, which almost always starts midway through at some indexed location (e.g. "document #4324319, save #53 to the end"). These documents start very small, at several KB. They typically reach a final size around 500KB, but many reach 10MB or more. I'm currently using MySQL (InnoDB) to store these documents. Each of the incremental saves is just dumped into one big table with the document ID it belongs to, so reading part of a document looks like "select * from saves where document_id=14 and save_id 53 order by save_id", then manually concatenating it all together in code. Ideally, I'd like the storage solution to be easily horizontally scalable, with redundancy across servers (e.g. each document stored on at least 3 nodes) with easy recovery of crashed servers. I've looked at CouchDB and MongoDB as possible replacements for MySQL, but I'm not sure that either of them make a whole lot of sense for this particular application, though I'm open to being convinced. Any input on a good storage solution?

    Read the article

  • Best way to create SEO friendly URI string

    - by Mat Banik
    The method below allows only "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" chars in URI strings. What better way is there to make nice SEO URI string? import org.apache.commons.lang.StringUtils; public static String safeChar(String input) { input = input.trim(); input = StringUtils.replace(input, " -", "-"); input = StringUtils.replace(input, "- ", "-"); input = StringUtils.replace(input, " - ", "-"); input = StringUtils.replaceChars(input, '\'', '-'); input = StringUtils.replaceChars(input, ' ', '-'); char[] allowed = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-".toCharArray(); char[] charArray = input.toCharArray(); StringBuilder result = new StringBuilder(); for (char c : charArray) { for (char a : allowed) { if (c == a) result.append(a); } } return result.toString(); }

    Read the article

  • Can I autogenerate/compile code on-the-fly, at runtime, based upon values (like key/value pairs) parsed out of a configuration file?

    - by Kumba
    This might be a doozy for some. I'm not sure if it's even 100% implementable, but I wanted to throw the idea out there to see if I'm really off of my rocker yet. I have a set of classes that mimics enums (see my other questions for specific details/examples). For 90% of my project, I can compile everything in at design time. But the remaining 10% is going to need to be editable w/o re-compiling the project in VS 2010. This remaining 10% will be based on a templated version of my Enums class, but will generate code at runtime, based upon data values sourced in from external configuration files. To keep this question small, see this SO question for an idea of what my Enums class looks like. The templated fields, per that question, will be the MaxEnums Int32, Names String() array, and Values array, plus each shared implementation of the Enums sub-class (which themselves, represent the Enums that I use elsewhere in my code). I'd ideally like to parse values from a simple text file (INI-style) of key/value pairs: [Section1] Enum1=enum_one Enum2=enum_two Enum3=enum_three So that the following code would be generated (and compiled) at runtime (comments/supporting code stripped to reduce question size): Friend Shared ReadOnly MaxEnums As Int32 = 3 Private Shared ReadOnly _Names As String() = New String() _ {"enum_one", "enum_two", "enum_three"} Friend Shared ReadOnly Enum1 As New Enums(_Names(0), 1) Friend Shared ReadOnly Enum2 As New Enums(_Names(1), 2) Friend Shared ReadOnly Enum3 As New Enums(_Names(2), 4) Friend Shared ReadOnly Values As Enums() = New Enums() _ {Enum1, Enum2, Enum3} I'm certain this would need to be generated in MSIL code, and I know from reading that the two components to look at are CodeDom and Reflection.Emit, but I was wondering if anyone had working examples (or pointers to working examples) versus really long articles. I'm a hands-on learner, so I have to have example code to play with. Thanks!

    Read the article

  • Sending double quote character to CreateProcess?

    - by karikari
    I want to send the double quote character to my CreateProcess function. How can I do the correct way? I want to send all of this characters: "%h" CreateProcess(L"C:\\identify -format ",L"\"%h\" trustedsnapshot.png",0,0,TRUE,NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW,0,0,&sInfo,&pInfo); Here is the full code: int ExecuteExternalFile() { SECURITY_ATTRIBUTES secattr; ZeroMemory(&secattr,sizeof(secattr)); secattr.nLength = sizeof(secattr); secattr.bInheritHandle = TRUE; HANDLE rPipe, wPipe; //Create pipes to write and read data CreatePipe(&rPipe,&wPipe,&secattr,0); STARTUPINFO sInfo; ZeroMemory(&sInfo,sizeof(sInfo)); PROCESS_INFORMATION pInfo; ZeroMemory(&pInfo,sizeof(pInfo)); sInfo.cb=sizeof(sInfo); sInfo.dwFlags=STARTF_USESTDHANDLES; sInfo.hStdInput=NULL; sInfo.hStdOutput=wPipe; sInfo.hStdError=wPipe; CreateProcess(L"C:\\identify",L" -format \"%h\" trustedsnapshot.png",0,0,TRUE,NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW,0,0,&sInfo,&pInfo); CloseHandle(wPipe); char buf[100]; DWORD reDword; CString m_csOutput,csTemp; BOOL res; do { res=::ReadFile(rPipe,buf,100,&reDword,0); csTemp=buf; m_csOutput+=csTemp.Left(reDword); }while(res); //return m_csOutput; float fvar; //fvar = atof((const char *)(LPCTSTR)(m_csOutput)); ori //fvar=atof((LPCTSTR)m_csOutput); fvar = _tstof(m_csOutput); const size_t len = 256; wchar_t buffer[len] = {}; _snwprintf(buffer, len - 1, L"%d", fvar); MessageBox(NULL, buffer, L"test print createprocess value", MB_OK); return fvar; } I need this function to return the integer value from the CreateProcess.

    Read the article

  • How do I create a custom python interpreter? i.e. with certain modules already included?

    - by Johnny Brown
    If you've used Ruby on Rails, I'm thinking of the feature where the user types 'rails console' and instantly gets a Ruby console with rails and the current app already loaded. I want to make something like this for a python program I'm working on, does anyone know how I would get to type say, 'python myPythonConsole.py' and open up a regular python interpreter but with my program and all its dependencies loaded?

    Read the article

  • Xcode warning: application executable contains unsupported architecture(s):arm, arm (-19031)

    - by rmvz3
    Hi all. I've been receiving this warning since I loaded my project in last Xcode 4 preview. There was no warning before that but now I can't get rid of it even in Xcode 3.2. I've been googling but nobody seems to have the same error. My project and target settings are correct (IMHO): Architectures: Standard (armv6 armv7), Base SDK: Latest iOS (currently set to iOS 4.2), Build Active Architecture Only: FALSE, Valid Architectures: armv6 armv7. I compared every project setting with other projects and and found no differences. I even have recreated the project starting from scratch and copying classes, resources and frameworks with the same result. I must say that the warning is not shown when I set Debug configuration. I hope someone can help me because I don't know what to do. Thanks in advice.

    Read the article

  • Optimizing performance of large ASP.NET applications

    - by NLV
    Hello, I'm building a asp.net web application with lots and lots of controls and huge volumes of data. My application is very slow and it is taking a large amount of time to load the data into the .net controls like grid, tree view etc. I also have some ajaxified pages and controls in my application. I want to reduce the page load time in each postbacks. What are the standards/best practices to be followed while developing large asp.net applications? Thank you. NLV

    Read the article

  • click events issue in jquery.

    - by alex
    I don't know if the title explain this situation well. Below is a code i wrote to create div elements when the button is pressed. Then By clicking on any of the created divs, we can change the div background by choosing a color from the drop down box. However if i click on another div and tried to change the color by selecting another color from the drop down, the previously clicked divs also gets affected by the new color. Why is this happening. I only want the selected div to change color, without affecting the previously clicked divs. I read allot of threads on this site, some of which talks about unbinding clicks, but I'm unable to solve the problem. Thanks for the help. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <style> .aaa { width:100px; height:100px;background-color:#ccc;margin-bottom:5px;} p{widht:500px; height:500px; margin:0px; padding:0px;border:2px solid red;color:#000;} </style> <select id="item_select" name="item"> <option value="1">red</option> <option value="2">blue</option> <option value="3">green</option> </select> <button>Click to create divs</button> <p id="ptest"></p> <script type="text/javascript"> var dividcount = 1; $("button").click(run); function run(){ var myDiv = $('<div id=lar'+dividcount+' class=aaa></div>'); $(myDiv).clone().appendTo('#ptest'); $(dividcount++); $("div").bind('click',(function() { var box = $("div").index(this); var idd = (this.id); $("#"+idd).text("div #"+idd); $("select").change(function(){ var str= $("select option:selected").text(); $("#"+idd).css("background-color",str); }); })); }; </script>

    Read the article

  • C# or C++ game: many 16 color images loaded into RAM. Efficient solution?

    - by user560639
    I am in the planning stages of creating a fighting game and am unsure how to handle one issue relating to memory. Background info: - Still debating whether to use C# (XNA) or C++. We do not want to commit to either until we have explored how to solve this problem in both languages. - Using a max of 256MB RAM would be great if possible. - Two characters will be present at a time, and these characters can only change between battles. There is time to load/free memory between battles, but the game needs to run at a constant 60 drawn frames per second during combat. Each frame is 16.67ms - The total number of images per character is in the low hundreds. Each image is roughly 200x400 pixels. Only one image from each character will be displayed at any given moment. Uncompressed, each image takes roughly 300kb from my calculations; upwards of 100MB for a whole character. This is pushing too close to the 256MB limit given that memory will be needed for some other resources as well. Since each image can be made with a total of 16 colors. Theoretically I should be able to use 1/8th the space if I can take advantage of this. I've looked around but haven't found any word of native support for paletted images. (Storing each pixel using fewer bits that each map to a 32-bit RGBa color) I was considering making my own file format with 4 bits per pixel (and some extra palette info), loading all the images of this new format into RAM before battle, and then when drawing any specific image, decompress only that image into a raw image so it can be rendered properly. I don't know if it's realistic to perform so many assignment operations (appx 200x400 for each character = 160k) each frame. It sounds very hacky to me. Does anyone have advice on whether my solution sounds reasonable, and if there is perhaps a better one available? Thanks so much! (I also attempted to use an image with only 1 channel, then use a shader to perform a series of if statements to translate various values into other colors. Unfortunately, there were too many lines of code for the shader. It is also rather hacky and does not scale well.)

    Read the article

  • Ruby on Rails redirect_to not functioning in IF statement?

    - by Hard-Boiled Wonderland
    Hi, I am redirecting a POST request to ensure the URL is correct along with other things. The redirect worked fine before I added in the if statements for town below: if !params[:address].blank? town = Town.find(:all, :conditions => ["name = ?", params[:address]]) @towns = town if !town.blank? redirect_to '/town/' + params[:address] else @town_invalid = 'test' end end end I am sure it is something simple and that I simply cannot see it. Also if you see any glaring errors or code mishaps let me know as I am just starting out. EDIT: I should mention this is what I get back from Safari when a real town is entered: Safari can’t open the page.Safari can’t open the page “http://localhost:3000/” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes, and then try again. Thanks!

    Read the article

  • Subversive Connector Discovery error

    - by Zac
    Trying to install Subversive for the first time. Successfully installed Subversive "Team Provider" via the Available Sites dialog in Help Install New Software. Added a site that points to the Helios Update Site. Restarted Eclipse and tried to open the SVN Repository Browser and it automatically launched a Subversive Connector Discovery dialog, presenting me with 6 or 7 connectors to choose from. I've tried every single one, and they all fail, stating that an "error occured" and that I need to check the "error log" (Eclipse error log?) for details. I then exited the dialog and noticed that I can now view all the SVN-related perspective panes. (1) Was it alright for me to cancel that Connector Discovery process, or will I need that to create/edit repositories locally? If I need it, what was going wrong and does anyone have any ideas for how to get it working? (2) I'm trying to undertand the SVN Repositories feature for creating a new repository. How do I point it to my local SVN server instance? The default is to query me for a URL that I assume I would point to one of those "publicly available" repos.... which I don't want! Thanks for any and all help here!

    Read the article

  • Why is xslt converter ignoring the content of <link>-tag

    - by Kristoffer Nolgren
    When I put forexample this in my xslt-stylesheet: <link><xsl:text>test</xsl:text></link> Or this: <link>test</link> I get the following result: <link xmlns=""></link> This however: <linkb>test</linkb> Render the following result: <linkb xmlns="">test</linkb> The rest of the xslt does not seem to make any difference, i've tried it in several different and empty xslt-stylesheets This problem appears in backend conversion (php) aswell as frontend-konversion in chrome browser (but not in Firefox) Example of error: dev.resihop.nu (right above the footer)

    Read the article

  • Trying to add trailing slash with htaccess, results in a absolute path

    - by Fredrik
    What I'm trying to achive is to have all urls on my page look like http://domain.com/page/, no extensions, but a trailing slash. If a user happends to write http://domain.com/page or http://domain.com/page.php it will redirect to the first url. After some googling i found this code, and it's close to working, but when you leave out the trailing slash in your request the url becomes something like http://domain.com/Users/"..."/page/ and therefor returns a 404. My .htaccess looks like this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php RewriteRule (.*)\.php$ /$1/ [L,R=301] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*)/$ $1.php [L] RewriteCond %{REQUEST_FILENAME} !(.*)/$ RewriteRule (.*)/$ $1.php [L] RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule .*[^/]$ $0/ [L,R=301] I've been trying to add an additional rule but I really don't get any of this and I haven't been able to find any answers.

    Read the article

  • Distributing points over a surface within boundries

    - by vise
    I'm interested in a way (algorithm) of distributing a predefined number of points over a 4 sided surface like a square. The main issue is that each point has got to have a minimum and maximum proximity to each other (random between two predefined values). Basically the distance of any two points should not be closer than let's say 2, and a further than 3. My code will be implemented in ruby (the points are locations, the surface is a map), but any ideas or snippets are definitely welcomed as all my ideas include a fair amount of brute force.

    Read the article

  • Create multi-part message in MIME format Freemarker template

    - by Mat Banik
    How do you create email message that contains text and HTML version for the same content? Of course I would like to know how to setup the freemarker template or the header of the message that will be send. When I look on the source of message multi-part message in MIME format that I receive in inbox every once in while this is what is in there: This is a multi-part message in MIME format. ------=_NextPart_000_B10D_01CBAAA8.F29DB300 Content-Type: text/plain Content-Transfer-Encoding: 7bit ...Text here... ------=_NextPart_000_B10D_01CBAAA8.F29DB300 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <html><body> html code here ... </body></html>

    Read the article

  • Need help setting up subversion

    - by mousey
    Hi, We are a small company working on a source of a big company. We are actually setting up Subversion with Apache server to work on their code. We need to setup a secure environment so that others outside my group should not have access. I heard there are lot of authentication techniques that can be set up with apache server. Can some one help what are the most secure techniques that come up with apache server and are good with subversion.

    Read the article

  • Configuring and managing Windows web server

    - by Mike C.
    Hello, I run a few websites and I was thinking of paying for a dedicated Windows web server from GoDaddy instead of paying for each site's hosting individually. I know enough about IIS to configure the Host Header and stuff like that, but I'm a little fuzzy about the email portion of the hosting. I have a few questions: Do I need to install an SMTP server on the web server to allow for emails to be sent/received to a website email address? Or is there another approach that I'm unaware of? Are there tools that monitor the amount of bandwidth used by the server? GoDaddy charges for bandwidth and I want to make sure I don't go over. Am I opening a can of worms that I don't really want to open by going the dedicated server route? Things like server updates, security, etc? Thanks!

    Read the article

  • "You need to confirm this operation" message when trying to delete a file

    - by Richard West
    I'm trying to delete a few files that I created, and I have full permissions on, on a Windows 2008 system. The files are within a folder that I created so they are not system files of any kind. The message box that pops up when I try to delete the file is titled "Destination Folder Access Denied", and the message is "you need to confirm this operation", with a continue, skip or cancel button. I disabled UAC and rebooted to see if this would make the message go away -- it did not. However, with UAC disabled I am able to click on continue and the files are deleted. With UAC enabled I had to provide elevated credientials before the files would delete. What causes this behaviour and how can I remove it?

    Read the article

  • Why upgrade from SQL 2005 to SQL 2008 R2?

    - by GordyII
    have been tasked to write a document outlining the best reasons to use SQL 2008 R2 instead of SQL 2005 for my brand new BI project. We have a policy of only using two versions at a time and there are still SQL 2000 boxes around here somewhere.... I know the microsoft line on as per this link. http://www.microsoft.com/sqlserver/2008/en/us/why-upgrade.aspx What I want to know is your opinions of which are the best features and why. So if you can help me try to convince management to use a product which is actually up to date, I would appreciate it.

    Read the article

  • Apache restart on Ubuntu - error “could not bind to address 0.0.0.0:80”

    - by william
    I'm a n00b - trying to get apache2 set up on Ubuntu 9.10 (Karmic Koala) on Rackspace Cloud. I have set up/configured OpenSSL and installed Apache, but Apache won't start. I assume its a misconfiguration in my /etc/apache2/sites-available/ssl or /etc/apache2/sites-available/default files) When I try to restart apache using the command: sudo /etc/init.d/apache2 restart I get the following error message: [error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring! [error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring! (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs ...fail! For my /etc/apache2/sites-available/ssl I have used a virtual host of *:443. For my /etc/apache2/sites-available/default i have used a virtual host of *:80

    Read the article

  • redirection problem for my sites.

    - by redirect-p
    I have a site example.com and another one test.example.com. Both have different configuration file. But when I enter url test.example.com it will redirect to example.com. configuration file for example.com <VirtualHost *:80> ServerName example.com ServerAlias www.example.com DirectoryIndex index.html DocumentRoot my-document-path Options -Indexes ErrorDocument 404 /errors/404.html ErrorDocument 403 /errors/404.html <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['path', 'path'] + sys.path" SetEnv DJANGO_SETTINGS_MODULE example.settings PythonInterpreter example PythonAutoReload On PythonDebug On </Location> </VirtualHost>

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >