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,214,240
6,214,284
Is retainCount giving me the correct information for my NSDate?
I have NSDate property In.h... @interface MyAppDelegate: NSObject {... NSDate *pageStartDate;... }... @property (nonatomic, retain) NSDate *pageStartDate;... In.m... -(void)myMethod {... // set date of start showing page NSDate *tempStartDate = [NSDate date]; [tempStartDate retain]; pageStartDate = tempStartDate; [temp...
The problem isn't just your NSDate its because you've used retainCount Annotation: NSDate *tempStartDate = [NSDate date]; // No alloc, retain, copy, or mutableCopy - so assume autoreleased instance [tempStartDate retain]; // You call retain - you own this now pageStartDate = tempStartDate; // Not going through the sett...
Is retainCount giving me the correct information for my NSDate? I have NSDate property In.h... @interface MyAppDelegate: NSObject {... NSDate *pageStartDate;... }... @property (nonatomic, retain) NSDate *pageStartDate;... In.m... -(void)myMethod {... // set date of start showing page NSDate *tempStartDate = [NSDate dat...
TITLE: Is retainCount giving me the correct information for my NSDate? QUESTION: I have NSDate property In.h... @interface MyAppDelegate: NSObject {... NSDate *pageStartDate;... }... @property (nonatomic, retain) NSDate *pageStartDate;... In.m... -(void)myMethod {... // set date of start showing page NSDate *tempStart...
[ "ios", "memory", "properties", "nsdate", "retaincount" ]
0
0
304
2
0
2011-06-02T12:01:30.410000
2011-06-02T12:05:37.807000
6,214,248
6,214,545
Adding a JComponent on top of full-screen-graphics
I have a fullscreen program, which draws a lot of things for the game I am making. The canvas is the entire window, which it should be. Now I want to add a button, or textfield (JButton and JTextField etc...) to my window. However, when I add a button, or anything else, they go begind the canvas. Do you have any idea h...
It is difficult to tell much from the code snippet (please consider posting an SSCCE in future), but: Don't code AWT in this millennium. Don't mix Swing with AWT (at least until Java 7) Don't load images within the draw() method (which is presumably called from the paintComponent() method). Note that custom painting in...
Adding a JComponent on top of full-screen-graphics I have a fullscreen program, which draws a lot of things for the game I am making. The canvas is the entire window, which it should be. Now I want to add a button, or textfield (JButton and JTextField etc...) to my window. However, when I add a button, or anything else...
TITLE: Adding a JComponent on top of full-screen-graphics QUESTION: I have a fullscreen program, which draws a lot of things for the game I am making. The canvas is the entire window, which it should be. Now I want to add a button, or textfield (JButton and JTextField etc...) to my window. However, when I add a button...
[ "java", "swing", "button", "canvas" ]
3
2
466
2
0
2011-06-02T12:02:35.297000
2011-06-02T12:32:52.943000
6,214,266
6,218,051
Ordering lists with constraint logic programming
I was wondering if anyone could help me with this problem: I have to order a list using Prolog with Constraing Logic Programming and I must do it with the more efficient way I can. So the main predicate I have defined is the next one: order(Xs,Ys):- same_length(Xs,Ys), /* To determine the list Ys with the Xs' length */...
Your definition of same_length/2 will not terminate very often. Instead, consider same_length([],[]). same_length([_|Xs], [_|Ys]):- same_length(Xs, Ys). equally, using library(lambda) use... maplist(\_^_^true,Xs, Ys),... in place of... same_length(Xs, Ys),... It seems you want to reformulate sorting by stating first, t...
Ordering lists with constraint logic programming I was wondering if anyone could help me with this problem: I have to order a list using Prolog with Constraing Logic Programming and I must do it with the more efficient way I can. So the main predicate I have defined is the next one: order(Xs,Ys):- same_length(Xs,Ys), /...
TITLE: Ordering lists with constraint logic programming QUESTION: I was wondering if anyone could help me with this problem: I have to order a list using Prolog with Constraing Logic Programming and I must do it with the more efficient way I can. So the main predicate I have defined is the next one: order(Xs,Ys):- sam...
[ "list", "prolog", "constraint-programming" ]
11
11
1,574
3
0
2011-06-02T12:04:26.090000
2011-06-02T17:34:41.460000
6,214,288
6,214,999
MVVM pattern basics
A very common scenario. We have: double _H; public double H { get { return _H; } set { if (_H == value) return; _H = value; SomeMethod("H"); //Inside SomeMethod's body we calculate some other properties among other things, //and we call their corresponding base.RaisePropertyChanged. ALSO we //RECALCULATE the freshly se...
You need to use the Dispatcher to either force a refresh or to raise the property change notification outside of the context of the setter (asynchronous invocation). So, instead of base.OnPropertyChanged("H"); …you'd do Action action = () => base.OnPropertyChanged("H"); Dispatcher.CurrentDispatcher.BeginInvoke(action);
MVVM pattern basics A very common scenario. We have: double _H; public double H { get { return _H; } set { if (_H == value) return; _H = value; SomeMethod("H"); //Inside SomeMethod's body we calculate some other properties among other things, //and we call their corresponding base.RaisePropertyChanged. ALSO we //RECALC...
TITLE: MVVM pattern basics QUESTION: A very common scenario. We have: double _H; public double H { get { return _H; } set { if (_H == value) return; _H = value; SomeMethod("H"); //Inside SomeMethod's body we calculate some other properties among other things, //and we call their corresponding base.RaisePropertyChanged...
[ ".net", "wpf", "mvvm" ]
1
4
466
1
0
2011-06-02T12:05:51.303000
2011-06-02T13:15:26.033000
6,214,301
6,225,154
WCF Service Still Callable When Windows Service Has Been Stopped
I have written a windows service in C#.NET. This windows service contains a WCF service. I then use a new ServiceHost in the OnStart of the windows service to listen for messages for the WCF service. And close this ServiceHost in the OnStop. When the service is running I can call the WCF service just fine. However, I t...
I have now solved this and thought I would update with the answer. Although I doubt anyone else would be so stupid;) I had added the reference to my client app by right clicking on the project and selecting "Add Reference" rather than "Add Service Reference". I am still not sure why this allows the service to be called...
WCF Service Still Callable When Windows Service Has Been Stopped I have written a windows service in C#.NET. This windows service contains a WCF service. I then use a new ServiceHost in the OnStart of the windows service to listen for messages for the WCF service. And close this ServiceHost in the OnStop. When the serv...
TITLE: WCF Service Still Callable When Windows Service Has Been Stopped QUESTION: I have written a windows service in C#.NET. This windows service contains a WCF service. I then use a new ServiceHost in the OnStart of the windows service to listen for messages for the WCF service. And close this ServiceHost in the OnS...
[ "c#", ".net", "wcf", "service" ]
0
0
1,087
2
0
2011-06-02T12:07:05.187000
2011-06-03T09:14:00.680000
6,214,304
6,214,340
jquery-ui retrieving selected in a buttonset (checkbox) - firefox issue
It's possible to retrieve the 'selected' buttons in a jquery ui buttonset build with checkboxes (to allow multiselect) with: $('#format').buttonset(); $('#format').click(function() { var text = ""; $('#format').find('label[aria-pressed|="true"]').each(function() { text += $(this).attr("for") + "-"; }); $('#selected')....
Try: $('label.ui-state-active') See my updated jsFiddle http://jsfiddle.net/qLWNd/
jquery-ui retrieving selected in a buttonset (checkbox) - firefox issue It's possible to retrieve the 'selected' buttons in a jquery ui buttonset build with checkboxes (to allow multiselect) with: $('#format').buttonset(); $('#format').click(function() { var text = ""; $('#format').find('label[aria-pressed|="true"]')....
TITLE: jquery-ui retrieving selected in a buttonset (checkbox) - firefox issue QUESTION: It's possible to retrieve the 'selected' buttons in a jquery ui buttonset build with checkboxes (to allow multiselect) with: $('#format').buttonset(); $('#format').click(function() { var text = ""; $('#format').find('label[aria-p...
[ "javascript", "jquery", "jquery-ui", "firefox" ]
4
4
2,661
3
0
2011-06-02T12:07:19.880000
2011-06-02T12:11:35.200000
6,214,305
6,214,648
Persist selected item on ASP.Net custom control
I have built the following custom control that I have built and I set the selected value when a bullet list item is clicked. My problem is that I need to set the css class (SetSelected()) after postback, but it always picks up the previous entry in the viewstate rather than picking up the new value. I don't think I sho...
Add following code: protected override void CreateChildControls() { Controls.Clear(); CreateBulletedList(); } public override ControlCollection Controls { get { EnsureChildControls(); return base.Controls; } } protected override void OnInit(EventArgs e) { base.OnInit(e); EnsureChildControls(); } Change the SetSelecte...
Persist selected item on ASP.Net custom control I have built the following custom control that I have built and I set the selected value when a bullet list item is clicked. My problem is that I need to set the css class (SetSelected()) after postback, but it always picks up the previous entry in the viewstate rather th...
TITLE: Persist selected item on ASP.Net custom control QUESTION: I have built the following custom control that I have built and I set the selected value when a bullet list item is clicked. My problem is that I need to set the css class (SetSelected()) after postback, but it always picks up the previous entry in the v...
[ "asp.net", "webforms", "custom-controls" ]
0
1
527
1
0
2011-06-02T12:07:20.487000
2011-06-02T12:42:40.890000
6,214,317
6,215,783
How to share same Visual Studio project between different solutions? Different app.config and setttings.settings
The title doesn't entirely describe the actual question, since I was trying to fit a succinct enough description into a one-liner. I have a C# project I want to share between two different solutions (.sln). The project is an application with a Main method. It requires use of settings.settings and app.config. Each of th...
The project I want to share is actually shared between two different source control locations. I want to share the same project (i.e. C) between a SVN server solution and a TFS server solution. One solution I came up with which works (for more than one shared project, too) is to link the app.config in from a directory/...
How to share same Visual Studio project between different solutions? Different app.config and setttings.settings The title doesn't entirely describe the actual question, since I was trying to fit a succinct enough description into a one-liner. I have a C# project I want to share between two different solutions (.sln). ...
TITLE: How to share same Visual Studio project between different solutions? Different app.config and setttings.settings QUESTION: The title doesn't entirely describe the actual question, since I was trying to fit a succinct enough description into a one-liner. I have a C# project I want to share between two different ...
[ "c#", "visual-studio-2010", "settings", "t4" ]
5
2
2,109
2
0
2011-06-02T12:08:12.800000
2011-06-02T14:19:57.183000
6,214,319
6,214,335
How do I find indexes that have statistics_norecompute = ON
I'm looking for a SQL Server 2005 query that will list all the indexes and with their respective STATISTICS_NORECOMPUTE value. I didn't see any obvious value in sysindexes that corresponds to that value.
The column is no_recompute in sys.stats which says Every index will have a corresponding statistics row with the same name and ID (sys.indexes.object_id = sys.stats.object_id AND sys.indexes.index_id = sys.stats.stats_id), but not every statistics row has a corresponding index. So a JOIN between sys.indexes and sys.sta...
How do I find indexes that have statistics_norecompute = ON I'm looking for a SQL Server 2005 query that will list all the indexes and with their respective STATISTICS_NORECOMPUTE value. I didn't see any obvious value in sysindexes that corresponds to that value.
TITLE: How do I find indexes that have statistics_norecompute = ON QUESTION: I'm looking for a SQL Server 2005 query that will list all the indexes and with their respective STATISTICS_NORECOMPUTE value. I didn't see any obvious value in sysindexes that corresponds to that value. ANSWER: The column is no_recompute in...
[ "sql-server-2005" ]
8
9
4,674
3
0
2011-06-02T12:08:20.393000
2011-06-02T12:10:41.193000
6,214,321
6,214,345
PHP variable in Javascript
Consider this simple example; This works fine. Creating the alert with the text from the php var. However, if I place; below the script - it does not work. I've tried the defer function. What am I doing wrong? Cheers
If you place below the JS code, the the variable $text is not defined yet, so you cannot echo it earlier ( edit ) in the script.
PHP variable in Javascript Consider this simple example; This works fine. Creating the alert with the text from the php var. However, if I place; below the script - it does not work. I've tried the defer function. What am I doing wrong? Cheers
TITLE: PHP variable in Javascript QUESTION: Consider this simple example; This works fine. Creating the alert with the text from the php var. However, if I place; below the script - it does not work. I've tried the defer function. What am I doing wrong? Cheers ANSWER: If you place below the JS code, the the variable ...
[ "php", "javascript" ]
1
6
275
3
0
2011-06-02T12:08:38.527000
2011-06-02T12:12:11.843000
6,214,326
6,246,060
Translate Keys to char
I want to translate a given set of System.Windows.Forms.Keys and a System.Windows.Forms.InputLanguage to the corresponding System.Char. Tried some experiments with MapVirtualKeyEx, but there is now way to consider keyboard state, and ToUnicodeEx is a pain with dead keys. My goal is a function... static char? FromKeys(K...
Here is a piece of code that seems to do what you're looking for - if I understood it correctly:-) public static char? FromKeys(Keys keys, InputLanguage inputLanguage) { return FromKeys(keys, inputLanguage, true); } private static char? FromKeys(Keys keys, InputLanguage inputLanguage, bool firstChance) { if (inputLang...
Translate Keys to char I want to translate a given set of System.Windows.Forms.Keys and a System.Windows.Forms.InputLanguage to the corresponding System.Char. Tried some experiments with MapVirtualKeyEx, but there is now way to consider keyboard state, and ToUnicodeEx is a pain with dead keys. My goal is a function... ...
TITLE: Translate Keys to char QUESTION: I want to translate a given set of System.Windows.Forms.Keys and a System.Windows.Forms.InputLanguage to the corresponding System.Char. Tried some experiments with MapVirtualKeyEx, but there is now way to consider keyboard state, and ToUnicodeEx is a pain with dead keys. My goal...
[ ".net", "winforms", "keycode" ]
1
5
2,962
2
0
2011-06-02T12:09:31.017000
2011-06-05T21:43:25.077000
6,214,327
6,214,391
Using jQuery to post back to a controller
I'm using jQuery to post back to my controller, but i'm wondering how you pass values as parameters in the ActionResult. For example: I have a jQuery post: $.post("Home\PostExample") but i would like to include a value from a dropdown menu: @Html.DropDownListFor(m => m.Example, Model.Example, new { @id = "exampleCssId"...
I think this should work: $.post("Home/PostExample", { myString: $("#exampleCssId").val() } );
Using jQuery to post back to a controller I'm using jQuery to post back to my controller, but i'm wondering how you pass values as parameters in the ActionResult. For example: I have a jQuery post: $.post("Home\PostExample") but i would like to include a value from a dropdown menu: @Html.DropDownListFor(m => m.Example,...
TITLE: Using jQuery to post back to a controller QUESTION: I'm using jQuery to post back to my controller, but i'm wondering how you pass values as parameters in the ActionResult. For example: I have a jQuery post: $.post("Home\PostExample") but i would like to include a value from a dropdown menu: @Html.DropDownListF...
[ "c#", "javascript", "jquery", "asp.net-mvc-3", "postback" ]
0
4
4,892
3
0
2011-06-02T12:09:38.210000
2011-06-02T12:17:50.707000
6,214,329
6,214,676
Does implementing the MVP Pattern on webforms app make it easier to transition to MVC?
Since the MVP pattern allows more testability and some reuse in webforms apps, i thought it would be a good first step to moving to MVC for legacy(webforms with code in codebehind, no pattern). As I refresh myself with MVP internals, it doesn't seem so. Anyone have experience using this approach. Would it be better to ...
Proper separation of concerns should make the transition easier if needed. MVC framework is suitable only for web applications, while MVP can be more universal and can work for Web forms and Windows forms - views implement interfaces for presenters to use and views themselves handle implementation details pertaining to...
Does implementing the MVP Pattern on webforms app make it easier to transition to MVC? Since the MVP pattern allows more testability and some reuse in webforms apps, i thought it would be a good first step to moving to MVC for legacy(webforms with code in codebehind, no pattern). As I refresh myself with MVP internals,...
TITLE: Does implementing the MVP Pattern on webforms app make it easier to transition to MVC? QUESTION: Since the MVP pattern allows more testability and some reuse in webforms apps, i thought it would be a good first step to moving to MVC for legacy(webforms with code in codebehind, no pattern). As I refresh myself w...
[ "asp.net-mvc", "webforms", "mvp" ]
2
2
603
2
0
2011-06-02T12:09:53.153000
2011-06-02T12:45:05.450000
6,214,330
6,214,416
Taking data out of JSONP
Using the url: http://www.remote_host.com/feed.php?callback=jsonpCallback I get back: jsonpCallback({ "rss": { "channels": [ { "title": "title goes here", "link": "http://www.remote_server.com/feed.php", "description": "description goes here", "items": [ { "title": "item title goes here", "link": "item link goes here",...
You can reach the values in jsonp like this: html = "channel title: "+jsonp.rss.channels[0].title+" "; for (x in jsonp.rss.channels[0].items) { html += "item title: "+jsonp.rss.channels[0].items[x].title+" "; html += "item link: "+jsonp.rss.channels[0].items[x].link+" "; html += "item date: "+jsonp.rss.channels[0].item...
Taking data out of JSONP Using the url: http://www.remote_host.com/feed.php?callback=jsonpCallback I get back: jsonpCallback({ "rss": { "channels": [ { "title": "title goes here", "link": "http://www.remote_server.com/feed.php", "description": "description goes here", "items": [ { "title": "item title goes here", "link...
TITLE: Taking data out of JSONP QUESTION: Using the url: http://www.remote_host.com/feed.php?callback=jsonpCallback I get back: jsonpCallback({ "rss": { "channels": [ { "title": "title goes here", "link": "http://www.remote_server.com/feed.php", "description": "description goes here", "items": [ { "title": "item title...
[ "ajax", "jquery", "jsonp" ]
1
2
338
4
0
2011-06-02T12:10:02.657000
2011-06-02T12:19:43.313000
6,214,334
6,215,084
Gracefully stopping an std::thread?
I have a worker std::thread and I want its main loop to check if some other thread tells it to stop looping and exit. What is a good cross platform way to do this? Does boost provide some event object for it? Is using just a bool considered thread-safe?
.. well it depends. What is the thread doing? Does it block on anything, I/O, sleep, or some other API? If it's just CPU-looping all the time and it does not matter about exactly when it stops and it stops and exits, then just use a boolean. There's no point, in this case, in locking up a 'stopAndExit' boolean. If the ...
Gracefully stopping an std::thread? I have a worker std::thread and I want its main loop to check if some other thread tells it to stop looping and exit. What is a good cross platform way to do this? Does boost provide some event object for it? Is using just a bool considered thread-safe?
TITLE: Gracefully stopping an std::thread? QUESTION: I have a worker std::thread and I want its main loop to check if some other thread tells it to stop looping and exit. What is a good cross platform way to do this? Does boost provide some event object for it? Is using just a bool considered thread-safe? ANSWER: .. ...
[ "c++", "multithreading" ]
9
6
13,536
4
0
2011-06-02T12:10:28.587000
2011-06-02T13:21:43.047000
6,214,339
6,214,618
Use variable as entity table name
Is there a way to dynmaically define the table name so I do not have to do multiple calls if the table I'm accessing is different for different conditions? I don't want to have an if/else for every table I am accessing if I can use a variable name instead. using (Entity ctx = new Entity()) { dbTableVal = "EntityTables"...
I guess no, because the table itself also defines the type of returned IQueryable. It is even not possible with ESQL (which has string syntax) to define generic query where you don't know the type of result set.
Use variable as entity table name Is there a way to dynmaically define the table name so I do not have to do multiple calls if the table I'm accessing is different for different conditions? I don't want to have an if/else for every table I am accessing if I can use a variable name instead. using (Entity ctx = new Entit...
TITLE: Use variable as entity table name QUESTION: Is there a way to dynmaically define the table name so I do not have to do multiple calls if the table I'm accessing is different for different conditions? I don't want to have an if/else for every table I am accessing if I can use a variable name instead. using (Enti...
[ "c#", "sql", "entity-framework" ]
2
1
2,319
3
0
2011-06-02T12:11:29.540000
2011-06-02T12:39:48.270000
6,214,350
6,216,759
Is Azure role local storage guaranteed to be inaccessible to an application that is next to use the same host?
Suppose my Azure role stores files to the role local filesystem and forgets to delete them. Can another application that uses that host in future possibly get access to those files? I've read the whitepaper and it's full of marketing style statements but I can't find a definitive statement about how thoroughly the host...
No, it cannot be used by another VM, even accidentally. The 'scratch' drive that is mounted by your Windows Azure instance is another VHD - data is not written natively to disk. So, in order for another instance to read your data, it would have to mount your VHD, which is not possible.
Is Azure role local storage guaranteed to be inaccessible to an application that is next to use the same host? Suppose my Azure role stores files to the role local filesystem and forgets to delete them. Can another application that uses that host in future possibly get access to those files? I've read the whitepaper an...
TITLE: Is Azure role local storage guaranteed to be inaccessible to an application that is next to use the same host? QUESTION: Suppose my Azure role stores files to the role local filesystem and forgets to delete them. Can another application that uses that host in future possibly get access to those files? I've read...
[ "windows", "security", "azure", "cloud" ]
3
4
283
3
0
2011-06-02T12:12:55.137000
2011-06-02T15:35:52.230000
6,214,357
6,214,726
What is the correct way to fill Model for UserControl?
The question is not about MVC but more about code architecture. I have a partial view that takes a CompanyModel <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl " %> <%: Html.TextAreaFor(m => m.Name) %> <%: Html.TextAreaFor(m => m.Location) %> CompanyModel public class CompanyModel { [LocalizedDispla...
Ok, following the question update, here's my updated answer:) I'm assuming the different Views LoadController populates take different types of ViewModel, and each ViewModel is populated from a different part of the domain model. Here's how I'd tackle that: Firstly, create each partial View as a strongly-typed subclass...
What is the correct way to fill Model for UserControl? The question is not about MVC but more about code architecture. I have a partial view that takes a CompanyModel <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl " %> <%: Html.TextAreaFor(m => m.Name) %> <%: Html.TextAreaFor(m => m.Location) %> Co...
TITLE: What is the correct way to fill Model for UserControl? QUESTION: The question is not about MVC but more about code architecture. I have a partial view that takes a CompanyModel <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl " %> <%: Html.TextAreaFor(m => m.Name) %> <%: Html.TextAreaFor(m =>...
[ "c#", "model-view-controller", "architecture", "s#arp-architecture" ]
3
2
201
2
0
2011-06-02T12:14:17.633000
2011-06-02T12:50:52.667000
6,214,358
6,214,994
Remove Current Item from List if some criteria matches
I am trying to remove my current item in for each loop if some criterai matches but its triggering error after removing and looping again. My sample code: For Each Item As BookingRoom In myBookedRooms If Item.RoomInfo.UIN = myRoom.UIN Then myBookedRooms.Remove(Item) Continue For End If Next * Note RoomInfo and myRoom a...
The problem is you're modifying the collection while iterating over it. You can iterate the list in reverse with a for loop: For i = myBookedRooms.Count - 1 To 0 Step -1 If myBookedRooms(i).RoomInfo.UIN = myRoom.UIN Then myBookedRooms.RemoveAt(i) End If Next Alternately, you can use the RemoveAll method: myBookedRooms....
Remove Current Item from List if some criteria matches I am trying to remove my current item in for each loop if some criterai matches but its triggering error after removing and looping again. My sample code: For Each Item As BookingRoom In myBookedRooms If Item.RoomInfo.UIN = myRoom.UIN Then myBookedRooms.Remove(Item...
TITLE: Remove Current Item from List if some criteria matches QUESTION: I am trying to remove my current item in for each loop if some criterai matches but its triggering error after removing and looping again. My sample code: For Each Item As BookingRoom In myBookedRooms If Item.RoomInfo.UIN = myRoom.UIN Then myBooke...
[ "vb.net", "list" ]
5
9
15,610
1
0
2011-06-02T12:14:18.367000
2011-06-02T13:15:14.530000
6,214,360
6,214,789
Creating a new Orchard site
I am currently configuring a new Orchard site. I'd like to point the connectionstring to our development SQL database, but there is no option to do this. Well, I say that, but I don't have an Orchard database in the first place to populate on the development server. How do I create the Orchard database in the first pla...
I have managed to figure this out. I had to create an empty database and assign a user to that database. Then, using the Orchard Setup, I was able to point the connection string to the new development database and this created all of the necessary tables.
Creating a new Orchard site I am currently configuring a new Orchard site. I'd like to point the connectionstring to our development SQL database, but there is no option to do this. Well, I say that, but I don't have an Orchard database in the first place to populate on the development server. How do I create the Orcha...
TITLE: Creating a new Orchard site QUESTION: I am currently configuring a new Orchard site. I'd like to point the connectionstring to our development SQL database, but there is no option to do this. Well, I say that, but I don't have an Orchard database in the first place to populate on the development server. How do ...
[ "asp.net", "sql-server", "asp.net-mvc", "orchardcms" ]
2
3
856
2
0
2011-06-02T12:14:40.473000
2011-06-02T12:56:32.373000
6,214,375
6,214,478
CoreLocation singleton delegate methods used by multiple views
I've implemented a singleton CoreLocation class (courtesy of this link: http://jinru.wordpress.com/2010/08/15/singletons-in-objective-c-an-example-of-cllocationmanager/ ) However, I need two different ViewControllers to access the delegate method "newLocation". One viewController manages identification of locations. An...
I would go with posting notifications with NSNotificationCenter.
CoreLocation singleton delegate methods used by multiple views I've implemented a singleton CoreLocation class (courtesy of this link: http://jinru.wordpress.com/2010/08/15/singletons-in-objective-c-an-example-of-cllocationmanager/ ) However, I need two different ViewControllers to access the delegate method "newLocati...
TITLE: CoreLocation singleton delegate methods used by multiple views QUESTION: I've implemented a singleton CoreLocation class (courtesy of this link: http://jinru.wordpress.com/2010/08/15/singletons-in-objective-c-an-example-of-cllocationmanager/ ) However, I need two different ViewControllers to access the delegate...
[ "objective-c", "ios", "singleton", "notifications", "core-location" ]
0
2
882
1
0
2011-06-02T12:16:01.803000
2011-06-02T12:26:36.153000
6,214,377
6,216,461
fisheye distortion
I've found the code below written in java that places a fisheye effect on a buffered image. Is it possible to use this code on a different image format eg jpeg or bitmap? I've tried replacing the bufferedImage with bitmap and instead of using set/getARGB i've replaced with bitmap's get/setPixel. i just get a black bitm...
The short answer is "yes, it is possible". It will take some time for you to translate the BufferedImage methods to the Bitmap methods but there are plenty of good references online that will be able to help you out.
fisheye distortion I've found the code below written in java that places a fisheye effect on a buffered image. Is it possible to use this code on a different image format eg jpeg or bitmap? I've tried replacing the bufferedImage with bitmap and instead of using set/getARGB i've replaced with bitmap's get/setPixel. i ju...
TITLE: fisheye distortion QUESTION: I've found the code below written in java that places a fisheye effect on a buffered image. Is it possible to use this code on a different image format eg jpeg or bitmap? I've tried replacing the bufferedImage with bitmap and instead of using set/getARGB i've replaced with bitmap's ...
[ "android", "image-processing", "bitmap", "fisheye" ]
2
1
4,024
2
0
2011-06-02T12:16:07.743000
2011-06-02T15:11:55.867000
6,214,378
6,218,072
Validating a Number for long
I have generated actionscript (AS3) beans from the Serverside(java). Now some of the classes had (Long,long,double) which I had to convert into Number on the Actionscript side (as we dont have long,double etc ) on AS3 side. Now I have to validate Number on AS3 side to match type on Serverside. Let take example I have a...
I would hard code the ceiling for a 'long' and then compare against that when sending a value to the server. Like so: var floatCeiling:Number = Math.pow(2, 63) - 1; var testValue:Number = 1000000000000000000000000; if(testValue >= floatCeiling) { //tell the server to cast this value to 'double' when it gets it } else...
Validating a Number for long I have generated actionscript (AS3) beans from the Serverside(java). Now some of the classes had (Long,long,double) which I had to convert into Number on the Actionscript side (as we dont have long,double etc ) on AS3 side. Now I have to validate Number on AS3 side to match type on Serversi...
TITLE: Validating a Number for long QUESTION: I have generated actionscript (AS3) beans from the Serverside(java). Now some of the classes had (Long,long,double) which I had to convert into Number on the Actionscript side (as we dont have long,double etc ) on AS3 side. Now I have to validate Number on AS3 side to matc...
[ "actionscript", "numbers" ]
0
2
310
1
0
2011-06-02T12:16:09.053000
2011-06-02T17:35:47.447000
6,214,380
6,214,774
Do I need to restructure my Backbone models/collections? Unsure how to save all at once
My application revolves around people. I have a Person model where you can set the name, age, and other traits. On the same page I have a Collection of Interest models that can be added for the person. I need to pass a JSON representation of the Person and their Interests to the server. But I do not know how to bring t...
First, it sounds like Person should have a collection of Interest models. You should be able to see an example of this on the backbone.js documentation page -- see the Mailbox example. Link here: http://documentcloud.github.com/backbone/#FAQ-nested However, if you are trying to have one single call to update your Perso...
Do I need to restructure my Backbone models/collections? Unsure how to save all at once My application revolves around people. I have a Person model where you can set the name, age, and other traits. On the same page I have a Collection of Interest models that can be added for the person. I need to pass a JSON represen...
TITLE: Do I need to restructure my Backbone models/collections? Unsure how to save all at once QUESTION: My application revolves around people. I have a Person model where you can set the name, age, and other traits. On the same page I have a Collection of Interest models that can be added for the person. I need to pa...
[ "javascript", "backbone.js" ]
0
1
327
1
0
2011-06-02T12:16:24.780000
2011-06-02T12:55:08.580000
6,214,386
6,214,567
How to access drawable from non activity class
I am in a situation where I have to use the drawable folder of my app form a non activity class. I tried using the parent activity with the following code: ParentActivity pa = new ParentActivity(); Drawable d = pa.getResources()..getDrawable(R.drawable.icon);` But this returns me a NulLPointerException. How can I achie...
Pass the context object as a parameter to the constructor of the non Activity class. Then use that context object to get the Resources. Example public class MyClass { Context context; public MyClass(Context context) { this.context = context; } public void urMethod() { Drawable drawable=context.getResources().getDrawab...
How to access drawable from non activity class I am in a situation where I have to use the drawable folder of my app form a non activity class. I tried using the parent activity with the following code: ParentActivity pa = new ParentActivity(); Drawable d = pa.getResources()..getDrawable(R.drawable.icon);` But this ret...
TITLE: How to access drawable from non activity class QUESTION: I am in a situation where I have to use the drawable folder of my app form a non activity class. I tried using the parent activity with the following code: ParentActivity pa = new ParentActivity(); Drawable d = pa.getResources()..getDrawable(R.drawable.ic...
[ "android", "drawable" ]
8
15
15,878
2
0
2011-06-02T12:17:39.847000
2011-06-02T12:35:15.660000
6,214,388
6,214,784
Fastest way to extract a substring in C#
I'm going to process thousands of strings (with the size of ~150kB on average). Each of them contains zero or more substrings of the following form: Fixed_String I would like to extract all such links and put them into a list. Additionally, there is another fixed string after which the strings I am looking for will not...
The SubString() Option As noted by Teoman Soygul, there is a SubString() Option, which I don't know if it is slower or faster as I did not test them side by side. Now, this is not properly disected into sub methods but should give you the general idea. I just use a ReadOnlyCollection cause it is what I'm used to when n...
Fastest way to extract a substring in C# I'm going to process thousands of strings (with the size of ~150kB on average). Each of them contains zero or more substrings of the following form: Fixed_String I would like to extract all such links and put them into a list. Additionally, there is another fixed string after wh...
TITLE: Fastest way to extract a substring in C# QUESTION: I'm going to process thousands of strings (with the size of ~150kB on average). Each of them contains zero or more substrings of the following form: Fixed_String I would like to extract all such links and put them into a list. Additionally, there is another fix...
[ "c#", "regex", "string" ]
1
3
6,066
6
0
2011-06-02T12:17:44.373000
2011-06-02T12:55:54.090000
6,214,389
6,214,485
What do these Spring debug messages mean?
I use Spring IoC in my stand-alone Java application. When the application starts it creates a log with start-up info. Some messages I don't understand, please help me to understand them and explain how to fix them if they must be fixed? Also I am curious: Is there any danger for my application stability because of thes...
This is just debug level output which you probably don't need. Essentially it's telling you that you haven't defined any particular classes which override its default functionality, so it's going to use the default functionality. There's nothing to worry about here.
What do these Spring debug messages mean? I use Spring IoC in my stand-alone Java application. When the application starts it creates a log with start-up info. Some messages I don't understand, please help me to understand them and explain how to fix them if they must be fixed? Also I am curious: Is there any danger fo...
TITLE: What do these Spring debug messages mean? QUESTION: I use Spring IoC in my stand-alone Java application. When the application starts it creates a log with start-up info. Some messages I don't understand, please help me to understand them and explain how to fix them if they must be fixed? Also I am curious: Is t...
[ "spring", "message", "spring-jdbc" ]
8
15
14,702
2
0
2011-06-02T12:17:45.167000
2011-06-02T12:27:08.580000
6,214,396
6,214,496
C# binary data conversion to string
Here is the deal. I found a source code and changed it a little bit so i can retrieve data from a receiver that is on com6. The data i am receiving is binary. What i want is to convert it to a string so i can cut parts of the string and decode them seperately. how can i dot his? The source code is beneath. using System...
Data from ports will always come in binary(bytes), therefore it depends on how to interpret the data. Assuming that the bytes are ASCII, you can encode it to a string as follows: byte[] binaryData; // assuming binaryData contains the bytes from the port. string ascii = Encoding.ASCII.GetString(binaryData);
C# binary data conversion to string Here is the deal. I found a source code and changed it a little bit so i can retrieve data from a receiver that is on com6. The data i am receiving is binary. What i want is to convert it to a string so i can cut parts of the string and decode them seperately. how can i dot his? The ...
TITLE: C# binary data conversion to string QUESTION: Here is the deal. I found a source code and changed it a little bit so i can retrieve data from a receiver that is on com6. The data i am receiving is binary. What i want is to convert it to a string so i can cut parts of the string and decode them seperately. how c...
[ "c#", "string", "binary" ]
0
10
20,692
2
0
2011-06-02T12:18:19.397000
2011-06-02T12:28:30.580000
6,214,408
6,214,453
Iphone - Assigning properties and instance variables
Well, i am still confused about objective c properties and instance variables. I create a LocationManager-object in my viewDidLoad. On the one hand the LocationMan is just an instance variable on the other hand it is declared as a property. Have a look at the examples: First example: Header: CLLocationManager* _locatio...
The problem you have in your first example: CLLocationManager* theManager = [[[CLLocationManager alloc] init] autorelease]; is caused by the use of autorelease. autorelease can be seen as meaning: at some point in the near future, release automatically this object. Given the way autorelease is implemented, by means of ...
Iphone - Assigning properties and instance variables Well, i am still confused about objective c properties and instance variables. I create a LocationManager-object in my viewDidLoad. On the one hand the LocationMan is just an instance variable on the other hand it is declared as a property. Have a look at the example...
TITLE: Iphone - Assigning properties and instance variables QUESTION: Well, i am still confused about objective c properties and instance variables. I create a LocationManager-object in my viewDidLoad. On the one hand the LocationMan is just an instance variable on the other hand it is declared as a property. Have a l...
[ "iphone", "memory", "properties", "instance-variables" ]
0
3
170
3
0
2011-06-02T12:19:14.247000
2011-06-02T12:23:56.193000
6,214,413
6,214,915
WebSphere Portal 6.1 theme localization
How can a theme for a portal be localized? Suppose I wanted some text in IBM\WebSphere\wp_profile\installedApps\lhept\wps.ear\wps.war\themes\html\ \footer.jspf to be different depending on locale. It seems that I am looking for something similar to ", but I cannot locate the properties bundle file nls.engine, to add my...
In version 6.1, properties are located in..\WebSphere\PortalServer\ui\wp.ui\shared\app\wp.ui.jar file. When one wants to change the translations or add additional keys: the appropriate.properties file should be extracted to or a new.properties file should be created in..\WebSphere\PortalServer\shared\app\nls directory ...
WebSphere Portal 6.1 theme localization How can a theme for a portal be localized? Suppose I wanted some text in IBM\WebSphere\wp_profile\installedApps\lhept\wps.ear\wps.war\themes\html\ \footer.jspf to be different depending on locale. It seems that I am looking for something similar to ", but I cannot locate the prop...
TITLE: WebSphere Portal 6.1 theme localization QUESTION: How can a theme for a portal be localized? Suppose I wanted some text in IBM\WebSphere\wp_profile\installedApps\lhept\wps.ear\wps.war\themes\html\ \footer.jspf to be different depending on locale. It seems that I am looking for something similar to ", but I cann...
[ "localization", "properties", "themes", "websphere" ]
2
1
1,297
1
0
2011-06-02T12:19:25.870000
2011-06-02T13:08:23.957000
6,214,420
6,214,563
LINQ to XML - Elements() works but Elements(XName) does not work
Given below is my xml: true true =Today() 0.36958in 0.22917in 1in 2pt 2pt 2pt 2pt true true Mark Wilkinson 0.22917in 0.36958in 0.20833in 3.22917in 1 2pt 2pt 2pt 2pt 6.01667in 7.92333in I want to get all the Textbox names and values. This is what I tried and it does not work: XDocument data = XDocument.Load("..\\..\\tes...
You need to take the namespace into account: XNamespace df = data.Root.Name.Namespace; Then use df + "foo" to select elements with local name foo in the namespace defined on the root element. And as already mentioned you probably want to select descendants, not child elements: var elements = from c in data.Descendants(...
LINQ to XML - Elements() works but Elements(XName) does not work Given below is my xml: true true =Today() 0.36958in 0.22917in 1in 2pt 2pt 2pt 2pt true true Mark Wilkinson 0.22917in 0.36958in 0.20833in 3.22917in 1 2pt 2pt 2pt 2pt 6.01667in 7.92333in I want to get all the Textbox names and values. This is what I tried a...
TITLE: LINQ to XML - Elements() works but Elements(XName) does not work QUESTION: Given below is my xml: true true =Today() 0.36958in 0.22917in 1in 2pt 2pt 2pt 2pt true true Mark Wilkinson 0.22917in 0.36958in 0.20833in 3.22917in 1 2pt 2pt 2pt 2pt 6.01667in 7.92333in I want to get all the Textbox names and values. This...
[ "c#", "xml", "linq-to-xml" ]
14
35
14,150
3
0
2011-06-02T12:20:09.283000
2011-06-02T12:35:00.250000
6,214,422
6,214,600
if window.location.href has 'sometext' inside - do this
Currently working on something which uses ajax for some pagination. What I'm looking to do is add something like referal=3 to the end of some links then when they go to that link I'll insert a back button with the window location for example: User uses the ajax pagination, goes to page 3 I'll add?ref=3 to the end of th...
To find a if the url contains some string: if (document.location.href.search("ref=3")!=-1){ alert('got ref=3'); }
if window.location.href has 'sometext' inside - do this Currently working on something which uses ajax for some pagination. What I'm looking to do is add something like referal=3 to the end of some links then when they go to that link I'll insert a back button with the window location for example: User uses the ajax pa...
TITLE: if window.location.href has 'sometext' inside - do this QUESTION: Currently working on something which uses ajax for some pagination. What I'm looking to do is add something like referal=3 to the end of some links then when they go to that link I'll insert a back button with the window location for example: Use...
[ "javascript", "jquery", "ajax", "window", "location" ]
1
3
10,297
3
0
2011-06-02T12:20:14.467000
2011-06-02T12:38:11.930000
6,214,431
6,214,541
OR Condition Return Error in GQL ( Google app engine) Why?
When i use the OR condion in GQL it return error messege tht " BadQueryError: Parse Error: Expected no additional symbols at symbol OR. Why? db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'")
GQL does not have an OR operator. However, it does have an IN operator, which provides a limited form of OR. Docs clearly says that GQL doesn't have an OR operator.. You could do something like this..Make two queries and combine the results... vendors=vendor.all() pub_vendors = vendors.filter("access = ","public") vend...
OR Condition Return Error in GQL ( Google app engine) Why? When i use the OR condion in GQL it return error messege tht " BadQueryError: Parse Error: Expected no additional symbols at symbol OR. Why? db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'")
TITLE: OR Condition Return Error in GQL ( Google app engine) Why? QUESTION: When i use the OR condion in GQL it return error messege tht " BadQueryError: Parse Error: Expected no additional symbols at symbol OR. Why? db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'") ANSWER: GQ...
[ "python", "google-app-engine", "gql", "gqlquery" ]
1
3
1,109
1
0
2011-06-02T12:21:42.343000
2011-06-02T12:32:29.823000
6,214,437
6,220,082
Android: Programmatically Get IMG SRC from Image Gallery within WebView
I'm using a WebView which displays some nice HTML. One of the pictures should be chosen from the Picture Gallery and displayed within the WebView. So, basically, I need Javascript to access Java (in order to open the Gallery), as well as Java to access Javascript (to get the result back) I used the following code: publ...
Solved! The mistake was to add the onActivityResult as a function inside the JavascriptInterface class, while it needed to be outside it, within the WebView definition. (I couldn't answer to my own question before because my reputation isn't high enough, so I had to wait a few hours) @Override public void onActivityRes...
Android: Programmatically Get IMG SRC from Image Gallery within WebView I'm using a WebView which displays some nice HTML. One of the pictures should be chosen from the Picture Gallery and displayed within the WebView. So, basically, I need Javascript to access Java (in order to open the Gallery), as well as Java to ac...
TITLE: Android: Programmatically Get IMG SRC from Image Gallery within WebView QUESTION: I'm using a WebView which displays some nice HTML. One of the pictures should be chosen from the Picture Gallery and displayed within the WebView. So, basically, I need Javascript to access Java (in order to open the Gallery), as ...
[ "android", "webview", "android-webview" ]
1
1
1,828
1
0
2011-06-02T12:22:40.087000
2011-06-02T20:33:39.883000
6,214,439
6,214,673
CouchDB POST response, which was sent via curl via Python's subprocess module, is getting lost (curl code 53). Why is that?
I'm trying to add a document to couchDB from python using curl via the subprocess module. I can do it fine from the command line but not from python. Here is the command line code curl -X POST http://doug:enter@localhost:5984/mydb/ -H "Content-Type: application/json" -d {} The document is created each and every time wi...
You aren't including shell=True. Subprocess won't use your shell if you don't, so you'll have differences from running on the command line. retcode = subprocess.call(args, shell=True) That should fix your problem. Note that this may cause args to not work quite correctly, as it may want a string instead. If that is the...
CouchDB POST response, which was sent via curl via Python's subprocess module, is getting lost (curl code 53). Why is that? I'm trying to add a document to couchDB from python using curl via the subprocess module. I can do it fine from the command line but not from python. Here is the command line code curl -X POST htt...
TITLE: CouchDB POST response, which was sent via curl via Python's subprocess module, is getting lost (curl code 53). Why is that? QUESTION: I'm trying to add a document to couchDB from python using curl via the subprocess module. I can do it fine from the command line but not from python. Here is the command line cod...
[ "python", "couchdb", "subprocess" ]
1
2
178
1
0
2011-06-02T12:22:49.783000
2011-06-02T12:44:49.050000
6,214,441
6,218,197
DB design : Config Data, Actual Data, Log Data
I want to know if there is any typical approach to differenciate this kind of data I have to listing devices (for example) in a db, ane everyone will have Configuration data Actual data Log data I commonly mix Config/Actual Data in the same table and another table for Log data, This seems to be an usual issue, so I won...
You might divide it up like so (being lazy about sql syntax and types): ` signal_config id (key) position type signal_log signal_id, timestamp (compound key) color_stat one of (red, yellow, green) functioning_state ` To my mind, there's stuff that doesn't change about the signal, like it's location and type, and stuff ...
DB design : Config Data, Actual Data, Log Data I want to know if there is any typical approach to differenciate this kind of data I have to listing devices (for example) in a db, ane everyone will have Configuration data Actual data Log data I commonly mix Config/Actual Data in the same table and another table for Log ...
TITLE: DB design : Config Data, Actual Data, Log Data QUESTION: I want to know if there is any typical approach to differenciate this kind of data I have to listing devices (for example) in a db, ane everyone will have Configuration data Actual data Log data I commonly mix Config/Actual Data in the same table and anot...
[ "database", "sqlite", "database-design", "data-structures", "data-modeling" ]
0
1
175
4
0
2011-06-02T12:22:59.583000
2011-06-02T17:46:45.763000
6,214,443
6,214,850
Facebook API Access token
Hello I am reading the Facebook API docs but I need a simple Help. $token_url = "https://graph.facebook.com/oauth/access_token?". "client_id=". $app_id. "&redirect_uri=". urlencode($my_url). "&client_secret=". $app_secret. "&code=". $code; I do understand all the variables... But I do NOT understand what is $code What ...
This is explained thoroughly in Facebook Developers Documentation here. If the user presses Allow, your app is authorized. The OAuth Dialog will redirect (via HTTP 302) the user's browser to the URL you passed in the redirect_uri parameter with an authorization code: http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER Afte...
Facebook API Access token Hello I am reading the Facebook API docs but I need a simple Help. $token_url = "https://graph.facebook.com/oauth/access_token?". "client_id=". $app_id. "&redirect_uri=". urlencode($my_url). "&client_secret=". $app_secret. "&code=". $code; I do understand all the variables... But I do NOT unde...
TITLE: Facebook API Access token QUESTION: Hello I am reading the Facebook API docs but I need a simple Help. $token_url = "https://graph.facebook.com/oauth/access_token?". "client_id=". $app_id. "&redirect_uri=". urlencode($my_url). "&client_secret=". $app_secret. "&code=". $code; I do understand all the variables......
[ "php", "facebook", "api" ]
3
4
5,580
2
0
2011-06-02T12:23:10.127000
2011-06-02T13:02:32.510000
6,214,446
6,214,572
problem with regular expression replacement
I'm trying to make a program to go through a lot of.sql files and replace names for example view_name to [dbo].[view_name]. So far it replaces most of the words, however if a name contains number in brackets like (3) or (7) and so on it wont replace anything within that file. I've provided the code below. FolderBrowser...
You should Escape the characters when building a regex pattern: string pattern = "\\s" + Regex.Escape(tempNameNoExtens);
problem with regular expression replacement I'm trying to make a program to go through a lot of.sql files and replace names for example view_name to [dbo].[view_name]. So far it replaces most of the words, however if a name contains number in brackets like (3) or (7) and so on it wont replace anything within that file....
TITLE: problem with regular expression replacement QUESTION: I'm trying to make a program to go through a lot of.sql files and replace names for example view_name to [dbo].[view_name]. So far it replaces most of the words, however if a name contains number in brackets like (3) or (7) and so on it wont replace anything...
[ "c#", "regex", "winforms", "streamwriter" ]
0
1
136
1
0
2011-06-02T12:23:11.123000
2011-06-02T12:35:58.883000
6,214,458
6,214,499
Debugging Access Violation errors?
What tips can you share to help locate and fix access violations when writing applications in Delphi? I believe access violations are usually caused by trying to access something in memory that has not yet been created such as an Object etc? I find it hard to identify what triggers the access violations and then where ...
It means your code is accessing some part of the memory it isn't allowed to. That usually means you have a pointer or object reference pointing to the wrong memory. Maybe because it is not initialized or is already released. Use a debugger, like Delphi. It will tell you on what line of code the AV occurred. From there ...
Debugging Access Violation errors? What tips can you share to help locate and fix access violations when writing applications in Delphi? I believe access violations are usually caused by trying to access something in memory that has not yet been created such as an Object etc? I find it hard to identify what triggers th...
TITLE: Debugging Access Violation errors? QUESTION: What tips can you share to help locate and fix access violations when writing applications in Delphi? I believe access violations are usually caused by trying to access something in memory that has not yet been created such as an Object etc? I find it hard to identif...
[ "delphi", "access-violation" ]
22
27
84,091
4
0
2011-06-02T12:24:30.140000
2011-06-02T12:28:52.540000
6,214,464
6,214,639
How do I parse this json-response?
The response is structured like this, this is an extract, might be missing a curly brace: {"2":{"date":1306411951,"price":4.8003,"low":"4.80000000","high":"4.80060000","nicedate":"15:12"},"6":{"date":1306418941,"price":4.654175,"low":"4.40000000","high":"4.80000000","nicedate":"17:02"} And I get cast exceptions when pa...
As mentioned already, you're missing a trailing } from the JSON. Assuming that what you receive is properly formatted and consistent JSON, then your Currency class should look something like this: [DataContract] public class Currency { [DataMember(Name = "date")] public int Date { get; set; } [DataMember(Name = "price"...
How do I parse this json-response? The response is structured like this, this is an extract, might be missing a curly brace: {"2":{"date":1306411951,"price":4.8003,"low":"4.80000000","high":"4.80060000","nicedate":"15:12"},"6":{"date":1306418941,"price":4.654175,"low":"4.40000000","high":"4.80000000","nicedate":"17:02"...
TITLE: How do I parse this json-response? QUESTION: The response is structured like this, this is an extract, might be missing a curly brace: {"2":{"date":1306411951,"price":4.8003,"low":"4.80000000","high":"4.80060000","nicedate":"15:12"},"6":{"date":1306418941,"price":4.654175,"low":"4.40000000","high":"4.80000000",...
[ "c#", "json", "parsing", "windows-phone-7" ]
1
2
1,466
1
0
2011-06-02T12:24:53.830000
2011-06-02T12:41:49.367000
6,214,466
6,214,745
using @ symbol with ftp stream in DirectoryIterator
I'm using DirectoryIterator class to list ftp content: $a = new DirectoryIterator('ftp://user:password@host'); If there is an at "@" character in login, i get an error: failed to open dir: operation failed How i can escape @ symbol in login? I try: %40, + \@
RFC1738 mandates the special characters like @ should be urlencoded in the ftp:// scheme. So using %40 in place of the @ in a password fragement would be correct. But you just wanted the user:password@ prefix before the hostname. Those don't need escaping. And it's already natively supported by the ftp fopen url wrappe...
using @ symbol with ftp stream in DirectoryIterator I'm using DirectoryIterator class to list ftp content: $a = new DirectoryIterator('ftp://user:password@host'); If there is an at "@" character in login, i get an error: failed to open dir: operation failed How i can escape @ symbol in login? I try: %40, + \@
TITLE: using @ symbol with ftp stream in DirectoryIterator QUESTION: I'm using DirectoryIterator class to list ftp content: $a = new DirectoryIterator('ftp://user:password@host'); If there is an at "@" character in login, i get an error: failed to open dir: operation failed How i can escape @ symbol in login? I try: %...
[ "php", "ftp" ]
1
2
1,134
2
0
2011-06-02T12:25:05.553000
2011-06-02T12:52:16.053000
6,214,473
6,214,511
Cannot understand the following code in objective C?
Please refer to the following code: Filename: myclass.h @interface myclass:NSObject... @end @interface NSObject(CategoryName).... @end I do not understand how can we declare 2 @interface directives in the same.h file? and like in the implementation file we can only implement one of the above interfaces.eg. Filename: my...
Add it as another declaration in the same file, like this @implementation NSObject (categoryname)... @end It's all described in the Categories and extensions section of the Developer docs. Since you are extending a different class in the same interface - you need to have a separate declaration in the implementation fi...
Cannot understand the following code in objective C? Please refer to the following code: Filename: myclass.h @interface myclass:NSObject... @end @interface NSObject(CategoryName).... @end I do not understand how can we declare 2 @interface directives in the same.h file? and like in the implementation file we can only i...
TITLE: Cannot understand the following code in objective C? QUESTION: Please refer to the following code: Filename: myclass.h @interface myclass:NSObject... @end @interface NSObject(CategoryName).... @end I do not understand how can we declare 2 @interface directives in the same.h file? and like in the implementation ...
[ "objective-c" ]
0
4
99
1
0
2011-06-02T12:26:07.003000
2011-06-02T12:29:31.970000
6,214,476
6,253,458
Non-empty closures and the question mark: only first element is put into the AST?
I'm haunted by a strange phenomenon: Only the first in x in z: x | '<'! y? '>', where y: x (','! x)*, occurs in the resulting AST. But only if I compile the code using Antlr3 as deployed in the maven repositories. With AntlrWorks I see a correct Tree. Is b: a a*; c: d b? d; semantically wrong? What am I doing wrong? Or...
Kay wrote: Only the first in x in z: x | '<'! y? '>', where y: x (','! x)*, occurs in the resulting AST. But only if I compile the code using Antlr3 as deployed in the maven repositories. With AntlrWorks I see a correct Tree. ANTLRWorks produces a parse tree, not the AST your parser rules produce (assuming you're talki...
Non-empty closures and the question mark: only first element is put into the AST? I'm haunted by a strange phenomenon: Only the first in x in z: x | '<'! y? '>', where y: x (','! x)*, occurs in the resulting AST. But only if I compile the code using Antlr3 as deployed in the maven repositories. With AntlrWorks I see a ...
TITLE: Non-empty closures and the question mark: only first element is put into the AST? QUESTION: I'm haunted by a strange phenomenon: Only the first in x in z: x | '<'! y? '>', where y: x (','! x)*, occurs in the resulting AST. But only if I compile the code using Antlr3 as deployed in the maven repositories. With A...
[ "antlr", "antlr3", "antlrworks" ]
1
1
325
1
0
2011-06-02T12:26:25.433000
2011-06-06T14:22:48.460000
6,214,477
6,216,526
So sockets generated by socketpair() are availble across different processes?
As we know fd (file descriptor,an int to be exact) is per process,that is,the same file opened in different processes may have different fd. And I thought so should be for sockets. But when reading nginx source code I found it's using sockets to communicate between processes: if (socketpair(AF_UNIX, SOCK_STREAM, 0, ngx...
nginx uses unix domain sockets ancillary messages (specifically, the SCM_RIGHTS message, see the man page for the unix protocol for more information on this) to pass file descriptors around. When you receive an SCM_RIGHTS message, the kernel basically gives you a duplicate (as in dup ) file descriptor, valid in the rec...
So sockets generated by socketpair() are availble across different processes? As we know fd (file descriptor,an int to be exact) is per process,that is,the same file opened in different processes may have different fd. And I thought so should be for sockets. But when reading nginx source code I found it's using sockets...
TITLE: So sockets generated by socketpair() are availble across different processes? QUESTION: As we know fd (file descriptor,an int to be exact) is per process,that is,the same file opened in different processes may have different fd. And I thought so should be for sockets. But when reading nginx source code I found ...
[ "c", "sockets", "file-descriptor" ]
2
3
1,815
1
0
2011-06-02T12:26:34.340000
2011-06-02T15:17:03.450000
6,214,479
6,214,514
Is there a contain's method?
I know there's a method contain(), it looks like this: Dim arr() as string = {"apple","banana","orange"} For each fruit in arr If fruit.contains("app") Then Return True End If Next It will return true because "apple" contains letter "a". This is not what I want. I want it to return true only when "apple" contains the w...
"apple" does in fact contain the whole word "app", so Contains() is still probably your best bet. From MSDN: String.Contains Method Returns a value indicating whether the specified String object occurs within this string. Here is the link to it with samples. http://msdn.microsoft.com/en-us/library/dy85x1sa.aspx
Is there a contain's method? I know there's a method contain(), it looks like this: Dim arr() as string = {"apple","banana","orange"} For each fruit in arr If fruit.contains("app") Then Return True End If Next It will return true because "apple" contains letter "a". This is not what I want. I want it to return true onl...
TITLE: Is there a contain's method? QUESTION: I know there's a method contain(), it looks like this: Dim arr() as string = {"apple","banana","orange"} For each fruit in arr If fruit.contains("app") Then Return True End If Next It will return true because "apple" contains letter "a". This is not what I want. I want it ...
[ ".net", "vb.net" ]
0
2
57
2
0
2011-06-02T12:26:45.333000
2011-06-02T12:29:45.457000
6,214,482
6,214,688
startActivity for external app needs <activity> declared?
I want to be able to open Android's stock Wifi Settings screen from my app, got this code: Intent settings = new Intent(Settings.ACTION_WIFI_SETTINGS); settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(settings); I get "Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethod...
You only have to declare your activities in your manifest. Not the one that belong to external programs. And remove the flags in your intent, I can't see the point for them. startActivity( new Intent(android.provider.settings.Settings.ACTION_WIFI_SE‌​TTINGS) );
startActivity for external app needs <activity> declared? I want to be able to open Android's stock Wifi Settings screen from my app, got this code: Intent settings = new Intent(Settings.ACTION_WIFI_SETTINGS); settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(settings); I get "Window already focused, igno...
TITLE: startActivity for external app needs <activity> declared? QUESTION: I want to be able to open Android's stock Wifi Settings screen from my app, got this code: Intent settings = new Intent(Settings.ACTION_WIFI_SETTINGS); settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(settings); I get "Window alr...
[ "android" ]
0
0
624
1
0
2011-06-02T12:26:58.193000
2011-06-02T12:46:56.433000
6,214,490
6,214,516
Executing function for every key in array w/o loop
I'm looking for the best practice for executing encodeURIComponent (or some other function) for every key in array, before joining it to one string. This could be done with a loop like this: var dynamicArray = ['uri1', 'uri2', 'hax&%hax']; var max = dynamicArray.length, i, url = ''; for (i=0;i But I'm looking for some...
dynamicArray.map(encodeURIComponent).join('/'); Check out MDC for an implementation of map for non-compatible platforms. Of course, internally there is a loop in map 's implementation.
Executing function for every key in array w/o loop I'm looking for the best practice for executing encodeURIComponent (or some other function) for every key in array, before joining it to one string. This could be done with a loop like this: var dynamicArray = ['uri1', 'uri2', 'hax&%hax']; var max = dynamicArray.length...
TITLE: Executing function for every key in array w/o loop QUESTION: I'm looking for the best practice for executing encodeURIComponent (or some other function) for every key in array, before joining it to one string. This could be done with a loop like this: var dynamicArray = ['uri1', 'uri2', 'hax&%hax']; var max = d...
[ "javascript", "arrays", "function", "key" ]
1
4
256
2
0
2011-06-02T12:27:34.843000
2011-06-02T12:29:53.480000
6,214,494
6,218,580
Data report to pdf
Is it possible to convert Data report to a PDF from code? As of now, i am printing Data report to a PDF printer from Data report print button.
It is technically possible, but you would need to either know or find the pdf file format and it would be a huge (I wouldn't do it) headache. The easiest solution is to find a control or library that works for you. There are several such as pdf.ocx. I used one many years ago and don't even remember the name any more as...
Data report to pdf Is it possible to convert Data report to a PDF from code? As of now, i am printing Data report to a PDF printer from Data report print button.
TITLE: Data report to pdf QUESTION: Is it possible to convert Data report to a PDF from code? As of now, i am printing Data report to a PDF printer from Data report print button. ANSWER: It is technically possible, but you would need to either know or find the pdf file format and it would be a huge (I wouldn't do it)...
[ "vb6", "report" ]
0
1
814
1
0
2011-06-02T12:28:23.407000
2011-06-02T18:18:27.303000
6,214,509
6,214,554
Is Django middleware thread safe?
Are Django middleware thread safe? Can I do something like this, class ThreadsafeTestMiddleware(object): def process_request(self, request): self.thread_safe_variable = some_dynamic_value_from_request def process_response(self, request, response): # will self.thread_safe_variable always equal to some_dynamic_value_fr...
Why not bind your variable to the request object, like so: class ThreadsafeTestMiddleware(object): def process_request(self, request): request.thread_safe_variable = some_dynamic_value_from_request def process_response(self, request, response): #... do something with request.thread_safe_variable here...
Is Django middleware thread safe? Are Django middleware thread safe? Can I do something like this, class ThreadsafeTestMiddleware(object): def process_request(self, request): self.thread_safe_variable = some_dynamic_value_from_request def process_response(self, request, response): # will self.thread_safe_variable alw...
TITLE: Is Django middleware thread safe? QUESTION: Are Django middleware thread safe? Can I do something like this, class ThreadsafeTestMiddleware(object): def process_request(self, request): self.thread_safe_variable = some_dynamic_value_from_request def process_response(self, request, response): # will self.thread...
[ "python", "django", "thread-safety", "middleware" ]
16
30
4,154
3
0
2011-06-02T12:29:26.880000
2011-06-02T12:33:41.467000
6,214,513
6,216,018
LaTeX: Strange "La, Lb" showing in nested enumerate
I'm writing a big LaTeX document. In it I have a nested enumerate environment: \begin{enumerate} \item Bla bla \item More Bla Bla \item Now we nest: \begin{enumerate} \item Nested Bla Bla \item...And more \end{enumerate} \item Back from enumeration \end{enumerate} The problem: In the output the enumeration of the neste...
Your example above reproduces fine on my machine. Here's the output (as expected) Now if you wanted to change the list numbering to look like (La), (Lb) etc, you'd add something like this to your preamble: \renewcommand{\theenumii}{(L\alph{enumii})} \renewcommand{\labelenumii}{\theenumii} which will produce and output ...
LaTeX: Strange "La, Lb" showing in nested enumerate I'm writing a big LaTeX document. In it I have a nested enumerate environment: \begin{enumerate} \item Bla bla \item More Bla Bla \item Now we nest: \begin{enumerate} \item Nested Bla Bla \item...And more \end{enumerate} \item Back from enumeration \end{enumerate} The...
TITLE: LaTeX: Strange "La, Lb" showing in nested enumerate QUESTION: I'm writing a big LaTeX document. In it I have a nested enumerate environment: \begin{enumerate} \item Bla bla \item More Bla Bla \item Now we nest: \begin{enumerate} \item Nested Bla Bla \item...And more \end{enumerate} \item Back from enumeration \...
[ "latex" ]
0
1
149
1
0
2011-06-02T12:29:41.687000
2011-06-02T14:37:44.560000
6,214,515
6,214,720
Difference between "" and String.Empty()
Possible Duplicate: What is the difference between String.Empty and “” What is the difference between code and where it is applicable?? string mystr = ""; string mystr1 = String.Empty();
The answer appears to be 'nothing'. However, good programming practice says that you should preferably use string.Empty, as if in the future an empty string were to be represented by something other than "", your code otherwise might break. (I can't see tha change happening, but in principle it might).
Difference between "" and String.Empty() Possible Duplicate: What is the difference between String.Empty and “” What is the difference between code and where it is applicable?? string mystr = ""; string mystr1 = String.Empty();
TITLE: Difference between "" and String.Empty() QUESTION: Possible Duplicate: What is the difference between String.Empty and “” What is the difference between code and where it is applicable?? string mystr = ""; string mystr1 = String.Empty(); ANSWER: The answer appears to be 'nothing'. However, good programming pr...
[ "string", "c#-2.0", "variable-assignment" ]
1
0
491
2
0
2011-06-02T12:29:48.677000
2011-06-02T12:50:16.147000
6,214,518
6,214,569
What is the different between encode and encription?
I am using windows form and mysql. I am very confuse about different between encode and encription?. encode also change the string value. and decode is give back the string. In my program,... userid - mcs password - mcs i want to store these strings in mysql database. but not a same string, for security purpose. What i...
Encoding is how the different characters are represented according to their memory spaces (8bit etc.). Encryption is how to keep a text hidden with the use of a secret key. After encryption the text turns into a series of arbitrary bytes so you encode it with say Base64 encoding to be able to make it into a readable (a...
What is the different between encode and encription? I am using windows form and mysql. I am very confuse about different between encode and encription?. encode also change the string value. and decode is give back the string. In my program,... userid - mcs password - mcs i want to store these strings in mysql database...
TITLE: What is the different between encode and encription? QUESTION: I am using windows form and mysql. I am very confuse about different between encode and encription?. encode also change the string value. and decode is give back the string. In my program,... userid - mcs password - mcs i want to store these strings...
[ "winforms", "encryption", "encoding" ]
2
1
590
4
0
2011-06-02T12:30:08.177000
2011-06-02T12:35:28.837000
6,214,520
6,214,738
CSS3 Box-Shadow Showing Behind Sibling Div Element
I'm using: box-shadow: 0px -1px 0px #333333; on my footer but it's hiding behind or disappearing where the div before it is... hard to explain but here's what it looks like: http://cl.ly/7HLy Is there a way do have the box-shadow be on top of the other div before the footer? I've tried adding a z-index but it doesn't w...
I'll repeat my comment here since it solved the problem. When using z-index you should use position: relative;
CSS3 Box-Shadow Showing Behind Sibling Div Element I'm using: box-shadow: 0px -1px 0px #333333; on my footer but it's hiding behind or disappearing where the div before it is... hard to explain but here's what it looks like: http://cl.ly/7HLy Is there a way do have the box-shadow be on top of the other div before the f...
TITLE: CSS3 Box-Shadow Showing Behind Sibling Div Element QUESTION: I'm using: box-shadow: 0px -1px 0px #333333; on my footer but it's hiding behind or disappearing where the div before it is... hard to explain but here's what it looks like: http://cl.ly/7HLy Is there a way do have the box-shadow be on top of the othe...
[ "css" ]
26
65
21,634
1
0
2011-06-02T12:30:26.190000
2011-06-02T12:51:54.120000
6,214,527
6,215,191
Maintaining medium-sized to large JS-heavy web apps
What's the best way to deal with lots of JS in a web front end? Google's Closure compiler can compile and minify JS, which is good for production -- but annoying to have to recompile every time I make a change, and annoying to debug. What's the best way to be able to organise my JS into many files?
There are actually 2 questions: how to avoid recompiling in development and what's the best way to organize many js files. Easy answer for the first question is having a variable for production/development modes in your template. In pseudo-template code it may look like this (example is rough, of course it's better to ...
Maintaining medium-sized to large JS-heavy web apps What's the best way to deal with lots of JS in a web front end? Google's Closure compiler can compile and minify JS, which is good for production -- but annoying to have to recompile every time I make a change, and annoying to debug. What's the best way to be able to ...
TITLE: Maintaining medium-sized to large JS-heavy web apps QUESTION: What's the best way to deal with lots of JS in a web front end? Google's Closure compiler can compile and minify JS, which is good for production -- but annoying to have to recompile every time I make a change, and annoying to debug. What's the best ...
[ "javascript" ]
1
1
183
3
0
2011-06-02T12:31:01.557000
2011-06-02T13:29:41.437000
6,214,530
6,214,860
mvc 3 nested objects binding
I am very new to MVC 3 so this could be an easy one. I have a viewmodel with a nested object like this: public class EventViewModel { public Event Event { get; set; } } public class Event { [Required] public int Id { get; set; } public string Title { get; set; } } In my 'create' view I do something like this: @model ...
It's the name of your parameter. Change it from @event to eventViewModel. Seems like the model binder cannot bind it like that. Possibly it gets mixed up with the Event property on your model. public ActionResult Create(EventViewModel eventViewModel) {..} Edit: Some more rough explanation. The HtmlHelper creates a form...
mvc 3 nested objects binding I am very new to MVC 3 so this could be an easy one. I have a viewmodel with a nested object like this: public class EventViewModel { public Event Event { get; set; } } public class Event { [Required] public int Id { get; set; } public string Title { get; set; } } In my 'create' view I do...
TITLE: mvc 3 nested objects binding QUESTION: I am very new to MVC 3 so this could be an easy one. I have a viewmodel with a nested object like this: public class EventViewModel { public Event Event { get; set; } } public class Event { [Required] public int Id { get; set; } public string Title { get; set; } } In my ...
[ "c#", "asp.net-mvc-3" ]
3
2
3,240
3
0
2011-06-02T12:31:13.047000
2011-06-02T13:03:21.073000
6,214,532
6,214,761
Opengl proper lighting problem
I have written the following program to display a teapot on a table in a room with 2side walls and a floor. #include #include void wall1(float thickness) { glPushMatrix(); glTranslatef(100,100,0); glRotatef(90,1,0,0); glScalef(thickness,1,1); glutSolidCube(100); glPopMatrix(); } void wall2(float thickness) { glPushMatr...
I was missing glEnable(GL_NORMALIZE); in the main function, and thus opengl was not rendering it properly! Alse @Christian's answer of using ambient only worked.:)
Opengl proper lighting problem I have written the following program to display a teapot on a table in a room with 2side walls and a floor. #include #include void wall1(float thickness) { glPushMatrix(); glTranslatef(100,100,0); glRotatef(90,1,0,0); glScalef(thickness,1,1); glutSolidCube(100); glPopMatrix(); } void wall...
TITLE: Opengl proper lighting problem QUESTION: I have written the following program to display a teapot on a table in a room with 2side walls and a floor. #include #include void wall1(float thickness) { glPushMatrix(); glTranslatef(100,100,0); glRotatef(90,1,0,0); glScalef(thickness,1,1); glutSolidCube(100); glPopMat...
[ "c++", "opengl", "3d", "lighting" ]
3
5
2,266
3
0
2011-06-02T12:31:27.157000
2011-06-02T12:54:06.477000
6,214,534
6,214,551
Counting with python dictionaries and adding functionality
a = 0 b = 0 c = 0 d = 0 fruit = { 'lemons': [], 'apples': [], 'cherries': [], 'oranges': [], } def count(): fruit = input("What fruit are you getting at the store? ") if fruit == 'lemons': fruit['lemons'] = a + 1 elif fruit == 'apples': fruit['apples'] = b + 1 elif fruit == 'cherries': fruit['cherries'] = c + 1 elif...
You seem to have multiple variables called fruit, that's a bad idea. And if you're just counting, you should start with 0, not []. You can write your code way easier as: import collections result = collections.defaultdict(int) def count(): fruit = input("What fruit are you getting at the store? ") result[fruit] += 1 In...
Counting with python dictionaries and adding functionality a = 0 b = 0 c = 0 d = 0 fruit = { 'lemons': [], 'apples': [], 'cherries': [], 'oranges': [], } def count(): fruit = input("What fruit are you getting at the store? ") if fruit == 'lemons': fruit['lemons'] = a + 1 elif fruit == 'apples': fruit['apples'] = b + ...
TITLE: Counting with python dictionaries and adding functionality QUESTION: a = 0 b = 0 c = 0 d = 0 fruit = { 'lemons': [], 'apples': [], 'cherries': [], 'oranges': [], } def count(): fruit = input("What fruit are you getting at the store? ") if fruit == 'lemons': fruit['lemons'] = a + 1 elif fruit == 'apples': frui...
[ "python", "dictionary", "counter" ]
2
4
4,173
2
0
2011-06-02T12:31:42.400000
2011-06-02T12:33:28.923000
6,214,555
6,214,593
Filtering using Regular Expressions
I am having a filter for the following regular expressions [^@()[]\;:,<>]+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ I need to negate the following special charters before the @domain.com @()[]\;:",< any suggestions??
Try escaping the ] in the character class. [^@()[\]\;:,<>]+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ ^^ If not escaped the ] will be treated incorrectly as the end of the character class. Since this has been tagged as Java, remember that you need to escape using \\ and not just \.
Filtering using Regular Expressions I am having a filter for the following regular expressions [^@()[]\;:,<>]+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ I need to negate the following special charters before the @domain.com @()[]\;:",< any suggestions??
TITLE: Filtering using Regular Expressions QUESTION: I am having a filter for the following regular expressions [^@()[]\;:,<>]+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ I need to negate the following special charters before the @domain.com @()[]\;:",< any suggestions?? ANSWER: Try escaping the ] in the character class...
[ "java", "regex" ]
0
2
136
1
0
2011-06-02T12:33:46.220000
2011-06-02T12:37:37.257000
6,214,559
6,215,002
Passing a symbol as a function in clojure
I'm learning clojure and I've written a small function that given a directory pathname returns a sorted-map of files in descending order according to their mtimes. Here it is: (defn get-sorted-mtimes [dir] (loop [sm (sorted-map-by >) lst (for [f (.listFiles (File. dir))] (let [k (.lastModified f) v (.getName f)] [k v])...
> is just a function like any other in Clojure. So there is nothing to stop you passing it as an argument. In fact I'd say that is good Clojure style to do it this way. Clojure is a functional programming language at heart, so there's nothing wrong with using higher order functions where appropriate! Some other minor s...
Passing a symbol as a function in clojure I'm learning clojure and I've written a small function that given a directory pathname returns a sorted-map of files in descending order according to their mtimes. Here it is: (defn get-sorted-mtimes [dir] (loop [sm (sorted-map-by >) lst (for [f (.listFiles (File. dir))] (let [...
TITLE: Passing a symbol as a function in clojure QUESTION: I'm learning clojure and I've written a small function that given a directory pathname returns a sorted-map of files in descending order according to their mtimes. Here it is: (defn get-sorted-mtimes [dir] (loop [sm (sorted-map-by >) lst (for [f (.listFiles (F...
[ "clojure" ]
4
4
854
1
0
2011-06-02T12:34:31.093000
2011-06-02T13:15:44.343000
6,214,562
6,214,637
Merging XML in PHP
Somthing wrong here, dont seem to be able to merge XML DOMDocumet's I get the error, "Fatal error: Call to undefined method DOMElement::importNode() in C:\xampp\htdocs\xmltest\xmltest.php on line 27" can anybody help me put this code right... appendChild($dom->createElement('tables')); // create container for tblclien...
importNode() is a method belonging to the document, not an element. You want to import into the document ( $dom ) then append to the element ( $tblclients ). A node is needed when importing (and $tblclientsXML is not a node, it's a document) so importing the generated XML would look similar to: $tblclientsElement = $tb...
Merging XML in PHP Somthing wrong here, dont seem to be able to merge XML DOMDocumet's I get the error, "Fatal error: Call to undefined method DOMElement::importNode() in C:\xampp\htdocs\xmltest\xmltest.php on line 27" can anybody help me put this code right... appendChild($dom->createElement('tables')); // create con...
TITLE: Merging XML in PHP QUESTION: Somthing wrong here, dont seem to be able to merge XML DOMDocumet's I get the error, "Fatal error: Call to undefined method DOMElement::importNode() in C:\xampp\htdocs\xmltest\xmltest.php on line 27" can anybody help me put this code right... appendChild($dom->createElement('tables'...
[ "php", "sql", "xml" ]
3
4
880
1
0
2011-06-02T12:34:58.510000
2011-06-02T12:41:32.520000
6,214,564
6,214,908
File sharing in Python
I have 4 computers in a network. I am curios if anyone know how i can i make python to look for some files in different folders from the network or if i can create a mount point that include some folders from different computers. The reason is that i am running a script that needs to open some daemons on different comp...
It sounds like you don't merely want to execute files stored on different machines on one machine, but on the machines they're stored on. Mounting won't help with that. You'd need a daemon already running on the target, and tell it over the network to execute a file. xinetd is a common one.
File sharing in Python I have 4 computers in a network. I am curios if anyone know how i can i make python to look for some files in different folders from the network or if i can create a mount point that include some folders from different computers. The reason is that i am running a script that needs to open some da...
TITLE: File sharing in Python QUESTION: I have 4 computers in a network. I am curios if anyone know how i can i make python to look for some files in different folders from the network or if i can create a mount point that include some folders from different computers. The reason is that i am running a script that nee...
[ "linux", "unix", "python-3.x", "file-sharing" ]
0
1
361
1
0
2011-06-02T12:35:03.997000
2011-06-02T13:07:59.247000
6,214,571
6,214,801
$(document).ready() doesn't run after f:ajax rendering
I have some jQuery code that runs on every $(document).ready() event. I also have some tags that do re-rendering of some parts of the page. I noticed that when I rerender a component, the $(document).ready() doesn't get called. Is there a way to run javascript code after every rerendering? (I can technically use the on...
The $(document).ready() event fires once, when the DOM has fully loaded from the initial load. An ajax event may change the DOM, but it doesn't reload the page, so the $(document).ready() won't fire again. I noticed the way Google solved this problem in Gmail is by using a high frequency timer.
$(document).ready() doesn't run after f:ajax rendering I have some jQuery code that runs on every $(document).ready() event. I also have some tags that do re-rendering of some parts of the page. I noticed that when I rerender a component, the $(document).ready() doesn't get called. Is there a way to run javascript code...
TITLE: $(document).ready() doesn't run after f:ajax rendering QUESTION: I have some jQuery code that runs on every $(document).ready() event. I also have some tags that do re-rendering of some parts of the page. I noticed that when I rerender a component, the $(document).ready() doesn't get called. Is there a way to r...
[ "jquery", "ajax", "jsf-2" ]
4
4
5,706
2
0
2011-06-02T12:35:41.783000
2011-06-02T12:57:27.520000
6,214,576
6,214,830
jax-ws import and customizing package to namespace mapping
How do I customize the packages of the namespaces when using jax-ws to generate the java artifacts. I'm running jax-ws iwsmport via maven. I don't want to change the default package, I want to be able to map from more than one namespace to different packages.
Use JAXB bindings with the wsimport -b switch. You can find some sample files here.
jax-ws import and customizing package to namespace mapping How do I customize the packages of the namespaces when using jax-ws to generate the java artifacts. I'm running jax-ws iwsmport via maven. I don't want to change the default package, I want to be able to map from more than one namespace to different packages.
TITLE: jax-ws import and customizing package to namespace mapping QUESTION: How do I customize the packages of the namespaces when using jax-ws to generate the java artifacts. I'm running jax-ws iwsmport via maven. I don't want to change the default package, I want to be able to map from more than one namespace to dif...
[ "java", "jax-ws" ]
9
11
24,067
1
0
2011-06-02T12:36:29.917000
2011-06-02T13:00:29.250000
6,214,579
6,215,023
ORM for CodeIgniter 2.0
What are some recommended ORM's for CodeIgniter? I have heard of Data Mapper and Propel. What are some that people have used and would recommend?
CI comes bundled with an Active Record class -- which is confusing because the Active Record pattern is technically an ORM, however the class is not -- it is merely a query builder. With that said, for basic websites I'd highly suggest using it. Which ORM to actually use with CI is more a matter of personal preference ...
ORM for CodeIgniter 2.0 What are some recommended ORM's for CodeIgniter? I have heard of Data Mapper and Propel. What are some that people have used and would recommend?
TITLE: ORM for CodeIgniter 2.0 QUESTION: What are some recommended ORM's for CodeIgniter? I have heard of Data Mapper and Propel. What are some that people have used and would recommend? ANSWER: CI comes bundled with an Active Record class -- which is confusing because the Active Record pattern is technically an ORM,...
[ "codeigniter", "orm" ]
0
2
1,265
1
0
2011-06-02T12:36:47.583000
2011-06-02T13:17:24.983000
6,214,581
6,214,713
iOS view change with gesture problem
here is my problem: In mainviewcontroller I added to swipe down gesture to switch down another view, but inside other views added to mainviewcontroller with swipe down gesture opens that specific view. However, I dont want swipe down gesture in other views rather than main view. //---gesture recognizer - (IBAction) ha...
You should adopt the UIGestureRecognizerDelegate protocol and implement gestureRecognizer:shouldReceiveTouch: method to signal whether the gesture recognizer should respond or not. - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { for ( UIView *subview in self.view...
iOS view change with gesture problem here is my problem: In mainviewcontroller I added to swipe down gesture to switch down another view, but inside other views added to mainviewcontroller with swipe down gesture opens that specific view. However, I dont want swipe down gesture in other views rather than main view. //-...
TITLE: iOS view change with gesture problem QUESTION: here is my problem: In mainviewcontroller I added to swipe down gesture to switch down another view, but inside other views added to mainviewcontroller with swipe down gesture opens that specific view. However, I dont want swipe down gesture in other views rather t...
[ "iphone", "ios", "ipad" ]
0
0
938
1
0
2011-06-02T12:36:51.547000
2011-06-02T12:49:56.943000
6,214,589
6,215,247
Selenium popup support
Please give me an example java code to open a popup and move RC control to popup. is there any way to come back on main window after checking some element on popup window. I have few questions on this as selenium always need windowid to get control over popup. 1-What is the best way to get the windowid of any popup. 2-...
This will definitely help you. Handling Popups Hope this helps
Selenium popup support Please give me an example java code to open a popup and move RC control to popup. is there any way to come back on main window after checking some element on popup window. I have few questions on this as selenium always need windowid to get control over popup. 1-What is the best way to get the wi...
TITLE: Selenium popup support QUESTION: Please give me an example java code to open a popup and move RC control to popup. is there any way to come back on main window after checking some element on popup window. I have few questions on this as selenium always need windowid to get control over popup. 1-What is the best...
[ "selenium", "selenium-rc" ]
0
2
818
1
0
2011-06-02T12:37:18.993000
2011-06-02T13:34:03.007000
6,214,604
6,214,750
WCF RESTful API
I created a WCF project with one simple method that returns a pdf in a byte[] and a int (id #) and has username+password with a custom validator for message security and a SSL for transport security. Now the client tells me that he was assuming I was going to create a RESTful API instead. I don't have any experience wi...
REST is different than SOAP or even WCF in that you aren't using cumbersome "envelopes" unfortunately those envelopes provide you with functionality like the authentication scheme you're using (and out params, etc.) See Best Practices for securing a REST API / web service You can go /w basic authentication + SSL for au...
WCF RESTful API I created a WCF project with one simple method that returns a pdf in a byte[] and a int (id #) and has username+password with a custom validator for message security and a SSL for transport security. Now the client tells me that he was assuming I was going to create a RESTful API instead. I don't have a...
TITLE: WCF RESTful API QUESTION: I created a WCF project with one simple method that returns a pdf in a byte[] and a int (id #) and has username+password with a custom validator for message security and a SSL for transport security. Now the client tells me that he was assuming I was going to create a RESTful API inste...
[ "wcf", "rest", "restful-authentication" ]
0
1
616
1
0
2011-06-02T12:38:16.460000
2011-06-02T12:52:38.863000
6,214,614
6,214,665
Memory assignment in C through pointers
I am learning how to use pointers, so i wrote the below program to assign integer values in the interval [1,100] to some random locations in the memory. When i read those memory locations, printf displays all the values and then gives me a segmentation fault. This seems an odd behavior, because i was hoping to see eith...
Not odd at all. You are using your variable first, which is on the stack. What you essentially do is happily overwriting the stack (otherwise known from buffer overflows on the stack) and thus probably destroying any return address and so on. Since main is called by the libc, the return to libc would cause the crash.
Memory assignment in C through pointers I am learning how to use pointers, so i wrote the below program to assign integer values in the interval [1,100] to some random locations in the memory. When i read those memory locations, printf displays all the values and then gives me a segmentation fault. This seems an odd be...
TITLE: Memory assignment in C through pointers QUESTION: I am learning how to use pointers, so i wrote the below program to assign integer values in the interval [1,100] to some random locations in the memory. When i read those memory locations, printf displays all the values and then gives me a segmentation fault. Th...
[ "c" ]
2
5
217
3
0
2011-06-02T12:39:23.760000
2011-06-02T12:44:06.323000
6,214,619
6,214,857
Can an <a> contain a <footer> in HTML5?
I have a structure which is as follows: Some text A Heading This works and displays as expected in all browsers (even IE6 with the HTML5shiv.js) except Firefox 3.6. In Firefox 3.6 the display is completely screwed and if you use Firebug to inspect the DOM, the element is empty and the elements which should be inside it...
According the W3C HTML5 Reference the Footer Elements content model is: Flow content, but with no heading content descendants, no sectioning content descendants, and no footer element descendants. Which an a element is interactive content.(Which also can be a Flow Content ) So using the a element will validate, if you ...
Can an <a> contain a <footer> in HTML5? I have a structure which is as follows: Some text A Heading This works and displays as expected in all browsers (even IE6 with the HTML5shiv.js) except Firefox 3.6. In Firefox 3.6 the display is completely screwed and if you use Firebug to inspect the DOM, the element is empty an...
TITLE: Can an <a> contain a <footer> in HTML5? QUESTION: I have a structure which is as follows: Some text A Heading This works and displays as expected in all browsers (even IE6 with the HTML5shiv.js) except Firefox 3.6. In Firefox 3.6 the display is completely screwed and if you use Firebug to inspect the DOM, the e...
[ "firefox", "html", "layout" ]
3
3
150
2
0
2011-06-02T12:39:50.547000
2011-06-02T13:03:06.867000
6,214,620
6,225,509
MVC with Jquery ajax delete and how to keep the paging and other filter in the querystring?
I am having a search page with one dropdown list box, one button and one search result partial view. when user clicks button, it will use get request to filter the data with paging. for the tabular data the last column is "delete" link, currently delete functionality is working fine by using jquery ajax post, but I jus...
What I've done in the past is keep an instance of my filter/search criteria alive and pass it around as needed. In that scenario I used mostly AJAX calls to get and set data. So your criteria object in JavaScript may look like this (by default): var criteria = { name: {}, title: {}, pageSize: 10, currentPage: 1 }; Then...
MVC with Jquery ajax delete and how to keep the paging and other filter in the querystring? I am having a search page with one dropdown list box, one button and one search result partial view. when user clicks button, it will use get request to filter the data with paging. for the tabular data the last column is "delet...
TITLE: MVC with Jquery ajax delete and how to keep the paging and other filter in the querystring? QUESTION: I am having a search page with one dropdown list box, one button and one search result partial view. when user clicks button, it will use get request to filter the data with paging. for the tabular data the las...
[ "jquery", "asp.net-mvc-3" ]
0
1
740
1
0
2011-06-02T12:39:55.920000
2011-06-03T09:50:49.973000
6,214,625
6,214,674
JSONObject etc instantiation crashing
I am trying to learn how to use JSON and writing a simple program however whenever I instantiate a JSON Object it crashes. What am I missing if I receive this error when trying to instantiate a JSONObject or JSONArray. I have added http://sourceforge.net/projects/json-lib/files/ this JSON library to the build path. Is ...
A simple way to do this would be to use findjar to find the jar containing missing class for you and add it to you lib folder.
JSONObject etc instantiation crashing I am trying to learn how to use JSON and writing a simple program however whenever I instantiate a JSON Object it crashes. What am I missing if I receive this error when trying to instantiate a JSONObject or JSONArray. I have added http://sourceforge.net/projects/json-lib/files/ th...
TITLE: JSONObject etc instantiation crashing QUESTION: I am trying to learn how to use JSON and writing a simple program however whenever I instantiate a JSON Object it crashes. What am I missing if I receive this error when trying to instantiate a JSONObject or JSONArray. I have added http://sourceforge.net/projects/...
[ "java", "json" ]
1
1
7,381
3
0
2011-06-02T12:40:15.703000
2011-06-02T12:44:53.853000
6,214,629
6,214,794
stdout and need to flush it C++
I have some C++ code that uses cout statements for debug purposes and for some reason I can't get all the data to print unless I do a std::cout.flush(); at the end. I don't quite understand why this flush operation is needed. Anyone have any insight?
To add to the other answers: your debugging statements should instead go to cerr, because: it writes to the standard error, which means that, running the application, you can easily separate the "normal" program output from the errors/debug information via redirection; most importantly, cerr by default is unbuffered, w...
stdout and need to flush it C++ I have some C++ code that uses cout statements for debug purposes and for some reason I can't get all the data to print unless I do a std::cout.flush(); at the end. I don't quite understand why this flush operation is needed. Anyone have any insight?
TITLE: stdout and need to flush it C++ QUESTION: I have some C++ code that uses cout statements for debug purposes and for some reason I can't get all the data to print unless I do a std::cout.flush(); at the end. I don't quite understand why this flush operation is needed. Anyone have any insight? ANSWER: To add to ...
[ "c++", "stdout", "flush" ]
26
22
46,702
7
0
2011-06-02T12:40:36.083000
2011-06-02T12:56:57.410000
6,214,645
6,214,729
Rails help model design problem
I am having that problem when I update my konkurrencer the do_foobar is called. The problem is that the konkurrancer have no ratings. And I get a off course a ZeroDivisionerror. What is the best solution to solve this kind of problem? My model: before_update:do_foobar def do_foobar self.rating = (rating_score/ratings) ...
self.rating = (ratings == 0)? nil: rating_score/ratings or self.rating = rating_score/ratings rescue nil
Rails help model design problem I am having that problem when I update my konkurrencer the do_foobar is called. The problem is that the konkurrancer have no ratings. And I get a off course a ZeroDivisionerror. What is the best solution to solve this kind of problem? My model: before_update:do_foobar def do_foobar self....
TITLE: Rails help model design problem QUESTION: I am having that problem when I update my konkurrencer the do_foobar is called. The problem is that the konkurrancer have no ratings. And I get a off course a ZeroDivisionerror. What is the best solution to solve this kind of problem? My model: before_update:do_foobar d...
[ "ruby-on-rails", "ruby", "ruby-on-rails-3" ]
0
4
81
5
0
2011-06-02T12:42:24.033000
2011-06-02T12:51:11.533000
6,214,660
6,215,153
json format from rails to sproutcore
For those of you using Rails as a backend to their Sproutcore clients, which one is the best way to format the data into json? From the Sproutcore guides there was this approach: def as_json(options = {}) event_hash = { "guid" => self.id, "id" => self.id, "designation" => self.designation, "category" => self.category, ...
On the first method you need to call super: def as_json(options = {}) event_hash = { "guid" => self.id, "id" => self.id, "designation" => self.designation, "category" => self.category, "scheduled_for" => self.scheduled_for, "location" => self.location, "groups" => self.groups, "resources" => self.resources } super(eve...
json format from rails to sproutcore For those of you using Rails as a backend to their Sproutcore clients, which one is the best way to format the data into json? From the Sproutcore guides there was this approach: def as_json(options = {}) event_hash = { "guid" => self.id, "id" => self.id, "designation" => self.desig...
TITLE: json format from rails to sproutcore QUESTION: For those of you using Rails as a backend to their Sproutcore clients, which one is the best way to format the data into json? From the Sproutcore guides there was this approach: def as_json(options = {}) event_hash = { "guid" => self.id, "id" => self.id, "designat...
[ "ruby-on-rails", "json", "sproutcore" ]
0
1
208
1
0
2011-06-02T12:43:28.743000
2011-06-02T13:26:41.233000
6,214,668
6,214,689
C++ MFC Integer Textfields Always Set to 0?
I'm creating a preferences form in VC++ MFC, and I have several textfields that only accept integers. I'm new to MFC, so this is how I found to initialize them in some tutorial: CProgramDlg::CProgramDlg(CWnd* pParent /*=NULL*/): CDialog(CProgramDlg::IDD, pParent), m_nSampleValue1(), m_nSampleValue2()... m_nSampleValueN...
m_nSampleValue1() and m_nSampleValue2() are value-initialized. If its primitive types, then that means they will be zero-initialized. Is there a trick to getting the textboxes to just be empty without showing a 0? If its integral type, then I think that isn't possible without changing other part of the code (which part...
C++ MFC Integer Textfields Always Set to 0? I'm creating a preferences form in VC++ MFC, and I have several textfields that only accept integers. I'm new to MFC, so this is how I found to initialize them in some tutorial: CProgramDlg::CProgramDlg(CWnd* pParent /*=NULL*/): CDialog(CProgramDlg::IDD, pParent), m_nSampleVa...
TITLE: C++ MFC Integer Textfields Always Set to 0? QUESTION: I'm creating a preferences form in VC++ MFC, and I have several textfields that only accept integers. I'm new to MFC, so this is how I found to initialize them in some tutorial: CProgramDlg::CProgramDlg(CWnd* pParent /*=NULL*/): CDialog(CProgramDlg::IDD, pPa...
[ "c++", "visual-c++", "mfc", "initialization", "integer" ]
2
3
178
1
0
2011-06-02T12:44:13.300000
2011-06-02T12:47:13.073000
6,214,682
6,214,695
If I have a favicon, do I need to link to it?
I have a Favicon and in my page I have something like: This works fine. But inspired by the book "Ultra Fast asp" I am trying to remove all the small bits that are not necessary. I read a lot about browsers looking for favicon.ico anyway. (People complaining about 404 errors if they do not have a favicon). So I was won...
Using the explicit link syntax allows you to use different icons on different pages, and to have icon support on the browsers that do not automatically download the favicon.ico that is in the root of the site. If you only ever use one icon on a website and don't care about browsers that do not automatically download th...
If I have a favicon, do I need to link to it? I have a Favicon and in my page I have something like: This works fine. But inspired by the book "Ultra Fast asp" I am trying to remove all the small bits that are not necessary. I read a lot about browsers looking for favicon.ico anyway. (People complaining about 404 error...
TITLE: If I have a favicon, do I need to link to it? QUESTION: I have a Favicon and in my page I have something like: This works fine. But inspired by the book "Ultra Fast asp" I am trying to remove all the small bits that are not necessary. I read a lot about browsers looking for favicon.ico anyway. (People complaini...
[ "asp.net", "performance", "favicon" ]
2
5
327
3
0
2011-06-02T12:46:02.060000
2011-06-02T12:47:43.063000
6,214,690
6,214,782
Should I expect POSIX to include getopt.h?
According to this, the POSIX library does not include getopt.h. However, I found this in unistd.h: #ifdef __USE_POSIX2 /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. */ # define __need_getopt # include #endif Does this m...
__USE_POSIX2 is an implementation detail of glibc; it corresponds to _POSIX_C_SOURCE >= 2 or _XOPEN_SOURCE being defined. These are also implied by _GNU_SOURCE, and are used implicitly unless strict ANSI mode is on. You are not supposed to define the __USE_ macros directly. Since it corresponds to a value >= 2, it does...
Should I expect POSIX to include getopt.h? According to this, the POSIX library does not include getopt.h. However, I found this in unistd.h: #ifdef __USE_POSIX2 /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. */ # define...
TITLE: Should I expect POSIX to include getopt.h? QUESTION: According to this, the POSIX library does not include getopt.h. However, I found this in unistd.h: #ifdef __USE_POSIX2 /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in...
[ "posix", "getopt-long" ]
3
3
943
2
0
2011-06-02T12:47:15.257000
2011-06-02T12:55:50.940000
6,214,701
6,215,097
C# binary data from port convert to hex string
I found a source code and changed it a little bit so i can retrieve data from a receiver that is on com6. The data i am receiving is binary. Now I want to convert it to a hex string. If it's a hex string we can cut parts of the string and decode them seperately. how can i do this? The following is the code: using Syste...
Try this string Data = "123"; string hex = ""; foreach (char c in Data) { hex += String.Format("{0:x2}", (byte)c); } hex contains string as you wanted
C# binary data from port convert to hex string I found a source code and changed it a little bit so i can retrieve data from a receiver that is on com6. The data i am receiving is binary. Now I want to convert it to a hex string. If it's a hex string we can cut parts of the string and decode them seperately. how can i ...
TITLE: C# binary data from port convert to hex string QUESTION: I found a source code and changed it a little bit so i can retrieve data from a receiver that is on com6. The data i am receiving is binary. Now I want to convert it to a hex string. If it's a hex string we can cut parts of the string and decode them sepe...
[ "c#", "binary", "hex", "port" ]
1
3
2,958
2
0
2011-06-02T12:48:05.587000
2011-06-02T13:22:20.560000
6,214,702
6,214,846
Initialize window handle for form and child controls without displaying
Is there a way to programmatically force a form and all of its child controls to have window handles without it being visible? It looked like CreateControl would do it, but that only seems to work if the control is visible. Requesting the handle of the form gives the form a handle, but doesn't give handles to all child...
I don't understand why you don't like iterating. It seems like a good solution to me. I'd take the opportunity to build a reusable recursive control iterator. However, if you don't want to do that then you can try a simple variant on your current solution. Before you make the form visible set its position so that it do...
Initialize window handle for form and child controls without displaying Is there a way to programmatically force a form and all of its child controls to have window handles without it being visible? It looked like CreateControl would do it, but that only seems to work if the control is visible. Requesting the handle of...
TITLE: Initialize window handle for form and child controls without displaying QUESTION: Is there a way to programmatically force a form and all of its child controls to have window handles without it being visible? It looked like CreateControl would do it, but that only seems to work if the control is visible. Reques...
[ "c#", "winforms", "handle" ]
4
1
2,349
2
0
2011-06-02T12:48:08.190000
2011-06-02T13:02:06.583000
6,214,703
6,214,736
Copy entire directory contents to another directory?
Method to copy entire directory contents to another directory in java or groovy?
FileUtils.copyDirectory() Copies a whole directory to a new location preserving the file dates. This method copies the specified directory and all its child directories and files to the specified destination. The destination is the new location and name of the directory. The destination directory is created if it does ...
Copy entire directory contents to another directory? Method to copy entire directory contents to another directory in java or groovy?
TITLE: Copy entire directory contents to another directory? QUESTION: Method to copy entire directory contents to another directory in java or groovy? ANSWER: FileUtils.copyDirectory() Copies a whole directory to a new location preserving the file dates. This method copies the specified directory and all its child di...
[ "java", "grails", "file-io", "groovy" ]
90
124
192,460
10
0
2011-06-02T12:48:11.237000
2011-06-02T12:51:40.327000
6,214,709
6,214,825
MySQL Text formatting
Hej guys, I wrote a little php script which access a database and simply displays the rows which where found for a given query. It echos a table with them but it seems there are some typeset errors resulting in questionsmarks. Any hint what I could do to solve this? Here's a screenshot: Text Formatting"> Here's the cod...
I suggest you to use UTF-8 charset. You should make your table/colunmn charset to utf8_general_ci And then in your PHP script launch as first query SET NAMES 'utf-8'
MySQL Text formatting Hej guys, I wrote a little php script which access a database and simply displays the rows which where found for a given query. It echos a table with them but it seems there are some typeset errors resulting in questionsmarks. Any hint what I could do to solve this? Here's a screenshot: Text Forma...
TITLE: MySQL Text formatting QUESTION: Hej guys, I wrote a little php script which access a database and simply displays the rows which where found for a given query. It echos a table with them but it seems there are some typeset errors resulting in questionsmarks. Any hint what I could do to solve this? Here's a scre...
[ "php", "mysql", "types", "type-conversion" ]
0
1
345
2
0
2011-06-02T12:49:19.520000
2011-06-02T13:00:07.457000
6,214,715
6,221,665
How i add image map in joomla article?
I have to give link to multiple parts of the image.so please tell me how i can do it in joomla1.5.22.
You are using JCE as your WYSIWYG editor right? If not, start by adding that. It's free and way better than TinyMCE. Once you have JCE installed, go to Components > JCE > Configuration and add map[name],area[shape|coords|href|alt|title] to the extended elements. Now you will be able to add the map code without losing i...
How i add image map in joomla article? I have to give link to multiple parts of the image.so please tell me how i can do it in joomla1.5.22.
TITLE: How i add image map in joomla article? QUESTION: I have to give link to multiple parts of the image.so please tell me how i can do it in joomla1.5.22. ANSWER: You are using JCE as your WYSIWYG editor right? If not, start by adding that. It's free and way better than TinyMCE. Once you have JCE installed, go to ...
[ "joomla1.5" ]
2
1
2,991
1
0
2011-06-02T12:49:59.297000
2011-06-02T23:54:33.710000
6,214,721
6,214,976
Delete a cell array column
Placed simple values into the cell array for testing. model{1,1}=1;model{1,2}=2;model{1,3}=3; model{2,1}=4;model{2,2}=5;model{2,3}=6; i=2;//I want to remove the second column temp={ model{:,1:i-1} model{:,i+1:size(model,2)} } I wanted a result like this: temp = [1] [3] [4] [6] But I'm getting this: temp = [1] [4] [3] ...
You can reshape or delete the cells themselves using ()-addressing. model(:,2) = [];
Delete a cell array column Placed simple values into the cell array for testing. model{1,1}=1;model{1,2}=2;model{1,3}=3; model{2,1}=4;model{2,2}=5;model{2,3}=6; i=2;//I want to remove the second column temp={ model{:,1:i-1} model{:,i+1:size(model,2)} } I wanted a result like this: temp = [1] [3] [4] [6] But I'm gettin...
TITLE: Delete a cell array column QUESTION: Placed simple values into the cell array for testing. model{1,1}=1;model{1,2}=2;model{1,3}=3; model{2,1}=4;model{2,2}=5;model{2,3}=6; i=2;//I want to remove the second column temp={ model{:,1:i-1} model{:,i+1:size(model,2)} } I wanted a result like this: temp = [1] [3] [4] ...
[ "matlab", "cell-array" ]
3
10
12,420
3
0
2011-06-02T12:50:16.833000
2011-06-02T13:13:58.703000
6,214,743
6,215,113
Create new file from templates with bash script
I have to create conf files and init.d which are very similar. These files permit to deploy new HTTP service on my servers. These files are the same and only some parameters change from one file to another ( listen_port, domain, and path on server.) As any error in these files leads to dysfunction of service I would li...
You can do this using a heredoc. e.g. generate.sh: #!/bin/sh #define parameters which are passed in. PORT=$1 DOMAIN=$2 #define the template. cat << EOF This is my template. Port is $PORT Domain is $DOMAIN EOF Output: $ generate.sh 8080 domain.example This is my template. Port is 8080 Domain is domain.example or save...
Create new file from templates with bash script I have to create conf files and init.d which are very similar. These files permit to deploy new HTTP service on my servers. These files are the same and only some parameters change from one file to another ( listen_port, domain, and path on server.) As any error in these ...
TITLE: Create new file from templates with bash script QUESTION: I have to create conf files and init.d which are very similar. These files permit to deploy new HTTP service on my servers. These files are the same and only some parameters change from one file to another ( listen_port, domain, and path on server.) As a...
[ "bash", "templates", "configuration", "template-engine" ]
66
106
82,783
12
0
2011-06-02T12:52:08.957000
2011-06-02T13:23:54.930000
6,214,746
6,214,847
Calculate the total value of the Widgets sold each month for a particular year
If I have a Django Model that defines a Widget like this: class Widget(models.Model): type = models.CharField() sold = models.DateTimeField() price = models.DecimalField().. How would I go about getting the total value of the Widgets sold per month for a particular year? I'd like to end up with a list of 12 monthly tot...
based on this answer you could do. Widget.objects.extra(select={'year': "EXTRACT(year FROM sold)", 'month': "EXTRACT(month from sold)"}).values('year', 'month').annotate(Sum('price')) would give you something like [{'price__sum': 1111, 'year': 2010L, 'month': 6L}...] Edit - without using EXTRACT probably not very effic...
Calculate the total value of the Widgets sold each month for a particular year If I have a Django Model that defines a Widget like this: class Widget(models.Model): type = models.CharField() sold = models.DateTimeField() price = models.DecimalField().. How would I go about getting the total value of the Widgets sold pe...
TITLE: Calculate the total value of the Widgets sold each month for a particular year QUESTION: If I have a Django Model that defines a Widget like this: class Widget(models.Model): type = models.CharField() sold = models.DateTimeField() price = models.DecimalField().. How would I go about getting the total value of t...
[ "python", "django" ]
0
0
520
2
0
2011-06-02T12:52:16.710000
2011-06-02T13:02:10.653000
6,214,756
6,214,812
How can i put two different threads on a single service?
can someone give me the code example that shows how to use two different threads on a single service? i didnt find the way to do it in google, then i need a code example... one waiting 5 seconds and the other waiting 60 seconds, with different code
Thread t5 = new Thread(Runnable_that_waits_5_seconds); Thread t60 = new Thread(Runnable_that_waits_60_seconds); t5.start(); t60;start(); Now you just need to define your runnables. Also, you should give your runnables a way to detect that they've been interrupted and terminate if they do, and interrupt each thread in y...
How can i put two different threads on a single service? can someone give me the code example that shows how to use two different threads on a single service? i didnt find the way to do it in google, then i need a code example... one waiting 5 seconds and the other waiting 60 seconds, with different code
TITLE: How can i put two different threads on a single service? QUESTION: can someone give me the code example that shows how to use two different threads on a single service? i didnt find the way to do it in google, then i need a code example... one waiting 5 seconds and the other waiting 60 seconds, with different c...
[ "android", "multithreading", "service" ]
1
1
197
2
0
2011-06-02T12:53:27.393000
2011-06-02T12:58:55.583000
6,214,763
6,215,222
Connect to Oracle in remote server with .NET
In Visual Studio 2010 I select Add new connection and then I choose Oracle server. Then I choose Oracle provider for.Net, and this window comes. I wonder what I should write in the Data Source text field if the Oracle database is at a server with name AZSSRV and IP address 172.117.17.1? Any help will be appreciated.
Your entries from TNSNames.ora should appear here and you would select the one that you need to use. Since the drop down does not seem to be working, it would indicate that VS2010 cannot find your Oracle home. An easy solution to this is to create an environmental variable called TNS_ADMIN and place the path to the TNS...
Connect to Oracle in remote server with .NET In Visual Studio 2010 I select Add new connection and then I choose Oracle server. Then I choose Oracle provider for.Net, and this window comes. I wonder what I should write in the Data Source text field if the Oracle database is at a server with name AZSSRV and IP address 1...
TITLE: Connect to Oracle in remote server with .NET QUESTION: In Visual Studio 2010 I select Add new connection and then I choose Oracle server. Then I choose Oracle provider for.Net, and this window comes. I wonder what I should write in the Data Source text field if the Oracle database is at a server with name AZSSR...
[ "oracle", "visual-studio-2010", "database-connection" ]
1
1
2,129
2
0
2011-06-02T12:54:07.333000
2011-06-02T13:32:47.423000
6,214,766
6,214,809
Javascript json
does anyone know what this is not working? i have been trying for days now. function loadContent(obj, getcmt) { var params = $(obj).attr('href').split('?'); $.get(BASE_DIR+'content/load.php?'+params[1], function(json) { var result = eval('('+json+')'); if (result.returnval == 1) { $('#content').fadeOut('fast', functio...
Try it using jQuery's built-in tools: function loadContent(obj, getcmt) { var params = $(obj).attr('href').split('?'); $.getJSON(BASE_DIR+'content/load.php?'+params[1], function(json) { if (json.returnval == 1) { $('#content').fadeOut('fast', function() { $(this).html(json.content).fadeIn('slow'); }); } }); return fals...
Javascript json does anyone know what this is not working? i have been trying for days now. function loadContent(obj, getcmt) { var params = $(obj).attr('href').split('?'); $.get(BASE_DIR+'content/load.php?'+params[1], function(json) { var result = eval('('+json+')'); if (result.returnval == 1) { $('#content').fadeOut...
TITLE: Javascript json QUESTION: does anyone know what this is not working? i have been trying for days now. function loadContent(obj, getcmt) { var params = $(obj).attr('href').split('?'); $.get(BASE_DIR+'content/load.php?'+params[1], function(json) { var result = eval('('+json+')'); if (result.returnval == 1) { $('...
[ "php", "javascript", "json" ]
1
1
155
1
0
2011-06-02T12:54:23.997000
2011-06-02T12:58:46.197000
6,214,775
6,223,393
How to let ListBox scroll smoothly
There is a listbox with the following ItemContainerStyle, it's binding to the ViewModel class but when scroll the listbox its performance not smooth. I check this on the web, and I replaced the visualstackpanel with normal stackpanel in the listbox. Yes, it scrolls smoothly, but it freezes when the data is loading. Is ...
Think about pushing some of the work off into a thread, use Observable collections and try using Virtualized Lists in the UI to aid in the some of the speed issues. This helped me a little. http://blog.landdolphin.net/?p=78
How to let ListBox scroll smoothly There is a listbox with the following ItemContainerStyle, it's binding to the ViewModel class but when scroll the listbox its performance not smooth. I check this on the web, and I replaced the visualstackpanel with normal stackpanel in the listbox. Yes, it scrolls smoothly, but it fr...
TITLE: How to let ListBox scroll smoothly QUESTION: There is a listbox with the following ItemContainerStyle, it's binding to the ViewModel class but when scroll the listbox its performance not smooth. I check this on the web, and I replaced the visualstackpanel with normal stackpanel in the listbox. Yes, it scrolls s...
[ "windows-phone-7", "listbox", "smoothing" ]
1
1
1,174
3
0
2011-06-02T12:55:11.233000
2011-06-03T05:41:41.440000
6,214,791
6,214,859
How to wait for onPaint to finish painting (C#)
Hi based on the thread here: How to create a jpg image dynamically in memory with.NET? I have this method: int maxVal = 50; int maxXCells = r.Next(maxVal); int maxYCells = r.Next(maxVal); int cellXPosition = r.Next(maxVal); int cellYPosition = r.Next(maxVal); int boxSize = 10; Graphics fg = this.CreateGraphics(); usi...
The event handlers all run in the main thread of the application, so it's not possible that a method to handle an event is started before the method that handles the previous event is finished. If you experience flickering, it's not because of overlapping event handlers.
How to wait for onPaint to finish painting (C#) Hi based on the thread here: How to create a jpg image dynamically in memory with.NET? I have this method: int maxVal = 50; int maxXCells = r.Next(maxVal); int maxYCells = r.Next(maxVal); int cellXPosition = r.Next(maxVal); int cellYPosition = r.Next(maxVal); int boxSize ...
TITLE: How to wait for onPaint to finish painting (C#) QUESTION: Hi based on the thread here: How to create a jpg image dynamically in memory with.NET? I have this method: int maxVal = 50; int maxXCells = r.Next(maxVal); int maxYCells = r.Next(maxVal); int cellXPosition = r.Next(maxVal); int cellYPosition = r.Next(max...
[ "c#", "gdi", "system.drawing" ]
2
3
4,800
3
0
2011-06-02T12:56:38.017000
2011-06-02T13:03:13.540000
6,214,819
6,215,353
Trying to play with the annotation and bubble callout on mkmapview
I am developing an application in iphone which deals with maps. I have many annotations. I need different images to be loaded in the callout bubble.It mean user can edit the callout it may be image and He also type text on callout bubble.How can I give give multiple action on the callout bubble. And most important thin...
The second half of your question isn't very clear but I'll try and answer the first. The only real customisation you can apply to the callout view for an MKAnnotation is to set the Title, subtitle labels and the left/right calloutAccessoryViews. You can set the latter to images or callOutAccessoryViewIndicators, or ano...
Trying to play with the annotation and bubble callout on mkmapview I am developing an application in iphone which deals with maps. I have many annotations. I need different images to be loaded in the callout bubble.It mean user can edit the callout it may be image and He also type text on callout bubble.How can I give ...
TITLE: Trying to play with the annotation and bubble callout on mkmapview QUESTION: I am developing an application in iphone which deals with maps. I have many annotations. I need different images to be loaded in the callout bubble.It mean user can edit the callout it may be image and He also type text on callout bubb...
[ "iphone", "objective-c", "mkmapview" ]
0
3
578
1
0
2011-06-02T12:59:31.590000
2011-06-02T13:43:18.997000
6,214,831
6,214,865
Enable incoming connections from specified IP-address only
I have a server application with a listening socket opened on a specific IP port. How can I allow the socket to enable incoming connections from just one specified IP address?
You'll have to either use some firewall software to restrict incoming requests to that port, or shut down accepted connections that you do not want to service (based on the socket address returned by accept ). There might be libraries out there that do that for you, but the socket API doesn't have anything to do it aut...
Enable incoming connections from specified IP-address only I have a server application with a listening socket opened on a specific IP port. How can I allow the socket to enable incoming connections from just one specified IP address?
TITLE: Enable incoming connections from specified IP-address only QUESTION: I have a server application with a listening socket opened on a specific IP port. How can I allow the socket to enable incoming connections from just one specified IP address? ANSWER: You'll have to either use some firewall software to restri...
[ "c++", "c", "linux", "sockets" ]
2
8
490
4
0
2011-06-02T13:00:35.087000
2011-06-02T13:03:57.157000
6,214,832
6,214,874
Web Applications Converted To Desktop Applications
I have been reading some of the posts here, but haven't really seen the answers to my questions directly. I am a web developer and need to integrate some of my web applications to some sort of desktop application. For example, say a business has some kind of booking, it needs to be available offline (desktop in office/...
I discourage to use PHP as desktop application. You should sepearte the 2 appliaction. Web app using PHP Desktop app using Java (or whatever you want) In your desktop app you should provide a "journaled" system that can save all the actions users make offline and upload it when the users go online (or when the users wa...
Web Applications Converted To Desktop Applications I have been reading some of the posts here, but haven't really seen the answers to my questions directly. I am a web developer and need to integrate some of my web applications to some sort of desktop application. For example, say a business has some kind of booking, i...
TITLE: Web Applications Converted To Desktop Applications QUESTION: I have been reading some of the posts here, but haven't really seen the answers to my questions directly. I am a web developer and need to integrate some of my web applications to some sort of desktop application. For example, say a business has some ...
[ "php", "mysql", "web-applications", "desktop-application" ]
3
0
1,761
3
0
2011-06-02T13:00:42.307000
2011-06-02T13:04:17.863000
6,214,834
6,214,903
Javascript invalid label error
I am sorry if this question is a repeat of someother. I have looked into some of them but they don't answer my particular question. I get an "invalid label" error where I am printing my alert statement in the code below: $(document).ready( function(){ if( $('map#map').length > 0 ){ //alert('found a map!'); $('map#map a...
You have a colon at the end of the statement. Change that to a semicolon. Also, you have an extra parameter $area in the each method, which is not supported. If you remove that, the code will run.
Javascript invalid label error I am sorry if this question is a repeat of someother. I have looked into some of them but they don't answer my particular question. I get an "invalid label" error where I am printing my alert statement in the code below: $(document).ready( function(){ if( $('map#map').length > 0 ){ //aler...
TITLE: Javascript invalid label error QUESTION: I am sorry if this question is a repeat of someother. I have looked into some of them but they don't answer my particular question. I get an "invalid label" error where I am printing my alert statement in the code below: $(document).ready( function(){ if( $('map#map').le...
[ "javascript", "jquery", "label" ]
0
2
2,212
3
0
2011-06-02T13:00:49.940000
2011-06-02T13:07:04.583000
6,214,837
6,215,051
step by step tutorial for using slim fitnesse in .net
anybody knows some step by step tutorial for using slim fitnesse in.net? for now I managed to run the slim fitnesse website on my localhost:3434 and I unziped the fitSharp plugin in c:/fitSharp but I have no idea what's next
in your case this will be useful: http://fitsharp.github.com/Slim/GettingStarted.html else you should consider: http://schuchert.wikispaces.com/Acceptance+Testing.UsingSlimDotNetInFitNesse
step by step tutorial for using slim fitnesse in .net anybody knows some step by step tutorial for using slim fitnesse in.net? for now I managed to run the slim fitnesse website on my localhost:3434 and I unziped the fitSharp plugin in c:/fitSharp but I have no idea what's next
TITLE: step by step tutorial for using slim fitnesse in .net QUESTION: anybody knows some step by step tutorial for using slim fitnesse in.net? for now I managed to run the slim fitnesse website on my localhost:3434 and I unziped the fitSharp plugin in c:/fitSharp but I have no idea what's next ANSWER: in your case t...
[ ".net", "unit-testing", "automated-tests", "fitnesse", "fitnesse-slim" ]
7
6
6,567
2
0
2011-06-02T13:01:06.900000
2011-06-02T13:19:24.530000
6,214,845
6,214,988
Taking details from a map and saving it into another?
I have a map like this map, string> > what is the easiest way to get only the two strings and save into another map like this map? I mean is there another way other than something like this?? map, string> > info; map, string> >::iterator i; map something; for(i=info.begin(); i!=info.end(); ++i) something[*i).first] = ...
First, I'd define a proper type: struct Mapped { int someSignificantName; int anotherName; std::string yetAnother; }; There are almost no cases where std::pair is an acceptable solution (except for quick hacks and tests). Given that, you define a mapping functional object: struct Remap: std::unary_operator, std::pair >...
Taking details from a map and saving it into another? I have a map like this map, string> > what is the easiest way to get only the two strings and save into another map like this map? I mean is there another way other than something like this?? map, string> > info; map, string> >::iterator i; map something; for(i=inf...
TITLE: Taking details from a map and saving it into another? QUESTION: I have a map like this map, string> > what is the easiest way to get only the two strings and save into another map like this map? I mean is there another way other than something like this?? map, string> > info; map, string> >::iterator i; map som...
[ "c++", "stl", "dictionary" ]
0
2
98
3
0
2011-06-02T13:01:52.153000
2011-06-02T13:14:48.713000
6,214,848
6,216,753
windows phone app how to intergrate video player using only c# code
in my application i want to navigate from a page which is extending Canvas to the video player for video player page i hav created one class and i m doing this there MediaElement videoPlayer = new MediaElement(); videoPlayer.Source = (new Uri("some video url", UriKind.Absolute)); videoPlayer.AutoPlay = true; videoPlaye...
You need to insert the MediaElement into your VisualTree. For example, if your canvas' name is LayoutRoot (the default), you could to this: LayoutRoot.Children.Add(videoPlayer);
windows phone app how to intergrate video player using only c# code in my application i want to navigate from a page which is extending Canvas to the video player for video player page i hav created one class and i m doing this there MediaElement videoPlayer = new MediaElement(); videoPlayer.Source = (new Uri("some vid...
TITLE: windows phone app how to intergrate video player using only c# code QUESTION: in my application i want to navigate from a page which is extending Canvas to the video player for video player page i hav created one class and i m doing this there MediaElement videoPlayer = new MediaElement(); videoPlayer.Source = ...
[ "windows-phone-7" ]
2
2
1,192
1
0
2011-06-02T13:02:18.187000
2011-06-02T15:35:26.413000
6,214,852
6,215,292
Add files to a ZIP archive?
What component or method can be used to specify a list of filenames and then zip them into a single archive? I dont need advanced features or anything really, but if I could add some filenames to a stringlist for example then put those files into a ZIP that would be good. Ive tried searching a few components but not su...
In addition to VCLZip that Chris mentioned, Abbrevia (one of the old TurboPower packages) is available for free at SourceForge. If you need Delphi 2010/XE versions, you can find those available at SongBeamer (if the changes haven't been incorporated into the SF tree yet). As I was well educated about in the comments to...
Add files to a ZIP archive? What component or method can be used to specify a list of filenames and then zip them into a single archive? I dont need advanced features or anything really, but if I could add some filenames to a stringlist for example then put those files into a ZIP that would be good. Ive tried searching...
TITLE: Add files to a ZIP archive? QUESTION: What component or method can be used to specify a list of filenames and then zip them into a single archive? I dont need advanced features or anything really, but if I could add some filenames to a stringlist for example then put those files into a ZIP that would be good. I...
[ "delphi", "zip", "archive" ]
5
6
1,938
3
0
2011-06-02T13:02:38.813000
2011-06-02T13:37:55.723000
6,214,861
6,215,031
function is not returning data
I have the following code var redis = require("redis"), client = redis.createClient(); var getuser = function(username) { var userhash={}; client.hgetall("users."+username, function(err, user) { userhash=user; }); return userhash; }; user_rahul = { username: 'rahul', queueno: 1, sessionId: '6604353811126202' }; user_...
You're mixing sync and async patterns when you make an async call in your sync getUser function. You need to make your getUser function async - e.g: var redis = require("redis"), client = redis.createClient(); var getuser = function(username, cb) { client.hgetall("users."+username, cb); }; user_rahul = { username: 'r...
function is not returning data I have the following code var redis = require("redis"), client = redis.createClient(); var getuser = function(username) { var userhash={}; client.hgetall("users."+username, function(err, user) { userhash=user; }); return userhash; }; user_rahul = { username: 'rahul', queueno: 1, sessionI...
TITLE: function is not returning data QUESTION: I have the following code var redis = require("redis"), client = redis.createClient(); var getuser = function(username) { var userhash={}; client.hgetall("users."+username, function(err, user) { userhash=user; }); return userhash; }; user_rahul = { username: 'rahul', qu...
[ "node.js", "redis", "serverside-javascript" ]
0
2
1,170
1
0
2011-06-02T13:03:27.923000
2011-06-02T13:18:07.453000
6,214,864
6,218,036
Periodically import data from files on Heroku
I need to periodically import some data into my rails app on Heroku. The task to execute is split into the following parts: * download a big zip file (e.g. ~100mb) from a website * unzip the file (unzipped space is ~1.50gb) * run a rake script that reads those file and create or update records using my active record mo...
I have tried exact same thing couple of days back and the conclusion that I came up with was this can't be done because of memory limit restrictions that heroku imposes on each process. (I build a data structure with the files that I read from the internet and try to push to DB) I was using a rake task that would pull ...
Periodically import data from files on Heroku I need to periodically import some data into my rails app on Heroku. The task to execute is split into the following parts: * download a big zip file (e.g. ~100mb) from a website * unzip the file (unzipped space is ~1.50gb) * run a rake script that reads those file and crea...
TITLE: Periodically import data from files on Heroku QUESTION: I need to periodically import some data into my rails app on Heroku. The task to execute is split into the following parts: * download a big zip file (e.g. ~100mb) from a website * unzip the file (unzipped space is ~1.50gb) * run a rake script that reads t...
[ "import", "cron", "heroku" ]
1
1
543
1
0
2011-06-02T13:03:54.950000
2011-06-02T17:33:31.477000