Daily Archives

Articles indexed Tuesday May 25 2010

Page 16/118 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • SSH into Ubuntu Linux on a box without a static IP address

    - by Steven Xu
    Basically, how do I do it? I'd like to connect to my home computer from work, but my internet is routed through my apartment building's network, so I don't have the static IP address I'm accustomed to having. How do I go about accessing my home computer through SSH (I'll be using Putty at work if it matters) if my home computer doesn't have a static IP address?

    Read the article

  • Best approach to update a control after an Ajax request?

    - by Cuga
    I have a webpage that fires off an Ajax request which stores some data to a database and I want to update the webpage so that the user can see their changes have been submitted. There are at least 3 ways I can think of accomplishing this: Immediately update the webpage with plain JavaScript by grabbing the contents of the user's inputted text and immediately inserting it where it belongs. Have the ajax call return the stored text as the response, grab the response, and then insert this text where it belongs on the page using JavaScript Have the ajax call return a flag (say, true for successful db write, false otherwise), and if the flag is true, use JavaScript to grab the user's contents from the input control and insert it where it belongs elsewhere on the page Or another method not mentioned...? I don't mean this to be subjective, I just don't know which would be the best method to apply. My instinct tells me to go with the third item (return a flag, then update the field). Is this the best way? Thanks

    Read the article

  • How to handle dynamic site localizations?

    - by James Simpson
    I've got a website that is currently all in english. It is an online game, so it has a bunch of different pages with static text, as well as a lot of content in a database. I am trying to expand more globally and am gearing up to release some localizations of the site. However, I'm not sure about the best way to go about setting this up so that it'll be the easiest for me to manage and the easiest for users to use as well. Should I be storing the translated texts in a database, or should this be done in a completely different way? If it matters at all, the site is written in PHP and uses MySQL.

    Read the article

  • Validations for a has_many/belongs_to relationship

    - by Craig Walker
    I have a Recipe model which has_many Ingredients (which in turn belongs_to Recipe). I want Ingredient to be existent dependent on Recipe; an Ingredient should never exist without a Recipe. I'm trying to enforce the presence of a valid Recipe ID in the Ingredient. I've been doing this with a validates :recipe, :presence => true (Rails 3) statement in Ingredient. This works fine if I save the Recipe before adding an Ingredient to it's ingredients collection. However, if I don't have explicit control over the saving (such as when I'm creating a Recipe and its Ingredients from a nested form) then I get an error: Ingredients recipe can't be blank I can get around this simply by dropping the presence validation on Ingredient.recipe. However, I don't particularly like this, as it means I'm working without a safety net. What is the best way to enforce existence-dependence in Rails? Things I'm considering (please comment on the wisdom of each): Adding a not-null constraint on the ingredients.recipe_id database column, and letting the database do the checking for me. A custom validation that somehow checks whether the Ingredient is in an unsaved recipe's ingredient collection (and thus can't have a recipe_id but is still considered valid).

    Read the article

  • Why I cannot access the properties of my Custom ComboBox

    - by BDotA
    Ok, I created a windows control project....dropped a comboBox on it, wrote some custom code that I wanted on its event ( Text Changed event, etc) ... I can also compile it and drop it on a new WinForms App... good. But in my sample WinForms app that I want to use it, I cannot access the properties of that combo box.. it does not list them .. properties like SelectedItems, etc... what Am I doing wrong? this is my first time creating a custom control tho. Thanks all

    Read the article

  • nginx start failing, says error.log doesn't exist

    - by Blankman
    I structured my sites like: /home/www/domain.com/public,private, log, backup In the log folder, I created a blank error.log and access.log. My nginx file in sites-available for the domain looks like: server { access_log /home/www/domain1.com/log/access.log; error_log /home/www/domain1.com/log/error.log; } Trying to start nginx it says: starting nginx: the config file /etc/nginx/nginx/conf syntax is ok [emrg] open() ".../access.log" failed (2: no such file or directory) Is this a permission issue?

    Read the article

  • Multi-select menu in bash script

    - by am2605
    I'm a bash newbie but I would like to create a script in which I'd like to allow the user to select multiple options from a list of options. Essentially what I would like is something similar to the example below: #!/bin/bash OPTIONS="Hello Quit" select opt in $OPTIONS; do if [ "$opt" = "Quit" ]; then echo done exit elif [ "$opt" = "Hello" ]; then echo Hello World else clear echo bad option fi done (sourced from http://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.html#ss9.1) However my script would have more options, and I'd like to allow multiples to be selected. So somethig like this: 1) Option 1 2) Option 2 3) Option 3 4) Option 4 5) Done Having feedback on the ones they have selected would also be great, eg plus signs next to ones they ahve already selected. Eg if you select "1" I'd like to page to clear and reprint: 1) Option 1 + 2) Option 2 3) Option 3 4) Option 4 5) Done Then if you select "3": 1) Option 1 + 2) Option 2 3) Option 3 + 4) Option 4 5) Done Also, if they again selected (1) I'd like it to "deselect" the option: 1) Option 1 2) Option 2 3) Option 3 + 4) Option 4 5) Done And finally when Done is pressed I'd like a list of the ones that were selected to be displayed before the program exits, eg if the current state is: 1) Option 1 2) Option 2 + 3) Option 3 + 4) Option 4 + 5) Done Pressing 5 should print: Option 2, Option 3, Option 4 and the script terminate. So my question - is this possible in bash, and if so is anyone able to provide a code sample? Any advice would be much appreciated.

    Read the article

  • Can't Install msysgit/tortoisegit

    - by Jay
    I ran msysGit-netinstall-1.7.0.2-preview20100407-2.exe.   (http://code.google.com/p/msysgit/downloads/list) Then I ran TortoiseGit-1.4.4.0-64bit.msi.   (http://code.google.com/p/tortoisegit/downloads/list) msysgit was installed in C:\ TortioseGit appears to have been installed in C:\Program Files\TortoiseGit I have: "Git Clone..." "Git Create repository here" "TortoiseGit" in Explorer context menu. When I try to clone, I get "git have not installed" [sic]. I have tried setting the MSysGit path, in the TortioseGit settings, to everything imaginable. Nothing works. Neither C:\Program Files or C:\Program Files (x86) have a Git folder. The git command gives "command not found" from both cmd.exe and bash (that msysgit installed) I don't not see msysgit in - Control Panel - Programs - Program Features, but I do see TortioseGit in there. I would like a procedure for verifying that msysgit is properly installed. A procedure for uninstalling msysgit would be an added bonus. I would like a procedure for getting TortoiseGit to work. I am running Windows 7 on a MacBook Pro.

    Read the article

  • How to change a grouped UITableView cell's background to black (or non-white)?

    - by Meltemi
    Just want to make sure I'm not overlooking something obvious... It seems like it should be trivial to set the background color (black is fine) of a UITableView's cell to something other than white or completely transparent so that you can display your data with white text. However, with my attempts I lose the corners on my grouped table view and it all looks like crap. I've seen & understand the methods described by Matt Gallagher about customizing TableView cells with exotic gradients, etc. but wanted to be certain before heading down that path...

    Read the article

  • How can I map UIDs to user names using Perl library functions?

    - by Mike
    I'm looking for a way of mapping a uid (unique number representing a system user) to a user name using Perl. Please don't suggest greping /etc/passwd :) Edit As a clarification, I wasn't looking for a solution that involved reading /etc/passwd explicitly. I realize that under the hood any solution would end up doing this, but I was searching for a library function to do it for me.

    Read the article

  • Making CSV from PHP - Carriage return won't work

    - by DMin
    Seems like a fairly simple issue but can't get it to work. I am getting the user to download a csv file(which works fine). Basically I can't get the carriage return to work. header("Content-type: text/x-csv"); header("Content-Disposition: attachment; filename=search_results.csv"); echo '"Name","Age"\n"Chuck Norris","70"'; exit; Result : Name     Age\n"Chuck Norris"    70 Tried : echo '"Name","Age",\n,"Chuck Norris","70"'; Result : Name     Age    \n    Chuck Norris    70 And echo '"Name","Age",\n\r,"Chuck Norris","70"'; Result : Name     Age    \n\r    Chuck Norris    70 Know what's going wrong?

    Read the article

  • Interface Builder layout ViewController with its own nib

    - by Sean Clark Hess
    I would like to be able to decide where a sub view is placed, when that view is controlled by its own view controller. This happens frequently on the iPad when you have a semi-complicated view that doesn't fill the entire screen. So, imagine that I want the sub view controller's nib to decide its own width, components, connections, etc, while the parent nib would decide where that view/nib would be placed. I'd really like to lay it out visually instead of programatically. How can I?

    Read the article

  • How to create Query syntax for multiple DataTable for implementing IN operator of Sql Server

    - by Shantanu Gupta
    I have fetched 3-4 tables by executing my stored procedure. Now they resides on my dataset. I have to maintain this dataset for multiple forms and I am not doing any DML operation on this dataset. Now this dataset contains 4 tables out of which i have to fetch some records to display data. Data stored in tables are in form of one to many relationship. i.e. In case of transactions. N records per record. Then these N records are further mapped to M records of 3rd table. Table 1 MAP_ID GUEST_ID DEPARTMENT_ID PARENT_ID PREFERENCE_ID -------------------- -------------------- -------------------- -------------------- -------------------- 19 61 1 1 5 14 61 1 5 15 15 61 2 4 10 18 61 2 13 23 17 61 2 20 26 16 61 40 40 41 20 62 1 5 14 21 62 1 5 15 22 62 1 6 16 24 62 2 3 4 23 62 2 4 9 27 62 2 13 23 25 62 2 20 24 26 62 2 20 25 28 63 1 1 5 29 63 1 1 8 34 63 1 5 15 30 63 2 4 10 33 63 2 4 11 31 63 2 13 23 32 63 40 40 41 35 65 1 NULL 1 36 65 1 NULL 1 38 68 2 13 22 37 68 2 20 25 39 68 2 23 27 40 92 1 NULL 1 Table 2 Department_ID Department_Name Parent_Id Parent_Name -------------------- ----------------------- --------------- ---------------------------------------------------------------------------------- 1 Food 1, 5, 6 Food, North Indian, South Indian 2 Lodging 3, 4, 13, 20, 23 Room, Floor, Non Air Conditioned, With Balcony, Without Balcony 40 New 40 SubNew TABLE 3 Parent_Id Parent_Name Preference_ID Preference_Name -------------------- ----------------------------------------------- ----------------------- ------------------- NULL NULL NULL NULL 1 Food 5, 8 North Indian, Italian 3 Room 4 Floor 4 Floor 9, 10, 11 First, Second, Third 5 North Indian 14, 15 X, Y 6 South Indian 16 Dosa 13 Non Air Conditioned 22, 23 With Balcony, Without Balcony 20 With Balcony 24, 25, 26 Mountain View, Ocean View, Garden View 23 Without Balcony 27 Mountain View 40 New 41 SubNew I have these 3 tables that are related in some fashion like this. Table 1 will be the master for these 2 tables i.e. table 2 and table 3. I need to query on them as SELECT Department_Id, Department_Name, Parent_Name FROM Table2 WHERE Department_Id in ( SELECT Department_Id FROM Table1 WHERE guest_id=65 ) SELECT Parent_Id, Parent_Name, Preference_Name FROM Table3 WHERE PARENT_ID in ( SELECT parent_id FROM Table1 WHERE guest_id=65 ) Now I need to use these queries on DataTables. So I am using Query Syntax for this and reached up to this point. var dept_list= from dept in DtMapGuestDepartment.AsEnumerable() where dept.Field<long>("PK_GUEST_ID")==long.Parse(63) select dept; This should give me the list of all departments that has guest id =63 Now I want to select all departments_name and parent_name from Table 2 where guest_id=63 i.e. departments that i fetched above. This same case will be followed for Table3. Please suggest how to do this. Thanks for keeping up patience for reading my question.

    Read the article

  • PHP session values lost after redirect on one script but preserved after redirection on another.

    - by Iuhiz
    On my registration script i have: // Save registration information into the database // Set sessions $_SESSION['var1'] = 'somevalue'; $_SESSION['var2'] = 'anothervalue'; header('Location: /somewhere'); exit(); Then on my login script i have: // Check if user provided correct login credentials if (correct) { $_SESSION['var1'] = 'somevalue'; $_SESSION['var2'] = 'anothervalue'; } header('Location: /somewhere'); exit(); What happened is that the session variables were lost after the header redirect in the registration script but they were preserved after the redirect in the login script. I've checked session_id() at both pages and they have the same value, included session_start() at the top of every page and basically tried the solutions to this common problem found on Stackoverflow but somehow nothing seemed to work. I'm beginning to wonder if it is something to do with my server configuration instead of my code.

    Read the article

  • Silverlight themee error: Cannot find a Resource with the Name/Key System.Windows.Controls.Primitive

    - by Mark
    I have got an(other) error while trying to upgrade our large project to SL4. I didn't write the original theme and my theme knowlege isn't great. In my SL3 app I have a datagrid themed like so: <!--Datagrid Style--> <Style TargetType="datagrid:DataGrid"> <Setter Property="RowHeaderStyle" Value="{StaticResource System.Windows.Controls.Primitives.DataGridRowHeader}"/> <Setter Property="RowBackground" Value="Transparent"/> <Setter Property="etc" Value="..."/> </Style> When I upgrade to SL 4 the first line in the XAML above gives a runtime error: Cannot find a Resource with the Name/Key System.Windows.Controls.Primitives.DataGridRowHeader Should I handle this differently in SL4? TIA Mark Example showing error: http://walkersretreat.co.nz/files/SilverlightApplication1.zip

    Read the article

  • Ownership regarding to returned Quartz objects

    - by huggie
    I have recently asked about autoreleasing a returned quartz object: http://stackoverflow.com/questions/2819548/autorelease-for-cgmutablepathref Dave DeLong answered my question that there is no autorelease for quartz (or any NS foundation objects) and I should use the Create Rule. However the naming convention on the document says, The Core Foundation naming conventions, in particular use of the word “create”, only apply to C functions that return Core Foundation objects. Naming conventions for Objective-C methods are governed by the Cocoa conventions, irrespective of whether the method returns a Core Foundation or Cocoa object. By this account since my function is a message in an objective C object it doesn't seem proper to name it createSomething. I still want to return this object. What's the best way to approach this? Should I use the Get Rule and then have the caller explicitly retain it? But this is not within Cocoa convention. What's the proper way to handle this?

    Read the article

  • javascript instanceof get type from string name

    - by dcp
    Let's say I have this (assume the name variable is "receiver"): if (!(receiver instanceof com.HTMLReceiver)) { throw new com.IllegalArgumentException( name + " is not an instance of com.HTMLReceiver."); } I'd like to factor this code out into a common method so I could call it like this: Helper.checkInstance(receiver, "com.HTMLReceiver"); But I don't know of a way to convert the com.HTMLReceiver from a string to its actual type so I can use instanceof on it. Is there a way?

    Read the article

  • website session not set

    - by Matt
    Hello, I'm kind of a website development nub so bear with me. My problem is that the website php session doesn't seem to be set when I log in to my website. After ensuring that the username and password are correct, I have the following simple code: $_SESSION['username'] = $myusername; $_SESSION['password'] = $mypassword; session_start(); Content that should display after logging in is not displayed. Thanks in advance, Matt

    Read the article

  • multiple parameters type

    - by romerun
    I'm trying to write something like this: type 'a 'b xxx = {aaa: 'a: bbb: 'b: ccc: int};; It does not compile. Is it just syntax error, or they don't allow multiple paramters on type ? Then why ?

    Read the article

  • selecting among duplicated rows in VBA _updated

    - by Elaine Kuo
    I wanna select one row of each duplicated SIDs in a field below. (an attribute table of a shape file) The priority is R S = I 0 Therefore, among SID 87, FID1 will be selected. (SID 88, STATUS will be S+I) (SID 89, FID 6 will be chosen) (SID 90, deleting FID 9 or 10) Please kindly advise VBA cord to run the selection and thanks. FID SID STATUS 1 87 R 2 87 O 3 88 I 4 88 S 5 89 I 6 89 R 7 89 I 8 89 S 9 90 S 10 90 S

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >