question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,240,681
6,262,467
Basic testing functionality in SBT
How do I create a simple unit test for my application using SBT 's test feature? I'm hoping the answer is that I can write a single file in src/test/scala for my project that imports some special testing package from SBT which makes writing tests as easy as writing a single method. The tutorial ExampleSbtTest seems to ...
Testing with SBT No matter which version of SBT you want to use, basically you have to do the following steps: Include your desired testing framework as test-dependency in your project configuration. Create a dedicated testing folder within your source tree, usually src/test/scala, if it isn't present already. As alway...
Basic testing functionality in SBT How do I create a simple unit test for my application using SBT 's test feature? I'm hoping the answer is that I can write a single file in src/test/scala for my project that imports some special testing package from SBT which makes writing tests as easy as writing a single method. Th...
TITLE: Basic testing functionality in SBT QUESTION: How do I create a simple unit test for my application using SBT 's test feature? I'm hoping the answer is that I can write a single file in src/test/scala for my project that imports some special testing package from SBT which makes writing tests as easy as writing a...
[ "unit-testing", "sbt" ]
7
12
4,681
1
0
2011-06-05T02:39:12.117000
2011-06-07T08:23:36.977000
6,240,682
6,240,766
Dynamically Resize a JScrollPane?
I Have two files. One extends JFrame, and another Extends JPanel. Whenever I change the size of the frame, whether it be maximizing, dragging, whatever, i want the ScrollPane to fit itself to the current size of the frame. There's more to it, there's a top menubar and a bottom bar as well, but i left those out for simp...
Regarding the code you've posted, for one get rid of all calls to setSize -- these are generally not honored when using layout managers and get rid of all of your ComponentListener stuff as it's superfluous since you are using layout managers to resize things. The biggest problem I see though is that your allow your Te...
Dynamically Resize a JScrollPane? I Have two files. One extends JFrame, and another Extends JPanel. Whenever I change the size of the frame, whether it be maximizing, dragging, whatever, i want the ScrollPane to fit itself to the current size of the frame. There's more to it, there's a top menubar and a bottom bar as w...
TITLE: Dynamically Resize a JScrollPane? QUESTION: I Have two files. One extends JFrame, and another Extends JPanel. Whenever I change the size of the frame, whether it be maximizing, dragging, whatever, i want the ScrollPane to fit itself to the current size of the frame. There's more to it, there's a top menubar and...
[ "java", "dynamic", "resize", "jscrollpane", "jtextarea" ]
9
7
34,870
2
0
2011-06-05T02:39:21.333000
2011-06-05T03:06:35.037000
6,240,687
6,240,720
running php script on windows via bat file returns error on require_once ($_SERVER['Document_Root']);
On Windows XP system, I have test.bat C:\Path\to\php.exe -f "C:\Path\to\test.php" I also have test.php require_once ($_SERVER ['DOCUMENT_ROOT']. '/Inc/Class/Connect_DB.php');... more code. When I execute test.bat on "CMD mode" it returns Fatal error saying it can't locate the require_once file. The same file works fine...
Dump $_SERVER and check if document root is set. On my install $_SERVER is available from cli, but the DOCUMENT_ROOT key is set to an empty string. ie -> "". You would be better off getting the path by using something in the lines of: //you can put this in variable, $base_dir = dirname(__FILE__); //append another path....
running php script on windows via bat file returns error on require_once ($_SERVER['Document_Root']); On Windows XP system, I have test.bat C:\Path\to\php.exe -f "C:\Path\to\test.php" I also have test.php require_once ($_SERVER ['DOCUMENT_ROOT']. '/Inc/Class/Connect_DB.php');... more code. When I execute test.bat on "C...
TITLE: running php script on windows via bat file returns error on require_once ($_SERVER['Document_Root']); QUESTION: On Windows XP system, I have test.bat C:\Path\to\php.exe -f "C:\Path\to\test.php" I also have test.php require_once ($_SERVER ['DOCUMENT_ROOT']. '/Inc/Class/Connect_DB.php');... more code. When I exec...
[ "php", "batch-file", "scheduled-tasks" ]
1
2
4,865
2
0
2011-06-05T02:41:12.597000
2011-06-05T02:52:24.937000
6,240,688
6,240,698
SQL Check if exists before update
Hello All I would like to see an example how to check if pappssn exsist in database before the update is complete. If so to raise an error record exsist. My front end is VB however i would like to handle this within SQL in my stored procedure if possible. Any Ideas? ALTER Procedure [dbo].[usp_insertmemapp]( @pappfname ...
ALTER Procedure [dbo].[usp_insertmemapp]( @pappfname nvarchar(50), @pappmname nvarchar(50), @papplname nvarchar(50), @pappwedding nvarchar(50), @pappstateresidence nvarchar(50), @pappstreet nvarchar(50), @pappcity nvarchar(50), @pappstate char(2), @pappzip char(6), @papphomephone nvarchar (13), @pappfax nvarchar (13), ...
SQL Check if exists before update Hello All I would like to see an example how to check if pappssn exsist in database before the update is complete. If so to raise an error record exsist. My front end is VB however i would like to handle this within SQL in my stored procedure if possible. Any Ideas? ALTER Procedure [db...
TITLE: SQL Check if exists before update QUESTION: Hello All I would like to see an example how to check if pappssn exsist in database before the update is complete. If so to raise an error record exsist. My front end is VB however i would like to handle this within SQL in my stored procedure if possible. Any Ideas? A...
[ "sql", "vb.net", "sqltransaction" ]
2
3
809
1
0
2011-06-05T02:41:24.970000
2011-06-05T02:46:02.753000
6,240,691
6,240,714
C GTK+ periodic event to update the UI
How can I update a GTK+ interface on a periodic event. For example, let's say I wanted to update a text field containing the time every 200 milliseconds. How is this typically done? Update: Another question ( How one executes a periodic job in gtk application? ) mentiones g_timeout_add. Is this the best way to go about...
This tutorial has an example. (Search for the section titled "A timer example".) The short answer is "use g_timeout_add ".
C GTK+ periodic event to update the UI How can I update a GTK+ interface on a periodic event. For example, let's say I wanted to update a text field containing the time every 200 milliseconds. How is this typically done? Update: Another question ( How one executes a periodic job in gtk application? ) mentiones g_timeou...
TITLE: C GTK+ periodic event to update the UI QUESTION: How can I update a GTK+ interface on a periodic event. For example, let's say I wanted to update a text field containing the time every 200 milliseconds. How is this typically done? Update: Another question ( How one executes a periodic job in gtk application? ) ...
[ "c", "events", "gtk" ]
3
7
3,223
1
0
2011-06-05T02:42:31.383000
2011-06-05T02:51:15.890000
6,240,695
6,241,508
Using YouTube login with Omniauth, Ruby on Rails 3
I am creating an application that uses OmniAuth exclusively for logins, that is, users can log in using their various accounts from around the Internet. My site involves videosharing, so I would love to be able to have users login using their YouTube account. I've successfully implemented: Facebook, Twitter, Gmail, fou...
omniauth / oa-oauth / lib / omniauth / strategies / you_tube.rb is about OmniAuth's YouTube strategy. It should work with: provider:youtube, 'CONSUMER_KEY', 'CONSUMER_SECRET'
Using YouTube login with Omniauth, Ruby on Rails 3 I am creating an application that uses OmniAuth exclusively for logins, that is, users can log in using their various accounts from around the Internet. My site involves videosharing, so I would love to be able to have users login using their YouTube account. I've suc...
TITLE: Using YouTube login with Omniauth, Ruby on Rails 3 QUESTION: I am creating an application that uses OmniAuth exclusively for logins, that is, users can log in using their various accounts from around the Internet. My site involves videosharing, so I would love to be able to have users login using their YouTube...
[ "ruby-on-rails", "ruby-on-rails-3", "oauth", "youtube", "omniauth" ]
0
0
1,229
2
0
2011-06-05T02:43:50.417000
2011-06-05T07:16:39.063000
6,240,696
6,240,779
Creating a socket client in Objective-C - Mac OSX
I need to basically send some "data" to 98.136.86.109 at port 587. How can I do this in obj-c in my mac app?
As Yan notes in his answer, you could use the standard BSD-style networking APIs like socket(), connect(), etc. However, if you want to stay in Objective C and Foundation, then you're looking for NSInputStream and NSOutputStream, which are the stream classes for Cocoa. You should not, however, look at NSSocketPort as t...
Creating a socket client in Objective-C - Mac OSX I need to basically send some "data" to 98.136.86.109 at port 587. How can I do this in obj-c in my mac app?
TITLE: Creating a socket client in Objective-C - Mac OSX QUESTION: I need to basically send some "data" to 98.136.86.109 at port 587. How can I do this in obj-c in my mac app? ANSWER: As Yan notes in his answer, you could use the standard BSD-style networking APIs like socket(), connect(), etc. However, if you want t...
[ "objective-c", "macos", "sockets", "client" ]
3
5
8,723
2
0
2011-06-05T02:45:19.763000
2011-06-05T03:10:57.563000
6,240,702
6,240,740
Widget Layering in Tkinter
I'm using the place geometry manager to make draggable widgets. I've noticed however, that the last widget made gets priority in layering. In other words it always appears over the widgets made before it. Is there any way to change widget layering?
Use tk lower whose Tkinter form is window.lower(belowThis=None)
Widget Layering in Tkinter I'm using the place geometry manager to make draggable widgets. I've noticed however, that the last widget made gets priority in layering. In other words it always appears over the widgets made before it. Is there any way to change widget layering?
TITLE: Widget Layering in Tkinter QUESTION: I'm using the place geometry manager to make draggable widgets. I've noticed however, that the last widget made gets priority in layering. In other words it always appears over the widgets made before it. Is there any way to change widget layering? ANSWER: Use tk lower whos...
[ "python", "tkinter" ]
4
3
1,592
1
0
2011-06-05T02:48:06.577000
2011-06-05T02:58:39.543000
6,240,705
6,240,799
.NET Web Service Poor Performance (using MVC3 thinking about switching to WCF)
I am working on building a.NET-Based web service where I pass in a string as part of the URL, and I return another string. The returned string is actually JavaScript. Currently, I am using MVC3 for this service, because the requirements seemed very simple, and I did not see any reason to bring WCF into it. -Especially ...
Pulling the files from iis is a completely different operation and allows extreme performance gains because of server file caching and no processing required. I don't think your wcf will be that different (yes you can return JavaScript) but it would be a simple perf test.
.NET Web Service Poor Performance (using MVC3 thinking about switching to WCF) I am working on building a.NET-Based web service where I pass in a string as part of the URL, and I return another string. The returned string is actually JavaScript. Currently, I am using MVC3 for this service, because the requirements seem...
TITLE: .NET Web Service Poor Performance (using MVC3 thinking about switching to WCF) QUESTION: I am working on building a.NET-Based web service where I pass in a string as part of the URL, and I return another string. The returned string is actually JavaScript. Currently, I am using MVC3 for this service, because the...
[ "javascript", "asp.net", "wcf", "web-services", "asp.net-mvc-3" ]
1
0
405
4
0
2011-06-05T02:49:37.237000
2011-06-05T03:17:06.640000
6,240,706
6,240,763
How is compressed data stored in the buffer cache, compressed or uncompressed?
When using row-level or page-level compression with SQL Server 2008 R2, does SQL Server store the data into its buffer cache in its compressed form or its expanded form. For example, let's say I have a table that is (page-level) compressed down to 20% of its original size: Original size: 100 GB Compressed size: 20 GB F...
Compressed pages are persisted as compressed on disk and stay compressed when read into memory. Ref: SQL Server 2008 Data Compression: Strategy, Capacity Planning and Best Practices: Data is decompressed (not the entire page, but only the data values of interest) when it meets one of the following conditions: It is rea...
How is compressed data stored in the buffer cache, compressed or uncompressed? When using row-level or page-level compression with SQL Server 2008 R2, does SQL Server store the data into its buffer cache in its compressed form or its expanded form. For example, let's say I have a table that is (page-level) compressed d...
TITLE: How is compressed data stored in the buffer cache, compressed or uncompressed? QUESTION: When using row-level or page-level compression with SQL Server 2008 R2, does SQL Server store the data into its buffer cache in its compressed form or its expanded form. For example, let's say I have a table that is (page-l...
[ "sql-server", "sql-server-2008", "sql-server-2008-r2" ]
6
8
1,458
1
0
2011-06-05T02:49:37.200000
2011-06-05T03:05:29.453000
6,240,716
6,240,729
Facing "can't start new thread" error while doing multithread file operations
Hey guys, I'm writing a script to update status log, this involves frequently file operations. My way of doing this is to use a "big" method including all read/write operations on this file, and set a RLock to make sure only one thread operating the file at a time. I'm sure there is far less than 1000 threads running w...
You are probably reaching memory limit for an application on your platform. Check how much is allocated for stack for each thread. http://docs.python.org/library/resource.html
Facing "can't start new thread" error while doing multithread file operations Hey guys, I'm writing a script to update status log, this involves frequently file operations. My way of doing this is to use a "big" method including all read/write operations on this file, and set a RLock to make sure only one thread operat...
TITLE: Facing "can't start new thread" error while doing multithread file operations QUESTION: Hey guys, I'm writing a script to update status log, this involves frequently file operations. My way of doing this is to use a "big" method including all read/write operations on this file, and set a RLock to make sure only...
[ "python", "multithreading", "file-io" ]
1
0
1,248
1
0
2011-06-05T02:51:33.173000
2011-06-05T02:56:14.553000
6,240,727
6,240,744
Facebook Developer
I'm trying to register my tumblr website with Facebook in accordance with this tutorial http://forum.developers.facebook.net/viewtopic.php?id=62825. But when I enter my website like this, I get a validation error. Why is this not a valid domain name? Note, I am using my own domain name with Tumblr Validation failed. Si...
From the looks of things, you're redirecting www.leaftalk.com to leaftalk.com. The value for your site domain should be leaftalk.com (note, no trailing slash). The value for site URL should be http://leaftalk.com/
Facebook Developer I'm trying to register my tumblr website with Facebook in accordance with this tutorial http://forum.developers.facebook.net/viewtopic.php?id=62825. But when I enter my website like this, I get a validation error. Why is this not a valid domain name? Note, I am using my own domain name with Tumblr Va...
TITLE: Facebook Developer QUESTION: I'm trying to register my tumblr website with Facebook in accordance with this tutorial http://forum.developers.facebook.net/viewtopic.php?id=62825. But when I enter my website like this, I get a validation error. Why is this not a valid domain name? Note, I am using my own domain n...
[ "facebook", "facebook-graph-api", "facebook-c#-sdk" ]
0
1
567
2
0
2011-06-05T02:55:09.960000
2011-06-05T02:59:43.533000
6,240,731
6,240,895
jQuery: Can't append img tag after .find
I have a strange problem happening on one page I am making: myDiv.append(" ") <--- WORKS myDiv.find("p").append("whatever") <--- WORKS myDiv.find("p").append(" ") <--- FAILS! On that last one nothing gets appended. I can't see what is going wrong through Firebug. When I create new test page all three work, but I can't ...
Ah sorry, I found out the problem which was not surprisingly due to conflicting scripts on the page. I had another script which was automatically removing empty elements in the area and apparently it considers img tags to be empty. The reason the first example I gave works is because it placed the images outside the sc...
jQuery: Can't append img tag after .find I have a strange problem happening on one page I am making: myDiv.append(" ") <--- WORKS myDiv.find("p").append("whatever") <--- WORKS myDiv.find("p").append(" ") <--- FAILS! On that last one nothing gets appended. I can't see what is going wrong through Firebug. When I create n...
TITLE: jQuery: Can't append img tag after .find QUESTION: I have a strange problem happening on one page I am making: myDiv.append(" ") <--- WORKS myDiv.find("p").append("whatever") <--- WORKS myDiv.find("p").append(" ") <--- FAILS! On that last one nothing gets appended. I can't see what is going wrong through Firebu...
[ "jquery", "html", "dom", "append", "image" ]
0
0
610
3
0
2011-06-05T02:56:26.410000
2011-06-05T03:49:06.170000
6,240,733
6,240,758
Pass data from the Activity to SurfaceView
I'm not sure where the problem is. I thought if the activity would pass information to the surfaceview it implements. Basically I'm trying to make it so that when someone selects their choice of game layout from the main menu (passes it with Intent) it then goes to the PlayGame class. (I have it take the number given f...
If loadImages is being called from the Game constructor, then the problem is that when you inflate the view, you haven't yet defined playGame.type. Try extracting the intent extra before calling setContentView.
Pass data from the Activity to SurfaceView I'm not sure where the problem is. I thought if the activity would pass information to the surfaceview it implements. Basically I'm trying to make it so that when someone selects their choice of game layout from the main menu (passes it with Intent) it then goes to the PlayGam...
TITLE: Pass data from the Activity to SurfaceView QUESTION: I'm not sure where the problem is. I thought if the activity would pass information to the surfaceview it implements. Basically I'm trying to make it so that when someone selects their choice of game layout from the main menu (passes it with Intent) it then g...
[ "java", "android", "surfaceview" ]
2
1
1,739
3
0
2011-06-05T02:57:00.197000
2011-06-05T03:04:18.150000
6,240,736
6,242,659
rtmfp NetGroup - not all clients see messages inside group
I have Flex application - it connects to FMS and joins to NetGroup named "default". So I have for example 4 clients connected to the same server in the same group. And looks like not all clients are connected to each other! Client1 sees Client2's streams and messages but doesn't see others. Same for Client3 and 4. I kn...
I have found some very good info about RTMP on RTMFP failover here: http://www.adobe.com/devnet/flashmediaserver/articles/real-time-collaboration.html http://broadcast.oreilly.com/2009/04/adobes-real-time-media-flow-pr.html
rtmfp NetGroup - not all clients see messages inside group I have Flex application - it connects to FMS and joins to NetGroup named "default". So I have for example 4 clients connected to the same server in the same group. And looks like not all clients are connected to each other! Client1 sees Client2's streams and me...
TITLE: rtmfp NetGroup - not all clients see messages inside group QUESTION: I have Flex application - it connects to FMS and joins to NetGroup named "default". So I have for example 4 clients connected to the same server in the same group. And looks like not all clients are connected to each other! Client1 sees Client...
[ "flash", "apache-flex", "adobe", "p2p", "rtmfp" ]
1
1
779
1
0
2011-06-05T02:57:32.110000
2011-06-05T11:38:32.457000
6,240,737
6,240,775
Python socket.sendall() function
I'm reading Tutorial on Network Programming with Python, and in this document the author is saying that "The function sendall() should be used only with blocking sockets." But I do not see any such condition in the Python documentation, socket.sendall(string[, flags]). Is the author of PyNet right?
When in doubt, check the source. socket_sendall clearly gives up once send() returns -1, which it will do (with errno of EAGAIN or EWOULDBLOCK) if you call it on a non-blocking socket without calling poll() or select(). (And the internal_select function skips calling poll()/select() when the socket is non-blocking.) So...
Python socket.sendall() function I'm reading Tutorial on Network Programming with Python, and in this document the author is saying that "The function sendall() should be used only with blocking sockets." But I do not see any such condition in the Python documentation, socket.sendall(string[, flags]). Is the author of ...
TITLE: Python socket.sendall() function QUESTION: I'm reading Tutorial on Network Programming with Python, and in this document the author is saying that "The function sendall() should be used only with blocking sockets." But I do not see any such condition in the Python documentation, socket.sendall(string[, flags])....
[ "python", "sockets" ]
16
14
20,037
2
0
2011-06-05T02:58:05.140000
2011-06-05T03:08:47.337000
6,240,738
6,240,838
Edit MongoMapper Document
Nowhere in the MongoMapper documentation can I find any methods for actually editing documents. I can't find anything elsewhere, either. The only way I could find, is this method: class User include MongoMapper::Document key:name, String end user = User.create(:name => "Hello" ) user.name = "Hello?" puts user.name #...
You edit your documents/objects the same way you'd edit an ActiveRecord object: assign some values to attributes and then call save. Your example only has one key so here's one with multiple keys: class User include MongoMapper::Document key:name, String key:email, String key:birthday, Date timestamps! # The usual Acti...
Edit MongoMapper Document Nowhere in the MongoMapper documentation can I find any methods for actually editing documents. I can't find anything elsewhere, either. The only way I could find, is this method: class User include MongoMapper::Document key:name, String end user = User.create(:name => "Hello" ) user.name = ...
TITLE: Edit MongoMapper Document QUESTION: Nowhere in the MongoMapper documentation can I find any methods for actually editing documents. I can't find anything elsewhere, either. The only way I could find, is this method: class User include MongoMapper::Document key:name, String end user = User.create(:name => "Hel...
[ "ruby", "mongodb", "mongomapper" ]
2
4
652
1
0
2011-06-05T02:58:07.673000
2011-06-05T03:31:13.537000
6,240,741
6,241,509
Objective-C Drawing on a separate window
The following code is supposed to draw a rectangle on the mapWindow NSView. There is another file for my program that uses the NSView window; hence why I want to have a new window. However, the rectangle does not display. Any help would be appreciated. @interface mapWindow: NSView {@private NSView* theMapWindow;} - (v...
NSView 's drawRect: method is called on your behalf; you should use it to your drawing, as described in Drawing View Content. @interface mapWindow: NSView { @private NSView* theMapWindow; NSPoint drawPoint; } // - (void)drawRect:(int)pointx: (int)pointy; @property (assign) IBOutlet NSView* theMapWindow; @property (a...
Objective-C Drawing on a separate window The following code is supposed to draw a rectangle on the mapWindow NSView. There is another file for my program that uses the NSView window; hence why I want to have a new window. However, the rectangle does not display. Any help would be appreciated. @interface mapWindow: NSVi...
TITLE: Objective-C Drawing on a separate window QUESTION: The following code is supposed to draw a rectangle on the mapWindow NSView. There is another file for my program that uses the NSView window; hence why I want to have a new window. However, the rectangle does not display. Any help would be appreciated. @interfa...
[ "objective-c", "graphics", "drawing", "drawrect" ]
0
1
461
3
0
2011-06-05T02:59:02.610000
2011-06-05T07:16:42.093000
6,240,746
6,240,780
Saving a variable in the closure scope
I have the following: var Save = $('th:first')[0]; $('th').click(function() { if (Save!== this) { Save = this;... } }); How do I put "Save" into a closure scope?
With jQuery, I tend to wrap the whole lot in a function, that passes in the jQuery object as $, to avoid namespace clashes on that shorthand, as recommended by the jQuery documentation. (function($) { //.... })(jQuery); Any variables within that scope, for instance your var Save, are then out of the global name scope, ...
Saving a variable in the closure scope I have the following: var Save = $('th:first')[0]; $('th').click(function() { if (Save!== this) { Save = this;... } }); How do I put "Save" into a closure scope?
TITLE: Saving a variable in the closure scope QUESTION: I have the following: var Save = $('th:first')[0]; $('th').click(function() { if (Save!== this) { Save = this;... } }); How do I put "Save" into a closure scope? ANSWER: With jQuery, I tend to wrap the whole lot in a function, that passes in the jQuery object a...
[ "javascript", "jquery" ]
1
4
1,280
2
0
2011-06-05T02:59:54.843000
2011-06-05T03:11:29.920000
6,240,749
6,240,872
Generating a 2D grid in Haskell
Learning haskell and want a function to generate a 2D grid similar to how you might in C: int data[3][3] what's an acceptable and elegant approach? Zip? Foldl? I could declare one like: x = [[0,0,0], [0,0,0], [0,0,0]] But I would like a function with x y parameters. Struggling to understand the easiest way without for/...
You seem to be asking "what should I use instead of Arrays in Haskell", right? You asked about using lists, which certainly aren't arrays and should be avoided for any serious work requiring non-sequential access (for example, lists give O(n) element access instead of O(1)). The packages you should consider: array (old...
Generating a 2D grid in Haskell Learning haskell and want a function to generate a 2D grid similar to how you might in C: int data[3][3] what's an acceptable and elegant approach? Zip? Foldl? I could declare one like: x = [[0,0,0], [0,0,0], [0,0,0]] But I would like a function with x y parameters. Struggling to underst...
TITLE: Generating a 2D grid in Haskell QUESTION: Learning haskell and want a function to generate a 2D grid similar to how you might in C: int data[3][3] what's an acceptable and elegant approach? Zip? Foldl? I could declare one like: x = [[0,0,0], [0,0,0], [0,0,0]] But I would like a function with x y parameters. Str...
[ "haskell" ]
10
19
7,937
3
0
2011-06-05T03:01:03.360000
2011-06-05T03:42:27.117000
6,240,756
6,240,907
Does LINQ replace regex in all cases
Can a LINQ expression replace all cases where regex would have previously been used? In other words; does a regex exist that can not be represented by a LINQ query?
It's probably possible to craft a LINQ expression for any given regular expression, but doing so will likely be unreasonable in many cases. Even if you eliminate things like backreferences, regular expressions can be arbitrarily complex. The beauty of regular expressions (and I find it somewhat surprising that I use th...
Does LINQ replace regex in all cases Can a LINQ expression replace all cases where regex would have previously been used? In other words; does a regex exist that can not be represented by a LINQ query?
TITLE: Does LINQ replace regex in all cases QUESTION: Can a LINQ expression replace all cases where regex would have previously been used? In other words; does a regex exist that can not be represented by a LINQ query? ANSWER: It's probably possible to craft a LINQ expression for any given regular expression, but doi...
[ "c#", "regex", "linq", "programming-languages" ]
5
10
2,802
5
0
2011-06-05T03:03:41.970000
2011-06-05T03:51:54.903000
6,240,757
6,240,786
Alternative to WPF combo box dropdownstyle
In system.windows.forms, a combo box had a DropDownStyle. Unfortunately, I hate the style of a readonly combo box in WPF, and there is no longer the ability to set the DropDownStyle/FlatStyle to is there an easy way to simply never use the ugly gray "button"-looking combo box and always use the appearance as though it ...
Toggle IsEditable and that will give you the style right away. If you don't want the text box to be editable, also set IsReadOnly: The text in the text box still highlights when you select something, but it can't be edited as it's read-only.
Alternative to WPF combo box dropdownstyle In system.windows.forms, a combo box had a DropDownStyle. Unfortunately, I hate the style of a readonly combo box in WPF, and there is no longer the ability to set the DropDownStyle/FlatStyle to is there an easy way to simply never use the ugly gray "button"-looking combo box ...
TITLE: Alternative to WPF combo box dropdownstyle QUESTION: In system.windows.forms, a combo box had a DropDownStyle. Unfortunately, I hate the style of a readonly combo box in WPF, and there is no longer the ability to set the DropDownStyle/FlatStyle to is there an easy way to simply never use the ugly gray "button"-...
[ "wpf", "combobox" ]
3
8
13,295
1
0
2011-06-05T03:03:52.947000
2011-06-05T03:12:34.520000
6,240,759
6,242,208
How can I echo previous and next page link names in WordPress?
I am using this wonderful bit of code created by jackreichert. This in the functions.php file. function siblings($link) { global $post; $siblings = get_pages('child_of='.$post->post_parent.'&parent='.$post->post_parent); foreach ($siblings as $key=>$sibling){ if ($post->ID == $sibling->ID){ $ID = $key; } } $closest = a...
Change this line: $closest = array('before'=>get_permalink($siblings[$ID-1]->ID),'after'=>get_permalink($siblings[$ID+1]->ID)); To: $closest = array('before'=> ' '.get_the_title($siblings[$ID-1]->ID).' ','after'=> ' '.get_the_title($siblings[$ID+1]->ID).' ');
How can I echo previous and next page link names in WordPress? I am using this wonderful bit of code created by jackreichert. This in the functions.php file. function siblings($link) { global $post; $siblings = get_pages('child_of='.$post->post_parent.'&parent='.$post->post_parent); foreach ($siblings as $key=>$sibling...
TITLE: How can I echo previous and next page link names in WordPress? QUESTION: I am using this wonderful bit of code created by jackreichert. This in the functions.php file. function siblings($link) { global $post; $siblings = get_pages('child_of='.$post->post_parent.'&parent='.$post->post_parent); foreach ($siblings...
[ "php", "wordpress" ]
1
2
327
1
0
2011-06-05T03:04:21.347000
2011-06-05T10:02:44.013000
6,240,764
6,240,875
Button Click Animation
I'm developing a WebApp for Android, so I've added a custom button like this: HTML Register CSS #btRegister { height: 40px; width: 100px; font-weight: bold; text-align: center; color: white; text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 1px; line-height: 40px; border-width: 0 8px 0 8px; -webkit-border-image: url('shared/btR...
You could do something like this: Register function clickButton(btn){ //change image setTimeout(function(){ //change image back }, 120); } Not very sure about this but you might also try using an element instead. This way you might be able to style the buttons with pseudo-classes and avoid having to handle the changing...
Button Click Animation I'm developing a WebApp for Android, so I've added a custom button like this: HTML Register CSS #btRegister { height: 40px; width: 100px; font-weight: bold; text-align: center; color: white; text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 1px; line-height: 40px; border-width: 0 8px 0 8px; -webkit-border...
TITLE: Button Click Animation QUESTION: I'm developing a WebApp for Android, so I've added a custom button like this: HTML Register CSS #btRegister { height: 40px; width: 100px; font-weight: bold; text-align: center; color: white; text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 1px; line-height: 40px; border-width: 0 8px 0 8...
[ "javascript", "android", "html", "web-applications", "button" ]
0
3
3,406
2
0
2011-06-05T03:05:58.247000
2011-06-05T03:42:50.317000
6,240,770
6,240,917
how can I program a large number of for loops
I'm new to programming so I'm sorry in phrasing if I'm not asking this question correctly. I have the following code: int sum = 100; int a1 = 20; int a2 = 5; int a3 = 10; for (int i = 0; i * a1 <= sum; i++) { for (int j = 0; i * a1 + j * a2 <= sum; j++) { for (int k = 0; i * a1 + j * a2 + k * a3 <= sum; k++) { if (i * ...
Recursion. This is what it sounds like you are trying to solve: your current example: 20x 1 + 5x 2 + 10x 3 = 100 so in general you are doing: A 1 x 1 + A 2 x 2 +... + A n x n = SUM so you pass in an array of constants {A 1, A 2,..., A n } and you want to solve for {x 1, x 2,..., x n } public void findVariables(int[] co...
how can I program a large number of for loops I'm new to programming so I'm sorry in phrasing if I'm not asking this question correctly. I have the following code: int sum = 100; int a1 = 20; int a2 = 5; int a3 = 10; for (int i = 0; i * a1 <= sum; i++) { for (int j = 0; i * a1 + j * a2 <= sum; j++) { for (int k = 0; i ...
TITLE: how can I program a large number of for loops QUESTION: I'm new to programming so I'm sorry in phrasing if I'm not asking this question correctly. I have the following code: int sum = 100; int a1 = 20; int a2 = 5; int a3 = 10; for (int i = 0; i * a1 <= sum; i++) { for (int j = 0; i * a1 + j * a2 <= sum; j++) { ...
[ "java", "python", "algorithm", "math", "loops" ]
2
13
2,043
5
0
2011-06-05T03:07:44.597000
2011-06-05T03:54:54.467000
6,240,771
6,240,778
Ajax loading graphic
So I'm no JavaScript genius, but I can follow a tutorial just fine. I've got my Ajax JavaScript request. How do I make it so that I can make a.gif animation show while the information is being requested? Here's the code: function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera ...
When you start the AJAX request, add an img element: var image=document.createElement('img'); image.setAttribute('src', 'ajax-loader.gif'); document.getElementsByTagName('body')[0].appendChild(image); When the AJAX request is done, remove it. (this code assumes image is still in scope) image.parentNode.removeChild(imag...
Ajax loading graphic So I'm no JavaScript genius, but I can follow a tutorial just fine. I've got my Ajax JavaScript request. How do I make it so that I can make a.gif animation show while the information is being requested? Here's the code: function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax poss...
TITLE: Ajax loading graphic QUESTION: So I'm no JavaScript genius, but I can follow a tutorial just fine. I've got my Ajax JavaScript request. How do I make it so that I can make a.gif animation show while the information is being requested? Here's the code: function ajaxFunction(){ var ajaxRequest; // The variable th...
[ "javascript", "ajax", "gif" ]
1
1
1,277
2
0
2011-06-05T03:07:55.860000
2011-06-05T03:10:52.197000
6,240,790
6,240,800
finding referrer to current page/script
Possible Duplicate: php/html - http_referer I want to find which page/script get request to current page/script. For example I am on page "index.php" I click on link that takes me to "about.php" Now, on "about.php", I need to find referrer, i.e., "index.php" I need solution, that works on any OS/Platform (Windows, Linu...
Don't trust $_SERVER['HTTP_REFERER']: it is a bad solution because it's not reliable, set by the user agent, possible to modify, and not always set or is set incorrectly. Try setting the current page to a $_SESSION item at the end of each page load, and referencing that as your "last url". It will work as long as the l...
finding referrer to current page/script Possible Duplicate: php/html - http_referer I want to find which page/script get request to current page/script. For example I am on page "index.php" I click on link that takes me to "about.php" Now, on "about.php", I need to find referrer, i.e., "index.php" I need solution, that...
TITLE: finding referrer to current page/script QUESTION: Possible Duplicate: php/html - http_referer I want to find which page/script get request to current page/script. For example I am on page "index.php" I click on link that takes me to "about.php" Now, on "about.php", I need to find referrer, i.e., "index.php" I n...
[ "php" ]
0
1
507
2
0
2011-06-05T03:14:05.003000
2011-06-05T03:17:19.257000
6,240,797
6,240,953
How do I use a button to open a website from the browser on an Android widget?
So I have been trying for hours to get this to work and I can't for the life of me figure it out. I have tried many different ideas I've found just googling it, but without any luck. I am trying to create an android widget that you can click on an image and it uses the default browser to open up a website. I am able to...
Set a PendingIntent to your Button. This will cause the Intent to be executed when the Button is pressed. Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(data); PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, intent, PendingIntent.FLAG_CANCEL_CURRENT); remoteView.setOnClickP...
How do I use a button to open a website from the browser on an Android widget? So I have been trying for hours to get this to work and I can't for the life of me figure it out. I have tried many different ideas I've found just googling it, but without any luck. I am trying to create an android widget that you can click...
TITLE: How do I use a button to open a website from the browser on an Android widget? QUESTION: So I have been trying for hours to get this to work and I can't for the life of me figure it out. I have tried many different ideas I've found just googling it, but without any luck. I am trying to create an android widget ...
[ "android", "android-widget", "android-internet" ]
1
1
2,275
1
0
2011-06-05T03:16:08.837000
2011-06-05T04:09:56.190000
6,240,804
6,240,847
Trouble understanding the use of dot product in this example?
Usually, I use the dot product of 2 vectors either to find out how perpendicular they are or the cosine of the angle between them. In this shader, a toon shader, the dot product is used on 2 colors and I cannot wrap my head around what exactly this is doing. uniform vec2 resolution; uniform sampler2D backBuffer; void ...
The "geometric" scalar (dot) product properties don't really matter in this case. What you have here is an ordinary conversion of some (R, G, B) color to the corresponding grayscale intensity I in accordance with the formula I = R * 0.30 + G * 0.59 + B * 0.11 (You can learn more about these coefficients here: https://e...
Trouble understanding the use of dot product in this example? Usually, I use the dot product of 2 vectors either to find out how perpendicular they are or the cosine of the angle between them. In this shader, a toon shader, the dot product is used on 2 colors and I cannot wrap my head around what exactly this is doing....
TITLE: Trouble understanding the use of dot product in this example? QUESTION: Usually, I use the dot product of 2 vectors either to find out how perpendicular they are or the cosine of the angle between them. In this shader, a toon shader, the dot product is used on 2 colors and I cannot wrap my head around what exac...
[ "vector", "glsl" ]
4
10
3,096
1
0
2011-06-05T03:18:13.057000
2011-06-05T03:35:26.277000
6,240,808
6,241,539
count line changes with git?
Is there a simple way I can ask git for the amount of lines I added (or add and removed) in a specific date range? I'm using git on Windows, Linux and TortoiseGit(Windows)
Building upon Seth Robertson's answer, (+1 Seth!) awk will tally up the columns for you: % git log --stat --author $(git config --get user.email) --since="last year" --until="last month" | awk -F',' '/files? changed/ { files += $1 insertions += $2 deletions += $3 print } END { print "Files Changed: " files print "Inser...
count line changes with git? Is there a simple way I can ask git for the amount of lines I added (or add and removed) in a specific date range? I'm using git on Windows, Linux and TortoiseGit(Windows)
TITLE: count line changes with git? QUESTION: Is there a simple way I can ask git for the amount of lines I added (or add and removed) in a specific date range? I'm using git on Windows, Linux and TortoiseGit(Windows) ANSWER: Building upon Seth Robertson's answer, (+1 Seth!) awk will tally up the columns for you: % g...
[ "git", "tortoisegit" ]
16
24
6,660
3
0
2011-06-05T03:19:41.470000
2011-06-05T07:27:22.257000
6,240,811
6,241,873
How to change name, domain of site in Django
I am able to change the name of the domain and site in the administration panel (http://127.0.0.1:8000/admin). However, when I try to make changes directly to the database in the table django_site, it is not reflected in the administration panel (nor is it reflected in the URL of links sent in activation emails). Why i...
As per the docs, Django caches the site upon the first request. Therefore you need to call Site.objects.clear_cache(): As the current site is stored in the database, each call to Site.objects.get_current() could result in a database query. But Django is a little cleverer than that: on the first request, the current sit...
How to change name, domain of site in Django I am able to change the name of the domain and site in the administration panel (http://127.0.0.1:8000/admin). However, when I try to make changes directly to the database in the table django_site, it is not reflected in the administration panel (nor is it reflected in the U...
TITLE: How to change name, domain of site in Django QUESTION: I am able to change the name of the domain and site in the administration panel (http://127.0.0.1:8000/admin). However, when I try to make changes directly to the database in the table django_site, it is not reflected in the administration panel (nor is it ...
[ "django" ]
1
1
1,776
1
0
2011-06-05T03:20:33.207000
2011-06-05T08:51:33.277000
6,240,812
6,253,003
A Fast and Efficient way to create a matrix from a series of product
Ax, Ay, Az: [N-by-N] B=AA (a dyadic product) It means: B(i,j)= [Ax(i,j);Ay(i,j);Az(i,j)]*[Ax(i,j) Ay(i,j) Az(i,j)] B(i,j): a 3x3 matrix. One way to construct B is: N=2; Ax=rand(N); Ay=rand(N); Az=rand(N); %# [N-by-N] t=1; F=zeros(3,3,N^2); for i=1:N for j=1:N F(:,:,t)= [Ax(i,j);Ay(i,j);Az(i,j)]*[Ax(i,j) Ay(i,j) Az(i,j)...
Here's a fairly simple and general implementation that uses a single for loop to perform linear indexing and avoids dealing with 3-dimensional variables or reshaping: %# General solution: %# ---------------- B = cell(N); for index = 1:N^2 A = [Ax(index) Ay(index) Az(index)]; B{index} = A(:)*A; end B = cell2mat(B); EDIT...
A Fast and Efficient way to create a matrix from a series of product Ax, Ay, Az: [N-by-N] B=AA (a dyadic product) It means: B(i,j)= [Ax(i,j);Ay(i,j);Az(i,j)]*[Ax(i,j) Ay(i,j) Az(i,j)] B(i,j): a 3x3 matrix. One way to construct B is: N=2; Ax=rand(N); Ay=rand(N); Az=rand(N); %# [N-by-N] t=1; F=zeros(3,3,N^2); for i=1:N f...
TITLE: A Fast and Efficient way to create a matrix from a series of product QUESTION: Ax, Ay, Az: [N-by-N] B=AA (a dyadic product) It means: B(i,j)= [Ax(i,j);Ay(i,j);Az(i,j)]*[Ax(i,j) Ay(i,j) Az(i,j)] B(i,j): a 3x3 matrix. One way to construct B is: N=2; Ax=rand(N); Ay=rand(N); Az=rand(N); %# [N-by-N] t=1; F=zeros(3,3...
[ "matlab", "performance", "matrix", "large-data" ]
1
2
745
2
0
2011-06-05T03:20:44.760000
2011-06-06T13:49:29.010000
6,240,813
6,242,556
This memory scanner only work on strings. How can I find numbers?
I'm writing a memory scanner in C#. It's able to find strings, but not numerical values. How can I enhance it to find addresses with numbers in them? Edit: I give my app a specific number or string to search for within the memory of a running process. I want to use this to change those values later, but for now I'm jus...
Looks like it only works on strings that are in the loaded files/modules' binaries; not values that have changed in-proc. Grrr. Therefore it's not a string vs numeric issue and this whole question is moot. Thanks for your help. Next question in the series...
This memory scanner only work on strings. How can I find numbers? I'm writing a memory scanner in C#. It's able to find strings, but not numerical values. How can I enhance it to find addresses with numbers in them? Edit: I give my app a specific number or string to search for within the memory of a running process. I ...
TITLE: This memory scanner only work on strings. How can I find numbers? QUESTION: I'm writing a memory scanner in C#. It's able to find strings, but not numerical values. How can I enhance it to find addresses with numbers in them? Edit: I give my app a specific number or string to search for within the memory of a r...
[ "c#", "memory", "interop" ]
3
0
3,913
1
0
2011-06-05T03:20:53.043000
2011-06-05T11:14:37.797000
6,240,818
6,240,956
Unicode Byte sequence/convert a char to bytes array
I am trying to write a simple program for this interview question: Write a function that checks for valid unicode byte sequence. A unicode sequence is encoded as: - first byte indicates number of subsequent bytes '11110000' means 4 subsequent data bytes - data bytes start with a '10xxxxxx' public static void main(Strin...
Here's an enterprise level solution for your enterprise level job: public static void main(String[] args) { if (args.length == 0 || args[0] == null || (args[0] = args[0].trim()).isEmpty()) { System.out.println("No argument passed or argument empty!"); return; } String arg = args[0]; System.out.println("arg: " + arg + ...
Unicode Byte sequence/convert a char to bytes array I am trying to write a simple program for this interview question: Write a function that checks for valid unicode byte sequence. A unicode sequence is encoded as: - first byte indicates number of subsequent bytes '11110000' means 4 subsequent data bytes - data bytes s...
TITLE: Unicode Byte sequence/convert a char to bytes array QUESTION: I am trying to write a simple program for this interview question: Write a function that checks for valid unicode byte sequence. A unicode sequence is encoded as: - first byte indicates number of subsequent bytes '11110000' means 4 subsequent data by...
[ "java", "unicode" ]
0
6
5,315
4
0
2011-06-05T03:22:06.527000
2011-06-05T04:11:10.380000
6,240,823
6,240,844
Best practices on displaying suburbs on a global site based on the country selected
Let's say a user from a global site selects his/her country from a drop down list. I would like to present the user with a list of suburbs of that country. The problem I find is that it may be a lot of work populating the SQL database with country-suburb relations. And having done that, I would imagine each user would ...
Keep the master pairings in your database, but then push each country out to a JSON file (possibly on your CDN) that gets loaded dynamically and populates your select field whenever a country is chosen. Whenever you make a change in your database, re-push the respective JSON file.
Best practices on displaying suburbs on a global site based on the country selected Let's say a user from a global site selects his/her country from a drop down list. I would like to present the user with a list of suburbs of that country. The problem I find is that it may be a lot of work populating the SQL database w...
TITLE: Best practices on displaying suburbs on a global site based on the country selected QUESTION: Let's say a user from a global site selects his/her country from a drop down list. I would like to present the user with a list of suburbs of that country. The problem I find is that it may be a lot of work populating ...
[ "javascript", "asp.net", "dynamic-data" ]
0
0
85
1
0
2011-06-05T03:25:40.873000
2011-06-05T03:33:33.827000
6,240,827
6,240,840
Detaching and attaching
I have the following: $('th').click(function() { var $th = $(this); var column = $th.index(); var $table = $th.closest('table'); var rows = $table.find('tbody > tr').get(); rows.sort(function(rowA,rowB) { var keyA = $(rowA).children('td').eq(column).text().toUpperCase(); var keyB = $(rowB).children('td').eq(column).tex...
I believe you need to know where the table is coming from... i.e. if the table were inside a wrapper DIV with ID="tablewrapper", you could change your var $table line to: var $table = $th.closest('table').detach(); and at the end of your function add: $table.appendTo('#tablewrapper'); I'm not convinced detaching it wil...
Detaching and attaching I have the following: $('th').click(function() { var $th = $(this); var column = $th.index(); var $table = $th.closest('table'); var rows = $table.find('tbody > tr').get(); rows.sort(function(rowA,rowB) { var keyA = $(rowA).children('td').eq(column).text().toUpperCase(); var keyB = $(rowB).child...
TITLE: Detaching and attaching QUESTION: I have the following: $('th').click(function() { var $th = $(this); var column = $th.index(); var $table = $th.closest('table'); var rows = $table.find('tbody > tr').get(); rows.sort(function(rowA,rowB) { var keyA = $(rowA).children('td').eq(column).text().toUpperCase(); var ke...
[ "javascript", "jquery" ]
0
1
1,403
1
0
2011-06-05T03:26:34.293000
2011-06-05T03:31:46.987000
6,240,830
6,240,881
Problems Getting Multiple NSURLConnections to Run in Parallel
I am am trying to get multiple NSURLConnections to run in parallel (synchronously), however if it is not running on the main thread (block of code commented out below) the URL connection doesn't seem to work at all (none of the NSURLConnection delegate methods are triggered). Here is the code I have (implementation fil...
Background threads don't automatically have an active run loop on them. You need to start up the run loop after you create the NSURLConnection in order to get any input from it. Fortunately, this is quite simple: [[NSRunLoop currentRunLoop] run]; When you say that you are running the connections synchronously, you are ...
Problems Getting Multiple NSURLConnections to Run in Parallel I am am trying to get multiple NSURLConnections to run in parallel (synchronously), however if it is not running on the main thread (block of code commented out below) the URL connection doesn't seem to work at all (none of the NSURLConnection delegate metho...
TITLE: Problems Getting Multiple NSURLConnections to Run in Parallel QUESTION: I am am trying to get multiple NSURLConnections to run in parallel (synchronously), however if it is not running on the main thread (block of code commented out below) the URL connection doesn't seem to work at all (none of the NSURLConnect...
[ "objective-c", "cocoa-touch", "ios4", "nsurlconnection", "nsurlrequest" ]
1
3
1,184
2
0
2011-06-05T03:28:16.873000
2011-06-05T03:43:58.667000
6,240,843
6,241,091
Customizing the message contracts when creating a WCF service reference in Visual Studio 2010
Is it possible to modify how message contracts are generated when adding a WCF service reference in Visual Studio 2010? Specifically I want the request and response objects to have properties instead of public fields. I have no control over the WCF service itself, just the client.
You can't control the code in the generated proxy. If you want, you can do the proxy generation yourself, using the MetadataExchangeClient / ServiceContractGenerator classes. They'll give you a CodeDom object containing the code which you can modify (i.e., change fields into properties). There's an example of using the...
Customizing the message contracts when creating a WCF service reference in Visual Studio 2010 Is it possible to modify how message contracts are generated when adding a WCF service reference in Visual Studio 2010? Specifically I want the request and response objects to have properties instead of public fields. I have n...
TITLE: Customizing the message contracts when creating a WCF service reference in Visual Studio 2010 QUESTION: Is it possible to modify how message contracts are generated when adding a WCF service reference in Visual Studio 2010? Specifically I want the request and response objects to have properties instead of publi...
[ "wcf", "visual-studio-2010", "wcf-client" ]
0
0
264
2
0
2011-06-05T03:33:21.947000
2011-06-05T04:56:59.223000
6,240,855
6,240,871
Javascript error when calling a function in initialize()
I have a page for carpools. I made some changes to the function that calls initialize and now getting errors. Here is the page: http://www.comehike.com/hikes/hike_carpool.php?hike_id=180 What is the correct way to have the second argument when I call the initialize function? I think some JavaScript errors are coming fr...
You're not using your quotes right: onload="initialize( 180, "Hike_Carpool" ); placeHikeStartMarker( 180 ); placeCarpoolPassengersMarkers( 180 ); placeCarpoolDriversMarkers( 180 );" Should be: onload="initialize( 180, 'Hike_Carpool' ); placeHikeStartMarker( 180 ); placeCarpoolPassengersMarkers( 180 ); placeCarpoolDrive...
Javascript error when calling a function in initialize() I have a page for carpools. I made some changes to the function that calls initialize and now getting errors. Here is the page: http://www.comehike.com/hikes/hike_carpool.php?hike_id=180 What is the correct way to have the second argument when I call the initiali...
TITLE: Javascript error when calling a function in initialize() QUESTION: I have a page for carpools. I made some changes to the function that calls initialize and now getting errors. Here is the page: http://www.comehike.com/hikes/hike_carpool.php?hike_id=180 What is the correct way to have the second argument when I...
[ "javascript" ]
0
2
544
1
0
2011-06-05T03:38:00.333000
2011-06-05T03:42:20.727000
6,240,856
6,242,424
WordPress themes and plugins development
I want to develop WordPress themes and plugins. What do I need to know to do this? I have knowledge of PHP, HTML, CSS and JavaScript. I have developed a few projects using these. What is the best place to start (except Codex), is there any book? Where can I know how the core of WordPress works?
Professional WordPress Plugin Development Digging into WordPress
WordPress themes and plugins development I want to develop WordPress themes and plugins. What do I need to know to do this? I have knowledge of PHP, HTML, CSS and JavaScript. I have developed a few projects using these. What is the best place to start (except Codex), is there any book? Where can I know how the core of ...
TITLE: WordPress themes and plugins development QUESTION: I want to develop WordPress themes and plugins. What do I need to know to do this? I have knowledge of PHP, HTML, CSS and JavaScript. I have developed a few projects using these. What is the best place to start (except Codex), is there any book? Where can I kno...
[ "php", "wordpress", "wordpress-theming" ]
1
1
380
3
0
2011-06-05T03:38:16.390000
2011-06-05T10:46:21.787000
6,240,860
6,241,240
Model classes -- what the heck do they really mean?
I really can't seem to get the hang of Model objects in MVC. I wonder why we can't just work with arrays and dictionaries and arrays OF dictionaries? I understand that they represent the 'data' that my other classes manipulate and work with. But what is the proper way they should be constructed? Suppose I've got a plis...
You absolutely can work with dictionaries and arrays -- there's nothing wrong with using those as part of (or all of) your data model. Core Data's NSManagedObject is very much like a dictionary. But sometimes you want your model objects to do more than just store data -- you might also want them to know something about...
Model classes -- what the heck do they really mean? I really can't seem to get the hang of Model objects in MVC. I wonder why we can't just work with arrays and dictionaries and arrays OF dictionaries? I understand that they represent the 'data' that my other classes manipulate and work with. But what is the proper way...
TITLE: Model classes -- what the heck do they really mean? QUESTION: I really can't seem to get the hang of Model objects in MVC. I wonder why we can't just work with arrays and dictionaries and arrays OF dictionaries? I understand that they represent the 'data' that my other classes manipulate and work with. But what...
[ "objective-c", "ios", "cocoa-touch", "model-view-controller", "model" ]
3
6
448
1
0
2011-06-05T03:39:22.457000
2011-06-05T05:48:25.567000
6,240,865
6,240,997
Need help specifying a ending while condition
I have written a Python script to download all of the xkcd comic images. The only problem is I can't tell it to stop when it gets to the last one... Here is what I have so far. import re, mechanize from urllib import urlretrieve from BeautifulSoup import BeautifulSoup as bs baseUrl = "http://xkcd.com/1/" #Specify the ...
When you follow the "Next" link from the most recent xkcd comic, a hash tag is appended to the URL. Try using the following. while not br.geturl().endswith("#"):...
Need help specifying a ending while condition I have written a Python script to download all of the xkcd comic images. The only problem is I can't tell it to stop when it gets to the last one... Here is what I have so far. import re, mechanize from urllib import urlretrieve from BeautifulSoup import BeautifulSoup as bs...
TITLE: Need help specifying a ending while condition QUESTION: I have written a Python script to download all of the xkcd comic images. The only problem is I can't tell it to stop when it gets to the last one... Here is what I have so far. import re, mechanize from urllib import urlretrieve from BeautifulSoup import B...
[ "python", "while-loop", "beautifulsoup", "mechanize" ]
0
1
140
1
0
2011-06-05T03:40:32.253000
2011-06-05T04:24:56.900000
6,240,870
6,241,391
Tcl variable size limit
I am writing a Tcl script which will be used on an embedded device. The value of a variable in this script will be coming from a text file on the system. My concern is that if the source file is too big this may crash the device as there may not be enough memory to store the entire file. I wonder if the size of the var...
You can limit the size of the variable by specifying the number of characters to read from the file. For example: set f [open file.dat r] set var [read $f 1024] This code will read up to 1024 characters from the file (you'll get less than 1024 characters if the file is shorter than that, naturally).
Tcl variable size limit I am writing a Tcl script which will be used on an embedded device. The value of a variable in this script will be coming from a text file on the system. My concern is that if the source file is too big this may crash the device as there may not be enough memory to store the entire file. I wonde...
TITLE: Tcl variable size limit QUESTION: I am writing a Tcl script which will be used on an embedded device. The value of a variable in this script will be coming from a text file on the system. My concern is that if the source file is too big this may crash the device as there may not be enough memory to store the en...
[ "memory", "memory-management", "tcl" ]
4
7
4,387
2
0
2011-06-05T03:42:12.910000
2011-06-05T06:37:15.717000
6,240,882
6,240,896
Masking your web scraping activities to look like normal browser surfing activities?
I'm using the Html Agility Pack and I keep getting this error. "The remote server returned an error: (500) Internal Server Error." on certain pages. Now I'm not sure what this is, as I can use Firefox to get to these pages without any problems. I have a feeling the website itself is blocking and not sending a response....
Set a User-Agent similar to a regular browser. A User agent is a http header being passed by the http client(browser) to identify itself to the server.
Masking your web scraping activities to look like normal browser surfing activities? I'm using the Html Agility Pack and I keep getting this error. "The remote server returned an error: (500) Internal Server Error." on certain pages. Now I'm not sure what this is, as I can use Firefox to get to these pages without any ...
TITLE: Masking your web scraping activities to look like normal browser surfing activities? QUESTION: I'm using the Html Agility Pack and I keep getting this error. "The remote server returned an error: (500) Internal Server Error." on certain pages. Now I'm not sure what this is, as I can use Firefox to get to these ...
[ "c#", "web-scraping", "html-agility-pack" ]
6
6
1,876
2
0
2011-06-05T03:44:06.010000
2011-06-05T03:49:38.817000
6,240,890
6,240,916
overloading virtual operator -> ()
This is just an experiment code. struct B { virtual B* operator -> () { return this; } void foo () {} // edit: intentionally NOT virtual }; struct D: B { virtual D* operator -> () { return this; } void foo () {} }; int main () { B &pB = *new D; pB->foo(); // calls B::foo()! } I know that operator has to be called usi...
I think it is invoking D::operator->, but the return value is being treated as a B*, so B::foo() is being called. This is an artifact of how covariant return types behave.
overloading virtual operator -> () This is just an experiment code. struct B { virtual B* operator -> () { return this; } void foo () {} // edit: intentionally NOT virtual }; struct D: B { virtual D* operator -> () { return this; } void foo () {} }; int main () { B &pB = *new D; pB->foo(); // calls B::foo()! } I know...
TITLE: overloading virtual operator -> () QUESTION: This is just an experiment code. struct B { virtual B* operator -> () { return this; } void foo () {} // edit: intentionally NOT virtual }; struct D: B { virtual D* operator -> () { return this; } void foo () {} }; int main () { B &pB = *new D; pB->foo(); // calls ...
[ "c++", "operator-overloading", "virtual", "overriding" ]
9
8
592
4
0
2011-06-05T03:47:48.647000
2011-06-05T03:54:46.340000
6,240,897
6,241,494
Accessing transaction status in container managed beans
I have a @Stateless EJB using container managed transaction. Is there a way to access the "status" of javax.transaction.UserTransaction? That is, calling UserTransaction.getStatus() inside the bean methods? I know access to UserTransaction is prohibited in container managed beans, but I would like to know, is there any...
I don't think you've understood the responsibility of the UserTransaction class. It does not exist to provide you with access to the current running transaction. It is used to initiate any communication with the Transaction Manager of the container, especially for beginning and ending bean-managed transactions; that is...
Accessing transaction status in container managed beans I have a @Stateless EJB using container managed transaction. Is there a way to access the "status" of javax.transaction.UserTransaction? That is, calling UserTransaction.getStatus() inside the bean methods? I know access to UserTransaction is prohibited in contain...
TITLE: Accessing transaction status in container managed beans QUESTION: I have a @Stateless EJB using container managed transaction. Is there a way to access the "status" of javax.transaction.UserTransaction? That is, calling UserTransaction.getStatus() inside the bean methods? I know access to UserTransaction is pro...
[ "jakarta-ee", "ejb", "jta", "distributed-transactions" ]
7
2
10,637
2
0
2011-06-05T03:49:42.923000
2011-06-05T07:11:29.467000
6,240,898
6,240,930
ASP.NET MVC 3 jQuery client validation - disable for specific button (Ajax form)
How can I disable validation for one button inside the Ajax begin form? Using jQuery validation I tried many ways from Google, but none of them worked ( class="cancel", disableValidation attribute, etc.).
There may be other ways, but one for sure way is to remove all the validation rules if using unobtrusive validation via: http://docs.jquery.com/Plugins/Validation/rules#.22remove.22rules
ASP.NET MVC 3 jQuery client validation - disable for specific button (Ajax form) How can I disable validation for one button inside the Ajax begin form? Using jQuery validation I tried many ways from Google, but none of them worked ( class="cancel", disableValidation attribute, etc.).
TITLE: ASP.NET MVC 3 jQuery client validation - disable for specific button (Ajax form) QUESTION: How can I disable validation for one button inside the Ajax begin form? Using jQuery validation I tried many ways from Google, but none of them worked ( class="cancel", disableValidation attribute, etc.). ANSWER: There m...
[ "ajax", "asp.net-mvc-3", "unobtrusive-validation" ]
1
2
4,329
2
0
2011-06-05T03:49:45.077000
2011-06-05T04:00:32.130000
6,240,906
6,240,915
Python for x in list basic question
I am trying to create a function which will load a whole lot of images and map them to appropriate names in PyGame. I'm not all that great with python and this really has me stuck. My current code is this: tile1 = pygame.image.load("/one.bmp") tile2 = pygame.image.load("/two.bmp") tile3 = pygame.image.load("/three.bmp"...
List comprehensions to the rescue. tiles = ['/one.bmp', '/two.bmp', '/three.bmp'] tilelist = [pygame.img.load(tile) for tile in tiles] As @isakkarlsson commented,...or easier(?) tilelist = map(pygame.img.load, tiles)
Python for x in list basic question I am trying to create a function which will load a whole lot of images and map them to appropriate names in PyGame. I'm not all that great with python and this really has me stuck. My current code is this: tile1 = pygame.image.load("/one.bmp") tile2 = pygame.image.load("/two.bmp") ti...
TITLE: Python for x in list basic question QUESTION: I am trying to create a function which will load a whole lot of images and map them to appropriate names in PyGame. I'm not all that great with python and this really has me stuck. My current code is this: tile1 = pygame.image.load("/one.bmp") tile2 = pygame.image.l...
[ "python" ]
3
9
4,536
2
0
2011-06-05T03:51:40.597000
2011-06-05T03:54:46.263000
6,240,913
6,240,957
problem with accessing NSMutableArray
I have the following problem: int index=6; imageView.image=[imageArray objectAtIndex:index]; NSLog(@"%@",[imageArray objectAtIndex:index]); If I run this code I get (null) as an output...even though I have nicely put the images inside the array using the following code: NSURL *url = [NSURL URLWithString:@"somelink"]; N...
Remember you'll need to make a new instance of the NSMutableArray... it's possible you're just calling methods on nil. Before you start to you the imageArray, make sure you do something like: imageArray = [NSMutableArray array]; // or = [[NSMutableArray alloc] init] if you want to "retain" it // for use in other method...
problem with accessing NSMutableArray I have the following problem: int index=6; imageView.image=[imageArray objectAtIndex:index]; NSLog(@"%@",[imageArray objectAtIndex:index]); If I run this code I get (null) as an output...even though I have nicely put the images inside the array using the following code: NSURL *url ...
TITLE: problem with accessing NSMutableArray QUESTION: I have the following problem: int index=6; imageView.image=[imageArray objectAtIndex:index]; NSLog(@"%@",[imageArray objectAtIndex:index]); If I run this code I get (null) as an output...even though I have nicely put the images inside the array using the following...
[ "ios", "nsmutablearray" ]
0
1
263
2
0
2011-06-05T03:54:31.967000
2011-06-05T04:11:23.150000
6,240,920
6,247,466
Updating a jQuery flexbox
Is there a way to update the results of a jQuery flexbox with a JSON array? I have already created the flexbox, and I want to update its results. I initialize my flexbox as follows: $('#myFlex').flexbox({ "results": [ { "id": "1", "name": "Ant" }, { "id": "2", "name": "Bear" } ]}, { allowInput: false, paging: false, ma...
Ok, so I hacked myself a solution! Flexbox sets the data through the variable o.source upon initialization. What I did was store (and access) o.source as jQuery.data(). This allows me to view/change the value.
Updating a jQuery flexbox Is there a way to update the results of a jQuery flexbox with a JSON array? I have already created the flexbox, and I want to update its results. I initialize my flexbox as follows: $('#myFlex').flexbox({ "results": [ { "id": "1", "name": "Ant" }, { "id": "2", "name": "Bear" } ]}, { allowInput...
TITLE: Updating a jQuery flexbox QUESTION: Is there a way to update the results of a jQuery flexbox with a JSON array? I have already created the flexbox, and I want to update its results. I initialize my flexbox as follows: $('#myFlex').flexbox({ "results": [ { "id": "1", "name": "Ant" }, { "id": "2", "name": "Bear" ...
[ "jquery", "jquery-flexbox" ]
2
3
1,947
3
0
2011-06-05T03:56:31.233000
2011-06-06T03:12:34.667000
6,240,936
6,240,943
javascript: Does progressive enhancement means no json with ajax?
I read this article here that talks about progressive enhancement for javascript and the author mentioned: First, build an old-fashioned website that uses hyperlinks and forms to pass information to the server. The server returns whole new pages with each request. Now, use JavaScript to intercept those links and form s...
Does progressive enhancement means no json with ajax? No, it most certainly does not mean that. If JavaScript is disabled, there is no XMLHttpRequest, so there is no ajax. Now, use JavaScript to intercept those links and form submissions and pass the information via XMLHttpRequest instead. The JavaScript bits that inte...
javascript: Does progressive enhancement means no json with ajax? I read this article here that talks about progressive enhancement for javascript and the author mentioned: First, build an old-fashioned website that uses hyperlinks and forms to pass information to the server. The server returns whole new pages with eac...
TITLE: javascript: Does progressive enhancement means no json with ajax? QUESTION: I read this article here that talks about progressive enhancement for javascript and the author mentioned: First, build an old-fashioned website that uses hyperlinks and forms to pass information to the server. The server returns whole ...
[ "javascript", "graceful-degradation", "progressive-enhancement" ]
1
4
619
3
0
2011-06-05T04:02:40.857000
2011-06-05T04:06:10.320000
6,240,944
6,240,972
Classes as parameter of function c++
I wrote a bunch of crypto algorithms as classes and now I want to implement encryption modes (generalized modes shown in wikipedia, not the specific ones in the algorithms' specifications). How would I write a function that can accept any of the classes? edit: here's what i want to accomplish class mode{ private: algor...
Well, how about template class mode{ private: AlgorithmType _algo; public: mode(const AlgorithmType& algo): _algo(algo) {} };? No need for mode and key parameters, as the algorithm can be created by the user: mode m(YourAlgorithm(some_key,some_mode));
Classes as parameter of function c++ I wrote a bunch of crypto algorithms as classes and now I want to implement encryption modes (generalized modes shown in wikipedia, not the specific ones in the algorithms' specifications). How would I write a function that can accept any of the classes? edit: here's what i want to ...
TITLE: Classes as parameter of function c++ QUESTION: I wrote a bunch of crypto algorithms as classes and now I want to implement encryption modes (generalized modes shown in wikipedia, not the specific ones in the algorithms' specifications). How would I write a function that can accept any of the classes? edit: here...
[ "c++", "class", "parameters", "function-parameter" ]
1
2
311
2
0
2011-06-05T04:06:15.917000
2011-06-05T04:18:00.180000
6,240,946
6,241,110
What is the most efficient way to load YouTube videos through jQuery on a user click?
I'm trying to determine what is the most efficient way to load videos into a on a user click using jQuery. To give more context behind this, I'll have about 30 clips on YouTube that are each between 30-60seconds and I'd like to dynamically load them into a div on the right hand side of the page as the user browses the ...
you can add the URL to your Href and get it in the call Something Like: In your HTML: Now in your JQuery: $('.vid_trigger').click( function(e){ e.preventDefault(); var URL = $(this).attr('href'); var htm = ' '; $('#video_container').html(htm); return false; });
What is the most efficient way to load YouTube videos through jQuery on a user click? I'm trying to determine what is the most efficient way to load videos into a on a user click using jQuery. To give more context behind this, I'll have about 30 clips on YouTube that are each between 30-60seconds and I'd like to dynami...
TITLE: What is the most efficient way to load YouTube videos through jQuery on a user click? QUESTION: I'm trying to determine what is the most efficient way to load videos into a on a user click using jQuery. To give more context behind this, I'll have about 30 clips on YouTube that are each between 30-60seconds and ...
[ "jquery", "video" ]
6
13
11,845
3
0
2011-06-05T04:07:32.010000
2011-06-05T05:04:42.027000
6,240,950
6,240,980
Platform independent /dev/null in c++
Possible Duplicate: Implementing a no-op std::ostream Is there any stream equivalent of NULL in c++? I want to write a function that takes in a stream if the user wants to have the internal outputted to somewhere, but if not, the output goes into some fake place void data(std::stream & stream = fake_stream){ stream << ...
Edit: Taken from @Johannes Schaub - litb's mail here with slight modifications: template > struct basic_nullbuf: std::basic_streambuf { typedef std::basic_streambuf base_type; typedef typename base_type::int_type int_type; typedef typename base_type::traits_type traits_type; virtual int_type overflow(int_type c) { ret...
Platform independent /dev/null in c++ Possible Duplicate: Implementing a no-op std::ostream Is there any stream equivalent of NULL in c++? I want to write a function that takes in a stream if the user wants to have the internal outputted to somewhere, but if not, the output goes into some fake place void data(std::stre...
TITLE: Platform independent /dev/null in c++ QUESTION: Possible Duplicate: Implementing a no-op std::ostream Is there any stream equivalent of NULL in c++? I want to write a function that takes in a stream if the user wants to have the internal outputted to somewhere, but if not, the output goes into some fake place v...
[ "c++", "stream", "ostream", "default-parameters" ]
21
35
9,746
3
0
2011-06-05T04:08:14.527000
2011-06-05T04:20:31.597000
6,240,958
6,241,141
Deallocating and removing UiButtons
I am trying to make a program that dynamically creates a button using the command: [UIButton buttonWithType:UIButtonTypeRoundedRect] But when I use these commands the delete the button I create: [currentButton removeFromSuperview]; [currentButton dealloc]; [currentButton release]; I receive an error. How would I go abo...
In the Objective-C/Cocoa framework, you encounter two different ways to receive objects: ones which you have explicitly allocated memory for (via a constructor) and ones that you have received memory reference to (via a class method). FooBar *fone = [[FooBar alloc] initWithText:@"Hello, World!"]; In this example, memor...
Deallocating and removing UiButtons I am trying to make a program that dynamically creates a button using the command: [UIButton buttonWithType:UIButtonTypeRoundedRect] But when I use these commands the delete the button I create: [currentButton removeFromSuperview]; [currentButton dealloc]; [currentButton release]; I ...
TITLE: Deallocating and removing UiButtons QUESTION: I am trying to make a program that dynamically creates a button using the command: [UIButton buttonWithType:UIButtonTypeRoundedRect] But when I use these commands the delete the button I create: [currentButton removeFromSuperview]; [currentButton dealloc]; [currentB...
[ "iphone", "cocoa-touch" ]
1
0
599
4
0
2011-06-05T04:11:30.883000
2011-06-05T05:15:03.257000
6,240,959
6,247,650
Can selenium RC travels different domain in one test
If there is a one case that on open a yahoo.com page through selenium and on the click on any link on the home page of www.yahoo.com.it takes me to www.twitter.com page it opens in new page. Can selenium RC execute test on twitter.com now & after completion the test can selenium rc control go back to yahoo.com page aga...
Yes it can, you need to execute test using browsers with elevated security privileges, like *chrome with firefox.
Can selenium RC travels different domain in one test If there is a one case that on open a yahoo.com page through selenium and on the click on any link on the home page of www.yahoo.com.it takes me to www.twitter.com page it opens in new page. Can selenium RC execute test on twitter.com now & after completion the test ...
TITLE: Can selenium RC travels different domain in one test QUESTION: If there is a one case that on open a yahoo.com page through selenium and on the click on any link on the home page of www.yahoo.com.it takes me to www.twitter.com page it opens in new page. Can selenium RC execute test on twitter.com now & after co...
[ "selenium", "selenium-rc" ]
1
0
411
1
0
2011-06-05T04:12:14.027000
2011-06-06T04:02:17.017000
6,240,966
6,241,009
QuickCheck catch-22
I'm working on a Haskell project and I started out by organizing it like this: blah.hs holds the majority of the code blah_main.hs has the main program and blah_test.hs has the test cases. The problem with this is that restricting the functions exported by blah.hs means restricting the functions that can be tested from...
Move internal functions from the Blah.* modules to Blah.Internal.*. You can hide internal modules from the users of your library by listing them in the other-modules field in the blah.cabal file (instead of exposed-modules, where you list all modules visible to the users). Look at Hakyll 's.cabal file for an example.
QuickCheck catch-22 I'm working on a Haskell project and I started out by organizing it like this: blah.hs holds the majority of the code blah_main.hs has the main program and blah_test.hs has the test cases. The problem with this is that restricting the functions exported by blah.hs means restricting the functions tha...
TITLE: QuickCheck catch-22 QUESTION: I'm working on a Haskell project and I started out by organizing it like this: blah.hs holds the majority of the code blah_main.hs has the main program and blah_test.hs has the test cases. The problem with this is that restricting the functions exported by blah.hs means restricting...
[ "testing", "haskell" ]
12
18
256
2
0
2011-06-05T04:15:06.467000
2011-06-05T04:27:14.793000
6,240,973
6,243,973
How to extract a URL from a Tweet with a JavaScript RegEx?
Assuming that I have the tweet stored as a string in a JS variable... How to extract a URL from a tweet with a JavaScript RegEx? This should be much easier than extracting a URL from a string, because: I will assume that anything that starts with http or www and ends with a blank space (or end of tweet) is a URL.
Here is one of the regular expressions that I've used for pulling links from Twitter statuses. Link Match Pattern (?:<\w+.*?>|[^=!:'"/]|^)((?:https?://|www\.)[-\w]+(?:\.[-\w]+)*(?::\d+)?(?:/(?:(?:[~\w\+%-]|(?:[,.;@:][^\s$]))+)?)*(?:\?[\w\+%&=.;:-]+)?(?:\#[\w\-\.]*)?)(?:\p{P}|\s|<|$) Alternatively, if you control how th...
How to extract a URL from a Tweet with a JavaScript RegEx? Assuming that I have the tweet stored as a string in a JS variable... How to extract a URL from a tweet with a JavaScript RegEx? This should be much easier than extracting a URL from a string, because: I will assume that anything that starts with http or www an...
TITLE: How to extract a URL from a Tweet with a JavaScript RegEx? QUESTION: Assuming that I have the tweet stored as a string in a JS variable... How to extract a URL from a tweet with a JavaScript RegEx? This should be much easier than extracting a URL from a string, because: I will assume that anything that starts w...
[ "javascript", "regex", "twitter" ]
2
11
3,458
2
0
2011-06-05T04:18:25.513000
2011-06-05T15:47:44.760000
6,240,977
6,241,006
Execute JS from Firefox extension
I'm trying to execute custom JS code from a Firefox extension using: function executeJS(document, script) { var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.appendChild(document.createTextNode(script)); document.getElementsByTagName('head')[0].appendChild(script); } ...
I'm not sure about FF extensions, but in "normal" JS-land, there's no need for the createTextNode business. Outside of FF extensions, you can use Node.textContent — though maybe it's different with the XPCNativeWrapper types. script.textContent = 'var foo = 1; alert(foo);' I think the main problem, however, is that you...
Execute JS from Firefox extension I'm trying to execute custom JS code from a Firefox extension using: function executeJS(document, script) { var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.appendChild(document.createTextNode(script)); document.getElementsByTagName(...
TITLE: Execute JS from Firefox extension QUESTION: I'm trying to execute custom JS code from a Firefox extension using: function executeJS(document, script) { var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.appendChild(document.createTextNode(script)); document.get...
[ "javascript", "firefox", "firefox-addon" ]
5
3
4,819
1
0
2011-06-05T04:19:20.677000
2011-06-05T04:26:36.650000
6,240,985
6,241,235
Java program with 16GB virtual memory and growing: is it a problem?
On Mac OSX 5.8 I have a Java program that runs at 100% CPU for a very long time -- several days or more (it's a model checker analyzing a concurrent program, so that's more or less expected). However, its virtual memory size, as shown in OSX's Activity Monitor, becomes enormous after a day or so: right now it's 16GB an...
I suspect that it is a leak too. But it can't be a leak of 'normal' memory because the -Xmx1024m option is capping the normal heap. Likewise, it won't be a leak of 'permgen' heap, because the default maximum size of permgen is small. So I suspect it is one of the following: You are leaking threads; i.e. threads are bei...
Java program with 16GB virtual memory and growing: is it a problem? On Mac OSX 5.8 I have a Java program that runs at 100% CPU for a very long time -- several days or more (it's a model checker analyzing a concurrent program, so that's more or less expected). However, its virtual memory size, as shown in OSX's Activity...
TITLE: Java program with 16GB virtual memory and growing: is it a problem? QUESTION: On Mac OSX 5.8 I have a Java program that runs at 100% CPU for a very long time -- several days or more (it's a model checker analyzing a concurrent program, so that's more or less expected). However, its virtual memory size, as shown...
[ "java", "performance", "virtual-memory" ]
5
11
7,291
6
0
2011-06-05T04:23:26.947000
2011-06-05T05:47:12.477000
6,240,995
6,241,049
Tic Tac Toe C++ algorithm debugging help
Please help me understand why this isn't working. I don't know if there is a bug in my code, or whether my algorithm is fundamentally logically flawed. My algorithm is based on minimax, but I've forgone a heuristic evaluation function for a more simple technique. Because of the simplicity of plain 3x3 tic tac toe, I ju...
I think you'll see where the problem is if you make evaluate return the score rather than using return-by-reference. Evaluate should be minimaxing, but right now I think it's doing some weird sum of the leaf nodes because of the side-effect of additions and subtractions. Why summing up the scores is not correct Suppose...
Tic Tac Toe C++ algorithm debugging help Please help me understand why this isn't working. I don't know if there is a bug in my code, or whether my algorithm is fundamentally logically flawed. My algorithm is based on minimax, but I've forgone a heuristic evaluation function for a more simple technique. Because of the ...
TITLE: Tic Tac Toe C++ algorithm debugging help QUESTION: Please help me understand why this isn't working. I don't know if there is a bug in my code, or whether my algorithm is fundamentally logically flawed. My algorithm is based on minimax, but I've forgone a heuristic evaluation function for a more simple techniqu...
[ "c++", "algorithm", "minimax", "tic-tac-toe" ]
1
2
1,522
1
0
2011-06-05T04:24:47.847000
2011-06-05T04:43:05.180000
6,241,019
6,241,069
How do you use Castle Windsor - Fluent Interface to register a generic interfaces?
Castle Windsor just came out with a Fluent interface for registering components as an alternative to using XML in a config file. How do I use this Fluent interface to register a Generic interface? To illustrate, I have: public interface IFoo { public T IToo(); public U ISeeU(); } Which is implemented by some class call...
Someting like this? container.Register(AllTypes.FromAssemblyContaining ().BasedOn(typeof(IFoo<,>)).WithService.AllInterfaces().Configure(c => c.LifeStyle.Transient)); interface public interface IFoo { T IToo(); U ISeeU(); }
How do you use Castle Windsor - Fluent Interface to register a generic interfaces? Castle Windsor just came out with a Fluent interface for registering components as an alternative to using XML in a config file. How do I use this Fluent interface to register a Generic interface? To illustrate, I have: public interface ...
TITLE: How do you use Castle Windsor - Fluent Interface to register a generic interfaces? QUESTION: Castle Windsor just came out with a Fluent interface for registering components as an alternative to using XML in a config file. How do I use this Fluent interface to register a Generic interface? To illustrate, I have:...
[ "c#", "castle-windsor", "ioc-container", "castle", "fluent-interface" ]
8
15
5,413
2
0
2011-06-05T04:32:42.217000
2011-06-05T04:47:44.243000
6,241,026
6,241,074
Android music affiliate / associate programs
I have developed a music app for Android. At one stage in the application, the users can click on a song that they liked (when it was playing) and I'd like to be able to direct them to download it. This should preferably generate revenue as an affiliate purchase however I can't find a company which offers this service....
Did you try http://www.barnesandnoble.com/affiliate/index.asp? They seem pretty open by reading the FAQ. Note that I have no experience dealing with it. There's also Best Buy affiliate progam. And, finally, how can we forget about Walmart?
Android music affiliate / associate programs I have developed a music app for Android. At one stage in the application, the users can click on a song that they liked (when it was playing) and I'd like to be able to direct them to download it. This should preferably generate revenue as an affiliate purchase however I ca...
TITLE: Android music affiliate / associate programs QUESTION: I have developed a music app for Android. At one stage in the application, the users can click on a song that they liked (when it was playing) and I'd like to be able to direct them to download it. This should preferably generate revenue as an affiliate pur...
[ "java", "android", "mobile", "mp3", "affiliate" ]
2
1
1,127
1
0
2011-06-05T04:35:47.020000
2011-06-05T04:49:57.707000
6,241,028
6,241,063
CakePHP Form Submission with Results in Url
How do I submit a form using the form helper and have the reply of that submission have a url with what was searched for? I submit this code: create('Search', array('action' => 'results', 'type' => 'post'));?> 45, 'id' => 'search', 'tabindex' => 1, 'maxlength' => 250 ); echo $form->text('Search.query', $options);?> So...
You will have to do a redirect to get this exact URL. Submitting a form using GET would result in /searches/results?SearchQuery=Hello+World. For my taste that would be perfectly adequate, but if you want a pretty URL, do this in your controller: class SearchesController extends AppController { public function results($...
CakePHP Form Submission with Results in Url How do I submit a form using the form helper and have the reply of that submission have a url with what was searched for? I submit this code: create('Search', array('action' => 'results', 'type' => 'post'));?> 45, 'id' => 'search', 'tabindex' => 1, 'maxlength' => 250 ); echo...
TITLE: CakePHP Form Submission with Results in Url QUESTION: How do I submit a form using the form helper and have the reply of that submission have a url with what was searched for? I submit this code: create('Search', array('action' => 'results', 'type' => 'post'));?> 45, 'id' => 'search', 'tabindex' => 1, 'maxlengt...
[ "php", "forms", "cakephp", "cakephp-1.2" ]
1
2
787
1
0
2011-06-05T04:36:17.257000
2011-06-05T04:46:38.153000
6,241,031
6,241,041
How do I display an element that should overflow the parent container?
I have following HTML: I want to display another div in which will exceed the parent container's top. Above code is the parent widget which is assigned top and height property dynamically (this is attached to a flow panel). So each time mouse if over above parent widget, I need to display a child div which sometimes ex...
css overflow property. It sounds like you are looking for overflow: visible http://www.w3schools.com/css/pr_pos_overflow.asp
How do I display an element that should overflow the parent container? I have following HTML: I want to display another div in which will exceed the parent container's top. Above code is the parent widget which is assigned top and height property dynamically (this is attached to a flow panel). So each time mouse if ove...
TITLE: How do I display an element that should overflow the parent container? QUESTION: I have following HTML: I want to display another div in which will exceed the parent container's top. Above code is the parent widget which is assigned top and height property dynamically (this is attached to a flow panel). So each...
[ "html", "css", "dom", "gwt" ]
1
1
90
2
0
2011-06-05T04:37:50.793000
2011-06-05T04:41:13.337000
6,241,033
6,241,109
Does Rails create a new session when different controllers are called?
Say I have an app with multiple controllers. UserController EventsController Does Rails create different sessions when I first request for User#show method and then go on to call Events#show method? Or is the same session created in the first instance valid even during the second call.
No, rails does not create different sessions for each request (unless expired or deleted). In fact, that would invalidate the whole point of sessions, which is to share state between requests.
Does Rails create a new session when different controllers are called? Say I have an app with multiple controllers. UserController EventsController Does Rails create different sessions when I first request for User#show method and then go on to call Events#show method? Or is the same session created in the first instan...
TITLE: Does Rails create a new session when different controllers are called? QUESTION: Say I have an app with multiple controllers. UserController EventsController Does Rails create different sessions when I first request for User#show method and then go on to call Events#show method? Or is the same session created i...
[ "ruby-on-rails", "ruby-on-rails-3", "session", "controllers" ]
1
1
501
1
0
2011-06-05T04:38:33.757000
2011-06-05T05:04:40
6,241,036
6,241,300
How to use model objects instead of arrays and dictionaries?
Below is a simple example of how I'm reading from a plist and displaying the data in a table view. If I were to use a objects to represent my model, how would I be doing that? @interface RootViewController: UITableViewController { NSMutableArray *namesArray; } @property (nonatomic, retain) NSMutableArray *namesArray; @...
The Model in iOS MVC simply divides up your application so that the data and application algorithms (Model) are separated from the presentation and event handling code. So consider creating a new Model class that gets, sets and persist your application data. This class should have no knowledge of the GUI. Here is an ex...
How to use model objects instead of arrays and dictionaries? Below is a simple example of how I'm reading from a plist and displaying the data in a table view. If I were to use a objects to represent my model, how would I be doing that? @interface RootViewController: UITableViewController { NSMutableArray *namesArray; ...
TITLE: How to use model objects instead of arrays and dictionaries? QUESTION: Below is a simple example of how I'm reading from a plist and displaying the data in a table view. If I were to use a objects to represent my model, how would I be doing that? @interface RootViewController: UITableViewController { NSMutableA...
[ "iphone", "objective-c", "ios", "model-view-controller" ]
1
1
607
2
0
2011-06-05T04:39:01.003000
2011-06-05T06:06:49.830000
6,241,039
6,241,155
PHP: empty doesn't work with a getter method
I have a "getter" method like function getStuff($stuff){ return 'something'; } if I check it with empty($this->stuff), I always get FALSE, but I know $this->stuff returns data, because it works with echo. and if I check it with!isset($this->stuff) I get the correct value and the condition is never executed... here's th...
empty() will call __isset() first, and only if it returns true will it call __get(). Implement __isset() and make it return true for every magic property that you support. function __isset($name) { $getter = 'get'. ucfirst($name); return method_exists($this, $getter); }
PHP: empty doesn't work with a getter method I have a "getter" method like function getStuff($stuff){ return 'something'; } if I check it with empty($this->stuff), I always get FALSE, but I know $this->stuff returns data, because it works with echo. and if I check it with!isset($this->stuff) I get the correct value and...
TITLE: PHP: empty doesn't work with a getter method QUESTION: I have a "getter" method like function getStuff($stuff){ return 'something'; } if I check it with empty($this->stuff), I always get FALSE, but I know $this->stuff returns data, because it works with echo. and if I check it with!isset($this->stuff) I get the...
[ "php", "class", "getter" ]
14
27
4,834
3
0
2011-06-05T04:41:03.880000
2011-06-05T05:19:03.087000
6,241,043
6,241,090
Is it possible to save all documents once again?
I am wondering, is there any operation in rails console that does something like below?? a = Article.all foreach a as article article.save end
Sure, I've got an Article model too and just tried it in rails console: ruby-1.9.2-p180:002 > Article.all.each(&:save) => [# So what did that accomplish?
Is it possible to save all documents once again? I am wondering, is there any operation in rails console that does something like below?? a = Article.all foreach a as article article.save end
TITLE: Is it possible to save all documents once again? QUESTION: I am wondering, is there any operation in rails console that does something like below?? a = Article.all foreach a as article article.save end ANSWER: Sure, I've got an Article model too and just tried it in rails console: ruby-1.9.2-p180:002 > Article...
[ "ruby-on-rails", "ruby" ]
2
4
879
1
0
2011-06-05T04:41:38.407000
2011-06-05T04:56:49.147000
6,241,059
6,241,606
How to create a file upload form that creates more form fields based on input using php?
I have have ten columns in my SQL table: id, imgid, urlid, image1, image2, image3, image4, image5, and comment. Id, imgid, and urlid are int type. Image[1-5] are mediumblob type. Url and comment are text type. Imgid is the number of images uploaded (max should be 5), urlid is the number of urls submitted (which should ...
$_FILES['${'.img.'. $i}'] Replace to $_FILES[${'img'. $i}] Use IDE to edit scripts, to avoid such silly errors. Try NetBeans, PhpStorm. And try to read about MVC.
How to create a file upload form that creates more form fields based on input using php? I have have ten columns in my SQL table: id, imgid, urlid, image1, image2, image3, image4, image5, and comment. Id, imgid, and urlid are int type. Image[1-5] are mediumblob type. Url and comment are text type. Imgid is the number o...
TITLE: How to create a file upload form that creates more form fields based on input using php? QUESTION: I have have ten columns in my SQL table: id, imgid, urlid, image1, image2, image3, image4, image5, and comment. Id, imgid, and urlid are int type. Image[1-5] are mediumblob type. Url and comment are text type. Img...
[ "php", "forms", "file", "loops", "upload" ]
1
1
345
1
0
2011-06-05T04:45:41.023000
2011-06-05T07:45:00.103000
6,241,060
6,242,826
Reading a text file from desktop at app startup
I need to display the contents of a text file located on the user's desktop in an NSTextView at startup. My code is not working -- is it off track? NSError *err = nil; NSString *filepath = @"~/Desktop/test.txt"; NSString *file = [NSString stringWithContentsOfFile:filepath encoding:NSUTF8StringEncoding error:&err]; i...
@Shem. Sorry about that. I fixed it like this: NSError *err = nil; NSString *filepath = @"~/Desktop/test.txt"; filepath = [filepath stringByExpandingTildeInPath]; NSString *file = [NSString stringWithContentsOfFile:filepath encoding:NSUTF8StringEncoding error:&err]; if(!file) { } [textView setString:file];
Reading a text file from desktop at app startup I need to display the contents of a text file located on the user's desktop in an NSTextView at startup. My code is not working -- is it off track? NSError *err = nil; NSString *filepath = @"~/Desktop/test.txt"; NSString *file = [NSString stringWithContentsOfFile:filepa...
TITLE: Reading a text file from desktop at app startup QUESTION: I need to display the contents of a text file located on the user's desktop in an NSTextView at startup. My code is not working -- is it off track? NSError *err = nil; NSString *filepath = @"~/Desktop/test.txt"; NSString *file = [NSString stringWithCon...
[ "objective-c", "cocoa", "macos", "text-files", "nstextview" ]
4
7
2,584
2
0
2011-06-05T04:46:03.420000
2011-06-05T12:12:28.787000
6,241,072
6,241,088
How do I make modifications to a object that I don't want to commit in nhibernate?
I have ninject make a new session on httpRequest and close it at the end of the httpRequest. Now I learned through the nhibernate profile that I should always wrap everything in a transaction even queries(read). This has caused so many bugs now in my code because I would retrieve an object back from the database and th...
NHibernate 3.1 has a SetReadOnly() method on IQuery and ICriteria that ensures objects returned by the query will not be persisted by the session.
How do I make modifications to a object that I don't want to commit in nhibernate? I have ninject make a new session on httpRequest and close it at the end of the httpRequest. Now I learned through the nhibernate profile that I should always wrap everything in a transaction even queries(read). This has caused so many b...
TITLE: How do I make modifications to a object that I don't want to commit in nhibernate? QUESTION: I have ninject make a new session on httpRequest and close it at the end of the httpRequest. Now I learned through the nhibernate profile that I should always wrap everything in a transaction even queries(read). This ha...
[ "nhibernate" ]
1
2
336
2
0
2011-06-05T04:49:02.737000
2011-06-05T04:56:26.323000
6,241,073
6,241,077
Java: Explain what this for() loop parameter does
Could someone please explain what the for loop in this class does? Specifically the part with (String person: people) import java.util.Scanner; /** * This program uses the startsWith method to search using * a partial string * * */ public class PersonSearch { public static void main(String[] args){ String lookUp; //T...
It's called the foreach syntax. It works with arrays and Objects that implement Iterable. For arrays (as here) it's equivalent to this code: for (int i = 0; i < people.length; i++) { person = people[i]; // code inside loop } For Iterable iterable (eg a List), it's equivalent to: for (Iterator i = iterable.iterator(); i...
Java: Explain what this for() loop parameter does Could someone please explain what the for loop in this class does? Specifically the part with (String person: people) import java.util.Scanner; /** * This program uses the startsWith method to search using * a partial string * * */ public class PersonSearch { public s...
TITLE: Java: Explain what this for() loop parameter does QUESTION: Could someone please explain what the for loop in this class does? Specifically the part with (String person: people) import java.util.Scanner; /** * This program uses the startsWith method to search using * a partial string * * */ public class Person...
[ "java" ]
2
7
4,884
6
0
2011-06-05T04:49:28.243000
2011-06-05T04:51:26.303000
6,241,076
6,241,093
When useing jquery slide some of the css doesnt apply until after the slide
I'm making an html5 website. the page I'm encountering the issue is http://yamikowebs.com/blog.php right now I'm working on the copy/paste link. when you click it the other links slide in from the left. for some reason my anchors are underlined and display inline until the animation is done. is there a fix for this? $(...
While the animation is taking place, your div is wrapped in a temporary div with a class of ui-effects-wrapper. Once the animation is complete, your article element appears as a child of blogLinks and is styled appropriately, but until then, the article element is a child of.ui-effects-wrapper. Try applying the same st...
When useing jquery slide some of the css doesnt apply until after the slide I'm making an html5 website. the page I'm encountering the issue is http://yamikowebs.com/blog.php right now I'm working on the copy/paste link. when you click it the other links slide in from the left. for some reason my anchors are underlined...
TITLE: When useing jquery slide some of the css doesnt apply until after the slide QUESTION: I'm making an html5 website. the page I'm encountering the issue is http://yamikowebs.com/blog.php right now I'm working on the copy/paste link. when you click it the other links slide in from the left. for some reason my anch...
[ "javascript", "css", "jquery-ui", "html", "jquery-slider" ]
0
1
145
1
0
2011-06-05T04:51:16.037000
2011-06-05T04:57:19.550000
6,241,097
6,241,133
How to call a JQuery function defined in $(window).load from an HREF
I like to scope all of my JQuery functions and event sinks to $(window).load, like this: $(window).load(function () { function Foo(id) { alert(String.format("Do Foo for: {0}", id)); } }); Normally, I do all my work at this scope, but I have a case where I'd like to call Foo(27) from an HREF built by a standalone JQuery...
You can do this $(window).load(function (){ window.Foo = function(n){ alert(n); } }); http://jsfiddle.net/JQn8H/ Or this var Foo; $(window).load(function (){ Foo = function (n){ alert(n); } }); http://jsfiddle.net/JQn8H/2/ IMO, a better approach would be to set a namespace for your app, so you don't pollute the gobal ...
How to call a JQuery function defined in $(window).load from an HREF I like to scope all of my JQuery functions and event sinks to $(window).load, like this: $(window).load(function () { function Foo(id) { alert(String.format("Do Foo for: {0}", id)); } }); Normally, I do all my work at this scope, but I have a case whe...
TITLE: How to call a JQuery function defined in $(window).load from an HREF QUESTION: I like to scope all of my JQuery functions and event sinks to $(window).load, like this: $(window).load(function () { function Foo(id) { alert(String.format("Do Foo for: {0}", id)); } }); Normally, I do all my work at this scope, but...
[ "javascript", "jquery", "scope", "href" ]
0
7
9,846
3
0
2011-06-05T04:59:15.573000
2011-06-05T05:12:21.573000
6,241,101
6,254,132
How do you rename columns using a Visual Studio Database Project?
I'm using an SQL Server 2008 Database Prject in Visual Studio 2010 and now I need to rename one of my table columns. Using the SQL Server Data-tier Application project this can be done by right clicking on the item to rename in the Schema View and selecting the Refactor option. I don't see this option in the Database p...
After looking into this more it seems the refactoring feature is available in the Premium and Ultimate versions of Visual Studio 2010 and not in the Professional version.
How do you rename columns using a Visual Studio Database Project? I'm using an SQL Server 2008 Database Prject in Visual Studio 2010 and now I need to rename one of my table columns. Using the SQL Server Data-tier Application project this can be done by right clicking on the item to rename in the Schema View and select...
TITLE: How do you rename columns using a Visual Studio Database Project? QUESTION: I'm using an SQL Server 2008 Database Prject in Visual Studio 2010 and now I need to rename one of my table columns. Using the SQL Server Data-tier Application project this can be done by right clicking on the item to rename in the Sche...
[ "visual-studio-2010", "sql-server-2008", "database-project" ]
1
0
2,365
4
0
2011-06-05T04:59:57.623000
2011-06-06T15:13:16.790000
6,241,102
6,241,140
Copy a database with data in MySQL
I have a base set of data held in a database on my server. When a user signs up for my service, I want to be able to copy this database to another database that has been created. Is there a simple and effective way to do this using PHP / MySQL? Pure MySQL would be preferable. I thought about looping through all the tab...
Here is an article with ten ways to back up a database and restore it. Each uses a different method, most of which probably work in your situation but a few apply: http://www.noupe.com/how-tos/10-ways-to-automatically-manually-backup-mysql-database.html Number six talks about creating a dump file and then restoring it ...
Copy a database with data in MySQL I have a base set of data held in a database on my server. When a user signs up for my service, I want to be able to copy this database to another database that has been created. Is there a simple and effective way to do this using PHP / MySQL? Pure MySQL would be preferable. I though...
TITLE: Copy a database with data in MySQL QUESTION: I have a base set of data held in a database on my server. When a user signs up for my service, I want to be able to copy this database to another database that has been created. Is there a simple and effective way to do this using PHP / MySQL? Pure MySQL would be pr...
[ "php", "mysql" ]
9
9
29,271
6
0
2011-06-05T05:00:52.060000
2011-06-05T05:14:48.920000
6,241,107
6,242,218
CSS issue - How to Prevent Floating Objects from Wrapping in a Container, without changing size of container?
Here is my JSfiddle document: http://jsfiddle.net/TSM_mac/xXcZx/1/ Basically, I am trying to make the second div slide in as the first div slides out. I am having a problem with my CSS, the second div (because it is float: left) goes to the next line The way to fix it would be to make sure that they always stay on the ...
Here is what I came up with: http://jsfiddle.net/wdm954/xXcZx/7/ I added a around your other DIVs with overflow:hidden and removed the styling from #container and set its width dynamically with jQuery. $('#container').width(function() { return $('.page').width() * $('.page').length; }); Since you have the.page class on...
CSS issue - How to Prevent Floating Objects from Wrapping in a Container, without changing size of container? Here is my JSfiddle document: http://jsfiddle.net/TSM_mac/xXcZx/1/ Basically, I am trying to make the second div slide in as the first div slides out. I am having a problem with my CSS, the second div (because ...
TITLE: CSS issue - How to Prevent Floating Objects from Wrapping in a Container, without changing size of container? QUESTION: Here is my JSfiddle document: http://jsfiddle.net/TSM_mac/xXcZx/1/ Basically, I am trying to make the second div slide in as the first div slides out. I am having a problem with my CSS, the se...
[ "jquery", "jquery-selectors", "css" ]
0
1
295
2
0
2011-06-05T05:03:40.297000
2011-06-05T10:04:57.050000
6,241,126
6,241,178
Opening WPF form as a dialog on button click
I am building a WPF application in which I need to open one of my WPF forms as a dialog (pop up) on the button click of another form. I know how do it in windows forms, just not getting how I'll do it in WPF. Thanks in advance.
Here is a complete explanation of how to do a Dialog in WPF: http://marlongrech.wordpress.com/2008/05/28/wpf-dialogs-and-dialogresult/ The basic code you are looking for is as follows: wpfDialog dialog = new wpfDialog(); dialog.ShowDialog(); The above article will walk you through how to get information back from the f...
Opening WPF form as a dialog on button click I am building a WPF application in which I need to open one of my WPF forms as a dialog (pop up) on the button click of another form. I know how do it in windows forms, just not getting how I'll do it in WPF. Thanks in advance.
TITLE: Opening WPF form as a dialog on button click QUESTION: I am building a WPF application in which I need to open one of my WPF forms as a dialog (pop up) on the button click of another form. I know how do it in windows forms, just not getting how I'll do it in WPF. Thanks in advance. ANSWER: Here is a complete e...
[ "wpf", "winforms", "dialog" ]
1
1
7,946
2
0
2011-06-05T05:09:44.647000
2011-06-05T05:27:36.090000
6,241,128
6,241,196
Am I allowed to have one button with two actions in one for-loop?
Is there any reason I shouldn't do this? I'm fairly new at programming iPhone so I just want to check that its not making my memory footprint really high for some reason or anything like that. I'm creating buttons in a loop (one for each letter in a phrase) and then there may be up to about 100 instances of this code r...
You're registering 2 different selectors for same events type. What will happen - the second one will override the first one. What is the point of this? May be you have a typo in your code sample, but anyway, you can register different selectors for different events. And if you're creating your buttons in the loop it's...
Am I allowed to have one button with two actions in one for-loop? Is there any reason I shouldn't do this? I'm fairly new at programming iPhone so I just want to check that its not making my memory footprint really high for some reason or anything like that. I'm creating buttons in a loop (one for each letter in a phra...
TITLE: Am I allowed to have one button with two actions in one for-loop? QUESTION: Is there any reason I shouldn't do this? I'm fairly new at programming iPhone so I just want to check that its not making my memory footprint really high for some reason or anything like that. I'm creating buttons in a loop (one for eac...
[ "iphone", "objective-c", "cocoa-touch" ]
0
1
415
2
0
2011-06-05T05:09:58.270000
2011-06-05T05:33:06.127000
6,241,131
6,241,156
Selenium Popup support
I have few questions on this as selenium always need windowid to get control over popup. 1-What is the best way to get the windowid of any popup. 3-is it necessary that we must get the windowid of the each & every popup in the view source of the page. if not so what will be work-around. 4-Is window id present in any ja...
1-What is the best way to get the windowid of any popup. The best way to get window handle is by name (window.open(url, "Name", options)) _selenium.WaitForPopup("Name", "3000"); 3-is it necessary that we must get the windowid of the each & every popup in the view source of the page. if not so what will be work-around. ...
Selenium Popup support I have few questions on this as selenium always need windowid to get control over popup. 1-What is the best way to get the windowid of any popup. 3-is it necessary that we must get the windowid of the each & every popup in the view source of the page. if not so what will be work-around. 4-Is wind...
TITLE: Selenium Popup support QUESTION: I have few questions on this as selenium always need windowid to get control over popup. 1-What is the best way to get the windowid of any popup. 3-is it necessary that we must get the windowid of the each & every popup in the view source of the page. if not so what will be work...
[ "selenium", "selenium-rc" ]
1
0
1,319
2
0
2011-06-05T05:11:18.700000
2011-06-05T05:19:10.133000
6,241,143
6,241,164
Save output of a SP to a file and create a job to execute it
I have a SP which returns a XML string as output. I want to save the result in a.xml file automatically when the SP is executed. whats the best way to do that?
This might be exactly what you are looking for: http://munishbansal.wordpress.com/2009/02/20/saving-results-of-a-stored-procedure-into-a-xml-file/ In a nutshell, you have four options: Using CLR Stored Procedure. Using Command Line Utility (OSQL). Using xp_CmdShell utility of SQL Server. Creating OLE objects in SQL Ser...
Save output of a SP to a file and create a job to execute it I have a SP which returns a XML string as output. I want to save the result in a.xml file automatically when the SP is executed. whats the best way to do that?
TITLE: Save output of a SP to a file and create a job to execute it QUESTION: I have a SP which returns a XML string as output. I want to save the result in a.xml file automatically when the SP is executed. whats the best way to do that? ANSWER: This might be exactly what you are looking for: http://munishbansal.word...
[ "sql", "sql-server" ]
0
0
1,848
2
0
2011-06-05T05:15:12.990000
2011-06-05T05:21:40.570000
6,241,146
6,241,219
Abstract factory with abstract parameters?
I'm trying to design a good entity creation system with an abstract factory (as per http://www.dofactory.com/Patterns/PatternAbstract.aspx ) but I'm struggling when it comes to instance specific parameters. For example: I have two abstract factories, one for creating a projectile, and one for creating a crate Now the f...
A couple options: Rethink your usage An abstract factory is useful if it separates the user of the factory from how the exact type is produced. The abstract factory doesn't have any restrictions on what it produces, just that it is abstract. It can return a non-abstract type, or an abstract type that isn't at the very ...
Abstract factory with abstract parameters? I'm trying to design a good entity creation system with an abstract factory (as per http://www.dofactory.com/Patterns/PatternAbstract.aspx ) but I'm struggling when it comes to instance specific parameters. For example: I have two abstract factories, one for creating a project...
TITLE: Abstract factory with abstract parameters? QUESTION: I'm trying to design a good entity creation system with an abstract factory (as per http://www.dofactory.com/Patterns/PatternAbstract.aspx ) but I'm struggling when it comes to instance specific parameters. For example: I have two abstract factories, one for ...
[ "c++", "factory-pattern" ]
9
6
3,162
1
0
2011-06-05T05:16:13.460000
2011-06-05T05:39:34.723000
6,241,150
6,242,046
AdoQuery not working with SHOW: command
and I am tearing my hair out!! Even something simple like this work: procedure MyAdoQueryTest(); const MYSQL_CONNECT_STRING='Driver={MySQL ODBC 5.1 Driver};Server=%s;Port=3306;Database=%s;User=%s;Password=%s;Option=3;'; var AdoConnection: TADOConnection; ADOQuery: TADOQuery; Param: TParameter; begin AdoConnection:= TA...
The error is here: ADOQuery.SQl.Add('SHOW:what_to_show'); The:Param can only be used for values, not for dynamic column/keyword/table/database names. This is because if it worked like that you'd have an SQL-injection risk depending on the contents of your parameter. In order to fix that you'll have to inject your what_...
AdoQuery not working with SHOW: command and I am tearing my hair out!! Even something simple like this work: procedure MyAdoQueryTest(); const MYSQL_CONNECT_STRING='Driver={MySQL ODBC 5.1 Driver};Server=%s;Port=3306;Database=%s;User=%s;Password=%s;Option=3;'; var AdoConnection: TADOConnection; ADOQuery: TADOQuery; Par...
TITLE: AdoQuery not working with SHOW: command QUESTION: and I am tearing my hair out!! Even something simple like this work: procedure MyAdoQueryTest(); const MYSQL_CONNECT_STRING='Driver={MySQL ODBC 5.1 Driver};Server=%s;Port=3306;Database=%s;User=%s;Password=%s;Option=3;'; var AdoConnection: TADOConnection; ADOQue...
[ "delphi" ]
2
5
1,056
1
0
2011-06-05T05:16:49.993000
2011-06-05T09:25:18.643000
6,241,158
6,241,224
How to determine heights of div and set border on the div with the greater height?
I have two divs floated left so that they appear next to each other. They are both populated with dynamic content so that for some users the left div may have more items and height and for others the right div might be longer. I want to put a border in between the two divs so that it is border-right on the left div if ...
What you can do is set the two divs to overlap by their border width, and set a border-right on the leftmost float, and a border-left and position: relative on the rightmost float. Then the line will appear to grow with the longest one, but in actuality it is 2 overlapping borders. I set up two examples on jsfiddle so ...
How to determine heights of div and set border on the div with the greater height? I have two divs floated left so that they appear next to each other. They are both populated with dynamic content so that for some users the left div may have more items and height and for others the right div might be longer. I want to ...
TITLE: How to determine heights of div and set border on the div with the greater height? QUESTION: I have two divs floated left so that they appear next to each other. They are both populated with dynamic content so that for some users the left div may have more items and height and for others the right div might be ...
[ "php", "css", "html" ]
0
1
1,064
2
0
2011-06-05T05:20:24.353000
2011-06-05T05:43:15.280000
6,241,162
6,241,361
how to enumerate class method then chain them with itertools.product() in python?
I just learned yesterday from this site that I can: class Seq(object): def __init__(self, seq): self.seq = seq def __repr__(self): return repr(self.seq) def __str__(self): return str(self.seq) def all(self): return Seq(self.seq[:]) def head(self, count): return Seq(self.seq[:count]) def tail(self, count): return Seq(se...
Note that something like "s.head()" means a method which is "bound" to that specific instance of Seq, that is, "s." Something like "Seq.head()" means a method which is unbound, so one can still pass in different instances of Seq. From there it simply requires basic functional composition and string concatenation. def c...
how to enumerate class method then chain them with itertools.product() in python? I just learned yesterday from this site that I can: class Seq(object): def __init__(self, seq): self.seq = seq def __repr__(self): return repr(self.seq) def __str__(self): return str(self.seq) def all(self): return Seq(self.seq[:]) def he...
TITLE: how to enumerate class method then chain them with itertools.product() in python? QUESTION: I just learned yesterday from this site that I can: class Seq(object): def __init__(self, seq): self.seq = seq def __repr__(self): return repr(self.seq) def __str__(self): return str(self.seq) def all(self): return Seq(s...
[ "python", "enumeration", "method-chaining", "class-method" ]
0
0
463
1
0
2011-06-05T05:21:25.443000
2011-06-05T06:25:30.630000
6,241,165
6,241,216
Add multiple imageview in uitableviewcell iphone
I have 2 image view on a single table view cell. and i am downloading the images using "Lazy Table sample". but now but when 1 image downloading completed then i am showing 1 image on cell. but when other 2nd image downloading complted then how i update the cell using "cellForRowAtIndexPath". can any one suggest me. th...
reloadRowsAtIndexPaths:withRowAnimation: Look UITableView class reference
Add multiple imageview in uitableviewcell iphone I have 2 image view on a single table view cell. and i am downloading the images using "Lazy Table sample". but now but when 1 image downloading completed then i am showing 1 image on cell. but when other 2nd image downloading complted then how i update the cell using "c...
TITLE: Add multiple imageview in uitableviewcell iphone QUESTION: I have 2 image view on a single table view cell. and i am downloading the images using "Lazy Table sample". but now but when 1 image downloading completed then i am showing 1 image on cell. but when other 2nd image downloading complted then how i update...
[ "iphone", "uitableview" ]
0
2
410
1
0
2011-06-05T05:21:47.870000
2011-06-05T05:38:14.220000
6,241,167
6,241,610
Help setting up OSMdroid library for displaying OpenSourceMaps
Hey. I am having trouble setting up the OSMdroid library to display OpenSourceMaps. I am working on an activity that will allow the user to see a map of their current location wit buttons to allow the user to switch between normal google maps view, terrain google maps view, and openstreetmaps view. I am currently using...
I managed to get osmdroid working in a project, but had to have the Google and the OSM views in different activities as if you switch a Mapview from Google to OSM and then try to go back to Google, I got a runtime error saying something like "only one mapview allowed per activity". This results in a lot of duplicate co...
Help setting up OSMdroid library for displaying OpenSourceMaps Hey. I am having trouble setting up the OSMdroid library to display OpenSourceMaps. I am working on an activity that will allow the user to see a map of their current location wit buttons to allow the user to switch between normal google maps view, terrain ...
TITLE: Help setting up OSMdroid library for displaying OpenSourceMaps QUESTION: Hey. I am having trouble setting up the OSMdroid library to display OpenSourceMaps. I am working on an activity that will allow the user to see a map of their current location wit buttons to allow the user to switch between normal google m...
[ "android", "osmdroid" ]
0
1
3,456
1
0
2011-06-05T05:22:15.063000
2011-06-05T07:46:08.980000
6,241,168
6,241,483
Tkinter Canvas Problems
I'm trying to change the layering of Tkinter Canvas widgets. With most widgets you can force the widget above other widgets by using the lift method. However, if I try the same on a Canvas widget I get an error. Error: TypeError: tag_raise() got an unexpected keyword argument 'aboveThis' An Example of my Problem: impor...
The canvas lift() method is an alias for tag_raise(), which is used to raise not the canvas itself but entities within the canvas. I found this comment within the Tkinter.py source code: # lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift, # so the preferred name for them is tag_lower, tag_raise # (similar to tag_...
Tkinter Canvas Problems I'm trying to change the layering of Tkinter Canvas widgets. With most widgets you can force the widget above other widgets by using the lift method. However, if I try the same on a Canvas widget I get an error. Error: TypeError: tag_raise() got an unexpected keyword argument 'aboveThis' An Exam...
TITLE: Tkinter Canvas Problems QUESTION: I'm trying to change the layering of Tkinter Canvas widgets. With most widgets you can force the widget above other widgets by using the lift method. However, if I try the same on a Canvas widget I get an error. Error: TypeError: tag_raise() got an unexpected keyword argument '...
[ "python", "canvas", "tkinter" ]
1
3
2,704
2
0
2011-06-05T05:22:44.580000
2011-06-05T07:08:14.023000
6,241,177
6,241,237
Questions: controlling a Swing GUI from an external class and separating logic from user interface
UPDATE: I'm using Netbeans and Matise and it's possible that it could be Matise causing the problems I describe below. UPDATE 2: Thanks to those who offered constructive suggestions. After rewriting the code without Matise's help, the answer offered by ignis worked as he described. I'm still not sure how the code the N...
There is no need to use listeners. GUI objects are just like any other objects in the program, so actually you can use the listener pattern in any part of the program, even if it is unrelated to the GUI you can invoke methods of objects of the GUI whenever you want during the program execution, even if you do not attac...
Questions: controlling a Swing GUI from an external class and separating logic from user interface UPDATE: I'm using Netbeans and Matise and it's possible that it could be Matise causing the problems I describe below. UPDATE 2: Thanks to those who offered constructive suggestions. After rewriting the code without Matis...
TITLE: Questions: controlling a Swing GUI from an external class and separating logic from user interface QUESTION: UPDATE: I'm using Netbeans and Matise and it's possible that it could be Matise causing the problems I describe below. UPDATE 2: Thanks to those who offered constructive suggestions. After rewriting the ...
[ "java", "swing", "jtextfield" ]
4
3
1,443
3
0
2011-06-05T05:26:55.723000
2011-06-05T05:48:11.943000
6,241,183
6,244,470
A Couple Obj-C Questions
EDIT: My internet went out last night._. Well I'm new to the language. I got some basics down but: -(XYPoint *)origin In this, why does the return value for this method look like a pointer? I'm confused. I know what void, id, double, etc are but I don't get why this has a pointer. I was going through Kochans book, and ...
Simply because the return type is a pointer type, so it's designated as returning a pointer. Note that anything can be turned into a pointer type where the pointer is returned rather than the object it points to in memory, but that's probably something more advanced than just Objective-C classes. Release doesn't always...
A Couple Obj-C Questions EDIT: My internet went out last night._. Well I'm new to the language. I got some basics down but: -(XYPoint *)origin In this, why does the return value for this method look like a pointer? I'm confused. I know what void, id, double, etc are but I don't get why this has a pointer. I was going t...
TITLE: A Couple Obj-C Questions QUESTION: EDIT: My internet went out last night._. Well I'm new to the language. I got some basics down but: -(XYPoint *)origin In this, why does the return value for this method look like a pointer? I'm confused. I know what void, id, double, etc are but I don't get why this has a poin...
[ "objective-c" ]
0
0
90
1
0
2011-06-05T05:30:03.947000
2011-06-05T17:10:49.773000
6,241,193
6,247,458
creating a Mutable array that can be added to in later clicks of the same button?
General noob questions: (1) How can I create an NSMutable array in a buttonClicked action that I can add more entries to during subsequent clicks of the same button? I always seem to start over with a new array at every click (the array prints with only 1 entry which is the most recent button's tag in an NSLog statemen...
Okay, firstly you are creating a locally scoped array that is being re-initialised on every call to buttonClicked:. The variable should be part of the class init cycle. You will also be better off with an NSMutableDictionary instead of an NSMutableArray. With a dictionary we don't have to specify capacity and we can us...
creating a Mutable array that can be added to in later clicks of the same button? General noob questions: (1) How can I create an NSMutable array in a buttonClicked action that I can add more entries to during subsequent clicks of the same button? I always seem to start over with a new array at every click (the array p...
TITLE: creating a Mutable array that can be added to in later clicks of the same button? QUESTION: General noob questions: (1) How can I create an NSMutable array in a buttonClicked action that I can add more entries to during subsequent clicks of the same button? I always seem to start over with a new array at every ...
[ "iphone", "objective-c", "arrays", "ipad", "nsmutablearray" ]
4
3
234
1
0
2011-06-05T05:32:17.563000
2011-06-06T03:09:38.780000
6,241,211
6,245,072
How to reduce number of logic elements
I am trying to reduce the number of logic elements in my vhdl code. I am using quartus II to program a Altera DE2 FPGA. Can someone please give some advice on how I can do that? Thanks
Without additional detail of your design, only generic advice can be given. There are many ways to reduce device utilization in an FPGA, which break down into two major categories: Better use of your build toolset (synthesis, map, p&r tools) Better HDL design Build Toolset Areas to Look For Set tool to optimize for are...
How to reduce number of logic elements I am trying to reduce the number of logic elements in my vhdl code. I am using quartus II to program a Altera DE2 FPGA. Can someone please give some advice on how I can do that? Thanks
TITLE: How to reduce number of logic elements QUESTION: I am trying to reduce the number of logic elements in my vhdl code. I am using quartus II to program a Altera DE2 FPGA. Can someone please give some advice on how I can do that? Thanks ANSWER: Without additional detail of your design, only generic advice can be ...
[ "vhdl", "fpga", "intel-fpga" ]
0
5
5,559
2
0
2011-06-05T05:37:03.820000
2011-06-05T18:54:01.147000
6,241,213
6,249,485
Adding Action Bar items during run time
Is there anyway to add Action Bar items on the event of a button click or a list item click? I know about Action Mode but it is intended for multiple choices. So, my user interface requirement is that on clicking the list item, there should be a new action bar item for editing the selected item.
What you are describing is the entire reason why ActionMode was created. Catering for multiple choices is just one option available to you when using ActionMode. You should really be using this rather than trying to find some other hack around it. It provides callbacks to add action items and remove them once you are d...
Adding Action Bar items during run time Is there anyway to add Action Bar items on the event of a button click or a list item click? I know about Action Mode but it is intended for multiple choices. So, my user interface requirement is that on clicking the list item, there should be a new action bar item for editing th...
TITLE: Adding Action Bar items during run time QUESTION: Is there anyway to add Action Bar items on the event of a button click or a list item click? I know about Action Mode but it is intended for multiple choices. So, my user interface requirement is that on clicking the list item, there should be a new action bar i...
[ "android", "android-3.0-honeycomb", "android-actionbar" ]
0
2
711
1
0
2011-06-05T05:37:49.580000
2011-06-06T08:38:39.620000
6,241,236
6,241,637
Force apply to return a list
I have a matrix and a function that takes a vector and returns a matrix. I want to apply the function to all rows of the matrix and rbind all results together. For example mat <- matrix(1:6, ncol=2) f <- function (x) cbind(1:sum(x), sum(x):1) do.call(rbind, apply(mat, 1, f)) This works perfectly since the returned matr...
You have to split matrix mat before applying function f. list_result <- lapply(split(mat,seq(NROW(mat))),f) matrix_result <- do.call(rbind,list_result)
Force apply to return a list I have a matrix and a function that takes a vector and returns a matrix. I want to apply the function to all rows of the matrix and rbind all results together. For example mat <- matrix(1:6, ncol=2) f <- function (x) cbind(1:sum(x), sum(x):1) do.call(rbind, apply(mat, 1, f)) This works perf...
TITLE: Force apply to return a list QUESTION: I have a matrix and a function that takes a vector and returns a matrix. I want to apply the function to all rows of the matrix and rbind all results together. For example mat <- matrix(1:6, ncol=2) f <- function (x) cbind(1:sum(x), sum(x):1) do.call(rbind, apply(mat, 1, f...
[ "r" ]
20
16
10,762
3
0
2011-06-05T05:47:45.893000
2011-06-05T07:52:29.657000
6,241,244
6,241,295
Initialization makes integer without a cast
I get this warning and I am not sure how to fix it. The line where I get the warning is NSInteger thescore = [[myDictionary objectForKey:@"Score"] objectAtIndex:0]; If it makes a difference, myDictionary is a NSDictionary Edit: How is this? Btw my array is a NSMutableArray and not a NSArray NSInteger thescore = [[myDic...
The result of call [someArray objectAtIndex:0] is an object. And NSInteger is a primitive type: typedef long NSInteger; (cmd + double-click on NSInteger in xcode to see the definition) I guess you might actually be storing NSNumber objects in your array. In this case, you could do NSNumber *thescore = [someArray object...
Initialization makes integer without a cast I get this warning and I am not sure how to fix it. The line where I get the warning is NSInteger thescore = [[myDictionary objectForKey:@"Score"] objectAtIndex:0]; If it makes a difference, myDictionary is a NSDictionary Edit: How is this? Btw my array is a NSMutableArray an...
TITLE: Initialization makes integer without a cast QUESTION: I get this warning and I am not sure how to fix it. The line where I get the warning is NSInteger thescore = [[myDictionary objectForKey:@"Score"] objectAtIndex:0]; If it makes a difference, myDictionary is a NSDictionary Edit: How is this? Btw my array is a...
[ "objective-c", "warnings" ]
1
1
117
1
0
2011-06-05T05:49:17.860000
2011-06-05T06:05:53.627000
6,241,245
6,243,458
Tree traversal in a customised way in Python?
I have two trees in python. I need to compare them in a customized way according to the following specifications. Suppose I have a tree for entity E1 and a tree for entity E2. I need to traverse both the trees starting from E1 and E2 and moving upwards till I get to a common root. ( Please note that I have to start the...
def closest_common_ancestor(ds1, ds2): while ds1!= None: dd = ds2 while dd!= None: if ds1 == dd: return dd dd = dd.parent ds1 = ds1.parent return None
Tree traversal in a customised way in Python? I have two trees in python. I need to compare them in a customized way according to the following specifications. Suppose I have a tree for entity E1 and a tree for entity E2. I need to traverse both the trees starting from E1 and E2 and moving upwards till I get to a commo...
TITLE: Tree traversal in a customised way in Python? QUESTION: I have two trees in python. I need to compare them in a customized way according to the following specifications. Suppose I have a tree for entity E1 and a tree for entity E2. I need to traverse both the trees starting from E1 and E2 and moving upwards til...
[ "python", "tree" ]
1
0
357
3
0
2011-06-05T05:49:20.820000
2011-06-05T14:17:35.253000
6,241,249
6,242,557
Listening to when the user session is ended in a JSF managed bean
Is it possible to do something like this: When a user session starts I read a certain integral attribute from the database. As the user performs certain activities in this session, I update that variable(stored in session) & when the session ends, then I finally store that value to the DB. My question is how do I ident...
Apart from the HttpSessionListener, you can use a session scoped managed bean for this. You use @PostConstruct (or just the bean's constructor) and @PreDestroy annotations to hook on session creation and destroy @ManagedBean @SessionScoped public class SessionManager { @PostConstruct public void sessionInitialized() {...
Listening to when the user session is ended in a JSF managed bean Is it possible to do something like this: When a user session starts I read a certain integral attribute from the database. As the user performs certain activities in this session, I update that variable(stored in session) & when the session ends, then I...
TITLE: Listening to when the user session is ended in a JSF managed bean QUESTION: Is it possible to do something like this: When a user session starts I read a certain integral attribute from the database. As the user performs certain activities in this session, I update that variable(stored in session) & when the se...
[ "session", "jsf", "listener", "managed-bean" ]
6
10
5,439
3
0
2011-06-05T05:50:07.527000
2011-06-05T11:14:43.163000
6,241,250
6,241,658
How to exclude links/images so that they are not affected by fancybox?
Right now, the fancybox plugin is being used in all my images links. I can't really control this right now. But I need to exclude one page. How to do that? (Maybe excluding a div with a certain class or ID).
Regarding lightboxing I always use prettyPhoto, because: it's very much flexible and it has an API which enables you to make your images totally and fully customizable without binding any data to your inline images Also if you are developing using a server side language then using this API makes your code more readable...
How to exclude links/images so that they are not affected by fancybox? Right now, the fancybox plugin is being used in all my images links. I can't really control this right now. But I need to exclude one page. How to do that? (Maybe excluding a div with a certain class or ID).
TITLE: How to exclude links/images so that they are not affected by fancybox? QUESTION: Right now, the fancybox plugin is being used in all my images links. I can't really control this right now. But I need to exclude one page. How to do that? (Maybe excluding a div with a certain class or ID). ANSWER: Regarding ligh...
[ "jquery", "fancybox" ]
0
1
429
1
0
2011-06-05T05:50:10.963000
2011-06-05T08:00:08.047000
6,241,253
6,241,262
Is there something about the os module I'm not getting?
For the last half hour I've been trying to figure out what is wrong with this code. It should be very straight forward. I've practically copied it out of the documentation at this point. But no matter what I try I receive a syntax error. Here's the code: def addfiles(folder): foldercont = [os.path.normcase(f) for f in ...
There's a parenthesis missing at this line: files.append(os.path.realpath(x) ^ Python complains about the True: bit because it's expecting a statement like (x if condition else y) As jcomeau_ictx says, you should also leave out the == True when checking for booleans: if x: do_something if not y: do_something_else
Is there something about the os module I'm not getting? For the last half hour I've been trying to figure out what is wrong with this code. It should be very straight forward. I've practically copied it out of the documentation at this point. But no matter what I try I receive a syntax error. Here's the code: def addfi...
TITLE: Is there something about the os module I'm not getting? QUESTION: For the last half hour I've been trying to figure out what is wrong with this code. It should be very straight forward. I've practically copied it out of the documentation at this point. But no matter what I try I receive a syntax error. Here's t...
[ "python", "syntax", "file", "operating-system" ]
1
11
1,262
2
0
2011-06-05T05:51:58.950000
2011-06-05T05:54:12.643000