Daily Archives

Articles indexed Friday April 23 2010

Page 3/115 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • jQuery slideDown: Parent element doesn't expand?

    - by bobsoap
    Hi, This issue occurs in our beloved Internet Explorer 7: I have a list of items, each with a hidden child div. When user clicks the "expand" button in any list item, the hidden div will expand downwards and push all content beneith it lower. This works just as it should in FF, Chrome, IE8 - but IE7 will not expand the parent element along with its children. This is noticeable because the top-most parent container has an absolutely positioned image at the very bottom (yea... rounded corners) - that doesn't get pushed down when the content expands. I'm guessing that's because of the absolute positioning... Just wondering whether I should attempt to code up some huge workaround in jQuery just for that (assuming I'm able to), or if this is a known issue of some sort. My HTML: <div id="container"> <ul> <li>Click here to expand <div class="hide"></div> </li> <li>Click here to expand <div class="hide"></div> </li> <li>Click here to expand <div class="hide"></div> </li> </ul> <div id="containerbottom"></div> </div> The CSS: #container { position:relative; } #container #containerbottom { position:absolute; bottom:0px; left:0px; } The jQuery is pretty much your everyday slide function: $('ul li').click(function() { $(this).children('.hide').slideDown(200); }); Any ideas?

    Read the article

  • Adding a second table in a database

    - by MB
    Hi everyone. I used the code provided by the NoteExample from the developers doc to create a database. Now I want to add a second table to store different data. I simply "copied" the given code, but when I try to insert into the new table I get an error saying: "0ERROR/Database(370): android.database.sqlite.SQLiteException: no such table: routes: , while compiling: INSERT INTO routes(line, arrival, duration, start) VALUES(?, ?, ?, ?);" Can someone please take quick look at my DbAdapter class and give me a hint or a solution? I really don't see any problem. my code compiles without any errors.. thanks in advance! CODE: import static android.provider.BaseColumns._ID; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DbAdapter { public static final String KEY_FROM = "title"; public static final String KEY_TO = "body"; public static final String KEY_ROWID = "_id"; public static final String KEY_START = "start"; public static final String KEY_ARRIVAL = "arrival"; public static final String KEY_LINE = "line"; public static final String KEY_DURATION = "duration"; private static final String DATABASE_NAME = "data"; private static final String DATABASE_NOTESTABLE = "notes"; private static final String DATABASE_ROUTESTABLE = "routes"; private static final String TAG = "DbAdapter"; private DatabaseHelper mDbHelper; private SQLiteDatabase mDb; /** * Database creation sql statement */ private static final String DATABASE_CREATE_NOTES = "create table notes (_id integer primary key autoincrement, " + "title text not null, body text not null)"; private static final String DATABASE_CREATE_ROUTES = "create table routes (_id integer primary key autoincrement, " + "start text not null, arrival text not null, " + "line text not null, duration text not null);"; private static final int DATABASE_VERSION = 2; private final Context mCtx; private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE_NOTES); Log.d(TAG, "created notes table"); db.execSQL(DATABASE_CREATE_ROUTES); //CREATE LOKALTABLE db.execSQL("CREATE TABLE " + DATABASE_ROUTESTABLE + " " + "(" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_START + " TEXT NOT NULL, " + KEY_ARRIVAL + " TEXT NOT NULL, " + KEY_LINE + " TEXT NOT NULL, " + KEY_DURATION + " TEXT NOT NULL"); Log.d(TAG, "created routes table"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS notes"); onCreate(db); } } /** * Constructor - takes the context to allow the database to be * opened/created * * @param ctx the Context within which to work */ public DbAdapter(Context ctx) { this.mCtx = ctx; } /** * Open the notes database. If it cannot be opened, try to create a new * instance of the database. If it cannot be created, throw an exception to * signal the failure * * @return this (self reference, allowing this to be chained in an * initialization call) * @throws SQLException if the database could be neither opened or created */ public DbAdapter open() throws SQLException { mDbHelper = new DatabaseHelper(mCtx); mDb = mDbHelper.getWritableDatabase(); return this; } public void close() { mDbHelper.close(); } /** * Create a new note using the title and body provided. If the note is * successfully created return the new rowId for that note, otherwise return * a -1 to indicate failure. * * @param title the title of the note * @param body the body of the note * @return rowId or -1 if failed */ public long createNote(String title, String body) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_FROM, title); initialValues.put(KEY_TO, body); return mDb.insert(DATABASE_NOTESTABLE, null, initialValues); } /** * Create a new route using the title and body provided. If the route is * successfully created return the new rowId for that route, otherwise return * a -1 to indicate failure. * * @param start the start time of the route * @param arrival the arrival time of the route * @param line the line number of the route * @param duration the routes duration * @return rowId or -1 if failed */ public long createRoute(String start, String arrival, String line, String duration){ ContentValues initialValues = new ContentValues(); initialValues.put(KEY_START, start); initialValues.put(KEY_ARRIVAL, arrival); initialValues.put(KEY_LINE, line); initialValues.put(KEY_DURATION, duration); return mDb.insert(DATABASE_ROUTESTABLE, null, initialValues); } /** * Delete the note with the given rowId * * @param rowId id of note to delete * @return true if deleted, false otherwise */ public boolean deleteNote(long rowId) { return mDb.delete(DATABASE_NOTESTABLE, KEY_ROWID + "=" + rowId, null) > 0; } /** * Return a Cursor over the list of all notes in the database * * @return Cursor over all notes */ public Cursor fetchAllNotes() { return mDb.query(DATABASE_NOTESTABLE, new String[] {KEY_ROWID, KEY_FROM, KEY_TO}, null, null, null, null, null); } /** * Return a Cursor over the list of all routes in the database * * @return Cursor over all routes */ public Cursor fetchAllRoutes() { return mDb.query(DATABASE_ROUTESTABLE, new String[] {KEY_ROWID, KEY_START, KEY_ARRIVAL, KEY_LINE, KEY_DURATION}, null, null, null, null, null); } /** * Return a Cursor positioned at the note that matches the given rowId * * @param rowId id of note to retrieve * @return Cursor positioned to matching note, if found * @throws SQLException if note could not be found/retrieved */ public Cursor fetchNote(long rowId) throws SQLException { Cursor mCursor = mDb.query(true, DATABASE_NOTESTABLE, new String[] {KEY_ROWID, KEY_FROM, KEY_TO}, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } /** * Return a Cursor positioned at the route that matches the given rowId * * @param rowId id of route to retrieve * @return Cursor positioned to matching route * @throws SQLException if note could not be found/retrieved */ public Cursor fetchRoute(long rowId) throws SQLException { Cursor mCursor = mDb.query(true, DATABASE_ROUTESTABLE, new String[] {KEY_ROWID, KEY_START, KEY_ARRIVAL, KEY_LINE, KEY_DURATION}, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } /** * Update the note using the details provided. The note to be updated is * specified using the rowId, and it is altered to use the title and body * values passed in * * @param rowId id of note to update * @param title value to set note title to * @param body value to set note body to * @return true if the note was successfully updated, false otherwise */ public boolean updateNote(long rowId, String title, String body) { ContentValues args = new ContentValues(); args.put(KEY_FROM, title); args.put(KEY_TO, body); return mDb.update(DATABASE_NOTESTABLE, args, KEY_ROWID + "=" + rowId, null) > 0; } }

    Read the article

  • removing pairs of elements from numpy arrays that are NaN (or another value) in Python

    - by user248237
    I have an array with two columns in numpy. For example: a = array([[1, 5, nan, 6], [10, 6, 6, nan]]) a = transpose(a) I want to efficiently iterate through the two columns, a[:, 0] and a[:, 1] and remove any pairs that meet a certain condition, in this case if they are NaN. The obvious way I can think of is: new_a = [] for val1, val2 in a: if val2 == nan or val2 == nan: new_a.append([val1, val2]) But that seems clunky. What's the pythonic numpy way of doing this? thanks.

    Read the article

  • DB2 with mod_perl not working, works fine in CGI

    - by Matthew
    Hi, I'm having issues with getting DBI's IBM DB2 driver to work with mod_perl. My test script is: #!/usr/bin/perl use CGI; use Data::Dumper; use DBI; $q = CGI->new; print $q->header; print $q->start_html(); $dsn = "DBI:DB2:SAMPLE"; $username = "username"; $password = "password"; $dbc = DBI->connect($dsn, $username, $password); $sth = $dbc->prepare("SELECT * FROM SOME_TABLE WHERE FIELD='SOMETHING'"); $sth->execute(); $row = $sth->fetchrow_hashref(); print "<pre>".$q->escapeHTML(Dumper($row))."</pre>"; print $q->end_html; This script works as CGI but not under mod_perl. I get this error in apache's error log: DBD::DB2::dr connect warning: [unixODBC][Driver Manager]Data source name not found, and no default driver specified at /usr/lib/perl5/site_perl/5.8.8/Apache/DBI.pm line 190. DBI connect('SAMPLE','username',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified at /data/www/perl/test.pl line 15 First of all, why is it using ODBC? The native DB2 driver is installed (hence it works as CGI). Running Apache 2.2.3, mod_perl 2.0.4 under RHEL5. This guy had the same problem as me: http://www.mail-archive.com/[email protected]/msg22909.html But I have no idea how he fixed it. What does mod_php4 have to do with mod_perl? Any help would be greatly appreciated, I'm having no luck with google.

    Read the article

  • Multiple accordion panes open

    - by Kevin
    We are using a jquery accordion on our site : http://www.racedayworld.com It basically lists events under each month... Apparently people are finding difficulties knowing how it really works and they don't see at first glance that there are more events under each month (that you click to expand) So I was thinking about opening two at a time (the current month and the next) .. but I'm not sure how to enable both to be open at once ... any ideas?

    Read the article

  • Using Sub-Types And Return Types in Scala to Process a Generic Object Into a Specific One

    - by pr1001
    I think this is about covariance but I'm weak on the topic... I have a generic Event class used for things like database persistance, let's say like this: class Event( subject: Long, verb: String, directobject: Option[Long], indirectobject: Option[Long], timestamp: Long) { def getSubject = subject def getVerb = verb def getDirectObject = directobject def getIndirectObject = indirectobject def getTimestamp = timestamp } However, I have lots of different event verbs and I want to use pattern matching and such with these different event types, so I will create some corresponding case classes: trait EventCC case class Login(user: Long, timestamp: Long) extends EventCC case class Follow( follower: Long, followee: Long, timestamp: Long ) extends EventCC Now, the question is, how can I easily convert generic Events to the specific case classes. This is my first stab at it: def event2CC[T <: EventCC](event: Event): T = event.getVerb match { case "login" => Login(event.getSubject, event.getTimestamp) case "follow" => Follow( event.getSubject, event.getDirectObject.getOrElse(0), event.getTimestamp ) // ... } Unfortunately, this is wrong. <console>:11: error: type mismatch; found : Login required: T case "login" => Login(event.getSubject, event.getTimestamp) ^ <console>:12: error: type mismatch; found : Follow required: T case "follow" => Follow(event.getSubject, event.getDirectObject.getOrElse(0), event.getTimestamp) Could someone with greater type-fu than me explain if, 1) if what I want to do is possible (or reasonable, for that matter), and 2) if so, how to fix event2CC. Thanks!

    Read the article

  • book with good examples for each implementation?

    - by ajsie
    i've read about design patterns and it seems that there are a lot of different design patterns to use. i wonder if there are some books that acts like a reference. "you want to build a framework, then consider this, this and this pattern". also giving some examples. then jumps to another implementation eg. search engine and gives some patterns and concrete examples to use. in this way you learn about the weakness and strength about each pattern and where they will fit, instead of just reading about every design pattern decoupled from each other. are there good "reference sheets" or other tutorials good for a beginner at this? thanks

    Read the article

  • Javascript Associative Arrays

    - by John Hartsock
    Hello all, It seems to me that this should work but I cant see what exactly is the problem. The error Im receiving is "DDROA is not defined" Could anyone help enlighten me. var DDROA = { AllowedRoutes : { AR0 : {text : 'SomeText', value : 'SomeValue'}, AR1 : {text : 'SomeText2', value : 'SomeValue2'} }, RouteContext : { RC0 : {text : 'None', value : '0', AllowedRoutes : new Array( DDROA.AllowedRoutes.AR0 // An error occurs here ) } } }

    Read the article

  • MSDN Magazine: Patterns for High Availability, Scalability, and Computing Power with Windows Azure

    In this article, Joshy Joseph, a principal architect with Microsoft Services Managed Solutions Group, examines the typical cloud platform architecture and some common architectural patterns, along with their implementation on the Windows Azure offering from Microsoft....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Big Update for the Project Rosetta Site

    We just shipped a major update to the Project Rosetta site, including a new a series of Flash to Silverlight tutorials, an updated API Guide with a quick reference list and a full list of recommended tools, code samples, and frameworks to download....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How to resize Yahoo Messenger window?

    - by Ian Boyd
    Yahoo messenger is huge: And that's as short as you can make it, it won't shrink vertically anymore. How can i make it a more reasonable size, e.g.: In fact, if we're making it look better, how about Yahoo stops pissing on their users and makes it: Okay, yes, the last one was me complaining. But the first two are a valid question! Note: The cut-off title bar is because Yahoo! developers don't pay their taxes, and assume that everyone runs at 96dpi.

    Read the article

  • Getting started in Mac Development; No Mac.... What Do?!

    - by Andrew Bolster
    Hi folks, With all the RDF et al around King Jobs' newest glass beermat, I'm getting the feeling that its a good time to add the 'iphone/ipad developer' string to my bow. One problem (two if you count not being in a financial position to slap down $1000+ for a mac) ; I am a PC head, specifically a Linux-head, and have no regular access to a Mac platform to develop on. I cannot see any way of getting my hands on iSDK without being on a Mac, (but have been known to be wrong) How hopeless is my plight and where can I go from here?

    Read the article

  • ASP.NET site sometimes freezing up and/or showing odd text at top of the page while loading, on load

    - by MGOwen
    I have various servers (dev, 2 x test, 2 x prod) running the same asp.net site. The test and prod servers are in load-balanced pairs (prod1 with prod2, and test1 with test2). The test server pair is exhibiting some kind of (super) slowdown or freezing during about one in ten page loads. Sometimes a line of text appears at the very top of the page which looks something like: 00 OK Date: Thu, 01 Apr 2010 01:50:09 GMT Server: Microsoft-IIS/6.0 X-Powered_By: ASP.NET X-AspNet-Version:2.0.50727 Cache-Control:private Content-Type:text/html; charset=ut (the beginning and end are "cut off".) Has anyone seen anything like this before? Any idea what it means or what's causing it? Edit: I often see this too when clicking something - it comes up as red text on a yellow page: XML Parsing Error: not well-formed Location: http://203.111.46.211/3DSS/CompanyCompliance.aspx?cid=14 Line Number 1, Column 24:2mMTehON9OUNKySVaJ3ROpN" / -----------------------^ If I go back and click again, it works (I see the page I clicked on, not the above error message). Update: ...And, instead of the page loading, I sometimes just get a white screen with text like this in black (looks a lot like the above text): HTTP/1.1 302 Found Date: Wed, 21 Apr 2010 04:53:39 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Location: /3DSS/EditSections.aspx?id=3&siteId=56&sectionId=46 Set-Cookie: .3DSS=A6CAC223D0F2517D77C7C68EEF069ABA85E9392E93417FFA4209E2621B8DCE38174AD699C9F0221D30D49E108CAB8A828408CF214549A949501DAFAF59F080375A50162361E4AA94E08874BF0945B2EF; path=/; HttpOnly Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 184 object moved here Where "here" is a link that points to a URL just like the one I'm requesting, except with an extra folder in it, meaning something like: http://123.1.2.3/MySite//MySite/Page.aspx?option=1 instead of: http://123.1.2.3/MySite/Page.aspx?option=1 Update: A colleague of mine found some info saying it might be because the test servers are running iis in 64 bit (64bit win 2003) (prod servers are 32 bit win 2003). So we tried telling IIS to use 32 bit: **cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1 %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i ** (from this MS support page) But iis stopped working altogether (got "server unavailable" on a white page instead of web sites). Reversing the above (see the link) didn't work at first either. The ASP.NET tab disappeared from our IIS web site properties and we had to mess around for an hour uninstalling (aspnet_regiis.exe -u) and reinstalling 32 bit ASP.NET and adding Default.aspx manually back into default documents. We'll probably try again in a few days, if anyone has anything to add in the meantime, please do.

    Read the article

  • ASP.NET MVC: MetaTags; setting methodology, best practices

    - by MVCDummy09
    When I created a default MVC application in VS2K10, the master view (Site.Master) had a ContentPlaceHolder for the <title> tag. Is there a better way to set metatags like title and description than using a ContentPlaceHolder in the master and setting that ContentPlaceHolder's value in each view? How do you configure your views' metatags in a large-scale site with dozens and dozens of pages?

    Read the article

  • NSTableView is not showing my data. Why is that happening?

    - by lampShade
    I'm making a "simple" to-do-list project and running into a few bumps in the road. The problem is that my NSTableView is NOT showing the data from the NSMutableArray "myArray" and I don't know why that is. Can someone point out my mistake? /* IBOutlet NSTextField *textField; IBOutlet NSTabView *tableView; IBOutlet NSButton *button; NSMutableArray *myArray; */ #import "AppController.h" @implementation AppController -(IBAction)addNewItem:(id)sender { NSString *myString = [textField stringValue]; NSLog(@"my stirng is %@",myString); myArray = [[NSMutableArray alloc] initWithCapacity:100]; [myArray addObject:myString]; } - (int)numberOfRowsInTableView:(NSTableView *)aTableView { return [myArray count]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { return [myArray objectAtIndex:rowIndex]; } -(id)init { [super init]; [tableView setDataSource:self]; [tableView setDelegate:self]; NSLog(@"init"); return self; } @end

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >