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,217,663 | 6,217,702 | Limiting FPS for my game | Alright, i'm making a small game, and I need to limit my FPS, because, when I play on my really fast computer, I have around 850 FPS, and the game will go like, REALLY fast, and when I switch to my older computer, it goes alot slower, so I will need to limit my FPS to get this right. How do I limit my FPS? My main game... | It sounds like your display it tied to your game engine. Make sure the two are disconnected. You want the game playing at the same speed no matter what the framerate is. If your fast computer repaints the screen faster that is ok if the engine is causing the game to play at a constant speed. | Limiting FPS for my game Alright, i'm making a small game, and I need to limit my FPS, because, when I play on my really fast computer, I have around 850 FPS, and the game will go like, REALLY fast, and when I switch to my older computer, it goes alot slower, so I will need to limit my FPS to get this right. How do I l... | TITLE:
Limiting FPS for my game
QUESTION:
Alright, i'm making a small game, and I need to limit my FPS, because, when I play on my really fast computer, I have around 850 FPS, and the game will go like, REALLY fast, and when I switch to my older computer, it goes alot slower, so I will need to limit my FPS to get this... | [
"java",
"frame-rate"
] | 3 | 4 | 6,913 | 6 | 0 | 2011-06-02T17:00:05.097000 | 2011-06-02T17:03:55.173000 |
6,217,676 | 6,218,297 | Silverlight Won't Load PivotViewer Collection | I'm trying to get a proof-of-concept PivotViewer application up and running, but I can't get the collection to load properly, even in a testing environment. I'm following these instructions: Building Your First PivotViewer Application I have a clientaccesspolicy XML file in the root, giving all URIs access. I copied an... | OK, here's a number of ways forward for you. Firstly, wire up the PivotViewer's CollectionLoadingFailed event before calling the LoadCollection method. This will expose a CollectionErrorEventArgs containing any exceptions. Secondly, install Fiddler2 and use it to watch what the PivotViewer is requesting. If it's failin... | Silverlight Won't Load PivotViewer Collection I'm trying to get a proof-of-concept PivotViewer application up and running, but I can't get the collection to load properly, even in a testing environment. I'm following these instructions: Building Your First PivotViewer Application I have a clientaccesspolicy XML file in... | TITLE:
Silverlight Won't Load PivotViewer Collection
QUESTION:
I'm trying to get a proof-of-concept PivotViewer application up and running, but I can't get the collection to load properly, even in a testing environment. I'm following these instructions: Building Your First PivotViewer Application I have a clientaccess... | [
"silverlight",
"visual-studio-2010",
"pivotviewer"
] | 0 | 1 | 1,113 | 1 | 0 | 2011-06-02T17:01:38.030000 | 2011-06-02T17:56:13.307000 |
6,217,679 | 6,217,750 | Create/restore database from backup SQL Server Express | I don't have SQL Server Management Studio on my machine. I have a database backup (SQL Server 2008 R2). There is SQL Server Express that installed with Visual studio 2010 ultimate installed on my machine. How can I restore this back up on a database and attaching it to SQL Server Express? Is there any solution wihout u... | Even with SQL Server Management Studio Express, you won't be able to restore this backup. The Express edition being installed with Visual Studio 2010 is version 2008 of SQL Server - your backup is one from a SQL Server 2008 R2 release - those backups cannot be restore onto a 2008 version. You will need to download the ... | Create/restore database from backup SQL Server Express I don't have SQL Server Management Studio on my machine. I have a database backup (SQL Server 2008 R2). There is SQL Server Express that installed with Visual studio 2010 ultimate installed on my machine. How can I restore this back up on a database and attaching i... | TITLE:
Create/restore database from backup SQL Server Express
QUESTION:
I don't have SQL Server Management Studio on my machine. I have a database backup (SQL Server 2008 R2). There is SQL Server Express that installed with Visual studio 2010 ultimate installed on my machine. How can I restore this back up on a databa... | [
"sql-server",
"sql-server-express",
"database-restore"
] | 24 | 29 | 91,771 | 4 | 0 | 2011-06-02T17:02:03.143000 | 2011-06-02T17:08:09.837000 |
6,217,692 | 6,217,906 | Detecting the device being plugged in | I would like to be able to detect whether or not the device is plugged in. I would like to be able to just query that the same way we can do for the connectivity state. Is that possible or do I need to create a broadcast receiver that listens for the battery events? | Apparently the ACTION_BATTERY_CHANGED is a "sticky broadcast" which means you can register for it and receive it any time after it has been broadcast. To get the plugged state you can do something like: public void onCreate() { BroadcastReceiver receiver = new BroadcastReceiver() { public void onReceive(Context context... | Detecting the device being plugged in I would like to be able to detect whether or not the device is plugged in. I would like to be able to just query that the same way we can do for the connectivity state. Is that possible or do I need to create a broadcast receiver that listens for the battery events? | TITLE:
Detecting the device being plugged in
QUESTION:
I would like to be able to detect whether or not the device is plugged in. I would like to be able to just query that the same way we can do for the connectivity state. Is that possible or do I need to create a broadcast receiver that listens for the battery event... | [
"android",
"battery",
"power-state"
] | 9 | 24 | 9,017 | 1 | 0 | 2011-06-02T17:03:14.487000 | 2011-06-02T17:23:38.447000 |
6,217,696 | 6,217,923 | CSS Div with background image - how to allow for expansion of div on page? | I wasn't sure how to word the question for this topic...sorry. I'm just starting to learn CSS. I have a with a background image and there is text within the. I read that choosing font sizes in em is a good choice because some people might require larger text sizes in their browsers. So setting the font-size with em wou... | You could set the width of the div to the img width so that it never expands wider (beyond the image). Of course, the enlarged text would force the div to grow height-wise. You could also set the background-img to repeat (if the image allows for it), so that when the text expands, the image is repeated. background-imag... | CSS Div with background image - how to allow for expansion of div on page? I wasn't sure how to word the question for this topic...sorry. I'm just starting to learn CSS. I have a with a background image and there is text within the. I read that choosing font sizes in em is a good choice because some people might requir... | TITLE:
CSS Div with background image - how to allow for expansion of div on page?
QUESTION:
I wasn't sure how to word the question for this topic...sorry. I'm just starting to learn CSS. I have a with a background image and there is text within the. I read that choosing font sizes in em is a good choice because some p... | [
"css",
"html",
"cross-browser",
"background-image"
] | 1 | 1 | 1,637 | 2 | 0 | 2011-06-02T17:03:29.587000 | 2011-06-02T17:24:51.667000 |
6,217,709 | 6,217,755 | What is a good way to report on changes to documents in sharepoint 2007 | I've been requested to implement a means of reporting on add/update/deletes on files stored sharepoint (MOSS 2007). After a little bit of research I found out sharepoint has out of the box document auditing which I enabled a couple days ago. I ran the report today, but excel spreadsheet was not very easy to look at. Al... | If you have access to the SSRS instance for SharePoint, you can get the report file. You can then make a copy and edit for the report you would like. permissions are a separate issue that can be tackled however you desire, especially if you create a copy and store as a new report. | What is a good way to report on changes to documents in sharepoint 2007 I've been requested to implement a means of reporting on add/update/deletes on files stored sharepoint (MOSS 2007). After a little bit of research I found out sharepoint has out of the box document auditing which I enabled a couple days ago. I ran ... | TITLE:
What is a good way to report on changes to documents in sharepoint 2007
QUESTION:
I've been requested to implement a means of reporting on add/update/deletes on files stored sharepoint (MOSS 2007). After a little bit of research I found out sharepoint has out of the box document auditing which I enabled a coupl... | [
"reporting-services",
"sharepoint-2007",
"document-library"
] | 0 | 0 | 40 | 1 | 0 | 2011-06-02T17:04:46.823000 | 2011-06-02T17:09:26.077000 |
6,217,719 | 6,218,725 | branch diverged after rebase from another upstream | I've forked a project. I've also added handle 'upstream' that points to the original repository, and origin points to forked repository. After few days, i tried to fetch content from upstream and rebase it. After rebase, it shows branch diverging message. Commands i used are: git fetch upstream master git rebase upstre... | If you're not making any changes and just trying to keep your fork up to date, the workflow would be (assuming you have master checked out): git fetch upstream master git merge --ff-only upstream/master git push origin master The middle command is what you are missing. If you don't care about having a local branch that... | branch diverged after rebase from another upstream I've forked a project. I've also added handle 'upstream' that points to the original repository, and origin points to forked repository. After few days, i tried to fetch content from upstream and rebase it. After rebase, it shows branch diverging message. Commands i us... | TITLE:
branch diverged after rebase from another upstream
QUESTION:
I've forked a project. I've also added handle 'upstream' that points to the original repository, and origin points to forked repository. After few days, i tried to fetch content from upstream and rebase it. After rebase, it shows branch diverging mess... | [
"git",
"git-rebase"
] | 3 | 4 | 1,047 | 1 | 0 | 2011-06-02T17:05:39.087000 | 2011-06-02T18:29:25.507000 |
6,217,734 | 6,217,748 | C++ Why is it calling the function with reference | say i have the following C++ class. class C { int foo() const; int & foo(); }; and i just call myC.foo(), i can see using the debugger that it calls the one with the reference. why? thanks! | It's likely because myC is a non-const value and hence the compiler is prefering the non-const method. The const method will only be preferred when accessed from a const value. For example C value1; value1.foo(); // int& foo(); const C value2; value2.foo(); // int foo() const; EDIT Also, as Oli pointed out, overload re... | C++ Why is it calling the function with reference say i have the following C++ class. class C { int foo() const; int & foo(); }; and i just call myC.foo(), i can see using the debugger that it calls the one with the reference. why? thanks! | TITLE:
C++ Why is it calling the function with reference
QUESTION:
say i have the following C++ class. class C { int foo() const; int & foo(); }; and i just call myC.foo(), i can see using the debugger that it calls the one with the reference. why? thanks!
ANSWER:
It's likely because myC is a non-const value and henc... | [
"c++"
] | 2 | 11 | 117 | 2 | 0 | 2011-06-02T17:07:04.080000 | 2011-06-02T17:08:05.717000 |
6,217,737 | 6,217,918 | How can I update a list of checkboxes via Ajax without unchecking them | Consider the following list of checkboxes - a list of online and a list of offline users; Users Online Joe Bloggs Bill Gates John Smith Offline The Queen Steve Jobs The user can check the online users and then perform an action such as sending them (1 or more) an email - but I need the list to update dynamically as use... | 1) Wrap your lists in a form 2) Serialize the selected checkboxes 3) Perform your DOM replacement 4) Iterate through the selected checkboxes and reapply them var checked = $('#users form').serializeArray(); //perform ajax call
//in the ajax success function after replacing the DOM $.each(checked, function(i, data) { $... | How can I update a list of checkboxes via Ajax without unchecking them Consider the following list of checkboxes - a list of online and a list of offline users; Users Online Joe Bloggs Bill Gates John Smith Offline The Queen Steve Jobs The user can check the online users and then perform an action such as sending them ... | TITLE:
How can I update a list of checkboxes via Ajax without unchecking them
QUESTION:
Consider the following list of checkboxes - a list of online and a list of offline users; Users Online Joe Bloggs Bill Gates John Smith Offline The Queen Steve Jobs The user can check the online users and then perform an action suc... | [
"javascript",
"jquery-ui",
"jquery",
"jquery-selectors"
] | 3 | 2 | 1,306 | 4 | 0 | 2011-06-02T17:07:10.183000 | 2011-06-02T17:24:38.610000 |
6,217,743 | 6,217,765 | VS 2010 Express .NET Application Settings | I was trying to come up with a way to store some user-submitted config data (in essence, a unique identifier corresponding to a device they want monitored), when I came across the Application Settings in Visual Studio 2010 C# Express. My question is this: I there a reason why I should or shouldn't use the application s... | No, this is exactly where you should store such information. That's what this feature was designed for. Writing it out to a separate file should really only be considered if you need the information to be portable, or for the user to be able to interact with it directly as if it were one of their personal files. Otherw... | VS 2010 Express .NET Application Settings I was trying to come up with a way to store some user-submitted config data (in essence, a unique identifier corresponding to a device they want monitored), when I came across the Application Settings in Visual Studio 2010 C# Express. My question is this: I there a reason why I... | TITLE:
VS 2010 Express .NET Application Settings
QUESTION:
I was trying to come up with a way to store some user-submitted config data (in essence, a unique identifier corresponding to a device they want monitored), when I came across the Application Settings in Visual Studio 2010 C# Express. My question is this: I th... | [
".net",
"visual-studio-2010",
"configuration"
] | 0 | 1 | 175 | 1 | 0 | 2011-06-02T17:07:42.287000 | 2011-06-02T17:10:35.343000 |
6,217,747 | 6,219,146 | checkboxlist in asp.net MVC | I want to create a checkboxlist in asp.net mvc view and want to display week days (monday tuesday,....). I want to save the value(s) selected by user in database. How can I do this in MVC2 Someone suggested me to use "Enumeration Types as Bit Flags" mentioned here: http://msdn.microsoft.com/en-us/library/cc138362.aspx ... | Yes i would also suggest an enum in this scenario. Here is how you can do it in ASP.NET MVC: Your enum should look like this (see the link you provided): [Flags] public enum Days { Sunday = 0x1, Monday = 0x2, Tuesday = 0x4, Wednesday = 0x8, Thursday = 0x10, Friday = 0x20, Saturday = 0x40 } For reusability purposes I ha... | checkboxlist in asp.net MVC I want to create a checkboxlist in asp.net mvc view and want to display week days (monday tuesday,....). I want to save the value(s) selected by user in database. How can I do this in MVC2 Someone suggested me to use "Enumeration Types as Bit Flags" mentioned here: http://msdn.microsoft.com/... | TITLE:
checkboxlist in asp.net MVC
QUESTION:
I want to create a checkboxlist in asp.net mvc view and want to display week days (monday tuesday,....). I want to save the value(s) selected by user in database. How can I do this in MVC2 Someone suggested me to use "Enumeration Types as Bit Flags" mentioned here: http://m... | [
"asp.net-mvc-2"
] | 3 | 12 | 6,990 | 3 | 0 | 2011-06-02T17:08:01.473000 | 2011-06-02T19:06:33.880000 |
6,217,756 | 6,217,782 | Simple Issue with NSString Global Variables - HELP | Okay so here's my problem. I have a two global NSString variables. globalVariable1 //stores one string. globalVariable2 //stores 3 strings globalVariable2 is concatenated using [NSString stringWithFormat:@"%@, %@, %@", Item1, Item2, Item3]; I assign [textField setText:globalVariable1] //NO ERROR // but [textField setTe... | You probably aren't retaining globalVariable2. Since the stringWithFormat: method will return an autoreleased object, you need to retain it after you assign it. | Simple Issue with NSString Global Variables - HELP Okay so here's my problem. I have a two global NSString variables. globalVariable1 //stores one string. globalVariable2 //stores 3 strings globalVariable2 is concatenated using [NSString stringWithFormat:@"%@, %@, %@", Item1, Item2, Item3]; I assign [textField setText:... | TITLE:
Simple Issue with NSString Global Variables - HELP
QUESTION:
Okay so here's my problem. I have a two global NSString variables. globalVariable1 //stores one string. globalVariable2 //stores 3 strings globalVariable2 is concatenated using [NSString stringWithFormat:@"%@, %@, %@", Item1, Item2, Item3]; I assign [... | [
"iphone",
"objective-c",
"nsstring",
"uitextfield"
] | 0 | 2 | 148 | 1 | 0 | 2011-06-02T17:09:35.700000 | 2011-06-02T17:12:53.940000 |
6,217,757 | 6,217,807 | User can't view Database | version:SQL Server 2008 R2 I have granted a user the ability to EXECUTE and SELECT for a DB. However, when they log into SSMS they cannot see the DB that they have those permissions on. What is the minimum permission level they have to have in order to view the DB? The login is part of public server role and the EXECUT... | You can try to grant VIEW DEFINITION right. grant view definition to _user http://msdn.microsoft.com/en-us/library/ms187113.aspx Regards Piotr | User can't view Database version:SQL Server 2008 R2 I have granted a user the ability to EXECUTE and SELECT for a DB. However, when they log into SSMS they cannot see the DB that they have those permissions on. What is the minimum permission level they have to have in order to view the DB? The login is part of public s... | TITLE:
User can't view Database
QUESTION:
version:SQL Server 2008 R2 I have granted a user the ability to EXECUTE and SELECT for a DB. However, when they log into SSMS they cannot see the DB that they have those permissions on. What is the minimum permission level they have to have in order to view the DB? The login i... | [
"sql-server",
"sql-server-2008-r2"
] | 1 | 1 | 8,310 | 2 | 0 | 2011-06-02T17:09:37.167000 | 2011-06-02T17:15:39.210000 |
6,217,766 | 6,218,002 | How to set canonical hostname in linux? | Question: How do I "set" the canonical hostname as reported by java's InetAddress.getCanonicalHostname() method? Context: I'm trying to run Neo4j (which has an embedded jetty server) on CentOS 5.6. The service starts up just fine, but it's binding to the wrong address (IPv6) as evidenced by netstat. Instead of:::*, I n... | You can tell your JVM to use IPv4 instead of IPv6 via the following network property: -Djava.net.preferIPv4Stack=true See Networking properties | How to set canonical hostname in linux? Question: How do I "set" the canonical hostname as reported by java's InetAddress.getCanonicalHostname() method? Context: I'm trying to run Neo4j (which has an embedded jetty server) on CentOS 5.6. The service starts up just fine, but it's binding to the wrong address (IPv6) as e... | TITLE:
How to set canonical hostname in linux?
QUESTION:
Question: How do I "set" the canonical hostname as reported by java's InetAddress.getCanonicalHostname() method? Context: I'm trying to run Neo4j (which has an embedded jetty server) on CentOS 5.6. The service starts up just fine, but it's binding to the wrong a... | [
"java",
"linux",
"hostname",
"neo4j"
] | 1 | 3 | 1,965 | 3 | 0 | 2011-06-02T17:10:49.087000 | 2011-06-02T17:31:14.473000 |
6,217,770 | 6,217,914 | Consuming external JSON in Sencha Touch XTemplate | I've got my little asp.net mvc app working as expected, however I'm building the JSON incorrectly. Here's my current way of building a JSON object for consumption within Sencha // note: this is using a RAZOR / C# foreach loop to build a JSON string var videosToShow = [ @foreach (Web.Models.VideoListViewModel video in M... | Do it like this: var videosToShow = @Html.Raw(Json.Encode(Model)); or of course if your model has many properties and you wanted only id and title: var videosToShow = @Html.Raw(Json.Encode(Model.Select(x => new { x.id, x.title }))); It will be better/easier/shorter/safer/avoids spaghetti code/no loops/working. EDIT Ans... | Consuming external JSON in Sencha Touch XTemplate I've got my little asp.net mvc app working as expected, however I'm building the JSON incorrectly. Here's my current way of building a JSON object for consumption within Sencha // note: this is using a RAZOR / C# foreach loop to build a JSON string var videosToShow = [ ... | TITLE:
Consuming external JSON in Sencha Touch XTemplate
QUESTION:
I've got my little asp.net mvc app working as expected, however I'm building the JSON incorrectly. Here's my current way of building a JSON object for consumption within Sencha // note: this is using a RAZOR / C# foreach loop to build a JSON string var... | [
"asp.net-mvc",
"json",
"sencha-touch",
"restful-url"
] | 0 | 0 | 1,299 | 1 | 0 | 2011-06-02T17:11:03.437000 | 2011-06-02T17:24:26.607000 |
6,217,777 | 6,217,801 | Why is the following code extremely slow? | SELECT gs.HomeTeamId, 100*avg(s.P2M)/avg(s.P2A) as P2P FROM gamesstats as gs, stats as s WHERE gs.LeagueId = '145' AND gs.SeasonStart = '2010' GROUP BY gs.HomeTeamId HAVING P2P > 52.12765958 That is the SQL I try to ask for on my mysql server. For some reason it takes too much time. I can separately get s.P2M and s.P2A... | by using FROM gamesstats as gs, stats as s without a join in a where clause you're effectively creating a cross join between 2 tables. add a joining condition. | Why is the following code extremely slow? SELECT gs.HomeTeamId, 100*avg(s.P2M)/avg(s.P2A) as P2P FROM gamesstats as gs, stats as s WHERE gs.LeagueId = '145' AND gs.SeasonStart = '2010' GROUP BY gs.HomeTeamId HAVING P2P > 52.12765958 That is the SQL I try to ask for on my mysql server. For some reason it takes too much ... | TITLE:
Why is the following code extremely slow?
QUESTION:
SELECT gs.HomeTeamId, 100*avg(s.P2M)/avg(s.P2A) as P2P FROM gamesstats as gs, stats as s WHERE gs.LeagueId = '145' AND gs.SeasonStart = '2010' GROUP BY gs.HomeTeamId HAVING P2P > 52.12765958 That is the SQL I try to ask for on my mysql server. For some reason ... | [
"mysql",
"sql"
] | 0 | 2 | 69 | 2 | 0 | 2011-06-02T17:12:31.817000 | 2011-06-02T17:15:07.423000 |
6,217,783 | 6,217,958 | When I try delete a record, it creates a new one | I am trying to do a simple deletion of a record in the database. <%= button_to "Cancel your invitation", {:controller=>"invites",:method => 'destroy',:id => invite.id },:confirm => "Are you sure you want to delete this invite?" %> I specify the the controller because I am doing this action from a User view. When I clic... | You misused the methods. It should be: <%= button_to "Cancel your invitation", invite,:confirm => "Are you sure you want to delete this invite?",:method =>:delete %> There are 2 points. 1) For resources:invites, the destroy method needs delete. Without passing:method =>:delete to button_to would by default use:method =... | When I try delete a record, it creates a new one I am trying to do a simple deletion of a record in the database. <%= button_to "Cancel your invitation", {:controller=>"invites",:method => 'destroy',:id => invite.id },:confirm => "Are you sure you want to delete this invite?" %> I specify the the controller because I a... | TITLE:
When I try delete a record, it creates a new one
QUESTION:
I am trying to do a simple deletion of a record in the database. <%= button_to "Cancel your invitation", {:controller=>"invites",:method => 'destroy',:id => invite.id },:confirm => "Are you sure you want to delete this invite?" %> I specify the the cont... | [
"ruby-on-rails",
"ruby-on-rails-3"
] | 1 | 1 | 125 | 2 | 0 | 2011-06-02T17:12:57.990000 | 2011-06-02T17:28:30.067000 |
6,217,786 | 6,231,551 | CodeIgniter and throwing exceptions | I recently handed in a project for school which I built in CodeIgniter. I had to present it to my teacher and when asked how I handled certain errors, he told me to throw exceptions to intercept things a lot earlier in the chain of events. I have learnt how to throw exceptions and how to use try...catch blocks to uh, c... | Just FYI, I don't use exceptions in CodeIgniter tho I'm using them a lot in Kohana, just because the framework throws them and everything is designed to work with exceptions unlike CodeIgniter. Using exceptions is a good practice providing all your classes/framework are designed to work with them. I don't (really, DON'... | CodeIgniter and throwing exceptions I recently handed in a project for school which I built in CodeIgniter. I had to present it to my teacher and when asked how I handled certain errors, he told me to throw exceptions to intercept things a lot earlier in the chain of events. I have learnt how to throw exceptions and ho... | TITLE:
CodeIgniter and throwing exceptions
QUESTION:
I recently handed in a project for school which I built in CodeIgniter. I had to present it to my teacher and when asked how I handled certain errors, he told me to throw exceptions to intercept things a lot earlier in the chain of events. I have learnt how to throw... | [
"php",
"exception",
"codeigniter",
"error-handling"
] | 24 | 31 | 36,764 | 1 | 0 | 2011-06-02T17:13:24.673000 | 2011-06-03T19:09:13.700000 |
6,217,791 | 6,217,931 | What happens when you deserialize an incompatible version | What happens when I use an ObjectInputStream to read in a serialized object that is incompatible with the one currently defined in the program? Do I get an exception or just totally mangled data? Does it make any difference if I updated the serialVersionUID (as required) when compiling the newer version? I have looked ... | This answer sums it up: Imagine you have a class called Foo, and it has NO serialversionuid (the default), and you serialize an instance of Foo to a file. Later, you add some new members to the Foo class. If you try to deserialize the Foo object from the file, you will get a serialization failure stating that the objec... | What happens when you deserialize an incompatible version What happens when I use an ObjectInputStream to read in a serialized object that is incompatible with the one currently defined in the program? Do I get an exception or just totally mangled data? Does it make any difference if I updated the serialVersionUID (as ... | TITLE:
What happens when you deserialize an incompatible version
QUESTION:
What happens when I use an ObjectInputStream to read in a serialized object that is incompatible with the one currently defined in the program? Do I get an exception or just totally mangled data? Does it make any difference if I updated the ser... | [
"android",
"serialization",
"deserialization"
] | 2 | 1 | 385 | 2 | 0 | 2011-06-02T17:14:08.010000 | 2011-06-02T17:25:58.967000 |
6,217,793 | 6,217,819 | Why does C not run a comparison of unsigned int with negative value? | Consider this C code: #include "stdio.h"
int main(void) {
int count = 5; unsigned int i;
for (i = count; i > -1; i--) { printf("%d\n", i); } return 0; } My observation/question: the loop never gets executed. But if I change the data type of i from unsigned int to int, everything works as expected. I've been thinking... | In i > -1, the -1 is converted to unsigned int, resulting in the value UINT_MAX. i is never bigger than that value, so the loop body never executes. You might find that you can persuade your compiler to warn you about this: use of an always-true or always-false expression in a conditional context. But that still wouldn... | Why does C not run a comparison of unsigned int with negative value? Consider this C code: #include "stdio.h"
int main(void) {
int count = 5; unsigned int i;
for (i = count; i > -1; i--) { printf("%d\n", i); } return 0; } My observation/question: the loop never gets executed. But if I change the data type of i from ... | TITLE:
Why does C not run a comparison of unsigned int with negative value?
QUESTION:
Consider this C code: #include "stdio.h"
int main(void) {
int count = 5; unsigned int i;
for (i = count; i > -1; i--) { printf("%d\n", i); } return 0; } My observation/question: the loop never gets executed. But if I change the da... | [
"c",
"optimization",
"unsigned-integer"
] | 4 | 20 | 3,904 | 4 | 0 | 2011-06-02T17:14:27.620000 | 2011-06-02T17:16:17.137000 |
6,217,803 | 6,220,802 | Umbraco: How many nodes are too many? | Is it possible to have too many nodes in the umbraco cms? I'm currently taking over development of an umbraco site which will have user-generated content and a commenting system. If I were to store all this data as content nodes, will the system scale gracefully? I understand that the entire content is held as xml in r... | I know there are some very large (50,000+ content items) websites out there running Umbraco. Whether it's a good idea to implement a commenting system that stores comments within the content tree is difficult to say. If the web server has enough memory, I believe you can have hundreds of thousands of nodes without any ... | Umbraco: How many nodes are too many? Is it possible to have too many nodes in the umbraco cms? I'm currently taking over development of an umbraco site which will have user-generated content and a commenting system. If I were to store all this data as content nodes, will the system scale gracefully? I understand that ... | TITLE:
Umbraco: How many nodes are too many?
QUESTION:
Is it possible to have too many nodes in the umbraco cms? I'm currently taking over development of an umbraco site which will have user-generated content and a commenting system. If I were to store all this data as content nodes, will the system scale gracefully? ... | [
"content-management-system",
"umbraco",
"datastore"
] | 6 | 3 | 3,695 | 1 | 0 | 2011-06-02T17:15:13.030000 | 2011-06-02T21:50:08.110000 |
6,217,805 | 6,217,884 | using "order by" on inner join MySql? | hello master around the world, im here again with a problem:D now i wanna ask something simple for you but really I'm new on programming and sql, so need more learn. ok, lets to the problem. I have some sql query like this SELECT eu_product.*, eu_shop_display.display_name as dname, eu_product_img.image_url as img FROM ... | It is working. You see from the screenshot that they are first ordered by product_id and then by listing. If you just want to order by listing, then do ORDER BY eu_product_img.listing ASC. If you want to order by listing then product, reverse your order by statements. Order by accepts multiple statements, but your resu... | using "order by" on inner join MySql? hello master around the world, im here again with a problem:D now i wanna ask something simple for you but really I'm new on programming and sql, so need more learn. ok, lets to the problem. I have some sql query like this SELECT eu_product.*, eu_shop_display.display_name as dname,... | TITLE:
using "order by" on inner join MySql?
QUESTION:
hello master around the world, im here again with a problem:D now i wanna ask something simple for you but really I'm new on programming and sql, so need more learn. ok, lets to the problem. I have some sql query like this SELECT eu_product.*, eu_shop_display.disp... | [
"php",
"mysql"
] | 3 | 2 | 24,217 | 1 | 0 | 2011-06-02T17:15:34.807000 | 2011-06-02T17:21:28.030000 |
6,217,808 | 6,217,888 | jQuery toggle if NOT this | Forgive me if this is a newbie question: I've got a menu set to open the next div to see more details, and if there is another div open already it will close it while it opens the new one. I cannot figure out how to close the div already open if you click on the header associated with that div. It just closes & reopens... | Try this: $(".heading").click(function(){ // Cache stuff, so we don't have to keep generating jQuery objects var $this = $(this); var $thisContent = $this.next(".content");
// Saves a boolean value to see if the clicked element's content is // currently visible var thisWasVisible = $thisContent.is(":visible");
// Rem... | jQuery toggle if NOT this Forgive me if this is a newbie question: I've got a menu set to open the next div to see more details, and if there is another div open already it will close it while it opens the new one. I cannot figure out how to close the div already open if you click on the header associated with that div... | TITLE:
jQuery toggle if NOT this
QUESTION:
Forgive me if this is a newbie question: I've got a menu set to open the next div to see more details, and if there is another div open already it will close it while it opens the new one. I cannot figure out how to close the div already open if you click on the header associ... | [
"jquery",
"this",
"slidetoggle",
"toggleclass"
] | 1 | 6 | 3,884 | 2 | 0 | 2011-06-02T17:15:39.397000 | 2011-06-02T17:21:37.853000 |
6,217,821 | 6,217,849 | java: Graphics2D version of polyline? | OK, so there's a Line2D and a Rectangle2D that can be used by Graphics2D.draw() instead of Graphics.drawLine() and Graphics.drawRectangle(). Is there a similar "upgrade" for Graphics.drawPolyLine()? | Have a look at Path2D. It is a Shape and should thus be able to be drawn through Graphics2D.draw(). Example usage: import java.awt.*; import java.awt.geom.Path2D;
import javax.swing.*;
public class FrameTestBase extends JFrame {
public static void main(String args[]) { FrameTestBase t = new FrameTestBase(); t.add(ne... | java: Graphics2D version of polyline? OK, so there's a Line2D and a Rectangle2D that can be used by Graphics2D.draw() instead of Graphics.drawLine() and Graphics.drawRectangle(). Is there a similar "upgrade" for Graphics.drawPolyLine()? | TITLE:
java: Graphics2D version of polyline?
QUESTION:
OK, so there's a Line2D and a Rectangle2D that can be used by Graphics2D.draw() instead of Graphics.drawLine() and Graphics.drawRectangle(). Is there a similar "upgrade" for Graphics.drawPolyLine()?
ANSWER:
Have a look at Path2D. It is a Shape and should thus be ... | [
"java",
"graphics2d"
] | 3 | 8 | 4,113 | 1 | 0 | 2011-06-02T17:16:23.347000 | 2011-06-02T17:18:55.337000 |
6,217,833 | 6,217,872 | Wait table view load until an NSString is populated | I have an UITableview which has a description cell populated by an NSString, ok. But the problem is that the UITableView delegate methods are called before the code I use to download the description so it doesn't loads. How can I do something to solve this? thanks in advance:) | You can call [self.tableView reloadData]; when the download finished. | Wait table view load until an NSString is populated I have an UITableview which has a description cell populated by an NSString, ok. But the problem is that the UITableView delegate methods are called before the code I use to download the description so it doesn't loads. How can I do something to solve this? thanks in ... | TITLE:
Wait table view load until an NSString is populated
QUESTION:
I have an UITableview which has a description cell populated by an NSString, ok. But the problem is that the UITableView delegate methods are called before the code I use to download the description so it doesn't loads. How can I do something to solv... | [
"cocoa-touch",
"ios4"
] | 0 | 0 | 164 | 2 | 0 | 2011-06-02T17:17:17.817000 | 2011-06-02T17:20:34.260000 |
6,217,837 | 6,218,476 | 'stringstream' argument order trouble | I'm experiencing a weird problem with stringstream. #include "stdafx.h" #include "iostream" #include "sstream"
using namespace std;
struct Test { float f; };
wstringstream& operator <<( wstringstream& sstream, const Test& test ) { sstream << test.f; return sstream; }
int _tmain(int argc, _TCHAR* argv[]) { Test a; a... | Short answer The problem is that ss << L"text" gives you a std::wostream, not a std::wstringstream. You only created an operator<< for std::wstringstream, so the next operation (which you're trying to do on a ) fails. Long answer When you write something like ss << L"text" << a << endl; you are not invoking a function ... | 'stringstream' argument order trouble I'm experiencing a weird problem with stringstream. #include "stdafx.h" #include "iostream" #include "sstream"
using namespace std;
struct Test { float f; };
wstringstream& operator <<( wstringstream& sstream, const Test& test ) { sstream << test.f; return sstream; }
int _tmain... | TITLE:
'stringstream' argument order trouble
QUESTION:
I'm experiencing a weird problem with stringstream. #include "stdafx.h" #include "iostream" #include "sstream"
using namespace std;
struct Test { float f; };
wstringstream& operator <<( wstringstream& sstream, const Test& test ) { sstream << test.f; return sstr... | [
"c++",
"visual-studio",
"stringstream",
"visual-studio-2008-sp1"
] | 2 | 4 | 537 | 2 | 0 | 2011-06-02T17:17:37.993000 | 2011-06-02T18:10:51.223000 |
6,217,842 | 6,219,068 | Exposing message.properties to javascript? | Is there an easy way to expose all translated strings to javascript? I want to be able to use translated strings in my JS files without manually building them in GSPs. Is there an easy way to do this? | The Jawr plugin (good plugin to use to optimize your JS and CSS resources anyway) can expose parts or the whole of your i18n message bundles to Javascript: http://jawr.java.net/docs/messages_gen.html | Exposing message.properties to javascript? Is there an easy way to expose all translated strings to javascript? I want to be able to use translated strings in my JS files without manually building them in GSPs. Is there an easy way to do this? | TITLE:
Exposing message.properties to javascript?
QUESTION:
Is there an easy way to expose all translated strings to javascript? I want to be able to use translated strings in my JS files without manually building them in GSPs. Is there an easy way to do this?
ANSWER:
The Jawr plugin (good plugin to use to optimize y... | [
"javascript",
"grails",
"groovy",
"internationalization",
"translation"
] | 7 | 6 | 2,660 | 2 | 0 | 2011-06-02T17:17:49.320000 | 2011-06-02T19:00:04.817000 |
6,217,843 | 6,225,461 | Looking for MCU with AES. Migrating from STM32F107 | I'm looking for Microcontrollers based on the ARM Cortex-M3. The MCU should have an AES Accelerator, SPI, (at least 3) USARTs, USB OTG. I'm migrating from STM32F107 (the reason I'm migrating is because I need the AES by hardware) any good recommendations that will save me time in the migration process? I've been lookin... | LPC18xx from NXP (doesn't seem to be generally available yet). They also announced LPC4000 series based on Cortex-M4. EFM32 from EnergyMicro. STM32F215/217 from ST seem to have an encryption module. | Looking for MCU with AES. Migrating from STM32F107 I'm looking for Microcontrollers based on the ARM Cortex-M3. The MCU should have an AES Accelerator, SPI, (at least 3) USARTs, USB OTG. I'm migrating from STM32F107 (the reason I'm migrating is because I need the AES by hardware) any good recommendations that will save... | TITLE:
Looking for MCU with AES. Migrating from STM32F107
QUESTION:
I'm looking for Microcontrollers based on the ARM Cortex-M3. The MCU should have an AES Accelerator, SPI, (at least 3) USARTs, USB OTG. I'm migrating from STM32F107 (the reason I'm migrating is because I need the AES by hardware) any good recommendati... | [
"arm",
"migration",
"aes",
"microcontroller",
"cortex-m"
] | 4 | 3 | 1,240 | 2 | 0 | 2011-06-02T17:17:49.570000 | 2011-06-03T09:45:54.687000 |
6,217,857 | 6,217,887 | How to make iFrame not have the scrolling bar | I am working on making a widget like this one here: http://www.comehike.com/outdoors/widget.php?hike_id=176&height=400&width=700 And for some reason I can't seem to make scrolling bar go away. Does anyone know how to do that? Thanks! | Like this: Edit: Also frameborder="0" is handy to hide the border. | How to make iFrame not have the scrolling bar I am working on making a widget like this one here: http://www.comehike.com/outdoors/widget.php?hike_id=176&height=400&width=700 And for some reason I can't seem to make scrolling bar go away. Does anyone know how to do that? Thanks! | TITLE:
How to make iFrame not have the scrolling bar
QUESTION:
I am working on making a widget like this one here: http://www.comehike.com/outdoors/widget.php?hike_id=176&height=400&width=700 And for some reason I can't seem to make scrolling bar go away. Does anyone know how to do that? Thanks!
ANSWER:
Like this: Ed... | [
"html",
"css",
"iframe"
] | 15 | 24 | 46,434 | 5 | 0 | 2011-06-02T17:19:19.760000 | 2011-06-02T17:21:37.687000 |
6,217,879 | 6,217,986 | SELECT newest record of any GROUP of records (ignoring records with one record) | Having trouble with a query to return the newest order of any grouped set of orders having more than 1 order. CREATE & INSERTs for the test data are below. This query returns the unique customer id's I want to work with, along with the grouped order_id's. Of these records, I only need the most recent order (based on da... | Clarification of the query. The question was to only include those customers that had more... hence my query has it INSIDE with the GROUP BY... This way it ONLY GIVES the customer in question that HAD multiple orders, but at the same time, only gives the most recent date OF the last order for the person... Then the Pre... | SELECT newest record of any GROUP of records (ignoring records with one record) Having trouble with a query to return the newest order of any grouped set of orders having more than 1 order. CREATE & INSERTs for the test data are below. This query returns the unique customer id's I want to work with, along with the grou... | TITLE:
SELECT newest record of any GROUP of records (ignoring records with one record)
QUESTION:
Having trouble with a query to return the newest order of any grouped set of orders having more than 1 order. CREATE & INSERTs for the test data are below. This query returns the unique customer id's I want to work with, a... | [
"mysql",
"sql",
"greatest-n-per-group"
] | 0 | 1 | 275 | 1 | 0 | 2011-06-02T17:21:10.110000 | 2011-06-02T17:30:32.460000 |
6,217,881 | 6,218,035 | string sanitization to support special characters such as ñ, á, é, í, ó, ú, etc | I'm currently using this script to sanitize a block of text... function rseo_sanitize($s) { $result = preg_replace("/[^a-zA-Z0-9'-]+/", "", html_entity_decode($s, ENT_QUOTES)); return $result; } I'd like to add support for a collection of special characters such as ñ, á, é, í, ó, ú, etc How can I integrate those (and t... | You can use /\pL+/u to match all letter symbols in Unicode. There is no separate plane for Spanish letters only in PCRE, but you could try: /[^\p{Latin}0-9'-]+/u This includes everything from the ISO Latin-1 charset I believe. That encompasses other european languages, not just spanish. But otherwise you would really h... | string sanitization to support special characters such as ñ, á, é, í, ó, ú, etc I'm currently using this script to sanitize a block of text... function rseo_sanitize($s) { $result = preg_replace("/[^a-zA-Z0-9'-]+/", "", html_entity_decode($s, ENT_QUOTES)); return $result; } I'd like to add support for a collection of s... | TITLE:
string sanitization to support special characters such as ñ, á, é, í, ó, ú, etc
QUESTION:
I'm currently using this script to sanitize a block of text... function rseo_sanitize($s) { $result = preg_replace("/[^a-zA-Z0-9'-]+/", "", html_entity_decode($s, ENT_QUOTES)); return $result; } I'd like to add support for... | [
"php",
"regex"
] | 3 | 2 | 1,296 | 2 | 0 | 2011-06-02T17:21:19.547000 | 2011-06-02T17:33:31.020000 |
6,217,886 | 6,218,735 | Excel | Simple Question - Text Import Wizard | I recently used the Text Import Wizard to split some text into individual cells, for easier deletion, and where formulas use cell references. My problem now however, is that when I pass something, it always gets split into multiple cells. I'm not sure if Excel has some sort of interal memory telling it to always treat ... | Since you used the text import wizard to split things previously, it will use that the next time as well. This is supposed to be for a session, but you can get it back to normal, or how you want, by running the wizard again on a file with similar characteristics to how you want. For instance open a text or csv file | Excel | Simple Question - Text Import Wizard I recently used the Text Import Wizard to split some text into individual cells, for easier deletion, and where formulas use cell references. My problem now however, is that when I pass something, it always gets split into multiple cells. I'm not sure if Excel has some sort ... | TITLE:
Excel | Simple Question - Text Import Wizard
QUESTION:
I recently used the Text Import Wizard to split some text into individual cells, for easier deletion, and where formulas use cell references. My problem now however, is that when I pass something, it always gets split into multiple cells. I'm not sure if Ex... | [
"excel",
"text",
"wizard"
] | 0 | 0 | 266 | 1 | 0 | 2011-06-02T17:21:30.850000 | 2011-06-02T18:30:31.717000 |
6,217,900 | 6,218,108 | UIScrollView, reaching the bottom of the scroll view | I know the Apple documentation has the following delegate method: - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; // called when scroll view grinds to a halt However, it doesn't necessarily mean you are at the bottom. Cause if you use your finger, scroll a bit, then it decelerates, but you are not actu... | I think what you might be able to do is to check that your contentOffset point is at the bottom of contentSize. So you could probably do something like: - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { float bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height; if (bottomEdge >= scrol... | UIScrollView, reaching the bottom of the scroll view I know the Apple documentation has the following delegate method: - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; // called when scroll view grinds to a halt However, it doesn't necessarily mean you are at the bottom. Cause if you use your finger, sc... | TITLE:
UIScrollView, reaching the bottom of the scroll view
QUESTION:
I know the Apple documentation has the following delegate method: - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; // called when scroll view grinds to a halt However, it doesn't necessarily mean you are at the bottom. Cause if you u... | [
"iphone",
"uiscrollviewdelegate"
] | 44 | 105 | 42,893 | 7 | 0 | 2011-06-02T17:23:09.170000 | 2011-06-02T17:38:59.537000 |
6,217,907 | 6,218,515 | Wrapping text & block elements around images | I know it's easy enough to wrap text around images by floating the image right or left & then putting your text after it, but what I am wanting to do is wrap other elements around it as well, such as div's. I tried to set my div to inline & this worked fine, however once I added other divs inside that div it still look... | Yes, the correct way to move something to one side and have stuff wrap around it is to float the element. In the example below (simplified from your code), adding padding to the floated image works just fine. CSS:.main.screenshot { float: right; border: 1px solid #c0c0c0; padding: 5px; }.main.title{ font-size: 140%; } ... | Wrapping text & block elements around images I know it's easy enough to wrap text around images by floating the image right or left & then putting your text after it, but what I am wanting to do is wrap other elements around it as well, such as div's. I tried to set my div to inline & this worked fine, however once I a... | TITLE:
Wrapping text & block elements around images
QUESTION:
I know it's easy enough to wrap text around images by floating the image right or left & then putting your text after it, but what I am wanting to do is wrap other elements around it as well, such as div's. I tried to set my div to inline & this worked fine... | [
"css",
"xhtml",
"word-wrap"
] | 8 | 15 | 15,735 | 1 | 0 | 2011-06-02T17:23:43.207000 | 2011-06-02T18:13:17.707000 |
6,217,908 | 6,218,024 | How do I specify the columns and rows of a multiline Editor-For in ASP.MVC? | In ASP.MVC 3, how do I specify the columns and rows for a multiline EditorFor (textarea)? I am using [UIHint("MultilineText")], but can't find any documentation on how to add attributes for the text area. Desired HTML: Relevant Part of my MVC 3 Model: [UIHint("MultilineText")] public string Description { get; set; } Re... | Use TextAreaFor @Html.TextAreaFor(model => model.Description, new { @class = "whatever-class", @cols = 80, @rows = 10 }) or use style for multi-line class. You could also write EditorTemplate for this. | How do I specify the columns and rows of a multiline Editor-For in ASP.MVC? In ASP.MVC 3, how do I specify the columns and rows for a multiline EditorFor (textarea)? I am using [UIHint("MultilineText")], but can't find any documentation on how to add attributes for the text area. Desired HTML: Relevant Part of my MVC 3... | TITLE:
How do I specify the columns and rows of a multiline Editor-For in ASP.MVC?
QUESTION:
In ASP.MVC 3, how do I specify the columns and rows for a multiline EditorFor (textarea)? I am using [UIHint("MultilineText")], but can't find any documentation on how to add attributes for the text area. Desired HTML: Relevan... | [
"asp.net-mvc",
"razor",
"data-annotations"
] | 75 | 148 | 115,387 | 7 | 0 | 2011-06-02T17:24:08.433000 | 2011-06-02T17:32:42.377000 |
6,217,911 | 6,226,436 | Using Gradle and the gradle-gae-plugin debug parameters are not passed | I'm using gradle to build, run, deploy my Google App Engine project. The gradle-gae-plugin (version 0.4) seems to work perfect with one caveat. The debug parameters are never passed to the local running engine during gaeRun. I've changed the http port, so I see at least one parameter taking effect. However, my IDE is r... | This is because version 0.4 does not support the debug flag yet. I am currently working on version 0.5 and had already checked in the changes for the README.md file on master. Please refer to tag v0.4 for available convention properties in version 0.4. I will probably push the next version within the upcoming week. As ... | Using Gradle and the gradle-gae-plugin debug parameters are not passed I'm using gradle to build, run, deploy my Google App Engine project. The gradle-gae-plugin (version 0.4) seems to work perfect with one caveat. The debug parameters are never passed to the local running engine during gaeRun. I've changed the http po... | TITLE:
Using Gradle and the gradle-gae-plugin debug parameters are not passed
QUESTION:
I'm using gradle to build, run, deploy my Google App Engine project. The gradle-gae-plugin (version 0.4) seems to work perfect with one caveat. The debug parameters are never passed to the local running engine during gaeRun. I've c... | [
"gradle"
] | 0 | 3 | 439 | 1 | 0 | 2011-06-02T17:24:18.357000 | 2011-06-03T11:18:55.477000 |
6,217,915 | 6,217,932 | C# Loading a file from a command line? | I am relatively new to C# and I am having a little trouble. I am creating a program where I want to load a file from the command line. For example: MyProgram.exe C:\ExcelDocument.xls | in the Main method of your program the args string array parameter to the method will contain any command line parameters. The args array will contain 1 value for each space separated element that is not enclosed in quotes (") so myprograme.exe c:\my documents\file1.xls will result in 2 args: c:\my documents\file1.xls ... | C# Loading a file from a command line? I am relatively new to C# and I am having a little trouble. I am creating a program where I want to load a file from the command line. For example: MyProgram.exe C:\ExcelDocument.xls | TITLE:
C# Loading a file from a command line?
QUESTION:
I am relatively new to C# and I am having a little trouble. I am creating a program where I want to load a file from the command line. For example: MyProgram.exe C:\ExcelDocument.xls
ANSWER:
in the Main method of your program the args string array parameter to t... | [
"c#",
"command-line",
"cmd"
] | 3 | 6 | 373 | 2 | 0 | 2011-06-02T17:24:32.817000 | 2011-06-02T17:26:00.520000 |
6,217,916 | 6,218,930 | Deserializing JSON to C# - Trying to turn JSON associative array into Dictionary<string, string> | I have this JSON: { "AutoRefreshEnabled": false, "AutoRefreshInterval": 1, "AutoCycleEnabled": false, "AutoCycleInterval": 1, "Tabs": { "RadTab_Home", "Dashboard" }, "CommandName": "Update Global Settings" } I'm trying to store it in this class, but I am not sure how to handle the embedded Tabs object. There may be an ... | If you want the Tabs property to be a Dictionary then your representation in JSON is incorrect. Currently, you have: "Tabs": [ "RadTab_Home", "Dashboard" ], And it should be a string[]. If you want a mapping (i.e. Dictionary ), then you need a key to associate with the values, and therefore, a different representation ... | Deserializing JSON to C# - Trying to turn JSON associative array into Dictionary<string, string> I have this JSON: { "AutoRefreshEnabled": false, "AutoRefreshInterval": 1, "AutoCycleEnabled": false, "AutoCycleInterval": 1, "Tabs": { "RadTab_Home", "Dashboard" }, "CommandName": "Update Global Settings" } I'm trying to s... | TITLE:
Deserializing JSON to C# - Trying to turn JSON associative array into Dictionary<string, string>
QUESTION:
I have this JSON: { "AutoRefreshEnabled": false, "AutoRefreshInterval": 1, "AutoCycleEnabled": false, "AutoCycleInterval": 1, "Tabs": { "RadTab_Home", "Dashboard" }, "CommandName": "Update Global Settings"... | [
"c#",
"json"
] | 3 | 4 | 6,162 | 1 | 0 | 2011-06-02T17:24:33.960000 | 2011-06-02T18:47:29.817000 |
6,217,929 | 6,218,139 | Weird Array issue | So I am writing a C# console application. I have a text file that I want to send to a database. The plan is to have multiple text files and only one insert. Everything seems to go fine for the first line. Once I get to the 2nd line the array thinks it only has a length of 2. using System; using System.Collections.Gener... | Using the above code, I created a simple output file step that met your intended structure and your code does correctly parse the file out. Your issue appears to be based on the data string[] content = new string[] { "a\tb\tc\td\te\tf\tg\th\ti", "a\tb\tc\td\te\tf\tg\th\ti" }; System.IO.File.WriteAllLines(@"C:\sandbox\o... | Weird Array issue So I am writing a C# console application. I have a text file that I want to send to a database. The plan is to have multiple text files and only one insert. Everything seems to go fine for the first line. Once I get to the 2nd line the array thinks it only has a length of 2. using System; using System... | TITLE:
Weird Array issue
QUESTION:
So I am writing a C# console application. I have a text file that I want to send to a database. The plan is to have multiple text files and only one insert. Everything seems to go fine for the first line. Once I get to the 2nd line the array thinks it only has a length of 2. using Sy... | [
"c#",
"arrays"
] | 1 | 2 | 152 | 4 | 0 | 2011-06-02T17:25:23.740000 | 2011-06-02T17:41:46.077000 |
6,217,935 | 6,218,119 | What can cause JUnit to disregard @Ignore annotations? | I just used MyEclipse to automatically generate some JUnit test cases. One of the generated methods looks like this: @Ignore("Ignored") @Test public void testCreateRevision() { fail("Not yet implemented"); // TODO } I added the @Ignore annotation manually. However, when I run the test, JUnit lists that method, and othe... | Make sure you are importing the right @Ignore. To be sure use @org.junit.Ignore explicitly. Double check if your test is being executed by JUnit 4, not 3. The easiest way to do this is to either change the test name so it is not prefixed by test (now it shouldn't be executed at all and JUnit 4 does not need this prefix... | What can cause JUnit to disregard @Ignore annotations? I just used MyEclipse to automatically generate some JUnit test cases. One of the generated methods looks like this: @Ignore("Ignored") @Test public void testCreateRevision() { fail("Not yet implemented"); // TODO } I added the @Ignore annotation manually. However,... | TITLE:
What can cause JUnit to disregard @Ignore annotations?
QUESTION:
I just used MyEclipse to automatically generate some JUnit test cases. One of the generated methods looks like this: @Ignore("Ignored") @Test public void testCreateRevision() { fail("Not yet implemented"); // TODO } I added the @Ignore annotation ... | [
"java",
"junit"
] | 37 | 51 | 34,429 | 7 | 0 | 2011-06-02T17:26:32.960000 | 2011-06-02T17:39:58.913000 |
6,217,941 | 6,218,201 | UITableViewCell like Clock App on iPhone | I wanted to do the same design as the clock app on iOS for my UITableView, but don't really know the different steps. So in my app I have a UITabBarController, my second tab contains a UINavigationController that loads a UITableViewController (exactly like on the screenshot below). So for example, if I have 3 cells onl... | You actually didn't ask a question. Anyway to do the thing on screenshot you need to set background of UINavigationController to desirable and set UITableViewController tableView background color to clearColor. Also you need to set separator color of tableView to clearColor. If your cells is not full a screen you will ... | UITableViewCell like Clock App on iPhone I wanted to do the same design as the clock app on iOS for my UITableView, but don't really know the different steps. So in my app I have a UITabBarController, my second tab contains a UINavigationController that loads a UITableViewController (exactly like on the screenshot belo... | TITLE:
UITableViewCell like Clock App on iPhone
QUESTION:
I wanted to do the same design as the clock app on iOS for my UITableView, but don't really know the different steps. So in my app I have a UITabBarController, my second tab contains a UINavigationController that loads a UITableViewController (exactly like on t... | [
"iphone",
"uitableview"
] | 0 | 1 | 756 | 1 | 0 | 2011-06-02T17:27:13.413000 | 2011-06-02T17:47:06.600000 |
6,217,949 | 6,217,992 | jQuery nav arrays, looking for an elegant solution | I've been trying to think of the most elegant way to achieve the following... I've got the following nav structure: 1 2 3 4 5 6 7 And this div elsewhere on the page: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah the p's are all hidden by default; if I click the... | Why not just use.index()? $('#smenu li').click(function(){ $('.desc-wrap p').hide().eq($(this).index()).show(); }); | jQuery nav arrays, looking for an elegant solution I've been trying to think of the most elegant way to achieve the following... I've got the following nav structure: 1 2 3 4 5 6 7 And this div elsewhere on the page: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah bla... | TITLE:
jQuery nav arrays, looking for an elegant solution
QUESTION:
I've been trying to think of the most elegant way to achieve the following... I've got the following nav structure: 1 2 3 4 5 6 7 And this div elsewhere on the page: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah ... | [
"javascript",
"jquery",
"arrays",
"navigation"
] | 2 | 4 | 296 | 2 | 0 | 2011-06-02T17:27:40.990000 | 2011-06-02T17:30:53.937000 |
6,217,952 | 6,220,303 | CGEventPostToPSN - How to send keys with different keyboard locales? | So I'm sending key presses to another application, like so: - (void)keyPress:(int)hotkey withModifier:(unsigned int)modifier withKeyDown:(BOOL)keyDown{
// verify the process still exists ProcessSerialNumber psn = [self myPSN]; CGEventRef keyEvent = NULL;
// create our source CGEventSourceRef source = NULL; // this di... | I think its the same question as How to convert ASCII character to CGKeyCode? | CGEventPostToPSN - How to send keys with different keyboard locales? So I'm sending key presses to another application, like so: - (void)keyPress:(int)hotkey withModifier:(unsigned int)modifier withKeyDown:(BOOL)keyDown{
// verify the process still exists ProcessSerialNumber psn = [self myPSN]; CGEventRef keyEvent = N... | TITLE:
CGEventPostToPSN - How to send keys with different keyboard locales?
QUESTION:
So I'm sending key presses to another application, like so: - (void)keyPress:(int)hotkey withModifier:(unsigned int)modifier withKeyDown:(BOOL)keyDown{
// verify the process still exists ProcessSerialNumber psn = [self myPSN]; CGEve... | [
"objective-c",
"xcode",
"operating-system"
] | 1 | 1 | 1,258 | 1 | 0 | 2011-06-02T17:28:17.407000 | 2011-06-02T20:57:23.780000 |
6,217,956 | 6,301,049 | nginx with ssl compile error | I'm hoping one of you have figured this out already. I have been trying to compile nginx with ssl support and it is failing at make with the following error: src/event/ngx_event_openssl.c:1690:31: error: variable ‘c’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors make[1]: *... | with the removal of -Werror and -Wall in the make file after configure the issue was solved. it turned out to be a bug in the c code itself. yet unsure if this is hacking around or solving the problem. according to google those tags will treat warnings as errors and was causing the build to fail | nginx with ssl compile error I'm hoping one of you have figured this out already. I have been trying to compile nginx with ssl support and it is failing at make with the following error: src/event/ngx_event_openssl.c:1690:31: error: variable ‘c’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being... | TITLE:
nginx with ssl compile error
QUESTION:
I'm hoping one of you have figured this out already. I have been trying to compile nginx with ssl support and it is failing at make with the following error: src/event/ngx_event_openssl.c:1690:31: error: variable ‘c’ set but not used [-Werror=unused-but-set-variable] cc1: ... | [
"ssl",
"nginx",
"compilation"
] | 0 | 1 | 2,061 | 1 | 0 | 2011-06-02T17:28:24.733000 | 2011-06-10T01:21:23.700000 |
6,217,966 | 6,218,324 | jQuery: trying to load jQuery dynamically. Not instantiating until after script has been run | javascript:var width=1900; var height=800;
var jQueryScriptOutputted = false; function initJQuery() { if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { jQueryScriptOutputted = true; var oHead = document.getElementsByTagName('HEAD').item(0); var oScript= document.createElement("script"); oScript.type ... | usually to everything that loads a file can be attached an event handler "onload"... var jQueryLoaded = false; function initJQuery() { if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { jQueryScriptOutputted = true; var oHead = document.getElementsByTagName('HEAD').item(0); var oScript= document.create... | jQuery: trying to load jQuery dynamically. Not instantiating until after script has been run javascript:var width=1900; var height=800;
var jQueryScriptOutputted = false; function initJQuery() { if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { jQueryScriptOutputted = true; var oHead = document.getEl... | TITLE:
jQuery: trying to load jQuery dynamically. Not instantiating until after script has been run
QUESTION:
javascript:var width=1900; var height=800;
var jQueryScriptOutputted = false; function initJQuery() { if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { jQueryScriptOutputted = true; var oHea... | [
"javascript",
"jquery"
] | 0 | 0 | 439 | 1 | 0 | 2011-06-02T17:28:47.400000 | 2011-06-02T17:57:43.507000 |
6,217,974 | 6,226,463 | .Net Scrollable Control, Center button pan | Is there a way to enable a default pan behavior in the.Net scrollable control when you press down on the center scroll button, or Is that a behavior you have to implement yourself? You know like in some programs where you press down on the center button and it give you an arrow cursor that pans whichever direction you ... | That is called 'reader mode'. It is something every application implements on its own. You will need to override the appropriate handlers (OnMouseDown, OnMouseMove, OnMouseUp). The guidelines for scrolling and panning can be found at MSDN: http://msdn.microsoft.com/en-us/library/bb545459.aspx Also, see an earlier post ... | .Net Scrollable Control, Center button pan Is there a way to enable a default pan behavior in the.Net scrollable control when you press down on the center scroll button, or Is that a behavior you have to implement yourself? You know like in some programs where you press down on the center button and it give you an arro... | TITLE:
.Net Scrollable Control, Center button pan
QUESTION:
Is there a way to enable a default pan behavior in the.Net scrollable control when you press down on the center scroll button, or Is that a behavior you have to implement yourself? You know like in some programs where you press down on the center button and i... | [
".net",
"vb.net",
"winforms"
] | 1 | 1 | 255 | 1 | 0 | 2011-06-02T17:29:26.963000 | 2011-06-03T11:21:29.637000 |
6,217,977 | 6,219,413 | Android: How to grab username info after login and display welcome 'username' in MainActivity | I have done alot of search for this and most of them are not for android. I am using sharedpref to save the username in session until logout. I would like to display welcome 'username' in the mainactivity.. For now I would like a sample code on grabbing the 'username' within the mainactivity class thats saved in shared... | Try... In your login Activity: SharedPreferences prefs = getSharedPreferences("MyApp", MODE_PRIVATE); prefs.edit().putString("username", username).commit(); Intent i = new Intent(this, MainActivity.class); startActivity(i); In your main activity... public class MainActivity extends Activity {
private String username =... | Android: How to grab username info after login and display welcome 'username' in MainActivity I have done alot of search for this and most of them are not for android. I am using sharedpref to save the username in session until logout. I would like to display welcome 'username' in the mainactivity.. For now I would lik... | TITLE:
Android: How to grab username info after login and display welcome 'username' in MainActivity
QUESTION:
I have done alot of search for this and most of them are not for android. I am using sharedpref to save the username in session until logout. I would like to display welcome 'username' in the mainactivity.. F... | [
"android",
"authentication",
"textview",
"sharedpreferences"
] | 1 | 4 | 14,920 | 2 | 0 | 2011-06-02T17:29:38.273000 | 2011-06-02T19:31:26.470000 |
6,217,978 | 6,218,049 | SQL - Regroup by subfield | I've got a problem with my SQL. I have a table (named "Regions") looking like this: What I want to do is sorting this table with the sub_region "next" to the region. In this exemple, Québec (9) and Ontario (10) are sub region of Canada (7) so I want to get them right after Canada. I don't know if it's stupid or my SQL ... | select s.id, s.name, r.* from Regions r left join Regions s on s.id = r.sub_region order by(coalesce(s.id, r.id), r.id) edit: I modified the joined query, I haven't tried it, but would you give that a shot, I think that syntax should work for mysql | SQL - Regroup by subfield I've got a problem with my SQL. I have a table (named "Regions") looking like this: What I want to do is sorting this table with the sub_region "next" to the region. In this exemple, Québec (9) and Ontario (10) are sub region of Canada (7) so I want to get them right after Canada. I don't know... | TITLE:
SQL - Regroup by subfield
QUESTION:
I've got a problem with my SQL. I have a table (named "Regions") looking like this: What I want to do is sorting this table with the sub_region "next" to the region. In this exemple, Québec (9) and Ontario (10) are sub region of Canada (7) so I want to get them right after Ca... | [
"php",
"mysql",
"sql",
"cakephp"
] | 2 | 2 | 421 | 1 | 0 | 2011-06-02T17:29:41.960000 | 2011-06-02T17:34:28.417000 |
6,217,980 | 6,218,026 | how to get inner xml tag values through java? | how i can find the "abc" from this tag through JAVA code and SAX parser. My Text for example i am using the java code given below to find "My Text" from the above tag. NodeList firstNameList = firstPersonElement.getElementsByTagName("first"); Element firstNameElement = (Element)firstNameList.item(0); String type = firs... | name="abc" is an attribute of the first element. String name = firstNameElement.getAttribute("name"); // "abc" | how to get inner xml tag values through java? how i can find the "abc" from this tag through JAVA code and SAX parser. My Text for example i am using the java code given below to find "My Text" from the above tag. NodeList firstNameList = firstPersonElement.getElementsByTagName("first"); Element firstNameElement = (Ele... | TITLE:
how to get inner xml tag values through java?
QUESTION:
how i can find the "abc" from this tag through JAVA code and SAX parser. My Text for example i am using the java code given below to find "My Text" from the above tag. NodeList firstNameList = firstPersonElement.getElementsByTagName("first"); Element first... | [
"java",
"xml",
"dom"
] | 1 | 4 | 2,308 | 2 | 0 | 2011-06-02T17:29:53.780000 | 2011-06-02T17:32:49.777000 |
6,217,985 | 6,218,690 | Stop images overflowing container div | I have created a page with a fixed width column on the right that contains thumbnail images, and large images are displayed to the left. I currently use a Javascript function to limit the height of the #thumbcontainer div to the size of the window so that the #thumbcolumn div can scroll within if the number of thumbnai... | Could you use something like.thumbnailcontainer { position: fixed; top: 0; bottom: 0; right:0; width: 200px; overflow-y: auto; } That should, in theory, give you a container that spans top to bottom of the window and scroll when the image list becomes to big. EDIT: Example: http://jsfiddle.net/QgY3L/ | Stop images overflowing container div I have created a page with a fixed width column on the right that contains thumbnail images, and large images are displayed to the left. I currently use a Javascript function to limit the height of the #thumbcontainer div to the size of the window so that the #thumbcolumn div can s... | TITLE:
Stop images overflowing container div
QUESTION:
I have created a page with a fixed width column on the right that contains thumbnail images, and large images are displayed to the left. I currently use a Javascript function to limit the height of the #thumbcontainer div to the size of the window so that the #thu... | [
"css"
] | 1 | 0 | 7,850 | 2 | 0 | 2011-06-02T17:30:30.260000 | 2011-06-02T18:27:21.280000 |
6,217,994 | 6,218,092 | PHP: How to use set_error_handler() to properly deal with all errors except notices? | I'm confused about how to use set_error_handler() properly, and the php documentation isn't really helping to clarify. I want it to email me as many errors as possible, with the exception of notices. I have the following code Above is my current setting set_error_handler('globalErrorHandler', E_USER_WARNING);, which se... | set_error_handler('some_handler',E_ALL & ~E_NOTICE & ~E_USER_NOTICE); Or, if you really want all, set_error_handler('some_handler',-1 & ~E_NOTICE & ~E_USER_NOTICE); Alternatively, you can just set it to use all errors, and just ignore it if they're not in error_reporting (which you set to the same value as the above li... | PHP: How to use set_error_handler() to properly deal with all errors except notices? I'm confused about how to use set_error_handler() properly, and the php documentation isn't really helping to clarify. I want it to email me as many errors as possible, with the exception of notices. I have the following code Above is ... | TITLE:
PHP: How to use set_error_handler() to properly deal with all errors except notices?
QUESTION:
I'm confused about how to use set_error_handler() properly, and the php documentation isn't really helping to clarify. I want it to email me as many errors as possible, with the exception of notices. I have the follow... | [
"php",
"error-handling"
] | 16 | 16 | 23,736 | 4 | 0 | 2011-06-02T17:30:57.500000 | 2011-06-02T17:37:30.457000 |
6,217,995 | 6,218,519 | How do I init a NSArray with a set of images that reocur? | EDIT: I think i asked something really wrong over here, and i am sorry. What i am doing, is a mock of a slot machine, but i don't think that it will be wise(just don't want to insult myself) of me to put 250(50*5) images in the UIPICKERVIEW, There is no reason doing that, My idea now is to use only the 6 images for eac... | Not sure I understood the question, but, if I did, you may do: NSArray *set = [NSArray arrayWithObjects:[UIImage imageNamed:@"img1.png"],/* all the images */, nil]; NSMutableArray *tmp = [[NSMutableArray alloc] init];
for (int i = 0; i<50; i++) { [tmp addObject:[set objectAtIndex:(i%6)]]; } then you may use tmp as com... | How do I init a NSArray with a set of images that reocur? EDIT: I think i asked something really wrong over here, and i am sorry. What i am doing, is a mock of a slot machine, but i don't think that it will be wise(just don't want to insult myself) of me to put 250(50*5) images in the UIPICKERVIEW, There is no reason d... | TITLE:
How do I init a NSArray with a set of images that reocur?
QUESTION:
EDIT: I think i asked something really wrong over here, and i am sorry. What i am doing, is a mock of a slot machine, but i don't think that it will be wise(just don't want to insult myself) of me to put 250(50*5) images in the UIPICKERVIEW, Th... | [
"objective-c",
"cocoa-touch",
"cocoa",
"nsarray"
] | 0 | 1 | 2,481 | 2 | 0 | 2011-06-02T17:30:59.960000 | 2011-06-02T18:13:25.853000 |
6,218,003 | 6,218,042 | Is it bad practice to have both build server and subversion server as same machine? | Is it bad practise to have both build server and subversion server on the same machine? Previously they have been separate machines, but I wondered if it is really a waste of resources having them separate. In addition can these be deployed to a virtual server, will the performance be degraded much if they are VMs? | I think it depends mostly on how much load each server is facing. If they're lightly loaded, I can't think of much reason they shouldn't be the same machine. For large software projects though, build servers tend to work really hard, so in that case keeping the two separate makes more sense. | Is it bad practice to have both build server and subversion server as same machine? Is it bad practise to have both build server and subversion server on the same machine? Previously they have been separate machines, but I wondered if it is really a waste of resources having them separate. In addition can these be depl... | TITLE:
Is it bad practice to have both build server and subversion server as same machine?
QUESTION:
Is it bad practise to have both build server and subversion server on the same machine? Previously they have been separate machines, but I wondered if it is really a waste of resources having them separate. In addition... | [
"svn",
"cruisecontrol.net"
] | 1 | 4 | 109 | 2 | 0 | 2011-06-02T17:31:17.590000 | 2011-06-02T17:33:56.247000 |
6,218,007 | 6,218,649 | iPhone - pushing and pulling a value from a dictionary to a CGlayer | I have a finger painting view that I am implementing undo/redo. All the drawing occurs on a CGLayer called lineLayer. As soon as the user touches the screen but before any modification is done to the screen, I need to quickly grab the views content and create an undo level. Obviously saving the view to disk is not an o... | Have you considered Core data for managing your objects? I'm asking because Undo/redo comes for free with it? | iPhone - pushing and pulling a value from a dictionary to a CGlayer I have a finger painting view that I am implementing undo/redo. All the drawing occurs on a CGLayer called lineLayer. As soon as the user touches the screen but before any modification is done to the screen, I need to quickly grab the views content and... | TITLE:
iPhone - pushing and pulling a value from a dictionary to a CGlayer
QUESTION:
I have a finger painting view that I am implementing undo/redo. All the drawing occurs on a CGLayer called lineLayer. As soon as the user touches the screen but before any modification is done to the screen, I need to quickly grab the... | [
"iphone",
"quartz-graphics",
"cglayer"
] | 1 | 0 | 118 | 2 | 0 | 2011-06-02T17:31:36.280000 | 2011-06-02T18:23:56.090000 |
6,218,010 | 6,218,041 | How do I break apart a URL to its component parts in PHP? | Regular expressions have never been one of my strong points, and this one has me stumped. As part of a project, I want to develop an SEO link class in PHP. Handling the mod_rewrite through Apache is fairly straightforward for me, and that works great. However, I'd like to create a function which is able to generate the... | You can just use parse_url and parse_str, no need for regexes. | How do I break apart a URL to its component parts in PHP? Regular expressions have never been one of my strong points, and this one has me stumped. As part of a project, I want to develop an SEO link class in PHP. Handling the mod_rewrite through Apache is fairly straightforward for me, and that works great. However, I... | TITLE:
How do I break apart a URL to its component parts in PHP?
QUESTION:
Regular expressions have never been one of my strong points, and this one has me stumped. As part of a project, I want to develop an SEO link class in PHP. Handling the mod_rewrite through Apache is fairly straightforward for me, and that works... | [
"php",
"url"
] | 1 | 6 | 2,985 | 2 | 0 | 2011-06-02T17:31:40.427000 | 2011-06-02T17:33:55.997000 |
6,218,015 | 6,218,055 | My Site Shrinks When Deployed to Heroku | Check it out, in this quick video I toggle between my localhost copy and the deployed app on Heroku: http://screencast.com/t/oD6SLXHg99k Obviously both are in the same browser. Why would this happen? | Are you sure you did not change the zoom with Ctrl + or Ctrl - at some point in time and your browser remembered it? Try Ctrl 0 to reset it. | My Site Shrinks When Deployed to Heroku Check it out, in this quick video I toggle between my localhost copy and the deployed app on Heroku: http://screencast.com/t/oD6SLXHg99k Obviously both are in the same browser. Why would this happen? | TITLE:
My Site Shrinks When Deployed to Heroku
QUESTION:
Check it out, in this quick video I toggle between my localhost copy and the deployed app on Heroku: http://screencast.com/t/oD6SLXHg99k Obviously both are in the same browser. Why would this happen?
ANSWER:
Are you sure you did not change the zoom with Ctrl + ... | [
"ruby-on-rails",
"css",
"heroku"
] | 3 | 5 | 139 | 1 | 0 | 2011-06-02T17:31:56.173000 | 2011-06-02T17:34:49.120000 |
6,218,028 | 6,218,189 | mkdir() and "Time of Check, Time of Use" vulnerabilities | Is there a secure alternative to mkdir() for C? I am examining some code and notice it is using calls to mkdir(). From what I have read on the US-CERT Secure Coding site, use of that function leaves it vulnerable to "Time of Check, Time of Use" (TOCTOU). Edit From the miniunz.c source for zlib int mymkdir(dirname) cons... | mkdir() is only TOCTOU - Time of Check, Time of Use when it's preceded by a check to see if the directory exists. The usage above, in your example, is ok if the calling code does the right thing. Check Zack's comment. | mkdir() and "Time of Check, Time of Use" vulnerabilities Is there a secure alternative to mkdir() for C? I am examining some code and notice it is using calls to mkdir(). From what I have read on the US-CERT Secure Coding site, use of that function leaves it vulnerable to "Time of Check, Time of Use" (TOCTOU). Edit Fro... | TITLE:
mkdir() and "Time of Check, Time of Use" vulnerabilities
QUESTION:
Is there a secure alternative to mkdir() for C? I am examining some code and notice it is using calls to mkdir(). From what I have read on the US-CERT Secure Coding site, use of that function leaves it vulnerable to "Time of Check, Time of Use" ... | [
"c",
"mkdir",
"secure-coding"
] | 1 | 1 | 1,385 | 2 | 0 | 2011-06-02T17:32:58.647000 | 2011-06-02T17:45:55.420000 |
6,218,033 | 6,218,227 | Setfocus() in master page | I have the set focus for a property which I am trying to use in the masterpage but I am unable to do so. public partial class Site1: System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; SetFocus(this);
} public void SetFocus(Site1 site1) { stri... | I'm not sure if this works but it should at least compile: Replace: site1.ClientScript.RegisterStartupScript(typeof(string), "controlFocus", sScript); With: site1.Page.ClientScript.RegisterStartupScript(GetType(String), "controlFocus", sScript); | Setfocus() in master page I have the set focus for a property which I am trying to use in the masterpage but I am unable to do so. public partial class Site1: System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; SetFocus(this);
} public void Se... | TITLE:
Setfocus() in master page
QUESTION:
I have the set focus for a property which I am trying to use in the masterpage but I am unable to do so. public partial class Site1: System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; SetFocus(this);... | [
"c#",
"asp.net",
"master-pages",
"webforms",
"clientscript"
] | 1 | 1 | 890 | 1 | 0 | 2011-06-02T17:33:20.503000 | 2011-06-02T17:50:00.253000 |
6,218,037 | 6,218,132 | Why does this jQuery code not work? | Why doesn't the following jQuery code work? $(function() { var regex = /\?fb=[0-9]+/g; var input = window.location.href;
var scrape = input.match(regex); // returns?fb=4
var numeral = /\?fb=/g;
scrape.replace(numeral,''); alert(scrape); // Should alert the number? }); Basically I have a link like this: http://foo.co... | Consider using the following code instead: $(function() { var matches = window.location.href.match(/\?fb=([0-9]+)/i);
if (matches) { var number = matches[1]; alert(number); // will alert 4! } }); Test an example of it here: http://jsfiddle.net/GLAXS/ The regular expression is only slightly modified from what you provi... | Why does this jQuery code not work? Why doesn't the following jQuery code work? $(function() { var regex = /\?fb=[0-9]+/g; var input = window.location.href;
var scrape = input.match(regex); // returns?fb=4
var numeral = /\?fb=/g;
scrape.replace(numeral,''); alert(scrape); // Should alert the number? }); Basically I ... | TITLE:
Why does this jQuery code not work?
QUESTION:
Why doesn't the following jQuery code work? $(function() { var regex = /\?fb=[0-9]+/g; var input = window.location.href;
var scrape = input.match(regex); // returns?fb=4
var numeral = /\?fb=/g;
scrape.replace(numeral,''); alert(scrape); // Should alert the number... | [
"javascript",
"jquery",
"regex",
"replace",
"match"
] | 1 | 5 | 525 | 5 | 0 | 2011-06-02T17:33:33.843000 | 2011-06-02T17:41:21.487000 |
6,218,040 | 6,218,081 | Kohana 3.1 ORM Security Question | Are all values escaped when using the ORM Module? For example, if I have: $user->where('username', 'LIKE', '%'. $this->request-post('user'). '%')->find_all() Is this safe? | Yes, ORM uses the query builder, which automatically escapes all values. Creating queries dynamically using objects and methods allows queries to be written very quickly in an agnostic way. Query building also adds identifier (table and column name) quoting, as well as value quoting. | Kohana 3.1 ORM Security Question Are all values escaped when using the ORM Module? For example, if I have: $user->where('username', 'LIKE', '%'. $this->request-post('user'). '%')->find_all() Is this safe? | TITLE:
Kohana 3.1 ORM Security Question
QUESTION:
Are all values escaped when using the ORM Module? For example, if I have: $user->where('username', 'LIKE', '%'. $this->request-post('user'). '%')->find_all() Is this safe?
ANSWER:
Yes, ORM uses the query builder, which automatically escapes all values. Creating querie... | [
"orm",
"kohana"
] | 1 | 0 | 218 | 1 | 0 | 2011-06-02T17:33:54.997000 | 2011-06-02T17:36:26.137000 |
6,218,043 | 6,218,562 | Trying to write breadcrumb navigation using XML/XSL | I am trying to write a breadcrumb navigation by using XSL to transform XML. Here is a piece of the XML file I am using: 22486a60-2bfe-46ba-96ee-7ea92b6ca5bb 00000000-0000-0000-0000-000000000000 Main Menu 44595707-a331-49ae-a8ed-4bc1cef22e4f 83a1df5f-2909-4c8a-9aa7-a4f2e0111d7c /home.aspx _self Home a9fd822b-838f-4129-9... | The following stylesheet first selects the menu item with the correct page ID, then displays all its ancestors, and finally displays the menu item itself. This approach is more effective than repeatedly calculating the expression descendant::*. Note that if the page ID does not exist in the menu structure, no ul elemen... | Trying to write breadcrumb navigation using XML/XSL I am trying to write a breadcrumb navigation by using XSL to transform XML. Here is a piece of the XML file I am using: 22486a60-2bfe-46ba-96ee-7ea92b6ca5bb 00000000-0000-0000-0000-000000000000 Main Menu 44595707-a331-49ae-a8ed-4bc1cef22e4f 83a1df5f-2909-4c8a-9aa7-a4f... | TITLE:
Trying to write breadcrumb navigation using XML/XSL
QUESTION:
I am trying to write a breadcrumb navigation by using XSL to transform XML. Here is a piece of the XML file I am using: 22486a60-2bfe-46ba-96ee-7ea92b6ca5bb 00000000-0000-0000-0000-000000000000 Main Menu 44595707-a331-49ae-a8ed-4bc1cef22e4f 83a1df5f-... | [
"xml",
"xslt",
"navigation",
"breadcrumbs"
] | 2 | 0 | 1,711 | 1 | 0 | 2011-06-02T17:34:04.810000 | 2011-06-02T18:16:40.897000 |
6,218,046 | 6,218,060 | How to identify when a dynamic button is clicked using JQuery? | I am dynamically creating a bunch of buttons REMOVE but how do I identify which one of them was clicked? | If you register for the click event the this variable inside this callback will point to the corresponding DOM element that was clicked: $('a').click(function() { // this here will represent the anchor that was clicked return false; }); | How to identify when a dynamic button is clicked using JQuery? I am dynamically creating a bunch of buttons REMOVE but how do I identify which one of them was clicked? | TITLE:
How to identify when a dynamic button is clicked using JQuery?
QUESTION:
I am dynamically creating a bunch of buttons REMOVE but how do I identify which one of them was clicked?
ANSWER:
If you register for the click event the this variable inside this callback will point to the corresponding DOM element that w... | [
"jquery",
"button",
"click",
"dynamic-controls"
] | 0 | 1 | 549 | 1 | 0 | 2011-06-02T17:34:14.217000 | 2011-06-02T17:35:07.290000 |
6,218,066 | 6,225,493 | How do I take a snapshot of the Android emulator's state? | When I launch the Android emulator from the Android SDK and AVD Manager I can check the boxes Launch from snapshot and Save to snapshot so that the emulator's state is saved when I close it and restored again when I launch it. This is great because I don't have to wait for Android to boot each time the emulator is laun... | I found the answer thanks to this comment. To take and load snapshots, start a Telnet session to the emulator: $ telnet localhost 5554 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Android Console: type 'help' for a list of commands OK avd snapshot save snapshot_name OK avd snapshot load snapsho... | How do I take a snapshot of the Android emulator's state? When I launch the Android emulator from the Android SDK and AVD Manager I can check the boxes Launch from snapshot and Save to snapshot so that the emulator's state is saved when I close it and restored again when I launch it. This is great because I don't have ... | TITLE:
How do I take a snapshot of the Android emulator's state?
QUESTION:
When I launch the Android emulator from the Android SDK and AVD Manager I can check the boxes Launch from snapshot and Save to snapshot so that the emulator's state is saved when I close it and restored again when I launch it. This is great bec... | [
"android",
"emulation",
"snapshot"
] | 7 | 10 | 7,079 | 1 | 0 | 2011-06-02T17:35:33.347000 | 2011-06-03T09:48:50.597000 |
6,218,067 | 6,218,532 | Very strange behaviour jQuery load() with CodeIgniter | I really can't work out what's going on here. I'm using the jQuery load() method to replace some HTML within a page. In this case it is to replace the current message with one selected from a list by the user. It's all working as expected except for one vital thing. When the HTML is returned it has added the word "ARRA... | I'm going to try to help you debug in an answer instead of buried in comments. We've tried if($this->input->is_ajax_request()) exit('Hello'); as the first line of get_message() and the output was Arrayhello. This leads me to believe that somewhere, you are checking for an AJAX request and echo ing some array, as this i... | Very strange behaviour jQuery load() with CodeIgniter I really can't work out what's going on here. I'm using the jQuery load() method to replace some HTML within a page. In this case it is to replace the current message with one selected from a list by the user. It's all working as expected except for one vital thing.... | TITLE:
Very strange behaviour jQuery load() with CodeIgniter
QUESTION:
I really can't work out what's going on here. I'm using the jQuery load() method to replace some HTML within a page. In this case it is to replace the current message with one selected from a list by the user. It's all working as expected except fo... | [
"php",
"javascript",
"jquery",
"codeigniter"
] | 0 | 3 | 703 | 1 | 0 | 2011-06-02T17:35:38.010000 | 2011-06-02T18:14:31.283000 |
6,218,080 | 6,220,613 | Open only one instance of QDialog with show() , and also does the Object is deleted if i close the QDialog | in Qt im opening QDialog windows each time i click some item im doing it with new, i like to be sure im opening only one instance of QDialog for each item im clicking: void foo::treeWidget_itemClicked(QTreeWidgetItem *item,nt column)..... QString groupID = item->data(0, Qt::UserRole).toString(); QString groupName = ite... | Yes, you should probably keep some kind of list of your dialogs to keep track of which ones are already open. If your GroupID is your unique ID then you could do something like this: QMap DialogMap; void foo::treeWidget_itemClicked(QTreeWidgetItem *item,nt column) {..... QString groupID = item->data(0, Qt::UserRole).to... | Open only one instance of QDialog with show() , and also does the Object is deleted if i close the QDialog in Qt im opening QDialog windows each time i click some item im doing it with new, i like to be sure im opening only one instance of QDialog for each item im clicking: void foo::treeWidget_itemClicked(QTreeWidgetI... | TITLE:
Open only one instance of QDialog with show() , and also does the Object is deleted if i close the QDialog
QUESTION:
in Qt im opening QDialog windows each time i click some item im doing it with new, i like to be sure im opening only one instance of QDialog for each item im clicking: void foo::treeWidget_itemCl... | [
"c++",
"qt",
"qdialog"
] | 3 | 1 | 3,174 | 1 | 0 | 2011-06-02T17:36:26.127000 | 2011-06-02T21:29:17.693000 |
6,218,097 | 6,219,415 | File upload in Django | I'm trying to get Django to upload a file (keeping it simple, for now), but am having difficulties. Here's all of the relevant code (that I know of). Perhaps something is wrong with my settings.py? My code is pieces of various answers on Stack Overflow. I've checked here already. When I select a file (~8.5mb file becau... | You are posting data to the wrong URL, change action="/uploadsuccess/" to /uploadfile/. | File upload in Django I'm trying to get Django to upload a file (keeping it simple, for now), but am having difficulties. Here's all of the relevant code (that I know of). Perhaps something is wrong with my settings.py? My code is pieces of various answers on Stack Overflow. I've checked here already. When I select a f... | TITLE:
File upload in Django
QUESTION:
I'm trying to get Django to upload a file (keeping it simple, for now), but am having difficulties. Here's all of the relevant code (that I know of). Perhaps something is wrong with my settings.py? My code is pieces of various answers on Stack Overflow. I've checked here already.... | [
"django",
"file-upload",
"upload"
] | 1 | 0 | 1,919 | 1 | 0 | 2011-06-02T17:37:46.610000 | 2011-06-02T19:31:29.260000 |
6,218,109 | 6,218,144 | Queue implementation in C# | I'm dealing with a hardware resource that can only handle 1 command at a time. I'm going to exposing some of it's API functions via a web interface, so obviously there's a good chance more than 1 command will get sent at a time. I have decided that queuing these commands when they're submitted is the best way to ensure... | You can use the ConcurrentQueue class for your implementation and have a dedicated thread to process items in the queue. For the waiting part you can use an AutoResetEvent, producers pass the event instance to the singleton class along with the request, then calls WaitOne() which blocks until the processor has signaled... | Queue implementation in C# I'm dealing with a hardware resource that can only handle 1 command at a time. I'm going to exposing some of it's API functions via a web interface, so obviously there's a good chance more than 1 command will get sent at a time. I have decided that queuing these commands when they're submitte... | TITLE:
Queue implementation in C#
QUESTION:
I'm dealing with a hardware resource that can only handle 1 command at a time. I'm going to exposing some of it's API functions via a web interface, so obviously there's a good chance more than 1 command will get sent at a time. I have decided that queuing these commands whe... | [
"c#",
"queue"
] | 8 | 11 | 4,059 | 2 | 0 | 2011-06-02T17:39:06.183000 | 2011-06-02T17:42:10.753000 |
6,218,111 | 6,227,260 | Change svn node properties with Python raises a SubversionException | When changing a svn node property with python, using svn.fs.change_node_prop(root, path, "thisisa:property", "andthisisavalue") raises an exception with the message "svn.core.SubversionException: ('Root object must be a transaction root', 160022)" root is made with this: canon_path = svn.core.svn_path_canonicalize(repo... | I was wrong using root as the head revision root. I needed to begin a transaction for commit and get it's transaction root. For doing this I made, txn = svn.repos.fs_begin_txn_for_commit(repos_ptr, headrev, SVN_COMMIT_USER, SVN_COMMIT_MESSAGE) root = svn.fs.txn_root(txn) Hope this helps to anyone. | Change svn node properties with Python raises a SubversionException When changing a svn node property with python, using svn.fs.change_node_prop(root, path, "thisisa:property", "andthisisavalue") raises an exception with the message "svn.core.SubversionException: ('Root object must be a transaction root', 160022)" root... | TITLE:
Change svn node properties with Python raises a SubversionException
QUESTION:
When changing a svn node property with python, using svn.fs.change_node_prop(root, path, "thisisa:property", "andthisisavalue") raises an exception with the message "svn.core.SubversionException: ('Root object must be a transaction ro... | [
"python",
"svn",
"svn-propset"
] | 0 | 0 | 252 | 1 | 0 | 2011-06-02T17:39:16.057000 | 2011-06-03T12:46:23.140000 |
6,218,126 | 6,231,045 | XPath predicate with sub-paths with lxml? | I'm trying to understand and XPath that was sent to me for use with ACORD XML forms (common format in insurance). The XPath they sent me is (truncated for brevity):./PersApplicationInfo/InsuredOrPrincipal[InsuredOrPrincipalInfo/InsuredOrPrincipalRoleCd="AN"]/GeneralPartyInfo Where I'm running into trouble is that Pytho... | Change tree.find to tree.xpath. find and findall are present in lxml to provide compatibility with other implementations of ElementTree. These methods do not implement the entire XPath language. To employ XPath expressions containing more advanced features, use the xpath method, the XPath class, or XPathEvaluator. For ... | XPath predicate with sub-paths with lxml? I'm trying to understand and XPath that was sent to me for use with ACORD XML forms (common format in insurance). The XPath they sent me is (truncated for brevity):./PersApplicationInfo/InsuredOrPrincipal[InsuredOrPrincipalInfo/InsuredOrPrincipalRoleCd="AN"]/GeneralPartyInfo Wh... | TITLE:
XPath predicate with sub-paths with lxml?
QUESTION:
I'm trying to understand and XPath that was sent to me for use with ACORD XML forms (common format in insurance). The XPath they sent me is (truncated for brevity):./PersApplicationInfo/InsuredOrPrincipal[InsuredOrPrincipalInfo/InsuredOrPrincipalRoleCd="AN"]/G... | [
"python",
"xml",
"xpath",
"lxml"
] | 8 | 19 | 8,153 | 4 | 0 | 2011-06-02T17:40:44.330000 | 2011-06-03T18:17:12.890000 |
6,218,131 | 6,218,162 | PHP: Determine number of characters that come before a dash in a string | If I have a bunch of strings like XXX-WYC-5b, where XXX is any value between 1 and 999, how do I determine the length of XXX? So I might have: 1: 6-WYC-5b 2: 32-WYC-5b 3: 932-W-5b 4: 22-XYQ-5b 5: 914-WYC-5b And I want it to tell me the length of XXX, so: 1: 1 character 2: 2 characters 3: 3 characters 4: 2 characters 5:... | Use PHP's built-in string position function. Because it starts counting at 0, you don't even have to adjust the output: $pos = strpos($string, "-"); For the second part, use PHP's substring function: return substr($string, 0, $pos); | PHP: Determine number of characters that come before a dash in a string If I have a bunch of strings like XXX-WYC-5b, where XXX is any value between 1 and 999, how do I determine the length of XXX? So I might have: 1: 6-WYC-5b 2: 32-WYC-5b 3: 932-W-5b 4: 22-XYQ-5b 5: 914-WYC-5b And I want it to tell me the length of XX... | TITLE:
PHP: Determine number of characters that come before a dash in a string
QUESTION:
If I have a bunch of strings like XXX-WYC-5b, where XXX is any value between 1 and 999, how do I determine the length of XXX? So I might have: 1: 6-WYC-5b 2: 32-WYC-5b 3: 932-W-5b 4: 22-XYQ-5b 5: 914-WYC-5b And I want it to tell m... | [
"php"
] | 0 | 3 | 828 | 2 | 0 | 2011-06-02T17:41:07.633000 | 2011-06-02T17:43:51.537000 |
6,218,143 | 6,218,563 | How to send POST request in JSON using HTTPClient in Android? | I'm trying to figure out how to POST JSON from Android by using HTTPClient. I've been trying to figure this out for a while, I have found plenty of examples online, but I cannot get any of them to work. I believe this is because of my lack of JSON/networking knowledge in general. I know there are plenty of examples out... | In this answer I am using an example posted by Justin Grammens. About JSON JSON stands for JavaScript Object Notation. In JavaScript properties can be referenced both like this object1.name and like this object['name'];. The example from the article uses this bit of JSON. The Parts A fan object with email as a key and ... | How to send POST request in JSON using HTTPClient in Android? I'm trying to figure out how to POST JSON from Android by using HTTPClient. I've been trying to figure this out for a while, I have found plenty of examples online, but I cannot get any of them to work. I believe this is because of my lack of JSON/networking... | TITLE:
How to send POST request in JSON using HTTPClient in Android?
QUESTION:
I'm trying to figure out how to POST JSON from Android by using HTTPClient. I've been trying to figure this out for a while, I have found plenty of examples online, but I cannot get any of them to work. I believe this is because of my lack ... | [
"android",
"json",
"post",
"httprequest"
] | 112 | 157 | 269,902 | 5 | 0 | 2011-06-02T17:42:07.790000 | 2011-06-02T18:16:50.753000 |
6,218,145 | 6,218,673 | Displaying folders and making links of those folders | I am looking to build a directory browser in PHP. I have just started my code, but need someone to help me complete or modify it. $dir = dirname(__FILE__); //path of the directory to read
$iterator = new RecursiveDirectoryIterator($dir); foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHIL... | While you develop this, its important to recognize that you are dealing with two different directory paths. One path is URL based, the other is Document based. The path / would take you to the root of your site where C:\some path\www\ would also take you there. Both of these reference the same location, using different... | Displaying folders and making links of those folders I am looking to build a directory browser in PHP. I have just started my code, but need someone to help me complete or modify it. $dir = dirname(__FILE__); //path of the directory to read
$iterator = new RecursiveDirectoryIterator($dir); foreach (new RecursiveIterat... | TITLE:
Displaying folders and making links of those folders
QUESTION:
I am looking to build a directory browser in PHP. I have just started my code, but need someone to help me complete or modify it. $dir = dirname(__FILE__); //path of the directory to read
$iterator = new RecursiveDirectoryIterator($dir); foreach (n... | [
"php",
"file-io"
] | 0 | 0 | 871 | 1 | 0 | 2011-06-02T17:42:27.950000 | 2011-06-02T18:25:47.487000 |
6,218,147 | 6,218,176 | Enter Data to main form | I Made an application. The Main form Name is Form1. And the other Form is called PoP. public partial class pops: Form { public pops() { InitializeComponent(); CenterToScreen(); }
private void pops_Load(object sender, EventArgs e) { }
private void button1_Click(object sender, EventArgs e) { Close(); }
private void lb... | Make two public properties on popup form and retrieve them from parent form. string username = string.Empty; string password = string.Empty;
using (LoginForm form = new LoginForm ()) { DialogResult result = form.ShowDialog(); if (result == DialogResult.Ok) { username = form.Username; password = form.Password; } } | Enter Data to main form I Made an application. The Main form Name is Form1. And the other Form is called PoP. public partial class pops: Form { public pops() { InitializeComponent(); CenterToScreen(); }
private void pops_Load(object sender, EventArgs e) { }
private void button1_Click(object sender, EventArgs e) { Clo... | TITLE:
Enter Data to main form
QUESTION:
I Made an application. The Main form Name is Form1. And the other Form is called PoP. public partial class pops: Form { public pops() { InitializeComponent(); CenterToScreen(); }
private void pops_Load(object sender, EventArgs e) { }
private void button1_Click(object sender, ... | [
"c#",
"windows",
"winforms",
"label"
] | 0 | 2 | 228 | 4 | 0 | 2011-06-02T17:42:37.373000 | 2011-06-02T17:45:15.093000 |
6,218,148 | 6,226,841 | Solr lucene schema.xml multi-valued entries, please help | Essentially I am trying to link a user type to a price for a product. So a product is a document in the index, and each document has multiple prices, one for each user type. And i am essentially trying to check the price for that usertype e.g. where user type = 2 and price > 10 But each product can have a varying numbe... | Hmmm... One thing you could try is using dynamic fields in solr to solve this problem. As you add fields you just name them like price_usertypex_i (see some examples in the schema.xml as well). As you add user types you create more fields, but you don't have to modify your schema because it is dynamic. One caveat is th... | Solr lucene schema.xml multi-valued entries, please help Essentially I am trying to link a user type to a price for a product. So a product is a document in the index, and each document has multiple prices, one for each user type. And i am essentially trying to check the price for that usertype e.g. where user type = 2... | TITLE:
Solr lucene schema.xml multi-valued entries, please help
QUESTION:
Essentially I am trying to link a user type to a price for a product. So a product is a document in the index, and each document has multiple prices, one for each user type. And i am essentially trying to check the price for that usertype e.g. w... | [
"java",
"lucene",
"solr",
"schema",
"indexing"
] | 0 | 2 | 565 | 3 | 0 | 2011-06-02T17:43:03.217000 | 2011-06-03T12:01:27.823000 |
6,218,153 | 6,218,799 | Kohana 3.1 ORM: How to implement a "unique" validation rule? | does exists a "unique" validation rule (if does, how to implement it?) or must be implemented via callback? Thanks. | ) As far as I know there is no universal "unique" (or "is_unique") rule of Validation class. That's probably because of not regular nature of this kind of check. However, if you would like do it nicely, you could create a 'base model' for all your models you use in your application (make them extend the base one). Then... | Kohana 3.1 ORM: How to implement a "unique" validation rule? does exists a "unique" validation rule (if does, how to implement it?) or must be implemented via callback? Thanks. | TITLE:
Kohana 3.1 ORM: How to implement a "unique" validation rule?
QUESTION:
does exists a "unique" validation rule (if does, how to implement it?) or must be implemented via callback? Thanks.
ANSWER:
) As far as I know there is no universal "unique" (or "is_unique") rule of Validation class. That's probably because... | [
"php",
"kohana",
"kohana-3",
"kohana-orm"
] | 0 | 3 | 5,110 | 3 | 0 | 2011-06-02T17:43:18.583000 | 2011-06-02T18:36:13.370000 |
6,218,167 | 6,218,438 | Send data to page loaded in WebView | I have a WebView in my app and I load http://mysite.com/somepage.php I know I can pass data using the GET method because that would just be right in the URL string. I was wondering how I could pass data to the page using the POST method. I tried searching but I cannot find anything specific. Thanks. | There's a method called postUrl in WebView. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webView = new WebView(this); setContentView(webView);
String url = "http://mysite.com/somepage.php"; String postData = "postvar=value";
webView.postUrl(url, EncodingUtils.getBytes(... | Send data to page loaded in WebView I have a WebView in my app and I load http://mysite.com/somepage.php I know I can pass data using the GET method because that would just be right in the URL string. I was wondering how I could pass data to the page using the POST method. I tried searching but I cannot find anything s... | TITLE:
Send data to page loaded in WebView
QUESTION:
I have a WebView in my app and I load http://mysite.com/somepage.php I know I can pass data using the GET method because that would just be right in the URL string. I was wondering how I could pass data to the page using the POST method. I tried searching but I cann... | [
"android",
"post",
"webview",
"http-post"
] | 5 | 8 | 8,662 | 1 | 0 | 2011-06-02T17:44:39.427000 | 2011-06-02T18:06:50.307000 |
6,218,173 | 6,218,311 | Send mysql dump to amazon S3 | I want to do a simple full backup of my mysql database to S3 once or twice a day. So I can execute mysqldump in a cron task. What's the easiest way to send that dump to amazon S3? | Check out this one: http://s3tools.org/s3cmd If you are on Linux, it is probably included in your distribution. | Send mysql dump to amazon S3 I want to do a simple full backup of my mysql database to S3 once or twice a day. So I can execute mysqldump in a cron task. What's the easiest way to send that dump to amazon S3? | TITLE:
Send mysql dump to amazon S3
QUESTION:
I want to do a simple full backup of my mysql database to S3 once or twice a day. So I can execute mysqldump in a cron task. What's the easiest way to send that dump to amazon S3?
ANSWER:
Check out this one: http://s3tools.org/s3cmd If you are on Linux, it is probably inc... | [
"database",
"amazon-s3",
"backup",
"mysql"
] | 2 | 1 | 1,929 | 2 | 0 | 2011-06-02T17:45:04.730000 | 2011-06-02T17:57:01.860000 |
6,218,174 | 6,218,282 | Compiler error in G++ but not in VS2008, stl templates | I am compiling the same project under two different compilers. The snippet below compiles fine under VS2008 but gives the following error when I try to compile it under G++ with Eclipse G++ Error message: common.h: In function 'int ci_find_substr(const T&, const T&, const std::locale&)': common.h:84: error: expected `;... | Try putting typename T::const_iterator it = std::search(etc.) I don't think it's recognizing T::const_iterator as a type. When I tried to compile your code in g++ 4.5.2, it gave me the following error message, which confirms this error: need 'typename' before 'T:: const_iterator' because 'T' is a dependent scope Edit: ... | Compiler error in G++ but not in VS2008, stl templates I am compiling the same project under two different compilers. The snippet below compiles fine under VS2008 but gives the following error when I try to compile it under G++ with Eclipse G++ Error message: common.h: In function 'int ci_find_substr(const T&, const T&... | TITLE:
Compiler error in G++ but not in VS2008, stl templates
QUESTION:
I am compiling the same project under two different compilers. The snippet below compiles fine under VS2008 but gives the following error when I try to compile it under G++ with Eclipse G++ Error message: common.h: In function 'int ci_find_substr(... | [
"visual-studio-2008",
"stl",
"g++"
] | 2 | 2 | 816 | 1 | 0 | 2011-06-02T17:45:12.420000 | 2011-06-02T17:53:47.087000 |
6,218,175 | 6,218,463 | How to implement followers/following in Django | I want to implement the followers/following feature in my Django application. I've an UserProfile class for every User (django.contrib.auth.User): class UserProfile(models.Model): user = models.ForeignKey(User, unique = True, related_name = 'user') follows = models.ManyToManyField("self", related_name = 'follows') So I... | Set symmetrical to False in your Many2Many relation: follows = models.ManyToManyField('self', related_name='follows', symmetrical=False) | How to implement followers/following in Django I want to implement the followers/following feature in my Django application. I've an UserProfile class for every User (django.contrib.auth.User): class UserProfile(models.Model): user = models.ForeignKey(User, unique = True, related_name = 'user') follows = models.ManyToM... | TITLE:
How to implement followers/following in Django
QUESTION:
I want to implement the followers/following feature in my Django application. I've an UserProfile class for every User (django.contrib.auth.User): class UserProfile(models.Model): user = models.ForeignKey(User, unique = True, related_name = 'user') follow... | [
"python",
"django",
"django-orm"
] | 20 | 29 | 9,379 | 2 | 0 | 2011-06-02T17:45:12.530000 | 2011-06-02T18:09:13.480000 |
6,218,182 | 6,235,774 | Problem with an NSString and UITableViewCell | I have a big UITableViewCell which has a text from an NSString from internet. Then that string is shown ok on an NSLog, but when shown on the cell shows strange characters at the start of the text, like this: And it randomizes the characters every launch. I'm not formatting the string in any way, so I can't understand ... | The problem is that I was adding random garbage, because that text was used before now on a simple UITextView. Recoding the wayt it gets the description worked, thanks all who helped! | Problem with an NSString and UITableViewCell I have a big UITableViewCell which has a text from an NSString from internet. Then that string is shown ok on an NSLog, but when shown on the cell shows strange characters at the start of the text, like this: And it randomizes the characters every launch. I'm not formatting ... | TITLE:
Problem with an NSString and UITableViewCell
QUESTION:
I have a big UITableViewCell which has a text from an NSString from internet. Then that string is shown ok on an NSLog, but when shown on the cell shows strange characters at the start of the text, like this: And it randomizes the characters every launch. I... | [
"cocoa-touch",
"ios4"
] | 0 | 0 | 105 | 2 | 0 | 2011-06-02T17:45:27.053000 | 2011-06-04T09:01:08.500000 |
6,218,188 | 6,218,217 | How can I get a CheckEdit in a NavBarGroup | We need to place a check box (and caption for it) in the header of a NavBarGroup. Is there a way to do this? | We created a NavBarGroupChecked class (NavBarGroupChecked.cs) that inherits from NavBarGroup and can just be dropped in to replace it. It adds a RepositoryItemCheckEdit member that tracks the checkbox and implements custom draw. It has a Checked property that tells you if it is checked and an event that will be called ... | How can I get a CheckEdit in a NavBarGroup We need to place a check box (and caption for it) in the header of a NavBarGroup. Is there a way to do this? | TITLE:
How can I get a CheckEdit in a NavBarGroup
QUESTION:
We need to place a check box (and caption for it) in the header of a NavBarGroup. Is there a way to do this?
ANSWER:
We created a NavBarGroupChecked class (NavBarGroupChecked.cs) that inherits from NavBarGroup and can just be dropped in to replace it. It add... | [
"winforms",
"devexpress"
] | 3 | 3 | 2,321 | 2 | 0 | 2011-06-02T17:45:54.730000 | 2011-06-02T17:48:37.613000 |
6,218,192 | 6,218,250 | JSON Encoding - Get MySQL data to an iPhone | Im new to JSON and have whats probably a basic question. I have some MySQL rows I want grab with Php, and then JSON encode for a response to an iphone request. so the questions are: 1) Whats the format for the array to encode this info? 2) Where the does the response code (200) fit into it? | Try this tutorial. http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/ Basically on the PHP side, write a script that fetches the MySQL data and then echo back the output of json_encode. The iPhone side will call to the URL of this script using the method above. I would suggest you take a look at json.org a... | JSON Encoding - Get MySQL data to an iPhone Im new to JSON and have whats probably a basic question. I have some MySQL rows I want grab with Php, and then JSON encode for a response to an iphone request. so the questions are: 1) Whats the format for the array to encode this info? 2) Where the does the response code (20... | TITLE:
JSON Encoding - Get MySQL data to an iPhone
QUESTION:
Im new to JSON and have whats probably a basic question. I have some MySQL rows I want grab with Php, and then JSON encode for a response to an iphone request. so the questions are: 1) Whats the format for the array to encode this info? 2) Where the does the... | [
"php",
"mysql",
"json"
] | 1 | 0 | 1,573 | 2 | 0 | 2011-06-02T17:46:32.647000 | 2011-06-02T17:51:47.947000 |
6,218,193 | 6,218,287 | What is better for my ASP.NET project using (Server explorer) or DBconnect class? | I have ASP.NET project and I want to know what is better to use. ODBC connection and with Server Explorer (drag and drop make DataSet and modify it) or do some DBconnect class with connection to database, queries and use it for GridView? When I use server explorer, I don't have good feeling because all logic is on aspx... | "Better" depends entirely on your situation. Is the purpose to get something done as quickly as possible for internal users at your company, or is this going to be a commercial site that will need to be highly extensible and needs to be as easy as possible to maintain? Will you need to integrate with other platforms po... | What is better for my ASP.NET project using (Server explorer) or DBconnect class? I have ASP.NET project and I want to know what is better to use. ODBC connection and with Server Explorer (drag and drop make DataSet and modify it) or do some DBconnect class with connection to database, queries and use it for GridView? ... | TITLE:
What is better for my ASP.NET project using (Server explorer) or DBconnect class?
QUESTION:
I have ASP.NET project and I want to know what is better to use. ODBC connection and with Server Explorer (drag and drop make DataSet and modify it) or do some DBconnect class with connection to database, queries and use... | [
"asp.net",
"sql"
] | 4 | 2 | 126 | 3 | 0 | 2011-06-02T17:46:35.220000 | 2011-06-02T17:54:34.850000 |
6,218,194 | 6,218,429 | How to define a Constant in XSD | Is there a way to define a constant value and use that constant in the preceeding XSD? I have a common value I want to use for various xs:element tag's maxOccurs attributes. Like constants in other languages, I want to make the change in one place should the value backing MyConst were to ever change.... | No it is not allowed that way. However you can define your own type with a fixed value in it somewhere on top of your XSD (place dosen matters) and use that type for the elements. | How to define a Constant in XSD Is there a way to define a constant value and use that constant in the preceeding XSD? I have a common value I want to use for various xs:element tag's maxOccurs attributes. Like constants in other languages, I want to make the change in one place should the value backing MyConst were to... | TITLE:
How to define a Constant in XSD
QUESTION:
Is there a way to define a constant value and use that constant in the preceeding XSD? I have a common value I want to use for various xs:element tag's maxOccurs attributes. Like constants in other languages, I want to make the change in one place should the value backi... | [
"xsd",
"constants"
] | 5 | 2 | 5,747 | 3 | 0 | 2011-06-02T17:46:36.587000 | 2011-06-02T18:06:03.840000 |
6,218,195 | 6,218,349 | Connect to ONLINE MySQL database using DSN ODBC | I am connecting an online MySQL database. I have downloaded MySQL ODBC Connector 5.1. Now am trying to setup the DSN. But am getting the error: Connection Failed: [HY000] [MySQL] [ODBC 5.1 Driver]Access Denied for user 'user123'@'myweb.com' I have hosted this site with some hosting provider. Do i need some details from... | Cpanel by default does not allow remote connections. Please go to database area in your cPanel and add there your public IP address so that it can accept connection requests from your IP address. | Connect to ONLINE MySQL database using DSN ODBC I am connecting an online MySQL database. I have downloaded MySQL ODBC Connector 5.1. Now am trying to setup the DSN. But am getting the error: Connection Failed: [HY000] [MySQL] [ODBC 5.1 Driver]Access Denied for user 'user123'@'myweb.com' I have hosted this site with so... | TITLE:
Connect to ONLINE MySQL database using DSN ODBC
QUESTION:
I am connecting an online MySQL database. I have downloaded MySQL ODBC Connector 5.1. Now am trying to setup the DSN. But am getting the error: Connection Failed: [HY000] [MySQL] [ODBC 5.1 Driver]Access Denied for user 'user123'@'myweb.com' I have hosted... | [
"mysql",
"database",
"odbc",
"database-connection",
"dsn"
] | 2 | 3 | 4,547 | 1 | 0 | 2011-06-02T17:46:37.040000 | 2011-06-02T18:00:15.480000 |
6,218,205 | 6,220,390 | How to build chained methods like - should_receive(:something).with(:params, values).and_return(:something_else) | I was trying to make my code a bit smaller building a method that can look like the should_receive from RSpec, the case here is that I'm testing a state machine and I have several methods with code like this: context "State is unknown" do before do @obj = create_obj(:state => 'unknown') end context "Event add" do it 's... | The important part to chaining is to return self from the object, so the next call can still work on the object. class Foo def one puts "one" self end
def two puts "two" self end
def three puts "three" self end end
a=Foo.new a.one.two.three | How to build chained methods like - should_receive(:something).with(:params, values).and_return(:something_else) I was trying to make my code a bit smaller building a method that can look like the should_receive from RSpec, the case here is that I'm testing a state machine and I have several methods with code like this... | TITLE:
How to build chained methods like - should_receive(:something).with(:params, values).and_return(:something_else)
QUESTION:
I was trying to make my code a bit smaller building a method that can look like the should_receive from RSpec, the case here is that I'm testing a state machine and I have several methods w... | [
"ruby-on-rails",
"ruby",
"rspec",
"rspec-rails"
] | 0 | 0 | 382 | 3 | 0 | 2011-06-02T17:47:31.390000 | 2011-06-02T21:05:39.380000 |
6,218,206 | 6,220,292 | How to deal with Savon Responses? | I do not understand the people who prefer Savon to Soap4r. How can I get the attributes of the returned object in a Savon response? With soap4r it's as clean as invoking a getter! Apparently, in Savon I need to explicitly parse the response and walk the response_hash. This is way worse than the soap4r approach. Am I ge... | From https://github.com/raldred/savon/blob/master/lib/savon/response.rb # You can also let Savon translate the SOAP response body to a Hash. # # response.to_hash # => {:findUserByIdResponse => { # =>:id => "123", # =>:username => "eve" # =>:active => true # => } So you should be able to call hash[:object] which would r... | How to deal with Savon Responses? I do not understand the people who prefer Savon to Soap4r. How can I get the attributes of the returned object in a Savon response? With soap4r it's as clean as invoking a getter! Apparently, in Savon I need to explicitly parse the response and walk the response_hash. This is way worse... | TITLE:
How to deal with Savon Responses?
QUESTION:
I do not understand the people who prefer Savon to Soap4r. How can I get the attributes of the returned object in a Savon response? With soap4r it's as clean as invoking a getter! Apparently, in Savon I need to explicitly parse the response and walk the response_hash.... | [
"ruby-on-rails",
"ruby",
"soap",
"savon",
"soap4r"
] | 0 | 1 | 2,016 | 1 | 0 | 2011-06-02T17:47:41.413000 | 2011-06-02T20:55:46.527000 |
6,218,218 | 6,218,317 | comparing values sent to/from server by NetworkStream | When u know why the sent string "kamote" to server and the string received "kamote" from server are not the same.. CLIENT tcpClient = new TcpClient(); tcpClient.Connect(ServerIP, Port); connectionState = (HandShake("kamote", tcpClient))? "Connected to " + ServerIP.ToString(): "Host unreachable.";
private bool HandShak... | As in the previous question you asked, you're not keeping track of the number of bytes you received. So what's happening is this: On the client, you send the string "kamote". On the server, it receives that string into a buffer that's 10025 bytes long. The server then sends the entire buffer back to the client -- all 1... | comparing values sent to/from server by NetworkStream When u know why the sent string "kamote" to server and the string received "kamote" from server are not the same.. CLIENT tcpClient = new TcpClient(); tcpClient.Connect(ServerIP, Port); connectionState = (HandShake("kamote", tcpClient))? "Connected to " + ServerIP.T... | TITLE:
comparing values sent to/from server by NetworkStream
QUESTION:
When u know why the sent string "kamote" to server and the string received "kamote" from server are not the same.. CLIENT tcpClient = new TcpClient(); tcpClient.Connect(ServerIP, Port); connectionState = (HandShake("kamote", tcpClient))? "Connected... | [
"c#",
"sockets",
"encoding",
"network-programming",
"tcpclient"
] | 1 | 4 | 937 | 3 | 0 | 2011-06-02T17:48:58.117000 | 2011-06-02T17:57:29.317000 |
6,218,231 | 6,218,266 | Do I need the Internet-permission tag to provide links in an app? | Description of the permission: "Allows applications to open network sockets." It doesn't seem like I need this permission since it seems like if you try to do something that requires specific permission-tags and you don't have that tag, you'll end up with an error message. Also, it seems weird that links would somehow ... | If you are sending an intent which is handled by a browser application, your application does not need internet permission. If you are opening a webview within your own application, then it does. | Do I need the Internet-permission tag to provide links in an app? Description of the permission: "Allows applications to open network sockets." It doesn't seem like I need this permission since it seems like if you try to do something that requires specific permission-tags and you don't have that tag, you'll end up wit... | TITLE:
Do I need the Internet-permission tag to provide links in an app?
QUESTION:
Description of the permission: "Allows applications to open network sockets." It doesn't seem like I need this permission since it seems like if you try to do something that requires specific permission-tags and you don't have that tag,... | [
"android",
"permissions"
] | 2 | 5 | 420 | 1 | 0 | 2011-06-02T17:50:33.077000 | 2011-06-02T17:52:55.123000 |
6,218,239 | 6,218,274 | HTML5 rotating/animated background | How would you go about creating something like this http://www.bikingboss.com/ (move your mouse horizontally). I just want some general guidelines/ minimal code, where do you get stared, I've learnt some HTML5 (diveintohtml5.ep.io), and I was thinking this would have something to do with canvas, am I right? | It's just a parallax effect. There is even jQuery plugin for that http://webdev.stephband.info/parallax.html. | HTML5 rotating/animated background How would you go about creating something like this http://www.bikingboss.com/ (move your mouse horizontally). I just want some general guidelines/ minimal code, where do you get stared, I've learnt some HTML5 (diveintohtml5.ep.io), and I was thinking this would have something to do w... | TITLE:
HTML5 rotating/animated background
QUESTION:
How would you go about creating something like this http://www.bikingboss.com/ (move your mouse horizontally). I just want some general guidelines/ minimal code, where do you get stared, I've learnt some HTML5 (diveintohtml5.ep.io), and I was thinking this would have... | [
"javascript",
"jquery",
"css",
"jquery-animate"
] | 1 | 6 | 3,131 | 3 | 0 | 2011-06-02T17:51:05.047000 | 2011-06-02T17:53:22.643000 |
6,218,244 | 6,218,711 | Records not showing up in the database | We start an operation by making sure a customer has enough items with which to work. So we begin by collecting all their current items in an array: @items = SOrder.where(:user_id => current_user.id).order("order") Then we determine how many items they should have. If someone has a free account, they should have 5 items... | The error may come from calling.length from an Arel object and not a record set. @items = SOrder.where(:user_id => current_user.id).order("order").all However, since you only need a count for the first query, I'd suggest using.count. If I was writing this I'd do something like: number_of_items = SOrder.where(:user_id =... | Records not showing up in the database We start an operation by making sure a customer has enough items with which to work. So we begin by collecting all their current items in an array: @items = SOrder.where(:user_id => current_user.id).order("order") Then we determine how many items they should have. If someone has a... | TITLE:
Records not showing up in the database
QUESTION:
We start an operation by making sure a customer has enough items with which to work. So we begin by collecting all their current items in an array: @items = SOrder.where(:user_id => current_user.id).order("order") Then we determine how many items they should have... | [
"ruby-on-rails",
"ruby",
"ruby-on-rails-3"
] | 0 | 1 | 181 | 4 | 0 | 2011-06-02T17:51:29.760000 | 2011-06-02T18:28:34.493000 |
6,218,245 | 6,218,246 | C# 4.0 and .Net 3.5 | So we've finally got VS2010 on some developer stations at work and can use the C# 4.0 features. Although most of what we develop will still have to target.Net 3.5 for the time being. When I start a new project and set the target to.Net 3.5, it still allows me to use C# 4.0 such as dynamic. Can you therefore use C#4.0 f... | dynamic code will not compile if you target the.NET 3.5 framework. To be more clear, the compiler will allow you to define and assign a dynamic variable, such as: dynamic x = 3; That one line of code will compile, because dynamic just compiles to object as far as types are concerned. But if you then try to do anything ... | C# 4.0 and .Net 3.5 So we've finally got VS2010 on some developer stations at work and can use the C# 4.0 features. Although most of what we develop will still have to target.Net 3.5 for the time being. When I start a new project and set the target to.Net 3.5, it still allows me to use C# 4.0 such as dynamic. Can you t... | TITLE:
C# 4.0 and .Net 3.5
QUESTION:
So we've finally got VS2010 on some developer stations at work and can use the C# 4.0 features. Although most of what we develop will still have to target.Net 3.5 for the time being. When I start a new project and set the target to.Net 3.5, it still allows me to use C# 4.0 such as ... | [
"c#",
".net",
".net-3.5"
] | 29 | 44 | 16,412 | 1 | 0 | 2011-06-02T13:41:12.963000 | 2011-06-02T14:20:49.830000 |
6,218,256 | 6,218,307 | Objective C Encryption CFB Mode | I'm aware that in Objective C I can encrypt using AES128 through their native libraries (CommonCrypter.h). In Java, I'm encrypting using AES128 ISO-8859-1 in CFB Mode. In Objective C encoding is done through NSISOLATIN1STRINGENCODING but the problem is there's no equivalent in CFB Mode. The only modes available are: EB... | CBC can be built using ECB, conceptually it's: Key K; InitializationVector IV; OutputDataStream OS; Block X;
set X = IV; for each Block B of data D: Block E = ECB(K, B ^ X); set X = E write E to OS | Objective C Encryption CFB Mode I'm aware that in Objective C I can encrypt using AES128 through their native libraries (CommonCrypter.h). In Java, I'm encrypting using AES128 ISO-8859-1 in CFB Mode. In Objective C encoding is done through NSISOLATIN1STRINGENCODING but the problem is there's no equivalent in CFB Mode. ... | TITLE:
Objective C Encryption CFB Mode
QUESTION:
I'm aware that in Objective C I can encrypt using AES128 through their native libraries (CommonCrypter.h). In Java, I'm encrypting using AES128 ISO-8859-1 in CFB Mode. In Objective C encoding is done through NSISOLATIN1STRINGENCODING but the problem is there's no equiva... | [
"objective-c",
"encryption",
"aes"
] | 4 | 3 | 504 | 1 | 0 | 2011-06-02T17:52:08.113000 | 2011-06-02T17:56:43.087000 |
6,218,258 | 6,218,603 | Xcode instruments - fixing leaks | I have several memory leaks when testing my IOS application in xcode instruments. Can anyone see why the lines marked with "-->" are leaking? --> CLLocationCoordinate2D newCoord = CLLocationCoordinate2DMake(latitude, longitude); --> MapAnnotation* annotation = [[MapAnnotation alloc] initWithCoordinate:newCoord]; [mapVi... | Your code is correct, as much as you show of it. One thing you have to keep in mind is that Leaks will show you the place where the leaked object is created, not the place where you do something wrong that will produce the leak. This is an important difference. Indeed, it could well be, in the first case, that is the v... | Xcode instruments - fixing leaks I have several memory leaks when testing my IOS application in xcode instruments. Can anyone see why the lines marked with "-->" are leaking? --> CLLocationCoordinate2D newCoord = CLLocationCoordinate2DMake(latitude, longitude); --> MapAnnotation* annotation = [[MapAnnotation alloc] ini... | TITLE:
Xcode instruments - fixing leaks
QUESTION:
I have several memory leaks when testing my IOS application in xcode instruments. Can anyone see why the lines marked with "-->" are leaking? --> CLLocationCoordinate2D newCoord = CLLocationCoordinate2DMake(latitude, longitude); --> MapAnnotation* annotation = [[MapAnn... | [
"xcode",
"ios",
"instruments",
"memory-leaks"
] | 0 | 2 | 633 | 1 | 0 | 2011-06-02T17:52:26.740000 | 2011-06-02T18:20:30.423000 |
6,218,261 | 6,239,063 | rake task in cron | I have a shell script ( /home/user/send_report.sh ) that runs my rake task: cd /home/user/rails/app /home/user/.rvm/gems/ruby-1.9.2-p136/bin/rake report:send When I run it in console sh /home/user/send_report.sh it works properly. I am trying to make a cron task with my script: */10 * * * * sh /home/user/send_report.sh... | Problem was that RVM single-user installation doesn't supports cron tasks. Installed RVM as multi-user and crontab worked properly. | rake task in cron I have a shell script ( /home/user/send_report.sh ) that runs my rake task: cd /home/user/rails/app /home/user/.rvm/gems/ruby-1.9.2-p136/bin/rake report:send When I run it in console sh /home/user/send_report.sh it works properly. I am trying to make a cron task with my script: */10 * * * * sh /home/u... | TITLE:
rake task in cron
QUESTION:
I have a shell script ( /home/user/send_report.sh ) that runs my rake task: cd /home/user/rails/app /home/user/.rvm/gems/ruby-1.9.2-p136/bin/rake report:send When I run it in console sh /home/user/send_report.sh it works properly. I am trying to make a cron task with my script: */10 ... | [
"ruby-on-rails-3",
"cron",
"rakefile"
] | 0 | 0 | 502 | 2 | 0 | 2011-06-02T17:52:31.923000 | 2011-06-04T20:00:34.750000 |
6,218,265 | 6,218,322 | Using a Model function in Controller | In my model named Profile_model I have this function which retrieves profile data for the logged in user. function profile_read() { $this->db->where('user_id', $this->tank_auth->get_user_id()); $query = $this->db->get('user_profiles'); $data['row'] = $query->row(); } In my controller I'm using $this->load->view('profil... | Time to read about variable scopes: http://php.net/manual/en/language.variables.scope.php The $data variable in the model method isn't accessible to the controller. Have the model method return an actual array of data.. eg: function profile_read() { $this->db->where('user_id', $this->tank_auth->get_user_id()); $query =... | Using a Model function in Controller In my model named Profile_model I have this function which retrieves profile data for the logged in user. function profile_read() { $this->db->where('user_id', $this->tank_auth->get_user_id()); $query = $this->db->get('user_profiles'); $data['row'] = $query->row(); } In my controlle... | TITLE:
Using a Model function in Controller
QUESTION:
In my model named Profile_model I have this function which retrieves profile data for the logged in user. function profile_read() { $this->db->where('user_id', $this->tank_auth->get_user_id()); $query = $this->db->get('user_profiles'); $data['row'] = $query->row();... | [
"php",
"mysql",
"codeigniter"
] | 0 | 3 | 130 | 1 | 0 | 2011-06-02T17:52:54.637000 | 2011-06-02T17:57:40.403000 |
6,218,268 | 6,218,355 | How to define a bash function for use in any script? | I'd like to define it once and use it anywhere. | While I basically agree with @eduffy, I typically put such functions in a file either in the user's home directory or if the scripts are shared between users in a directory in the user's path. I would then source the file (. ~/FILE or. $(type -p FILE)) in the.bash_profile. This allows you to 're-source' the file if nec... | How to define a bash function for use in any script? I'd like to define it once and use it anywhere. | TITLE:
How to define a bash function for use in any script?
QUESTION:
I'd like to define it once and use it anywhere.
ANSWER:
While I basically agree with @eduffy, I typically put such functions in a file either in the user's home directory or if the scripts are shared between users in a directory in the user's path.... | [
"bash",
"function",
"export"
] | 13 | 7 | 15,493 | 4 | 0 | 2011-06-02T17:53:03.887000 | 2011-06-02T18:00:50.507000 |
6,218,272 | 6,218,413 | The type or namespace name 'ManagementEventWatcher' not found | Why do I get The type or namespace name 'ManagementEventWatcher' not found in the following code: using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; using System.Management;
class Program { public ManagementEventWatcher mgmtWtch;
static v... | Have you added the reference as well as the using? eg using System.Management; is not enough.. you need to add the reference to System.Management too. | The type or namespace name 'ManagementEventWatcher' not found Why do I get The type or namespace name 'ManagementEventWatcher' not found in the following code: using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; using System.Management;
cla... | TITLE:
The type or namespace name 'ManagementEventWatcher' not found
QUESTION:
Why do I get The type or namespace name 'ManagementEventWatcher' not found in the following code: using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; using Syste... | [
"c#",
"managementeventwatcher"
] | 2 | 5 | 3,815 | 2 | 0 | 2011-06-02T17:53:18.603000 | 2011-06-02T18:04:46.507000 |
6,218,273 | 6,218,407 | Both if and else statements executing | I have this query in my sql if (select count(*) from sys.columns where object_id = (select object_id from sys.tables where name = 'CLIENT_STATUS')) = 4 insert into CLIENT_STATUS select 'NA', 'Inactive', 0, 0 --old version else insert into CLIENT_STATUS select 'NA', 'Inactive', 0, 0, 1 --new version The result of select... | You get the error when SQL Server compiles your statements. With this table create table TestTable(ID int) Try to run this statement if 1 = 1 insert into TestTable values (1) else insert into TestTable values(1, 2) Result: Msg 213, Level 16, State 1, Line 4 Column name or number of supplied values does not match table ... | Both if and else statements executing I have this query in my sql if (select count(*) from sys.columns where object_id = (select object_id from sys.tables where name = 'CLIENT_STATUS')) = 4 insert into CLIENT_STATUS select 'NA', 'Inactive', 0, 0 --old version else insert into CLIENT_STATUS select 'NA', 'Inactive', 0, 0... | TITLE:
Both if and else statements executing
QUESTION:
I have this query in my sql if (select count(*) from sys.columns where object_id = (select object_id from sys.tables where name = 'CLIENT_STATUS')) = 4 insert into CLIENT_STATUS select 'NA', 'Inactive', 0, 0 --old version else insert into CLIENT_STATUS select 'NA'... | [
"sql",
"sql-server-2005"
] | 4 | 6 | 2,423 | 3 | 0 | 2011-06-02T17:53:19.047000 | 2011-06-02T18:04:29.570000 |
6,218,292 | 6,218,416 | UITextField always resignFirstResponder | I am using a UIPickerView and I want my keyboard to never show up for some of my UITextFields. When I call resignFirstResponder on the UITextField after it is touched it doesn't make the keyboard go down. - (IBAction) txtFieldClicked:(id)sender { [txtField resignFirstResponder]; } | Set text field delegate and implement its delegate methods See UItextFieldDelegate If you dont want the keyboard to pop up, return NO for all those text fields here - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { if([textField isEqualTo:self.myTextField]) { return NO; } return YES; } | UITextField always resignFirstResponder I am using a UIPickerView and I want my keyboard to never show up for some of my UITextFields. When I call resignFirstResponder on the UITextField after it is touched it doesn't make the keyboard go down. - (IBAction) txtFieldClicked:(id)sender { [txtField resignFirstResponder]; ... | TITLE:
UITextField always resignFirstResponder
QUESTION:
I am using a UIPickerView and I want my keyboard to never show up for some of my UITextFields. When I call resignFirstResponder on the UITextField after it is touched it doesn't make the keyboard go down. - (IBAction) txtFieldClicked:(id)sender { [txtField resig... | [
"iphone",
"objective-c",
"uitextfield"
] | 1 | 1 | 232 | 2 | 0 | 2011-06-02T17:55:21.580000 | 2011-06-02T18:04:58.793000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.