Daily Archives

Articles indexed Wednesday April 14 2010

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

  • How to ste default name to GtkComboBox?

    - by PP
    Hello, I want to set my GtkComboBox to have some default name on it as follows: +---------------+---+ | Image Options | X | +---------------+---+ | Image Option 1 | +-------------------+ | Image Option 2 | +-------------------+ | Image Option 3 | +-------------------+ Thanks, PP.

    Read the article

  • .NET Hashtable clone

    - by thelost
    Given the following code: Hashtable main = new Hashtable(); Hashtable inner = new Hashtable(); ArrayList innerList = new ArrayList(); innerList.Add(1); inner.Add("list", innerList); main.Add("inner", inner); Hashtable second = (Hashtable)main.Clone(); ((ArrayList)((Hashtable)second["inner"])["list"])[0] = 2; Why does the value within the array change from 1 to 2 in the "main" Hashtable, as the change was made on a clone ?

    Read the article

  • How reliable are URIs like /index.php/seo_path

    - by Boldewyn
    I noticed, that sometimes (especially where mod_rewrite is not available) this path scheme is used: http://host/path/index.php/clean_url_here --------------------------^ This seems to work, at least in Apache, where index.php is called, and one can query the /clean_url_here part via $_SERVER['PATH_INFO']. PHP even kind of advertises this feature. Also, e.g., the CodeIgniter framework uses this technique as default for their URLs. The question: How reliable is the technique? Are there situations, where Apache doesn't call index.php but tries to resolve the path? What about lighttpd, nginx, IIS, AOLServer? A ServerFault question? I think it's got more to do with using this feature inside PHP code. Therefore I ask here.

    Read the article

  • RemoteRef.invoke implementation

    - by phill
    Just finished a basic implementation of RMI for a class project, and now I am interested in how it is actually done. Sun is kind enough to provide the source for the majority of the Java classes with the JDK, however an implementation of RemoteRef doesn't seem to be there. I have the source for the interface RemoteRef along with the ServerRef interface and one implementation, ProxyRef, which just calls invoke on another RemoteRef, but none of the classes that implement actual code, ActivatableRef or UnicastRef for example, are included. I mention ActivatableRef and UnicastRef because I believe these have proper implementations of invoke thanks to the wonder that is Eclipse and its class file editor showing that it is more then just a method declaration. Although I can tell that it is more then a declaration, I can't get much more out of it, building a string here, throw exception there, but nothing about the process that is taking place to send the remote method call. Would anyone here happen to know where I can get this code, or if its even available? If it is not available, would anyone happen to know what the message being sent to the server looks like? phill

    Read the article

  • Mac:Upgrade from 10.5.8 to Snow leopard 10.6?

    - by user187532
    Hi, I would like to upgrade my mac from 10.5.8 to Snow leopard 10.6. I searched around the google but didn't get any clear info from Apple sites. Is it possible? Are there any steps to follow this from Apple sites? Is there any possibility to do it without wiping the existing software and files? Thank you. I appreciate your helps.

    Read the article

  • how to include .pl (PERL) file in PHP

    - by dexter
    i have two pages one in php(index.php) and another one in Perl(dbcon.pl). basically i want my php file to show only the UI and all the data operations would be done in Perl file. i have tried in index.pl <?php include("dbcon.pl");?> <html> <br/>PHP</br> </html> and dbcon.pl has #!/usr/bin/perl use strict; use warnings; use DBI; use CGI::Simple; my $cgi = CGI::Simple->new; my $dsn = sprintf('DBI:mysql:database=%s;host=%s','dbname','localhost'); my $dbh = DBI->connect($dsn,root =>'',{AutoCommit => 0,RaisError=> 0}); my $sql= "SELECT * FROM products"; my $sth =$dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while (my @row = $sth->fetchrow_array){ print $cgi->header, <<html; <div>&nbsp;@row[0]&nbsp;@row[1]&nbsp;@row[2]&nbsp;@row[3]&nbsp;@row[4]</div> html } but when i run index.php in browser it prints all the code in dbcon.pl file instead of executing it how to overcome this problem? note: i am running this in windows environment is there any other way to do this?

    Read the article

  • Call a void* as a function without declaring a function pointer

    - by ToxIk
    I've searched but couldn't find any results (my terminology may be off) so forgive me if this has been asked before. I was wondering if there is an easy way to call a void* as a function in C without first declaring a function pointer and then assigning the function pointer the address; ie. assuming the function to be called is type void(void) void *ptr; ptr = <some address>; ((void*())ptr)(); /* call ptr as function here */ with the above code, I get error C2066: cast to function type is illegal in VC2008 If this is possible, how would the syntax differ for functions with return types and multiple parameters?

    Read the article

  • Efficient way to update all rows in a table

    - by m_pGladiator
    Hi, I have a table with a lot of records (could be more than 500 000 or 1 000 000). I added a new column in this table and I need to fill a value for every row in the column, using the corresponding row value of another column in this table. I tried to use separate transactions for selecting every next chunk of 100 records and update the value for them, but still this takes hours to update all records in Oracle10 for example. What is the most efficient way to do this in SQL, without using some dialect-specific features, so it works everywhere (Oracle, MSSQL, MySQL, PostGre etc.)?

    Read the article

  • Sorting Android ListView

    - by aeoth
    I'm only starting with Android dev, and while the Milestone is a nice device Java is not my natural language and I'm struggling with both the Google docs on Android SDK, Eclipse and Java itself. Anyway... I'm writing a microblog client for Android to go along with my Windows client (MahTweets). At the moment I've got Tweets coming and going without fail, the problem is with the UI. The initial call will order items correctly (as in highest to lowest) 3 2 1 When a refresh is made 3 2 1 6 5 4 After the tweets are processed, I'm calling adapter.notifyDataSetChanged(); Initially I thought that getItem() on the Adapter needed to be sorted (and the code below is what I ended up with), but I'm still not having any luck. public class TweetAdapter extends BaseAdapter { private List<IStatusUpdate> elements; private Context c; public TweetAdapter(Context c, List<IStatusUpdate> Tweets) { this.elements = Tweets; this.c = c; } public int getCount() { return elements.size(); } public Object getItem(int position) { Collections.sort(elements, new IStatusUpdateComparator()); return elements.get(position); } public long getItemId(int id) { return id; } public void Remove(int id) { notifyDataSetChanged(); } public View getView(int position, View convertView, ViewGroup parent) { RelativeLayout rowLayout; IStatusUpdate t = elements.get(position); rowLayout = t.GetParent().GetUI(t, parent, c); return rowLayout; } class IStatusUpdateComparator implements Comparator { public int compare(Object obj1, Object obj2) { IStatusUpdate update1 = (IStatusUpdate)obj1; IStatusUpdate update2 = (IStatusUpdate)obj2; int result = update1.getID().compareTo(update2.getID()); if (result == -1) return 1; else if (result == 1) return 0; return result; } } } Is there a better way to go about sorting ListViews in Android, while still being able to use the LayoutInflater? (rowLayout = t.GetParent().GetUI(t, parent, c) expands the UI to the specific view which the microblog implementation can provide)

    Read the article

  • How classes are secure than structures ?

    - by Asad Hanif
    Structure's member are public by default ans class's members are private by default. We can access private data members through a proper channel (using member function). If we have access to member functions we can read/write data in private data member, so how it is secure...we are accessing it and we are changing data too.....

    Read the article

  • - Default value of variables at the time of declaration -

    - by gotye
    Hey guys, I was wondering what was the default values of variables before I intialize them .. For example, if I do : //myClass.h BOOL myBOOL; // default value ? NSArray *myArray; // default value ? NSUInteger myInteger; // default value ? Some more examples here : //myClass.m // myArray is not initialized, only declared in .h file if ([myArray count] == 0) { // TRUE or FALSE ? // do whatever } More generally, what is returned when I do : [myObjectOnlyDeclaredAndNotInitialized myCustomFunction]; Thank you for your answers. Gotye.

    Read the article

  • Using ViewModel Pattern with MVC 2 Strongly Typed HTML Helpers

    - by Brettski
    I am working with ASP.NET MVC2 RC and can't figure out how to get the HTML helper, TextBoxfor to work with a ViewModel pattern. When used on an edit page the data is not saved when UpdateModel() is called in the controller. I have taken the following code examples from the NerdDinner application. Edit.aspx <%@ Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NerdDinner.Models.DinnerFormViewModel>" %> ... <p> // This works when saving in controller (MVC 1) <label for="Title">Dinner Title:</label> <%= Html.TextBox("Title", Model.Dinner.Title) %> <%= Html.ValidationMessage("Title", "*") %> </p> <p> // This does not work when saving in the controller (MVC 2) <label for="Title">Dinner Title:</label> <%= Html.TextBoxFor(model => model.Dinner.Title) %> <%= Html.ValidationMessageFor(model=> model.Dinner.Title) %> </p> DinnerController // POST: /Dinners/Edit/5 [HttpPost, Authorize] public ActionResult Edit(int id, FormCollection collection) { Dinner dinner = dinnerRepository.GetDinner(id); if (!dinner.IsHostedBy(User.Identity.Name)) return View("InvalidOwner"); try { UpdateModel(dinner); dinnerRepository.Save(); return RedirectToAction("Details", new { id=dinner.DinnerID }); } catch { ModelState.AddModelErrors(dinner.GetRuleViolations()); return View(new DinnerFormViewModel(dinner)); } } When the original helper style is used (Http.TextBox) the UpdateModel(dinner) call works as expected and the new values are saved. When the new (MVC2) helper style is used (Http.TextBoxFor) the UpdateModel(dinner) call does not update the values. Yes, the current values are loaded into the edit page on load. Is there something else which I need to add to the controller code for it to work? The new helper works fine if I am just using a model and not a ViewModel pattern. Thank you.

    Read the article

  • Android:How to display images from the in a ListView?

    - by Maxood
    Android:How to display images from the web in a ListView?I have the following code to display image from a URL in an ImageView: import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import android.app.ListActivity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.widget.ImageView; public class HttpImgDownload extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Bitmap bitmap = // DownloadImage( // "http://www.streetcar.org/mim/cable/images/cable-01.jpg"); DownloadImage( "http://s.twimg.com/a/1258674567/images/default_profile_3_normal.png"); ImageView img = (ImageView) findViewById(R.id.img); img.setImageBitmap(bitmap); } private InputStream OpenHttpConnection(String urlString) throws IOException { InputStream in = null; int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); if (!(conn instanceof HttpURLConnection)) throw new IOException("Not an HTTP connection"); try{ HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET"); httpConn.connect(); response = httpConn.getResponseCode(); if (response == HttpURLConnection.HTTP_OK) { in = httpConn.getInputStream(); } } catch (Exception ex) { throw new IOException("Error connecting"); } return in; } private Bitmap DownloadImage(String URL) { Bitmap bitmap = null; InputStream in = null; try { in = OpenHttpConnection(URL); bitmap = BitmapFactory.decodeStream(in); in.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } return bitmap; } } Now how can i display images in an array in a listview? Here's how i want to display the images: http://sites.google.com/site/androideyecontact/_/rsrc/1238086823282/Home/android-eye-contact-lite/eye_contact-list_view_3.png?height=420&width=279

    Read the article

  • What are the names of network interfaces on the Motorola CLIQ XT?

    - by RS
    The network interfaces on Android interfaces are listed as directories in the file system in /sys/class/net/. For most Android devices the network interface for gprs traffic is called rmnet0 and for Wi-Fi it's usually eth0 or tiwlan0. I suspect that the cell interface for the Motorola CLIQ XT is rmnet0, but I would like to have this confirmed + know the name of the Wi-Fi interface. Also it would be good to know the device id for this model. This is the value available as android.os.Build.DEVICE in the Java SDK. (E.g. T-Mobile G1 uses dream, Samsung Galaxy uses GT-I7500, and Motorolda Droid uses sholes.)

    Read the article

  • china and gmail attachs -

    - by doug
    "We have evidence to suggest that a primary goal of the attackers was accessing the Gmail accounts of Chinese human rights activists. Based on our investigation to date we believe their attack did not achieve that objective. Only two Gmail accounts appear to have been accessed, and that activity was limited to account information (such as the date the account was created) and subject line, rather than the content of emails themselves.” [source] I don't know much about how internet works, but as long the chines gov has access to the chines internet providers servers, why do they need to hack gmail accounts? I assume that i don't understand how submitting/writing a message(from user to gmail servers) works, in order to be sent later to the other email address. Who can tell me how submitting a message to a web form works?

    Read the article

  • Oracle 11g RDBMS Enterprise Edition download?

    - by Oliver Michels
    I am looking for a URL where i can download the Enterprise Edition of Oracle 11g. I know that i can download the Standard Edition of 11g at Oracle's technet, but as i would like to use some of those enterprise options, which are disabled in standard, i would rather reinstall the enterprise software on our development server.

    Read the article

  • Perl Strip Comments with Regex Unique Request

    - by YoDar
    Hello, I'm running a code that read files, do some parsing but need to ignore all comments. There are good explanations how to conduct it. like this link $/ = undef; $_ = <>; s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse; print; My first problem is that after run this line $/ = undef; my code doesn't work properly. Actually, I don't know what it does. But if I could turn it back after ignoring all comments it will be helpful. In general, What is the useful way to ignore all comments without changing the rest of the code ? Thanks, YoDar

    Read the article

  • SQL Server: Are temp tables or unions better?

    - by Jonathan Allen
    Generally speaking, for combining a lot of data is it better to use a temp table/temp variable as a staging area or should I just stick to "UNION ALL"? Assumptions: No further processing is needed, the results are sent directly to the client. The client waits for the complete recordset, so streaming results isn't necessary.

    Read the article

  • How do I associate the Enter key with a button on an aspx page?

    - by Xaisoft
    I have an asp.net ascx control file and I have put the control on an aspx page. The aspx page has a button in which when I press enter on the keyboard, I want it to fire the event handler for the button. Is there a way to set this? I am using a master page with a button already on it, so now when I press the enter key, the event handler for that button fires.

    Read the article

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