Search Results

Search found 31491 results on 1260 pages for 'simple talk'.

Page 74/1260 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • Erlang: simple refactoring

    - by alexey
    Consider the code: f(command1, UserId) -> case is_registered(UserId) of true -> %% do command1 ok; false -> not_registered end; f(command2, UserId) -> case is_registered(UserId) of true -> %% do command2 ok; false -> not_registered end. is_registered(UserId) -> %% some checks Now imagine that there are a lot of commands and they are all call is_registered at first. Is there any way to generalize this behavior (refactor this code)? I mean that it's not a good idea to place the same case in all the commands.

    Read the article

  • Make a simple animation in winforms using a loop

    - by Michael Quiles
    I need help making this loop to move a label move smoothly across the screen using count for the animation (its required). The labels location is currently in location 0,0 I'd like to make it go in a square right - down - left - back to its original position how can I accomplish this ? please give me an example using my code below. Thank You in advance. private void xAnimeTimer_Tick(object sender, EventArgs e) { int count; this.xAnimTimer.Stop(); for (count = 0; count <= 100; count++) { this.xAnimLabel.Left = count; } for (count = 0; count <= 150; count++) { this.xAnimLabel.Top = count; }

    Read the article

  • Simple PHP GET question

    - by Jake
    I know how to detect if a particular GET method is in the url: $username = $_GET['username']; if ($username) { // whatever } But how can I detect something like this: http://www.mysite.com?username=me&action=editpost How can I detect the "&action" above?

    Read the article

  • nextSibling issue, should be simple

    - by SoLoGHoST
    Ok, I'm trying to come to grips with this nextSibling function in JS. Here's my issue within the following code... var fromRow = document.getElementById("row_1"); while(fromRow.nodeType == 1 && fromRow.nextSibling != null) { var fRowId = fromRow.id; if (!fRowId) continue; // THIS ONLY gets done once and alerts "row_1" ONLY :( alert(fRowId); fromRow = fromRow.nextSibling; } Ok can someone please tell me what is wrong with this code? There are siblings next to this document.getElementById("row_1"); element for sure as I can see them, and they all have id attributes, so why is it not getting the id attributes of the siblings?? I don't get it. row_1 is a TR element, and I need to get the TR elements next to it within this table, but for some reason, it only gets the 1 element that I can already get using document.getElementById, arggg. Thanks guys :)

    Read the article

  • Simple jQuery Toggle of children

    - by Rick
    Um, why no worky? Trying to toggle a ul with this: $("#others").children(".btn").click(function(){ if ($(this).children("ul").is(":hidden")) { $(this).children("ul").slideDown(); } else { $(this).children("ul").slideUp(); } }); And: <div id="other"> <div id="galleries"> <a href="#" class="btn">Galleries >> </a> <ul id="select_gallery"> ... </ul> </div> <div id="events"> <a href="#" class="btn">Events >> </a> <ul id="select_event"> ... </ul> </div> </div>

    Read the article

  • Simple line matching using Regex

    - by Joan Venge
    I have this string stream: "do=whoposted&amp;t=1934067" rel=nofollow>61</A></TD><TD class=alt2 align=middle>5,286</TD></TR><TR><TD id=td_threadstatusicon_1911046 class=alt1><IMG id=thread_statusicon_1911046 border=0 alt="" src="http://url.com/forum/images/statusicon/thread_new.gif"> </TD><TD class=alt2><IMG title=Node border=0 alt=Node src="http://url.com/forum/images/icons/new.png"></TD><TD id=td_threadtitle_1911046 class=alt1 title="http://lulzimg.com/i14/7bd11b.jpg &#10; &#10;Complete name : cool-thread...."><DIV><A id=thread_gotonew_1911046 href="http://url.com/forum/f80/cool-topic-new/"><IMG class=inlineimg title="Go to first new post" border=0 alt="Go to first new post" src="http://url.com/forum/images/buttons/firstnew.gif"></A> [MULTI] <A style="FONT-WEIGHT: bold" id=thread_title_1911046 href="http://url.com/forum/f80/cool-topic-name-1911046/">Cool Topic Name</A> </DIV><DIV class=smallfont><SPAN style="CURSOR: pointer" onclick="window.open('http://url.com/forum/members/u2031889/', '_self')">m3no</SPAN> </DIV></TD><TD class=alt2 title="Replies: 11, Views: 1,554"><DIV style="TEXT-ALIGN: right; WHITE-SPACE: nowrap" class=smallfont>Today <SPAN class=time>08:04 AM</SPAN><BR>by <A href="http://url.com/forum/members/u1131830/" rel=nofollow>karetsos</A> <A " The lines I am interested are similar to this: <A style="FONT-WEIGHT: bold" id=thread_title_1911046 href="http://url.com/forum/f80/cool-topic-name-1911046/">Cool Topic Name</A> From here all I am trying to extract are: Thread id: 1911046 (could be from either location in the string) Thread name: "Cool Topic Name" Thread link: "http://url.com/forum/f80/cool-topic-name-1911046/" Currently I use this: Regex pattern = new Regex ( "<A\\s+href=\"([^\"]*)\">([^\\x00]*?)\\s+id=thread_title_(\\S+)</A>" ); MatchCollection matches = pattern.Matches ( doc.ToString ( ) ); foreach ( Match match in matches ) { int id = Convert.ToInt32 ( match.Groups [ 1 ].Value ); string name = match.Groups [ 3 ].Value; string link = match.Groups [ 2 ].Value; ... } I would appreciate if someone can help me fix the pattern to match it. This used to work but it returns 0 matches.

    Read the article

  • Simple check for SELECT query empty result

    - by den-javamaniac
    Hi. Can anyone point out how to check if a select query returns non empty result set? For example I have next query: SELECT * FROM service s WHERE s.service_id = ?; Should I do something like next: ISNULL(SELECT * FROM service s WHERE s.service_id = ?) to test if result set is not empty?

    Read the article

  • Simple php if query to double check

    - by skarama
    Is anything wrong with this code? <?php $variable = ; if (isset($variable)) { echo $variable ; echo "also this" ; } else echo "The variable is not set" ; ?> also, the other potential value of the variable is : $variable = <a href="http://www.mysite.com/article">This Article</a>; To clarify, I have a variable that may hold one of two possible values : an a href tag with it's url, or notihng at all. I need to have two different printouts for each of these cases, maybe I'm not doing it the right way though!

    Read the article

  • simple GET validation

    - by Andrew
    I have GET[] input and would like to carry out their validation. The input data is always a number by. Schema. I want to make sure that the pass number and the appropriate amount - not to throw the sql query. at this moment I am using the procedures $cc = $_GET['cc']; if ($cc=='') $cc='9012';$find=array("..", "/", "\\"); $replace=array("", "", ""); $cc=str_replace($find, $replace, $cc); $eic = $_GET['eic']; .... ect. // where f.ex. 9012 is an real existing data (in dbase) to generate sucure sql question GET[] variable data schema $_GET[$cc] - always 4 digits $_GET[$eic] - always 4 digits $_GET[$iy] - always 4 digits $_GET[$ir] - always 1 digit Can you show me a better way to secure my GET?

    Read the article

  • Simple Java math operations

    - by user1730056
    I'm making a BMI calculator that doesn't seem to be working. The math operations work if i just do something like w/h, but once i had the brackets, it returns an error. If i change the variables w and h and use a constant number, the operation works. Another problem is that although i'm making result a double, it seems to be rounding to the nearest int. Could someone tell me what I'm doing wrong here? public class ass10 { public static void main(String[] args) { bmi(223,100); } public static bmi(int w, int h){ double result; result = (w/(h*h))*703 System.out.println(result) } }

    Read the article

  • Simple Communication between 2 instances of application

    - by KyleGobel
    I have a WPF application that can take a few optional command line arguments. This application is also a single instance application (using a mutex to close any instances if one is already open). What I want for it to do though, is if something tries to open the application with some cmd line args, that the application will do what it's suppose to do with those (in my application it opens different dialogs based on the cmd line). What is the easiest way to achieve this? In psedo code here is what i'm looking for protected override void OnStartup(StartupEventArgs e) { bool mutexIsNew; using (System.Threading.Mutex m = new System.Threading.Mutex(true, "MyApplication", out mutexIsNew)) { //if this is not the first instance of the app if (!mutexIsNew) { //if there is some cmd line args if (e.Args.Length > 0) { //send the args to the older instance so it can handle them SendToOtherInstance(e.Args); //shutdown this new instance Application.Current.Shutdown(); } } } base.OnStartup(e); }

    Read the article

  • [C++] Simple inheritance question

    - by xbonez
    I was going over some sample questions for an upcoming test, and this question is totally confusing me. Any help would be appreciated. Consider the following code: class GraduateStudent : public Student { ... }; If the word "public" is omitted, GraduateStudent uses private inheritance, which means which of the following? GraduateStudent objects may not use methods of Student. GraduateStudent does not have access to private objects of Student. No method of GraduateStudent may call a method of Student. Only const methods of GraduateStudent can call methods of Student.

    Read the article

  • A simple, clean web layout

    - by Shaun_web
    Ok, so I hate CSS/HTML graphic design... What do you guys recommend as a sample template or website that you think has great CSS and html layout? From my past experience it's best to get a page that has a white background and little dependency on graphics -- that's clean, and easy to modify ;-).

    Read the article

  • trying to sort a simple string in c++

    - by every_answer_gets_a_point
    #include "stdio.h" #include "conio.h" #include <iostream> using namespace std; int main (void) { char my_char[] = "happy birthday"; int i; bool j=false; char my_char_temp[1]; do { for (i=0;i<sizeof(my_char)-2;i++) { j=false; if (my_char[i+1] < my_char[i]) { my_char_temp[0]=my_char[i+1]; my_char[i+1] = my_char[i]; my_char[i] = my_char_temp[0]; j=true; } } }while (j); cout << my_char; } what am i doing wrong? im just trying to sort the letters within the char the output i get is completely wrong

    Read the article

  • SQLite: Simple DELETE statement did not work

    - by user186446
    I have a table MRU, that has 3 columns. (VALUE varchar(255); TYPE varchar(20); DT_ADD datetime) This is a table simply storing an entry and recording the date time it was recorded. What I wanted to do is: delete the oldest entry whenever I add a new entry that exceeds a certain number. here is my query: delete from MRU where type = 'FILENAME' ORDER BY DT_ADD limit 1; The query returns an error. Thanks

    Read the article

  • IE 7 issues: Super simple page - TD height not taking effect

    - by Anthony
    This is my markup: <!DOCTYPE HTML> <html> <head> <title>Test title</title> <style type="text/css"> * { margin:0px auto; padding:0px; } html,body { height:100%; width:100%; } </style> </head> <body> <table cellspacing="0" cellpadding="0" style="width: 100%; height: 100%;"> <tr> <td style="height:55px;background:#CCC;" valign="top"> <h1>Header</h1> </td> </tr> <tr> <td valign="top"> Content @RenderBody() </td> </tr> <tr> <td style="height:85px;background:#CCC;" valign="bottom"> Footer </td> </tr> </table> </body> </html> Can anybody tell me why td height is not taking effect? This same markup works in IE9. Is it due to the HTML5 doctype?

    Read the article

  • Simple question on database query.

    - by GK
    I have been asked in an interview, To write a sql query which fetches the first three records with highest value on some column from a table. i had written a query which fetched all the records with highest value, but didnt get how exactly i can get only first three records of those. could you help me in this. thanks.

    Read the article

  • java class that simulates a simple database table

    - by ericso
    I have a collection of heterogenous data that I pull from a database table mtable. Then, for every unique value uv in column A, I compute a function of (SELECT * FROM mtable WHERE A=uv). Then I do the same for column B, and column C. There are rather a lot of unique values, so I don't want to hit the db repeatedly - I would rather have a class that replicates some of the functionality (most importantly some version of SELECT WHERE). Additionally, I would like to abstract the column names away from the class definition, if that makes any sense - the constructor should take a list of names as a parameter, and also, I suppose, a list of types (right now this is just a String[], which seems hacky). I'm getting the initial data from a RowSet. I've more or less done this by using a hashmap that maps Strings to lists/arrays of Objects, but I keep getting bogged down in comparisons and types, and am thinking that my current implementation really isn't as clean and clear as it could be. I'm pretty new to java, also, and am not sure if I'm not going down a completely incorrect path. Does anyone have any suggestions?

    Read the article

  • Mongodb, simple IN problem

    - by afvasd
    Hi everyone I am new to mongo, this is my db design: product := { name: str group: ref, comments: [ ref, ref, ref, ref ] } comments := { ... a bunch of comments stuff } tag := { _id: int, #Need this for online requests tag: str, products: [ {product: ref, score: float}, ... ], comments: [ {comment: ref, score: float}, ...], } So my usage pattern is: GIVEN a product, find comments that have certain tag and sort them accordingly. My current approach involves: Look for that tag object that has tag=myTag pull all the comments out, sorted look for that product where product.name=myProduct pull all the comments out (which are dbrefs by the way) loop through the result of 2, and checking if they are in 4, (this I can do a limit 10) etc. It's pretty inefficient. Any better methods?

    Read the article

  • Simple Java web application on Tomcat

    - by EugeneP
    If we only need to graphically authorize a user, view a few tables representation (from database), ability to change data in the database visually what tools to use to write such a web application that will run on Tomcat? What framework allows to do that in the most straightforward, easy-to-manage and elegant way?

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >