Daily Archives

Articles indexed Friday June 11 2010

Page 18/114 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • .net configurable business error messages

    - by Daniel
    Hi all, I need to implement some kind of solution such that in our business logic layer when certain conditions are met an error message is returned. That error message should be configurable either in a file or table that can be edited at run time if needed. I've seen it done before a few ways and it always ends up something like "This error message is {0}" and then when the dev goes the use the message they dont neccesarily know how many (if any) parameters the message needs. Just hoping to leverage off something that may have already been done, I dont think there is a provider or anything already in the .net framework.

    Read the article

  • How to display an array's content in colomns, like ls -C does.

    - by Arko
    I wanted to display a long list of strings from an array. Right now, my script run through a for loop echoing each value to the standard output: for value in ${values[@]} do echo $value done Yeah, that's pretty ugly! And the one column listing is pretty long too... I was wondering if i can find a command or builtin helping me to display all those values in columns, like the ls command does by default when listing a directory (ls -C).

    Read the article

  • Using CreateOrthographicOffCenter in XNA

    - by Jeffrey Kern
    I'm trying to figure out how to draw graphics in XNA, and someone else suggested this. But before I attempt to use this... If I create and use this camera, and set LEFT,TOP to 0 and WIDTH=256 and HEIGHT=240, anything I render to the screen will use these coordinates? So a box with a width and height of 1, if set to 0,0 will take up space from 0,0 to 1,1?

    Read the article

  • How can I lookup data about a book from its barcode number?

    - by Joel Spolsky
    I'm building the world's simplest library application. All I want to be able to do is scan in a book's UPC (barcode) using a typical scanner (which just types the numbers of the barcode into a field) and then use it to look up data about the book... at a minimum, title, author, year published, and either the Dewey Decimal or Library of Congress catalog number. The goal is to print out a tiny sticker ("spine label") with the card catalog number that I can stick on the spine of the book, and then I can sort the books by card catalog number on the shelves in our company library. That way books on similar subjects will tend to be near each other, for example, if you know you're looking for a book about accounting, all you have to do is find SOME book about accounting and you'll see the other half dozen that we have right next to it which makes it convenient to browse the library. There seem to be lots of web APIs to do this, including Amazon and the Library of Congress. But those are all extremely confusing to me. What I really just want is a single higher level function that takes a UPC barcode number and returns some basic data about the book.

    Read the article

  • NoSuchMethod exception thrown in GWT

    - by eb1
    I'm starting to get my feet wet in the latest Google Web Toolkit using the Eclipse plugin on OS X 10.5.8. So far I've been able to get the client up and running, which is great. The server, though, is a different matter. I'm trying to link to a .jar file that has some classes I want to use in a server ServiceImpl class, but it seems to have glommed onto a previous iteration of the .jar - I've added a method, rebuilt the jar, removed the jar from the libraries tab on the GWT project's build path (as well as on the exports) and reincluded the jar. No luck - I'm still getting: [WARN] Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract org.gwtapplication.client.LWDocument org.gwtapplication.client.DocumentService.getDocument()' threw an unexpected exception: java.lang.NoSuchMethodError: org.externalmodel.MyReallyValidClass.toSomething()Ljava/lang/String; at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581) ... Caused by: java.lang.NoSuchMethodError: org.externalmodel.MyReallyValidClass.toSomething()Ljava/lang/String; at org.application.server.DocumentServiceImpl.getDocument(DocumentServiceImpl.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) Eclipse's code sense has no problems resolving the MyReallyValidClass.toSomething() call, and there are no errors with other calls into the externalmodel classes. Any clue where I should be looking?

    Read the article

  • Is there any advantage to having more than 16gb ram on a Windows Dev machine?

    - by Robert Kozak
    Assuming a machine (Dual Quad Core Xeon (2.26GHz) with 24GB RAM) running Windows Server 2008 and Hyper-V. How many VMs can I expect to run at the same time with good performance. Is this overkill? Can you really have too much RAM? Assuming 2GB per VM thats around 16GB for the VMs with 8GB left over for the Main OS and Hyper-V. Sound about right? Edit: Tried to make the question sound less like bragging. Was never my intention. Its a hard question to write.

    Read the article

  • You tube video integration

    - by Mac
    for you tube video integration youtube provides an embed for all the you tube videos what i want is i just provide a link to the user on clicking of which it fetches the embed of that particular video and play that one in my asp.net page how to achieve this can any one help me out it ill be better if you can give some examples along with

    Read the article

  • Losing URI segments when paginating with CodeIgniter

    - by Danny Herran
    I have a /payments interface where the user should be able to filter via price range, bank, and other stuff. Those filters are standard select boxes. When I submit the filter form, all the post data goes to another method called payments/search. That method performs the validation, saves the post values into a session flashdata and redirects the user back to /payments passing the flashdata name via URL. So my standard pagination links with no filters are exactly like this: payments/index/20/ payments/index/40/ payments/index/60/ And if you submit the filter form, the returning URL is: payments/index/0/b48c7cbd5489129a337b0a24f830fd93 This works just great. If I change the zero for something else, it paginates just fine. The only issue however is that the << 1 2 3 4 page links wont keep the hash after the pagination offset. CodeIgniter is generating the page links ignoring that additional uri segment. My uri_segment config is already set to 3: $config['uri_segment'] = 3; I cannot set the page offset to 4 because that hash may or may not exists. Any ideas of how can I solve this? Is it mandatory for CI to have the offset as the last segment in the uri? Maybe I am trying an incorrect approach, so I am all ears. Thank you folks.

    Read the article

  • jquery: show data after change event

    - by klox
    i have this code: <script> $("#mod").change(function() { var matches=str.match(/(EE|[EJU]).*(D)/i); $.ajax({ type="post", url="process.php", data="matches", cache=false, async=false, success= function(res){ $('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>"); return this; } }); return false; }); </script> i want this code can show the result normally..where is my fault?

    Read the article

  • Is it possible to create an Android Service that listens for hardware key presses?

    - by VoteBrian
    I'd like to run an Android background service that will act as a keylistener from the home screen or when the phone is asleep. Is this possible? From semi-related examples online, I put together the following service, but get the error, "onKeyDown is undefined for the type Service". Does this mean it can't be done without rewriting Launcher, or is there something obvious I'm missing? public class ServiceName extends Service { @Override public void onCreate() { //Stuff } public IBinder onBind(Intent intent) { //Stuff return null; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(event.getAction() == KeyEvent.ACTION_DOWN) { switch(keyCode) { case KeyEvent.KEYCODE_A: //Stuff return true; case KeyEvent.KEYCODE_B: //Stuff return true; //etc. } } return super.onKeyDown(keyCode, event); } } I realize Android defaults to the search bar when you type from the home screen, but this really is just for a very particular use. I don't really expect anyone but me to want this. I just think it'd be nice, for example, to use the camera button to wake the phone.

    Read the article

  • SqlParameter contructor compiler overload choice

    - by Ash
    When creating a SqlParameter (.NET3.5) or OdbcParameter I often use the SqlParameter(string parameterName, Object value) constructor overload to set the value in one statement. When I tried passing a literal 0 as the value paramter I was initially caught by the C# compiler choosing the (string, OdbcType) overload instead of (string, Object). MSDN actually warns about this gotcha in the remarks section, but the explanation confuses me. Why does the C# compiler decide that a literal 0 parameter should be converted to OdbcType rather than Object? The warning also says to use Convert.ToInt32(0) to force the Object overload to be used. It confusingly says that this converts the 0 to an "Object type". But isn't 0 already an "Object type"? The Types of Literal Values section of this page seems to say literals are always typed and so inherit from System.Object. This behavior doesn't seem very intuitive given my current understanding? Is this something to do with Contra-variance or Co-variance maybe?

    Read the article

  • application specific seed data population

    - by user339108
    Env: JBoss, (h2, MySQl, postgres), JPA, Hibernate 3.3.x @Id @GeneratedValue(strategy = IDENTITY) private Integer key; Currently our primary keys are created using the above annotation. We expect to support a large number of users (~million users), what key should be used. Should it be Integer or Long or should I use the unsigned versions of the above declarations. We have a j2ee application which needs to be populated with some seed data on installation. On purchase, the customer creates his own data on top of the application. We just want to make sure that there is enough room to ship, modify or add data for future releases. What would be the best mechanism to support this, we had looked at starting all table identifiers from a certain id (say 1000) but this mandates modifying primary key generation to have table or sequence based generators and we have around ~100 tables. We are not sure if this is the right strategy for this. If we use a signed integer approach for the key, would it make sense to have the seed data as everything starting from 0 and below (i.e -ve numbers), so that all customer specific data will be available on 0 and above (i.e. +ve numbers)

    Read the article

  • Forcing IE8 Standards Mode with FEATURE_BROWSER_EMULATION

    - by earls
    I'm doing this: http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx But it's not working. I have "iexplore.exe" set to 8888 (decimal mode) under MACHINE, but it's still coming up documentMode = 5. I thought 8888 was suppose to force IE8 Standards Mode whether you have a doctype or not. What is going on?

    Read the article

  • Addressing "Access Denied" Exception with WMI Calls

    - by Joe
    I'm getting an exception with a message of "Access Denied" when executing against a WMI request. Some WMI requests appear to require higher security privileges than others. Ultimately my goal is to monitor process launches within the system and log. Regardless if there is a better approach, its now become a vendetta in getting this WMI approach to work. I've attempted the code at Security Tools - WMI Programming Using C#.Net and still receive the exception. If you copy the code found in the blog entry you can reproduce my issue. Another post on a similar topic can be found at link text but again, try the code and you'll the see the same security exception. How do I permit my code to execute these WMI requests? I'm running on Windows 7 Pro and VS 2010 in a new C# command line project.

    Read the article

  • How to iterate with Selenium RC over XPath results directly?

    - by Gj
    I'm currently resorting to first doing a get_xpath_count, and then creating a loop incrementing an index variable, which in turn I inject back into the original xpath to select the nth result... very awkward no doubt. Is there some simple, direct, elegant way to iterate directly over the xpath results? Thanks!

    Read the article

  • Interfacing HTTPBuilder and HTMLUnit... some code

    - by Misha Koshelev
    Ok, this isn't even a question: import com.gargoylesoftware.htmlunit.HttpMethod import com.gargoylesoftware.htmlunit.WebClient import com.gargoylesoftware.htmlunit.WebResponseData import com.gargoylesoftware.htmlunit.WebResponseImpl import com.gargoylesoftware.htmlunit.util.Cookie import com.gargoylesoftware.htmlunit.util.NameValuePair import static groovyx.net.http.ContentType.TEXT import java.io.File import java.util.logging.Logger import org.apache.http.impl.cookie.BasicClientCookie /** * HTTPBuilder class * * Allows Javascript processing using HTMLUnit * * @author Misha Koshelev */ class HTTPBuilder { /** * HTTP Builder - implement this way to avoid underlying logging output */ def httpBuilder /** * Logger */ def logger /** * Directory for storing HTML files, if any */ def saveDirectory=null /** * Index of current HTML file in directory */ def saveIdx=1 /** * Current page text */ def text=null /** * Response for processJavascript (Complex Version) */ def resp=null /** * URI for processJavascript (Complex Version) */ def uri=null /** * HttpMethod for processJavascript (Complex Version) */ def method=null /** * Default constructor */ public HTTPBuilder() { // New HTTPBuilder httpBuilder=new groovyx.net.http.HTTPBuilder() // Logging logger=Logger.getLogger(this.class.name) } /** * Constructor that allows saving output files for testing */ public HTTPBuilder(saveDirectory,saveIdx) { this() this.saveDirectory=saveDirectory this.saveIdx=saveIdx } /** * Save text and return corresponding XmlSlurper object */ public saveText() { if (saveDirectory) { def file=new File(saveDirectory.toString()+File.separator+saveIdx+".html") logger.finest "HTTPBuilder.saveText: file=\""+file.toString()+"\"" file<<text saveIdx++ } new XmlSlurper(new org.cyberneko.html.parsers.SAXParser()).parseText(text) } /** * Wrapper around supertype get method */ public Object get(Map<String,?> args) { logger.finer "HTTPBuilder.get: args=\""+args+"\"" args.contentType=TEXT httpBuilder.get(args) { resp,reader-> text=reader.text this.resp=resp this.uri=args.uri this.method=HttpMethod.GET saveText() } } /** * Wrapper around supertype post method */ public Object post(Map<String,?> args) { logger.finer "HTTPBuilder.post: args=\""+args+"\"" args.contentType=TEXT httpBuilder.post(args) { resp,reader-> text=reader.text this.resp=resp this.uri=args.uri this.method=HttpMethod.POST saveText() } } /** * Load cookies from specified file */ def loadCookies(file) { logger.finer "HTTPBuilder.loadCookies: file=\""+file.toString()+"\"" file.withObjectInputStream { ois-> ois.readObject().each { cookieMap-> def cookie=new BasicClientCookie(cookieMap.name,cookieMap.value) cookieMap.remove("name") cookieMap.remove("value") cookieMap.entrySet().each { entry-> cookie."${entry.key}"=entry.value } httpBuilder.client.cookieStore.addCookie(cookie) } } } /** * Save cookies to specified file */ def saveCookies(file) { logger.finer "HTTPBuilder.saveCookies: file=\""+file.toString()+"\"" def cookieMaps=new ArrayList(new LinkedHashMap()) httpBuilder.client.cookieStore.getCookies().each { cookie-> def cookieMap=[:] cookieMap.version=cookie.version cookieMap.name=cookie.name cookieMap.value=cookie.value cookieMap.domain=cookie.domain cookieMap.path=cookie.path cookieMap.expiryDate=cookie.expiryDate cookieMaps.add(cookieMap) } file.withObjectOutputStream { oos-> oos.writeObject(cookieMaps) } } /** * Process Javascript using HTMLUnit (Simple Version) */ def processJavascript() { logger.finer "HTTPBuilder.processJavascript (Simple)" def webClient=new WebClient() def tempFile=File.createTempFile("HTMLUnit","") tempFile<<text def page=webClient.getPage("file://"+tempFile.toString()) webClient.waitForBackgroundJavaScript(10000) text=page.asXml() webClient.closeAllWindows() tempFile.delete() saveText() } /** * Process Javascript using HTMLUnit (Complex Version) * Closure, if specified, used to determine presence of necessary elements */ def processJavascript(closure) { logger.finer "HTTPBuilder.processJavascript (Complex)" // Convert response headers def headers=new ArrayList() resp.allHeaders.each() { header-> headers.add(new NameValuePair(header.name,header.value)) } def responseData=new WebResponseData(text.bytes,resp.statusLine.statusCode,resp.statusLine.toString(),headers) def response=new WebResponseImpl(responseData,uri.toURL(),method,0) // Transfer cookies def webClient=new WebClient() httpBuilder.client.cookieStore.getCookies().each { cookie-> webClient.cookieManager.addCookie(new Cookie(cookie.domain,cookie.name,cookie.value,cookie.path,cookie.expiryDate,cookie.isSecure())) } def page=webClient.loadWebResponseInto(response,webClient.getCurrentWindow()) // Wait for condition if (closure) { for (i in 1..20) { if (closure(page)) { break; } synchronized(page) { page.wait(500); } } } // Return text text=page.asXml() webClient.closeAllWindows() saveText() } } Allows one to interface HTTPBuilder with HTMLUnit! Enjoy Misha

    Read the article

  • convert remote object result to array collection in flex...........

    - by user364199
    HI guys, im using zend_amf and flex. My problem is i have to populate my advance datagrid using array collection. this array collection have a children. example: [Bindable] private var dpHierarchy:ArrayCollection = new ArrayCollection([ {trucks:"Truck", children: [ {trucks:"AMC841", total_trip:1, start_time:'3:46:40 AM'}, {trucks:"AMC841", total_trip:1, start_time:'3:46:40 AM'}]) ]}; but the datasource of my datagrid should come from a database, how can i convert the result from remote object to array collection that has the same format like in my example, or any other way. here is my advance datagrid <mx:AdvancedDataGrid id="datagrid" width="500" height="200" lockedColumnCount="1" lockedRowCount="0" horizontalScrollPolicy="on" includeIn="loggedIn" x="67" y="131"> <mx:dataProvider> <mx:HierarchicalData id="dpHierarchytest" source="{dp}"/> </mx:dataProvider> <mx:groupedColumns> <mx:AdvancedDataGridColumn dataField="trucks" headerText="Trucks"/> <mx:AdvancedDataGridColumn dataField="total_trip" headerText="Total Trip"/> <mx:AdvancedDataGridColumnGroup headerText="PRECOOLING"> <mx:AdvancedDataGridColumnGroup headerText="Before Loading"> <mx:AdvancedDataGridColumn dataField="start_time" headerText="Start Time"/> <mx:AdvancedDataGridColumn dataField="end_time" headerText="End Time"/> <mx:AdvancedDataGridColumn dataField="precooling_time" headerText="Precooling Time"/> <mx:AdvancedDataGridColumn dataField="precooling_temp" headerText="Precooling Temp"/> </mx:AdvancedDataGridColumnGroup> <mx:AdvancedDataGridColumnGroup headerText="Before Dispatch"> <mx:AdvancedDataGridColumn dataField="bd_start_time" headerText="Start Time"/> <mx:AdvancedDataGridColumn dataField="bd_end_time" headerText="End Time"/> <mx:AdvancedDataGridColumn dataField="bd_precooling_time" headerText="Precooling Time"/> <mx:AdvancedDataGridColumn dataField="bd_precooling_temp" headerText="Precooling Temp"/> </mx:AdvancedDataGridColumnGroup> <mx:AdvancedDataGridColumn dataField="remarks" headerText="Remarks"/> </mx:AdvancedDataGridColumnGroup> <mx:AdvancedDataGridColumnGroup headerText="Temperature Compliance"> <mx:AdvancedDataGridColumn dataField="total_hit" headerText="Total Hit"/> <mx:AdvancedDataGridColumn dataField="total_miss" headerText="Total Miss"/> <mx:AdvancedDataGridColumn dataField="cold_chain_compliance" headerText="Cold Chain Compliance"/> <mx:AdvancedDataGridColumn dataField="average_temp" headerText="Average Temp"/> </mx:AdvancedDataGridColumnGroup> <mx:AdvancedDataGridColumnGroup headerText="Productivity"> <mx:AdvancedDataGridColumn dataField="total_drop_points" headerText="Total Drop Points"/> <mx:AdvancedDataGridColumn dataField="total_delivery_time" headerText="Total Delivery Time"/> <mx:AdvancedDataGridColumn dataField="total_distance" headerText="Total Distance"/> </mx:AdvancedDataGridColumnGroup> <mx:AdvancedDataGridColumnGroup headerText="Trip Exceptions"> <mx:AdvancedDataGridColumn dataField="total_doc" headerText="Total DOC"/> <mx:AdvancedDataGridColumn dataField="total_eng" headerText="Total ENG"/> <mx:AdvancedDataGridColumn dataField="total_fenv" headerText="Total FENV"/> <mx:AdvancedDataGridColumn dataField="average_speed" headerText="Average Speed"/> </mx:AdvancedDataGridColumnGroup> </mx:groupedColumns> </mx:AdvancedDataGrid> Thanks, and i really need some help.

    Read the article

  • Vim: How can I :cd to an sftp directory?

    - by ChrisInCambo
    Hi, I'm currently an emacs user, but thought I would come back and take another look at Vim for fun. My client machine is Ubuntu, and I frequently work on other ubuntu servers within my network, emacs and tramp is really nice in this regard, I can just connect to a file via sftp and then easily navigate to it's parents/children/sibling, just as if I was dealing with a file on the local file system. With Vim I can sftp to a file, but none of the navigation stuff works, when I use :e or fuzzy file search, vim still thinks I'm back on the client machine. If I try to :cd to the sftp directory I get an error. Is there anyway I can get the same file/folder navigation regardless of whether I'm looking at an sftp folder or a folder on my client machine? Cheers, Chrsi

    Read the article

  • IPTables configuration for Localhost

    - by Gabe Mc
    I have a problem in connecting a JIRA instance running on a cloud server to an instance of MySQL running on the same box. I have configured it previously using quite a few iptables rules, but it seems overly broad/terribly inprecise. I want access to several of localhosts ports from the local machine, but deny it from all other accounts. Currently, my /etc/iptables.rules file looks like: *filter :INPUT DROP [223:17779] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [10161:1120819] # SSH Access -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT # Apache2 Access for connecting to Tomcat on port 8080 -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT # MySQL -I INPUT -i lo -p tcp -m tcp --dport mysql -j ACCEPT COMMIT However, this doesn't allow me to log in when I try logging in; it just hangs on: #> mysql -u root -p -h 127.0.0.1 The Tomcat servlet container starts throwing all kinds of exceptions, as well. This is a more general problem, as I need to enable things like accessing the shutdown port for the Tomcat container, but I need to at least get the MySQL part ironed out first, without the ugliness I was originally trying. Thanks.

    Read the article

  • What are optimal strategies for using mapreduce and other applications on the same server?

    - by user45532
    I have two applications that I need to run continuously to process data. 1.) An app that processes and aggregates information from sources 2.) A mapreduce workflow* that processes the above info I've thought about either getting vps hosting or getting my own inexpensive server and using xen to split the resources of the server. Getting a quad core box with 2 GB of Ram seems a lot cheaper than the grid options I've seen at slicehost, rackspace and others...

    Read the article

  • SQL Server 2008 R2 Reporting Services: A generic error occurred in GDI+

    - by Greg Low
    While building some maps today in SQL Server 2008 R2 Reporting Services, I kept coming up with an error that said: A generic error occurred in GDI+ I was struggling to think what I'd done wrong. After much nashing of teeth and removal of hair, I finally worked out what the error was. When I got to the "Choose Color Scheme and Visualization" page of the map wizard for building a color analytical map, I hadn't picked the correct value for the "Field to Visualize" drop-down. I'm guessing that because...(read more)

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >