Search Results

Search found 2417 results on 97 pages for 'states'.

Page 89/97 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • Custom Windows Forms Control not exporting functions, not showing in tools list, showing as Text

    - by flavour404
    Hi, I have written a very simple control. C# Visual Studio 2008. Its output should be, and is a dll. I have added a reference to the dll within the project that I intend to use it with. The msdn article about how to write a control states that it should appear in the 'Add reference / projects' list, which it doesn't but I simply navigated to it under the 'browse' tab, went to the /bin folder and added the reference that way. I dragged it over to my toolbox, but it shows up as a 'Text:xhair_tool' and when i try and add it to a form, it won't, so what have I done wrong? It was created as a 'Windows forms control' project. It should export the one method which is 'Target' which return an array, as shown below. using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; namespace xhair_tool { public partial class xhair : UserControl { public xhair() { InitializeComponent(); } private void xhair_Load(object sender, EventArgs e) { } protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; Pen pen = new Pen(Color.Black, 1); SolidBrush redBrush = new SolidBrush(Color.Red); g.DrawLine(pen, 8, 0, 8, 7); g.DrawLine(pen, 8, 9, 8, 16); g.DrawLine(pen, 0, 8, 7, 8); g.DrawLine(pen, 9, 8, 16, 8); //ControlPaint.DrawReversibleLine(start, end, backColor) } /// <summary> /// Returns the point at the center of the crosshair /// </summary> /// <returns>int[x,y]</returns> public int[] Target { get { int[] _xy = new int[2]; _xy[0] = this.Left + 8; _xy[1] = this.Top + 8; return _xy; } } } } Thanks, R.

    Read the article

  • IPHONE SDK, How to put Void function into my BOOL??? PLEASE!

    - by Harry
    I am using the IPhone's Accelerometer to make a object move. I want to be able to make this function work and not work depending on different states. I have my code for my Accelerometer function and i want to put it into a BOOL so i can call on it when i need it, but i am having problems. Can anyone Help me put this code into a BOOL named: -(BOOL) accelerometerWorks -(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration{ valueX = acceleration.x*25.5; int newX = (int)(ball.center.x +valueX); if (newX > 320-BALL_RADIUS) newX = 320-BALL_RADIUS; if (newX < 0+BALL_RADIUS) newX = 0+BALL_RADIUS; int XA = (int)(balloonbit1.center.x +valueX); if (XA > 320-BALL_RADIUS) XA = 320-BALL_RADIUS; if (XA < 0+BALL_RADIUS) XA = 0+BALL_RADIUS; int XB = (int)(balloonbit2.center.x +valueX); if (XB > 320-BALL_RADIUS) XB = 320-BALL_RADIUS; if (XB < 0+BALL_RADIUS) XB = 0+BALL_RADIUS; int XE = (int)(balloonbit5.center.x +valueX); if (XE > 320-BALL_RADIUS) XE = 320-BALL_RADIUS; if (XE < 0+BALL_RADIUS) XE = 0+BALL_RADIUS; int XF = (int)(balloonbit6.center.x +valueX); if (XF > 320-BALL_RADIUS) XF = 320-BALL_RADIUS; if (XF < 0+BALL_RADIUS) XF = 0+BALL_RADIUS; int XH = (int)(balloonbit8.center.x +valueX); if (XH > 320-BALL_RADIUS) XH = 320-BALL_RADIUS; if (XH < 0+BALL_RADIUS) XH = 0+BALL_RADIUS; ball.center = CGPointMake (newX, 415); balloonbit1.center = CGPointMake (XA, 408); balloonbit2.center = CGPointMake (XB, 395); balloonbit5.center = CGPointMake (XE, 388); balloonbit6.center = CGPointMake (XF, 413); balloonbit8.center = CGPointMake (XH, 426); } Please help. i have been trying for ages with no success. Thanks. Harry.

    Read the article

  • extra vertical space within <li> in IE7

    - by powerboy
    The test case is in below. Or you can view it in jsbin: http://jsbin.com/uxagi. <!DOCTYPE html> <html> <head> <style type="text/css"> body {margin: 20px; } #main {border: 1px solid red;} img {float: left; height: 100px; padding: 0 10px 10px 0;} ul {margin: 0; padding: 0; list-style-type: none;} </style> </head> <body> <div id="main"> <ul> <li> <img src="http://upload.wikimedia.org/wikipedia/en/thumb/0/07/CranebyLinson1894.jpg/100px-CranebyLinson1894.jpg" /> <div class="content">"The Open Boat" is a short story by American author Stephen Crane. First published in 1897, it was based on Crane's experience of having survived a shipwreck off the coast of Florida earlier that year while traveling to Cuba to work as a newspaper correspondent. Crane was stranded at sea for thirty hours when his ship, the SS Commodore, sank after hitting a sandbar. He and three other men were forced to navigate their way to shore in a small boat; one of the men, an oiler named Billie Higgins, drowned. Crane subsequently adapted his report into narrative form, and the short story "The Open Boat" was published in Scribner's Magazine. The story is told from the point of view of an anonymous correspondent, Crane's fictional doppelgänger, and the action closely resembles the author's experiences after the shipwreck. A volume titled The Open Boat and Other Tales of Adventure was published in the United States in 1898. Praised for its innovation by contemporary critics, the story is considered an exemplary work of literary Naturalism. One of the most frequently discussed works in Crane's canon, it is notable for its use of imagery, irony, symbolism, and exploration of themes including survival, solidarity, and the conflict between man and nature. H. G. Wells considered "The Open Boat" to be "beyond all question, the crown of all [Crane's] work".</div> </li> </ul> </div> </body> </html> Note that in standards-compliant browsers and IE8, there is no vertical space between the red border and the text. But there is vertical space in IE7 (haven't tested in IE6).

    Read the article

  • Why don't my scrollbars work properly when programmatically hiding rows in silverlight Datagrid?

    - by Luke Vilnis
    I have a Silverlight datagrid with custom code that allows for +/- buttons on the lefthand side and can display a table with a tree structure. The +/- buttons are bound to a IsExpanded property on my ViewModelRows, as I call them. The visibility of rows is bound to an IsVisible property on the ViewModelRows which is determined based on whether or not all of the parent rows are expanded. Straightforward enough. This code works fine in that if I scroll up and down the grid with PageUp/PageDown or the arrow keys, all the right rows are hidden and everything has the right structure and I can play with the +/- buttons to my hearts content. However, the vertical scroll bar on the right hand side, although it starts off the correct size and it scrolls through the rows smoothly, when I collapse rows and then re-expand them, doesn't go back to its correct size. The scrollbar can still usually be moved around to scroll through the whole collection, but because it is too big, once the bar moves to the bottom, there are still more rows to go through and it sort of jerkily shoots all the way down to the bottom or sometimes fails to scroll at all. This is pretty hard to describe so I included a screenshot with the black lines drawn on to show the difference in scrollbar length even though the two grids have the same number of rows expanded. I think this might be a bug related to the way the Datagrid does virtualization of rows. It seems to me like it isn't properly keeping track of how tall each row is supposed to be when expansion states change. Is there a way to programmatically "poke" (read hack) it to recalculate its scrollbar size on LoadingRow or something ugly like that? I'd include a code sample but there's 2 c# files and 1 xaml file so I wanted to see if anyone else has heard of this sort of issue before I try to make it reproducible in a self-contained way. Once again, scrolling with the arrow keys works fine so I'm pretty sure the underlying logic and binding is working, there's just some issue with the row height not being calculated properly. Since I'm a new user, it won't let me use image tags so here's the link to a picture of the problem: http://img210.imageshack.us/img210/8760/messedupscrollbars.png

    Read the article

  • fileToSTring keeps on returning " "

    - by karikari
    I managed to get this code to compile with out error. But somehow it did not return the strings that I wrote inside file1.txt and file.txt that I pass its path through str1 and str2. My objective is to use this open source library to measure the similarity between strings contains inside 2 text files. Inside the its Javadoc, its states that ... public static java.lang.StringBuffer fileToString(java.io.File f) private call to load a file and return its content as a string. Parameters: f - a file for which to load its content Returns: a string containing the files contents or "" if empty or not present Here's is my modified code trying to use the FileLoader function, but fails to return the strings inside the file. The end result keeps on returning me the "" . I do not know where is my fault: package uk.ac.shef.wit.simmetrics; import java.io.File; import uk.ac.shef.wit.simmetrics.similaritymetrics.*; import uk.ac.shef.wit.simmetrics.utils.*; public class SimpleExample { public static void main(final String[] args) { if(args.length != 2) { usage(); } else { String str1 = "arg[0]"; String str2 = "arg[1]"; File objFile1 = new File(str1); File objFile2 = new File(str2); FileLoader obj1 = new FileLoader(); FileLoader obj2 = new FileLoader(); str1 = obj1.fileToString(objFile1).toString(); str2 = obj2.fileToString(objFile2).toString(); System.out.println(str1); System.out.println(str2); AbstractStringMetric metric = new MongeElkan(); //this single line performs the similarity test float result = metric.getSimilarity(str1, str2); //outputs the results outputResult(result, metric, str1, str2); } } private static void outputResult(final float result, final AbstractStringMetric metric, final String str1, final String str2) { System.out.println("Using Metric " + metric.getShortDescriptionString() + " on strings \"" + str1 + "\" & \"" + str2 + "\" gives a similarity score of " + result); } private static void usage() { System.out.println("Performs a rudimentary string metric comparison from the arguments given.\n\tArgs:\n\t\t1) String1 to compare\n\t\t2)String2 to compare\n\n\tReturns:\n\t\tA standard output (command line of the similarity metric with the given test strings, for more details of this simple class please see the SimpleExample.java source file)"); } }

    Read the article

  • How to I serialize a large graph of .NET object into a SQL Server BLOB without creating a large bu

    - by Ian Ringrose
    We have code like: ms = New IO.MemoryStream bin = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bin.Serialize(ms, largeGraphOfObjects) dataToSaveToDatabase = ms.ToArray() // put dataToSaveToDatabase in a Sql server BLOB But the memory steam allocates a large buffer from the large memory heap that is giving us problems. So how can we stream the data without needing enough free memory to hold the serialized objects. I am looking for a way to get a Stream from SQL server that can then be passed to bin.Serialize() so avoiding keeping all the data in my processes memory. Likewise for reading the data back... Some more background. This is part of a complex numerical processing system that processes data in near real time looking for equipment problems etc, the serialization is done to allow a restart when there is a problem with data quality from a data feed etc. (We store the data feeds and can rerun them after the operator has edited out bad values.) Therefore we serialize the object a lot more often then we de-serialize them. The objects we are serializing include very large arrays mostly of doubles as well as a lot of small “more normal” objects. We are pushing the memory limit on a 32 bit system and make the garage collector work very hard. (Effects are being made elsewhere in the system to improve this, e.g. reusing large arrays rather then create new arrays.) Often the serialization of the state is the last straw that courses an out of memory exception; our peak memory usage is while this serialization is being done. I think we get large memory pool fragmentation when we de-serialize the object, I expect there are also other problem with large memory pool fragmentation given the size of the arrays. (This has not yet been investigated, as the person that first looked at this is a numerical processing expert, not a memory management expert.) Are customers use a mix of Sql Server 2000, 2005 and 2008 and we would rather not have different code paths for each version of Sql Server if possible. We can have many active models at a time (in different process, across many machines), each model can have many saved states. Hence the saved state is stored in a database blob rather then a file. As the spread of saving the state is important, I would rather not serialize the object to a file, and then put the file in a BLOB one block at a time. Other related questions I have asked How to Stream data from/to SQL Server BLOB fields? Is there a SqlFileStream like class that works with Sql Server 2005?

    Read the article

  • CSS precedence order? My lecture slides are correct or not?

    - by Michael Mao
    Hi all: I've noticed that there are a couple of similar questions and answers at SO already, but let me clarify my specific question here first: I've got lecture slides which states like this: To be frank, I haven't heard of this rule of css precedence myself, and I googled to find something with similar topic but not quite like that : here To have a test myself, I've made a test page on my own server here After running it on FireFox 3.6.3, I am sure it does not show the way as it should be, according to the statement in lecture slides: imported stylesheet ? am I doing it wrong? I cannot see its effect using FireBug it says that embedded stylesheet has a higher precedence over linked/imported stylesheets, however, it doesn't work, if I put the linked/imported tag AFTER that. inline style vs html attributes ? I've got an image where I firstly set its inline style to control the width and height, then use direct html attributes width/height to try modifying that, but failed... Below is the source code : <html> <head> <style type="text/css"> #target { border : 2px solid green; color : green; } </style> <link rel="stylesheet" href="./linked.css" type="text/css" media="screen" /> </head> <body> <div id="target">A targeted div tag on page.</div> <img src="cat.jpg" alt="" style="width : 102px; height : 110px;" width="204px" height="220px" /> </body> </html> Can any experienced CSS guys help me figure out if the slide is correct or not? Frankly speaking, I am puzzled myself, as I can clearly see some other "incorrect" statements here and there amongst the slides, such as JavaScript is on client-side (how about server-side JavaScript?) and "Embedded styles are in the head section of a web page "(what the heck? I am not allowed to put it inside the body tag?) Sorry about this silly question, the exam is on TOMORROW, and I now see a lot of things to think about :)

    Read the article

  • Grails Twitter Bootstrap Plugin Issue with navbar-fixed-top

    - by Philip Tenn
    I am using Grails 2.1.0 and Twitter Bootstrap Plugin 2.1.1 and am encountering an issue with navbar-fixed-top. In order to get the Navbar fixed to the top of the page to behave correctly during resize, the Twitter Bootstrap Docs states: Add .navbar-fixed-top and remember to account for the hidden area underneath it by adding at least 40px padding to the . Be sure to add this after the core Bootstrap CSS and before the optional responsive CSS. How can I do this when using the Grails Plugin for Twitter Bootstrap? Here is what I have tried: main.gsp <head> ... <r:require modules="bootstrap-css"/> <style type="text/css"> body { padding-top: 60px; padding-bottom: 40px; } .sidebar-nav { padding: 9px 0; } </style> <r:require modules="bootstrap-responsive-css"/> <r:layoutResources/> </head> The problem is that Grails Plugin for Twitter Bootstrap takes the content of bootstrap.css and bootstrap-responsive.css and combines them into the following merged file: static/bundle-bundle_bootstrap_head.css. Thus, I am not able to put the body padding style "after core Bootstrap CSS and before Responsive CSS" as per Twitter Bootstrap docs. Here is the View Source HTML that I get from the main.gsp above <style type="text/css"> body { padding-top: 60px; padding-bottom: 40px; } .sidebar-nav { padding: 9px 0; } </style> <link href="/homes/static/bundle-bundle_bootstrap_head.css" type="text/css" rel="stylesheet" media="screen, projection" /> If there is no way to do this, I could always just drop the Grails Twitter Bootstrap Plugin and manually download Twitter Bootstrap and put it my Grails Project's web-app/css, web-app/images, and web-app/js. However, I would like to be able to use the Grails Twitter Bootstrap Plugin. Thank you very much in advance, I appreciate it!

    Read the article

  • Using mx.charts in a Flex Hero mobile project

    - by Alexander Farber
    Hello, Adobe states that Charts are supported in mobile projects but when I try to change the following working files (created project with File - New - Flex Mobile Project - Google Nexus One): MyTest.mxml: <?xml version="1.0" encoding="utf-8"?> <s:MobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.MyTestHome"> <s:navigationContent> <s:Button label="Home" click="navigator.popToFirstView();"/> </s:navigationContent> <s:actionContent/> </s:MobileApplication> MyTestHome.mxml: <?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="Test Chart"> </s:View> to the new MyTestHome.mxml: <?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" title="Test Chart"> <fx:Script> <![CDATA[ import mx.collections.*; [Bindable] private var medalsAC:ArrayCollection = new ArrayCollection( [ {Country: "USA", Gold: 35, Silver:39, Bronze: 29 }, {Country:"China", Gold: 32, Silver:17, Bronze: 14 }, {Country:"Russia", Gold: 27, Silver:27, Bronze: 38 } ]); ]]> </fx:Script> <mx:PieChart id="chart" height="100%" width="100%" paddingRight="5" paddingLeft="5" color="0x323232" dataProvider="{medalsAC}" > <mx:series> <mx:PieSeries labelPosition="callout" field="Gold"> <mx:calloutStroke> <s:SolidColorStroke weight="0" color="0x888888" alpha="1.0"/> </mx:calloutStroke> <mx:radialStroke> <s:SolidColorStroke weight="0" color="#FFFFFF" alpha="0.20"/> </mx:radialStroke> <mx:stroke> <s:SolidColorStroke color="0" alpha="0.20" weight="2"/> </mx:stroke> </mx:PieSeries> </mx:series> </mx:PieChart> </s:View> and also add c:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\4.5.0\frameworks\libs\datavisualization.swc c:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\4.5.0\frameworks\libs\sparkskins.swc c:\Program Files\Adobe\Adobe Flash Builder Burrito\sdks\4.5.0\frameworks\libs\mx\mx.swc to Flex Build Path (clicking "Add SWC" button): Then it fails with the error: Could not resolve to a component implementation. Does anybody please have an idea here? Alex

    Read the article

  • Java "compare cannot be resolved to a type" error

    - by King Triumph
    I'm getting a strange error when attempting to use a comparator with a binary search on an array. The error states that "compareArtist cannot be resolved to a type" and is thrown by Eclipse on this code: Comparator<Song> compare = new Song.compareArtist(); I've done some searching and found references to a possible bug with Eclipse, although I have tried the code on a different computer and the error persists. I've also found similar issues regarding the capitalization of the compare method, in this case compareArtist. I've seen examples where the first word in the method name is capitalized, although it was my understanding that method names are traditionally started with a lower case letter. I have experimented with changing the capitalization but nothing has changed. I have also found references to this error if the class doesn't import the correct package. I have imported java.util in both classes in question, which to my knowledge allows the use of the Comparator. I've experimented with writing the compareArtist method within the class that has the binary search call as well as in the "Song" class, which according to my homework assignment is where it should be. I've changed the constructor accordingly and the issue persists. Lastly, I've attempted to override the Comparator compare method by implementing Comparator in the Song class and creating my own method called "compare". This returns the same error. I've only moved to calling the comparator method something different than "compare" after finding several examples that do the same. Here is the relevant code for the class that calls the binary search that uses the comparator. This code also has a local version of the compareArtist method. While it is not being called currently, the code for this method is the same as the in the class Song, where I am trying to call it from. Thanks for any advice and insight. import java.io.*; import java.util.*; public class SearchByArtistPrefix { private Song[] songs; // keep a direct reference to the song array private Song[] searchResults; // holds the results of the search private ArrayList<Song> searchList = new ArrayList<Song>(); // hold results of search while being populated. Converted to searchResults array. public SearchByArtistPrefix(SongCollection sc) { songs = sc.getAllSongs(); } public int compareArtist (Song firstSong, Song secondSong) { return firstSong.getArtist().compareTo(secondSong.getArtist()); } public Song[] search(String artistPrefix) { String artistInput = artistPrefix; int searchLength = artistInput.length(); Song searchSong = new Song(artistInput, "", ""); Comparator<Song> compare = new Song.compareArtist(); int search = Arrays.binarySearch(songs, searchSong, compare);

    Read the article

  • Expression Too Complex In Access 2007

    - by Jazzepi
    When I try to run this query in Access through the ODBC interface into a MySQL database I get an "Expression too complex in query expression" error. The essential thing I'm trying to do is translate abbreviated names of languages into their full body English counterparts. I was curious if there was some way to "trick" access into thinking the expression is smaller with sub queries, or if someone else had a better idea of how to solve this problem. I thought about making a temporary table and doing a join on it, but that's not supported in Access SQL. Just as an FYI, the query worked fine until I added the big long IFF chain. I tested the query on a smaller IFF chain for three languages, and that wasn't an issue, so the problem definitely stems from the huge IFF chain (It's 26 deep). Also, I might be able to drop some of the options (like combining the different forms of Chinese or Portuguese) As a test, I was able to get the SQL query to work after paring it down to 14 IFF() statements, but that's a far cry from the 26 languages I'd like to represent. SELECT TOP 5 Count( * ) AS [Number of visits by language], IIf(login.lang="ar","Arabic",IIf(login.lang="bg","Bulgarian",IIf(login.lang="zh_CN","Chinese (Simplified Han)",IIf(login.lang="zh_TW","Chinese (Traditional Han)",IIf(login.lang="cs","Czech",IIf(login.lang="da","Danish",IIf(login.lang="de","German",IIf(login.lang="en_US","United States English",IIf(login.lang="en_GB","British English",IIf(login.lang="es","Spanish",IIf(login.lang="fr","French",IIf(login.lang="el","Greek",IIf(login.lang="it","Italian",IIf(login.lang="ko","Korean",IIf(login.lang="hu","Hungarian",IIf(login.lang="nl","Dutch",IIf(login.lang="pl","Polish",IIf(login.lang="pt_PT","European Portuguese",IIf(login.lang="pt_BR","Brazilian Portuguese",IIf(login.lang="ru","Russian",IIf(login.lang="sk","Slovak",IIf(login.lang="sl","Slovenian","IIf(login.lang="fi","Finnish",IIf(login.lang="sv","Swedish",IIf(login.lang="tr","Turkish","Unknown")))))))))))))))))))))))))) AS [Language] FROM login, reservations, reservation_users, schedules WHERE (reservations.start_date Between DATEDIFF('s','1970-01-01 00:00:00',[Starting Date in the Following Format YYYY/MM/DD]) And DATEDIFF('s','1970-01-01 00:00:00',[Ending Date in the Following Format YYYY/MM/DD])) And reservations.is_blackout=0 And reservation_users.memberid=login.memberid And reservation_users.resid=reservations.resid And reservation_users.invited=0 And reservations.scheduleid=schedules.scheduleid And scheduletitle=[Schedule Title] GROUP BY login.lang ORDER BY Count( * ) DESC; @ Michael Todd I completely agree. The list of languages should have been a table in the database and the login.lang should have been a FK into that table. Unfortunately this isn't how the database was written, and it's not really mine to modify. The languages are placed into the login.lang field by the PHP running on top of the database.

    Read the article

  • Can't start rails server after 3.0.1 upgrade

    - by Alberto
    Followed instructions on Railscast but can't get server to start. It states the following error: $ rails s script/rails:6:in `require': no such file to load -- rails/commands (LoadError)` from script/rails:6:in `<main>' Saw the answer on this related question but my Gemfile has no reference to any rails 2.x version and in the "bundle install" results i get this in the results: "Using rails (3.0.1)" EDIT: (adding Gemfile.lock details) GEM remote: http://rubygems.org/ specs: abstract (1.0.0) actionmailer (3.0.1) actionpack (= 3.0.1) mail (~> 2.2.5) actionpack (3.0.1) activemodel (= 3.0.1) activesupport (= 3.0.1) builder (~> 2.1.2) erubis (~> 2.6.6) i18n (~> 0.4.1) rack (~> 1.2.1) rack-mount (~> 0.6.12) rack-test (~> 0.5.4) tzinfo (~> 0.3.23) activemodel (3.0.1) activesupport (= 3.0.1) builder (~> 2.1.2) i18n (~> 0.4.1) activerecord (3.0.1) activemodel (= 3.0.1) activesupport (= 3.0.1) arel (~> 1.0.0) tzinfo (~> 0.3.23) activeresource (3.0.1) activemodel (= 3.0.1) activesupport (= 3.0.1) activesupport (3.0.1) arel (1.0.1) activesupport (~> 3.0.0) builder (2.1.2) calendar_date_select (1.16.1) erubis (2.6.6) abstract (>= 1.0.0) googlecharts (1.6.0) i18n (0.4.2) mail (2.2.9) activesupport (>= 2.3.6) i18n (~> 0.4.1) mime-types (~> 1.16) treetop (~> 1.4.8) mechanize (1.0.0) nokogiri (>= 1.2.1) mime-types (1.16) nokogiri (1.4.3.1) pg (0.9.0) polyglot (0.3.1) rack (1.2.1) rack-mount (0.6.13) rack (>= 1.0.0) rack-test (0.5.6) rack (>= 1.0) rails (3.0.1) actionmailer (= 3.0.1) actionpack (= 3.0.1) activerecord (= 3.0.1) activeresource (= 3.0.1) activesupport (= 3.0.1) bundler (~> 1.0.0) railties (= 3.0.1) railties (3.0.1) actionpack (= 3.0.1) activesupport (= 3.0.1) rake (>= 0.8.4) thor (~> 0.14.0) rake (0.8.7) sparklines (0.5.2) thor (0.14.4) treetop (1.4.8) polyglot (>= 0.3.1) tzinfo (0.3.23) PLATFORMS ruby DEPENDENCIES calendar_date_select googlecharts mechanize pg rails (= 3.0.1) sparklines EDIT: (adding Boot.rb details) require 'rubygems' # Set up gems listed in the Gemfile. gemfile = File.expand_path('../../Gemfile', __FILE__) begin ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup rescue Bundler::GemNotFound => e STDERR.puts e.message STDERR.puts "Try running `bundle install`." exit! end if File.exist?(gemfile)

    Read the article

  • Question SpeechSynthesizer.SetOutputToAudioStream audio format problem

    - by Chris Kugler
    Hi, I'm currently working on an application which requires transmission of speech encoded to a specific audio format. System.Speech.AudioFormat.SpeechAudioFormatInfo synthFormat = new System.Speech.AudioFormat.SpeechAudioFormatInfo(System.Speech.AudioFormat.EncodingFormat.Pcm, 8000, 16, 1, 16000, 2, null); This states that the audio is in PCM format, 8000 samples per second, 16 bits per sample, mono, 16000 average bytes per second, block alignment of 2. When I attempt to execute the following code there is nothing written to my MemoryStream instance; however when I change from 8000 samples per second up to 11025 the audio data is written successfully. SpeechSynthesizer synthesizer = new SpeechSynthesizer(); waveStream = new MemoryStream(); PromptBuilder pbuilder = new PromptBuilder(); PromptStyle pStyle = new PromptStyle(); pStyle.Emphasis = PromptEmphasis.None; pStyle.Rate = PromptRate.Fast; pStyle.Volume = PromptVolume.ExtraLoud; pbuilder.StartStyle(pStyle); pbuilder.StartParagraph(); pbuilder.StartVoice(VoiceGender.Male, VoiceAge.Teen, 2); pbuilder.StartSentence(); pbuilder.AppendText("This is some text."); pbuilder.EndSentence(); pbuilder.EndVoice(); pbuilder.EndParagraph(); pbuilder.EndStyle(); synthesizer.SetOutputToAudioStream(waveStream, synthFormat); synthesizer.Speak(pbuilder); synthesizer.SetOutputToNull(); There are no exceptions or errors recorded when using a sample rate of 8000 and I couldn't find anything useful in the documentation regarding SetOutputToAudioStream and why it succeeds at 11025 samples per second and not 8000. I have a workaround involving a wav file that I generated and converted to the correct sample rate using some sound editing tools, but I would like to generate the audio from within the application if I can. One particular point of interest was that the SpeechRecognitionEngine accepts that audio format and successfully recognized the speech in my synthesized wave file... Update: Recently discovered that this audio format succeeds for certain installed voices, but fails for others. It fails specifically for LH Michael and LH Michelle, and failure varies for certain voice settings defined in the PromptBuilder.

    Read the article

  • How to catch 'exceptions' for out of order execution in Workflow Foundation 4?

    - by Alex Key
    Hi, I am attempting to model a worklfow using a "WCF Workflow Service" in .net / vs 2010 that needs to handle out of order execution gracefully (but not allow it - if thath makes sense!?) For example I have 2 receive activities one called Initialize and the other called GetValue inside a FlowChart. In most cases Initialize should be called first and GetValue after (as modled in the flow chart). However if GetValue is executed before Initialize I do not want to return an "out of order" exception (although when I look at the WCF test client, I can't actually see an exception). But instead a custom exception saying something like "you must initialize first". In theory I could model this with lots of parallel activities and conditions to check if Initialized / Running / Terminated etc. But the business process I am modelling if very very similar to a state machine... except it must handle people executing things in the wrong order. Ideally I would like to catch the "out of order" exception (thought I don't think it's really an exception as such), check the 'exception' to see which function was attempted to run and then handle it. I have done some research around enabling AllowBufferedReceive. However I don't want to be able to execute out of order (I don't think), but instead give a detailed response if it does happen. I've looked at the new beta state machine template for WF 4 - but i'm not sure if it does what i'm after? I'm not sure if I have the wrong end of the stick, so any help would be greatly appreciated. [EDIT] To help clarify... Sorry it's a tricky one to explain. The standard I am trying to implement (the e-learning standard SCORM RTE) is structured like a state machine i.e. certain functions can only be executed in certain states. However the standard specifies that if the calling clients tries to execute a function that it is not meant to, then a warning should be issued... for example "you cannot use GetValue(), because you have not yet Initialized". Ideally I'd like to structure the workflow as the theoretical state machine and not need to have to use multiple if/else's to handle all the scenarios where something could be executed out-of-order. I'd like to catch a out-of-order exception (but I don't think there is such an exception - as it's not in the debugger) and rethrow it.

    Read the article

  • generated service mock: everything but RhinoMocks fails?

    - by hko
    I have the "quest" to search for the next Mocking Framework for my company, and basically it's down to NSubstitute (simplest syntax, but no strict mocks), FakeItEasy(best reviews, Roy Osherove bonus, and slightly better lib support than NSubstitute), Moq (best "other libs support", biggest featureset, downside: mock.Object). We definitely want to move on from RhinoMocks, e.g. because of the unusefull interactiontest error messages (it should tell me what the parameter was instead, when a verification fails). So I was pretty surprised the other day (that was yesterday) when I found out RhinoMocks could do a thing where every other mock framework fails at: Mocking an autogenerated SomethingService (a typical VS autogenerated service with a default construtor in a partial class). Please don't argue about the design.. I intend to write lightweight integration tests (and some unit tests), and I can't mess around with the service, the product is installed on too many customers system. See this code: // here the NSubstitute and FakeItEasy equivalents throw an exception.. see below TicketStoreService fakeTicketStoreService = MockRepository.GenerateMock<TicketStoreService>(); fakeTicketStoreService.Expect(service => service.DoSomething(Arg.Is(new Guid())).Return(new Guid()); fakeTicketStoreService.DoSomething(Arg.Is(new Guid())); fakeTicketStoreService.VerifyAllExpectations(); Note that DoSomething is a non-virtual methodcall in an autogenerated class. So it shouldn't work, according to common knowledge. But it does. Problem is that it's the only (non commercial) framework that can do this: Rhino.Mocks works, and verification works too FakeItEasy says it doesn't find a default constructor (probably just wrong exception message): No default constructor was found on the type SomeNamespace.TicketStoreService Moq gives something sane and understandable: Invalid setup on a non-virtual (overridable in VB) member: service=> service.DoSomething Nsubstitute gives a message System.NotSupportedException: Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface. I'm really wondering what's going on here with the frameworks, except Moq. The "fancy new" frameworks seem to have an initial perf hit too, probably preparing some Type cache and serializing stuff, whilst RhinoMocks somehow manages to create a very "slim" mock without recursion. I have to admit I didn't like RhinoMocks very well, but here it shines.. unfortunately. So, is there a way to get that to work with newer (non-commercial!) mocking frameworks, or somehow get a sane error message out of Rhino.Mocks? And why can Rhino.Mocks achieve this, when clearly every Mocking framework states it can only work with virtual methods when given a concrete class? Let's not derail the discussion by talking about alternative approaches like Extract&Override or runtime-proxy Mocking frameworks like JustMock/TypeMock/Moles or the new Fakes framework, I know these, but that would be less ideal solutions, for reasons beyond this topic. Any help appreciated..

    Read the article

  • JavaCC: How can one exclude a string from a token? (A.k.a. understanding token ambiguity.)

    - by java.is.for.desktop
    Hello, everyone! I had already many problems with understanding, how ambiguous tokens can be handled elegantly (or somehow at all) in JavaCC. Let's take this example: I want to parse XML processing instruction. The format is: "<?" <target> <data> "?>": target is an XML name, data can be anything except ?>, because it's the closing tag. So, lets define this in JavaCC: (I use lexical states, in this case DEFAULT and PROC_INST) TOKEN : <#NAME : (very-long-definition-from-xml-1.1-goes-here) > TOKEN : <WSS : (" " | "\t")+ > // WSS = whitespaces <DEFAULT> TOKEN : {<PI_START : "<?" > : PROC_INST} <PROC_INST> TOKEN : {<PI_TARGET : <NAME> >} <PROC_INST> TOKEN : {<PI_DATA : ~[] >} // accept everything <PROC_INST> TOKEN : {<PI_END : "?>" > : DEFAULT} Now the part which recognizes processing instructions: void PROC_INSTR() : {} { ( <PI_START> (t=<PI_TARGET>){System.out.println("target: " + t.image);} <WSS> (t=<PI_DATA>){System.out.println("data: " + t.image);} <PI_END> ) {} } Let's test it with <?mytarget here-goes-some-data?>: The target is recognized: "target: mytarget". But now I get my favorite JavaCC parsing error: !! procinstparser.ParseException: Encountered "" at line 1, column 15. !! Was expecting one of: !! Encountered nothing? Was expecting nothing? Or what? Thank you, JavaCC! I know, that I could use the MORE keyword of JavaCC, but this would give me the whole processing instruction as one token, so I'd had to parse/tokenize it further by myself. Why should I do that? Am I writing a parser that does not parse? The problem is (i guess): hence <PI_DATA> recognizes "everything", my definition is wrong. I should tell JavaCC to recognize "everything except ?>" as processing instruction data. But how can it be done? NOTE: I can only exclude single characters using ~["a"|"b"|"c"], I can't exclude strings such as ~["abc"] or ~["?>"]. Another great anti-feature of JavaCC. Thank you.

    Read the article

  • Netsuite - how to specify record_type for getall request

    - by Dvporg
    I want to get a list of all InventoryItems According to this document: https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/getAll.html I'm forming the following request: <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:platform_2013_1.webservices.netsuite.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header> <passport> <email>******</email> <password>******</password> <account>******</account> </passport> </env:Header> <env:Body> <platformMsgs:getAll> <recordType>InventoryItem</recordType> </platformMsgs:getAll> </env:Body> </env:Envelope> But receiving response with the error: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2013_1.platform.webservices.netsuite.com"> <platformMsgs:nsId>WEBSERVICES_969904_100920131651936419141601801_cbf1690968b43</platformMsgs:nsId> </platformMsgs:documentInfo> </soapenv:Header> <soapenv:Body> <getAllResponse xmlns="urn:platform_2013_1.webservices.netsuite.com"> <platformCore:getAllResult xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com"> <platformCore:status isSuccess="false"> <platformCore:statusDetail type="ERROR"> <platformCore:code>GETALL_RCRD_TYPE_REQD</platformCore:code> <platformCore:message>The getAll record type is required.</platformCore:message> </platformCore:statusDetail> </platformCore:status> </platformCore:getAllResult> </getAllResponse> </soapenv:Body> </soapenv:Envelope> I've tried to request currencies, states - the response always the same I've tried following variants: <GetAllRecordType>inventoryItem</GetAllRecordType> and <recordType>inventoryItem</recordType> and <GetAllRecordType>currency</GetAllRecordType> and <recordType>currency</recordType> with the same response: <platformCore:message>The getAll record type is required.</platformCore:message> According to https://webservices.netsuite.com/xsd/platform/v2013_2_0/coreTypes.xsd - I've specified correctly recordType (btw I've also tried without any success) I'm using ruby and there is no complete library for ruby. The one that is exists doesn't contain almost all things I'm going to use. Can someone help me what I'm doing wrong or may be someone have working example

    Read the article

  • Inserting contact with android and querying the result uri returns no entries

    - by th0m4d
    Im developing an application which is dealing with the android contacts API. I implemented methods to insert, update and query contacts. So far everything worked (writing and reading contacts). At one point in my project Im experiencing a strange behaviour. I insert a contact using batch mode. I receive the URI to the RawContact. I do this in a background thread. // use batchmode for contact insertion ArrayList ops = new ArrayList(); int rawContactInsertIndex = ops.size(); // create rawContact ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI) .withValue(RawContacts.ACCOUNT_TYPE, ConstantsContract.ACCOUNT_TYPE) .withValue(RawContacts.ACCOUNT_NAME, accountName).build()); ops.add(createInsertOperation().withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) .withValue(StructuredName.DISPLAY_NAME, displayName).withValue(StructuredName.GIVEN_NAME, firstName) .withValue(StructuredName.FAMILY_NAME, lastName).build()); //other data values... ContentProviderResult[] results = context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); if (results.length 0) { result = results[0]; } Then i request and store the lookup uri RawContacts.getContactLookupUri(this.getContentResolver(), myContantRawContactUri); I am able to query the contact using the rawContactUri directly after inserting it (in the same thread). The lookup uri returns null. Uri rawContactUri = appUser.getRawContactUri(ctx); if (rawContactUri == null) { return null; } String lastPathSegment = rawContactUri.getLastPathSegment(); long rawContactId = Long.decode(lastPathSegment); if (rawContactUri != null) { contact = readContactWithID(rawContactId, ContactsContract.Data.RAW_CONTACT_ID); In a different place in the project I want to query the contact i inserted by the stored lookup uri or raw contact uri. Both return no rows from the content provider. I tried it in the main thread and in another background thread. ctx.getContentResolver().query(ContactsContract.Data.CONTENT_URI, null, ContactsContract.Data.RAW_CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ?", new String[] { contactID + "", ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE }, null); My first thought was that it could be related to the context.getContentResolver(). But the android documentation states, that the ContentResolver objects scope is the application's package, so you have on ContentResolver for the whole app. Am I right? What am I doing wrong? Why does the same rawContactUri return the contact at one place and does not on another place? And why do I get a lookup uri from a raw contact, which is not working at all?

    Read the article

  • log4net initialisation

    - by Ruben Bartelink
    I've looked hard for duplicates but have to ask the following, no matter how basic it may seem, to get it clear once and for all! In a fresh Console app using log4net version 1.2.10.0 on VS28KSP1 on 64 bit W7, I have the following code:- using log4net; using log4net.Config; namespace ConsoleApplication1 { class Program { static readonly ILog _log = LogManager.GetLogger(typeof(Program)); static void Main(string[] args) { _log.Info("Ran"); } } } In my app.config, I have: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="Program.log" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="1MB" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="[%username] %date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="RollingFileAppender" /> </root> </log4net> </configuration> This doesnt write anything, unless I either add an attribute: [ assembly:XmlConfigurator ] Or explicitly initialise it in Main(): _log.Info("This will not go to the log"); XmlConfigurator.Configure(); _log.Info("Ran"); This raises the following questions: I'm almost certain I've seen it working somewhere on some version of log4net without the addition of the assembly attribute or call in Main. Can someone assure me I'm not imagining that? Can someone please point me to where in the doc it explicitly states that both the config section and the initialisation hook are required - hopefully with an explanation of when this changed, if it did? I can easily imagine why this might be the policy -- having the initialisation step explicit to avoid surprises etc., it's just that I seem to recall this not always being the case... (And normally I have the config in a separate file, which generally takes configsections out of the picture)

    Read the article

  • General ORM design question

    - by Calvin
    Suppose you have 2 classes, Person and Rabbit. A person can do a number of things to a rabbit, s/he can either feed it, buy it and become its owner, or give it away. A rabbit can have none or at most 1 owner at a time. And if it is not fed for a while, it may die. Class Person { Void Feed(Rabbit r); Void Buy(Rabbit r); Void Giveaway(Person p, Rabbit r); Rabbit[] rabbits; } Class Rabbit { Bool IsAlive(); Person pwner; } There are a couple of observations from the domain model: Person and Rabbit can have references to each other Any actions on 1 object can also change the state of the other object Even if no explicit actions are invoked, there can still be a change of state in the objects (e.g. Rabbit can be starved to death, and that causes it to be removed from the Person.rabbits array) As DDD is concerned, I think the correct approach is to synchronize all calls that may change the states in the domain model. For instance, if a Person buys a Rabbit, s/he would need to acquire a lock in Person to make a change to the rabbits array AND also another lock in Rabbit to change its owner before releasing the first one. This would prevent a race condition where 2 Persons claim to be the owner of the little Rabbit. The other approach is to let the database to handle all these synchronizations. Who makes the first call wins, but then the DB needs to have some kind of business logics to figure out if it is a valid transaction (e.g. if a Rabbit already has an owner, it cannot change its owner unless the Person gives it away). There are both pros/cons in either approach, and I’d expect the “best” solution would be somewhere in-between. How would you do it in real life? What’s your take and experience? Also, is it a valid concern that there can be another race condition the domain model has committed its change but before it is fully committed in the database? And for the 3rd observation (i.e. state change due to time factor). How will you do it?

    Read the article

  • Points in CSS specificity

    - by Sam
    Researching specificity I stumbled upon this blog - http://www.htmldog.com/guides/cssadvanced/specificity/ It states that specificity is a point-scoring system for CSS. It tells us that elements are worth 1 point, classes are worth 10 points and IDs are worth 100 points. It also goes on top say that these points are totaled and the overall amount is that selector's specificity. For example: body = 1 point body .wrapper = 11 points body .wrapper #container = 111 points So, using these points surely the following CSS and HTML will result in the text being blue: CSS: #a { color: red; } .a .b .c .d .e .f .g .h .i .j .k .l .m .n .o { color: blue; } HTML: <div class="a"> <div class="b"> <div class="c"> <div class="d"> <div class="e"> <div class="f"> <div class="g"> <div class="h"> <div class="i"> <div class="j"> <div class="k"> <div class="l"> <div class="m"> <div class="n"> <div class="o" id="a"> This should be blue. </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> RESULT: http://jsfiddle.net/hkqCF/ Why is the text red when 15 classes would equal 150 points compared to 1 ID which equals 100 points?

    Read the article

  • closing MQ connection

    - by OakvilleWork
    Good afternoon, I wrote a project to Get Park Queue Info from the IBM MQ, it has producing an error when attempting to close the connection though. It is written in java. Under application in Event Viewer on the MQ machine it displays two errors. They are: “Channel program ended abnormally. Channel program ‘system.def.surconn’ ended abnormally. Look at previous error messages for channel program ‘system.def.surconn’ in the error files to determine the cause of the failure. The other message states: “Error on receive from host rnanaj (10.10.12.34) An error occurred receiving data from rnanaj (10.10.12.34) over tcp/ip. This may be due to a communications failure. The return code from tcp/ip recv() call was 10054 (X’2746’). Record these values.” This must be something how I try to connect or close the connection, below I have my code to connect and close, any ideas?? Connect: _logger.info("Start"); File outputFile = new File(System.getProperty("PROJECT_HOME"), "run/" + this.getClass().getSimpleName() + "." + System.getProperty("qmgr") + ".txt"); FileUtils.mkdirs(outputFile.getParentFile()); Connection jmsConn = null; Session jmsSession = null; QueueBrowser queueBrowser = null; BufferedWriter commandsBw = null; try { // get queue connection MQConnectionFactory MQConn = new MQConnectionFactory(); MQConn.setHostName(System.getProperty("host")); MQConn.setPort(Integer.valueOf(System.getProperty("port"))); MQConn.setQueueManager(System.getProperty("qmgr")); MQConn.setChannel("SYSTEM.DEF.SVRCONN"); MQConn.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP); jmsConn = (Connection) MQConn.createConnection(); jmsSession = jmsConn.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue jmsQueue = jmsSession.createQueue("PARK"); // browse thru messages queueBrowser = jmsSession.createBrowser(jmsQueue); Enumeration msgEnum = queueBrowser.getEnumeration(); commandsBw = new BufferedWriter(new FileWriter(outputFile)); // String line = "DateTime\tMsgID\tOrigMsgID\tCorrelationID\tComputerName\tSubsystem\tDispatcherName\tProcessor\tJobID\tErrorMsg"; commandsBw.write(line); commandsBw.newLine(); while (msgEnum.hasMoreElements()) { Message message = (Message) msgEnum.nextElement(); line = dateFormatter.format(new Date(message.getJMSTimestamp())) + "\t" + message.getJMSMessageID() + "\t" + message.getStringProperty("pkd_orig_jms_msg_id") + "\t" + message.getJMSCorrelationID() + "\t" + message.getStringProperty("pkd_computer_name") + "\t" + message.getStringProperty("pkd_subsystem") + "\t" + message.getStringProperty("pkd_dispatcher_name") + "\t" + message.getStringProperty("pkd_processor") + "\t" + message.getStringProperty("pkd_job_id") + "\t" + message.getStringProperty("pkd_sysex_msg"); _logger.info(line); commandsBw.write(line); commandsBw.newLine(); } } Close: finally { IO.close(commandsBw); if (queueBrowser != null) { try { queueBrowser.close();} catch (Exception ignore) {}} if (jmsSession != null) { try { jmsSession.close();} catch (Exception ignore) {}} if (jmsConn != null) { try { jmsConn.stop();} catch (Exception ignore) {}} }

    Read the article

  • Maven2 not compiling source

    - by Grep
    Hi, I am new to Maven2 and have been having an issue with the compiling of the source for a RAR. Maven currently copies all the information located at my sourceDirectory instead of compiling it even though the console states that the source is being compiled. If I navigate to the sourceDirectory I find all my source files with no compiled class files. I have tried changing my outputDirectory to a different location and when I inspect this directory I find that it only copied my source files instead of compiling them. I have added an example of my POM. Any advice would be appreciated and please keep in mind I have only started learning/implementing Maven2 yesterday :) <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>MyApp</artifactId> <groupId>.</groupId> <version>4</version> <packaging>rar</packaging> <name>MyApp rar</name> <build> <directory>target\${artifactId}-${version}</directory> <resources> <resource> <directory>..\gen-src</directory> <excludes> <exclude>util.jar</exclude> </excludes> </resource> <resource> <directory>..\domain</directory> </resource> </resources> <sourceDirectory>target\${artifactId}-${version}</sourceDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-rar-plugin</artifactId> <configuration> <workDirectory>target\${artifactId}-${version}\classes</workDirectory> <outputDirectory>target</outputDirectory> <finalName>MyApp${version}</finalName> <raXmlFile>${workDirectory}\META-INF\ra.xml</raXmlFile> </configuration> </plugin> </plugins> </build> </project>

    Read the article

  • Can i store a Queue in viewstate? only will store the first item i add to queue

    - by Mausimo
    Hey, as the question states i am trying to store a Queue in a viewstate (to track postbacks and refreshes to stop a form from resubmitting). Here is just the viewstate code: private Queue<string> p_tempQue { set { ViewState["sTemp"] = value; } get { return (Queue<string>)ViewState["sTemp"]; } } //BasePage constructor public BasePage() { //create a Queue of string //sTemp = new Queue(); this.Load += new EventHandler(this.Page_Load); this.Init += new EventHandler(this.Page_Init); } //In the 'page_Init' event we have created a simple hidden field by name 'hdnGuid' which is attached to the page on the first hit itself. protected void Page_Init(object sender, EventArgs e) { //initializing the hidden field //create a hidden field with a ID HiddenField hdnGuid = new HiddenField(); hdnGuid.ID = "hdnGuid"; //if it is the first time the page is loaded, create a new guid and assign it as the hidden field value if (!Page.IsPostBack) hdnGuid.Value = Guid.NewGuid().ToString(); //add the hidden field to the page Page.Form.Controls.Add(hdnGuid); } //In the 'page_Load' event we check if the hidden field value is same as the old value. In case the value is not same that means it's a 'postback' //and if the value is same then its 'refresh'. As per situation we set the 'httpContent.Items["Refresh"]' value. protected void Page_Load(object sender, EventArgs e) { if(p_tempQue != null) sTemp = p_tempQue; else sTemp = new Queue<string>(); //The hdnGuid will be set the first time page is loaded, else the hdnGuid //will be set after each time the form is submitted using javascript. //assign the hidden field currently on the page for manipulation HiddenField h1 = (HiddenField)(Page.Form.FindControl("hdnGuid")); //create an instance of the GuidClass GuidClass currentGuid = new GuidClass(); //set the GuidClass Guid property to the value of the hidden field currentGuid.Guid = h1.Value; //check to see if the Queue of strings contains the string which is the current Guid property of the GuidClass //if the are equal, then the page was refreshed if (sTemp.Contains<string>(currentGuid.Guid)) { //adds item as key/value pair to share data between an System.Web.IHttpModule interface and an System.Web.IHttpHandler interface during an HTTP request. System.Web.HttpContext.Current.Items.Add("IsRefresh", true); } //if they are not requal, the page is not refreshed else { //if the current Guid property in the GuidClass is not null or not an empty string //add the new Guid to the Queue if (!(currentGuid.Guid.Equals(null) || currentGuid.Guid.Equals(""))) sTemp.Enqueue(currentGuid.Guid); System.Web.HttpContext.Current.Items.Add("IsRefresh", false); } p_tempQue = sTemp; }

    Read the article

  • MVC validation error with strongly typed view

    - by Remnant
    I have a simple form that I would like to validate on form submission. Note I have stripped out the html for ease of viewing <%=Html.TextBox("LastName", "")%> //Lastname entry <%=Html.ValidationMessage("LastName")%> <%=Html.TextBox("FirstName", "")%>//Firstname entry <%=Html.ValidationMessage("FirstName")%> <%=Html.DropDownList("JobRole", Model.JobRoleList)%> //Dropdownlist of job roles <% foreach (var record in Model.Courses) // Checkboxes of different courses for user to select { %> <li><label><input type="checkbox" name="Courses" value="<%=record.CourseName%>" /><%= record.CourseName%></label></li> <% } %> On submission of this form I would like to check that both FirstName and LastName are populated (i.e. non-zero length). In my controller I have: public ActionResult Submit(string FirstName, string LastName) { if (FirstName.Trim().Length == 0) ModelState.AddModelError("FirstName", "You must enter a first name"); if (LastName.Trim().Length == 0) ModelState.AddModelError("LastName", "You must enter a first name"); if (ModelState.IsValid) { //Update database + redirect to action } return View(); //If ModelState not valid, return to View and show error messages } Unfortunately, this code logic produces an error that states that no objects are found for JobRole and Courses. If I remove the dropdownlist and checkboxes then all works fine. The issue appears to be that when I return the View the view is expecting objects for the dropwdownlist and checkboxes (which is sensible as that is what is in my View code) How can I overcome this problem? Things I have considered: In my controller I could create a JobRoleList object and Course object to pass to the View so that it has the objects to render. The issue with this is that it will overwrite any dropdownlist / checkbox selections that the user has already made. In the parameters of my controller method Submit I could aslo capture the JobRoleList object and Course object to pass back to the View. Again, not sure this would capture any items the user has already selected. I have done much googling and reading but I cannot find a good answer. When I look at examples in books or online (e.g. Nerddinner) all the validation examples involve simple forms with TextBox inputs and don't seems to show instances with multiple checkboxes and dropdownlists. Have I missed something obvious here? What would be best practice in this situation? Thanks

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >