Daily Archives

Articles indexed Sunday June 13 2010

Page 9/73 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Command Line arguments - PHP

    - by Chaitanya
    Am trying the following php script which finds out the maximum between 2 numbers, it accepts the arguments through command line. I check whether the input is provided right, based on the number of command line arguments. <?php function larger($arg1,$arg2) { return max($arg1,$arg2); } if($argc > 3 || $argc < 3) print 'Invalid Arguments'; exit(1); if($argc==3) { print larger($argv[1],$argv[2]); } ?> Am executing the program in a windows system, and the file resides in xampp/php directory. While executing I don't get any output neither any error report. How do i check whether am right or wrong?

    Read the article

  • how to detect an escape sequence in a string

    - by mix
    Given a string named line whose raw version has this value: \rRAWSTRING how can I detect if it has the escape character \r? What I've tried is: if repr(line).startswith('\r'): blah... but it doesn't catch it. I also tried find, such as: if repr(line).find('\r') != -1: blah doesn't work either. What am I missing? thx! EDIT: thanks for all the replies and the corrections re terminolgy and sorry for the confusion. OK, if i do this print repr(line) then what it prints is: '\rSET ENABLE ACK\n' (including the single quotes). i have tried all the suggestions, including: line.startswith(r'\r') line.startswith('\\r') each of which returns False. also tried: line.find(r'\r') line.find('\\r') each of which returns -1

    Read the article

  • Rails: How to toggle a boolean field from a view?

    - by sscirrus
    Very simple question. I have a boolean field called "saved" in my database. I want to toggle this field by clicking on a text link that changes from "Save" to "Unsave" depending on the situation, and updates my "Customer" table with 0 or 1. I imagine Javascript may be a way to go for this but I am not experienced enough (yet!) in Javascript to know how to code it. What is the best way to approach this problem, and how can I find the code I would need to drop into my view to make this toggle work? Thank you very much.

    Read the article

  • jQuery image hover color overlay

    - by Ryan Max
    I can't seem to find any examples of this having been done anywhere on the internet before but here is what I am going to attempt to do...I'm trying to go about the cleanest possible way of laying this out. So I have an image gallery where the images are all different sizes. I want to make it so that when you mouseover the image, it turns a shade of orange. Just a simple hover effect. I want to do this without using an image swap, otherwise I'd have to create an orange colored hover-image for each individual gallery image, I'd like this to be a bit more dynamic. My plan is just to position an empty div over the image absolutely with a background color, width and height 100% and opacity: 0. Then using jquery, on mouseover I'd have the opacity fade to 0.3 or so, and fade back to zero on mouseout. My question is, what would be the best way to layout the html and css to do this efficiently and cleanly. Here's a brief, but incomplete setup: <li> <a href="#"> <div class="hover">&nbsp;</div> <img src="images/galerry_image.png" /> </a> </li> .hover { width: 100%; height: 100%; background: orange; opacity: 0; }

    Read the article

  • Help with Linq Expression - INotifyPropertyChanged

    - by Stephen Patten
    Hello, I'm reading the source code from the latest Prism 4 drop and am interested in solving this problem. There is a base class for the ViewModels that implements INotifyPropertyChanged and INotifyDataErrorInfo and provides some refactoring friendly change notification. protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpresssion) { var propertyName = ExtractPropertyName(propertyExpresssion); this.RaisePropertyChanged(propertyName); } private string ExtractPropertyName<T>(Expression<Func<T>> propertyExpresssion) { if (propertyExpresssion == null) { throw new ArgumentNullException("propertyExpression"); } var memberExpression = propertyExpresssion.Body as MemberExpression; if (memberExpression == null) { throw new ArgumentException("The expression is not a member access expression.", "propertyExpression"); } var property = memberExpression.Member as PropertyInfo; if (property == null) { throw new ArgumentException("The member access expression does not access property.","propertyExpression"); } if (!property.DeclaringType.IsAssignableFrom(this.GetType())) { throw new ArgumentException("The referenced property belongs to a different type.", "propertyExpression"); } var getMethod = property.GetGetMethod(true); if (getMethod == null) { // this shouldn't happen - the expression would reject the property before reaching this far throw new ArgumentException("The referenced property does not have a get method.", "propertyExpression"); } if (getMethod.IsStatic) { throw new ArgumentException("The referenced property is a static property.", "propertyExpression"); } return memberExpression.Member.Name; } and as an example of it's usage private void RetrieveNewQuestionnaire() { this.Questions.Clear(); var template = this.questionnaireService.GetQuestionnaireTemplate(); this.questionnaire = new Questionnaire(template); foreach (var question in this.questionnaire.Questions) { this.Questions.Add(this.CreateQuestionViewModel(question)); } this.RaisePropertyChanged(() => this.Name); this.RaisePropertyChanged(() => this.UnansweredQuestions); this.RaisePropertyChanged(() => this.TotalQuestions); this.RaisePropertyChanged(() => this.CanSubmit); } My question is this. What would it take to pass an array of the property names to an overloaded method (RaisePropertyChanged) and condense this last bit of code from 4 lines to 1? Thank you, Stephen

    Read the article

  • Installing psycopg2 (postgresql) in virtualenv on windows

    - by StackUnderflow
    I installed psycopg2 in virtualenv using easy_install psycopg2. I did not see any errors and looks like installation went fine.. there is an egg file created in the site-packages dir for psycopg2.. but when I run import psycopg2 in the interpreter, I am getting following error.. any clue? How can I fix it.. any other way to install psycopg2 in virtualenv.. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build\bdist.win32\egg\psycopg2\__init__.py", line 69, in <module> File "build\bdist.win32\egg\psycopg2\_psycopg.py", line 7, in <module> File "build\bdist.win32\egg\psycopg2\_psycopg.py", line 6, in __bootstrap__ Thanks.

    Read the article

  • Outstanding SQL Saturday

    - by merrillaldrich
    I had the privilege to attend the SQL Saturday held in Redmond today, and it was really outstanding. Among the many sessions, I especially enjoyed and took a lot of useful information away from Greg Larsen’s Dynamic Management Views session, Kalen Delaney’s Compression Session – I am planning to implement 2008 Enterprise compression on my company’s data warehouse later this year – and Remus Rusanu’s session on Service Broker to process NAP data. I want to send out heartfelt thanks to the generous...(read more)

    Read the article

  • HTML5 tags not working at all in firefox 3.6.3

    - by William
    Okay, so I'm trying to get into this whole HTML 5 thing, and this tutorial (http://www.webreference.com/authoring/languages/html/HTML5/) says that these tags should move the content around without any kind of CSS at all, but all I'm getting is a line of text that looks like this: Header tag Nav tag Artical Section tags Aside tag footer tag Here is the code: <!DOCTYPE html> <html lang="en"> <head> <title>HTML5 test1</title> <meta charset="utf-8" /> </head> <body> <header> Header tag </header> <nav> Nav tag </nav> <article> <section> Artical Section tags </section> </article> <aside> Aside tag </aside> <footer> footer tag </footer> </body> </html>

    Read the article

  • php preg_match pattern to extract a specific information, regex

    - by Michael
    I need to extract a specific Id from a html document but the problem is that the id must not "be used". Here is the html content http://pastebin.com/wF2dx8JZ As you may see there are different html blocks . Some of them contain the "Used" word so I need to extract only the first id which is not used. Basically I can write a simple pattern like : $pattern = "/javascript:tw(.*))/"; preg_match_all($pattern, $content, $matches); $id = $matches[1][0]; However in this case I'm also getting the "ids" which are used so I don't know how to exclude them from the equation . Any idea would be highly appreciated.

    Read the article

  • SVN syncing fails with ZendStudio

    - by rashcroft
    Hi. When I try to sync with my SVN (I'm using unfuddle) through ZendStudio I get the following error: Some of selected resources were not committed. svn: Commit failed (details follow): svn: MKACTIVITY request failed on '/svn/test1234_a/!svn/act/58ae0e6d-2301-0010-8300-cb465553b788' svn: MKACTIVITY of '/svn/test1234_a/!svn/act/58ae0e6d-2301-0010-8300-cb465553b788': 400 Bad Request (http://test1234.unfuddle.com) I think this is some type of proxy error, but how can I fix this (using ZendStudio). Thanks.

    Read the article

  • making changes in master page from front(calling) page in vb.net

    - by ferrer
    i have a page called a1.aspx, with the Masterpagefile = a1_master.master. Now the master page has its own div's and images for design purpose. I want a way where when i load a1.aspx, certain chosen 's and images should be hidden (visible=false). how can i do this? how can i change the visibility of a div or an image in the master page from the calling page?

    Read the article

  • Saving a bitmap to a Memorystream produces an inverted colors image

    - by Raphael
    I've created an image with GDI+ on my application and now I must convert this image to an array of bytes. My first thought was this simple code: public byte[] ToByte() { MemoryStream ms = new MemoryStream(); bitmap.Save(ms, ImageFormat.Bmp); return ms.GetBuffer(); } The problem with this approach is that when I finally save this image into a file the colors are inverted. What I'm I doing wrong?

    Read the article

  • How can let Qt Graphics View Framework support custom layers

    - by jnblue
    Qt's graphics view frameworks is very powerful, but I have not found a way to support custom layers. In Qt, there is a QGraphicsScene::ItemLayer,but QGraphicsScene renders all items are in this layer. I want manage the items with several layers, Just like Illustrator and CorelDraw. all the item only in the current layer will receive the event, be selected or get the key focus etc.. Other layers(not current layer) will not receive all scene event. The most reasons of using layers is I could catalogue a large number of items more clearly.And without needing transfer events to all the layers' items ,I think the graphics frameworks will be more efficient. The last question, does QGraphicsView support rendering server stacked graphics scenes at the same time? If support, I think the "custom layers" can be solved in this way. Thanks very much!

    Read the article

  • Agilent E4426B signal generator locks up during multiple GPIB *SAV operations

    - by aspiehler
    I have a test fixture with an Agilent E4426B RF signal generator connected to a PC via a National Instrument Ethernet-to-GPIB bridge. My software is attempting to sanitize the instrument by presetting it and then saving the current state to all of the memory locations writable via the standard SCPI command "*SAV x,y". The loop works to a point, but eventually the instrument responds with an error and continuously displays the "L" icon on the front display and a "Remote preset" message at the bottom. At that point it won't respond to any more remote commands and I have to either cycle power or press LOCAL, then PRESET at which point it takes about 3 minutes to finish presetting. At that point the "L" icon is still present and and the next GPIB command sent to the instrument causes it to report a -113 error (undefined header) in the instrument error queue. I fired up NI spy to see what was happening, and found that the error was happening at the same point in the loop - "*SAV 6,2" in this case. From NI Spy: Send (0, 0x0017, "*SAV 6,2", 8 (0x8), NLend (0,0x01)) Process ID: 0x00000520 Thread ID: 0x00000518 ibsta:0xc168 iberr: 6 ibcntl: 2(0x2) And here's the code from the instrument driver: int CHP_E4426b::Erase() { if ((m_StatusCode = Initialize()) != GPIB_SUCCESS) // basically just sends "*RST" return m_StatusCode; m_SaveState = "*SAV %d, %d"; for (int i=0; i < 10; i++) for (int j=0; j < 100; j++) { sprintf(m_CmdString, m_SaveState, j, i); if ((m_StatusCode = Send(m_CmdString, strlen(m_CmdString))) != GPIB_SUCCESS) return m_StatusCode; } return GPIB_SUCCESS; } I tried putting a small Sleep() delay (10-20 ms) at the end of the inner loop, and to my surprise it caused the error to show up earlier rather than later. 10 ms caused the loop to error out at 44,1 and 20 ms was even sooner. I've already eliminated faulty cabling or the instrument as the culprit. This same type of sequence works without any error on a higher end signal generator, so I'm tempted to chalk this up to a bug in the instrument's firmware.

    Read the article

  • Is a display list best for this? (OpenGL)

    - by user146780
    I'm rendering 2D polygons with the GLUTesselator the first time, then they are stored in a display list for subsequent use. I think VBO's might be faster, but since I can't access the stuff that the tesselator outputs, and since it uses mixes of gl_triangle, quad, strip etc, i'm not sure how I could do this, even though I would like to use VBO's once the GLUTesselator is done with them for optimal performance. Thanks

    Read the article

  • What does the :compiler command do in Vim?

    - by Martín Fixman
    I recently found that there is a command in Vim called compiler. You can call it with any common compiler (for example, :compiler gcc, :compiler php, etc.), but it doesn't seem to have any immediate effect. I searched on the manpages but didn't find anything useful about what it actually does, nor does the Vim Wiki. Does anyone know what that command actually does?

    Read the article

  • Linksys wireless router will not hardware reset.

    - by Jack M.
    Hello, all. I'm unable to make my router perform a hardware reset, and I cannot understand why. All was working well, except that my iPhone could not connect to the wireless. I found that the router was only allowing AES encryption on WPA2 Personal mode, so I upgraded the firmware. I updated the firmware to Ver.1.06.1, and everything went screwy. The router is no longer showing up in the WiFi list (as Linksys, or its previous network name). Wiring into the router gives me an IP address from my ISP (24.121.121.XXX). Attempting to do a hardware reset, but the power light never starts flashing and the router does not seem to reboot. My machine wired in is still online with no interruption in WoW. Pulling the power cord to force a reset returns it to the same state. I even went so far as to pull up my previous IP address (from DynDNS) and try to connect to that, but it wont even ping. What I'm trying to find out is: Did the new firmware fry the thing, or is there some way to fix this? Thanks in advance for any help.

    Read the article

  • Changing elements in master page from content page in vb.net

    - by ferrer
    i have a page called a1.aspx, with the Masterpagefile = a1_master.master. Now the master page has its own divs and images for design purposes. I want a way where when i load a1.aspx, certain chosen 's and images should be hidden (visible=false). how can i do this? how can i change the visibility of a div or an image in the master page from the content page?

    Read the article

  • SqlLite/Fluent NHibernate integration test harness initialization not repeatable after large data se

    - by Mark Rogers
    In one of my main data integration test harnesses I create and use Fluent NHibernate's SingleConnectionSessionSourceForSQLiteInMemoryTesting, to get a fresh session for each test. After each test, I close the connection, session, and session factory, and throw out the nested StructureMap container they came from. This works for almost any simple data integration test I can think, including ones that utilize Fluent NHib's PersistenceSpecification object. When I test the application's lengthy database bootstrapping process, which creates and saves thousands of domain objects, I start seeing issues. It's not that the setup and tear down fails, in fact, the test successfully bootstraps the in-memory database as the application would bootstrap the real database in the production environment. The problem occurs when the database bootstrapping occurs a second time on a new in-memory database, with a new session and session factory. The error is: NHibernate.StaleStateException : Unexpected row count: 0; expected: 1 The row count is indeed Unexpected, the row that the application under test is looking for should be in the session. You see, it's not that any data from the last integration test is sticking around, it's that for some reason the session just stops working mid-database-boostrap. And I've looked everywhere for a place I might be holding on to an old session and I can't find one. I've searched through the code for static singleton objects, but there are none anywhere near the code in question. I have a couple StructureMap InstanceScope singleton's but they are getting thrown out with each nested container that is lost after every test teardown. I've tried every possible variation on disposing and closing every object involved with each test teardown and it still fails on this lengthy database bootstrap. But non-bootstrap related database tests appear to work fine. I'm starting to run out of options and may have to surrender lengthy database integration tests in favor of WatiN-based acceptance tests. Can anyone give me any clue about how I can figure out why some of my SingleConnectionSessionSourceForSQLiteInMemoryTesting aren't repeatable? Any advice at all, about how to make an NHibernate SqlLite database integration test harness repeatable?

    Read the article

  • How do i create nice looking controls?

    - by KoolKabin
    hi guys, I found a nice controls used by a software so wanted to use or build similar nice looking controls for my applications in vb.net First Sample control is nice rounded cornor group box [ i guess so ]: http://sachicomputer.com/kabin/samples/control1.jpg and second control is nice looking tab control: http://sachicomputer.com/kabin/samples/control1.jpg

    Read the article

  • cant read the json fom yahoo pipe.

    - by Bunny Rabbit
    $(function(){ $.getJSON('http://pipes.yahoo.com/pipes/pipe.run?_id=7ba696f34ae17b6fa8f5d4de13064dea&_render=json&callback=?',function(data){alert('called')}); }); i am using the above code to acess the a yahoo pipe i created to convert the last.fm xml output to json.but the firebug console output is showing me invalid label http://pipes.yahoo.com/pipes/pipe.run?_id=7ba696f34ae17b6fa8f5d4de13064dea&_render=json&callback=jsonp1276401573015 Line 1 while i can view the result using a browser in a perfectly normal way.also i validated the json using jsonlint and it shows the json is valid,what migt be the problem ?

    Read the article

  • How can i use the Pluggable ASP.NET Components on my project.

    - by shamim
    http://msdn.microsoft.com/en-us/library/aa479332.aspx form this site i download the MSDNElmah.msi.After install this, i get a solution Contain .aspx and web.config file and one dll.This site have some information about this plugin,but it's seems to difficult to me.I can not use it on my Project.I want to use this plugin on my project.Please help me to do that,give me some syntax or Full information how to do it.Thanks in advance.

    Read the article

  • Looking for exercises to learn SQL, using the Northwind database

    - by MedicineMan
    I am trying to become more familiar with SQL by writing queries against the Northwind database. I am looking for some exercises that would help me to learn SQL and features of SQL Server. It is important that the exercises have solutions, and in complicated cases, it would be great if there was an explanation for the query. Thanks for the answers so far but I still have not found what I am looking for: Is there any free resource, available online, without registration, that I can find a list of these exercises?

    Read the article

  • Trying to exclude certain extensions doing a recursive copy (MSBuild)

    - by Kragen
    I'm trying to use MSBuild to read in a list of files from a text file, and then perform a recursive copy, copying the contents of those directories files to some staging area, while excluding certain extensions (e.g. .tmp files) I've managed to do most of the above quite easily using CreateItem and the MSBuild copy task, whatever I do the CreateItem task just ignores my Exclude parameter: <PropertyGroup> <RootFolder>c:\temp</RootFolder> <ExcludeFilter>*.tmp</ExcludeFilter> <StagingDirectory>staging</StagingDirectory> </PropertyGroup> <ItemGroup> <InputFile Include="MyFile.txt" /> </ItemGroup> <Target Name="Build"> <ReadLinesFromFile File="@(InputFile)"> <Output ItemName="AllFolders" TaskParameter="Lines" /> </ReadLinesFromFile> <CreateItem Include="$(RootFolder)\%(AllFolders.RelativeDir)**" Exclude="$(ExcludeFilter)"> <Output ItemName="AllFiles" TaskParameter="Include" /> </CreateItem> <Copy SourceFiles="@(AllFiles)" DestinationFolder="$(StagingDirectory)\%(RecursiveDir)" Example contents of 'MyFile.txt': somedirectory\ someotherdirectory\ (I.e. the paths are relative to $(RootFolder) - mention this because I read somewhere that it might be relevant) I've tried loads of different combinations of Exclude filters, but I never seem to be able to get it to correctly exclude my .tmp files - is there any way of doing this with MSBuild without resorting to xcopy?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >