Search Results

Search found 28627 results on 1146 pages for 'case statement'.

Page 68/1146 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • C++ / Java: Toggle boolean statement?

    - by Martijn Courteaux
    Hi, Is there a short way to toggle a boolean? With integers we can do operations like this: int i = 4; i *= 4; // equals 16 /* Which is equivalent to */ i = i * 4; So is there also something for booleans (like the *= operator for ints)? In C++: bool booleanWithAVeryLongName = true; booleanWithAVeryLongName = !booleanWithAVeryLongName; // Can it shorter? booleanWithAVeryLongName !=; // Or something? In Java: boolean booleanWithAVeryLongName = true; booleanWithAVeryLongName = !booleanWithAVeryLongName; // Can it shorter? booleanWithAVeryLongName !=; // Or something?

    Read the article

  • CSS/IE7: The Case of the Extending Background-Image

    - by dmr
    The situation: There a collapsible advanced search box. It is made up of a search box div that contains a boxhead div and a boxbody div. Inside the boxbody div, there is a searchToggle div. When the user clicks "Show/Hide", the display style property of the searchToggle div is toggled between block and none. (The search fields are hidden and the search boxbody gets much smaller). The 2 background-images for the body of the search box are set via the css of the searchBox div and the boxbody div. In IE7, when the searchToggle div is hidden, the background-image from the searchBox div extends on the left more than it should (see Here). It shows up correctly when the display of the searchToggle div is block (see Here). Everything show up correctly, in both cases, in IE8 and FF. The relevant HTML: <div class="searchBox"> <div class="boxhead"> <h2></h2> </div> <div class="boxbody"> <div id="searchToggle" name="searchToggle"> </div> </div> </div> The relevant CSS: .searchBox { margin: 0 auto; width: 700px; background: url(/images/myImageRight-r.gif) no-repeat bottom right; font-size: 100%; text-align: left; overflow: hidden; } .boxbody { margin: 0; padding: 5px 30px 31px; background-image: url(/images/myImageLeft.gif); background-repeat: no-repeat; background-position: left bottom; }

    Read the article

  • Bash, no-arguments warning, and case decisions

    - by Werner
    Hi, I am learning bash. I would like to do a simple script that, when not arguments given, shows some message. And when I give numers as argument,s depending on the value, it does one thing or another. I would also like to know suggestions for the best online manuals for beginners in bash Thanks

    Read the article

  • Only show link if conditional equals true

    - by Dave Morin
    I want the link to appear only when $data['block'] equals to 1, 3 or 4. Not if it equals to 2 or 5. <td style="font-size:18px;color:#f0cb01;"> <a href="kickcodes.php?id='.$data["block"].'">Reason Codes</a> </td> EDIT while ($data = mysql_fetch_array($query)) { echo ' <tr style="background-color:#576c11;"> <td style="font-size:18px; color:#f0cb01;">'.$data["keyword"].'</td> <td style="font-size:18px;color:#f0cb01;">'.$data["block"].'</td> <td style="font-size:18px;color:#f0cb01;">'.$data["phone"].'</td> <td style="font-size:18px;color:#f0cb01;">'.$data["Reason"].'</td> <td style="font-size:18px;color:#f0cb01;"><a href="kickcodes.php?id='.$data ["block"].'">Kickcodes</a></td>' echo '<td style="font-size:18px;color:#f0cb01;">'; if( $data['block'] == 1 || $data['block'] == 3 || $data['block'] == 4) { echo '<a href="kickcodes.php?id='.$data["block"].'">Reason Codes</a>'; } else { echo '<span>Reason Codes</span>'; // Or echo nothing } echo '</td>';

    Read the article

  • Simulating python's With statement in java

    - by drozzy
    Is there something like Python with context manager in Java? For example say I want to do something like the following: getItem(itemID){ Connection c = C.getConnection(); c.open(); try{ Item i = c.query(itemID); }catch(ALLBunchOfErrors){ c.close(); } c.close(); return c; } where in python I just have: with( C.getConnection().open() as c): Item i = c.query(itemID); return i;

    Read the article

  • Importing specific ( in my case - Themes.ThemesService.ThemesEnabled ) function / procedure in runet

    - by HX_unbanned
    Hi again :) I think subject tells everything ... I need this method only. No need to waste about 6Mb of included unit if only thing I need is one method from that unit ( Themes ) ... I was thinking of UxTheme unit, but it did not contain proper function. What Windows DLL do I need to import and what API function this method stands for? Thanks. P.S. Question is intended to cover not only this particular method, but others too as I will need to do same in MSXML and MM units ...

    Read the article

  • Does table columns increase select statement execution time

    - by paokg4
    I have 2 tables, same structure, same rows, same data but the first has more columns (fields). For example: I select the same 3 fields from both of them (SELECT a,b,c FROM mytable1 and then SELECT a,b,c FROM mytable2) I've tried to run those queries on 100,000 records (for each table) but at the end I got the same execution time (0.0006 sec) Do you know if the number of the columns (and in the end the size of the one table is bigger than the other) has to do something with the query execution time?

    Read the article

  • How to select a subset of results from a select statement

    - by Ankur
    I have a table that stores RDF triples: triples(triple_id, sub_id, pre_id, obj_id) The method (I need to write) will receive an array of numbers which correspond to pre_id values. I want to select all sub_id values that have a corresponding pre_id for all the pre_ids in the array that is passed in. E.g. if I had a single pre_id values passed in... lets call the value passed in preId, I would do: select sub_id from triples where pre_id=preId; However since I have mutliple pre_id values I want to keep iterating through the pre_id values and only keep the sub_id values corresponding to the "triples" records that have both. E.g. image there are five records: triples(1, 34,65,23) triples(2, 31,35,28) triples(3, 32,32,19) triples(4, 12,65,28) triples(5, 76,32,34) If I pass in an array of pre_id values [65,32] then I want to select the first, third, fourth and fifth records. What would I do for that?

    Read the article

  • Select statement to check multiple rows against 2 variables

    - by Duncan Cook
    I have the following table : alertID inspectorID datelive dateread 1 none 2012-11-06 10:36:03.350 NULL 2 none 2012-11-06 10:36:25.043 NULL 3 none 2012-11-06 10:36:42.433 NULL 1 31030 2012-11-06 10:37:19.193 2012-06-11 10:34:47.000 I want to select the alerts that dont have the inspectors ID against it AND where the alert ID doenst match the one that has the inspectorID against it, ie inspector has read alert 1 so i only want it to return alerts 2 & 3 Am using Classic ASP and MS-SQL Cheers

    Read the article

  • Dynamically Insert Variables into DB Table using PreparedStatement

    - by gran_profaci
    I was working with PreparedStatement today and noticed that it used setString() setTimestamp() etc. to insert variables into the DB. I basically have 20 tables each with at least 15 columns and it would not be feasible for me to manuallt write down all the setters. Considering that I have an ArrayList "Vals" which contains all the variables to be inputted in String format (obtained by getString() using PreparedStatement itself), is there any way I can do an insert without using expressly using the Setters? That would save me a lot of time.

    Read the article

  • Mapping integers to types using C++ template fails in a specific case

    - by Shailesh Kumar
    I am attempting to compile the following template based code in VC++ 2005. #include <iostream> using namespace std; /* * T is a template which maps an integer to a specific type. * The mapping happens through partial template specialization. * In the following T<1> is mapped to char, T<2> is mapped to long * and T<3> is mapped to float using partial template specializations */ template <int x> struct T { public: }; template<> struct T<1> { public: typedef char xType; }; template<> struct T<2> { public: typedef long xType; }; template<> struct T<3> { public: typedef float xType; }; // We can easily access the specific xType for a specific T<N> typedef T<3>::xType x3Type; /*! * In the following we are attempting to use T<N> inside another * template class T2<R> */ template<int r> struct T2 { //We can map T<r> to some other type T3 typedef T<r> T3; // The following line fails typedef T3::xType xType; }; int main() { T<1>::xType a1; cout << typeid(a1).name() << endl; T<2>::xType a2; cout << typeid(a2).name() << endl; T<3>::xType a3; cout << typeid(a3).name() << endl; return 0; } There is a particular line in the code which doesn't compile: typedef T3::xType xType; If I remove this line, compilation goes fine and the result is: char long float If I retain this line, compilation errors are observed. main.cpp(53) : warning C4346: 'T<x>::xType' : dependent name is not a type prefix with 'typename' to indicate a type main.cpp(54) : see reference to class template instantiation 'T2<r>' being compiled main.cpp(53) : error C2146: syntax error : missing ';' before identifier 'xType' main.cpp(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int I am not able to figure out how to make sure that T::xType can be treated as a type inside the T2 template. Any help is highly appreciated.

    Read the article

  • Excel VBA: Error Handling with Case Statement

    - by AME
    I am trying to validate a file that is uploaded by the user using the code below. The error handler checks the top row of the uploaded file for three specific column names. If one or more of the column names is not present, the program should return a prompt to the user notifying them which column(s) are missing from the file that they uploaded and then close the file. There are a couple issues with my current VBA code that I am seeking help with: The prompt doesn't specify which column(s) are missing to the user. The error handler is triggered even when all required columns are present in the uploaded file. Code: Sub getworkbook() ' Get workbook... Dim ws As Worksheet Dim filter As String Dim targetWorkbook As Workbook, wb As Workbook Dim Ret As Variant Set targetWorkbook = Application.ActiveWorkbook ' get the customer workbook filter = ".xlsx,.xls" caption = "Please select an input file " Ret = Application.GetOpenFilename(filter, , caption) If Ret = False Then Exit Sub Set wb = Workbooks.Open(Ret) On Error GoTo ErrorLine: 'Check for columns var1 = ActiveSheet.Range("1:1").Find("variable1", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True).Column var2 = ActiveSheet.Range("1:1").Find("variable2", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True).Column var3 = ActiveSheet.Range("1:1").Find("variable3", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True).Column ErrorLine: MsgBox ("The selected file is missing a key data column, please upload a correctly formated file.") If Error = True Then ActiveWorkSheet.Close wb.Sheets(1).Move Before:=targetWorkbook.Sheets("Worksheet2") ActiveSheet.Name = "DATA" End Sub

    Read the article

  • Can I get the full query that a PreparedStatement is about to execute?

    - by ufk
    I'm working with PreparedStatement with MySQL server. example: String myQuery = "select id from user where name = ?"; PreparedStatement stmt = sqlConnection.prepareStatement(myQuery); stmt.setString(1, "test"); stmt.executeQUery(); ResultSet rs = stmt.getResultSet(); How can I receive the full SQL query that is about to be executed on the MySQL server? thanks!

    Read the article

  • Java if/else behaving strangely

    - by Alex
    I'm a real newbie to java, so please excuse me if this is a hopelessly straightforward problem. I have the following from my java game server: // Get input from the client DataInputStream in = new DataInputStream (server.getInputStream()); PrintStream out = new PrintStream(server.getOutputStream()); disconnect=false; while((line = in.readLine().trim()) != null && !line.equals(".") && !line.equals("") && !disconnect) { System.out.println("Received "+line); if(line.equals("h")){ out.println("h"+EOF); // Client handshake System.out.println("Matched 1"); }else if (line.equals("<policy-file-request/>")) { out.println("..."+EOF); // Policy file System.out.println(server.getInetAddress()+": Policy Request"); disconnect=true; System.out.println("Matched 2"); }else if(line.substring(0,3).equals("GET")||line.substring(0,4).equals("POST")){ out.println("HTTP/1.0 200 OK\nServer: VirtuaRoom v0.9\nContent-Type: text/html\n\n..."); // HTML status page disconnect=true; System.out.println("Matched 3"); } else { System.out.println(server.getInetAddress()+": Unknown command, client disconnected."); disconnect=true; System.out.println("Matched else"); } } server.close(); First of all, the client sends an "h" packet, and expects the same back (handshake). However, I want it to disconnect the client when an unrecognised packet is received. For some reason, it responds fine to the handshake and HTML status request, but the else clause is never executed when there's an unknown packet. Thanks

    Read the article

  • Getting the most recent entry per group in a select statement

    - by TheObserver
    I have 3 tables to join to get table1.code, table1.series, table2.entry_date, table3.title1 and I'm trying to get the most recent non null table3.title1 grouped by table1.code and table1.series. select table1.code, table1.series, max(table2.entry_date), table3.Title1 from table3 INNER JOIN table2 ON table3.ID = table2.ID INNER JOIN table1 ON table2.source_code = table1.code where table3.Title1 is not NULL group by table1.code, table1.series, table3.Title1 seems to give me all entries with a non null title1 instead of the most recent one. How should I structure the query to just pick the newest version of Title1 per code & series?

    Read the article

  • How to get this done in mysql?

    - by bala3569
    Consider i have a registartion table and there is field prefLocationId and it contains value like this 1,2,3,2,1,4 and so many.... And i have a table prefLocation which looks like this Id LocationName 1 Chennai 2 Mumbai 3 Kolkatta 4 Delhi and i want to select record of users and show values like Chennai,Mumbai,Kolkatta,Mumbai,Chennai,Delhi and so on...

    Read the article

  • rails belongs_to sql statement using NULL id

    - by Team Pannous
    When paginating through our Phrase table it takes very long to return the results. In the sql logs we see many sql requests which don't make sense to us: Phrase Load (7.4ms) SELECT "phrases".* FROM "phrases" WHERE "phrases"."id" IS NULL LIMIT 1 User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1 These add up significantly. Is there a way to prevent querying against null ids? This is the underlying model: class Phrase < ActiveRecord::Base belongs_to :user belongs_to :response, :class_name => "Phrase", :foreign_key => "next_id" end

    Read the article

  • Java2D: if statement doesn`t work with java.awt.Color

    - by DarkSun
    I have a getPixelColour function: Color getPixelColor(int x, int y) { if(mazeImage == null) System.out.println(":("); int pixel = mazeImage.getRGB(x, y); int red = (pixel & 0x00ff0000) >> 16; int green = (pixel & 0x0000ff00) >> 8; int blue = pixel & 0x000000ff; return new Color(red,green,blue); } For example a pixel is black, and System.out.println(getPixelColor(x,y) + " " + Color.BLACK); writes "java.awt.Color[r=0,g=0,b=0] java.awt.Color[r=0,g=0,b=0]" But getPixelColor(x,y) == Color.BLACK return false. What's wrong with it?

    Read the article

  • Caching result of SELECT statement for reuse in multiple queries

    - by Andrew
    I have a reasonably complex query to extract the Id field of the results I am interested in based on parameters entered by the user. After extracting the relevant Ids I am using the resulting set of Ids several times, in separate queries, to extract the actual output record sets I want (by joining to other tables, using aggregate functions, etc). I would like to avoid running the initial query separately for every set of results I want to return. I imagine my situation is a common pattern so I am interested in what the best approach is. The database is in MS SQL Server and I am using .NET 3.5.

    Read the article

  • Can I use WCF in this case?

    - by BDotA
    We have a third party application that provied its web services to us by ASMX and it is created at the time of .NET 1.1 in the old days we were using VB 6.0 and connected to it by a PocketSOAP, etc... bt now we want to replace the VB 6.0 with C# 3.5 WinApps and still use that third party web services. so I wish to know what are my options for doing this? which one do you recommend and which one has a faster learning curve? Thanks All.

    Read the article

  • How to use prepared statements (named parameters) on a php Class

    - by Mohamed Adib Errifai
    This is my first post here. I've searched in the site, but inforutunaly no matchs. Anyway, i want to know how to use named parameters on a class. so the pdo basic form is something like. $query = $bdd->prepare('SELECT * FROM table WHERE login = :login AND pww = :pww'); $query->execute(array('login' => $login, 'pww' => $pww)); and i want to integrate this on a class regardless of the number of parameters. Currently, i have this code http://pastebin.com/kKgSkaKt and for parameters, i use somethings like ( which is wrong and vulnerable to injection ) require_once 'classes/Mysql.class.php'; $mysql = new Mysql(); $sql = 'SELECT * FROM articles WHERE id = '.$_GET['id'].' LIMIT 1'; $data = $mysql->select($sql); And Thanks.

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >