Daily Archives

Articles indexed Saturday May 1 2010

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

  • Parsing a UTF-16 encoded xml file in ruby

    - by Matthew Toohey
    Hello I've been trying to parse a UTF-16 encoded xml file in Ruby (1.8.7), and I can't seem to find how to do it by searching (google and stack overflow) Here's the xml file url: http://www.abc.net.au/triplej/feeds/playout/triplejsydneyplayout.xml?_5366 Getting the xml string from Net::HTTP and passing it to REXML, then calling logger.info xmlDoc.inspect produces: <UNDEFINED> ... </> Any ideas? Cheers

    Read the article

  • WIA Automation for scanner color intent is not working

    - by Mike Nicholson
    I cannot get my Canon Pixma MP150 to scan a color scan from c# code. The following code is resulting in a black and white image, or if I change the value of 6146 to 2 then a grayscale image is created. I would like to be able to have a color scan from code. I know the scanner does color images because I can do one through the xp wizard in "scanners and camera". Can anyone help me figure out what value I am not setting for a color scan. All documentation and examples I can find just say to change the value of 6146. Thank you for taking the time to read this! private void ScanAndSaveOnePage () { WIA.CommonDialog Dialog1 = new WIA.CommonDialogClass(); WIA.DeviceManager DeviceManager1 = new WIA.DeviceManagerClass(); System.Object Object1 = null; System.Object Object2 = null; WIA.Device Scanner = null; Scanner = Dialog1.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, false, false); WIA.Item Item1 = Scanner.Items[1]; setItem(Item1, "6146", 1); setItem(Item1, "6147", 150); setItem(Item1, "6148", 150); setItem(Item1, "6151", 150 * 8.5); setItem(Item1, "6152", 150 * 11); WIA.ImageFile Image1 = new WIA.ImageFile(); WIA.ImageProcess ImageProcess1 = new WIA.ImageProcess(); Object1 = (Object)"Convert"; ImageProcess1.Filters.Add(ImageProcess1.FilterInfos.get_Item(ref Object1).FilterID, 0); Object1 = (Object)"FormatID"; Object2 = (Object)WIA.FormatID.wiaFormatBMP; ImageProcess1.Filters[1].Properties.get_Item(ref Object1).set_Value(ref Object2); Object1 = null; Object2 = null; Image1 = (WIA.ImageFile)Item1.Transfer(WIA.FormatID.wiaFormatBMP); string DestImagePath = @"C:\test.bmp"; File.Delete(DestImagePath); Image1.SaveFile(DestImagePath); } private void setItem (IItem item, object property, object value) { WIA.Property aProperty = item.Properties.get_Item(ref property); aProperty.set_Value(ref value); }

    Read the article

  • PHP CSV upload files

    - by Anand
    hi, I have asked a question regarding updating a csv file's contents to the db @Question Now I want to add this functionality, like my db will contain url to images that are stored on a prespecified folder on the server. The csv files will contain the urls as to where these images reside on the client side. Now when I click an upload the following should happen My file must read the location of image on the client side Must copy the image from the client to the server's prespecified folder update the corresponding field in the db table with the url of the image

    Read the article

  • "Meld requires pygtk 2.8.0 or higher."

    - by Lynx
    I got this error after installing Meld on a new Karmic installation: ~$ meld No module named pygtk Meld requires pygtk 2.8.0 or higher. I installed the latest version of python-gtk with aptitude but I'm not sure what version is actually installed. My python version is 2.6. This is weird because I have another machine that runs Karmic and Meld without a problem. Any ideas?

    Read the article

  • Best way to gather, then import data into drupal?

    - by Frank
    I am building my first database driven website with Drupal and I have a few questions. I am currently populating a google docs excel spreadsheet with all of the data I want to eventually be able to query from the website (after it's imported). Is this the best way to start? If this is not the best way to start what would you recommend? My plan is to populate the spreadsheet then import it as a csv into the mysql db via the CCK Node. I've seen two ways to do this. http://drupal.org/node/133705 (importing data into CCK nodes) http://drupal.org/node/237574 (Inserting data using spreadsheet/csv instead of SQL insert statements) Basically my question(s) is what is the best way to gather, then import data into drupal? Thanks in advance for any help, suggestions.

    Read the article

  • Example: Objective C method alongside a php method

    - by Nic Hubbard
    I am very used to javascript and php programing, and I just jumped into programing Objective C. After working with it for a few weeks, the methods still confused me, as to how it is passing params, and how the methods are named. Since I am used to php, I am used to seeing: function myFunc($param1, $param2, $param3, $param4) { return FALSE; } Could someone show me how this would be written in Objective C, so that I can get used to writing methods that have parameters?

    Read the article

  • How to display the data of DOM parsed attributes in the listView display ?

    - by Praween k
    Hi, I am building a test output for DOM parser with node "Rider" and within that 7 attributes are there.URL://http://ps700.pranasystems.com/tours/8/xml/results/stage1results.xml. I want to display only the "name" and the "team" attributes output in the listview mode of the device.I am not getting clear where to store the output to display. Please help me someone for how to store and display that data to the output of the device in List view. Thanks in advance //-------------------------------// Here is my code------------// public String getSearch(String strURL) { URL url; URLConnection urlConn = null; NamedNodeMap nnm = null; int len; try { url = new URL(strURL); urlConn = url.openConnection(); } catch (IOException ioe) { Log.e("Could not Connect: "+ioe.getMessage(), "."); } DocumentBuilder builder = null ; Document doc = null ; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse(urlConn.getInputStream()); Node thisNode, currentNode, node,theAttribute ; NodeList nchild, nodeList; String name; ArrayList<Node> result = new ArrayList<Node>(); nodeList = doc.getElementsByTagName("rider"); int length = nodeList.getLength(); for (int i = 0; i < length; i++) { currentNode = nodeList.item(i); NamedNodeMap attributes = currentNode.getAttributes(); Log.i("TAG", attributes.toString()); for (int a = 0; a < attributes.getLength(); a++) { theAttribute = attributes.item(a); } // s1.setAdapter(new ArrayAdapter<Node>(this, // android.R.layout.simple_list_item_1,result)); }catch(ParserConfigurationException pce ){ Log.e("Could not Parse XML:" +pce.getMessage() ,"."); } catch (SAXException se) {Log.e("Could not Parse XML: "+se.getMessage(), ".");} catch (IOException ioe) {Log.e("Invalid XML: "+ioe.getMessage(), ".");} return strURL; }

    Read the article

  • RewriteRule in htaccess in subdirectory

    - by Jay
    Windows server, running Apache. In my Apache conf, I have AllowOverride None for the root of a site and then I have a subdirectory set to AllowOverride All: <Directory /> AllowOverride None </Directory> <Directory "/safe/"> AllowOverride All </Directory> However, when I try to set up a rewrite rule in the subdirectory's htaccess file, nothing happens, I just get a 404 page not found error. Example: RewriteEngine On RewriteRule (.*) /blah?test=$1 [R=302,NC,NE,L] Rwewriting URLs are working fine from the root via the Apache conf. I don't understand why the rule is ignored. I don't want to do the URL re-writing within the conf because for this case I may need to be changing the redirects constantly and don't want to reload the server every time a change is made. I also don't want to affect server performance by enabling htaccess files site-wide, just in the subdirectory I need it.

    Read the article

  • iPad. UIBarButtonItem has an undocumented view of type UIToolbarTextButton. Huh?

    - by dugla
    I have an iPad app where I have a view controller that is the UIGestureRecognizerDelegate for a number of UIGestureRecognizers. I have implemented the following method of UIGestureRecognizerDelegate: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // Double tapping anywhere on the screen hides/shows the toolbar if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] == YES) { if (touch.tapCount == 2) { self.toolbar.hidden = self.toolbar.isHidden ? NO : YES; } // if (touch.tapCount == 2) } // if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] == YES) // All gestures are ignored unless they happen on the fullscreen EAGLView if ([touch.view isKindOfClass:[EAGLView class]] == NO) { return NO; } // if ([touch.view isKindOfClass:[EAGLView class]] == NO) return YES; } My setup is a fullscreen EAGLView with a UIToolbar atop the EAGLView. There is a UIBarButtonItem on the toolbar. The idea here is that double-tapping anywhere toggles the appearance of the toolbar. All other gestures must occur on the EAGLView. My problem is that taps directly on the UIBarButtonItem show touch.view to be the UIView subclass UIToolbarTextButton which is undocumented and can't be introspected. Huh? Can someone suggest a work around, preferably that uses introspective goodness of some form? Thanks, Doug Thanks, Doug

    Read the article

  • HLSL, Program pixel shader with different Texture2D downscaling algorithms

    - by Kaminari
    I'm trying to port some image interpolation algorithms into HLSL code, for now i got: float2 texSize; float scale; int method; sampler TextureSampler : register(s0); float4 PixelShader(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0 { float2 newTexSize = texSize * scale; float4 tex2; if(texCoord[0] * texSize[0] > newTexSize[0] || texCoord[1] * texSize[1] > newTexSize[1]) { tex2 = float4( 0, 0, 0, 0 ); } else { if (method == 0) { tex2 = tex2D(TextureSampler, float2(texCoord[0]/scale, texCoord[1]/scale)); } else { float2 step = float2(1/texSize[0], 1/texSize[1]); float4 px1 = tex2D(TextureSampler, float2(texCoord[0]/scale-step[0], texCoord[1]/scale-step[1])); float4 px2 = tex2D(TextureSampler, float2(texCoord[0]/scale , texCoord[1]/scale-step[1])); float4 px3 = tex2D(TextureSampler, float2(texCoord[0]/scale+step[0], texCoord[1]/scale-step[1])); float4 px4 = tex2D(TextureSampler, float2(texCoord[0]/scale-step[0], texCoord[1]/scale )); float4 px5 = tex2D(TextureSampler, float2(texCoord[0]/scale+step[0], texCoord[1]/scale )); float4 px6 = tex2D(TextureSampler, float2(texCoord[0]/scale-step[0], texCoord[1]/scale+step[1])); float4 px7 = tex2D(TextureSampler, float2(texCoord[0]/scale , texCoord[1]/scale+step[1])); float4 px8 = tex2D(TextureSampler, float2(texCoord[0]/scale+step[0], texCoord[1]/scale+step[1])); tex2 = (px1+px2+px3+px4+px5+px6+px7+px8)/8; tex2.a = 1; } } return tex2; } technique Resample { pass Pass1 { PixelShader = compile ps_2_0 PixelShader(); } } The problem is that programming pixel shader requires different approach because we don't have the control of current position, only the 'inner' part of actual loop through pixels. I've been googling for about whole day and found none open source library with scaling algoriths used in loop. Is there such library from wich i could port some methods? I found http://www.codeproject.com/KB/GDI-plus/imgresizoutperfgdiplus.aspx but I really don't understand His approach to the problem, and porting it will be a pain in the ... Wikipedia tells a matematic approach. So my question is: Where can I find easy-to-port graphic open source library wich includes simple scaling algorithms? Of course if such library even exists :)

    Read the article

  • Getting the median of 3 values using scheme's

    - by kristian Roger
    The problem this time is to get the median of three values (easy) I did this: (define (med x y z) (car(cdr(x y z))) and it was accepted but when testing it: (med 3 4 5) I get this error: Error: attempt to call a non-procedure (2 3 4) And when entering letters instead of number i get: (md x y z) Error: undefined varia y (package user) Using something besides x y z I get: (md d l m) Error: undefined variable d (package user) the question was deleted dont know how anyway write a function that return the median of 3 values Sorry for editing the question I got that I should put the values in order first not just a sill car and cdr thing so I did so 33> (define (med x y z) (if(and( (<x y) (<y z) y if(and( (<y x) (<x z) x z))))) Warning: invalid expression (if (and< (<x y) (<y z) y if (and ((<y x) (<x z) x z)))) but as u see Im getting a warning so what is wronge ?

    Read the article

  • How to build Graceful Degradation AJAX web page?

    - by Morgan Cheng
    I want to build web page with "Graceful Degradation". That is, the web page functions even javascript is disabled. Now I have to make design decision on the format of AJAX response. If javascript is disabled, each HTTP request to server will generate HTML as response. The browser refreshes with the returned HTML. That's fine. If javascript is enabled, each AJAX HTTP request to server will generate ... well, JSON or HTML. If it is HTML, it is easy to implement. Just have javascript to replace part of page with the returned HTML. And, in server side, not much code change is needed. If it is JSON, then I have to implement JSON-to-html logic in javascript again which is almost duplicate of server side logic. Duplication is evil. I really don't like it. The benefit is that the bandwidth usage is better than HTML, which brings better performance. So, what's the best solution to Graceful Degradation? AJAX request better to return JSON or HTML?

    Read the article

  • Any Way to Further Customize Embedded Google Calendar?

    - by user117737
    I'd like to embed a few Google Calendars for my client's web site. The "Google Embeddable Calendar Helper" provides very few customization options. Updating the hex code for the background color in the generated source only works if you pick one of the ~70 standard Google Calendar bg colors. (I can tweak the "border" selector because at least it's in an actual statement.) A "view-source" on the rendered page shows a CSS file loaded from the iframe, but I obviously can't change anything in there. And I assume I can't force an override of selectors with my own CSS file because I have no way of "injecting" it into the iframe. Does anyone know of a (non-API) way of tweaking the colors, fonts, and other CSS thingies in an embedded Google Calendar? Thanks in advance...

    Read the article

  • Working with Primary Keys and Generators - Quickstart with NHibernate (Part 4)

    - by BobPalmer
    In this NHibernate tutorial, I'll be digging into the ID tag and Generator classes.  I had originally planned on finishing up a series on relationships (parent/child, etc.) but felt this would be an interesting topic for folks, and I also wanted to start integrating some of the current NHibernate reference. Since this article also includes some reference sections (and since I have not had a chance to check for every possible parameter value), I used the current reference as a baseline, and would welcome any feedback or technical updates that I can incorporate. You can find the entire article up on Google Docs at this link: http://docs.google.com/Doc?id=dg3z7qxv_24f3ch2rf7 As always, feedback, suggestions, and technical corrections are greatly appreciated! Enjoy! - Bob

    Read the article

  • SQL SERVER – What is AdventureWorks?

    - by pinaldave
    NOTE: If you know the answer of this question, then I request you to stop reading this post right now. Please do not leave comment about this blog post not being useful to you, if you knew the answer. Few days ago, I received DM asking What is an AdventureWorks database and why in all the examples I use that instead of any other database (e.g. Pubs or  Northwind)? As matter of fact, when I went back to my question list, which I have yet not answered, there were a few more variations of this same question. AdventureWorks is a Sample Database shipped with SQL Server and it can be downloaded from http://codeplex.com site. AdventureWorks has replaced Northwind and Pubs from the sample database in SQL Server 2005. The Microsoft team keeps updating the sample database as they release new versions. Here are some quick links: AdventureWorks SQL Server 2008 SR4 AdventureWorks 2008R2 November CTP AdventureWorks for SQL Azure (December CTP) AventureWorks for SQL Server 2005 SP2A SQL SERVER – 2008 – Download and Install Samples Database AdventureWorks 2005 – Detail Tutorial I have previously written few other articles on the same subject; you can find them easily here: [email protected] Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Documentation, SQL Download, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • What languages allow cross-platform native executables to be created?

    - by JT
    I'm frustrated to discover that Java lacks an acceptable solution for creating programs that will run via double-click. Other than .NET for Windows, what modern and high-level programming languages can I write code in that can be compiled for various platforms and run as a native/binary in each (Windows, Linux, OSX (optional)) Assuming I wanted to write code in python, for instance, is there a cohesive way that I could distribute my software which wouldn't require users to do anything special to get it to run? I want to write and distribute software for computer-illiterate and Java has turned out to be a real pain in this respect.

    Read the article

  • .NET Process.Start() on an executable on a remote system - security warning?

    - by BrettRobi
    I've created a Windows Service that accepts commands from remote machines via WCF. One of those commands is to run a specified executable (let's ignore the security implications of such functionality). In my Service I am using Process.Start() to run the executable. All works well if the executable is local to the machine, but if it is on a remote file share it is failing with no error (or more accurately just hanging). I suspect the problem is that it is triggering the standard Windows 'Unverified Publisher' warning that one would see if they double click an exe on a remote system. Is there any way I can bypass this from my service so that I can truly run any executable? As I said I understand the security implications of allowing it to run any executable, but this is really what I need. I would have thought this warning was only a user mode concept, but it really does seem to be getting in the way of my Service. Ideas?

    Read the article

  • Bash commands not executed when through cron job - PHP

    - by basicxman
    Hi there! I have a cron job running a PHP script every five minutes; the PHP script executes two bash commands at the end of the script. I know the script is running due to a log file it appends to. When I run the PHP script manually via the Ubuntu Gnome Terminal both bash commands execute flawlessly; however when the PHP script is triggered via cron, the two bash commands are not ran. Any ideas? $command = 'notify-send "' . count($infoleakPosts) . ' New Posts."'; `$command`; $command = 'firefox http://example.com'; `$command`; */1 * * * * php /home/andrew/grab.php USERNAME PASSWORD # JOB_ID_1

    Read the article

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