Search Results

Search found 2008 results on 81 pages for 'greg smith'.

Page 51/81 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • How to display combo box as textbox in WPF via a style template trigger?

    - by Greg R
    I would like to display a combobox drop down list as a textbox when it's set to be read only. For some reason I can't seem to bind the text of the selected item in the combo box to the textbox. This is my XAML: <Style x:Key="EditableDropDown" TargetType="ComboBox"> <Style.Triggers> <Trigger Property="IsReadOnly" Value="True"> <Setter Property="Background" Value="#FFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ComboBox"> <TextBox Text="{TemplateBinding SelectedItem, Converter={StaticResource StringCaseConverter}}" BorderThickness="0" Background="Transparent" FontSize="{TemplateBinding FontSize}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" FontFamily="{TemplateBinding FontFamily}" Width="{TemplateBinding Width}" TextWrapping="Wrap"/> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> <ComboBox IsReadOnly="{Binding ReadOnlyMode}" Style="{StaticResource EditableDropDown}" Margin="0 0 10 0"> <ComboBoxItem IsSelected="True">Test</ComboBoxItem> </ComboBox> When I do this, I get the following as the text: System.Windows.Controls.ComboBoxItem: Test I would really appreciate the help!

    Read the article

  • Run a form in another thread

    - by Smith
    i have five forms in my c# project. one host an httplistener that i want to run continionsly. when the listener gets a message, it passes it to a static class, which in turn calls the appropriate forms for another processing. is it possible that the static class calls the new form in a new thread? if so please help me out

    Read the article

  • CSS Only Selecting Certain Classes

    - by Greg
    Hi I'm working with a Wordpress template. I have a separate template page for the blog section. On the other pages of the site I have class that works fine and looks like this .post header h2 { display:none; } On the blog page, I add this to the CSS and it works as it should #main .post header h2 { display:block; } However if I try that with other classes like #main .wrapper { background-color:#000000; } Nothing happens. I've tried adding !important, I've also tried writing like such body.page-id-15 #main .wrapper { background-color:#000000; } with no luck. Here is a link to the site. http://gregtregunno.ca/news

    Read the article

  • Best way to use PL/SQL Pacakge Cursors from Pro*C

    - by Greg Reynolds
    I have a cursor defined in PL/SQL, and I am wondering what the best way to use it from Pro*C is. Normally for a cursor defined in Pro*C you would do: EXEC SQL DECLARE curs CURSOR FOR SELECT 1 FROM DUAL; EXEC SQL OPEN curs; EXEC SQL FETCH curs INTO :foo; EXEC SQL CLOSE cusr; I was hoping that the same (or similar) syntax would work for a packaged cursor. For example, I have a package MyPack, with a declaration type MyType is record (X integer); cursor MyCurs(x in integer) return MyType; Now I have in my Pro*C code a rather unsatisfying piece of embedded PL/SQL that opens the cursor, does the fetching etc., as I couldn't get the first style of syntax to work. Using the example EXEC SQL EXECUTE DECLARE XTable is table of MyPack.MyType; BEGIN OPEN MyPack.MyCurs(:param); FETCH MyPack.MyCurs INTO XTable; CLOSE MyPack.MyCurs; END; END-EXEC; Does anyone know if there is a more "Pure" Pro*C approach?

    Read the article

  • Month to Date in SQL Server 2008

    - by Aaron Smith
    Hopefully this will be an easy one to answer. I am working on a table that requires MTD data. One of our SQL guys told me to use MONTH (@monthtodate)= 11 Where @monthtodate is set to GetDate() in the parameter list in SQL Server Management Studio. So in "theory", he says, it should select the month (11) and then get today and return all the requested data in between those two dates. But I'm thinking this isn't correct. In looking at my data I'm starting to think that It's just returning data for the whole month of November instead of just MTD. I guess, technically, anything that has 0 won't be calculated. However that just means it's poorly written code correct? In your opinions, would this be the better way to return MTD data: production_date <= @today and Production_Date >= DATEADD(mm, DATEDIFF(mm, 0, @today), 0) Thanks in advance everyone!

    Read the article

  • Django finding which field matched in a multiple OR query

    - by Greg Hinch
    I've got a couple models which are set up something like this: class Bar(models.Model): baz = models.CharField() class Foo(models.Model): bar1 = models.ForeignKey(Bar) bar2 = models.ForeignKey(Bar) bar3 = models.ForeignKey(Bar) And elsewhere in the code, I end up with an instance of Bar, and need to find the Foo it is attached to in some capacity. Right now I came up with doing a multiple OR query using Q, something like this: foo_inst = Foo.objects.get(Q(bar1=bar_inst) | Q(bar2=bar_inst) | Q(bar3=bar_inst)) What I need to figure out is, which of the 3 cases actually hit, at least the name of the member (bar1, bar2, or bar3). Is there a good way to do this? Is there a better way to structure the query to glean that information?

    Read the article

  • What's wrong with this jQuery? It isn't working as intended

    - by Doug Smith
    Using cookies, I want it to remember the colour layout of the page. (So, if they set the gallery one color and the body background another color, it will save that on refresh. But it doesn't seem to be working. jQuery: $(document).ready(function() { if (verifier == 1) { $('body').css('background', $.cookie('test_cookie')); } if (verifier == 2) { $('#gallery').css('background', $.cookie('test_cookie')); } if (verifier == 3) { $('body').css('background', $.cookie('test_cookie')); $('#gallery').css('background', $.cookie('test_cookie')); } $('#set_cookie').click(function() { var color = $('#set_cookie').val(); $.cookie('test_cookie', color); }); $('#set_page').click(function() { $('body').css('background', $.cookie('test_cookie')); var verifier = 1; }); $('#set_gallery').click(function() { $('#gallery').css('background', $.cookie('test_cookie')); var verifier = 2; }); $('#set_both').click(function() { $('body').css('background', $.cookie('test_cookie')); $('#gallery').css('background', $.cookie('test_cookie')); var verifier = 3; }); }); HTML: <p>Please select a background color for either the page's background, the gallery's background, or both.</p> <select id="set_cookie"> <option value="#1d375a" selected="selected">Default</option> <option value="black">Black</option> <option value="blue">Blue</option> <option value="brown">Brown</option> <option value="darkblue">Dark Blue</option> <option value="darkgreen">Dark Green</option> <option value="darkred">Dark Red</option> <option value="fuchsia">Fuchsia</option> <option value="green">Green</option> <option value="grey">Grey</option> <option value="#d3d3d3">Light Grey</option> <option value="#32cd32">Lime Green</option> <option value="#f8b040">Macaroni</option> <option value="#ff7300">Orange</option> <option value="pink">Pink</option> <option value="purple">Purple</option> <option value="red">Red</option> <option value="#0fcce0">Turquoise</option> <option value="white">White</option> <option value="yellow">Yellow</option> </select> <input type="button" id="set_page" value="Page's Background" /><input type="button" id="set_gallery" value="Gallery's Background" /><input type="button" id="set_both" value="Both" /> </div> </div> </body> </html> Thanks so much for the help, I appreciate it. jsFiddle: http://jsfiddle.net/hL6Ye/

    Read the article

  • How can I save a directory tree to an array in PHP?

    - by Greg
    I'm trying to take a directory with the structure: top folder1 file1 folder2 file1 file2 And save it into an array like: array ( 'folder1' => array('file1'), 'folder2' => array('file1', 'file2') ) This way, I can easily resuse the tree throughout my site. I've been playing around with this code but it's still not doing what I want: private function get_tree() { $uploads = __RELPATH__ . DS . 'public' . DS . 'uploads'; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($uploads), RecursiveIteratorIterator::SELF_FIRST); $output = array(); foreach($iterator as $file) { $relativePath = str_replace($uploads . DS, '', $file); if ($file->isDir()) { if (!in_array($relativePath, $output)) $output[$relativePath] = array(); } } return $output; }

    Read the article

  • Making a jQuery selection in IE on html added via .load()

    - by Joel Crawford-Smith
    Scenario: I am using jQuery to lazy load some html and change the relative href attributes of all the anchors to absolute links. The loading function adds the html in all browsers. The url rewrite function works on the original DOM in all browsers. But In IE7, IE8 I can't run that same function on the new lazy loaded html in the DOM. //lazy load a part of a file $(document).ready(function() { $('#tab1-cont') .load('/web_Content.htm #tab1-cont'); return false; }); //convert relative links to absolute links $("#tab1-cont a[href^=/]").each(function() { var hrefValue = $(this).attr("href"); $(this) .attr("href", "http://www.web.org" + hrefValue) .css('border', 'solid 1px green'); return false; }); I think my question is: whats the trick to getting IE to make selections on DOM that is lazy loaded with jQuery? This is my first post. Be gentle :-) Thanks, Joel

    Read the article

  • Objective-C properties are not being recognized in header file?

    - by Greg
    Hey folks, I wonder if I'm doing something completely stupid here... I'm clearly missing something. I've gotten used to the pattern of defining properties of a custom class, however I seem to be hitting a point where extended classes do not recognize new properties. Case of point, here's my header file: import import "MyTableViewController.h" @interface MyRootController : MyTableViewController { NSMutableArray *sectionList; } @property (nonatomic, retain) NSMutableArray *sectionList; @end Now, for some reason that "sectionList" property is not turning green within my interface file (ie: it's not being recognized as custom property it seems). As a result, I'm getting all kinds of errors down in my implementation. The first is right at the top of my implementation where I try to synthesize the property: import "MyRootController.h" @implementation MyRootController @synthesize sectionList; That synthesize line throws the error "No declaration of property 'sectionList' found in the interface". So, this is really confusing. I'm clearly doing something wrong, although I can't put my finger on what. One thought: I am extending another custom class of my own. Do I need to specify some kind of super-class declaration to keep the architecture from getting sealed one level up? Thanks!

    Read the article

  • Getting a ReturnValue from cmd.Parameters in c#?

    - by mark smith
    Hi, I have just finished converted a vb.net app to c# and one of the lines is to get @ReturnValue from the parameter. I ended up having to CAST a lot of things.. Is there not a easier way here is what i have int rc = ((System.Data.SqlTypes.SqlInt32)(((System.Data.SqlClient.SqlParameter)(cmd.Parameters["@ReturnValue"])).SqlValue)).Value; In vb.net it was as simple as doing this Dim rc As Integer = Convert.ToInt32(cmd.Parameters("@ReturnValue").Value) Alot easier :-) But the problem with C# is the property Value isn't available unless I Cast to SqlParameter and i also need to cast to Sqltypes.SqlInt32 - i can't just do a standard Convert.ToInt32

    Read the article

  • Using EhCache for session.createCriteria(...).list()

    - by James Smith
    I'm benchmarking the performance gains from using a 2nd level cache in Hibernate (enabling EhCache), but it doesn't seem to improve performance. In fact, the time to perform the query slightly increases. The query is: session.createCriteria(MyEntity.class).list(); The entity is: @Entity @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class MyEntity { @Id @GeneratedValue private long id; @Column(length=5000) private String data; //---SNIP getters and setters--- } My hibernate.cfg.xml is: <!-- all the normal stuff to get it to connect & map the entities plus:--> <property name="hibernate.cache.region.factory_class"> net.sf.ehcache.hibernate.EhCacheRegionFactory </property> The MyEntity table contains about 2000 rows. The problem is that before adding in the cache, the query above to list all entities took an average of 65 ms. After the cache, they take an average of 74 ms. Is there something I'm missing? Is there something extra that needs to be done that will increase performance?

    Read the article

  • Rails: how to represent available view actions in a stateful model?

    - by Greg
    I have a model that is stateful. In each state there are a selection of actions that the user might want to perform on an instance of the model. Currently I am translating the model state to actions that get represented in the view using a view helper. Something like this... in the model: Class Thing def state_is_A? state == 'A' end end In the helper: def display_available_actions(thing) if thing.state_is_A? link_to <action1> link_to <action2> end end And in the view: <%= display_available_actions(@thing) %> I don't like the fact that the model state is translated into view actions in the helper. I would like this to be incorporated into the model. On the other hand, it doesn't seem healthy for the model and view to get so coupled. Is there a Ruby or Rails idiom that suits this kind of situation better than my approach? Should each state be a separate model perhaps?

    Read the article

  • Does it ever make sense to make a fundamental (non-pointer) parameter const?

    - by Scott Smith
    I recently had an exchange with another C++ developer about the following use of const: void Foo(const int bar); He felt that using const in this way was good practice. I argued that it does nothing for the caller of the function (since a copy of the argument was going to be passed, there is no additional guarantee of safety with regard to overwrite). In addition, doing this prevents the implementer of Foo from modifying their private copy of the argument. So, it both mandates and advertises an implementation detail. Not the end of the world, but certainly not something to be recommended as good practice. I'm curious as to what others think on this issue. Edit: OK, I didn't realize that const-ness of the arguments didn't factor into the signature of the function. So, it is possible to mark the arguments as const in the implementation (.cpp), and not in the header (.h) - and the compiler is fine with that. That being the case, I guess the policy should be the same for making local variables const. One could make the argument that having different looking signatures in the header and source file would confuse others (as it would have confused me). While I try to follow the Principle of Least Astonishment with whatever I write, I guess it's reasonable to expect developers to recognize this as legal and useful.

    Read the article

  • How can i check if key is pressed during click event with jquery?

    - by daniel smith
    Hi, I would like to catch a click event with jquery and be able to tell if a key was pressed at the same time so i can fork within the callback function based on the keypress. for example: $("button").click(function() { if([KEYPRESSED WHILE CLICKED]) { do something... } else { do something different... } }); Does anyone know if this is possible at all or how it can be done if it is possible?

    Read the article

  • What Windows message is fired for mouse-up with modifier keys?

    - by Greg
    My WndProc isn't seeing mouse-up notifications when I click with a modifier key (shift or control) pressed. I see them without the modifier key, and I see mouse-down notifications with the modifier keys. I'm using the Windows Forms NativeWindow wrapper to get Windows messages from the WndProc() method. I've tried tracking the notifications I do get, and I the only clue I see is WM_CAPTURECHANGED. I've tried calling SetCapture when I receive the WM_LBUTTONDOWN message, but it doesn't help. Without modifier (skipping paint, timer and NCHITTEST messages): WM_LBUTTONDOWN WM_SETCURSOR WM_MOUSEMOVE WM_SETCURSOR WM_LBUTTONUP With modifier (skipping paint, timer and NCHITTEST messages): WM_KEYDOWN WM_PARENTNOTIFY WM_MOUSEACTIVATE WM_MOUSEACTIVATE WM_SETCURSOR WM_LBUTTONDOWN WM_SETCURSOR (repeats) WM_KEYDOWN (repeats) WM_KEYUP If I hold the mouse button down for a long time, I can usually get a WM_LBUTTONUP notification, but it should be possible to make it more responsive.. What am I missing? Thanks.

    Read the article

  • When are sqlite3 views updated?

    - by John Smith
    I have a database on the iPhone which as a view. When I update the dependent tables the view is not updated. It's only updated when I close and reopen the application. From there onwards things are okay: updates reflect immediately. Is there something I need to do to force update of a VIEW?

    Read the article

  • Explanation of `self` usage during dealloc?

    - by Greg
    I'm trying to lock down my understanding of proper memory management within Objective-C. I've gotten into the habit of explicitly declaring self.myProperty rather than just myProperty because I was encountering occasional scenarios where a property would not be set to the reference that I intended. Now, I'm reading Apple documentation on releasing IBOutlets, and they say that all outlets should be set to nil during dealloc. So, I put this in place as follows and experienced crashes as a result: - (void)dealloc { [self.dataModel close]; [self.dataModel release], self.dataModel = nil; [super dealloc]; } So, I tried taking out the "self" references, like so: - (void)dealloc { [dataModel close]; [dataModel release], dataModel = nil; [super dealloc]; } This second system seems to work as expected. However, it has me a bit confused. Why would self cause a crash in that case, when I thought self was a fairly benign reference more used as a formality than anything else? Also, if self is not appropriate in this case, then I have to ask: when should you include self references, and when should you not?

    Read the article

  • Using XmlDiffPatch when writing to stream

    - by Mark Smith
    I am trying to use xmldiffpatch when comparing two Xmls(one from a stream, the other from a file) and writing the diff patch to a stream. The first method is to write my xml to a memory stream. The second method loads an xml from a file and creates a stream for the patched file to be written into. The third method actually compares the two files and writes the third. The xmldiff.Compare(originalFile, finalFile, dgw); method takes (XmlReader, XmlReader, XmlWriter). I'm always getting that both files are identical, even though they are not, so I know that I am missing something. Any help is appreciated! public MemoryStream FirstXml() { string[] names = { "John", "Mohammed", "Marc", "Tamara", "joy" }; MemoryStream ms = new MemoryStream(); XmlTextWriter xtw= new XmlTextWriter(ms, Encoding.UTF8); xtw.WriteStartDocument(); xtw.WriteStartElement("root"); foreach (string s in names) { xtw.WriteStartElement(s); xtw.WriteEndElement(); } xtw.WriteEndElement(); xtw.WriteEndDocument(); return ms; } public Stream SecondXml() { XmlReader finalFile =XmlReader.Create(@"c:\......\something.xml"); MemoryStream ms = FirstXml(); XmlReader originalFile = XmlReader.Create(ms); MemoryStream ms2 = new MemoryStream(); XmlTextWriter dgw = new XmlTextWriter(ms2, Encoding.UTF8); GenerateDiffGram(originalFile, finalFile, dgw); return ms2; } public void GenerateDiffGram(XmlReader originalFile, XmlReader finalFile, XmlWriter dgw) { XmlDiff xmldiff = new XmlDiff(); bool bIdentical = xmldiff.Compare(originalFile, finalFile, dgw); dgw.Close(); StreamReader sr = new StreamReader(SecondXml()); string xmlOutput = sr.ReadToEnd(); if(xmlOutput.Contains("</xd:xmldiff>")) {Console.WriteLine("Xml files are not identical"); Console.Read();} else {Console.WriteLine("Xml files are identical");Console.Read();} }

    Read the article

  • POST parameters strangely parsed inside phantomjs

    - by user61629
    I am working with PHP/CURL and would like to send POST data to my phantomjs script, by setting the postfields array below: In my php controller I have: $data=array('first' => 'John', 'last' => 'Smith'); $url='http://localhost:7788/'; $output = $this->my_model->get_data($url,$data); In my php model I have: public function get_data($url,$postFieldArray) { $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFieldArray); curl_setopt($ch, CURLOPT_URL, $url); $output = curl_exec($ch); In my phantomJS script that I am running locally I have: // import the webserver module, and create a server var server = require('webserver').create(); var port = require('system').env.PORT || 7788; console.log("Start Application"); console.log("Listen port " + port); // Create serever and listen port server.listen(port, function(request, response) { // Print some information Just for debbug console.log("We got some requset !!!"); console.log("request method: ", request.method); // request.method POST or GET if(request.method == 'POST' ){ console.log("POST params should be next: "); console.log("POST params: ",request.post); exit; } I first start and run the phantomjs script (myscript.js) from the command line, then I run my php script. The output is: $ phantomjs.exe myscript.js Start Application Listen port 7788 null We got some requset !!! request method: POST POST params should be next: POST params: ------------------------------e70d439800f9 Content-Disposition: form-data; name="first" John ------------------------------e70d439800f9 Content-Disposition: form-data; name="last" Smith ------------------------------e70d439800f9-- I'm confused about the the output. I was expecting something more like: first' => 'John', 'last' => 'Smith Can someone explain why it looks this way? How can I parse the request.post object to assign to variables inside myscript.js

    Read the article

  • Creating a Group of Groups in Django

    - by Greg
    I'm creating my own Group model; I'm not referring to the builtin Group model. I want each hroup to be a member of another group (it's parent), but there is the one "top" group that doesn't have a parent group. The admin interface won't let me create a group without entering a parent. I get the error personnel_group.parent_id may not be NULL. My Group model looks like this: class Group(models.Model): name = models.CharField(max_length=50) parent = models.ForeignKey('self', blank=True, null=True) order = models.IntegerField() icon = models.ImageField(upload_to='groups', blank=True, null=True) description = models.TextField(blank=True, null=True) How can I accomplish this? Thanks.

    Read the article

  • Loading non-RJS javascript via ajax in Rails

    - by David Smith
    I've written a rails module that generates some javascript for a google map. As the user makes changes on the webpage, I use observe_field to call back to the server to regenerate the map's javascript (without updating the whole page). I'm having trouble finding a good way to insert the new javascript into the page. I've tried <div id='my_div_1'>div1</div> <%= update_page_tag do |page| page.replace_html 'my_div_1', "<script>alert('hi');</script>" end %> but it seems that replace_html only works for non-script html. It chokes when the content includes the closing < /script tag. Additional information...here is a page that I think is the root of the problem. http://www.wwco.com/~wls/blog/2007/04/25/using-script-in-a-javascript-literal/

    Read the article

  • flex 4: custom css value.

    - by greg
    is there any way to create a custom css value for a component and have it available to the skin class that component is using? for example, if i define this in a css file: s|Panel{ skinClass: ClassReference("PanelSkin"); myCustomValue: #CCCCFF; } is there a way to make myCustomValue available in the PanelSkin ?

    Read the article

  • PHP/MySQL: Storing and retrieving UUIDS

    - by Greg
    I'm trying to add UUIDs to a couple of tables, but I'm not sure what the best way to store/retrieve these would be. I understand it's far more efficient to use BINARY(16) instead of VARCHAR(36). After doing a bit of research, I also found that you can convert a UUID string to binary with: UNHEX(REPLACE(UUID(),'-','')) Pardon my ignorance, but is there an easy way to this with PHP and then turn it back to a string, when needed, for readability? Also, would it make much difference if I used this as a primary key instead of auto_increment? EDIT: Found part of the answer: $bin = pack("h*", str_replace('-', '', $guid)); How would you unpack it?

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >