PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 30k | Tag1 stringlengths 1 25 ⌀ | Tag2 stringlengths 1 25 ⌀ | Tag3 stringlengths 1 25 ⌀ | Tag4 stringlengths 1 25 ⌀ | Tag5 stringlengths 1 25 ⌀ | PostClosedDate stringlengths 19 19 ⌀ | OpenStatus stringclasses 5 values | unified_texts stringlengths 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,464,943 | 12/16/2010 20:14:51 | 132,138 | 07/02/2009 07:50:41 | 62 | 3 | How to? Correct sql syntax for finding the next available identifier | I think I could use some help here from more experienced users...
I have an integer field name in a table, let's call it SO_ID in a table SO, and to each new row I need to calculate a new SO_ID based on the following rules<br>
1) SO_ID consists of 6 letters where first 3 are an area code, and the last three is the sequenced number within this area.
<br>309001<br>
309002<br>
309003<br>
2) so the next new row will have a SO_ID of value<br>
309004<br>
3) if someone deletes the row with SO_ID value = 309002, then the next new row must recycle this value, so the next new row has got to have the SO_ID of value<br>
309002
can anyone please provide me with either a SQL function or PL/SQL (perhaps a trigger straightaway?) function that would return the next available SO_ID I need to use ?
I reckon I could get use of keyword rownum in my sql, but the follwoing just doens't work properly
select max(so_id),max(rownum) from(
select (so_id),rownum,cast(substr(cast(so_id as varchar(6)),4,3) as int) from SO
where length(so_id)=6
and substr(cast(so_id as varchar(6)),1,3)='309'
and cast(substr(cast(so_id as varchar(6)),4,3) as int)=rownum
order by so_id
);
thank you for all your help! | sql | oracle | sql-syntax | null | null | null | open | How to? Correct sql syntax for finding the next available identifier
===
I think I could use some help here from more experienced users...
I have an integer field name in a table, let's call it SO_ID in a table SO, and to each new row I need to calculate a new SO_ID based on the following rules<br>
1) SO_ID consists of 6 letters where first 3 are an area code, and the last three is the sequenced number within this area.
<br>309001<br>
309002<br>
309003<br>
2) so the next new row will have a SO_ID of value<br>
309004<br>
3) if someone deletes the row with SO_ID value = 309002, then the next new row must recycle this value, so the next new row has got to have the SO_ID of value<br>
309002
can anyone please provide me with either a SQL function or PL/SQL (perhaps a trigger straightaway?) function that would return the next available SO_ID I need to use ?
I reckon I could get use of keyword rownum in my sql, but the follwoing just doens't work properly
select max(so_id),max(rownum) from(
select (so_id),rownum,cast(substr(cast(so_id as varchar(6)),4,3) as int) from SO
where length(so_id)=6
and substr(cast(so_id as varchar(6)),1,3)='309'
and cast(substr(cast(so_id as varchar(6)),4,3) as int)=rownum
order by so_id
);
thank you for all your help! | 0 |
602,364 | 03/02/2009 13:31:24 | 1,228 | 08/13/2008 13:58:55 | 11,281 | 545 | MICR in .NET | I'm looking for libraries, fonts, UI elements and other tools for working with MICRs in .NET.
Specifically, if you had to put E13B on a check stub, how would you do it? | .net | micr | null | null | null | 12/11/2011 17:01:57 | not constructive | MICR in .NET
===
I'm looking for libraries, fonts, UI elements and other tools for working with MICRs in .NET.
Specifically, if you had to put E13B on a check stub, how would you do it? | 4 |
960,032 | 06/06/2009 16:05:38 | 69,224 | 09/25/2008 13:16:11 | 723 | 45 | Close application from captive IE session. | Folks,
My question is: **Can this be done better?** and if so, How? Any ideas?
We need to start a captive IE session from within an "invisible" C# .NET 3.5 application, and quit both the IE session and the "parent" application after processing a certain request.
I've been mucking around with this problem for the last week or so... and this morning I've finally reached what I think is a robust solution; but I'm a bit of a C# noob (though I've been a professional programmer for 10 years), so I'm seeking a second or third opinion; and any other options, critiques, suggestions, or comments... Especially: is SHDocVw still the preferred method of creating a "captive but not imbedded" Internet Explorer session?
As I see things, the tricky bit is Disposing of the unmanaged *InternetExplorerApplication* COM object, so I've wrapped it in an *IDisposable* class called *InternetExplorer*
My basic approach is:
1. Application.Run MyApp, which is-a ApplicationContext, and is IQuitable.
- I think an app is needed to keep the program open whilste we wait for the IE request?
- I guess maybe a (non-daemon) listener-loop thread might also work?
2. MyApp's constructor creates a new *InternetExporer* object passing (IQuitable)this
3. *InternetExporer*'s constructor starts a new IE session, and navigates it to a URL.
4. When a certain URL is requested *InternetExporer* calls-back the "parents" Quit method.
**Background:**
The real story is: I'm writing a plugin for [MapInfo][1] (A [GIS][2] Client). The plugin hijacks the "Start Extraction" HTTP request from IE to the server, modifies the URL slightly and sends a HTTPRequest in it's place... we parse the respose XML into [MIF files][3] [PDF 196K], which we then import and open in MapInfo. Then we quit the IE session, **and close the "plugin" application.**
**SSCCE**
using System;
using System.Windows.Forms;
// IE COM interface
// reference ~ C:\Windows\System32\SHDocVw.dll
using SHDocVw;
namespace QuitAppFromCaptiveIE
{
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MyApp());
}
}
interface IQuitable {
void Quit();
}
public class MyApp : ApplicationContext, IQuitable {
private InternetExplorer ie = null;
public MyApp() {
// create a new Internet Explorer COM component - starts IE application.
this.ie = new InternetExplorer(this);
this.ie.Open("www.microsoft.com");
}
#region IQuitable Members
public void Quit() {
if (ie != null) {
ie.Dispose();
ie = null;
}
Application.Exit();
}
#endregion
}
class InternetExplorer : IDisposable, IQuitable
{
// allows us to end the parent application when IE is closed.
private IQuitable parent;
private bool _parentIsQuited = false;
private bool _ieIsQuited = false;
private SHDocVw.InternetExplorer ie; // Old (VB4 era) IE COM component
public InternetExplorer(IQuitable parent) {
// lock-onto the parent app to quit it when IE is closed.
this.parent = parent;
// create a new Internet Explorer COM component - starts IE application.
this.ie = new SHDocVw.InternetExplorerClass();
// hook-up our navigate-event interceptor
ie.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(ie_BeforeNavigate2);
}
public void Open(string url) {
object o = null;
// make the captive IE session navigate to the given URL.
ie.Navigate(url, ref o, ref o, ref o, ref o);
// now make the ie window visible
ie.Visible = true;
}
// this callback event handler is invoked prior to the captive IE
// session navigating (opening) a URL. Navigate-TWO handles both
// external (normal) and internal (AJAX) requests.
// For example: You could create a history-log file of every page
// visited by each captive session.
// Being fired BEFORE the actual navigation allows you to hijack
// (ie intercept) requests to certain URLs; in this case a request
// to http://support.microsoft.com/ terminates the Browser session
// and this program!
void ie_BeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel) {
if (URL.Equals("http://support.microsoft.com/")) {
this.Quit();
}
}
#region IDisposable Members
public void Dispose() {
quitIE();
}
#endregion
private void quitIE() {
// close my unmanaged COM object
if (ie != null && !_ieIsQuited) {
_ieIsQuited = true;
ie.Quit();
ie = null;
}
}
#region IQuitable Members
public void Quit() {
// close my unmanaged COM object
quitIE();
// quit the parent app as well.
if (parent != null && !_parentIsQuited) {
_parentIsQuited = true;
parent.Quit();
parent = null;
}
}
#endregion
}
}
Thanks y'all. Cheers. Keith.
[1]: http://www.mapinfo.com/
[2]: http://www.gis.com/whatisgis/
[3]: http://www.directionsmag.com/mapinfo-l/mif/AppJ.pdf
| c# | internet-explorer | close | dispose | null | null | open | Close application from captive IE session.
===
Folks,
My question is: **Can this be done better?** and if so, How? Any ideas?
We need to start a captive IE session from within an "invisible" C# .NET 3.5 application, and quit both the IE session and the "parent" application after processing a certain request.
I've been mucking around with this problem for the last week or so... and this morning I've finally reached what I think is a robust solution; but I'm a bit of a C# noob (though I've been a professional programmer for 10 years), so I'm seeking a second or third opinion; and any other options, critiques, suggestions, or comments... Especially: is SHDocVw still the preferred method of creating a "captive but not imbedded" Internet Explorer session?
As I see things, the tricky bit is Disposing of the unmanaged *InternetExplorerApplication* COM object, so I've wrapped it in an *IDisposable* class called *InternetExplorer*
My basic approach is:
1. Application.Run MyApp, which is-a ApplicationContext, and is IQuitable.
- I think an app is needed to keep the program open whilste we wait for the IE request?
- I guess maybe a (non-daemon) listener-loop thread might also work?
2. MyApp's constructor creates a new *InternetExporer* object passing (IQuitable)this
3. *InternetExporer*'s constructor starts a new IE session, and navigates it to a URL.
4. When a certain URL is requested *InternetExporer* calls-back the "parents" Quit method.
**Background:**
The real story is: I'm writing a plugin for [MapInfo][1] (A [GIS][2] Client). The plugin hijacks the "Start Extraction" HTTP request from IE to the server, modifies the URL slightly and sends a HTTPRequest in it's place... we parse the respose XML into [MIF files][3] [PDF 196K], which we then import and open in MapInfo. Then we quit the IE session, **and close the "plugin" application.**
**SSCCE**
using System;
using System.Windows.Forms;
// IE COM interface
// reference ~ C:\Windows\System32\SHDocVw.dll
using SHDocVw;
namespace QuitAppFromCaptiveIE
{
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MyApp());
}
}
interface IQuitable {
void Quit();
}
public class MyApp : ApplicationContext, IQuitable {
private InternetExplorer ie = null;
public MyApp() {
// create a new Internet Explorer COM component - starts IE application.
this.ie = new InternetExplorer(this);
this.ie.Open("www.microsoft.com");
}
#region IQuitable Members
public void Quit() {
if (ie != null) {
ie.Dispose();
ie = null;
}
Application.Exit();
}
#endregion
}
class InternetExplorer : IDisposable, IQuitable
{
// allows us to end the parent application when IE is closed.
private IQuitable parent;
private bool _parentIsQuited = false;
private bool _ieIsQuited = false;
private SHDocVw.InternetExplorer ie; // Old (VB4 era) IE COM component
public InternetExplorer(IQuitable parent) {
// lock-onto the parent app to quit it when IE is closed.
this.parent = parent;
// create a new Internet Explorer COM component - starts IE application.
this.ie = new SHDocVw.InternetExplorerClass();
// hook-up our navigate-event interceptor
ie.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(ie_BeforeNavigate2);
}
public void Open(string url) {
object o = null;
// make the captive IE session navigate to the given URL.
ie.Navigate(url, ref o, ref o, ref o, ref o);
// now make the ie window visible
ie.Visible = true;
}
// this callback event handler is invoked prior to the captive IE
// session navigating (opening) a URL. Navigate-TWO handles both
// external (normal) and internal (AJAX) requests.
// For example: You could create a history-log file of every page
// visited by each captive session.
// Being fired BEFORE the actual navigation allows you to hijack
// (ie intercept) requests to certain URLs; in this case a request
// to http://support.microsoft.com/ terminates the Browser session
// and this program!
void ie_BeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel) {
if (URL.Equals("http://support.microsoft.com/")) {
this.Quit();
}
}
#region IDisposable Members
public void Dispose() {
quitIE();
}
#endregion
private void quitIE() {
// close my unmanaged COM object
if (ie != null && !_ieIsQuited) {
_ieIsQuited = true;
ie.Quit();
ie = null;
}
}
#region IQuitable Members
public void Quit() {
// close my unmanaged COM object
quitIE();
// quit the parent app as well.
if (parent != null && !_parentIsQuited) {
_parentIsQuited = true;
parent.Quit();
parent = null;
}
}
#endregion
}
}
Thanks y'all. Cheers. Keith.
[1]: http://www.mapinfo.com/
[2]: http://www.gis.com/whatisgis/
[3]: http://www.directionsmag.com/mapinfo-l/mif/AppJ.pdf
| 0 |
9,105,679 | 02/02/2012 00:56:07 | 599,184 | 02/01/2011 22:34:03 | 765 | 14 | Website URL appears in serif font in the browser's address bar | I'm using WordPress's permalinks to generate URLs for my website. However, I noticed that part of the URL is displayed in a different font as other URLs in Google Chrome. Here's an URL in which the problem occurs: http://linksku.com/news/world/mcdonald%E2%80%99s-confirms-%E2%80%99s-longer-using-%E2%80%98pink-slime%E2%80%99-chemical-hamburgers/
Is this an encoding issue? If so, how can I convert everything to the standard encoding (UTF-8?) using PHP? | wordpress | browser | encoding | null | null | null | open | Website URL appears in serif font in the browser's address bar
===
I'm using WordPress's permalinks to generate URLs for my website. However, I noticed that part of the URL is displayed in a different font as other URLs in Google Chrome. Here's an URL in which the problem occurs: http://linksku.com/news/world/mcdonald%E2%80%99s-confirms-%E2%80%99s-longer-using-%E2%80%98pink-slime%E2%80%99-chemical-hamburgers/
Is this an encoding issue? If so, how can I convert everything to the standard encoding (UTF-8?) using PHP? | 0 |
7,693,867 | 10/07/2011 23:51:16 | 724,408 | 04/25/2011 21:30:51 | 168 | 2 | Convert a youtube video into mp3 file? | Does Any one know how to convert a Youtube video into an mp3 file. The solution needs to be in python. | python | null | null | null | null | 10/08/2011 08:15:07 | not a real question | Convert a youtube video into mp3 file?
===
Does Any one know how to convert a Youtube video into an mp3 file. The solution needs to be in python. | 1 |
8,186,768 | 11/18/2011 17:54:11 | 972,208 | 09/30/2011 00:35:06 | 363 | 23 | What does the Python logo mean? | I know this question is not fully programmatic, but I know many are wondering the same thing, so I will go ahead and say it: what does the Python logo mean? Someone get it?
![enter image description here][1]
[1]: http://i.stack.imgur.com/hRJou.gif | python | null | null | null | null | 11/18/2011 18:45:20 | off topic | What does the Python logo mean?
===
I know this question is not fully programmatic, but I know many are wondering the same thing, so I will go ahead and say it: what does the Python logo mean? Someone get it?
![enter image description here][1]
[1]: http://i.stack.imgur.com/hRJou.gif | 2 |
11,529,916 | 07/17/2012 19:55:21 | 702,469 | 04/11/2011 15:41:17 | 3,654 | 305 | document-ready v/s body-ready v/s window-ready event | Whats the different between these three events ?
Which one loads before/after others ?
<body>
<script type='text/javascript'>
$(document).ready(function(){
console.log('Document %s',+new Date());
});
$('body').ready(function(){
console.log('Body %s',+new Date());
});
$(window).ready(function(){
console.log('Window %s',+new Date());
});
</script>
<div>hello world</div>
</body>
Strange thing is that , they fires on the same order as I put them on code. For current example. `document` one fires first and `windows` one fires at the last.
p.s. I've read http://stackoverflow.com/questions/191157/window-onload-vs-body-onload ,
http://stackoverflow.com/questions/588040/window-onload-vs-document-onload and few others. | javascript | jquery | javascript-events | event-handling | jquery-events | null | open | document-ready v/s body-ready v/s window-ready event
===
Whats the different between these three events ?
Which one loads before/after others ?
<body>
<script type='text/javascript'>
$(document).ready(function(){
console.log('Document %s',+new Date());
});
$('body').ready(function(){
console.log('Body %s',+new Date());
});
$(window).ready(function(){
console.log('Window %s',+new Date());
});
</script>
<div>hello world</div>
</body>
Strange thing is that , they fires on the same order as I put them on code. For current example. `document` one fires first and `windows` one fires at the last.
p.s. I've read http://stackoverflow.com/questions/191157/window-onload-vs-body-onload ,
http://stackoverflow.com/questions/588040/window-onload-vs-document-onload and few others. | 0 |
469,243 | 01/22/2009 14:09:59 | 36,330 | 11/10/2008 20:40:21 | 111 | 10 | How can I listen for 'usb device inserted' events in Linux, in Python? | I'd like to write a Python script for Amarok in Linux to automatically copy the stackoverflow podcast to my player. When I plug in the player, it would mount the drive, copy any pending podcasts, and eject the player. How can I listen for the "plugged in" event? I have looked through hald but couldn't find a good example. | linux | python | usb | null | null | null | open | How can I listen for 'usb device inserted' events in Linux, in Python?
===
I'd like to write a Python script for Amarok in Linux to automatically copy the stackoverflow podcast to my player. When I plug in the player, it would mount the drive, copy any pending podcasts, and eject the player. How can I listen for the "plugged in" event? I have looked through hald but couldn't find a good example. | 0 |
8,977,277 | 01/23/2012 19:15:19 | 1,165,612 | 01/23/2012 19:04:37 | 1 | 0 | How can I know number of write and read operation have been done on a page of a hard disk or flash | I need some information for select a disk for some application.
Then I want to know numebr of Read/Write operation have been done each of logical pages in personal computer, like my computer, or server host. Is there any benchmark to do this or Is there any command on windows or linux to show this information to me? | harddisk | null | null | null | null | null | open | How can I know number of write and read operation have been done on a page of a hard disk or flash
===
I need some information for select a disk for some application.
Then I want to know numebr of Read/Write operation have been done each of logical pages in personal computer, like my computer, or server host. Is there any benchmark to do this or Is there any command on windows or linux to show this information to me? | 0 |
11,123,007 | 06/20/2012 15:32:40 | 763,577 | 05/21/2011 01:26:49 | 352 | 3 | Check which files have changed in Mac::FSEvents in Perl? | Is it possible to see which files have been changed whenever an change-event is called using:
http://search.cpan.org/~rhoelz/Mac-FSEvents-0.08/ ?
Thanks a lot! :) | osx | perl | null | null | null | null | open | Check which files have changed in Mac::FSEvents in Perl?
===
Is it possible to see which files have been changed whenever an change-event is called using:
http://search.cpan.org/~rhoelz/Mac-FSEvents-0.08/ ?
Thanks a lot! :) | 0 |
9,725,270 | 03/15/2012 17:46:56 | 1,272,224 | 03/15/2012 17:42:50 | 1 | 0 | Scrolling down box with most recent Activity JQUERY | I've taken a look at this website:
http://www.pedidosya.cl/
as you can see the main page has a scrolling down most recent activity box. How do I create something like this whit JQUERY? | jquery | null | null | null | null | 03/16/2012 16:47:05 | not a real question | Scrolling down box with most recent Activity JQUERY
===
I've taken a look at this website:
http://www.pedidosya.cl/
as you can see the main page has a scrolling down most recent activity box. How do I create something like this whit JQUERY? | 1 |
5,595,051 | 04/08/2011 12:30:15 | 128,629 | 06/25/2009 05:13:25 | 1,115 | 89 | what is the most frequent error in python for a beginner? | What do you think is the most frequent errors a beginner may encounter when he use python?
I would like to make this question a community wiki but I don't know how. | python | null | null | null | null | 04/08/2011 13:37:35 | not constructive | what is the most frequent error in python for a beginner?
===
What do you think is the most frequent errors a beginner may encounter when he use python?
I would like to make this question a community wiki but I don't know how. | 4 |
5,322,250 | 03/16/2011 07:35:01 | 643,037 | 03/03/2011 13:18:06 | 6 | 0 | How to send ArrayList<object> from one activity to second activity? | I want to pass "ArrayList<object> objArrayList" from one activity to second activity and want to receive there. I am creating a simple class in that there are four arraylist. I m creating object of that class and calling method of that class by passing parameters to be added in arraylist. After that I m adding that class object in objArrayList.
HOw can I pass objArrayList from one activity to second activity and receive it there?
Thanks,
Vishakha. | android | activity | null | null | null | null | open | How to send ArrayList<object> from one activity to second activity?
===
I want to pass "ArrayList<object> objArrayList" from one activity to second activity and want to receive there. I am creating a simple class in that there are four arraylist. I m creating object of that class and calling method of that class by passing parameters to be added in arraylist. After that I m adding that class object in objArrayList.
HOw can I pass objArrayList from one activity to second activity and receive it there?
Thanks,
Vishakha. | 0 |
11,701,347 | 07/28/2012 13:18:25 | 1,557,984 | 07/27/2012 14:41:55 | 1 | 0 | ASP: My data field is null since the 2nd Page_Load() | My code_behind is:
public partial class Question2 : System.Web.UI.Page
{
private SqlDataAdapter dataAdapter;
private DataTable table;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
table = new DataTable();
//And pull the data from my DB to the table
}
}
I am intend to store my data (the 'table') in the class's field BUT after I clicked on any button of my page. I found that the Page_Load() is called again and my all data fields has gone. They're 'null'.
I'm really confuse what happen O_O. I just needed to store my table for later use. But why they're lost ? When does it lost ? Please help, Thank you. | c# | asp.net | null | null | null | null | open | ASP: My data field is null since the 2nd Page_Load()
===
My code_behind is:
public partial class Question2 : System.Web.UI.Page
{
private SqlDataAdapter dataAdapter;
private DataTable table;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
table = new DataTable();
//And pull the data from my DB to the table
}
}
I am intend to store my data (the 'table') in the class's field BUT after I clicked on any button of my page. I found that the Page_Load() is called again and my all data fields has gone. They're 'null'.
I'm really confuse what happen O_O. I just needed to store my table for later use. But why they're lost ? When does it lost ? Please help, Thank you. | 0 |
10,653,794 | 05/18/2012 13:43:17 | 1,403,469 | 05/18/2012 13:27:01 | 1 | 0 | How to map /proc/bus/usb/devices entry to a /dev/sdX device? | I need to know how I can figure out to which entry in /proc/bus/usb/devices a /dev/sdX device maps to. Basically, I need to know the vendor id and product id of a given USB stick (which may not have a serial number).
In my case, I have this entry for my flash drive in /proc/bus/usb/devices:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0781 ProdID=5530 Rev= 2.00
S: Manufacturer=SanDisk
S: Product=Cruzer
S: SerialNumber=0765400A1BD05BEE
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I happen to know that in my case it is /dev/sda, but I'm not sure how I can figure this out in code. My first approach was to loop through all /dev/sdXX devices and issue a SCSI_IOCTL_GET_BUS_NUMBER and/or SCSI_IOCTL_GET_IDLUN request, but the information returned doesn't help me match it up:
/tmp # ./getscsiinfo /dev/sda
SCSI bus number: 8
ID: 00
LUN: 00
Channel: 00
Host#: 08
four_in_one: 08000000
host_unique_id: 0
I'm not sure how I can use the SCSI bus number or the ID, LUN, Channel, Host to map it to the entry in /proc/bus/usb/devices. Or how I could get the SCSI bus number from the /proc/bus/usb/001/006 device, which is a usbfs device and doesn't appear to like the same ioctl's:
/tmp # ./getscsiinfo /proc/bus/usb/001/006
Could not get bus number: Inappropriate ioctl for device
Here's the test code for my little getscsiinfo test tool:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <scsi/scsi.h>
#include <scsi/sg.h>
#include <sys/ioctl.h>
struct scsi_idlun
{
int four_in_one;
int host_unique_id;
};
int main(int argc, char** argv) {
if (argc != 2)
return 1;
int fd = open(argv[1], O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
printf("Error opening device: %m\n");
return 1;
}
int busNumber = -1;
if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &busNumber) < 0)
{
printf("Could not get bus number: %m\n");
close(fd);
return 1;
}
printf("SCSI bus number: %d\n", busNumber);
struct scsi_idlun argid;
if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, &argid) < 0)
{
printf("Could not get id: %m\n");
close(fd);
return 1;
}
printf("ID: %02x\n", argid.four_in_one & 0xFF);
printf("LUN: %02x\n", (argid.four_in_one >> 8) & 0xFF);
printf("Channel: %02x\n", (argid.four_in_one >> 16) & 0xFF);
printf("Host#: %02x\n", (argid.four_in_one >> 24) & 0xFF);
printf("four_in_one: %08x\n", (unsigned int)argid.four_in_one);
printf("host_unique_id: %d\n", argid.host_unique_id);
close(fd);
return 0;
}
Does anyone have any idea? | c | linux | flash | usb | drive | null | open | How to map /proc/bus/usb/devices entry to a /dev/sdX device?
===
I need to know how I can figure out to which entry in /proc/bus/usb/devices a /dev/sdX device maps to. Basically, I need to know the vendor id and product id of a given USB stick (which may not have a serial number).
In my case, I have this entry for my flash drive in /proc/bus/usb/devices:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0781 ProdID=5530 Rev= 2.00
S: Manufacturer=SanDisk
S: Product=Cruzer
S: SerialNumber=0765400A1BD05BEE
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I happen to know that in my case it is /dev/sda, but I'm not sure how I can figure this out in code. My first approach was to loop through all /dev/sdXX devices and issue a SCSI_IOCTL_GET_BUS_NUMBER and/or SCSI_IOCTL_GET_IDLUN request, but the information returned doesn't help me match it up:
/tmp # ./getscsiinfo /dev/sda
SCSI bus number: 8
ID: 00
LUN: 00
Channel: 00
Host#: 08
four_in_one: 08000000
host_unique_id: 0
I'm not sure how I can use the SCSI bus number or the ID, LUN, Channel, Host to map it to the entry in /proc/bus/usb/devices. Or how I could get the SCSI bus number from the /proc/bus/usb/001/006 device, which is a usbfs device and doesn't appear to like the same ioctl's:
/tmp # ./getscsiinfo /proc/bus/usb/001/006
Could not get bus number: Inappropriate ioctl for device
Here's the test code for my little getscsiinfo test tool:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <scsi/scsi.h>
#include <scsi/sg.h>
#include <sys/ioctl.h>
struct scsi_idlun
{
int four_in_one;
int host_unique_id;
};
int main(int argc, char** argv) {
if (argc != 2)
return 1;
int fd = open(argv[1], O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
printf("Error opening device: %m\n");
return 1;
}
int busNumber = -1;
if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &busNumber) < 0)
{
printf("Could not get bus number: %m\n");
close(fd);
return 1;
}
printf("SCSI bus number: %d\n", busNumber);
struct scsi_idlun argid;
if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, &argid) < 0)
{
printf("Could not get id: %m\n");
close(fd);
return 1;
}
printf("ID: %02x\n", argid.four_in_one & 0xFF);
printf("LUN: %02x\n", (argid.four_in_one >> 8) & 0xFF);
printf("Channel: %02x\n", (argid.four_in_one >> 16) & 0xFF);
printf("Host#: %02x\n", (argid.four_in_one >> 24) & 0xFF);
printf("four_in_one: %08x\n", (unsigned int)argid.four_in_one);
printf("host_unique_id: %d\n", argid.host_unique_id);
close(fd);
return 0;
}
Does anyone have any idea? | 0 |
7,148,045 | 08/22/2011 13:16:05 | 905,929 | 08/22/2011 13:16:05 | 1 | 0 | install shield limited edition - backup a file and place it after installation mostly at same place | I created setup using install shield **limited edition** :(
our requirement is whenever the setup is run, if application already exists, need to uninstall,
before uninstalling, backup a file and place it after installation at same place
how can i do this? | installshield | null | null | null | null | null | open | install shield limited edition - backup a file and place it after installation mostly at same place
===
I created setup using install shield **limited edition** :(
our requirement is whenever the setup is run, if application already exists, need to uninstall,
before uninstalling, backup a file and place it after installation at same place
how can i do this? | 0 |
3,254,716 | 07/15/2010 10:34:09 | 392,574 | 07/15/2010 10:29:17 | 1 | 0 | screen shot for the activity | i want to create a bitmap of whats being currently displayed of my app, one thing i went into is cant read FB buffer requires root, would like to know if it is possible to create a image file for the screen, please i want the help to code this, no 3rd party intents , thanks, answers would be much appreciated | android | null | null | null | null | null | open | screen shot for the activity
===
i want to create a bitmap of whats being currently displayed of my app, one thing i went into is cant read FB buffer requires root, would like to know if it is possible to create a image file for the screen, please i want the help to code this, no 3rd party intents , thanks, answers would be much appreciated | 0 |
4,800,705 | 01/26/2011 01:43:52 | 16,794 | 09/17/2008 20:47:55 | 3,211 | 37 | What packaging tool should I use for a Mac/Windows Java app? | I have a Java desktop app that runs on both the MacOS and Windows.
I understand that I cannot have one distribution for each, which is not a requirement.
I need to know what tool or tools is best to use when delivering a Java app for each.
The tool should install prerequisites (in this case, Java and some JARs) and look native to the respective operating system. | java | windows | osx | installation | null | null | open | What packaging tool should I use for a Mac/Windows Java app?
===
I have a Java desktop app that runs on both the MacOS and Windows.
I understand that I cannot have one distribution for each, which is not a requirement.
I need to know what tool or tools is best to use when delivering a Java app for each.
The tool should install prerequisites (in this case, Java and some JARs) and look native to the respective operating system. | 0 |
11,452,580 | 07/12/2012 13:10:38 | 1,520,858 | 07/12/2012 13:07:21 | 1 | 0 | SQL select query into delete statement | I have the following query:
select acc.Username from accounts acc
left join accountevents ace on acc.accountid=ace.accountid
left join leads lds on lds.leadid=acc.leadid
where lds.DateEntered>'2011-01-01' and lds.DateEntered<'2011-02-01'
Group by acc.Username
Having count(ace.accounteventid)=0
I wanted to make it a delete statement:
delete username from accounts
left join accountevents ace on accounts.accountid=ace.accountid
left join leads lds on lds.leadid=accounts.leadid
where Leads.DateEntered>'2011-01-01' and lds.DateEntered<'2011-02-01'
Having count(accountevents.accounteventid)=0
And i get the following error:
Incorrect syntax near the keyword 'Having'.
Any suggestions? | sql | null | null | null | null | 07/13/2012 15:15:52 | too localized | SQL select query into delete statement
===
I have the following query:
select acc.Username from accounts acc
left join accountevents ace on acc.accountid=ace.accountid
left join leads lds on lds.leadid=acc.leadid
where lds.DateEntered>'2011-01-01' and lds.DateEntered<'2011-02-01'
Group by acc.Username
Having count(ace.accounteventid)=0
I wanted to make it a delete statement:
delete username from accounts
left join accountevents ace on accounts.accountid=ace.accountid
left join leads lds on lds.leadid=accounts.leadid
where Leads.DateEntered>'2011-01-01' and lds.DateEntered<'2011-02-01'
Having count(accountevents.accounteventid)=0
And i get the following error:
Incorrect syntax near the keyword 'Having'.
Any suggestions? | 3 |
6,775,804 | 07/21/2011 12:10:45 | 792,142 | 06/10/2011 05:11:00 | 16 | 0 | How to use Classes As List Collection in Azure AppFabric Caching | H,
I am using the Windows Azure AppFabri Caching.
I have two project in asp.ne t .
One to put data in cache and 2nd to read that cache. These Two project are running on 2 different systems.
I have 4 dll included in these projects.``
Microsoft.WindowsFabric.Common.dll
Microsoft.WindowsFabric.Data.Common.dll
Microsoft.ApplicationServer.Caching.Client.dll
Microsoft.ApplicationServer.Caching.Core.dll
Poject 1: To insert data in cache is using the following code:Data is saving to cache successfully
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.ApplicationServer.Caching;
public partial class Default2 : System.Web.UI.Page
{
public class Employee
{
public string Name { get; set; }
public decimal Salary { get; set; }
}
protected static DataCacheFactory _factory = null;
protected static DataCache _cache = null;
protected void Page_Load(object sender, EventArgs e)
{
PutDataIntoCache();
}
protected void PutDataIntoCache()
{
List<Employee> emp = new List<Employee>();
try
{
emp.Add(new Employee { Name = "James", Salary = 20000 });
PutCacheItem("55", emp);
}
catch (Exception ex)
{
}
}
protected void PutCacheItem(string key, object value)
{
try
{
_cache = GetDefaultCache();
_cache.Put(key, value);
}
catch (Exception ex)
{
}
}
protected static DataCache GetDefaultCache()
{
_factory = new DataCacheFactory();
_cache = _factory.GetDefaultCache();
return _cache;
}
}
Now I am reading the cache in another project that is running on another system.
Code is given below:
default.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.ApplicationServer.Caching;
public partial class Default2 : System.Web.UI.Page
{
protected static DataCacheFactory _factory = null;
protected static DataCache _cache = null;
protected void Page_Load(object sender, EventArgs e)
{
GetDataFromCache();
}
protected void GetDataFromCache()
{
_cache = GetDefaultCache();
string key = "55";
var item = _cache.Get(key);// Error is generation here
}
protected static DataCache GetDefaultCache()
{
_factory = new DataCacheFactory();
_cache = _factory.GetDefaultCache();
return _cache;
}
}
An error is generating on the line _cache.Get(key)
The deserializer cannot load the type to deserialize because type 'System.Collections.Generic.List`1[[_Default2+Employee, App_Web_4xzswv4j, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]' could not be found in assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Check that the type being serialized has the same contract as the type being deserialized and the same assembly is used.
Why this error is coming?
How can Can I uses Classes as List collection to add/read in Cache.
| azure | null | null | null | null | null | open | How to use Classes As List Collection in Azure AppFabric Caching
===
H,
I am using the Windows Azure AppFabri Caching.
I have two project in asp.ne t .
One to put data in cache and 2nd to read that cache. These Two project are running on 2 different systems.
I have 4 dll included in these projects.``
Microsoft.WindowsFabric.Common.dll
Microsoft.WindowsFabric.Data.Common.dll
Microsoft.ApplicationServer.Caching.Client.dll
Microsoft.ApplicationServer.Caching.Core.dll
Poject 1: To insert data in cache is using the following code:Data is saving to cache successfully
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.ApplicationServer.Caching;
public partial class Default2 : System.Web.UI.Page
{
public class Employee
{
public string Name { get; set; }
public decimal Salary { get; set; }
}
protected static DataCacheFactory _factory = null;
protected static DataCache _cache = null;
protected void Page_Load(object sender, EventArgs e)
{
PutDataIntoCache();
}
protected void PutDataIntoCache()
{
List<Employee> emp = new List<Employee>();
try
{
emp.Add(new Employee { Name = "James", Salary = 20000 });
PutCacheItem("55", emp);
}
catch (Exception ex)
{
}
}
protected void PutCacheItem(string key, object value)
{
try
{
_cache = GetDefaultCache();
_cache.Put(key, value);
}
catch (Exception ex)
{
}
}
protected static DataCache GetDefaultCache()
{
_factory = new DataCacheFactory();
_cache = _factory.GetDefaultCache();
return _cache;
}
}
Now I am reading the cache in another project that is running on another system.
Code is given below:
default.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.ApplicationServer.Caching;
public partial class Default2 : System.Web.UI.Page
{
protected static DataCacheFactory _factory = null;
protected static DataCache _cache = null;
protected void Page_Load(object sender, EventArgs e)
{
GetDataFromCache();
}
protected void GetDataFromCache()
{
_cache = GetDefaultCache();
string key = "55";
var item = _cache.Get(key);// Error is generation here
}
protected static DataCache GetDefaultCache()
{
_factory = new DataCacheFactory();
_cache = _factory.GetDefaultCache();
return _cache;
}
}
An error is generating on the line _cache.Get(key)
The deserializer cannot load the type to deserialize because type 'System.Collections.Generic.List`1[[_Default2+Employee, App_Web_4xzswv4j, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]' could not be found in assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Check that the type being serialized has the same contract as the type being deserialized and the same assembly is used.
Why this error is coming?
How can Can I uses Classes as List collection to add/read in Cache.
| 0 |
11,295,450 | 07/02/2012 14:14:19 | 1,482,459 | 06/26/2012 10:45:58 | 6 | 0 | The quantization parameter QP in VLC codec | I just installed the codec vlc compilation mode.
I documented the process of video compression and I found that video compression goes through several stages. The step of quantization step is the most impotent because this is when we decide the rate of compression. The quantization step manipulates a parameter called: The quantization parameter. I want to extract and learn which part of the code is implemented.
Vlc code is in c + +
I would be grateful to give me ideas on this problem. Thank you in advance.
Toufik | c | c++11 | vlc | vlcj | null | 07/05/2012 16:02:20 | off topic | The quantization parameter QP in VLC codec
===
I just installed the codec vlc compilation mode.
I documented the process of video compression and I found that video compression goes through several stages. The step of quantization step is the most impotent because this is when we decide the rate of compression. The quantization step manipulates a parameter called: The quantization parameter. I want to extract and learn which part of the code is implemented.
Vlc code is in c + +
I would be grateful to give me ideas on this problem. Thank you in advance.
Toufik | 2 |
5,814,638 | 04/28/2011 06:39:54 | 728,690 | 04/28/2011 06:33:57 | 1 | 0 | VC++ 10 treating bool as char at explicit template specialization | 1>c:\program files\microsoft visual studio 10.0\vc\include\limits(378): error C2766: explicit specialization; 'std::numeric_limits<char>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\limits(187) : see previous definition of 'numeric_limits<char>'
1>c:\program files\microsoft visual studio 10.0\vc\include\xtr1common(244): error C2766: explicit specialization; 'std::tr1::_Is_integral<char>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\xtr1common(236) : see previous definition of '_Is_integral<char>'
1>c:\program files\microsoft visual studio 10.0\vc\include\type_traits(1092): error C2766: explicit specialization; 'std::_Arithmetic_traits<char>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\type_traits(1084) : see previous definition of '_Arithmetic_traits<char>'
1>c:\program files\microsoft visual studio 10.0\vc\include\xutility(411): error C2766: explicit specialization; 'std::iterator_traits<std::_Bool>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(404) : see previous definition of 'iterator_traits<char>'
I am getting many compilation errors like this :
The reason is C++ is treating _Bool as char while _Bool is
_STD_BEGIN
typedef bool _Bool;
_STD_END
| c++ | templates | char | boolean | specialization | null | open | VC++ 10 treating bool as char at explicit template specialization
===
1>c:\program files\microsoft visual studio 10.0\vc\include\limits(378): error C2766: explicit specialization; 'std::numeric_limits<char>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\limits(187) : see previous definition of 'numeric_limits<char>'
1>c:\program files\microsoft visual studio 10.0\vc\include\xtr1common(244): error C2766: explicit specialization; 'std::tr1::_Is_integral<char>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\xtr1common(236) : see previous definition of '_Is_integral<char>'
1>c:\program files\microsoft visual studio 10.0\vc\include\type_traits(1092): error C2766: explicit specialization; 'std::_Arithmetic_traits<char>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\type_traits(1084) : see previous definition of '_Arithmetic_traits<char>'
1>c:\program files\microsoft visual studio 10.0\vc\include\xutility(411): error C2766: explicit specialization; 'std::iterator_traits<std::_Bool>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(404) : see previous definition of 'iterator_traits<char>'
I am getting many compilation errors like this :
The reason is C++ is treating _Bool as char while _Bool is
_STD_BEGIN
typedef bool _Bool;
_STD_END
| 0 |
4,673,618 | 01/12/2011 20:20:11 | 201,482 | 11/03/2009 08:36:04 | 95 | 8 | How expensive is the lock statement? | I've been experimenting with multi threading and parallel processing and I needed a counter to do some basic counting and statistic analysis of the speed of the processing. To avoid problems with concurrent use of my class I've used a lock statement on a private variable in my class:
private object mutex = new object();
public void Count(int amount)
{
lock(mutex)
{
done += amount;
}
}
But I was wondering... how expensive is locking a variable? What are the negative effects on performance? | c# | .net | multithreading | locking | parallel-processing | null | open | How expensive is the lock statement?
===
I've been experimenting with multi threading and parallel processing and I needed a counter to do some basic counting and statistic analysis of the speed of the processing. To avoid problems with concurrent use of my class I've used a lock statement on a private variable in my class:
private object mutex = new object();
public void Count(int amount)
{
lock(mutex)
{
done += amount;
}
}
But I was wondering... how expensive is locking a variable? What are the negative effects on performance? | 0 |
9,846,409 | 03/23/2012 20:58:50 | 450,466 | 09/17/2010 09:59:29 | 956 | 23 | Where to put the class model of representation? | I'm creating a project book Sanderson Pro ASp.net mvc3.
But I have had a problem.
I have a class CreateDiscountViewByUser - a class which describes the creation of discount by the user.
And I do not know where to put it.
In her book, I must put myproject.WebUI. but I want to create a method in myproject.Domain DiscountRepository.
But myprojec.Domain sees myproject.WebUI.
What do I do?
and another big problem mypoject.Domain - a class library. and he does not have the space using System.ComponentModel.DataAnnotations; | c# | asp.net-mvc-3 | null | null | null | null | open | Where to put the class model of representation?
===
I'm creating a project book Sanderson Pro ASp.net mvc3.
But I have had a problem.
I have a class CreateDiscountViewByUser - a class which describes the creation of discount by the user.
And I do not know where to put it.
In her book, I must put myproject.WebUI. but I want to create a method in myproject.Domain DiscountRepository.
But myprojec.Domain sees myproject.WebUI.
What do I do?
and another big problem mypoject.Domain - a class library. and he does not have the space using System.ComponentModel.DataAnnotations; | 0 |
11,334,670 | 07/04/2012 19:43:04 | 771,273 | 05/26/2011 12:17:30 | 353 | 6 | Looking for open-source test-last Java projects | For my graduate thesis I'm looking for several open-source test-last Java software projects. Although it's pretty easy to find projects which use a test-first approach, because that has been asked before on Q&A sites like for example stackoverflow and tools like junit and mocking frameworks are more commonly build by supporters of the test-first approach. It seems pretty hard (for me) to find projects which 'explicitly' state that they have used a test-last approach. It would be much appreciated if someone could give me some pointers to some test-last projects.
Thanks in advance. | unit-testing | testing | tdd | test-first | null | 07/06/2012 10:39:00 | not constructive | Looking for open-source test-last Java projects
===
For my graduate thesis I'm looking for several open-source test-last Java software projects. Although it's pretty easy to find projects which use a test-first approach, because that has been asked before on Q&A sites like for example stackoverflow and tools like junit and mocking frameworks are more commonly build by supporters of the test-first approach. It seems pretty hard (for me) to find projects which 'explicitly' state that they have used a test-last approach. It would be much appreciated if someone could give me some pointers to some test-last projects.
Thanks in advance. | 4 |
7,370,431 | 09/10/2011 08:02:45 | 919,722 | 08/30/2011 12:42:13 | 1 | 3 | rails 2.3.14 fragment caching, memcache-client 1.8.5 | I'm using view fragment caching in rails 2.3.14, memcache-client 1.8.5. Unfortunately it gives error:
ArgumentError: undefined class/module ActiveSupport::Cache::Entry
with backtrace:
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:250:in `load'
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:250:in `get_without_newrelic_trace'
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:886:in `with_server'
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:246:in `get_without_newrelic_trace' (eval):7:in `get'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped' (eval):4:in `get'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/cache/mem_cache_store.rb:63:in `read'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/cache/strategy/local_cache.rb:39:in `read'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/caching/fragments.rb:70:in `read_fragment'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:30:in `benchmark'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/caching/fragments.rb:69:in `read_fragment'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/caching/fragments.rb:39:in `fragment_for'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_view/helpers/cache_helper.rb:35:in `cache' app/views/layouts/_mini_calendar.erb:37:in `_run_erb_app47views47layouts47_mini_calendar46erb_locals_mini_calendar_object'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_view/renderable.rb:34:in `send'
.......................
Why is it trying to load ActiveSupport::Cache::Entry which is not present in rails 2.3?
Thanks! | ruby-on-rails | null | null | null | null | null | open | rails 2.3.14 fragment caching, memcache-client 1.8.5
===
I'm using view fragment caching in rails 2.3.14, memcache-client 1.8.5. Unfortunately it gives error:
ArgumentError: undefined class/module ActiveSupport::Cache::Entry
with backtrace:
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:250:in `load'
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:250:in `get_without_newrelic_trace'
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:886:in `with_server'
[GEM_ROOT]/gems/memcache-client-1.8.5/lib/memcache.rb:246:in `get_without_newrelic_trace' (eval):7:in `get'
[GEM_ROOT]/gems/newrelic_rpm-3.1.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped' (eval):4:in `get'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/cache/mem_cache_store.rb:63:in `read'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/cache/strategy/local_cache.rb:39:in `read'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/caching/fragments.rb:70:in `read_fragment'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:30:in `benchmark'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/caching/fragments.rb:69:in `read_fragment'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_controller/caching/fragments.rb:39:in `fragment_for'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_view/helpers/cache_helper.rb:35:in `cache' app/views/layouts/_mini_calendar.erb:37:in `_run_erb_app47views47layouts47_mini_calendar46erb_locals_mini_calendar_object'
[GEM_ROOT]/gems/actionpack-2.3.14/lib/action_view/renderable.rb:34:in `send'
.......................
Why is it trying to load ActiveSupport::Cache::Entry which is not present in rails 2.3?
Thanks! | 0 |
5,568,315 | 04/06/2011 14:47:29 | 663,011 | 03/16/2011 17:45:22 | 8 | 0 | locking issue problem | I have a treeSet in a class
It also offers a couple of ways to modify the TreeSet collection:
1. addtoset
2. removefrom set
3. setitems
In addtoSetmethod i need to check if the item is already present in set ,if yes do nothin if not add the new item to set.
public static void addto set(final String items){
if(!set.contains(items){
//do something
}
}
public static boolean contains( final String items) {
//check wether the items exists or not
return channels.contains(channel);
}
How i can introduce locking around the set....?
| multithreading | locking | null | null | null | null | open | locking issue problem
===
I have a treeSet in a class
It also offers a couple of ways to modify the TreeSet collection:
1. addtoset
2. removefrom set
3. setitems
In addtoSetmethod i need to check if the item is already present in set ,if yes do nothin if not add the new item to set.
public static void addto set(final String items){
if(!set.contains(items){
//do something
}
}
public static boolean contains( final String items) {
//check wether the items exists or not
return channels.contains(channel);
}
How i can introduce locking around the set....?
| 0 |
10,843,312 | 06/01/2012 01:23:59 | 1,417,988 | 05/25/2012 17:44:41 | 3 | 0 | mysql_fetch_assoc($query) | I am currently getting this error when using "mysql_fetch_assoc($query)":
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a6461923/public_html/index.html on line 111
Here is my query:
$query = mysql_query("SELECT * FROM users WHERE email='$email' AND password='$encripted_password'");
Thanks! | php | mysql | null | null | null | 07/13/2012 15:11:41 | too localized | mysql_fetch_assoc($query)
===
I am currently getting this error when using "mysql_fetch_assoc($query)":
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a6461923/public_html/index.html on line 111
Here is my query:
$query = mysql_query("SELECT * FROM users WHERE email='$email' AND password='$encripted_password'");
Thanks! | 3 |
5,995,345 | 05/13/2011 17:03:02 | 704,513 | 04/12/2011 16:43:00 | 9 | 4 | help : add downloaded images in a Gallery | i arrived to add pictures to a gallery , but all those images are in drawable folder ,
i want to download some images , and add them to the Gallery ,
any help plz !! :(
Thakns in advance , | android | android-gallery | null | null | null | 05/14/2011 09:35:52 | not a real question | help : add downloaded images in a Gallery
===
i arrived to add pictures to a gallery , but all those images are in drawable folder ,
i want to download some images , and add them to the Gallery ,
any help plz !! :(
Thakns in advance , | 1 |
7,383,443 | 09/12/2011 04:54:32 | 288,579 | 03/08/2010 07:34:43 | 46 | 7 | How to write Clean Code in Cakephp | I want to know how to write a clean code in CakePHP?
Definitely something like the book "Clean Code, A handbook of Agile Software Craftmanship by Robert Martin"
What is a cleaner way to write a controller, a model, and a view? How to handle inline javascripts the cleaner way?
I ask this questions because I do have managed cakephp application and it is currently bloated. We didn't wrote it with the clean code technique in our mind. So now we are having a hard time extending it.
Thanks in advance. | cakephp | cakephp-1.3 | cakephp-2.0 | null | null | 09/12/2011 10:17:52 | not constructive | How to write Clean Code in Cakephp
===
I want to know how to write a clean code in CakePHP?
Definitely something like the book "Clean Code, A handbook of Agile Software Craftmanship by Robert Martin"
What is a cleaner way to write a controller, a model, and a view? How to handle inline javascripts the cleaner way?
I ask this questions because I do have managed cakephp application and it is currently bloated. We didn't wrote it with the clean code technique in our mind. So now we are having a hard time extending it.
Thanks in advance. | 4 |
1,879,170 | 12/10/2009 07:11:56 | 166,664 | 09/01/2009 15:01:38 | 1 | 2 | UMLModeler.closeModel(modelObj) is not closing the EMX File in Editor RSA 6.0.1 | I am working on a project where we are using RSA 6.0.1.
I have to run the some set of tasks programmatically. I have open the emx file using UMLModeler.openModel(absoluteModelPath); Then do some editing and save through UMLModeler.getEditingDomain().run( new ResourceSetModifyOperation("Update Operation") {},Monitor); Then I refreshed the project through sourceProject.refreshLocal(IProject.DEPTH_INFINITE,monitor); till now things goes fine and finally when I am closing the model through UMLModeler.closeModel(objUMLModel); It is running this code but not closing the EMX file in the editor.
There is no error , no exception. Can any one please suggest me what can I do to close this emx file. | rational | uml | null | null | null | null | open | UMLModeler.closeModel(modelObj) is not closing the EMX File in Editor RSA 6.0.1
===
I am working on a project where we are using RSA 6.0.1.
I have to run the some set of tasks programmatically. I have open the emx file using UMLModeler.openModel(absoluteModelPath); Then do some editing and save through UMLModeler.getEditingDomain().run( new ResourceSetModifyOperation("Update Operation") {},Monitor); Then I refreshed the project through sourceProject.refreshLocal(IProject.DEPTH_INFINITE,monitor); till now things goes fine and finally when I am closing the model through UMLModeler.closeModel(objUMLModel); It is running this code but not closing the EMX file in the editor.
There is no error , no exception. Can any one please suggest me what can I do to close this emx file. | 0 |
9,769,732 | 03/19/2012 11:57:50 | 272,869 | 02/14/2010 15:03:44 | 633 | 4 | Create COM-object on server in C#: ERROR: 800706be | I'm new in `C#` and `COM` technology.
Trying to create `COM`-object on server. Need to test it locally first, so using IP: `127.0.0.1`
My code is:
var myGuid = new Guid("530A1815-820C-11D3-BBB7-008048DE406A");
var myType = Type.GetTypeFromCLSID(myGuid, "127.0.0.1", true);
ITInfoServer infsrv = (ITInfoServer)Activator.CreateInstance(myType);
// infsrv.callSomeMethod (....);
I call this code very frequently and I don't '*release*' COM object (I don't know, maybe I have to).
And after that getting the error:
> Creating an instance of the COM component with CLSID
> {530A1815-820C-11D3-BBB7-008048DE406A} from the IClassFactory failed
> due to the following error: 800706be.
| c# | com | windows-server-2003 | null | null | null | open | Create COM-object on server in C#: ERROR: 800706be
===
I'm new in `C#` and `COM` technology.
Trying to create `COM`-object on server. Need to test it locally first, so using IP: `127.0.0.1`
My code is:
var myGuid = new Guid("530A1815-820C-11D3-BBB7-008048DE406A");
var myType = Type.GetTypeFromCLSID(myGuid, "127.0.0.1", true);
ITInfoServer infsrv = (ITInfoServer)Activator.CreateInstance(myType);
// infsrv.callSomeMethod (....);
I call this code very frequently and I don't '*release*' COM object (I don't know, maybe I have to).
And after that getting the error:
> Creating an instance of the COM component with CLSID
> {530A1815-820C-11D3-BBB7-008048DE406A} from the IClassFactory failed
> due to the following error: 800706be.
| 0 |
6,648,878 | 07/11/2011 10:39:47 | 825,904 | 07/02/2011 08:36:47 | 24 | 0 | How difficult it is to maintain web server without cpanel | I am planning to buy a VPS server from hosting company but that is without cpanel.
I have always used cpanel/whm for accounts.
i want to know how difficult it will be to create accounts without cpanel/whm.
Can i install something manuallly which is little bit closer to cpanel. Basically
i want account create delete faclity
thanks | linux | cpanel | vps | null | null | 07/11/2011 10:56:56 | off topic | How difficult it is to maintain web server without cpanel
===
I am planning to buy a VPS server from hosting company but that is without cpanel.
I have always used cpanel/whm for accounts.
i want to know how difficult it will be to create accounts without cpanel/whm.
Can i install something manuallly which is little bit closer to cpanel. Basically
i want account create delete faclity
thanks | 2 |
11,574,597 | 07/20/2012 07:14:21 | 1,142,729 | 01/11/2012 08:19:49 | 25 | 0 | Is there any recommended vector drawing tool that can outcome suitable EPS for Latex in MacOS? | WINFIG is good. Is there any other one? | osx | latex | drawing | vector-graphics | eps | 07/25/2012 16:51:05 | off topic | Is there any recommended vector drawing tool that can outcome suitable EPS for Latex in MacOS?
===
WINFIG is good. Is there any other one? | 2 |
11,701,035 | 07/28/2012 12:29:11 | 683,233 | 03/30/2011 03:52:18 | 2,251 | 147 | Connecting to Oracle from Java | How can I connect to Oracle DB from Java without using any DSN, so the program can be executed on any system without any changes ?
_My Code_
import java.sql.*;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:cn","scott","tiger");
}
catch(Exception e)
{}
PreparedStatemenet ps=cn.prepareStatemenet("insert into table values(?)");
ps.setString("A");
int m=ps.executeUpdate(); | java | jsp | jdk | null | null | 07/30/2012 03:35:49 | not a real question | Connecting to Oracle from Java
===
How can I connect to Oracle DB from Java without using any DSN, so the program can be executed on any system without any changes ?
_My Code_
import java.sql.*;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:cn","scott","tiger");
}
catch(Exception e)
{}
PreparedStatemenet ps=cn.prepareStatemenet("insert into table values(?)");
ps.setString("A");
int m=ps.executeUpdate(); | 1 |
9,169,672 | 02/07/2012 01:03:54 | 1,114,803 | 12/24/2011 19:01:18 | 37 | 2 | QGraphicsView: How to efficiently get the viewport coordinates of QGraphicsItems? | Is there a fast way to get the viewport coordinates of QGraphicsItems in a QGraphicsView? The only way I can think of is to call QGraphicsView::items(), and then QGraphicsItem::pos() followed by QGraphicsView::mapFromScene.
I must be missing something, though, because items are already converted to viewport coordinates to position them correctly on the QGraphicsView, so converting it to viewport coordinates again with mapFromScene seems inefficient--especially because in my case this is occurring often and for many items. Is there a more direct approach? | qt | qgraphicsview | null | null | null | null | open | QGraphicsView: How to efficiently get the viewport coordinates of QGraphicsItems?
===
Is there a fast way to get the viewport coordinates of QGraphicsItems in a QGraphicsView? The only way I can think of is to call QGraphicsView::items(), and then QGraphicsItem::pos() followed by QGraphicsView::mapFromScene.
I must be missing something, though, because items are already converted to viewport coordinates to position them correctly on the QGraphicsView, so converting it to viewport coordinates again with mapFromScene seems inefficient--especially because in my case this is occurring often and for many items. Is there a more direct approach? | 0 |
6,084,977 | 05/21/2011 23:02:45 | 685,453 | 03/31/2011 09:40:56 | 6 | 0 | JFrame's position and pack() | every time when I call pack() method on JFrame, it moves to the initial position where was when started. When I try to get the location of the JFrame (getLocation, getLocationOnScreen) it's still the same as initial position no matter I'm moving the window. I am running Archlinux with Awesome WM. Please help.
Thanks Uiii | java | swing | position | jframe | pack | 05/22/2011 17:38:38 | too localized | JFrame's position and pack()
===
every time when I call pack() method on JFrame, it moves to the initial position where was when started. When I try to get the location of the JFrame (getLocation, getLocationOnScreen) it's still the same as initial position no matter I'm moving the window. I am running Archlinux with Awesome WM. Please help.
Thanks Uiii | 3 |
6,498,467 | 06/27/2011 20:20:16 | 278,899 | 02/22/2010 18:12:18 | 3,720 | 187 | Conversion from BufferedImage to SWT Image | After much looking, I found a bit of code that converts a `BufferedImage` to a SWT Image:
public static ImageData convertToSWT(BufferedImage bufferedImage) {
if (bufferedImage.getColorModel() instanceof DirectColorModel) {
DirectColorModel colorModel = (DirectColorModel) bufferedImage.getColorModel();
PaletteData palette = new PaletteData(
colorModel.getRedMask(),
colorModel.getGreenMask(),
colorModel.getBlueMask()
);
ImageData data = new ImageData(
bufferedImage.getWidth(),
bufferedImage.getHeight(), colorModel.getPixelSize(),
palette
);
WritableRaster raster = bufferedImage.getRaster();
int[] pixelArray = new int[3];
for (int y = 0; y < data.height; y++) {
for (int x = 0; x < data.width; x++) {
raster.getPixel(x, y, pixelArray);
int pixel = palette.getPixel(
new RGB(pixelArray[0], pixelArray[1], pixelArray[2])
);
data.setPixel(x, y, pixel);
}
}
return data;
} else if (bufferedImage.getColorModel() instanceof IndexColorModel) {
IndexColorModel colorModel = (IndexColorModel) bufferedImage.getColorModel();
int size = colorModel.getMapSize();
byte[] reds = new byte[size];
byte[] greens = new byte[size];
byte[] blues = new byte[size];
colorModel.getReds(reds);
colorModel.getGreens(greens);
colorModel.getBlues(blues);
RGB[] rgbs = new RGB[size];
for (int i = 0; i < rgbs.length; i++) {
rgbs[i] = new RGB(reds[i] & 0xFF, greens[i] & 0xFF, blues[i] & 0xFF);
}
PaletteData palette = new PaletteData(rgbs);
ImageData data = new ImageData(
bufferedImage.getWidth(),
bufferedImage.getHeight(),
colorModel.getPixelSize(),
palette
);
data.transparentPixel = colorModel.getTransparentPixel();
WritableRaster raster = bufferedImage.getRaster();
int[] pixelArray = new int[1];
for (int y = 0; y < data.height; y++) {
for (int x = 0; x < data.width; x++) {
raster.getPixel(x, y, pixelArray);
data.setPixel(x, y, pixelArray[0]);
}
}
return data;
}
return null;
}
(found here: http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/ConvertsabufferedimagetoSWTImageData.htm).
I've tested it, and it works just fine. The problem is that I don't understand it (my best guess is that it uses the raw data interfaces of both to make the transfer). It occurred to me that a much simpler solution would be to write the `BufferedImage` out to `ByteArrayOutputStream`, and then read it back into a SWT Image with` ByteArrayInputStream`. Are there any problems with this solution? What about speed?
This conversion is necessary because all of the image resizing libraries out there are for AWT, and yet I'm displaying the image with SWT.
Thanks! | java | image | swt | awt | bufferedimage | null | open | Conversion from BufferedImage to SWT Image
===
After much looking, I found a bit of code that converts a `BufferedImage` to a SWT Image:
public static ImageData convertToSWT(BufferedImage bufferedImage) {
if (bufferedImage.getColorModel() instanceof DirectColorModel) {
DirectColorModel colorModel = (DirectColorModel) bufferedImage.getColorModel();
PaletteData palette = new PaletteData(
colorModel.getRedMask(),
colorModel.getGreenMask(),
colorModel.getBlueMask()
);
ImageData data = new ImageData(
bufferedImage.getWidth(),
bufferedImage.getHeight(), colorModel.getPixelSize(),
palette
);
WritableRaster raster = bufferedImage.getRaster();
int[] pixelArray = new int[3];
for (int y = 0; y < data.height; y++) {
for (int x = 0; x < data.width; x++) {
raster.getPixel(x, y, pixelArray);
int pixel = palette.getPixel(
new RGB(pixelArray[0], pixelArray[1], pixelArray[2])
);
data.setPixel(x, y, pixel);
}
}
return data;
} else if (bufferedImage.getColorModel() instanceof IndexColorModel) {
IndexColorModel colorModel = (IndexColorModel) bufferedImage.getColorModel();
int size = colorModel.getMapSize();
byte[] reds = new byte[size];
byte[] greens = new byte[size];
byte[] blues = new byte[size];
colorModel.getReds(reds);
colorModel.getGreens(greens);
colorModel.getBlues(blues);
RGB[] rgbs = new RGB[size];
for (int i = 0; i < rgbs.length; i++) {
rgbs[i] = new RGB(reds[i] & 0xFF, greens[i] & 0xFF, blues[i] & 0xFF);
}
PaletteData palette = new PaletteData(rgbs);
ImageData data = new ImageData(
bufferedImage.getWidth(),
bufferedImage.getHeight(),
colorModel.getPixelSize(),
palette
);
data.transparentPixel = colorModel.getTransparentPixel();
WritableRaster raster = bufferedImage.getRaster();
int[] pixelArray = new int[1];
for (int y = 0; y < data.height; y++) {
for (int x = 0; x < data.width; x++) {
raster.getPixel(x, y, pixelArray);
data.setPixel(x, y, pixelArray[0]);
}
}
return data;
}
return null;
}
(found here: http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/ConvertsabufferedimagetoSWTImageData.htm).
I've tested it, and it works just fine. The problem is that I don't understand it (my best guess is that it uses the raw data interfaces of both to make the transfer). It occurred to me that a much simpler solution would be to write the `BufferedImage` out to `ByteArrayOutputStream`, and then read it back into a SWT Image with` ByteArrayInputStream`. Are there any problems with this solution? What about speed?
This conversion is necessary because all of the image resizing libraries out there are for AWT, and yet I'm displaying the image with SWT.
Thanks! | 0 |
7,170,060 | 08/24/2011 03:17:09 | 908,806 | 08/24/2011 02:58:16 | 1 | 0 | Float Images and Text in One Line within a UITableViewCell | I have a custom UITableViewCell class and would like to display images and strings linearly. For example:
Row 1: [Image1] string1 [Image2] string2 [Image3]
Row 2: [Image4] string3 [Image5]
The images have varying widths but I would like equal spacing. How would I do this? I have tried manipulating subviews and CGRectMake to no avail.
Additionally, I am using an NSDictionary to hold the content and the number of images/string is not constant for each cell. | objective-c | uitableview | uitableviewcell | nsdictionary | cgrect | null | open | Float Images and Text in One Line within a UITableViewCell
===
I have a custom UITableViewCell class and would like to display images and strings linearly. For example:
Row 1: [Image1] string1 [Image2] string2 [Image3]
Row 2: [Image4] string3 [Image5]
The images have varying widths but I would like equal spacing. How would I do this? I have tried manipulating subviews and CGRectMake to no avail.
Additionally, I am using an NSDictionary to hold the content and the number of images/string is not constant for each cell. | 0 |
10,109,550 | 04/11/2012 15:55:34 | 1,173,428 | 01/27/2012 12:05:52 | 272 | 14 | How to refresh jquery mobile multipage document after deploying new software | I have a jqm multipage document (index.html) that includes several pages and other assets (js, css, etc.). I have my server configured to use etags for the html, css, and js files. The request/response headers are set appropriately and it works as expected.
During use of my application there are no requests (with the exception of signing off) to index.html, so there is never really a chance for the browser to see if there is a new file out there, let alone all of it's css and js files (unless the user signs off, requests the page again or does a refresh). If I deploy new software, how might I notify the user that new sw is available and/or somehow force a refresh of the index.html file?
My initial thoughts were to store the version # on the client and periodically make ajax requests to the server to check the version #. If new sw is available, display a link to notify the user informing them of the new sw and to click on the link to get it (reload index.html).
I'm curious how others have done this? Thoughts? Recommendations? | caching | jquery-mobile | browser-cache | browser-caching | null | null | open | How to refresh jquery mobile multipage document after deploying new software
===
I have a jqm multipage document (index.html) that includes several pages and other assets (js, css, etc.). I have my server configured to use etags for the html, css, and js files. The request/response headers are set appropriately and it works as expected.
During use of my application there are no requests (with the exception of signing off) to index.html, so there is never really a chance for the browser to see if there is a new file out there, let alone all of it's css and js files (unless the user signs off, requests the page again or does a refresh). If I deploy new software, how might I notify the user that new sw is available and/or somehow force a refresh of the index.html file?
My initial thoughts were to store the version # on the client and periodically make ajax requests to the server to check the version #. If new sw is available, display a link to notify the user informing them of the new sw and to click on the link to get it (reload index.html).
I'm curious how others have done this? Thoughts? Recommendations? | 0 |
2,695,492 | 04/23/2010 00:46:54 | 46,768 | 12/16/2008 18:26:48 | 655 | 29 | Using Sub-Types And Return Types in Scala to Process a Generic Object Into a Specific One | I think this is about covariance but I'm weak on the topic...
I have a generic Event class used for things like database persistance, let's say like this:
class Event(
subject: Long,
verb: String,
directobject: Option[Long],
indirectobject: Option[Long],
timestamp: Long)
{
def getSubject = subject
def getVerb = verb
def getDirectObject = directobject
def getIndirectObject = indirectobject
def getTimestamp = timestamp
}
However, I have lots of different event verbs and I want to use pattern matching and such with these different event types, so I will create some corresponding case classes:
trait EventCC
case class Login(user: Long, timestamp: Long) extends EventCC
case class Follow(
follower: Long,
followee: Long,
timestamp: Long
) extends EventCC
Now, the question is, how can I easily convert generic Events to the specific case classes.
This is my first stab at it:
def event2CC[T <: EventCC](event: Event): T = event.getVerb match {
case "login" => Login(event.getSubject, event.getTimestamp)
case "follow" => Follow(
event.getSubject,
event.getDirectObject.getOrElse(0),
event.getTimestamp
)
// ...
}
Unfortunately, this is wrong.
<console>:11: error: type mismatch;
found : Login
required: T
case "login" => Login(event.getSubject, event.getTimestamp)
^
<console>:12: error: type mismatch;
found : Follow
required: T
case "follow" => Follow(event.getSubject,
event.getDirectObject.getOrElse(0), event.getTimestamp)
Could someone with greater type-fu than me explain if, 1) if what I want to do is possible (or reasonable, for that matter), and 2) if so, how to fix `event2CC`. Thanks! | scala | covariance | return-type | subclass | subtype | null | open | Using Sub-Types And Return Types in Scala to Process a Generic Object Into a Specific One
===
I think this is about covariance but I'm weak on the topic...
I have a generic Event class used for things like database persistance, let's say like this:
class Event(
subject: Long,
verb: String,
directobject: Option[Long],
indirectobject: Option[Long],
timestamp: Long)
{
def getSubject = subject
def getVerb = verb
def getDirectObject = directobject
def getIndirectObject = indirectobject
def getTimestamp = timestamp
}
However, I have lots of different event verbs and I want to use pattern matching and such with these different event types, so I will create some corresponding case classes:
trait EventCC
case class Login(user: Long, timestamp: Long) extends EventCC
case class Follow(
follower: Long,
followee: Long,
timestamp: Long
) extends EventCC
Now, the question is, how can I easily convert generic Events to the specific case classes.
This is my first stab at it:
def event2CC[T <: EventCC](event: Event): T = event.getVerb match {
case "login" => Login(event.getSubject, event.getTimestamp)
case "follow" => Follow(
event.getSubject,
event.getDirectObject.getOrElse(0),
event.getTimestamp
)
// ...
}
Unfortunately, this is wrong.
<console>:11: error: type mismatch;
found : Login
required: T
case "login" => Login(event.getSubject, event.getTimestamp)
^
<console>:12: error: type mismatch;
found : Follow
required: T
case "follow" => Follow(event.getSubject,
event.getDirectObject.getOrElse(0), event.getTimestamp)
Could someone with greater type-fu than me explain if, 1) if what I want to do is possible (or reasonable, for that matter), and 2) if so, how to fix `event2CC`. Thanks! | 0 |
7,008,535 | 08/10/2011 09:25:41 | 179,081 | 09/25/2009 14:16:44 | 802 | 9 | Design Patterns for Lock and Monitors | Ok, so I did a course on locks and monitors a couple of monthgs ago, and when i was doing it I could clearly see the design patterns and the Antipatterns.
more recently I cwas called to put them into large scale practical use,
and in the gap time (and partially my change of programming language from F# to C#),
I could feel my skills had started to wan.
I could see some things we were doing that felt like antipatterns
(like i think there is an antipattern of using anything that is not atomic (ie most things other than lock) to keep track of that is allows and what isn't)
But it took me a while to try and work out the correct code to go in its place (but i know there are textbook solutions to most problems).
So I'm looking for a book on design patterns/antipatterns with particular reference to locks, monitors and other threading related concerns.
It must have examples in C# and ideally would have examples for Java and Python (F# too would be good, since while C# can be manipulated to use F# techniques they still are more prevelent in F#).
For once this is a problem i am prepared to thopugh money at (maybe around $100AU)
So any suggestions for a great book? (or if it is particularly good a website) | c# | multithreading | design-patterns | books | locking | 10/02/2011 22:27:49 | not constructive | Design Patterns for Lock and Monitors
===
Ok, so I did a course on locks and monitors a couple of monthgs ago, and when i was doing it I could clearly see the design patterns and the Antipatterns.
more recently I cwas called to put them into large scale practical use,
and in the gap time (and partially my change of programming language from F# to C#),
I could feel my skills had started to wan.
I could see some things we were doing that felt like antipatterns
(like i think there is an antipattern of using anything that is not atomic (ie most things other than lock) to keep track of that is allows and what isn't)
But it took me a while to try and work out the correct code to go in its place (but i know there are textbook solutions to most problems).
So I'm looking for a book on design patterns/antipatterns with particular reference to locks, monitors and other threading related concerns.
It must have examples in C# and ideally would have examples for Java and Python (F# too would be good, since while C# can be manipulated to use F# techniques they still are more prevelent in F#).
For once this is a problem i am prepared to thopugh money at (maybe around $100AU)
So any suggestions for a great book? (or if it is particularly good a website) | 4 |
7,300,465 | 09/04/2011 16:07:04 | 348,081 | 03/08/2010 17:00:09 | 517 | 7 | Building vim in OSX | I compiling vim in OSX because I need the python support, I use this
#!/bin/bash
git clone https://github.com/b4winckler/vim.git
cd vim
./configure CFLAGS="-arch i386 -arch x86_64 -g -O3 -pipe" --prefix=$HOME/opt --enable-pythoninterp --with-features=huge --enable-cscope
make
make install
[vim build gist](https://gist.github.com/1185168)
but I never get the same of default vim
with my compilated vim
for i in $(seq 1 20) ; do time vim .vimrc -c "exec ':q'"; done
the average is
real 0m0.228s
user 0m0.144s
sys 0m0.039s
with default OSX vim
for i in $(seq 1 20) ; do time /usr/bin/vim .vimrc -c "exec ':q'"; done
the average is
real 0m0.186s
user 0m0.115s
sys 0m0.032s
how I can get a better speed ? | osx | vim | build | configure | null | 09/04/2011 19:55:40 | too localized | Building vim in OSX
===
I compiling vim in OSX because I need the python support, I use this
#!/bin/bash
git clone https://github.com/b4winckler/vim.git
cd vim
./configure CFLAGS="-arch i386 -arch x86_64 -g -O3 -pipe" --prefix=$HOME/opt --enable-pythoninterp --with-features=huge --enable-cscope
make
make install
[vim build gist](https://gist.github.com/1185168)
but I never get the same of default vim
with my compilated vim
for i in $(seq 1 20) ; do time vim .vimrc -c "exec ':q'"; done
the average is
real 0m0.228s
user 0m0.144s
sys 0m0.039s
with default OSX vim
for i in $(seq 1 20) ; do time /usr/bin/vim .vimrc -c "exec ':q'"; done
the average is
real 0m0.186s
user 0m0.115s
sys 0m0.032s
how I can get a better speed ? | 3 |
9,930,848 | 03/29/2012 18:01:39 | 1,301,530 | 03/29/2012 17:55:30 | 1 | 0 | Turning off Facebook chat at a network level | Not sure if this is the right web site for this but I literally can not find Facebook support anywhere. We have a company policy to disallow chat messages. I am trying to figure out how to turn off Facebook chat. We have this issue with the new cover images being rolled out and people can't see them unless they have secure browsing turned enable. The odd thing is that the firewall pulls up the chat from facebook as the blocking transaction.
as a side note typeing the tags in below pushes the Post your question submit out of the | facebook | chat | null | null | null | 03/29/2012 19:27:01 | off topic | Turning off Facebook chat at a network level
===
Not sure if this is the right web site for this but I literally can not find Facebook support anywhere. We have a company policy to disallow chat messages. I am trying to figure out how to turn off Facebook chat. We have this issue with the new cover images being rolled out and people can't see them unless they have secure browsing turned enable. The odd thing is that the firewall pulls up the chat from facebook as the blocking transaction.
as a side note typeing the tags in below pushes the Post your question submit out of the | 2 |
11,098,276 | 06/19/2012 09:37:01 | 1,355,792 | 04/25/2012 09:34:15 | 68 | 0 | Creation of 2 ListViews in Metro App using HTML & Javascript | Iam trying to create 2 Listviews with different information in a single html file.But, here if i modify one listview it is effecting on other listview also. But I need to maintain 2 listviews with different service information?Am using Visual-studio-2012RC and windows8.Any working examples are really helpful to me.
Thank u in advance. | html5 | microsoft-metro | visual-studio-2012 | winjs | null | null | open | Creation of 2 ListViews in Metro App using HTML & Javascript
===
Iam trying to create 2 Listviews with different information in a single html file.But, here if i modify one listview it is effecting on other listview also. But I need to maintain 2 listviews with different service information?Am using Visual-studio-2012RC and windows8.Any working examples are really helpful to me.
Thank u in advance. | 0 |
3,035,281 | 06/14/2010 06:17:07 | 366,051 | 06/14/2010 05:45:47 | 1 | 0 | choose javascript variable based on element id from jquery | I feel like this is a simple question, but I am still relatively new to javascript and jquery.
I am developing a site for a touch interface that uses unordered lists and jquery .click functions to take input data. I have a section to input a m:ss time, with 3 divs, each containing a list of digits for time. I need to get the input for each column and set it as a variable. I originally designed the inputs to change form inputs, because I didn't understand javascript very much. It was easy to change the 3 hidden inputs by using div id's, but I can't figure out how to do it now with javascript variables.
Here is my original jquery code...
$("div#time>div>ul>li").click(function() {
var id = $(this).parents(".time").attr("name");
var number = $(this).html();
$("input#"+id).val(number); });
The last line sets one of 3 hidden inputs equal to whatever was clicked. I need to make it so separate variables take the inputs, then I can manipulate those variables however I want.
Here's a short snippet of the html, to have an idea of how jquery grabs it.
<div id="time">
<h1>Time</h1>
<div name="minute" class="time" id="t_minute">
M :
<ul>
The full time html is here: [link text][1]
Thanks everyone!
I've been using SO to answer many questions I've had, but I couldn't find something for this, so I figured I would join, since I'm sure I will have more questions along the way.
[1]: http://paulrhoffer.com/time.html | javascript | jquery | variables | null | null | null | open | choose javascript variable based on element id from jquery
===
I feel like this is a simple question, but I am still relatively new to javascript and jquery.
I am developing a site for a touch interface that uses unordered lists and jquery .click functions to take input data. I have a section to input a m:ss time, with 3 divs, each containing a list of digits for time. I need to get the input for each column and set it as a variable. I originally designed the inputs to change form inputs, because I didn't understand javascript very much. It was easy to change the 3 hidden inputs by using div id's, but I can't figure out how to do it now with javascript variables.
Here is my original jquery code...
$("div#time>div>ul>li").click(function() {
var id = $(this).parents(".time").attr("name");
var number = $(this).html();
$("input#"+id).val(number); });
The last line sets one of 3 hidden inputs equal to whatever was clicked. I need to make it so separate variables take the inputs, then I can manipulate those variables however I want.
Here's a short snippet of the html, to have an idea of how jquery grabs it.
<div id="time">
<h1>Time</h1>
<div name="minute" class="time" id="t_minute">
M :
<ul>
The full time html is here: [link text][1]
Thanks everyone!
I've been using SO to answer many questions I've had, but I couldn't find something for this, so I figured I would join, since I'm sure I will have more questions along the way.
[1]: http://paulrhoffer.com/time.html | 0 |
5,752,202 | 04/22/2011 04:07:54 | 464,682 | 10/02/2010 15:56:31 | 1 | 0 | How much does a Windows Phone 7 license cost? | Not a license to develop apps, but a cost of the actual OS to put on your phone if you're a manufacturer. Basically, what amount of what the consumer pays (before carrier subsidies) goes to the OS? | windows-phone-7 | licensing | cost | null | null | 04/22/2011 04:51:16 | off topic | How much does a Windows Phone 7 license cost?
===
Not a license to develop apps, but a cost of the actual OS to put on your phone if you're a manufacturer. Basically, what amount of what the consumer pays (before carrier subsidies) goes to the OS? | 2 |
5,388,629 | 03/22/2011 08:39:27 | 164,683 | 08/28/2009 06:36:27 | 1,103 | 82 | Resource File problem in VC++ | all when i try to build application, from resource file i'm getting error. i.e
> "error RC2103 : unexpected end of file
> in string literal "
if i comment the
> "1 TYPELIB "File name.tlb"
in resource file Project build well, why is this problem is appearing. | gui | visual-c++ | resources | embedded-resource | null | null | open | Resource File problem in VC++
===
all when i try to build application, from resource file i'm getting error. i.e
> "error RC2103 : unexpected end of file
> in string literal "
if i comment the
> "1 TYPELIB "File name.tlb"
in resource file Project build well, why is this problem is appearing. | 0 |
5,282,580 | 03/12/2011 12:51:29 | 655,898 | 03/11/2011 19:35:47 | 6 | 0 | Paging Or segmentation in linux | using paging or segmentation or both of them in linux ?
Thank you | linux | null | null | null | null | 03/12/2011 13:57:26 | not a real question | Paging Or segmentation in linux
===
using paging or segmentation or both of them in linux ?
Thank you | 1 |
10,992,983 | 06/12/2012 08:27:49 | 621,042 | 02/17/2011 09:03:46 | 8 | 1 | Intellisense and code suggestion not working in VS2012 Ultimate RC | I have just downloaded and installed Visual Studio 2012 RC Ultimate, but I'm having an issue with the intellisense: it is not working until I press Ctrl+Space, and code suggestions are disabled also (method parameters for example). I think the problem is with the VS installation, because at the end of the process the following message is shown: " The event log file is full".
If anyone has the same problem, or has any solution, I'll be grateful to get help with it.
Thanks | intellisense | visual-studio-2012 | logfile | null | null | 06/13/2012 07:07:21 | off topic | Intellisense and code suggestion not working in VS2012 Ultimate RC
===
I have just downloaded and installed Visual Studio 2012 RC Ultimate, but I'm having an issue with the intellisense: it is not working until I press Ctrl+Space, and code suggestions are disabled also (method parameters for example). I think the problem is with the VS installation, because at the end of the process the following message is shown: " The event log file is full".
If anyone has the same problem, or has any solution, I'll be grateful to get help with it.
Thanks | 2 |
11,079,346 | 06/18/2012 08:36:06 | 1,167,111 | 01/24/2012 13:36:04 | 6 | 1 | Timestamping XML using DSIG | I need to timestamp an XML file. Is there any solution on this?
I can make an digital signature and put it into XML-DSIG structure, but i need to do it with timestamp. Principialy it is the same process. Signing i do myself, timestamping do TSA (Timestamp authority).
Yes of cours, i can make hash in the same way a clasis signature is made. And response from TSA put in some element (for example <TSAResponse>). But it does not seem clean. And validation cannot be done with available tools (Tools for XML-DSIG).
Thanks for advice. | xml | asn.1 | timestamping | xml-dsig | null | null | open | Timestamping XML using DSIG
===
I need to timestamp an XML file. Is there any solution on this?
I can make an digital signature and put it into XML-DSIG structure, but i need to do it with timestamp. Principialy it is the same process. Signing i do myself, timestamping do TSA (Timestamp authority).
Yes of cours, i can make hash in the same way a clasis signature is made. And response from TSA put in some element (for example <TSAResponse>). But it does not seem clean. And validation cannot be done with available tools (Tools for XML-DSIG).
Thanks for advice. | 0 |
1,059,572 | 06/29/2009 17:52:42 | 46,011 | 12/13/2008 19:05:05 | 1,063 | 40 | How can I remove copyrighted trademarks indexed by Google? | A company has issued the company I work for a cease and assist for a certain term we have been using to describe many products on the website. So we are currently going to do as they say and replace that term with a different term. But the problem is, the search feature on our web site is powered by Google site search. And when I make a change it usually takes a number of weeks before they are changed in Google's index. So after we change everything to no longer say this term, if you search our site for the term you will still find results until Google's index gets updated. We don't want them to see this and think we have not complied. So what would you recommend, is there a way to get Google to remove that keyword from their index of our site...is there something else we can do?
Thanks!! | google | index | legal | copyright | null | 06/29/2009 18:03:37 | off topic | How can I remove copyrighted trademarks indexed by Google?
===
A company has issued the company I work for a cease and assist for a certain term we have been using to describe many products on the website. So we are currently going to do as they say and replace that term with a different term. But the problem is, the search feature on our web site is powered by Google site search. And when I make a change it usually takes a number of weeks before they are changed in Google's index. So after we change everything to no longer say this term, if you search our site for the term you will still find results until Google's index gets updated. We don't want them to see this and think we have not complied. So what would you recommend, is there a way to get Google to remove that keyword from their index of our site...is there something else we can do?
Thanks!! | 2 |
5,764,498 | 04/23/2011 13:44:47 | 718,390 | 04/21/2011 06:21:16 | 1 | 0 | how to distinguish methods | using System;
interface one
{
void getdata();
}
interface two : one
{
new void getdata();
void showdata();
}
class intefacehierarchy:two,one
{
string name;
public void getdata()
{
Console.WriteLine("ok tell me your name");
}
public void getdata()
{
Console.WriteLine("Enter the name");
name = Console.ReadLine();
}
public void showdata()
{
Console.WriteLine(String.Format("hello mr. {0}", name));
}
} | c# | java | c++ | null | null | 04/24/2011 03:08:16 | not a real question | how to distinguish methods
===
using System;
interface one
{
void getdata();
}
interface two : one
{
new void getdata();
void showdata();
}
class intefacehierarchy:two,one
{
string name;
public void getdata()
{
Console.WriteLine("ok tell me your name");
}
public void getdata()
{
Console.WriteLine("Enter the name");
name = Console.ReadLine();
}
public void showdata()
{
Console.WriteLine(String.Format("hello mr. {0}", name));
}
} | 1 |
7,075,145 | 08/16/2011 07:59:02 | 876,047 | 08/03/2011 07:06:25 | 17 | 1 | Tablayout problem with keyboard | I've a Tablayout in my application. In one of the tablayout there is a listview with a search. When I want to write something in the search the tablayout is visible and the layout. But I only want to show the keyboard and not the tablayout when I write something in the search box. When I close the keyboard the tablayout should display again.
Thanks for Help | android | keyboard | tabs | null | null | null | open | Tablayout problem with keyboard
===
I've a Tablayout in my application. In one of the tablayout there is a listview with a search. When I want to write something in the search the tablayout is visible and the layout. But I only want to show the keyboard and not the tablayout when I write something in the search box. When I close the keyboard the tablayout should display again.
Thanks for Help | 0 |
9,942,673 | 03/30/2012 12:11:51 | 359,135 | 06/05/2010 10:21:44 | 473 | 28 | Ruby: add method to existing class | I am newish to Ruby and I am trying to write a method to dynamically add methods to n existing ruby class, here is what I have so far:
class Person
end
def attr_addr (target, attr)
target.send :attr_accessor, attr
end
bob = Person.new
attr_addr(Person,"name")
bob.name = "bob"
But I get:
private method `name=' for ....
What am I doing wrong here? - am I using the wrong approach entirely ;-)?
| ruby | dynamic | null | null | null | null | open | Ruby: add method to existing class
===
I am newish to Ruby and I am trying to write a method to dynamically add methods to n existing ruby class, here is what I have so far:
class Person
end
def attr_addr (target, attr)
target.send :attr_accessor, attr
end
bob = Person.new
attr_addr(Person,"name")
bob.name = "bob"
But I get:
private method `name=' for ....
What am I doing wrong here? - am I using the wrong approach entirely ;-)?
| 0 |
11,017,154 | 06/13/2012 14:32:07 | 525,541 | 11/30/2010 18:10:33 | 246 | 8 | Use Google Apps as a Domain Controller | Is it possible to use google apps as a domain controller. Specifically I want to remove our local dependence on a local windows DC. I want to have it so that users sit down at their workstations and when they log in they are authenticated against google apps user directory. I have yet to figure out how to piece together printer/etc sharing, but the org is currently using google apps for email, contacts, and calender... and box as a file server. The goal is to move us to 100% cloud then write up a case study on the whole affair. | cloud | google-apps | domaincontroller | null | null | 06/13/2012 17:02:16 | off topic | Use Google Apps as a Domain Controller
===
Is it possible to use google apps as a domain controller. Specifically I want to remove our local dependence on a local windows DC. I want to have it so that users sit down at their workstations and when they log in they are authenticated against google apps user directory. I have yet to figure out how to piece together printer/etc sharing, but the org is currently using google apps for email, contacts, and calender... and box as a file server. The goal is to move us to 100% cloud then write up a case study on the whole affair. | 2 |
6,375,861 | 06/16/2011 17:11:05 | 216,743 | 11/23/2009 03:59:24 | 660 | 38 | Why is nothing written to output.txt in this example from a batch file? | I have this in a batch file and nothing is put into output.txt on both Win7 and XP:
IF EXIST %systemdrive%\Test.exe (echo Success: %systemdrive%\Test.exe still exists) else (echo Bug: %systemdrive%\Test.exe file deleted) >> output.txt | windows | batch-file | output | null | null | null | open | Why is nothing written to output.txt in this example from a batch file?
===
I have this in a batch file and nothing is put into output.txt on both Win7 and XP:
IF EXIST %systemdrive%\Test.exe (echo Success: %systemdrive%\Test.exe still exists) else (echo Bug: %systemdrive%\Test.exe file deleted) >> output.txt | 0 |
6,950,675 | 08/05/2011 02:08:36 | 471,196 | 10/09/2010 22:06:41 | 390 | 13 | Test-based progress bar | I'm trying to create a terminal based backup program and I'm looking for some c++ code that creates a text-based progress bar. I understand you can implement it yourself with \b but I thought I'd see if there is any well built implementations already. My favourite implementation of a text-based progress bar is pacman's progress bar on arch linux.
My project is create with C++ (Qt4) | c++ | terminal | text-based | null | null | null | open | Test-based progress bar
===
I'm trying to create a terminal based backup program and I'm looking for some c++ code that creates a text-based progress bar. I understand you can implement it yourself with \b but I thought I'd see if there is any well built implementations already. My favourite implementation of a text-based progress bar is pacman's progress bar on arch linux.
My project is create with C++ (Qt4) | 0 |
11,682,019 | 07/27/2012 05:33:56 | 1,498,958 | 07/03/2012 13:39:23 | 1 | 0 | How To Convert Bit torrent Info hash From Base 32 into Base 16 | I Have a Base 32 Info hash.. eg *IXE2K3JMCPUZWTW3YQZZOIB5XD6KZIEQ*
I need to convert it to base 16...
How can I do it with PHP..
My Code is Below
$hash32=strtolower($hash32);
echo $hash32; // shows - IXE2K3JMCPUZWTW3YQZZOIB5XD6KZIEQ
$hash32=sha1($hash32);
$hash16=base_convert($hash32, 32, 16);
echo "</br>";
echo $hash16 // shows - 3ee5e7325a282c56fe2011125e0492f6ffbcd467
;In my code the 16 based info hash is not valid..
the Valid Info hash is *45C9A56D2C13E99B4EDBC43397203DB8FCACA090*
How can I get a Valid info Hash??
Thanks` | php | convert | bittorrent | info-hash | null | null | open | How To Convert Bit torrent Info hash From Base 32 into Base 16
===
I Have a Base 32 Info hash.. eg *IXE2K3JMCPUZWTW3YQZZOIB5XD6KZIEQ*
I need to convert it to base 16...
How can I do it with PHP..
My Code is Below
$hash32=strtolower($hash32);
echo $hash32; // shows - IXE2K3JMCPUZWTW3YQZZOIB5XD6KZIEQ
$hash32=sha1($hash32);
$hash16=base_convert($hash32, 32, 16);
echo "</br>";
echo $hash16 // shows - 3ee5e7325a282c56fe2011125e0492f6ffbcd467
;In my code the 16 based info hash is not valid..
the Valid Info hash is *45C9A56D2C13E99B4EDBC43397203DB8FCACA090*
How can I get a Valid info Hash??
Thanks` | 0 |
11,460,533 | 07/12/2012 20:56:10 | 1,007,680 | 10/21/2011 18:35:23 | 308 | 15 | Referencing a dynamically created control? | I know how to create a dynamic control in c#:
TextBlock tb = new TextBlock();
tb.Text = "This is a new textblock";
But how would I reference this newly created control through code?
I browsed the net for a solution, and came across this code:
TextBlock tb = (TextBlock)this.FindName("TB");
tb.Text = "Text property changed";
Every time I create a new control with a name I get an exception:
TextBlock tb = new TextBlock();
tb.Text = "This is a new textblock";
tb.Name = "TB";
> "The parameter is incorrect."
Am I doing this correctly? Any help would be greatly appreciated.
Thanks in advance. | c# | windows-phone-7 | dynamic | control | null | null | open | Referencing a dynamically created control?
===
I know how to create a dynamic control in c#:
TextBlock tb = new TextBlock();
tb.Text = "This is a new textblock";
But how would I reference this newly created control through code?
I browsed the net for a solution, and came across this code:
TextBlock tb = (TextBlock)this.FindName("TB");
tb.Text = "Text property changed";
Every time I create a new control with a name I get an exception:
TextBlock tb = new TextBlock();
tb.Text = "This is a new textblock";
tb.Name = "TB";
> "The parameter is incorrect."
Am I doing this correctly? Any help would be greatly appreciated.
Thanks in advance. | 0 |
8,234,372 | 11/22/2011 21:57:09 | 1,059,992 | 11/22/2011 14:38:29 | 26 | 0 | Threading troubles ! When, and when not ! (For best performance) | My question is, when and when not!
**Can anyone give some general rules !**
Say i have an mainForm, and i want to do some buisness by another thread !
Should I:
*) Create a new thread. Like - Thread t = new Thread(new ThreadStart(ThreadProc));
*) Declare an delegate and - myDelegate.BeginInvoke(IsyncCallback) (delegate not control Yes :))
*) Create an System.ComponentModel.BackgroundWorker()
For the best performance !
Example scenarious:
* Fetch data from database to control - or serius background calculation !
* Maybe multi threads if its something like an ATM
* A thread you want to stay a live forever and ever !
And please, give me deep explanations, not like 'I guess' :)
**What buisness you may ask? Thats therefore i want some general rules, it might differ :D**
Thanks !
| c# | multithreading | null | null | null | 11/23/2011 16:38:48 | not constructive | Threading troubles ! When, and when not ! (For best performance)
===
My question is, when and when not!
**Can anyone give some general rules !**
Say i have an mainForm, and i want to do some buisness by another thread !
Should I:
*) Create a new thread. Like - Thread t = new Thread(new ThreadStart(ThreadProc));
*) Declare an delegate and - myDelegate.BeginInvoke(IsyncCallback) (delegate not control Yes :))
*) Create an System.ComponentModel.BackgroundWorker()
For the best performance !
Example scenarious:
* Fetch data from database to control - or serius background calculation !
* Maybe multi threads if its something like an ATM
* A thread you want to stay a live forever and ever !
And please, give me deep explanations, not like 'I guess' :)
**What buisness you may ask? Thats therefore i want some general rules, it might differ :D**
Thanks !
| 4 |
11,621,611 | 07/23/2012 22:46:09 | 1,290,600 | 03/24/2012 22:50:04 | 41 | 3 | Entity Framework - Trouble with .Load() | I have been following this article, http://blogs.msdn.com/b/adonet/archive/2011/01/31/using-dbcontext-in-ef-feature-ctp5-part-6-loading-related-entities.aspx
Specifically the section titled "Applying filters when explicitly loading related entities".
I need to do something like:
db.Configuration.LazyLoadingEnabled = false;
var class = db.Classes.Find(1);
db.Entry(class).Collection(c => c.Students).Query().Where(s => s.grade > 2.0).Load();
When I step through this and watch SQL profiler I see the query that loads the class. Then I see the query that should load the Students, but class.Students is never populated and remains null. However if I copy the students query from SQL profiler and run in myself, the appropriate students are returned. It seems that Entity Framework is running the students query and getting to proper results back, but is not attaching them to the class object.
There are ways I can work around this, but I wondering if I missed a step, or if I am not using .Load() properly.
| entity-framework | null | null | null | null | null | open | Entity Framework - Trouble with .Load()
===
I have been following this article, http://blogs.msdn.com/b/adonet/archive/2011/01/31/using-dbcontext-in-ef-feature-ctp5-part-6-loading-related-entities.aspx
Specifically the section titled "Applying filters when explicitly loading related entities".
I need to do something like:
db.Configuration.LazyLoadingEnabled = false;
var class = db.Classes.Find(1);
db.Entry(class).Collection(c => c.Students).Query().Where(s => s.grade > 2.0).Load();
When I step through this and watch SQL profiler I see the query that loads the class. Then I see the query that should load the Students, but class.Students is never populated and remains null. However if I copy the students query from SQL profiler and run in myself, the appropriate students are returned. It seems that Entity Framework is running the students query and getting to proper results back, but is not attaching them to the class object.
There are ways I can work around this, but I wondering if I missed a step, or if I am not using .Load() properly.
| 0 |
886,615 | 05/20/2009 07:30:04 | 78,892 | 03/17/2009 06:28:27 | 427 | 35 | Is magento really opensource? | For the last month or two I have been trying to wrap my head around Magento, with a moderate degree of success. While it has been billed as the next great e-commerce system , I have come to realize that although it has some pretty neat features ... in reality its a step backward for open-source projects as far as development and community is concerned.
A look at the forums and its full of developers complaining about the lack of documentation, the joke of an official wiki (there are people who post ads on the official wiki) , and also reports of the upgrades breaking core functionality. Most of these posts and valid bug reports are ignored by the Magento staff. A request for some xml diagrams of the core modules has been ignored for an year!
The irc chat is pointless as a lot of new users are greeted by mods who ask them to RTFM!
It seems like there is a conflict of interest for the company that runs Magento, they now sell an enterprise version of Magento and their core business is in providing support for Magento users. I feel it isn't in their best interest to provide documentation for the over-complicated architecture (going through 8 layers of folders to update just a single image).
With all this in mind, would you call Magento an opensource system? | rant | subjective | not-programming-related | null | null | 06/18/2012 03:24:18 | not a real question | Is magento really opensource?
===
For the last month or two I have been trying to wrap my head around Magento, with a moderate degree of success. While it has been billed as the next great e-commerce system , I have come to realize that although it has some pretty neat features ... in reality its a step backward for open-source projects as far as development and community is concerned.
A look at the forums and its full of developers complaining about the lack of documentation, the joke of an official wiki (there are people who post ads on the official wiki) , and also reports of the upgrades breaking core functionality. Most of these posts and valid bug reports are ignored by the Magento staff. A request for some xml diagrams of the core modules has been ignored for an year!
The irc chat is pointless as a lot of new users are greeted by mods who ask them to RTFM!
It seems like there is a conflict of interest for the company that runs Magento, they now sell an enterprise version of Magento and their core business is in providing support for Magento users. I feel it isn't in their best interest to provide documentation for the over-complicated architecture (going through 8 layers of folders to update just a single image).
With all this in mind, would you call Magento an opensource system? | 1 |
5,550,580 | 04/05/2011 10:44:59 | 571,507 | 01/11/2011 16:14:04 | 51 | 5 | Optimal object to return from this method asp.net csharp | Having a checkedboxlist databound with encrypted listitem value, i had written a method to return a array holding respective checked items on postback.
Signature of which would be similar to below
`private Array GetCheckedItems(CheckBoxList ctrlChkbox)
{
//decrypt and push to array
}`
Is this a optimal object to return. I will be accessing the array items again to be individually pushed into DataBase.( I will also be binding the same data with a gridview again to show the records. It's like single page form with a gridview to show records)
Which objects might get me benefits and performance than arrays. key based would be nice i feel. Advice me on this please,
Regards,
Deeptechtons | c# | asp.net | optimization | webusercontrol | null | null | open | Optimal object to return from this method asp.net csharp
===
Having a checkedboxlist databound with encrypted listitem value, i had written a method to return a array holding respective checked items on postback.
Signature of which would be similar to below
`private Array GetCheckedItems(CheckBoxList ctrlChkbox)
{
//decrypt and push to array
}`
Is this a optimal object to return. I will be accessing the array items again to be individually pushed into DataBase.( I will also be binding the same data with a gridview again to show the records. It's like single page form with a gridview to show records)
Which objects might get me benefits and performance than arrays. key based would be nice i feel. Advice me on this please,
Regards,
Deeptechtons | 0 |
10,559,411 | 05/11/2012 22:30:57 | 1,031,822 | 11/06/2011 03:41:52 | 26 | 1 | Manipulating the return of data on a jquery ajax request | So the issue currently doesn't lie in the ajax itself, just what to do once i get the data back. Im having an immense issue in trying to have it prepend the data into a class on dynamic content.
Here is the code that does the ajax request, again the ajax works as expected, but when i tried to prepend the data returned, it would add it to every post on my site ([http://readysetfail.com][1]).
/*
* This is the ajax
*/
$(".reply").on( "submit" , function(event){
event.preventDefault(); // Prevent from submitting.
// Intercept the form submission
var formdata = $(this).serialize(); // Serialize all form data
// Post data to your PHP processing script
$.post( "/comment.php", formdata, function( data ) {
// Act upon the data returned, setting it to #success <div>
$('.reply').parent('.post_comment').children('.view_comments').prepend(data);
$('.hidden').hide();
});
});
/*
* End ajax
*/
Sorry if i'm explaining this awfully, just as a summary this is what i would ideally want. The user to hit Post Comment, then it fades in the comment they posted on the correct post.
Thanks a ton!
Jon
[1]: http://readysetfail.com | javascript | jquery | ajax | fadein | null | null | open | Manipulating the return of data on a jquery ajax request
===
So the issue currently doesn't lie in the ajax itself, just what to do once i get the data back. Im having an immense issue in trying to have it prepend the data into a class on dynamic content.
Here is the code that does the ajax request, again the ajax works as expected, but when i tried to prepend the data returned, it would add it to every post on my site ([http://readysetfail.com][1]).
/*
* This is the ajax
*/
$(".reply").on( "submit" , function(event){
event.preventDefault(); // Prevent from submitting.
// Intercept the form submission
var formdata = $(this).serialize(); // Serialize all form data
// Post data to your PHP processing script
$.post( "/comment.php", formdata, function( data ) {
// Act upon the data returned, setting it to #success <div>
$('.reply').parent('.post_comment').children('.view_comments').prepend(data);
$('.hidden').hide();
});
});
/*
* End ajax
*/
Sorry if i'm explaining this awfully, just as a summary this is what i would ideally want. The user to hit Post Comment, then it fades in the comment they posted on the correct post.
Thanks a ton!
Jon
[1]: http://readysetfail.com | 0 |
10,767,505 | 05/26/2012 15:30:24 | 928,017 | 09/04/2011 22:09:49 | 76 | 3 | 3g modem settings data port device on xubuntu | I found '' Vodafone mobile connect card driver for Linux 2.0 beta3'' application and install it. Now on the first run it ask for a 'data port device' and 'control port device' to enter. How can I find it on xubuntu 9.04? I'm very new Linux user.
| linux | ubuntu | usb | 3g | xubuntu | 05/31/2012 20:17:12 | off topic | 3g modem settings data port device on xubuntu
===
I found '' Vodafone mobile connect card driver for Linux 2.0 beta3'' application and install it. Now on the first run it ask for a 'data port device' and 'control port device' to enter. How can I find it on xubuntu 9.04? I'm very new Linux user.
| 2 |
10,959,403 | 06/09/2012 08:01:35 | 1,445,932 | 06/09/2012 07:57:48 | 1 | 0 | Can't run/load fiddler2 |
I can't open fiddler after installed.
I tried Start/All Programs/Fiddler2 and C:\Program Files\Fiddler2\Fiddler.exe; no success.
There was a loading icon on my cursor, but fiddler did not load.
I checked my task manager, and I sometimes saw fiddler.exe under processes tab, but it quickly disappeared. There is no error message.
I uninstalled Fiddler2, reinstaled and still same problem.
Can anyone please help me out, please?
P.S.: My PC is running Windows 7 | fiddler | null | null | null | null | 06/10/2012 15:47:46 | too localized | Can't run/load fiddler2
===
I can't open fiddler after installed.
I tried Start/All Programs/Fiddler2 and C:\Program Files\Fiddler2\Fiddler.exe; no success.
There was a loading icon on my cursor, but fiddler did not load.
I checked my task manager, and I sometimes saw fiddler.exe under processes tab, but it quickly disappeared. There is no error message.
I uninstalled Fiddler2, reinstaled and still same problem.
Can anyone please help me out, please?
P.S.: My PC is running Windows 7 | 3 |
7,145,917 | 08/22/2011 10:13:29 | 905,658 | 08/22/2011 10:09:38 | 1 | 0 | Lava Lamp navigation problem jQuery Firefox | I'm experiancing a weird problem with my lava lamp navigation. It's adapted after Jeffrey Way's Lava lamp [tutorial][1]. And you can see it here: [www.tnorgaard.com][2].
The code for the lava lamp is at the bottom. Problems appear mainly in firefox (I'm using FF6) but occationally also in Chrome and Safari (but not IE9): The orange line above the menu item sometimes is too long and too much to the right when a page is loaded. When I hover over the item then it centers over it and stays there like it should from the beginning.
Any ideas why that happens? Something weird with position().left and outerWidth()?
Feedback very appreciated!
(function($) {
$.fn.spasticNav = function(options) {
options = $.extend({
speed: 500,
reset: 1500,
color: '#F29400',
easing: 'easeOutExpo'
}, options);
return this.each(function() {
var nav = $(this),
currentPageItem = $('#active', nav),
stroke,
reset;
$('<li id="stroke"></li>').css({
width: currentPageItem.outerWidth(),
height: 4,
margin: 0,
left: currentPageItem.position().left,
top: currentPageItem.position().top,
backgroundColor: options.color
}).appendTo(this);
stroke = $('#stroke', nav);
$('a:not(#stroke)', nav).hover(function() {
// mouse over
clearTimeout(reset);
stroke.animate(
{
left : $(this).position().left,
width : $(this).width()
},
{
duration : options.speed,
easing : options.easing,
queue : false
}
);
}, function() {
// mouse out
reset = setTimeout(function() {
stroke.animate({
width : currentPageItem.outerWidth(),
left : currentPageItem.position().left
}, options.speed)
}, options.reset);
});
});
};
})(jQuery);
[1]: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-a-lava-lamp-style-navigation-menu/
[2]: http://www.tnorgaard.com | jquery | firefox | lavalamp | null | null | null | open | Lava Lamp navigation problem jQuery Firefox
===
I'm experiancing a weird problem with my lava lamp navigation. It's adapted after Jeffrey Way's Lava lamp [tutorial][1]. And you can see it here: [www.tnorgaard.com][2].
The code for the lava lamp is at the bottom. Problems appear mainly in firefox (I'm using FF6) but occationally also in Chrome and Safari (but not IE9): The orange line above the menu item sometimes is too long and too much to the right when a page is loaded. When I hover over the item then it centers over it and stays there like it should from the beginning.
Any ideas why that happens? Something weird with position().left and outerWidth()?
Feedback very appreciated!
(function($) {
$.fn.spasticNav = function(options) {
options = $.extend({
speed: 500,
reset: 1500,
color: '#F29400',
easing: 'easeOutExpo'
}, options);
return this.each(function() {
var nav = $(this),
currentPageItem = $('#active', nav),
stroke,
reset;
$('<li id="stroke"></li>').css({
width: currentPageItem.outerWidth(),
height: 4,
margin: 0,
left: currentPageItem.position().left,
top: currentPageItem.position().top,
backgroundColor: options.color
}).appendTo(this);
stroke = $('#stroke', nav);
$('a:not(#stroke)', nav).hover(function() {
// mouse over
clearTimeout(reset);
stroke.animate(
{
left : $(this).position().left,
width : $(this).width()
},
{
duration : options.speed,
easing : options.easing,
queue : false
}
);
}, function() {
// mouse out
reset = setTimeout(function() {
stroke.animate({
width : currentPageItem.outerWidth(),
left : currentPageItem.position().left
}, options.speed)
}, options.reset);
});
});
};
})(jQuery);
[1]: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-a-lava-lamp-style-navigation-menu/
[2]: http://www.tnorgaard.com | 0 |
10,438,603 | 05/03/2012 20:08:59 | 1,352,485 | 04/23/2012 23:17:32 | 46 | 1 | The best way to construct the image path in jquery for inline css | I have the following code:
$('<div style="background-image:url(\'/images/a.gif\')"></div>').appendTo('body')
depending on where I am on a page the path comes out to be like:
http://www.mysite.com/this/is/where/i/am/_images/spinner.gif
I need it to be "http://www.mysite.com/images/a.gif".
I do not wish to hard code it.
I also do not wish to give it a class name and define it with css.
I have tried this as well:
myVar = window.location.hostname + "/images/a.gif"
and use 'myVar' in the jQuery code above for the path. That doesn't seem to work either. I get something similar to this http://www.mysite.com/this/is/where/i/am/mysite.com/images/a.gif"
So I guess my question is what is the best way to construct a path from jQuery to that image. This information that might be relevant as well:
that jquery code is in main.js which is in the "javascript" folder which has the same parent directory as the "images" folder, so "images" and "javascript" folders are siblings. | javascript | jquery | html | null | null | 05/03/2012 20:29:53 | too localized | The best way to construct the image path in jquery for inline css
===
I have the following code:
$('<div style="background-image:url(\'/images/a.gif\')"></div>').appendTo('body')
depending on where I am on a page the path comes out to be like:
http://www.mysite.com/this/is/where/i/am/_images/spinner.gif
I need it to be "http://www.mysite.com/images/a.gif".
I do not wish to hard code it.
I also do not wish to give it a class name and define it with css.
I have tried this as well:
myVar = window.location.hostname + "/images/a.gif"
and use 'myVar' in the jQuery code above for the path. That doesn't seem to work either. I get something similar to this http://www.mysite.com/this/is/where/i/am/mysite.com/images/a.gif"
So I guess my question is what is the best way to construct a path from jQuery to that image. This information that might be relevant as well:
that jquery code is in main.js which is in the "javascript" folder which has the same parent directory as the "images" folder, so "images" and "javascript" folders are siblings. | 3 |
8,425,130 | 12/08/2011 01:43:41 | 615,701 | 02/14/2011 04:10:26 | 26 | 0 | Designing a unit combat system (java) | Hello I am seeing if I can get help designing/understanding how to make a system in java. I am looking to make a program that will take in different units of a game and add them to a team. Then two teams will battle it out, many many times, for a statistical mean.
The thing I need help with is how to design the units. That is I am wondering do I make a generic unit class, then make classes for each unit, like grunt, that inherits from the generic one or something else. If I do how do I store the units per team yet still be able to call upon them as unique units of one type.
For instance I will have functions that add units to teams, I was thinking arraylist. Then when it comes to combat I would pull a unit from a team and call some of its methods, units can have abilities etc. So I need to know what the unit is, since they will have different methods.
So basically I need help making a system that defines multiple units and allows me to add them to teams and call upon them at different times. Any help? | java | system | null | null | null | 12/08/2011 02:00:33 | not a real question | Designing a unit combat system (java)
===
Hello I am seeing if I can get help designing/understanding how to make a system in java. I am looking to make a program that will take in different units of a game and add them to a team. Then two teams will battle it out, many many times, for a statistical mean.
The thing I need help with is how to design the units. That is I am wondering do I make a generic unit class, then make classes for each unit, like grunt, that inherits from the generic one or something else. If I do how do I store the units per team yet still be able to call upon them as unique units of one type.
For instance I will have functions that add units to teams, I was thinking arraylist. Then when it comes to combat I would pull a unit from a team and call some of its methods, units can have abilities etc. So I need to know what the unit is, since they will have different methods.
So basically I need help making a system that defines multiple units and allows me to add them to teams and call upon them at different times. Any help? | 1 |
1,545,080 | 10/09/2009 17:23:18 | 178,133 | 09/23/2009 23:01:46 | 53 | 0 | Correct C++ code file extension? .cc vs .cpp | I have seen C++ code live in both .cc and .cpp files.
Which of these (or another!) is the best practice/most modern/best to use? http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml seems to suggest .cc, are there any other opinions or options?
I am mainly concerned with programs on Linux systems.
=:) | c++ | filenames | null | null | null | 06/28/2012 14:16:53 | not constructive | Correct C++ code file extension? .cc vs .cpp
===
I have seen C++ code live in both .cc and .cpp files.
Which of these (or another!) is the best practice/most modern/best to use? http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml seems to suggest .cc, are there any other opinions or options?
I am mainly concerned with programs on Linux systems.
=:) | 4 |
6,099,509 | 05/23/2011 15:40:39 | 275,414 | 02/17/2010 16:44:35 | 99 | 2 | Output BLOB video | have been able to output images from BLOB,
however I am now wanting to print out a MOV video which is saved in BLOB as well.
The video type is MOV
I am Using PHP but not sure how to print out the video. | php | video | blob | null | null | null | open | Output BLOB video
===
have been able to output images from BLOB,
however I am now wanting to print out a MOV video which is saved in BLOB as well.
The video type is MOV
I am Using PHP but not sure how to print out the video. | 0 |
827,502 | 05/06/2009 00:14:39 | 8,014 | 09/15/2008 14:55:27 | 1,648 | 83 | PyODBC and Microsoft Access: Inconsistent results from simple query | I am using pyodbc, via Microsoft Jet, to access the data in a Microsoft Access 2003 database from a Python program.
The Microsoft Access database comes from a third-party; I am only reading the data.
I have generally been having success in extracting the data I need, but I recently noticed some discrepancies.
I have boiled it down to a simple query, of the form:
SELECT field1 FROM table WHERE field1 = 601 AND field2 = 9067
I've obfuscated the field names and values but really, it doesn't get much more trivial than that! When I run the query in Access, it returns one record.
Then I run it over pyodbc, with code that looks like this:
connection = pyodbc.connect(connectionString)
rows = self.connection.execute(queryString).fetchall()
(Again, it doesn't get much more trivial than that!)
The value of queryString is cut-and-pasted from the working query in Access, but it returns *no* records. I expected it to return the same record.
When I change the query to search for a different value for field2, bingo, it works. It is only some values it rejects.
So, please help me out. Where should I be looking next to explain this discrepancy? If I can't trust the results of trivial queries, I don't have a chance on this project!
| python | odbc | ms-access | jet | pyodbc | 01/14/2012 06:17:03 | too localized | PyODBC and Microsoft Access: Inconsistent results from simple query
===
I am using pyodbc, via Microsoft Jet, to access the data in a Microsoft Access 2003 database from a Python program.
The Microsoft Access database comes from a third-party; I am only reading the data.
I have generally been having success in extracting the data I need, but I recently noticed some discrepancies.
I have boiled it down to a simple query, of the form:
SELECT field1 FROM table WHERE field1 = 601 AND field2 = 9067
I've obfuscated the field names and values but really, it doesn't get much more trivial than that! When I run the query in Access, it returns one record.
Then I run it over pyodbc, with code that looks like this:
connection = pyodbc.connect(connectionString)
rows = self.connection.execute(queryString).fetchall()
(Again, it doesn't get much more trivial than that!)
The value of queryString is cut-and-pasted from the working query in Access, but it returns *no* records. I expected it to return the same record.
When I change the query to search for a different value for field2, bingo, it works. It is only some values it rejects.
So, please help me out. Where should I be looking next to explain this discrepancy? If I can't trust the results of trivial queries, I don't have a chance on this project!
| 3 |
9,935,099 | 03/29/2012 23:32:38 | 692,572 | 04/05/2011 09:26:09 | 648 | 16 | Infopath - Populating textbox from a SharePoint list datasource but newlines are stripping out | As the title indicates I'm populating an Infopath textbox control using a SharePoint list as a datasource. Unfortunately although there are carriage returns in the text in the SharePoint list it's stripped out of the textbox for no conceivable reason. I've tried numerous controls and a heap of google suggestions but come up short... has anybody encountered this before and know how to tackle it? | textbox | sharepoint2007 | infopath | infopath-2007 | null | null | open | Infopath - Populating textbox from a SharePoint list datasource but newlines are stripping out
===
As the title indicates I'm populating an Infopath textbox control using a SharePoint list as a datasource. Unfortunately although there are carriage returns in the text in the SharePoint list it's stripped out of the textbox for no conceivable reason. I've tried numerous controls and a heap of google suggestions but come up short... has anybody encountered this before and know how to tackle it? | 0 |
1,221,339 | 08/03/2009 09:08:07 | 23,368 | 09/29/2008 07:10:57 | 4,810 | 127 | Are there any IDA Pro alternatives? | The question title says it all:
**Are there any disassembler which provide a feature set comparable to IDA Pro?**
I'm interested in both free and commercial products. Please use one answer per product and if possible write a short comment about it, like "easy to use", "many features", "only support for PE files", ...
Thank you!
| disassembler | debugging | null | null | null | 05/22/2012 19:08:45 | not constructive | Are there any IDA Pro alternatives?
===
The question title says it all:
**Are there any disassembler which provide a feature set comparable to IDA Pro?**
I'm interested in both free and commercial products. Please use one answer per product and if possible write a short comment about it, like "easy to use", "many features", "only support for PE files", ...
Thank you!
| 4 |
10,370,257 | 04/29/2012 06:38:48 | 1,363,827 | 04/29/2012 06:33:29 | 1 | 0 | Can't install Rails | I'm trying to install Rails on OS X Lion and get the message below. I've installed Ruby and updated to the rubyGems version 1.8.5 too.
>Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
>
/opt/local/bin/ruby extconf.rb
creating Makefile
make
/usr/bin/gcc-4.2 -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -arch x86_64 -fno-common -pipe -fno-common -O3 -Wall -arch x86_64 -c parser.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [parser.o] Error 1
>Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/json-1.7.0 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/json-1.7.0/ext/json/ext/parser/gem_make.out
| ruby-on-rails | installation | null | null | null | null | open | Can't install Rails
===
I'm trying to install Rails on OS X Lion and get the message below. I've installed Ruby and updated to the rubyGems version 1.8.5 too.
>Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
>
/opt/local/bin/ruby extconf.rb
creating Makefile
make
/usr/bin/gcc-4.2 -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -arch x86_64 -fno-common -pipe -fno-common -O3 -Wall -arch x86_64 -c parser.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [parser.o] Error 1
>Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/json-1.7.0 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/json-1.7.0/ext/json/ext/parser/gem_make.out
| 0 |
6,305,896 | 06/10/2011 11:43:40 | 755,553 | 05/16/2011 11:33:09 | 1 | 0 | div layers move | I have some div layers on my site that move to the wrong position when you navigate to the page (almost like the margins are being ignored?) this happens in most browsers i.e. Safari, FF, Chrome etc. Does anyone know why this would happen? Interestingly, the site seems OK locally and only seems to play up once I've uploaded it!! I'd appreciate any help/advice anyone can offer....
CSS:
#page-wrap-padding {
width: 1078px;
height: 700px;
margin: 0px auto 0px;
background-color: transparent;
}
#page-wrap {
width: 978px;
height: 610px;
margin: 35px auto 0px;
background: #dc000f;
overflow: hidden;
z-index:1000;
}
#guts{
margin: -15px;
overflow: hidden;
z-index: 2000;
}
#index-innards2{
position: absolute;
background: #dc000f;
margin: 0px 0px 0px 600px;
width: 378px;
height: 550px;
}
#index-innards{
position: absolute;
margin: 104px 0px 0px 230px;
width: 340px;
height: 390px;
}
HTML
<div id="page-wrap-padding">
<div id="page-wrap">
<div id="guts">
<div id="index-innards2">
Content here
</div>
<div id="index-innards">
More content here
</div>
</div>
</div>
</div> | html | css | null | null | null | null | open | div layers move
===
I have some div layers on my site that move to the wrong position when you navigate to the page (almost like the margins are being ignored?) this happens in most browsers i.e. Safari, FF, Chrome etc. Does anyone know why this would happen? Interestingly, the site seems OK locally and only seems to play up once I've uploaded it!! I'd appreciate any help/advice anyone can offer....
CSS:
#page-wrap-padding {
width: 1078px;
height: 700px;
margin: 0px auto 0px;
background-color: transparent;
}
#page-wrap {
width: 978px;
height: 610px;
margin: 35px auto 0px;
background: #dc000f;
overflow: hidden;
z-index:1000;
}
#guts{
margin: -15px;
overflow: hidden;
z-index: 2000;
}
#index-innards2{
position: absolute;
background: #dc000f;
margin: 0px 0px 0px 600px;
width: 378px;
height: 550px;
}
#index-innards{
position: absolute;
margin: 104px 0px 0px 230px;
width: 340px;
height: 390px;
}
HTML
<div id="page-wrap-padding">
<div id="page-wrap">
<div id="guts">
<div id="index-innards2">
Content here
</div>
<div id="index-innards">
More content here
</div>
</div>
</div>
</div> | 0 |
10,684,209 | 05/21/2012 11:18:34 | 1,347,936 | 04/21/2012 06:18:27 | 17 | 0 | XQuery and XSLT are no use after Extension Class | I write a class mediator(AbstractMediator) to convert return code between client and service.
My class mediator return message is :
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body>0000</soapenv:Body></soapenv:Envelope>
After this I need get the return code, and then use XSLT or XQuery construct response message.
But XSLT or XQuery is no use. It always return:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body>0000</soapenv:Body></soapenv:Envelope>
Why XSLT and XQuery is no use after extension class? How to convert return code? Anyone can help me?
Best regards. | class | wso2 | null | null | null | null | open | XQuery and XSLT are no use after Extension Class
===
I write a class mediator(AbstractMediator) to convert return code between client and service.
My class mediator return message is :
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body>0000</soapenv:Body></soapenv:Envelope>
After this I need get the return code, and then use XSLT or XQuery construct response message.
But XSLT or XQuery is no use. It always return:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body>0000</soapenv:Body></soapenv:Envelope>
Why XSLT and XQuery is no use after extension class? How to convert return code? Anyone can help me?
Best regards. | 0 |
2,867,486 | 05/19/2010 16:30:04 | 62,039 | 02/03/2009 17:25:34 | 43 | 2 | Is there an example of checking on if a WCF Service is online? | I will have a client application using a proxy to a WCF Service. This client will be a windows form application doing basicHttpBinding to N number of endpoints at an address.
The problem I want to resolve is that when any windows form application going across the internet to get my web server that must have my web server online will need to know that this particular WCF Service is online. I need an example of how this client on a background thread will be able to do a polling of just "WCF Service.., Are You There?" This way our client application can notify clients before they invest a lot of time in building up work client-side to only be frustrated with the WCF Service being offline.
Again I am looking for a simple way to check for WCF Service "Are You There?" | c# | wcf | null | null | null | null | open | Is there an example of checking on if a WCF Service is online?
===
I will have a client application using a proxy to a WCF Service. This client will be a windows form application doing basicHttpBinding to N number of endpoints at an address.
The problem I want to resolve is that when any windows form application going across the internet to get my web server that must have my web server online will need to know that this particular WCF Service is online. I need an example of how this client on a background thread will be able to do a polling of just "WCF Service.., Are You There?" This way our client application can notify clients before they invest a lot of time in building up work client-side to only be frustrated with the WCF Service being offline.
Again I am looking for a simple way to check for WCF Service "Are You There?" | 0 |
3,394,664 | 08/03/2010 08:06:54 | 407,309 | 07/31/2010 05:52:58 | 6 | 1 | a component for working with databases in .net | i need a component for working with every kind of databases in app.
i want to access and atach to any kind of databases and bring tabals and it's fileds to my app.
please help me.thanks alot. | c# | .net | null | null | null | 08/03/2010 09:13:55 | not a real question | a component for working with databases in .net
===
i need a component for working with every kind of databases in app.
i want to access and atach to any kind of databases and bring tabals and it's fileds to my app.
please help me.thanks alot. | 1 |
10,848,853 | 06/01/2012 10:47:54 | 1,430,471 | 06/01/2012 10:33:40 | 1 | 0 | How to convert a string to enum value in C | I have a file which has some difinitions like:
TRACE( tra_1, "AA")
TRACE( tra_1, "BB")
TRACE( tra_1, "CC")
TRACE( tra_1, "DD")
TRACE( tra_1, "EE")
..
and so on.
where AA, BB, CC, DD and EE are strings.
I want to take those TRACE definitions from file and convert them to enum. The output should look like:
typedef enum{
AA,
BB,
CC,
DD,
EE
} TRACE;
Please help if anybody know the solution. | c | null | null | null | null | 06/02/2012 07:00:19 | too localized | How to convert a string to enum value in C
===
I have a file which has some difinitions like:
TRACE( tra_1, "AA")
TRACE( tra_1, "BB")
TRACE( tra_1, "CC")
TRACE( tra_1, "DD")
TRACE( tra_1, "EE")
..
and so on.
where AA, BB, CC, DD and EE are strings.
I want to take those TRACE definitions from file and convert them to enum. The output should look like:
typedef enum{
AA,
BB,
CC,
DD,
EE
} TRACE;
Please help if anybody know the solution. | 3 |
7,593,192 | 09/29/2011 06:10:34 | 610,094 | 02/09/2011 16:41:48 | 479 | 18 | Eclipse not compile my servlet | I have eclipse project with many packages. I move one .java file from one package to another and then I try to compile. Compile was successful but this file hasn't been compiled. I restart eclipse but this problem still appear. I create new test class ant this class weren't compile again. I use Eclipse Indigo on Mac OSX 10.6.8 Can someone help me. Thanks in advance. | java | eclipse | java-ee | servlets | javacompiler | 09/29/2011 06:22:59 | not a real question | Eclipse not compile my servlet
===
I have eclipse project with many packages. I move one .java file from one package to another and then I try to compile. Compile was successful but this file hasn't been compiled. I restart eclipse but this problem still appear. I create new test class ant this class weren't compile again. I use Eclipse Indigo on Mac OSX 10.6.8 Can someone help me. Thanks in advance. | 1 |
7,803,126 | 10/18/2011 06:12:42 | 1,000,439 | 10/18/2011 05:31:29 | 1 | 0 | get latitude and longitude from postal address using php | i have to know how to get latitute and longitude from a postal address,
Ref : [enter link description here][1]
[1]: http://postal-codes.net/latitude-and-longitude/ | php | address | null | null | null | 10/19/2011 02:43:57 | not a real question | get latitude and longitude from postal address using php
===
i have to know how to get latitute and longitude from a postal address,
Ref : [enter link description here][1]
[1]: http://postal-codes.net/latitude-and-longitude/ | 1 |
1,557,080 | 10/12/2009 21:36:46 | 56,880 | 01/19/2009 23:01:42 | 1 | 3 | Why is java.util.Date's setTime() method not deprecated? | All the other mutators got deprecated back in JDK 1.1, so why was setTime() left as is? Surely java.util.Calendar - the correct way to manipulate dates - can create new instances of java.util.Date as needed using the java.util.Date(long) constructor? | java | null | null | null | null | null | open | Why is java.util.Date's setTime() method not deprecated?
===
All the other mutators got deprecated back in JDK 1.1, so why was setTime() left as is? Surely java.util.Calendar - the correct way to manipulate dates - can create new instances of java.util.Date as needed using the java.util.Date(long) constructor? | 0 |
9,958,755 | 03/31/2012 18:58:45 | 1,193,321 | 02/06/2012 21:15:41 | 572 | 38 | Writing a MongoDB insert statement | I'm fairly new to PHP and MongoDB so it would be really helpful if I got some suggestions from you guys. I've been messing with this loop for hours on end, but to no avail.
This is roughly my input:
while ($currentCol<$maxCols){
$obj = array( $currentarray[0][$currentCol] => $currentarray[$currentRow][$currentCol]);
$collection->insert($obj);
echo $testing;
echo "<br />";
print_r ($obj);
echo "<br />";
$testing++;
$currentCol++;
}
It outputs:
1
Array ( [President ] => George Washington [_id] => MongoId Object ( [$id] => 4f774d924f62e5ca37000160 ) )
2
Array ( [Wikipedia Entry] => http://en.wikipedia.org/wiki/George_Washington [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000161 ) )
3
Array ( [Took office ] => 30/04/1789 [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000162 ) )
4
Array ( [Left office ] => 4/03/1797 [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000163 ) )
5
Array ( [Party ] => Independent [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000164 ) )
6
Array ( [Portrait] => GeorgeWashington.jpg [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000165 ) )
7
Array ( [Thumbnail] => thmb_GeorgeWashington.jpg [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000166 ) )
8
Array ( [Home State] => Virginia [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000167 ) )
The last problem I'm having is to actually combine everything into one insert statement instead of having multiple insert statements as you see above. So, instead of generating 8 insert statements, I'm trying to get it to make 1 insert statement.
Any suggestions? | php | mongodb | null | null | null | null | open | Writing a MongoDB insert statement
===
I'm fairly new to PHP and MongoDB so it would be really helpful if I got some suggestions from you guys. I've been messing with this loop for hours on end, but to no avail.
This is roughly my input:
while ($currentCol<$maxCols){
$obj = array( $currentarray[0][$currentCol] => $currentarray[$currentRow][$currentCol]);
$collection->insert($obj);
echo $testing;
echo "<br />";
print_r ($obj);
echo "<br />";
$testing++;
$currentCol++;
}
It outputs:
1
Array ( [President ] => George Washington [_id] => MongoId Object ( [$id] => 4f774d924f62e5ca37000160 ) )
2
Array ( [Wikipedia Entry] => http://en.wikipedia.org/wiki/George_Washington [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000161 ) )
3
Array ( [Took office ] => 30/04/1789 [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000162 ) )
4
Array ( [Left office ] => 4/03/1797 [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000163 ) )
5
Array ( [Party ] => Independent [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000164 ) )
6
Array ( [Portrait] => GeorgeWashington.jpg [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000165 ) )
7
Array ( [Thumbnail] => thmb_GeorgeWashington.jpg [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000166 ) )
8
Array ( [Home State] => Virginia [_id] => MongoId Object ( [$id] => 4f774d934f62e5ca37000167 ) )
The last problem I'm having is to actually combine everything into one insert statement instead of having multiple insert statements as you see above. So, instead of generating 8 insert statements, I'm trying to get it to make 1 insert statement.
Any suggestions? | 0 |
7,621,728 | 10/01/2011 17:11:32 | 669,002 | 12/13/2010 07:32:48 | 47 | 0 | What all may have gone into making google+ circles' UI? | I have very very limited knowledge regarding UI/UX design and want to learn stuff for a side project I am working on which will bank heavily on good UI/UX. I take Google's circle UI as an excellent example of user friendly UI and would like to know the technologies/techniques which were (probably) used to build and then maybe use it as a reference. | user-interface | user-experience | null | null | null | 10/01/2011 23:45:13 | not constructive | What all may have gone into making google+ circles' UI?
===
I have very very limited knowledge regarding UI/UX design and want to learn stuff for a side project I am working on which will bank heavily on good UI/UX. I take Google's circle UI as an excellent example of user friendly UI and would like to know the technologies/techniques which were (probably) used to build and then maybe use it as a reference. | 4 |
3,478,598 | 08/13/2010 15:56:18 | 351,062 | 05/26/2010 15:13:44 | 57 | 5 | how to get joomla menu object based on name? | This question is bit specific to joomla.
I know if with the code `$menu = &JSite::getMenu()` I can get the reference object of the complete menu. But how can i get a specif menu based on the name?
My Scenario :
I have footer-menu with items : home | about us | rules | privacy policy.
I need to display links to two menu items Rules and privacy policy in a component. I cannot hard code the links, as the itemid would be different in development and production environment.
Do we have some workaround like `$menu = &JSite::getMenu()->get('footer-menu')->getMenuItem('rules');` which can give me refrence object to a particular menu item, from which I can create my links for that particular article.
Thanks,
Tanmay | php | joomla | null | null | null | null | open | how to get joomla menu object based on name?
===
This question is bit specific to joomla.
I know if with the code `$menu = &JSite::getMenu()` I can get the reference object of the complete menu. But how can i get a specif menu based on the name?
My Scenario :
I have footer-menu with items : home | about us | rules | privacy policy.
I need to display links to two menu items Rules and privacy policy in a component. I cannot hard code the links, as the itemid would be different in development and production environment.
Do we have some workaround like `$menu = &JSite::getMenu()->get('footer-menu')->getMenuItem('rules');` which can give me refrence object to a particular menu item, from which I can create my links for that particular article.
Thanks,
Tanmay | 0 |
10,198,380 | 04/17/2012 20:10:52 | 515,585 | 11/22/2010 03:30:03 | 159 | 5 | PHP test if form has file uploaded | How do I do it? These don't work:
if(empty($_FILES)){
echo "there is no file uploaded";
exit;
}else{
echo "there is file";
}
if(sizeof($_FILES)!=0){
echo "there is file";
}else{
echo "there is no file";
}
| php | forms | null | null | null | 04/17/2012 20:55:10 | not a real question | PHP test if form has file uploaded
===
How do I do it? These don't work:
if(empty($_FILES)){
echo "there is no file uploaded";
exit;
}else{
echo "there is file";
}
if(sizeof($_FILES)!=0){
echo "there is file";
}else{
echo "there is no file";
}
| 1 |
4,822,891 | 01/27/2011 22:51:38 | 142,178 | 07/21/2009 17:26:08 | 936 | 72 | Rebol annoying bug: not capable of processing more than 118 caracters on command line | I want to pass a rebol 2 script a path to some directory and it truncates the path to 118 caracters. This makes rebol unsuable for me. Will this limit be alleviated in very some near future ? | rebol | null | null | null | null | 01/31/2011 10:51:32 | too localized | Rebol annoying bug: not capable of processing more than 118 caracters on command line
===
I want to pass a rebol 2 script a path to some directory and it truncates the path to 118 caracters. This makes rebol unsuable for me. Will this limit be alleviated in very some near future ? | 3 |
3,883,035 | 10/07/2010 15:04:02 | 459,762 | 09/27/2010 17:15:58 | 1 | 0 | Use JSON to extract parameters from URL. | How do extract parameters from the URL when the method is posted using JSON?
| json | null | null | null | null | 06/18/2012 17:26:32 | not a real question | Use JSON to extract parameters from URL.
===
How do extract parameters from the URL when the method is posted using JSON?
| 1 |
3,599,763 | 08/30/2010 11:04:54 | 385,335 | 07/07/2010 09:01:07 | 106 | 0 | HOW TO MAKE TEMPLATE FUNCTION | //TEMPLATE FILE
<html>
f_blog_title();
</html>
//TEMPLATE LOAD
<?php
ob_start();
echo file_get_contents('TEMPLATE FILE');
ob_end_flush();
?>
Now my problem is, how to search f_???() and run ??? function? | php | null | null | null | null | 09/02/2010 01:48:16 | not a real question | HOW TO MAKE TEMPLATE FUNCTION
===
//TEMPLATE FILE
<html>
f_blog_title();
</html>
//TEMPLATE LOAD
<?php
ob_start();
echo file_get_contents('TEMPLATE FILE');
ob_end_flush();
?>
Now my problem is, how to search f_???() and run ??? function? | 1 |
4,746,027 | 01/20/2011 10:35:45 | 559,032 | 12/31/2010 06:12:42 | 25 | 3 | how to work with SEO | hi guys i want to work with SEO by php. am not having a quite knowledge in SEO.
what should i do for this SEO.what are the things need it.should i use DB else without of DB can work with SE0.what should i do for keyword search.
thanks in adv | php | javascript | html | css | seo | 01/20/2011 10:43:37 | not a real question | how to work with SEO
===
hi guys i want to work with SEO by php. am not having a quite knowledge in SEO.
what should i do for this SEO.what are the things need it.should i use DB else without of DB can work with SE0.what should i do for keyword search.
thanks in adv | 1 |
8,675,685 | 12/30/2011 02:52:58 | 431,498 | 08/26/2010 06:02:34 | 133 | 10 | Fedora16 Installation Error: No TPM Chip Found | When I try to install Fedora16, it just occured an error like this: " No TPM Chip Found".
How can I continue progress.
PS. I have added "tpm_tis.interrupts=0" param, but it did not worked. | linux | fedora | null | null | null | 12/30/2011 13:00:50 | off topic | Fedora16 Installation Error: No TPM Chip Found
===
When I try to install Fedora16, it just occured an error like this: " No TPM Chip Found".
How can I continue progress.
PS. I have added "tpm_tis.interrupts=0" param, but it did not worked. | 2 |
137,647 | 09/26/2008 03:44:07 | 2,849 | 08/25/2008 14:24:20 | 142 | 11 | IoC Containers - Which is best? (.Net) | I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc.
What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weaknesses? Better fit (like StructureMap is great for ABC but not so good for XYZ)? | inversion-of-control | containers | null | null | null | 09/14/2011 15:20:48 | not constructive | IoC Containers - Which is best? (.Net)
===
I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc.
What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weaknesses? Better fit (like StructureMap is great for ABC but not so good for XYZ)? | 4 |
5,351,270 | 03/18/2011 11:25:21 | 665,942 | 03/18/2011 11:25:21 | 1 | 0 | how the performance will be? | i have a huge application.now i have a requirement for image upload.do i need to create a new database or i can simply create a new table in the same database.how the performance will be? | sql | null | null | null | null | 03/18/2011 11:36:16 | not a real question | how the performance will be?
===
i have a huge application.now i have a requirement for image upload.do i need to create a new database or i can simply create a new table in the same database.how the performance will be? | 1 |
7,935,986 | 10/28/2011 23:46:46 | 980,414 | 10/05/2011 13:12:02 | 1 | 0 | File association in Android 2.3.3 | Can someone tell me, how I can change the existing file associations in Android 2.3.3 on the file level?
I mean how can I set that Android opens a xyz-File with an App of my choice, when I cannot set it in the Application settings (GUI)?
Is there some lists where I can edit this, like e.g. the Registry in Windows?
| android | application | file-associations | null | null | 10/29/2011 12:55:55 | off topic | File association in Android 2.3.3
===
Can someone tell me, how I can change the existing file associations in Android 2.3.3 on the file level?
I mean how can I set that Android opens a xyz-File with an App of my choice, when I cannot set it in the Application settings (GUI)?
Is there some lists where I can edit this, like e.g. the Registry in Windows?
| 2 |
6,718,150 | 07/16/2011 14:54:59 | 662,827 | 03/16/2011 15:57:54 | 115 | 0 | How to prevent duplicate posts via a browser refresh? | Will the following stop accidental duplicate entries in my database if the user posts a form and then clicks the browser refresh button?
<?php
if( $_SERVER['REQUEST_METHOD']=='POST' ) {
try {
// write to database
} catch($e) {
// error reporting
}
}
?> | php | php5 | null | null | null | 07/17/2011 11:47:23 | not a real question | How to prevent duplicate posts via a browser refresh?
===
Will the following stop accidental duplicate entries in my database if the user posts a form and then clicks the browser refresh button?
<?php
if( $_SERVER['REQUEST_METHOD']=='POST' ) {
try {
// write to database
} catch($e) {
// error reporting
}
}
?> | 1 |
8,496,671 | 12/13/2011 21:49:24 | 1,095,845 | 12/13/2011 13:31:46 | 1 | 0 | What is float? (Simple explanation needed) | Sorry for the silly question, but I'm learning from the begining and I dont understand the meaning of the word Float?
I have an excercise where i have to square a float ?
Thank you | float | null | null | null | null | 12/13/2011 22:03:25 | not a real question | What is float? (Simple explanation needed)
===
Sorry for the silly question, but I'm learning from the begining and I dont understand the meaning of the word Float?
I have an excercise where i have to square a float ?
Thank you | 1 |
11,222,411 | 06/27/2012 08:41:30 | 705,725 | 04/13/2011 09:40:45 | 472 | 4 | How to detect divs which are on top of each other? | How can I write javascript to detect that d2 is over d1?
[http://jsfiddle.net/mNsWT/][1]
[1]: http://jsfiddle.net/mNsWT/ | javascript | jquery | html | css | positioning | 06/27/2012 18:27:59 | not a real question | How to detect divs which are on top of each other?
===
How can I write javascript to detect that d2 is over d1?
[http://jsfiddle.net/mNsWT/][1]
[1]: http://jsfiddle.net/mNsWT/ | 1 |
11,086,837 | 06/18/2012 16:13:27 | 245,926 | 01/07/2010 20:59:05 | 844 | 9 | Cascading Dropdowns Windows Application | I was looking at a friends code where he was trying to create a cascading dropdown filtering solution in a windows application (similar to the one ajax provides).
He wants to have the user make a selection in comboxbox1 and based on the users selection other comboboxes on the form get populated with filtered data.
In creating a data layer for this he wants to grab all the rows data from the database when the form loads, then use linq to filter the data based on the users selections
Is bringing all the data in 1 shot then filtering it locally a good idea?
What about calling the database everytime a user selects something different and populating the all the comboboxes just getting the filtered data over calls when the user selects something different?
Or maybe is there a better approach than what is listed here? | c# | winforms | null | null | null | 06/19/2012 17:40:49 | not constructive | Cascading Dropdowns Windows Application
===
I was looking at a friends code where he was trying to create a cascading dropdown filtering solution in a windows application (similar to the one ajax provides).
He wants to have the user make a selection in comboxbox1 and based on the users selection other comboboxes on the form get populated with filtered data.
In creating a data layer for this he wants to grab all the rows data from the database when the form loads, then use linq to filter the data based on the users selections
Is bringing all the data in 1 shot then filtering it locally a good idea?
What about calling the database everytime a user selects something different and populating the all the comboboxes just getting the filtered data over calls when the user selects something different?
Or maybe is there a better approach than what is listed here? | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.