Search Results

Search found 1685 results on 68 pages for 'no more guessing'.

Page 31/68 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Inserting non-pod struct into a GHashTable

    - by RikSaunderson
    Hi there, I'm trying to build a GHashTable of instances of a struct containing ints, a time_t and a few char*'s. My question is, how do you insert an instance of a struct into a GHashTable? there are plenty of examples of how to insert a string or an int (using g_str_hash and g_int_hash respectively), but I'm guessing thatI want to use the g_direct_hash, and I can't seem to find any examples of that. Ideally, my code would look like this: GHashtable table; table = g_hash_table_new(g_direct_hash, g_direct_equal); struct mystruct; mystruct.a = 1; mystruct.b = "hello"; mystruct.c = 5; mystruct.d = "test"; g_hash_table_insert(table,mystruct.a,mystruct); Clearly, this is incorrect as it does not compile. Can anyone provide an example that does do what I want? Thanks, Rik

    Read the article

  • How to make WordPress "Add/Edit Post" form more Tumblr like?

    - by Eliot Sykes
    Hi, WordPress requires you give each blog post at least two fields: a title and text body content. I'm wondering how to modify WordPress admin so I can sometimes enter a single field for a blog post, in particular a URL, without WordPress requiring a title (related but not the point of this question: a custom theme would then know how to handle a post that only contained a URL, it would treat it like a "Link" post in Tumblr). Ideally it'd be good if the "add/edit post" form could be modified so it only contains this single URL/Link field when this is wanted. I'm guessing this is possible through a plugin but I'm not certain. I'm hoping some smart WordPress devs are here to share and brainstorm ideas for how this could be done. Thanks in advance for any help, Eliot

    Read the article

  • Where are TFS Alerts stored in the TFS Databases? Receiving duplicate alerts after upgrade 2008 to

    - by MJ Hufford
    I recently performed a migration-upgrade from TFS 2008 to TFS 2010. Almost everything is working properly now. However, our team is getting duplicate emails now. I'm guessing this is because I used the TFS 2008 power tools to setup alerts. After the upgrade, I installed the TFS 2010 power tools and noticed that there were not alerts configured. I setup new alerts and now we get duplicates. Is it possible the old alerts configuration is floating around in the db somewhere?

    Read the article

  • Accessing a dictionary value by custom object value in Python?

    - by Sam
    So I have a square that's made up of a series of points. At every point there is a corresponding value. What I want to do is build a dictionary like this: class Point: def __init__(self, x, y): self._x = x self._y = y square = {} for x in range(0, 5): for y in range(0, 5): point = Point(x,y) square[point] = None However, if I later create a new point object and try to access the value of the dictionary with the key of that point it doesn't work.. square[Point(2,2)] Traceback (most recent call last): File "<pyshell#19>", line 1, in <module> square[Point(2,2)] KeyError: <__main__.Point instance at 0x02E6C378> I'm guessing that this is because python doesn't consider two objects with the same properties to be the same object? Is there any way around this? Thanks

    Read the article

  • Alert on moving to a different page of a grid when user changes contents of textboxes in a Grid

    - by Ashish Gupta
    In a ASP.NET application I have a paging RadGrid which shows up textbox in each row. Outside the grid, there is an OK button to save the content of all the textbox. If user changes text in any one or more of the textbox and without clicking on the "OK" button, tries to move to a different page number (of the grid by clicking on the page number), he should be prompted for confirmation of save or cancel the changes. I am guessing that one can write a Javascript function which would look for any form input control (textbox in my case) and detect changes and If there are changes, would prompt the user. However, I am not sure where I can call this function from? Any suggestion on this or a better way to achieve this would be appreciated. I am using RadGrid but I guess this should be applicable to GridView as well.

    Read the article

  • How can developers use a similar tracking link to Google's results page?

    - by Peter Jones
    I've read heaps of pages of people trying to implement some kind of tracking system similar to the way Google reroutes search link. Eg: Search "Facebook" in Google, open in a new window, and the link changes to something like: "http://www.google.com.au/url?sa=t&source=web&cd=1&ved=0CBkQFjAA&url=http%3A%2F%2Fwww.facebook.com%2F&rct=j&q=Facebook&ei=sksZTZexJobJccXnxZYK&usg=AFQjCNHTTNi-O4Qgrg6kvGVfKJuRqbuOKw&cad=rja" I'm guessing Google tracks that click and then redirects to the actual site by reading the url parameter. What I wanted to know is if there was a simple way that you can make this kind of functionality work using an onclick event - just change the link href after being clicked to redirect? There's a few threads, but from what I could find, nobody has actually succeeded without problems or limitations. Thanks in advance.

    Read the article

  • Can you define <=> in Ruby and then have ==, >, <, >=, and <= defined automatically?

    - by jeremy Ruten
    Here's part of my Note class: class Note attr_accessor :semitones, :letter, :accidental def initialize(semitones, letter, accidental = :n) @semitones, @letter, @accidental = semitones, letter, accidental end def <=>(other) @semitones <=> other.semitones end def ==(other) @semitones == other.semitones end def >(other) @semitones > other.semitones end def <(other) @semitones < other.semitones end end It seems to me like there should be a module that I could include that could give me my equality and comparison operators based on my <=> method. Is there one? I'm guessing a lot of people run into this kind of problem. How do you usually solve it? (How do you make it DRY?)

    Read the article

  • how to send JSON data with server error response code 500

    - by kapil.israni
    I wanted to know if theres a way to send a JSON data along with HTTP response code 500. Basically I want my rest client to know that there is some error on the backend and along with it send a JSON error data structure like this. {"error" : [ {"code": "1001", "desc": "Some error description"}, {"code": "1002", "desc": "Some other error description"} ] } This is using the following java stack = Java 6/JAX-RS/Jersey/Tomcat If not, then is there a way to send a custom response code along with JSON data. Basically looking from JAX-RS API it looks that you can only send JSON data along with 200 OK?? Any thoughts?? I am guessing RESTEasy would be the same, right??

    Read the article

  • MySQL: Blank row in table after LOAD DATA INFILE

    - by Tom
    Hi, I'm uploading a large amount of data from a CSV (I'm doing it via MySQL Workbench): LOAD DATA INFILE 'C:/development/mydoc.csv' INTO TABLE mydatabase.mytable CHARACTER SET utf8 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r'; However, I'm noticing that it keeps adding an empty line full of nulls/zeros after the last record. I'm guessing it's because of the "LINES TERMINATED" command. However, I need that to load the data in correctly. Is there some way around this / some better SQL to avoid the blank row in the table? Thanks

    Read the article

  • "Genie" animation effect in XAML

    - by ScottCate
    What would the XAML look like to create a Genie animation effect? Take an object of any size/shape, and "Genie" it to another Minimized location. Kind of like the OSX window minimize. Maybe even a little fancier through a smoke-like effect where the path is more switch back, instead of a simple funnel (if that makes any sense). I'm guessing that there is some sort of Path that could be drawn, and the shape could move and transform along that path. Just a wild guess. Thanks for your ideas.

    Read the article

  • ASP MVC 2: Regular expression attribute working on clientside but not on serverside

    - by wh0emPah
    [Required(ErrorMessage = "Date is required")] [RegularExpression(@"^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((1[6-9]|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$", ErrorMessage="Date is not valid must be like (dd/mm/jjjj)")] public DateTime Startdate{ get; set;} The client-side validation works perfectly. So it seems that JavaScript can successfully understand my regular expression. But when I do a postback, and the modelstate.Isvalid() gets called. My date isn't valid anymore. So I'm guessing that when .NET performs the matching with the regEx it doesn't match. My question: Why does this regular expression match on the client side but not on the server side?

    Read the article

  • Double associative array or indexed + associative array

    - by clover
    I'm undecided what's the best-practice approach for what I'm trying to do. I'm trying to enter data into an array where the data will look like this: apple color: red price: 2 orange color: orange price: 3 banana color: yellow price: 2 pineapple color: yellow price: 5 When I get input, let's say green apple (notice it's a combo of color + name of fruit), I'm going to check if the name of fruit part exists in the array and display its data (if it exists). What's the right way to compose those arrays? How would I do an indexed array containing an associative array? (or would this be better as 2 nested associative arrays, I'm guessing not)

    Read the article

  • Android: Displaying Video on VideoView

    - by AndroidDev93
    I'm trying to display a video in my sdcard on the video view. Here is my code: String name = Environment.getExternalStorageDirectory() + "/test.mp4"; final VideoView videoView = (VideoView)findViewById(R.id.videoView1); videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { public void onPrepared(MediaPlayer arg0) { videoView.start(); } }); videoView.setVideoPath(name); The file I am trying to open is called test.mp4 and its located within the sdcard folder. I get an error saying the application has unfortunately stopped. I would appreciate it if someone could help me. Thanks. EDIT : I used the debugger and found out that I get an InvocationTargetException. The detailed message says that : Failure delivering result ResultInfo{who=null, request=1001, result=-1, data=Intent { dat=file:///mnt/sdcard/test.mp4 }} to activity : java.lang.NullPointerException EDIT : I looked at the logcat again and it seems to give the error at videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { I'm guessing either videoView or MediaPlayer is null.

    Read the article

  • C# Changing a constant

    - by Jane T
    I have inherited a small windows form based program written in C# that uses a 'constant' (See below), I need to modify this program so 'PROPERTY_NAME' can be "jobs" and "careers". private const string PROPERTY_NAME = "jobs"; I'm guessing a constant isn't designed to change so should I need to change this. The line above is set once at the top of a class file and then PROPERTY_NAME is used throughout that file. On the main form I would like to add two radio buttons 1 called 'jobs' and one called 'careers' and then change the PROPERTY_NAME in the class file based on which is selected. Would I need to pass the radio button status to the method in the class file? I recall reading that I can't simply read the radio button value from the class file. Many thanks for your advice. Jane

    Read the article

  • Animate the enabling of a UIBarButtonItem?

    - by Michael Brewer
    Is there a way to animate enabling or disabling a button? I've tried the following with no success. I'm guessing at this point that the enabled property cannot be animated like opacity can – but I hope I'm wrong. [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0f]; theButton.enabled = YES; [UIView setAnimationDelegate:self]; [UIView commitAnimations]; I can't believe there isn't a setEnabled:(BOOL)enabled animated:(BOOL)animated method.

    Read the article

  • How to "defragment" MongoDB index effectively in production?

    - by dfrankow
    I've been looking at MongoDB. Feels good. I added some indexes to a collection, uploaded a bunch of data, then removed all the data, and I noticed the indexes did not change size, similar to the behavior reported here. If I call db.repairDatabase() the indexes are then squashed to near-zero. Similarly if I don't remove all the data, but call repairDatabase(), the indexes are squashed somewhat (perhaps because unused extends are truncated?). I am getting index size from "totalIndexSize" of db.collection.stats(). However, that takes a long time (I've read it could be hours on a large database). It's unclear to me how available the database is for reads or writes while it is running. I am guessing not so available. Since I want to run as few instances of mongod as possible, I want to understand more about how indexes are managed after deletes. Can anyone point me to anything or give any advice?

    Read the article

  • How to gain greater control of network packets on Android

    - by mauvehead
    I'm looking to design an application that will require some deep control over IP packets. Looking over the reference guide on the developers site at Android I see very limited control over packets from java.net:SocketOptions and java.net:DatagramPacket. Specifically I'm looking to control the individual bits within the packet to set TCP Flags, SYN/ACK/RST, and so forth. Based on the docs I am assuming I cannot do this within the Java API provided by Android and I'm guessing I'll have to do it some other way? Anyone have any insight on this?

    Read the article

  • Getting "on the wire" Size of Messages in WCF

    - by Mystagogue
    While I'm making SOAP or REST invocations to WCF, I'd like to have the channel stack on either end (client and server) record the on-the-wire size of the data received. So I'm guessing I need to add a custom behavior to the channel stack on either side. That is, on the server side I'd record the IP-header advertised size that was received. On the client side I'd record the IP-header advertised size that was returned from the server. But this presupposes that this information is visible to a custom WCF behavior at the channel stack level. Perhaps it is only visible at the level of ASP.NET (at a layer beneath WCF)? In short, does anyone have any further insight on if and how this information is accessible? I must qualify that this "size" data will be collected in a production environment, as part of regular business logic calls. This question is related to my earlier bandwidth question.

    Read the article

  • Problem with Python 3.1(syntax error). Im a beginner please help!

    - by Jonathan
    Hi there, im new to pragraming :) I got a problem with sytax error while making a guessing game. the problem is in (if Gender = boy or Boy), the equal(=) letter is a syntax error. Please help! Answer = 23 Guess = () Gender = input("Are you a boy, a girl or an alien? ") if Gender = boy or Boy: print("Nice!", Gender) if Gender = girl or Girl: print("Prepare do die!", Gender) if Gender = alien or Alien: print("AWESOME my", Gender, "Friend!") While Guess != Answer: if Guess < Answer: print("Too low! try again") else: print("too high!" print("Congratulations you guessed correct!", Gender, "Have fun!" Thank

    Read the article

  • Updating Excel Cell with Non-Numeric Data in C#

    - by kbo206
    I have a query that is ExcelQuery = "Update [Sheet1$] set CITIZEN_ID = #" + value + " where CITIZEN_ID = " + value; As you can see, I'm essentially just appending a "#" onto the CITIZEN_ID field. value is a int/numeric value. So if I had "256" in the CITIZEN_ID column it would be converted to "#256" When I execute this I get an OleDbException Syntax error in date in query expression so I surrounded part of the query in single quotes like this, ExcelQuery = "Update [Sheet1$] set CITIZEN_ID = '#" + value + "' where CITIZEN_ID = " + value; With that I get yet another OleDbException this time with, Data type mismatch in criteria expression. I'm guessing for some reason the CITIZEN_ID fields don't want to take anything besides a plain number. Is there any way I can remedy this to get that pound symbol in? Thanks!

    Read the article

  • vestal_versions and htmldiff question of reversion...

    - by holden
    I'm guessing there's probably an easier way to do what I'm doing so that the code is less unwieldy. I had trouble understanding how to use the revert_to method... i wanted something where i could call up two different versions at the same time, but this doesn't seem to be the way that vestal_versions works. This code works, but I'm wondering if I'm making something harder than it needs to be and I'd like to find out before I delve deeper. @article = Article.find(params[:id]) if params[:versions] v = params[:versions].split(',') @article.revert_to(v.first.to_i) @content1 = @article.content @article.revert_to(v.last.to_i) @content2 = @article.content end In case you're wondering, I'm using this in conjunction with HTMLDIFF to get the version changes. <div id="content"> <% if params[:versions] %> <%= Article.diff(@content1, @content2) %> <% else %> <%= @article.content %> <% end %> </div>

    Read the article

  • Building a complete online payment gateway like Paypal

    - by John Stewart
    So this question isn't about integrating an existing payment gateway into my site. This is more of a architectural question. I want to build a system similar to Paypal. Now I understand that Paypal offers a lot of features under the roof and I can't implement all of them at once. I want to implement the core functionality of Paypal and other such services. So my question is (rather discussion is) around how would one go about building such a system. Some points to discuss: Handle payments through existing banks. I am guessing that I would need access to local bank protocols to get this. Allow users to securely store and process their payments How does Paypal handle the transactions? Thoughts?

    Read the article

  • Redundancy algorithm for reading noisy bitstream

    - by Tedd Hansen
    I'm reading a lossy bit stream and I need a way to recover as much usable data as possible. There can be 1's in place of 0's and 0's in palce of 1's, but accuracy is probably over 80%. A bonus would be if the algorithm could compensate for missing/too many bits as well. The source I'm reading from is analogue with noise (microphone via FFT), and the read timing could vary depending on computer speed. I remember reading about algorithms used in CD-ROM's doing this in 3? layers, so I'm guessing using several layers is a good option. I don't remember the details though, so if anyone can share some ideas that would be great! :) Edit: Added sample data Best case data: in: 0000010101000010110100101101100111000000100100101101100111000000100100001100000010000101110101001101100111000101110000001001111011001100110000001001100111011110110101011100111011000100110000001000010111 out: 0010101000010110100101101100111000000100100101101100111000000100100001100000010000101110101001101100111000101110000001001111011001100110000001001100111011110110101011100111011000100110000001000010111011 Bade case (timing is off, samples are missing): out: 00101010000101101001011011001110000001001001011011001110000001001000011000000100001011101010011011001 in: 00111101001011111110010010111111011110000010010000111000011101001101111110000110111011110111111111101 Edit2: I am able to controll the data being sent. Currently attempting to implement simple XOR checking (though it won't be enough).

    Read the article

  • Quaere - Anyone using it yet? (LINQ to Objects for Java)

    - by Marty Pitt
    Hi there I'm a .NET guy originally, working in Java recently, and finding I'm really missing LINQ to Objects, specifically for performing filtering against collections. A few people here on Stack Overflow have answered the "LINQ for Java?" question with a single word : Quaere However, on the site it clearly states "Pre-Beta", and there's been no commits to their code for over a year, so I'm guessing the project is pretty much dead. Is anyone actually using this, and / or have any experience with it? The second most common answer appears to be "use Google Collections". Is this the most appropriate Java way? Cheers Marty

    Read the article

  • Getting the height of text to know fill height as in TCPDF

    - by sami
    I'm trying to go through the code of TCPDF to understand how it calculates the height of the text to be rendered, but it's too much for me to handle without asking. What I want to know: in the PDF from example 5 http://www.tcpdf.org/examples/example_005.pdf it gives the cell a yellow background. I'm guessing that at the basic level, it first draws a box with this fill color, then adds the text, so what method is it calling to get the height of the text to know the height of the box to fill? Anyone knows how to trace this, because doing it by hand and looking through the code isn't working at all for me.

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >