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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,896,281 | 01/17/2012 14:26:59 | 1,154,110 | 01/17/2012 14:24:00 | 1 | 0 | void Value not ignored as it ought to be -- C | void getdata(int arr[],int n)
{
for(int i=0; i < n;i++)
{
int a = srand(time(NULL))
arr[i] = a;
}
}
and i call my function in main
getdata(arr,1024);
but i dont understand what is wrong with that what i take this error ?
Ty.
| c | null | null | null | null | null | open | void Value not ignored as it ought to be -- C
===
void getdata(int arr[],int n)
{
for(int i=0; i < n;i++)
{
int a = srand(time(NULL))
arr[i] = a;
}
}
and i call my function in main
getdata(arr,1024);
but i dont understand what is wrong with that what i take this error ?
Ty.
| 0 |
7,975,935 | 11/02/2011 04:50:49 | 1,022,677 | 10/31/2011 20:36:27 | 28 | 0 | Is there a LINQ function for getting the longest string in a list of strings? | Is there a LINQ function for this is or would one have to code it themselves like this:
static string GetLongestStringInList()
{
string longest = list[0];
foreach (string s in list)
{
if (s.Length > longest.Length)
{
longest = s;
}
}
return longest;
} | c# | string | linq | null | null | null | open | Is there a LINQ function for getting the longest string in a list of strings?
===
Is there a LINQ function for this is or would one have to code it themselves like this:
static string GetLongestStringInList()
{
string longest = list[0];
foreach (string s in list)
{
if (s.Length > longest.Length)
{
longest = s;
}
}
return longest;
} | 0 |
6,310,040 | 06/10/2011 17:33:45 | 679,047 | 03/27/2011 15:18:24 | 17 | 0 | Neo4j Standalone vs Embedded server? | I want to know what is the difference between these two implementations of neo4j. Of-course names of both techniques is self-explanatory,but still what are the main differences?
What factors should be considered in deciding which technique to use in the project?
Pros and cons.
P.S. Sorry if it is a repeat question but I searched and was not able to find any ques which answers my question. | embedded | standalone | neo4j | null | null | null | open | Neo4j Standalone vs Embedded server?
===
I want to know what is the difference between these two implementations of neo4j. Of-course names of both techniques is self-explanatory,but still what are the main differences?
What factors should be considered in deciding which technique to use in the project?
Pros and cons.
P.S. Sorry if it is a repeat question but I searched and was not able to find any ques which answers my question. | 0 |
8,048,898 | 11/08/2011 10:19:45 | 846,351 | 07/15/2011 11:20:02 | 346 | 7 | Multithreaded/Parallel programing book? | hi guys I'm looking for a through guide for .NET parallel programing in C# from framework 1.1 to 5.0
one with many real life examples and exercises.
I know the basics as race conditions deadlocks etc..
but how to actually use those in real life, and what tools .NET provides?
what is recommended?
| c# | multithreading | c#-4.0 | parallel-processing | null | 11/08/2011 10:28:22 | not constructive | Multithreaded/Parallel programing book?
===
hi guys I'm looking for a through guide for .NET parallel programing in C# from framework 1.1 to 5.0
one with many real life examples and exercises.
I know the basics as race conditions deadlocks etc..
but how to actually use those in real life, and what tools .NET provides?
what is recommended?
| 4 |
5,162,544 | 03/02/2011 01:46:44 | 626,883 | 02/21/2011 15:54:00 | 30 | 0 | c++ library issue | I'm trying to make a call to a c++ assembly from my c#. I also have a sample application written in c++ that invokes the same library, and works fine. However, the call from c# throws an error: "attempted to read or write protected memory. this is often an indication that other memory is corrupt".
The c# code is:
#region DllImports
[DllImport("kernel32.dll", EntryPoint = "LoadLibrary")]
static extern int LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpLibFileName);
[DllImport("kernel32.dll", EntryPoint = "GetProcAddress")]
static extern IntPtr GetProcAddress(int hModule, [MarshalAs(UnmanagedType.LPStr)] string lpProcName);
[DllImport("kernel32.dll", EntryPoint = "FreeLibrary")]
static extern bool FreeLibrary(int hModule);
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
delegate string bondProbeCalc(string licenseFolder, string requestString);
#endregion
/// <summary>
/// Calls Bondprobe to calculate a formula
/// </summary>
internal static string DoBondProbeOperation(string requestString)
{
if (string.IsNullOrEmpty(requestString)) throw new ArgumentNullException();
//Reference library
int hModule = LoadLibrary(ConfigurationManager.Instance.BondProbeSettings.AssemblyFilePath);
if (hModule != 0)
{
IntPtr intPtr = GetProcAddress(hModule, "bpStringCalc");
bondProbeCalc funcDelegate = (bondProbeCalc)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(bondProbeCalc));
requestString = requestString.EndsWith("=") ? requestString.Substring(0, requestString.Length - 1) : requestString;
string returnValue = funcDelegate(ConfigurationManager.Instance.BondProbeSettings.LicenseFilePath, requestString);
FreeLibrary(hModule);
return returnValue;
}
return string.Empty;
}
This exact same code works on some computers, and it throws the error on others. However, the sample c++ app seems to work everywhere.
Any ideas?
Thanks, Gonzalo | c# | c++ | c | null | null | null | open | c++ library issue
===
I'm trying to make a call to a c++ assembly from my c#. I also have a sample application written in c++ that invokes the same library, and works fine. However, the call from c# throws an error: "attempted to read or write protected memory. this is often an indication that other memory is corrupt".
The c# code is:
#region DllImports
[DllImport("kernel32.dll", EntryPoint = "LoadLibrary")]
static extern int LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpLibFileName);
[DllImport("kernel32.dll", EntryPoint = "GetProcAddress")]
static extern IntPtr GetProcAddress(int hModule, [MarshalAs(UnmanagedType.LPStr)] string lpProcName);
[DllImport("kernel32.dll", EntryPoint = "FreeLibrary")]
static extern bool FreeLibrary(int hModule);
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
delegate string bondProbeCalc(string licenseFolder, string requestString);
#endregion
/// <summary>
/// Calls Bondprobe to calculate a formula
/// </summary>
internal static string DoBondProbeOperation(string requestString)
{
if (string.IsNullOrEmpty(requestString)) throw new ArgumentNullException();
//Reference library
int hModule = LoadLibrary(ConfigurationManager.Instance.BondProbeSettings.AssemblyFilePath);
if (hModule != 0)
{
IntPtr intPtr = GetProcAddress(hModule, "bpStringCalc");
bondProbeCalc funcDelegate = (bondProbeCalc)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(bondProbeCalc));
requestString = requestString.EndsWith("=") ? requestString.Substring(0, requestString.Length - 1) : requestString;
string returnValue = funcDelegate(ConfigurationManager.Instance.BondProbeSettings.LicenseFilePath, requestString);
FreeLibrary(hModule);
return returnValue;
}
return string.Empty;
}
This exact same code works on some computers, and it throws the error on others. However, the sample c++ app seems to work everywhere.
Any ideas?
Thanks, Gonzalo | 0 |
2,100,635 | 01/20/2010 10:31:11 | 232,812 | 12/16/2009 09:40:31 | 1 | 0 | Objective-C #import a whole directory | Hey guys, sure hope you can help me.
I've got around 50 Model-Classes stored in a seperate Folder (not only a group) and I really don't want to write an #import for each of these classes.
Is there a way to import a whole directory?
I know it's possible within other programming languaged and perhabs I simply used wrong syntax.
Plz help me!
greets Infinite | objective-c | import | directory | null | null | null | open | Objective-C #import a whole directory
===
Hey guys, sure hope you can help me.
I've got around 50 Model-Classes stored in a seperate Folder (not only a group) and I really don't want to write an #import for each of these classes.
Is there a way to import a whole directory?
I know it's possible within other programming languaged and perhabs I simply used wrong syntax.
Plz help me!
greets Infinite | 0 |
4,246,387 | 11/22/2010 14:25:27 | 118,810 | 06/07/2009 13:08:46 | 312 | 11 | Is Razor mature enough to use it in application right now? | Good day!
I'm planning to upgrade WebForms application and I have two possible choices:
- Write it in ASP.NET MVC 2.0 with WebForms view engine and upgrade it to 3.0 when it will be out
- Write it using ASP.NET MVC 3.0 RC with Razor as view engine
It seems that Razor is the only 3.0 feature I really can take advantage off for this task.
The launch date for application is Q1 of 2011 so there is a chance that ASP.NET MVC 3.0 will come out as RTM.
So, is Razor mature enough? | asp.net-mvc | razor | null | null | null | 11/22/2010 16:38:04 | not constructive | Is Razor mature enough to use it in application right now?
===
Good day!
I'm planning to upgrade WebForms application and I have two possible choices:
- Write it in ASP.NET MVC 2.0 with WebForms view engine and upgrade it to 3.0 when it will be out
- Write it using ASP.NET MVC 3.0 RC with Razor as view engine
It seems that Razor is the only 3.0 feature I really can take advantage off for this task.
The launch date for application is Q1 of 2011 so there is a chance that ASP.NET MVC 3.0 will come out as RTM.
So, is Razor mature enough? | 4 |
6,673,632 | 07/13/2011 03:07:22 | 627,569 | 02/22/2011 01:52:21 | 1,863 | 180 | Try-with-resources in Java 7? | In the new Try-with-Resources syntax in Java 7 do I need to worry about the order of the resources?
try (InputStream in = loadInput(...); // <--- can these be in any order?
OutputStream out = createOutput(...) ){
copy(in, out);
}
catch (Exception e) {
// Problem reading and writing streams.
// Or problem opening one of them.
// If compound error closing streams occurs, it will be recorded on this exception
// as a "suppressedException".
} | java-7 | try-with-resources | null | null | null | null | open | Try-with-resources in Java 7?
===
In the new Try-with-Resources syntax in Java 7 do I need to worry about the order of the resources?
try (InputStream in = loadInput(...); // <--- can these be in any order?
OutputStream out = createOutput(...) ){
copy(in, out);
}
catch (Exception e) {
// Problem reading and writing streams.
// Or problem opening one of them.
// If compound error closing streams occurs, it will be recorded on this exception
// as a "suppressedException".
} | 0 |
5,226,827 | 03/08/2011 00:00:55 | 591,149 | 01/26/2011 19:04:00 | 1 | 0 | complex data requirement. | Here is my query:
select
Table1.a,
Table1.b,
Table1.c,
Table1.d,
Table2.e,
Table3.f,
Table4.g,
Table5.h
from Table1
left join Table6 on Table1.b=Table6.b
left join Table3 on Table6.j=Table3.j
left join Table7 on Table1.b=Table7.b
left join Table5 on Table7.h=Table5.h
inner join Table4 on Table1.k=Table4.k
inner join Table2 on Table1.m=Table2.m
where
Table2.e <= x
and Table2.n = y
and Table3.f in (‘r’, ‘s’)
and Table1.d = z
group by
Table1.a,
Table1.b,
Table1.c,
Table1.d,
Table2.e,
Table3.f,
Table4.g,
Table5.h
order by
Table1.a,
Table1.b,
Table1.c
I am looking for records (a,b,c,d,e,f,g,h) for every a when the very first record b (there are multiple records b for each a) is either 'r' or 's'. Can someone help? | tsql | null | null | null | null | null | open | complex data requirement.
===
Here is my query:
select
Table1.a,
Table1.b,
Table1.c,
Table1.d,
Table2.e,
Table3.f,
Table4.g,
Table5.h
from Table1
left join Table6 on Table1.b=Table6.b
left join Table3 on Table6.j=Table3.j
left join Table7 on Table1.b=Table7.b
left join Table5 on Table7.h=Table5.h
inner join Table4 on Table1.k=Table4.k
inner join Table2 on Table1.m=Table2.m
where
Table2.e <= x
and Table2.n = y
and Table3.f in (‘r’, ‘s’)
and Table1.d = z
group by
Table1.a,
Table1.b,
Table1.c,
Table1.d,
Table2.e,
Table3.f,
Table4.g,
Table5.h
order by
Table1.a,
Table1.b,
Table1.c
I am looking for records (a,b,c,d,e,f,g,h) for every a when the very first record b (there are multiple records b for each a) is either 'r' or 's'. Can someone help? | 0 |
7,684,537 | 10/07/2011 08:01:41 | 593,627 | 01/28/2011 10:20:04 | 5,622 | 236 | How to update field from SQL database | I have a lotus notes application that has a document with a `Number`, and a `description` field.
Users reserve a series of numbers at which point documents are created. They then fill in the description and a few other things.
Once this is done they go into another, application (Qpulse; not a notes application) that stores its data in an SQL database.
They will create documents in that system with matching numbers.
Once the documents are created in that system (Qpulse) i'd like update the description field in notes.
How i've done it in the past is to have a notes agent running that does a query, looping through the results finding and updating notes documents.
Is there a better way of doing this? It would be nice to have it automatically updating. | sql | fields | lotus-notes | updating | null | null | open | How to update field from SQL database
===
I have a lotus notes application that has a document with a `Number`, and a `description` field.
Users reserve a series of numbers at which point documents are created. They then fill in the description and a few other things.
Once this is done they go into another, application (Qpulse; not a notes application) that stores its data in an SQL database.
They will create documents in that system with matching numbers.
Once the documents are created in that system (Qpulse) i'd like update the description field in notes.
How i've done it in the past is to have a notes agent running that does a query, looping through the results finding and updating notes documents.
Is there a better way of doing this? It would be nice to have it automatically updating. | 0 |
7,244,381 | 08/30/2011 13:56:10 | 403,658 | 07/27/2010 16:57:36 | 600 | 31 | Why is does my stopwatch keep reseting after 1 second | So I have the following code block:
var sw = new Stopwatch();
sw.Start();
while (sw.Elapsed.Seconds<10)
{
System.Threading.Thread.Sleep(50);
Console.WriteLine(sw.Elapsed.Milliseconds.ToString() + " ms");
}
sw.Stop();
and in the output I have
50 ms
101 ms
151 ms
202 ms
253 ms
304 ms
355 ms
405 ms
456 ms
507 ms
558 ms
608 ms
659 ms
710 ms
761 ms
812 ms
862 ms
913 ms
964 ms
15 ms
65 ms
116 ms
167 ms
218 ms
Why does it reset every 1000 ms? I need to wait for 10 seconds and I can't use `Thread.Sleep(10000);` because this 3rd party library i use sleeps also and I need it to do stuff during that time.
| c# | null | null | null | null | null | open | Why is does my stopwatch keep reseting after 1 second
===
So I have the following code block:
var sw = new Stopwatch();
sw.Start();
while (sw.Elapsed.Seconds<10)
{
System.Threading.Thread.Sleep(50);
Console.WriteLine(sw.Elapsed.Milliseconds.ToString() + " ms");
}
sw.Stop();
and in the output I have
50 ms
101 ms
151 ms
202 ms
253 ms
304 ms
355 ms
405 ms
456 ms
507 ms
558 ms
608 ms
659 ms
710 ms
761 ms
812 ms
862 ms
913 ms
964 ms
15 ms
65 ms
116 ms
167 ms
218 ms
Why does it reset every 1000 ms? I need to wait for 10 seconds and I can't use `Thread.Sleep(10000);` because this 3rd party library i use sleeps also and I need it to do stuff during that time.
| 0 |
10,958,554 | 06/09/2012 05:13:49 | 1,000,847 | 10/18/2011 09:56:12 | 168 | 1 | Dot lock protection for IPhone app | In Android, there is one feature for login protecting by dot lock password. For IPhone, I have seen some apps in app store to implemented that features for protecting photos, mail, videos and etc.
I want to create that feature(for login password) in IPhone app. Is that possible?
If you have any idea (or) sample codes, please share with me.
Thank for your support and time.
| iphone | ios | login | password-protection | null | 06/10/2012 16:16:55 | not a real question | Dot lock protection for IPhone app
===
In Android, there is one feature for login protecting by dot lock password. For IPhone, I have seen some apps in app store to implemented that features for protecting photos, mail, videos and etc.
I want to create that feature(for login password) in IPhone app. Is that possible?
If you have any idea (or) sample codes, please share with me.
Thank for your support and time.
| 1 |
11,308,923 | 07/03/2012 10:23:51 | 1,498,456 | 07/03/2012 10:18:13 | 1 | 0 | How 2 populate amazon cloud search using ASP DOT NET and HTTP API | Can any one help me with a link od how to add data to amazon cloud search using HTML API in ASP .NET.
I have googled it and even seen in the sample codes in amazon but was did'nt find a cingle link.
| asp.net | asp.net-mvc | null | null | null | 07/04/2012 12:59:22 | not constructive | How 2 populate amazon cloud search using ASP DOT NET and HTTP API
===
Can any one help me with a link od how to add data to amazon cloud search using HTML API in ASP .NET.
I have googled it and even seen in the sample codes in amazon but was did'nt find a cingle link.
| 4 |
11,198,404 | 06/25/2012 22:40:30 | 105,035 | 05/11/2009 21:40:38 | 2,060 | 17 | WCF Async Service or MVC Async controller thread usage? | Can anyone explain when to use async controller versus an async wcf service? As in thread usage etc?
My async controller looks like this
public class EventController : AsyncController
{
[HttpPost]
public void RecordAsync(EventData eventData)
{
AsyncManager.OutstandingOperations.Increment();
Debug.WriteLine(string.Empty);
Debug.WriteLine("****** Writing to database -- n:{0} l:{1} ******", eventData.Name, eventData.Location);
new Thread(() =>
{
AsyncManager.Parameters["eventData"] = eventData;
AsyncManager.OutstandingOperations.Decrement();
}).Start();
}
public ActionResult RecordCompleted(EventData eventData)
{
Debug.WriteLine("****** Complete -- n:{0} l:{1} ******", eventData.Name, eventData.Location);
Debug.WriteLine(string.Empty);
return new EmptyResult();
}
}
vs my WCF Service
[ServiceBehavior(Namespace = ServiceConstants.Namespace)]
public class EventCaptureService: IEventCaptureService
{
public EventCaptureInfo EventCaptureInfo { get; set; }
public IAsyncResult BeginAddEventInfo(EventCaptureInfo eventInfo, AsyncCallback wcfCallback, object asyncState)
{
this.EventCaptureInfo = eventInfo;
var task = Task.Factory.StartNew(this.PersistEventInfo, asyncState);
return task.ContinueWith(res => wcfCallback(task));
}
public void EndAddEventInfo(IAsyncResult result)
{
Debug.WriteLine("Task Completed");
}
private void PersistEventInfo(object state)
{
Debug.WriteLine("Foo:{0}", new object[]{ EventCaptureInfo.Foo});
}
}
Notice the WCF Service uses Task whereas the Controller uses Thread. I know little about threads and how they work. I was just wondering which of these would be more effecient and not bomb my server. The overall goal is to capture some activity in a Web App and call either the controller or the service (either of which will be on a different domain) and which is a better approach is better. Which is truly async? Do they use the same threads? Any help, tips, tricks, links etc... is always appreciated. My basic question is Async WCF Service or Async MVC Controller?
Thanks! | c# | wcf | mvc | asynchronous | thread-safety | null | open | WCF Async Service or MVC Async controller thread usage?
===
Can anyone explain when to use async controller versus an async wcf service? As in thread usage etc?
My async controller looks like this
public class EventController : AsyncController
{
[HttpPost]
public void RecordAsync(EventData eventData)
{
AsyncManager.OutstandingOperations.Increment();
Debug.WriteLine(string.Empty);
Debug.WriteLine("****** Writing to database -- n:{0} l:{1} ******", eventData.Name, eventData.Location);
new Thread(() =>
{
AsyncManager.Parameters["eventData"] = eventData;
AsyncManager.OutstandingOperations.Decrement();
}).Start();
}
public ActionResult RecordCompleted(EventData eventData)
{
Debug.WriteLine("****** Complete -- n:{0} l:{1} ******", eventData.Name, eventData.Location);
Debug.WriteLine(string.Empty);
return new EmptyResult();
}
}
vs my WCF Service
[ServiceBehavior(Namespace = ServiceConstants.Namespace)]
public class EventCaptureService: IEventCaptureService
{
public EventCaptureInfo EventCaptureInfo { get; set; }
public IAsyncResult BeginAddEventInfo(EventCaptureInfo eventInfo, AsyncCallback wcfCallback, object asyncState)
{
this.EventCaptureInfo = eventInfo;
var task = Task.Factory.StartNew(this.PersistEventInfo, asyncState);
return task.ContinueWith(res => wcfCallback(task));
}
public void EndAddEventInfo(IAsyncResult result)
{
Debug.WriteLine("Task Completed");
}
private void PersistEventInfo(object state)
{
Debug.WriteLine("Foo:{0}", new object[]{ EventCaptureInfo.Foo});
}
}
Notice the WCF Service uses Task whereas the Controller uses Thread. I know little about threads and how they work. I was just wondering which of these would be more effecient and not bomb my server. The overall goal is to capture some activity in a Web App and call either the controller or the service (either of which will be on a different domain) and which is a better approach is better. Which is truly async? Do they use the same threads? Any help, tips, tricks, links etc... is always appreciated. My basic question is Async WCF Service or Async MVC Controller?
Thanks! | 0 |
7,317,699 | 09/06/2011 09:27:37 | 896,472 | 08/16/2011 10:32:59 | 6 | 1 | Suggestions based on old transactions | I want to use some mechanisms to suggest(or refer) the items in the database to users based on the current transaction. For ex, In IMDB or Amazon, users are suggested with items based on the current viewing item. What should i read to implement such kind of mechanism? I need to implement it in java. Is there any java API that simplifies my process. I know there might be involving in learning concepts. But i don't know where to start. I want the knowledge base so that i can learn things before implementing them. Suggestion would be helpful a lot to me. | suggestions | autosuggest | null | null | null | 09/24/2011 14:55:36 | not a real question | Suggestions based on old transactions
===
I want to use some mechanisms to suggest(or refer) the items in the database to users based on the current transaction. For ex, In IMDB or Amazon, users are suggested with items based on the current viewing item. What should i read to implement such kind of mechanism? I need to implement it in java. Is there any java API that simplifies my process. I know there might be involving in learning concepts. But i don't know where to start. I want the knowledge base so that i can learn things before implementing them. Suggestion would be helpful a lot to me. | 1 |
10,698,205 | 05/22/2012 08:12:29 | 1,061,499 | 11/23/2011 09:03:38 | 635 | 23 | Javascript code check in JSPs | Is there a way, in Eclipse, to enable some kind of code check for Javascript inside a JSP?
I have some code between `<script>` tags and when a syntax error occurs I cannot easily find where the error is... This is very annoying... | javascript | eclipse | jsp | valid | null | null | open | Javascript code check in JSPs
===
Is there a way, in Eclipse, to enable some kind of code check for Javascript inside a JSP?
I have some code between `<script>` tags and when a syntax error occurs I cannot easily find where the error is... This is very annoying... | 0 |
936,895 | 06/01/2009 21:30:37 | 9,382 | 09/15/2008 18:36:29 | 1,370 | 30 | SQL Server 2005 Service Pack 3 won't install. | I am trying to install SQL Server 2005 Service Pack 3 and it keeps failing. Comes back with the following:
Microsoft SQL Server 2005 - Update 'Service Pack 3 for SQL Server Database Services 2005 ENU (KB955706)' could not be installed. Error code 1603.
The detailed dump reveals the following:
MSI (s) (90:C8) [13:50:17:776]: Note: 1: 1729
MSI (s) (90:C8) [13:50:17:776]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:776]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Product: Microsoft SQL Server 2005 -- Configuration failed.
Does it mean anything to anybody?
| sql-server-2005 | servicepacks | sp3 | null | null | 10/04/2009 19:51:29 | off topic | SQL Server 2005 Service Pack 3 won't install.
===
I am trying to install SQL Server 2005 Service Pack 3 and it keeps failing. Comes back with the following:
Microsoft SQL Server 2005 - Update 'Service Pack 3 for SQL Server Database Services 2005 ENU (KB955706)' could not be installed. Error code 1603.
The detailed dump reveals the following:
MSI (s) (90:C8) [13:50:17:776]: Note: 1: 1729
MSI (s) (90:C8) [13:50:17:776]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:776]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:792]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:792]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Transforming table Error.
MSI (s) (90:C8) [13:50:17:807]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (90:C8) [13:50:17:807]: Product: Microsoft SQL Server 2005 -- Configuration failed.
Does it mean anything to anybody?
| 2 |
8,198,420 | 11/20/2011 00:13:55 | 341,497 | 05/13/2010 11:21:07 | 176 | 11 | Open source VNC client for Android | Where can i find an open source VNC (RFB) client?
Thanks,
Eyal. | android | open-source | vnc | null | null | 11/20/2011 01:58:09 | off topic | Open source VNC client for Android
===
Where can i find an open source VNC (RFB) client?
Thanks,
Eyal. | 2 |
11,658,893 | 07/25/2012 21:26:34 | 1,438,637 | 06/06/2012 01:29:55 | 45 | 0 | Neural network - data with both binary and continuous inputs? | I'm using the nnet package in R to attempt to build an ANN to predict real estate prices for condos (personal project). I am new to this and don't have a math background so please bare with me.
I have input variables that are both binary and continuous. For example some binary variables which were originally yes/no were converted to 1/0 for the neural net. Other variables are continuous like sqft.
[Sample of input data][1]
I have normalized all values to be on a 0-1 scale. Maybe bedrooms and bathroom shouldn't be normalized since their range is only 0-4?
Do these mixed inputs present a problem for the ANN? I've gotten okay results, but upon closer examination the weights the ANN has chosen for certain variables don't seem to make sense. My code is below, any suggestions?
`ANN <- nnet(Price ~ Sqft + Bedrooms + Bathrooms + Parking2 + Elevator +`
`Central.AC + Terrace + Washer.Dryer + Doorman + Exercise.Room +` `New.York.View,data[1:700,],size=3, maxit=5000, linout=TRUE, decay=.0001)`
[1]: http://i.stack.imgur.com/KydHM.png | r | neural-network | null | null | null | 07/26/2012 13:00:20 | off topic | Neural network - data with both binary and continuous inputs?
===
I'm using the nnet package in R to attempt to build an ANN to predict real estate prices for condos (personal project). I am new to this and don't have a math background so please bare with me.
I have input variables that are both binary and continuous. For example some binary variables which were originally yes/no were converted to 1/0 for the neural net. Other variables are continuous like sqft.
[Sample of input data][1]
I have normalized all values to be on a 0-1 scale. Maybe bedrooms and bathroom shouldn't be normalized since their range is only 0-4?
Do these mixed inputs present a problem for the ANN? I've gotten okay results, but upon closer examination the weights the ANN has chosen for certain variables don't seem to make sense. My code is below, any suggestions?
`ANN <- nnet(Price ~ Sqft + Bedrooms + Bathrooms + Parking2 + Elevator +`
`Central.AC + Terrace + Washer.Dryer + Doorman + Exercise.Room +` `New.York.View,data[1:700,],size=3, maxit=5000, linout=TRUE, decay=.0001)`
[1]: http://i.stack.imgur.com/KydHM.png | 2 |
10,256,758 | 04/21/2012 06:14:54 | 651,174 | 03/09/2011 08:26:41 | 1,595 | 41 | Strategies for large amount of db queries for single page request | For sites like IMDB ( http://www.imdb.com/name/nm0000138/), LinkedIn, or Facebook, it seems like there could be a thousand queries for the loading of a single page.
Is there an upper limit on the number of queries that can be (sensibly) generated on a page request? Or is this problem solved by caching, like `memcached`? Are there other strategies that can also be employed? (I imagine on IMDB the content is for the most part static for a user's page.) | mysql | sql | caching | memcached | null | 04/23/2012 02:45:46 | not constructive | Strategies for large amount of db queries for single page request
===
For sites like IMDB ( http://www.imdb.com/name/nm0000138/), LinkedIn, or Facebook, it seems like there could be a thousand queries for the loading of a single page.
Is there an upper limit on the number of queries that can be (sensibly) generated on a page request? Or is this problem solved by caching, like `memcached`? Are there other strategies that can also be employed? (I imagine on IMDB the content is for the most part static for a user's page.) | 4 |
3,948,652 | 10/16/2010 11:14:32 | 477,869 | 10/16/2010 11:14:32 | 1 | 0 | Artistic worm creation | I have a problem, some friends and I are looking for some place we can upload our school design project like this:
http://www.freewebs.com/gfxvoidworm/worm.html . Each of those images are uploaded next to eachoter and not as a long single image. How can we upload our different images next to eachother like that without having to merge then all together as one image? And we need to do it for free, like the example we showed was on webs.com
Sorry for any bad grammer im not english.
Thanks
Mads Mikkelsen | jpeg | photoshop | art | null | null | 10/20/2010 19:27:02 | off topic | Artistic worm creation
===
I have a problem, some friends and I are looking for some place we can upload our school design project like this:
http://www.freewebs.com/gfxvoidworm/worm.html . Each of those images are uploaded next to eachoter and not as a long single image. How can we upload our different images next to eachother like that without having to merge then all together as one image? And we need to do it for free, like the example we showed was on webs.com
Sorry for any bad grammer im not english.
Thanks
Mads Mikkelsen | 2 |
3,280,992 | 07/19/2010 12:26:58 | 356,387 | 06/02/2010 11:44:16 | 167 | 5 | Can't release array objects, but they are causing leaks. | I have 2 arrays, 1 in the viewDidLoad method and 1 in the add method(adds an object to favorites)
NSUserDefaults *myDefault = [NSUserDefaults standardUserDefaults];
NSArray *prefs = [myDefault arrayForKey:@"addedPrefs"];
userAdded = [[NSMutableArray alloc] initWithArray:prefs];
Instruments is showing leaks from these arrays. (only one shown above, other is exactly the same in ViewDidLoad) When I try to release them the app crashes and they are defined locally, so I cannot release them in the dealloc method.
Is it possible to assign my userAdded NSMutable array directly to the arrayForKey? Or will it cause a mismatch?
How can this leak be stopped? | iphone | objective-c | memory-management | memory-leaks | instruments | null | open | Can't release array objects, but they are causing leaks.
===
I have 2 arrays, 1 in the viewDidLoad method and 1 in the add method(adds an object to favorites)
NSUserDefaults *myDefault = [NSUserDefaults standardUserDefaults];
NSArray *prefs = [myDefault arrayForKey:@"addedPrefs"];
userAdded = [[NSMutableArray alloc] initWithArray:prefs];
Instruments is showing leaks from these arrays. (only one shown above, other is exactly the same in ViewDidLoad) When I try to release them the app crashes and they are defined locally, so I cannot release them in the dealloc method.
Is it possible to assign my userAdded NSMutable array directly to the arrayForKey? Or will it cause a mismatch?
How can this leak be stopped? | 0 |
8,118,941 | 11/14/2011 08:25:34 | 580,488 | 01/18/2011 20:10:47 | 169 | 8 | Using htaccess to change document root | My website has document root ~/public_html but i want to add all the files into ~/public_html/www
Is there a way to do this with htaccess?
Thank you. | apache | .htaccess | null | null | null | 11/26/2011 08:34:43 | off topic | Using htaccess to change document root
===
My website has document root ~/public_html but i want to add all the files into ~/public_html/www
Is there a way to do this with htaccess?
Thank you. | 2 |
7,718,171 | 10/10/2011 20:17:39 | 985,736 | 10/08/2011 19:44:15 | 1 | 0 | AJAX.NET Asnycpostback not working | I created an AJAX.NET application and I am running my application with the help of `<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />` but now my following sample code is posting back on every button click. I need the action to be done without reloading the page.
Code follows.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Async="true" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Hello";
}
} | asp.net | ajax | ajax.net | null | null | null | open | AJAX.NET Asnycpostback not working
===
I created an AJAX.NET application and I am running my application with the help of `<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />` but now my following sample code is posting back on every button click. I need the action to be done without reloading the page.
Code follows.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Async="true" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Hello";
}
} | 0 |
7,193,871 | 08/25/2011 16:23:05 | 517,193 | 11/23/2010 09:11:42 | 74 | 8 | java - MongoDB + Solr performances | I've been looking around a lot to see how to use MongoDB in combination with Solr, and some questions here have partial responses, but nothing really concrete (more like theories). In my application, I will have lots and lots of documents stored in MongoDB (maybe up to few hundred millions), and I want to implement full-text searches on some properties of those documents, so I guess Solr is the best way to do this.
What I want to know is how should I configure/execute everything so that it has good performances? right now, here's what I do (and I know its not optimal):
1- When inserting an object in MongoDB, I then add it to Solr
SolrServer server = getServer();
SolrInputDocument document = new SolrInputDocument();
document.addField("id", documentId);
...
server.add(document);
server.commit();
2- When updating a property of the object, since Solr cannot update just one field, first I retrieve the object from MongoDB then I update the Solr index with all properties from object and new ones and do something like
StreamingUpdateSolrServer update = new StreamingUpdateSolrServer(url, 1, 0);
SolrInputDocument document = new SolrInputDocument();
document.addField("id", documentId);
...
update.add(document);
update.commit();
3- When querying, first I query Solr and then when retrieving the list of documents `SolrDocumentList` I go through each document and:
1. get the id of the document
2. get the object from MongoDB having the same id to be able to retrieve the properties from there
4- When deleting, well I haven't done that part yet and not really sure how to do it in Java
So anybody has suggestions on how to do this in more efficient ways for each of the scenarios described here? like the process to do it in a way that it won't take 1hour to rebuild the index when having a lot of documents in Solr and adding one document at a time? my requirements here are that users may want to add one document at a time, many times and I'd like them to be able to retrieve it right after | java | mongodb | solr | null | null | null | open | java - MongoDB + Solr performances
===
I've been looking around a lot to see how to use MongoDB in combination with Solr, and some questions here have partial responses, but nothing really concrete (more like theories). In my application, I will have lots and lots of documents stored in MongoDB (maybe up to few hundred millions), and I want to implement full-text searches on some properties of those documents, so I guess Solr is the best way to do this.
What I want to know is how should I configure/execute everything so that it has good performances? right now, here's what I do (and I know its not optimal):
1- When inserting an object in MongoDB, I then add it to Solr
SolrServer server = getServer();
SolrInputDocument document = new SolrInputDocument();
document.addField("id", documentId);
...
server.add(document);
server.commit();
2- When updating a property of the object, since Solr cannot update just one field, first I retrieve the object from MongoDB then I update the Solr index with all properties from object and new ones and do something like
StreamingUpdateSolrServer update = new StreamingUpdateSolrServer(url, 1, 0);
SolrInputDocument document = new SolrInputDocument();
document.addField("id", documentId);
...
update.add(document);
update.commit();
3- When querying, first I query Solr and then when retrieving the list of documents `SolrDocumentList` I go through each document and:
1. get the id of the document
2. get the object from MongoDB having the same id to be able to retrieve the properties from there
4- When deleting, well I haven't done that part yet and not really sure how to do it in Java
So anybody has suggestions on how to do this in more efficient ways for each of the scenarios described here? like the process to do it in a way that it won't take 1hour to rebuild the index when having a lot of documents in Solr and adding one document at a time? my requirements here are that users may want to add one document at a time, many times and I'd like them to be able to retrieve it right after | 0 |
6,451,956 | 06/23/2011 09:28:51 | 701,281 | 04/10/2011 21:45:27 | 13 | 0 | FlowCoverView How to change tile (texture) size? | I'm using FlowCoverView, an open source (and AppStore compliant) alternative to Apple's cover flow (you can find it here http://chaosinmotion.com/flowcover.m)
How can I change the tile (or texture as it's called in the library) size (statically at least)?
The code comes with a statically fixed 256x256 tile size. This is fixed using the TEXTURESIZE define and hard coding the number 256 within the code.
I tried to replace all 256 occurrence with the TEXTURESIZE define and it works... As long as the define is set to 256! As soon as I put another value, I get white 256x256 images in the flow view (I pass the correctly dimensioned UIImages through the delegate of course) :(
I can't find where in the code this 256 value is used. I repeat: all 256 occurrences were replaced by the TEXTURESIZE constant.
PS
Of course, the next step to improve this nice library will be to make the TEXTURESIZE a property, to be set at runtime... | iphone | opengl-es | coverflow | null | null | null | open | FlowCoverView How to change tile (texture) size?
===
I'm using FlowCoverView, an open source (and AppStore compliant) alternative to Apple's cover flow (you can find it here http://chaosinmotion.com/flowcover.m)
How can I change the tile (or texture as it's called in the library) size (statically at least)?
The code comes with a statically fixed 256x256 tile size. This is fixed using the TEXTURESIZE define and hard coding the number 256 within the code.
I tried to replace all 256 occurrence with the TEXTURESIZE define and it works... As long as the define is set to 256! As soon as I put another value, I get white 256x256 images in the flow view (I pass the correctly dimensioned UIImages through the delegate of course) :(
I can't find where in the code this 256 value is used. I repeat: all 256 occurrences were replaced by the TEXTURESIZE constant.
PS
Of course, the next step to improve this nice library will be to make the TEXTURESIZE a property, to be set at runtime... | 0 |
11,390,775 | 07/09/2012 07:36:18 | 1,353,335 | 04/24/2012 09:43:53 | 2 | 0 | c# nunit test not enough space in buffer | I have a question.
I got a problem with one unit test. Is a OutOfMemmory ecxeption. Buffer is set on 1MB and file is bigger than 1MB.
Can somebody help with that problem
I can just change test code.
Thanks | c# | nunit | null | null | null | 07/10/2012 14:19:51 | not a real question | c# nunit test not enough space in buffer
===
I have a question.
I got a problem with one unit test. Is a OutOfMemmory ecxeption. Buffer is set on 1MB and file is bigger than 1MB.
Can somebody help with that problem
I can just change test code.
Thanks | 1 |
4,884,987 | 02/03/2011 10:29:38 | 100,567 | 05/04/2009 00:39:29 | 615 | 28 | PHP: whitespaces that do matter | Whitespaces are generally ignored in PHP syntax, but there are several places where you cannot put them without affecting the sense (and the result).
One example is:
$a = 5.5; // five and a half (float)
$b = 5 . 5; // "55" (string)
Do you know of any other examples? | php | syntax | whitespace | null | null | 02/04/2011 17:56:16 | not constructive | PHP: whitespaces that do matter
===
Whitespaces are generally ignored in PHP syntax, but there are several places where you cannot put them without affecting the sense (and the result).
One example is:
$a = 5.5; // five and a half (float)
$b = 5 . 5; // "55" (string)
Do you know of any other examples? | 4 |
1,469,153 | 09/24/2009 00:01:08 | 143,030 | 07/22/2009 17:14:12 | 1,982 | 30 | How can I get the value in the URL and modify it for paging with mod-rewrite on? | I am trying to get my old paging class to work which relied on the variables available with $_GET in PHP to reconstruct the URL for the paging links, it worked great but now I am changing to have "pretty url's" with mod-rewrite.
So this
**domain.com/?p=the-pagename-identifier&userid=12&page=3**
would now be
**domain.com/the-pagename-identifier/12/page-3**
Problem is my PHP for my old paging would rely on the GET variables to re-construct the URL and make sure any variables present in the URL remain in the new URL's it makes for new pages, now I am stuck because I need it to work with the "virtual" directories that it appears I have in the URL, domain.com/mail/inbox/page-12 is really in the root directory running through my index file domain.com/index.php?p=mail.inbox&page=12
I am lost because some pages will have more things then others in the GET part of the URL.
Since all pages are loaded through the index.php at root level I could almost just link the pages without the full URL path but instead of something like domain.com/mail/page-2 it would end up being domain.com/page-2 since the mail directory in the example is not a real directory
| php | paging | mod-rewrite | null | null | null | open | How can I get the value in the URL and modify it for paging with mod-rewrite on?
===
I am trying to get my old paging class to work which relied on the variables available with $_GET in PHP to reconstruct the URL for the paging links, it worked great but now I am changing to have "pretty url's" with mod-rewrite.
So this
**domain.com/?p=the-pagename-identifier&userid=12&page=3**
would now be
**domain.com/the-pagename-identifier/12/page-3**
Problem is my PHP for my old paging would rely on the GET variables to re-construct the URL and make sure any variables present in the URL remain in the new URL's it makes for new pages, now I am stuck because I need it to work with the "virtual" directories that it appears I have in the URL, domain.com/mail/inbox/page-12 is really in the root directory running through my index file domain.com/index.php?p=mail.inbox&page=12
I am lost because some pages will have more things then others in the GET part of the URL.
Since all pages are loaded through the index.php at root level I could almost just link the pages without the full URL path but instead of something like domain.com/mail/page-2 it would end up being domain.com/page-2 since the mail directory in the example is not a real directory
| 0 |
7,800,258 | 10/17/2011 22:17:06 | 999,078 | 10/17/2011 11:47:09 | 1 | 0 | Adding custom rules at build time | I'm looking for tools (preferrably open source) which will help me to add/evaluate custom rules at the build time for C/C++ projects.
For example, I want to add a rule such that trailing spaces in the code will be treated
as error and after a file is compiled, the rule-checker will evaluate the file against the given rules and flag errors if any.
All suggestions will be gratefully received.
| c++ | c | make | null | null | 10/18/2011 08:22:32 | not constructive | Adding custom rules at build time
===
I'm looking for tools (preferrably open source) which will help me to add/evaluate custom rules at the build time for C/C++ projects.
For example, I want to add a rule such that trailing spaces in the code will be treated
as error and after a file is compiled, the rule-checker will evaluate the file against the given rules and flag errors if any.
All suggestions will be gratefully received.
| 4 |
858,990 | 05/13/2009 16:32:16 | 5,552 | 09/10/2008 13:38:06 | 1,240 | 46 | How can I target CSS to a particular sharepoint Page Layout file? | Is it possible to create a .CSS file for each sharepoint Page Layout I develop, or does the CSS for each possible layout in a master page need to be referenced in the master page?
IE is it possible to effect the <head> of the page a page layout is used in? | sharepoint | css | page-layout | null | null | null | open | How can I target CSS to a particular sharepoint Page Layout file?
===
Is it possible to create a .CSS file for each sharepoint Page Layout I develop, or does the CSS for each possible layout in a master page need to be referenced in the master page?
IE is it possible to effect the <head> of the page a page layout is used in? | 0 |
11,041,180 | 06/14/2012 20:53:39 | 400,589 | 07/23/2010 19:11:20 | 775 | 26 | How would you replicate try/catch/finally using On Error Goto | Suppose in VB.NET you have:
Try
Debug.Print("Trying...")
Catch ex as Exception
Debug.Print("Exception...")
Finally
Debug.Print("Finally...")
End Try
How would you write this using the "On Error Goto" construct? (please no questions asking why I would want to do this, just curious if it can be done). | vb.net | null | null | null | null | 06/15/2012 00:35:06 | not constructive | How would you replicate try/catch/finally using On Error Goto
===
Suppose in VB.NET you have:
Try
Debug.Print("Trying...")
Catch ex as Exception
Debug.Print("Exception...")
Finally
Debug.Print("Finally...")
End Try
How would you write this using the "On Error Goto" construct? (please no questions asking why I would want to do this, just curious if it can be done). | 4 |
2,252,934 | 02/12/2010 15:39:40 | 5,055 | 09/07/2008 15:43:03 | 921 | 39 | Javascript - what does this line do? | What does the following javascript do?
var groups = countrylist.split(',');
for( var i = -1, group; group = groupsCounty[++i]; ){
...
}
| javascript | loops | null | null | null | null | open | Javascript - what does this line do?
===
What does the following javascript do?
var groups = countrylist.split(',');
for( var i = -1, group; group = groupsCounty[++i]; ){
...
}
| 0 |
6,686,700 | 07/13/2011 23:02:08 | 809,684 | 06/22/2011 04:46:31 | 13 | 1 | problem with using colorbox in ajax.php page | I have a page called `example1.js` . This page calls another page with some
values using ajax that page is `ajax.php`.
Now problem is in `ajax.php` there is a submit button for which i want to use
colorbox. Now this `ajax.php` file does not have any header or .js files for
colorbox. What is the best way to achieve this? | php | ajax | colorbox | null | null | 07/14/2011 01:04:49 | not a real question | problem with using colorbox in ajax.php page
===
I have a page called `example1.js` . This page calls another page with some
values using ajax that page is `ajax.php`.
Now problem is in `ajax.php` there is a submit button for which i want to use
colorbox. Now this `ajax.php` file does not have any header or .js files for
colorbox. What is the best way to achieve this? | 1 |
8,317,451 | 11/29/2011 20:42:49 | 1,072,154 | 11/29/2011 20:33:47 | 1 | 0 | Getting JSON feed data from RESTFul web service | my requirement is similar to what the post below mentioned.
i tried to follow the same approach but i am getting error like "Illegal characters in path."
how would like get/access the information in file.. for excample..below is the JSON result data and i would like to read/display in webpage the data as
Store NAme:LMR
Name:Lamer
please let me know how to read that and put it on website.
**SELECT tlc, nameFROM `stores`
[{"tlc":"LMR","name":"Lamar","}]
Accept: */***
http://stackoverflow.com/questions/6846029/how-do-i-consume-a-non-wcf-rest-service-in-asp-net-mvc-3 | c# | mvc-3 | null | null | null | 11/30/2011 03:38:09 | not a real question | Getting JSON feed data from RESTFul web service
===
my requirement is similar to what the post below mentioned.
i tried to follow the same approach but i am getting error like "Illegal characters in path."
how would like get/access the information in file.. for excample..below is the JSON result data and i would like to read/display in webpage the data as
Store NAme:LMR
Name:Lamer
please let me know how to read that and put it on website.
**SELECT tlc, nameFROM `stores`
[{"tlc":"LMR","name":"Lamar","}]
Accept: */***
http://stackoverflow.com/questions/6846029/how-do-i-consume-a-non-wcf-rest-service-in-asp-net-mvc-3 | 1 |
6,538,937 | 06/30/2011 17:49:50 | 5,175 | 09/08/2008 10:47:07 | 915 | 7 | Database schema design - how to store specific application settings against entities | I'm trying to design some database tales to store configuration settings about certain entities and the applications they are associated with. I can get so far but have hit a "brick wall". I'll show you what I mean... (do not take the following: pictures, as a literal business problem, pictures are just an easy way of explaining my problem to you).
**Criteria**
1. We have a catlog of pictures.
2. We have several applications that can
consume any number of these
pictures.
3. We want to configure how to display these pictures
**depending** on the application.
***Bear in mind that each application has a specific and unique way it can be configured to show pictures.***
So it's clear we need 2 tables PICTURE and APPLICATION and a junction table to show the M-M relationship, as many pictures can be in many applications - see below:
![enter image description here][1]
I have highlighted in red the column "CONFIG_TABLE" - I have a very strong suspicion this is bad, very, very bad. It is showing that for a paricular app this is the config table to store the settings in. See below:
![enter image description here][2]
So - there are very speicific app configurations to apply to layers, depending on what app you are talking about. Now assuming the design is broken, as I believe it it is - how do I actually design the database to model this correctly? (Hope this makes sense)
[1]: http://i.stack.imgur.com/VgVDq.jpg
[2]: http://i.stack.imgur.com/hLIq2.jpg | database-design | null | null | null | null | null | open | Database schema design - how to store specific application settings against entities
===
I'm trying to design some database tales to store configuration settings about certain entities and the applications they are associated with. I can get so far but have hit a "brick wall". I'll show you what I mean... (do not take the following: pictures, as a literal business problem, pictures are just an easy way of explaining my problem to you).
**Criteria**
1. We have a catlog of pictures.
2. We have several applications that can
consume any number of these
pictures.
3. We want to configure how to display these pictures
**depending** on the application.
***Bear in mind that each application has a specific and unique way it can be configured to show pictures.***
So it's clear we need 2 tables PICTURE and APPLICATION and a junction table to show the M-M relationship, as many pictures can be in many applications - see below:
![enter image description here][1]
I have highlighted in red the column "CONFIG_TABLE" - I have a very strong suspicion this is bad, very, very bad. It is showing that for a paricular app this is the config table to store the settings in. See below:
![enter image description here][2]
So - there are very speicific app configurations to apply to layers, depending on what app you are talking about. Now assuming the design is broken, as I believe it it is - how do I actually design the database to model this correctly? (Hope this makes sense)
[1]: http://i.stack.imgur.com/VgVDq.jpg
[2]: http://i.stack.imgur.com/hLIq2.jpg | 0 |
1,254,995 | 08/10/2009 13:46:31 | 9,204 | 09/15/2008 18:03:06 | 1,291 | 59 | Thread-safe memoization | Let's take [Wes Dyer's][1] approach to function memoization as the starting point:
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, R>();
return a =>
{
R value;
if (map.TryGetValue(a, out value))
return value;
value = f(a);
map.Add(a, value);
return value;
};
}
The problem is, when using it from multiple threads, we can get into trouble:
Func<int, int> f = ...
var f1 = f.Memoize();
...
in thread 1:
var y1 = f1(1);
in thread 2:
var y2 = f1(1);
// We may be recalculating f(1) here!
Let's try to avoid this. Locking on `map`:
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, R>();
return a =>
{
R value;
lock(map)
{
if (map.TryGetValue(a, out value))
return value;
value = f(a);
map.Add(a, value);
}
return value;
};
}
is clearly a horrible idea, because it prevents us from calculating `f1` on many _different_ arguments at once. Locking on `a` won't work if `a` has a value type (and at any rate is a bad idea, since we don't control `a` and outside code may lock on it, too).
Here are two options I can think of:
Assuming a `Lazy<T>` class for lazy evaluation (see [here][2]):
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, Lazy<R>>();
return a =>
{
Lazy<R> result;
lock(map)
{
if (map.TryGetValue(a, out result))
return result.Value;
result = () => f(a);
map.Add(a, result);
}
return result.Value;
};
}
Or keeping an additional dictionary of objects for synchronization:
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, R>();
var mapSync = new Dictionary<A, object>();
return a =>
{
R value;
object sync;
lock(mapSync)
{
if (!mapSync.TryGetValue(a, out sync))
{
sync = new object();
mapSync[a] = sync;
}
}
if (map.TryGetValue(a, out value))
return value;
else
lock(sync)
{
value = f(a);
map[a] = value;
return value;
}
};
}
Any better options?
[1]: http://blogs.msdn.com/wesdyer/archive/2007/01/26/function-memoization.aspx
[2]: http://msdn.microsoft.com/en-us/vcsharp/bb870976.aspx | c# | locking | memoization | multithreading | thread-safety | null | open | Thread-safe memoization
===
Let's take [Wes Dyer's][1] approach to function memoization as the starting point:
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, R>();
return a =>
{
R value;
if (map.TryGetValue(a, out value))
return value;
value = f(a);
map.Add(a, value);
return value;
};
}
The problem is, when using it from multiple threads, we can get into trouble:
Func<int, int> f = ...
var f1 = f.Memoize();
...
in thread 1:
var y1 = f1(1);
in thread 2:
var y2 = f1(1);
// We may be recalculating f(1) here!
Let's try to avoid this. Locking on `map`:
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, R>();
return a =>
{
R value;
lock(map)
{
if (map.TryGetValue(a, out value))
return value;
value = f(a);
map.Add(a, value);
}
return value;
};
}
is clearly a horrible idea, because it prevents us from calculating `f1` on many _different_ arguments at once. Locking on `a` won't work if `a` has a value type (and at any rate is a bad idea, since we don't control `a` and outside code may lock on it, too).
Here are two options I can think of:
Assuming a `Lazy<T>` class for lazy evaluation (see [here][2]):
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, Lazy<R>>();
return a =>
{
Lazy<R> result;
lock(map)
{
if (map.TryGetValue(a, out result))
return result.Value;
result = () => f(a);
map.Add(a, result);
}
return result.Value;
};
}
Or keeping an additional dictionary of objects for synchronization:
public static Func<A, R> Memoize<A, R>(this Func<A, R> f)
{
var map = new Dictionary<A, R>();
var mapSync = new Dictionary<A, object>();
return a =>
{
R value;
object sync;
lock(mapSync)
{
if (!mapSync.TryGetValue(a, out sync))
{
sync = new object();
mapSync[a] = sync;
}
}
if (map.TryGetValue(a, out value))
return value;
else
lock(sync)
{
value = f(a);
map[a] = value;
return value;
}
};
}
Any better options?
[1]: http://blogs.msdn.com/wesdyer/archive/2007/01/26/function-memoization.aspx
[2]: http://msdn.microsoft.com/en-us/vcsharp/bb870976.aspx | 0 |
10,299,092 | 04/24/2012 13:39:38 | 1,353,815 | 04/24/2012 13:35:17 | 1 | 0 | Need a Free Sharepoint pie chart sandbox webpart | I am looking for a free SharePoint Pie chart webpart which would be fancy and highly dynamic in nature. We need to display list columns mainly "Status" column in task list as pie chart to see the overall performance of the team.
This webpart is need for an Office 365 SharePoint Online website so needs to be Sandbox
Please let me know the best source form where i can download the webpart. We might even buy it.
Thank You
Sumen | sharepoint | office365 | null | null | null | 04/25/2012 14:06:50 | not constructive | Need a Free Sharepoint pie chart sandbox webpart
===
I am looking for a free SharePoint Pie chart webpart which would be fancy and highly dynamic in nature. We need to display list columns mainly "Status" column in task list as pie chart to see the overall performance of the team.
This webpart is need for an Office 365 SharePoint Online website so needs to be Sandbox
Please let me know the best source form where i can download the webpart. We might even buy it.
Thank You
Sumen | 4 |
11,543,060 | 07/18/2012 13:54:24 | 1,510,629 | 07/08/2012 22:08:04 | 1 | 0 | Creating a web interface with python (cgi) | I am unable to display my python created webpage in my browser and I am not sure why. I believe my html syntax is correct. I think my problem is with the path I am using and the shebang. Does anyone know what I should do? Your help will be much appreciated. I am using cgi by the way. | python | html | web | connection | cgi | 07/19/2012 19:15:18 | not a real question | Creating a web interface with python (cgi)
===
I am unable to display my python created webpage in my browser and I am not sure why. I believe my html syntax is correct. I think my problem is with the path I am using and the shebang. Does anyone know what I should do? Your help will be much appreciated. I am using cgi by the way. | 1 |
10,349,213 | 04/27/2012 10:45:55 | 1,360,862 | 04/27/2012 10:04:16 | 1 | 0 | GET Url from Android default browser | How to Find the latest url in android browser which user has clicked , in run time
will a service be required ?
any help will be helpful.
thanks | android | url | null | null | null | 06/20/2012 12:39:27 | not a real question | GET Url from Android default browser
===
How to Find the latest url in android browser which user has clicked , in run time
will a service be required ?
any help will be helpful.
thanks | 1 |
3,797,245 | 09/26/2010 09:40:06 | 213,637 | 11/18/2009 10:17:38 | 1 | 0 | Doubling Internet Connection Speed | Scenario: I have two ADSL modem that are connected to to different ISPs. Each has 256KBps Speed.
Question:Is it possible to have 512KBps speed?(I have one PC that can be host any OS)
Is any special appliance essential for doing that?
Thanks in Advance,
Ashkan. | networking | null | null | null | null | 09/26/2010 10:36:21 | off topic | Doubling Internet Connection Speed
===
Scenario: I have two ADSL modem that are connected to to different ISPs. Each has 256KBps Speed.
Question:Is it possible to have 512KBps speed?(I have one PC that can be host any OS)
Is any special appliance essential for doing that?
Thanks in Advance,
Ashkan. | 2 |
6,436,899 | 06/22/2011 08:19:48 | 809,938 | 06/22/2011 08:15:32 | 1 | 0 | android screenshot ? | {
Button button = (Button)findViewById(R.id.btnTakeScreenshot);
button.setOnClickListener(new View.OnClickListener() {
//@Override
public void onClick(View v) {
final View content = findViewById(R.id.layoutroot);
Bitmap bitmap = content.getDrawingCache();
File file = new File(Environment.getExternalStorageDirectory() + "/test.png");
try
{
file.createNewFile();
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, ostream);
ostream.close();
Toast.makeText(content.getContext(), "HELLO", Toast.LENGTH_SHORT);
}
catch (Exception e)
{
System.out.print("error");
e.printStackTrace();
}
}
});
}
above code is to capture a screenshot, but it creates blank file of zero kb? | android | button | screenshot | null | null | 06/22/2011 09:47:32 | not a real question | android screenshot ?
===
{
Button button = (Button)findViewById(R.id.btnTakeScreenshot);
button.setOnClickListener(new View.OnClickListener() {
//@Override
public void onClick(View v) {
final View content = findViewById(R.id.layoutroot);
Bitmap bitmap = content.getDrawingCache();
File file = new File(Environment.getExternalStorageDirectory() + "/test.png");
try
{
file.createNewFile();
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, ostream);
ostream.close();
Toast.makeText(content.getContext(), "HELLO", Toast.LENGTH_SHORT);
}
catch (Exception e)
{
System.out.print("error");
e.printStackTrace();
}
}
});
}
above code is to capture a screenshot, but it creates blank file of zero kb? | 1 |
11,485,325 | 07/14/2012 16:13:56 | 343,592 | 05/18/2010 01:52:37 | 19 | 1 | Most recommended Android Developnent Book | Ive searching for a good android java development book. But i could found nothing but awfull book or neither old books oriented to android 2.2 or 1.6 versions. Im looking for something more updated as i recently bought an android 4 tablet.
Just looking for something simple and straight forward.
Any opinions would be appreciated! | android | books | null | null | null | 07/14/2012 17:35:04 | off topic | Most recommended Android Developnent Book
===
Ive searching for a good android java development book. But i could found nothing but awfull book or neither old books oriented to android 2.2 or 1.6 versions. Im looking for something more updated as i recently bought an android 4 tablet.
Just looking for something simple and straight forward.
Any opinions would be appreciated! | 2 |
8,752,499 | 01/06/2012 01:55:36 | 591,534 | 01/27/2011 00:33:22 | 25 | 0 | Navigation for sliding doors (full page slider) | I'm using jstn's <a href="https://gist.github.com/267584/846c5b367738fca9fe4c8ba309a894da814289e6">Sliding Doors</a> script (which is essentially a full page slider) but I'm having some trouble with the navigation. Instead of having to link directly to the frames, I would just like to have "previous" and "next" links that would always stay in the page and would just bring you to the previous or next page. Unfortunately, I'm terrible at JavaScript and was wondering if somebody could help me out with this.
I tried pasting the code onto here but was having problems, so I've posted it on JSFiddle here: http://jsfiddle.net/tUHNF/ | javascript | mootools | slider | null | null | null | open | Navigation for sliding doors (full page slider)
===
I'm using jstn's <a href="https://gist.github.com/267584/846c5b367738fca9fe4c8ba309a894da814289e6">Sliding Doors</a> script (which is essentially a full page slider) but I'm having some trouble with the navigation. Instead of having to link directly to the frames, I would just like to have "previous" and "next" links that would always stay in the page and would just bring you to the previous or next page. Unfortunately, I'm terrible at JavaScript and was wondering if somebody could help me out with this.
I tried pasting the code onto here but was having problems, so I've posted it on JSFiddle here: http://jsfiddle.net/tUHNF/ | 0 |
4,471,743 | 12/17/2010 15:02:52 | 439,507 | 11/01/2008 22:11:03 | 353 | 22 | How to catch users which open application from multiple page | In my web application, some users open app in multiple browser page. How can I catch users when they do it? | c# | asp.net | session | null | null | null | open | How to catch users which open application from multiple page
===
In my web application, some users open app in multiple browser page. How can I catch users when they do it? | 0 |
9,397,311 | 02/22/2012 15:05:05 | 1,119,148 | 12/28/2011 10:52:46 | 6 | 0 | What is the best gaming framework for android and iphone | What is the best gaming framework that can I use for both android and iPhone ??
| android | iphone | null | null | null | 02/23/2012 01:42:47 | not constructive | What is the best gaming framework for android and iphone
===
What is the best gaming framework that can I use for both android and iPhone ??
| 4 |
5,894,029 | 05/05/2011 07:19:38 | 740,374 | 05/05/2011 07:19:38 | 1 | 0 | C++ Using arrays in functions | I have this question that I didn't know how to solve.
Hope anybody can help me:
Write the C++ function
void zero (int x[ ] [N], zerroArray [ ], int rows, int cols)
that accepts the 2D integer array (matrix) x of size rows and cols, and returns, as the
one dimensional array zerroArray [ ], the number of zero elements present in each row of
the matrix x. You can declare the number of columns N, such as, const int N=3; at the
beginning of the file (before main () ), and this way N will be treated as a
const “global” variable for both main() and the function zeroArray( ).
Write a main program to test the working of your function using the following 2D array:
int p[N][N] = { {3,6,0}, {3,4,9}, {0,0,0}}.
The output should be:
zerroArray[0] = 1
zerroArray[1] = 0
zerroArray[2] = 3
| c++ | null | null | null | null | 05/05/2011 16:47:26 | not a real question | C++ Using arrays in functions
===
I have this question that I didn't know how to solve.
Hope anybody can help me:
Write the C++ function
void zero (int x[ ] [N], zerroArray [ ], int rows, int cols)
that accepts the 2D integer array (matrix) x of size rows and cols, and returns, as the
one dimensional array zerroArray [ ], the number of zero elements present in each row of
the matrix x. You can declare the number of columns N, such as, const int N=3; at the
beginning of the file (before main () ), and this way N will be treated as a
const “global” variable for both main() and the function zeroArray( ).
Write a main program to test the working of your function using the following 2D array:
int p[N][N] = { {3,6,0}, {3,4,9}, {0,0,0}}.
The output should be:
zerroArray[0] = 1
zerroArray[1] = 0
zerroArray[2] = 3
| 1 |
7,473,484 | 09/19/2011 15:15:09 | 480,101 | 10/19/2010 06:07:19 | 55 | 3 | Problems while restoring application from backup | I have a rooted android phone, I am working on an app which does backup of application installed in sdcard to PC. I am able to successfully backup the application from sdcard to PC. While restoring the application from the backup, I restored all files(asec,pkg,cache,data) pertaining to the application in the exact same place they were, including the permissions. When i reboot or restart the launcher the application does not show up as installed. Instead asec or pkg are getting flushed after (reboot)/(restart of launcher).
What should be done to make the application show up as installed after restoring? | sd-card | backup | launcher | null | null | null | open | Problems while restoring application from backup
===
I have a rooted android phone, I am working on an app which does backup of application installed in sdcard to PC. I am able to successfully backup the application from sdcard to PC. While restoring the application from the backup, I restored all files(asec,pkg,cache,data) pertaining to the application in the exact same place they were, including the permissions. When i reboot or restart the launcher the application does not show up as installed. Instead asec or pkg are getting flushed after (reboot)/(restart of launcher).
What should be done to make the application show up as installed after restoring? | 0 |
11,510,735 | 07/16/2012 18:56:31 | 700,074 | 04/09/2011 15:28:29 | 466 | 4 | rails - has_many categories | From a person record I need to be able to add documents of specific types. Including the conditions for category_id works but at this point I can not assume that the category ids will be the same. This is also an issue with testing where I only create the categories I need. Is there a way I can dynamically set the category_id, for example something like this:
has_many :personal_documents, :as => :documentable, :conditions => "category_id = #{DocumentCategory.find_by_name('Personal').id}", class_name: 'Document'
Models:
Person < AR::Base
has_many :documents, :as => :documentable
has_many :personal_documents, :as => :documentable, #:conditions => "category_id = 1"
has_many :legal_documents, :as => :documentable, #:conditions => "category_id = 2"
end
Animal < AR::Base
has_many :documents, :as => :documentable
end
Document < AR::Base
belongs_to :person
belongs_to :category
end | ruby-on-rails | null | null | null | null | null | open | rails - has_many categories
===
From a person record I need to be able to add documents of specific types. Including the conditions for category_id works but at this point I can not assume that the category ids will be the same. This is also an issue with testing where I only create the categories I need. Is there a way I can dynamically set the category_id, for example something like this:
has_many :personal_documents, :as => :documentable, :conditions => "category_id = #{DocumentCategory.find_by_name('Personal').id}", class_name: 'Document'
Models:
Person < AR::Base
has_many :documents, :as => :documentable
has_many :personal_documents, :as => :documentable, #:conditions => "category_id = 1"
has_many :legal_documents, :as => :documentable, #:conditions => "category_id = 2"
end
Animal < AR::Base
has_many :documents, :as => :documentable
end
Document < AR::Base
belongs_to :person
belongs_to :category
end | 0 |
11,156,038 | 06/22/2012 12:20:09 | 1,474,737 | 06/22/2012 12:03:12 | 1 | 0 | "Not defined" javascript error in Firefox | I'm very new to JS, and understand that my script is probably terrible, but it all works fine in Safari and Chrome, just not in Firefox.
Amongst other things, I'm calling two functions to hide and reveal a custom Quicktime movie controller by placing a "mask" over the top of it (I know a toggle would be a more elegant solution, but I couldn't get such a function to work the way I wanted). Anyway, this is what the Javascript looks like:
function revealControls()
{
document.getElementById("controlsCover");
controlsCover.style.display ="none"
}
function hideControls()
{
document.getElementById("controlsCover");
controlsCover.style.display ="block"
}
I'm calling these functions with different mouse events applied to various divs, such as:
<div id = "controls" onmouseout = "hideControls()">
Firefox is telling me "Error: controlsCover is not defined", and I have no idea how to define the element as null.
Any help would be appreciated. I'm sure it's something very simple — but I have virtually no experience with Javascript. Yet. | javascript | firefox | null | null | null | null | open | "Not defined" javascript error in Firefox
===
I'm very new to JS, and understand that my script is probably terrible, but it all works fine in Safari and Chrome, just not in Firefox.
Amongst other things, I'm calling two functions to hide and reveal a custom Quicktime movie controller by placing a "mask" over the top of it (I know a toggle would be a more elegant solution, but I couldn't get such a function to work the way I wanted). Anyway, this is what the Javascript looks like:
function revealControls()
{
document.getElementById("controlsCover");
controlsCover.style.display ="none"
}
function hideControls()
{
document.getElementById("controlsCover");
controlsCover.style.display ="block"
}
I'm calling these functions with different mouse events applied to various divs, such as:
<div id = "controls" onmouseout = "hideControls()">
Firefox is telling me "Error: controlsCover is not defined", and I have no idea how to define the element as null.
Any help would be appreciated. I'm sure it's something very simple — but I have virtually no experience with Javascript. Yet. | 0 |
5,637,724 | 04/12/2011 15:28:29 | 356,790 | 06/02/2010 18:59:59 | 565 | 16 | .net construct / pattern to block by segment of code, not by thread | Is there a construct or pattern in .net that defines a segment of code that can be accessed by multiple threads but blocks if any thread is in some other segment of code (and vice-versa)? For example:
void SomeOperationA()
{
Block( B )
{
Segment1:
... only executes if no threads are executing in Segment2 ...
}
}
}
void SomeOperationB()
{
Block( A )
{
Segment2:
... only executes if no threads are executing in Segment1 ...
}
} | c# | .net | multithreading | design-patterns | .net-4.0 | null | open | .net construct / pattern to block by segment of code, not by thread
===
Is there a construct or pattern in .net that defines a segment of code that can be accessed by multiple threads but blocks if any thread is in some other segment of code (and vice-versa)? For example:
void SomeOperationA()
{
Block( B )
{
Segment1:
... only executes if no threads are executing in Segment2 ...
}
}
}
void SomeOperationB()
{
Block( A )
{
Segment2:
... only executes if no threads are executing in Segment1 ...
}
} | 0 |
11,150,222 | 06/22/2012 04:33:09 | 433,570 | 08/28/2010 07:11:43 | 1,283 | 19 | Need help understanding Sprite & Texture | I recently started looking at cocos2d game development.
What's the difference between sprite and texture?
Maybe I could through in 'bitmap' in there. What is a bitmap?
They all seem to be the same thing as 2d image.
| cocos2d | sprite | texture | null | null | null | open | Need help understanding Sprite & Texture
===
I recently started looking at cocos2d game development.
What's the difference between sprite and texture?
Maybe I could through in 'bitmap' in there. What is a bitmap?
They all seem to be the same thing as 2d image.
| 0 |
2,756,055 | 05/03/2010 04:08:27 | 308,315 | 04/03/2010 13:55:08 | 49 | 5 | AVAudioPlayer not unloading cached memory after each new allocation | I am seeing in Instruments that when I play a sound via the standard "AddMusic" example method that Apple provides, it allocates 32kb of memory via the `prepareToPlay` call (which references the `AudioToolBox` framework's `Cache_DataSource::ReadBytes` function) each time a new player is allocated (i.e. each time a different sound is played). However, that cached data never gets released.
This obviously poses a huge problem if it doesn't get released and you have a lot of sound files to play, since it tends to keep allocating memory and eventually crashes if you have enough unique sound files (which I unfortunately do).
Have any of you run across this or what am I doing wrong in my code? I've had this issue for a while now and it's really bugging me since my code is verbatim of what Apple's is (I think).
How I call the function:
- (void)playOnce:(NSString *)aSound {
// Gets the file system path to the sound to play.
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:aSound ofType:@"caf"];
// Converts the sound's file path to an NSURL object
NSURL *soundURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
self.soundFileURL = soundURL;
[soundURL release];
AVAudioPlayer * newAudio=[[AVAudioPlayer alloc] initWithContentsOfURL: soundFileURL error:nil];
self.theAudio = newAudio; // automatically retain audio and dealloc old file if new m4a file is loaded
[newAudio release]; // release the audio safely
// this is where the prior cached data never gets released
[theAudio prepareToPlay];
// set it up and play
[theAudio setNumberOfLoops:0];
[theAudio setVolume: volumeLevel];
[theAudio setDelegate: self];
[theAudio play];
}
and then `theAudio` gets released in the `dealloc` method of course. | iphone | avaudioplayer | audiotoolbox | objective-c | null | null | open | AVAudioPlayer not unloading cached memory after each new allocation
===
I am seeing in Instruments that when I play a sound via the standard "AddMusic" example method that Apple provides, it allocates 32kb of memory via the `prepareToPlay` call (which references the `AudioToolBox` framework's `Cache_DataSource::ReadBytes` function) each time a new player is allocated (i.e. each time a different sound is played). However, that cached data never gets released.
This obviously poses a huge problem if it doesn't get released and you have a lot of sound files to play, since it tends to keep allocating memory and eventually crashes if you have enough unique sound files (which I unfortunately do).
Have any of you run across this or what am I doing wrong in my code? I've had this issue for a while now and it's really bugging me since my code is verbatim of what Apple's is (I think).
How I call the function:
- (void)playOnce:(NSString *)aSound {
// Gets the file system path to the sound to play.
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:aSound ofType:@"caf"];
// Converts the sound's file path to an NSURL object
NSURL *soundURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
self.soundFileURL = soundURL;
[soundURL release];
AVAudioPlayer * newAudio=[[AVAudioPlayer alloc] initWithContentsOfURL: soundFileURL error:nil];
self.theAudio = newAudio; // automatically retain audio and dealloc old file if new m4a file is loaded
[newAudio release]; // release the audio safely
// this is where the prior cached data never gets released
[theAudio prepareToPlay];
// set it up and play
[theAudio setNumberOfLoops:0];
[theAudio setVolume: volumeLevel];
[theAudio setDelegate: self];
[theAudio play];
}
and then `theAudio` gets released in the `dealloc` method of course. | 0 |
224,827 | 10/22/2008 08:15:08 | 11,979 | 09/16/2008 12:42:54 | 53 | 1 | Tips for optimizing an sqlite database with over a gig of data in it? | I am working with a larger than average sqlite database (for use on both on windows and linux) and am looking to maximize the performance I get out of it. The database is to be installed on commodity hardware along with an sqlite gui. The users I am delivering this to are sql savvy but are unlikely to undertake their own optimizations (creation of indexes, setting of pragma etc.) so I am keen to get as much out of the box performance as possible (to ensure maximum usage of the data).
One issue Windows seems to throttle the execution of queries much more than Linux and another is that I am less familiar with sqlite's approach to indexing (compared to other databases such as postgres). | sqlite | optimization | windows | linux | configuration | 01/27/2012 15:21:31 | too localized | Tips for optimizing an sqlite database with over a gig of data in it?
===
I am working with a larger than average sqlite database (for use on both on windows and linux) and am looking to maximize the performance I get out of it. The database is to be installed on commodity hardware along with an sqlite gui. The users I am delivering this to are sql savvy but are unlikely to undertake their own optimizations (creation of indexes, setting of pragma etc.) so I am keen to get as much out of the box performance as possible (to ensure maximum usage of the data).
One issue Windows seems to throttle the execution of queries much more than Linux and another is that I am less familiar with sqlite's approach to indexing (compared to other databases such as postgres). | 3 |
3,830,784 | 09/30/2010 13:10:05 | 178,575 | 09/24/2009 16:22:33 | 331 | 25 | How to set host and port in full java without dmcl.ini | Using Documentum DFC, I would like to set up a docbase connection without using a dmcl.ini.
How can I do such a thing? | java | documentum | dfc | null | null | null | open | How to set host and port in full java without dmcl.ini
===
Using Documentum DFC, I would like to set up a docbase connection without using a dmcl.ini.
How can I do such a thing? | 0 |
5,108,503 | 02/24/2011 17:51:16 | 58,800 | 01/25/2009 15:51:15 | 252 | 16 | Java OAuth Server | Are there any open source projects that enabled implementing OAuth Server? Apache Foundation ones? | java | source | open | oauth-2.0 | oauth-provider | 02/28/2012 14:20:23 | not constructive | Java OAuth Server
===
Are there any open source projects that enabled implementing OAuth Server? Apache Foundation ones? | 4 |
6,222,528 | 06/03/2011 02:57:19 | 374,220 | 06/23/2010 12:37:06 | 1 | 1 | UnitTesting the webapp.RequestHandler in GAE - Python |
I'm struggling on how to setup my environment for TDD with Google App Engine - Python. (I'm also pretty new to Python)
I am using IntelliJ with the Python plugin, so running unittests is as simple as hitting ctrl-shft-f10.
I've also read the documentation on testbed and have successfully tested the datastore and memcache. However, where I am stuck is how do i unittest my RequestHandlers. I've scanned a lot of articles on Google and most of them seem to be pre merging of gaetestbed into gae as testbed.
In the following code sample, i would like to know how to write a unit test (which is runnable in intellij) which tests that a call to '/' returns
Home Page
from google.appengine.ext import webapp
import wsgiref.handlers
paths = [
('/', MainHandler)
]
application = webapp.WSGIApplication(paths, debug=True)
class MainHandler(webapp.RequestHandler):
def get(self):
self.response.out.write('Home Page')
def main():
wsgiref.handlers.CGIHandler().run(application)
if __name__ == '__main__':
main()
Thanks! | python | unit-testing | google-app-engine | google | null | null | open | UnitTesting the webapp.RequestHandler in GAE - Python
===
I'm struggling on how to setup my environment for TDD with Google App Engine - Python. (I'm also pretty new to Python)
I am using IntelliJ with the Python plugin, so running unittests is as simple as hitting ctrl-shft-f10.
I've also read the documentation on testbed and have successfully tested the datastore and memcache. However, where I am stuck is how do i unittest my RequestHandlers. I've scanned a lot of articles on Google and most of them seem to be pre merging of gaetestbed into gae as testbed.
In the following code sample, i would like to know how to write a unit test (which is runnable in intellij) which tests that a call to '/' returns
Home Page
from google.appengine.ext import webapp
import wsgiref.handlers
paths = [
('/', MainHandler)
]
application = webapp.WSGIApplication(paths, debug=True)
class MainHandler(webapp.RequestHandler):
def get(self):
self.response.out.write('Home Page')
def main():
wsgiref.handlers.CGIHandler().run(application)
if __name__ == '__main__':
main()
Thanks! | 0 |
6,709,182 | 07/15/2011 15:09:55 | 836,420 | 07/09/2011 05:18:25 | 1 | 0 | cropping an UIImage to a new aspect ratio | i want to crop an UIImage to get a new aspect ratio...
bounds is a CGRect with `(0,0, newwidth, newhigh)`...
- (UIImage *)croppedImage:(UIImage *)myImage :(CGRect)bounds {
CGImageRef imageRef = CGImageCreateWithImageInRect(myImage.CGImage, bounds);
UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
CGSize asd = croppedImage.size;
return croppedImage;
}
after that the "workimage" have the same size as before...
what could be wrong?
regards
| iphone | xcode | ipad | uiimage | crop | null | open | cropping an UIImage to a new aspect ratio
===
i want to crop an UIImage to get a new aspect ratio...
bounds is a CGRect with `(0,0, newwidth, newhigh)`...
- (UIImage *)croppedImage:(UIImage *)myImage :(CGRect)bounds {
CGImageRef imageRef = CGImageCreateWithImageInRect(myImage.CGImage, bounds);
UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
CGSize asd = croppedImage.size;
return croppedImage;
}
after that the "workimage" have the same size as before...
what could be wrong?
regards
| 0 |
10,306,248 | 04/24/2012 21:27:45 | 1,353,611 | 04/24/2012 12:03:55 | 1 | 0 | C++ excercises reference | Does anyone have a C++ exercises website (or a reference), where I can test my skills in the previously mentioned programming langauge?
I already know about this site : http://www.cplusplus.com/forum/articles/12974/, so don't post it.
It can be commercial or non-commercial.
**Thank you a lot!** | c++ | tasks | excercises | null | null | 04/24/2012 21:35:01 | not constructive | C++ excercises reference
===
Does anyone have a C++ exercises website (or a reference), where I can test my skills in the previously mentioned programming langauge?
I already know about this site : http://www.cplusplus.com/forum/articles/12974/, so don't post it.
It can be commercial or non-commercial.
**Thank you a lot!** | 4 |
8,153,878 | 11/16/2011 15:10:02 | 886,582 | 08/09/2011 18:47:34 | 1 | 1 | jQuery Isotope - Not working within a responsive/fluid grid | I am in the process of building a photoblog which utilises the brilliant Isotope plugin by David DeSandro but I am curently having some difficulty getting the plugin to work as intended within a responsive / fluid grid.
www.lewismalpas.co.uk/tumblr (Demo)
Each image is wrapped within a div (.item) which has an explicit width of 25%, as the images are flexible this in theory should allow four images to be displayed inline, however at the moment only two are being displayed and I cannot seem to figure out the issue.
<script type="text/javascript">
$(document).ready(function(){
//scroll to top of page
$("a.top").click(function () {
$("body,html").animate({scrollTop: 0}, 800);
return false;
});
//Isotope settings
var $container = $('.images')
$container.imagesLoaded( function(){
$container.isotope({
resizable: false, // disable normal resizing
masonry: { columnWidth: $container.width() / 4 }
});
// update columnWidth on window resize
$(window).smartresize(function(){
$container.isotope({
masonry: { columnWidth: $container.width() / 4 }
});
});
});
//layout & search options
$(".header #layout").hide();
$(".header a.layout").click(function() {
$(".header #layout").fadeIn();
$(".header a.fullscreen").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"99%"}, function() {
$(".images").isotope('reLayout');
});
});
$(".header a.grid").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'masonry'});
});
$(".header a.linear").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'straightDown'});
});
});
$(".header #search").hide();
$(".header a.search").click(function() {
$(".header #search").fadeIn();
});
}); //end doc ready
</script>
Many thanks in advance for your help, I really appreciate it.
All the best!
Lewis. | jquery | jquery-plugins | jquery-masonry | responsive-design | jquery-isotope | null | open | jQuery Isotope - Not working within a responsive/fluid grid
===
I am in the process of building a photoblog which utilises the brilliant Isotope plugin by David DeSandro but I am curently having some difficulty getting the plugin to work as intended within a responsive / fluid grid.
www.lewismalpas.co.uk/tumblr (Demo)
Each image is wrapped within a div (.item) which has an explicit width of 25%, as the images are flexible this in theory should allow four images to be displayed inline, however at the moment only two are being displayed and I cannot seem to figure out the issue.
<script type="text/javascript">
$(document).ready(function(){
//scroll to top of page
$("a.top").click(function () {
$("body,html").animate({scrollTop: 0}, 800);
return false;
});
//Isotope settings
var $container = $('.images')
$container.imagesLoaded( function(){
$container.isotope({
resizable: false, // disable normal resizing
masonry: { columnWidth: $container.width() / 4 }
});
// update columnWidth on window resize
$(window).smartresize(function(){
$container.isotope({
masonry: { columnWidth: $container.width() / 4 }
});
});
});
//layout & search options
$(".header #layout").hide();
$(".header a.layout").click(function() {
$(".header #layout").fadeIn();
$(".header a.fullscreen").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"99%"}, function() {
$(".images").isotope('reLayout');
});
});
$(".header a.grid").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'masonry'});
});
$(".header a.linear").click(function() {
$("a.layout-option").removeClass("selected");
$(this).addClass("selected");
$("#container").animate({width:"80%"}, 800);
$('#images').isotope({itemSelector:'.item',layoutMode:'straightDown'});
});
});
$(".header #search").hide();
$(".header a.search").click(function() {
$(".header #search").fadeIn();
});
}); //end doc ready
</script>
Many thanks in advance for your help, I really appreciate it.
All the best!
Lewis. | 0 |
4,689 | 08/07/2008 13:08:44 | 637 | 08/07/2008 12:33:15 | 1 | 0 | Recommended Fonts for Programming? | What fonts do you use for programming, and for what language/ide? I use [Consolas][1] for all my Visual Studio work, any other recommendations?
[1]: http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&displaylang=en "Consolas" | font | null | null | null | null | 09/26/2011 22:55:42 | not constructive | Recommended Fonts for Programming?
===
What fonts do you use for programming, and for what language/ide? I use [Consolas][1] for all my Visual Studio work, any other recommendations?
[1]: http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&displaylang=en "Consolas" | 4 |
1,227,618 | 08/04/2009 13:43:52 | 147,150 | 07/29/2009 14:14:02 | 396 | 35 | Big clickable areas on a web page | Excuse me while I detach from reality.. I have a summary div which contains a small heading, a little bit of text, maybe an image. I'd like the whole summary div to be a link, something like this:
<div class="summary">
<a href="#">
<h4>Small Heading</h4>
<p>Small amount of text</p>
</a>
</div>
I'd then style the href to look like a nice box, change the H4 and P on :hover, etc etc. But putting an href there makes browsers angry.
Can anyone suggest a way of achieving the same effect without resorting to Javascript? Is that even possible?
Many thanks! | html | css | null | null | null | null | open | Big clickable areas on a web page
===
Excuse me while I detach from reality.. I have a summary div which contains a small heading, a little bit of text, maybe an image. I'd like the whole summary div to be a link, something like this:
<div class="summary">
<a href="#">
<h4>Small Heading</h4>
<p>Small amount of text</p>
</a>
</div>
I'd then style the href to look like a nice box, change the H4 and P on :hover, etc etc. But putting an href there makes browsers angry.
Can anyone suggest a way of achieving the same effect without resorting to Javascript? Is that even possible?
Many thanks! | 0 |
8,767,534 | 01/07/2012 05:05:04 | 927,667 | 09/04/2011 15:06:39 | 329 | 2 | Is there a company logo database online? | I would like to allow a company logo to display on my page when an user specify company name. Is there an online database, or a Rails gem for this purpose?
This would be similar to Gravatar, but for companies.
Thank you. | ruby-on-rails | api | null | null | null | 01/07/2012 05:27:48 | off topic | Is there a company logo database online?
===
I would like to allow a company logo to display on my page when an user specify company name. Is there an online database, or a Rails gem for this purpose?
This would be similar to Gravatar, but for companies.
Thank you. | 2 |
8,409,308 | 12/07/2011 01:26:10 | 1,093,391 | 11/28/2011 04:08:06 | 10 | 0 | ios - Login app | im making this application that logs in on an api link i am getting server response in the console but i dont have any response at the app what seems to be the problem?
**here is my code:**
-(IBAction)btnClicked:(id)sender
{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://192.168.18.8/apisample2/friendb.php?un=jackie&pd=jackie123&gd=f&ag=23&st=single&lf=kaloy&fm=jsn"]];
[request setPostValue:[self.usernameField text] forKey:@"u"];
[request setPostValue:[self.passwordField text] forKey:@"pw"];
[request setDelegate:self];
[request responseStatusCode];
[request startAsynchronous];
}
-(void)requestFailed:(ASIHTTPRequest *)request
{
NSLog(@"Request failed: %@",[request error]);
}
-(void)requestFinished:(ASIHTTPRequest *)request
{
NSLog(@"Submitted form successfully");
NSLog(@"Response was:");
NSLog(@"%@",[[request responseString]JSONValue]);
}
thanks to those who will answer. | ios | login | response | asihttprequest | null | 12/07/2011 19:14:40 | not a real question | ios - Login app
===
im making this application that logs in on an api link i am getting server response in the console but i dont have any response at the app what seems to be the problem?
**here is my code:**
-(IBAction)btnClicked:(id)sender
{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://192.168.18.8/apisample2/friendb.php?un=jackie&pd=jackie123&gd=f&ag=23&st=single&lf=kaloy&fm=jsn"]];
[request setPostValue:[self.usernameField text] forKey:@"u"];
[request setPostValue:[self.passwordField text] forKey:@"pw"];
[request setDelegate:self];
[request responseStatusCode];
[request startAsynchronous];
}
-(void)requestFailed:(ASIHTTPRequest *)request
{
NSLog(@"Request failed: %@",[request error]);
}
-(void)requestFinished:(ASIHTTPRequest *)request
{
NSLog(@"Submitted form successfully");
NSLog(@"Response was:");
NSLog(@"%@",[[request responseString]JSONValue]);
}
thanks to those who will answer. | 1 |
9,536,004 | 03/02/2012 15:36:12 | 966,638 | 09/27/2011 08:52:12 | 565 | 15 | Call to Javascript method | I'm a complete beginner in JS, so pls have patience :)
my.hello = function () {
$("#ok").myMethod({
goodbye: function () {
},
alividerci: function (event, ui) {
},
});
}
How to call the alividerci method?
Here is how I define myMethod:
my.myMethod= function () {
this.anotherMethod();
} | javascript | jquery | null | null | null | 03/05/2012 04:42:50 | not a real question | Call to Javascript method
===
I'm a complete beginner in JS, so pls have patience :)
my.hello = function () {
$("#ok").myMethod({
goodbye: function () {
},
alividerci: function (event, ui) {
},
});
}
How to call the alividerci method?
Here is how I define myMethod:
my.myMethod= function () {
this.anotherMethod();
} | 1 |
937,797 | 06/02/2009 03:25:50 | 105,135 | 05/12/2009 04:11:46 | 15 | 0 | How do you do a query in Access with a fixed amount of columns | I want to pull data with an MS Access crosstab query so I can bind it to a report. When I load the page I get a Run-time error'3637': Cannot use the crosstab of a non-fixed column as a subquery.
I would like a way to get back a fixed grid when I run the query and if the cell is null display a zero. | sql | ms-access | crosstab | null | null | null | open | How do you do a query in Access with a fixed amount of columns
===
I want to pull data with an MS Access crosstab query so I can bind it to a report. When I load the page I get a Run-time error'3637': Cannot use the crosstab of a non-fixed column as a subquery.
I would like a way to get back a fixed grid when I run the query and if the cell is null display a zero. | 0 |
8,058,551 | 11/08/2011 23:37:15 | 311,660 | 12/02/2009 21:32:31 | 6,087 | 281 | Lightweight convention based MVVM frameworks, are there any? | I've been looking for a nice convention based MVVM framework, I've looked at [NakedMVVM](http://blog.vuscode.com/malovicn/archive/2010/11/07/naked-mvvm-simplest-possible-mvvm-approach.aspx#comments), which seems to be along the lines of what I'm after.
But can there really be only one? What other options are available?
| c# | wpf | mvvm | null | null | 11/09/2011 13:30:46 | too localized | Lightweight convention based MVVM frameworks, are there any?
===
I've been looking for a nice convention based MVVM framework, I've looked at [NakedMVVM](http://blog.vuscode.com/malovicn/archive/2010/11/07/naked-mvvm-simplest-possible-mvvm-approach.aspx#comments), which seems to be along the lines of what I'm after.
But can there really be only one? What other options are available?
| 3 |
11,721,770 | 07/30/2012 12:38:58 | 1,561,262 | 07/29/2012 17:08:35 | 3 | 0 | How to make report in winforms using c sharp? | i want to filter records according to my value.like i want to select party name , date between from and to. these are user values and according to this report should be generated.can any one help me with code.how to filter records. | c# | ms-access | null | null | null | 07/30/2012 12:41:15 | not a real question | How to make report in winforms using c sharp?
===
i want to filter records according to my value.like i want to select party name , date between from and to. these are user values and according to this report should be generated.can any one help me with code.how to filter records. | 1 |
7,413,933 | 09/14/2011 09:14:39 | 899,271 | 07/14/2011 12:20:28 | 313 | 0 | how do i refactorise the below code using c# | i have two text boxes and one combobox and i am retrieving the data based upon the text entered into the text boxes and combobox selecion ...by using the following method....
private void textboxfillnames()
{
if (txtlastname.Text != "")
{
var totalmembers = from tsgentity in eclipse.members
join memtomships in eclipse.membertomships on tsgentity.member_Id equals memtomships.member_Id
join mshipoptiions in eclipse.mshipoptions on memtomships.mshipOption_Id equals mshipoptiions.mshipOption_Id
join mshiptypes in eclipse.mshiptypes on mshipoptiions.mshipType_Id equals mshiptypes.mshipType_Id
join mshipstatus in eclipse.mshipstatustypes on memtomships.mshipStatusType_Id equals mshipstatus.mshipStatusType_Id
where tsgentity.member_Lastname.StartsWith(txtlastname.Text)
select new {
tsgentity.member_Id,
tsgentity.member_Lastname,
tsgentity.member_Firstname,
tsgentity.member_Postcode,
tsgentity.member_Reference,
tsgentity.member_CardNum,
tsgentity.member_IsBiometric,
tsgentity.member_Dob,
mshiptypes.mshipType_Name,
mshipstatus.mshipStatusType_Name,
memtomships.memberToMship_EndDate
};
dgvReportMembers.DataSource = totalmembers;
}
if (txtpostcode.Text != "")
{
var totalmembers = from tsgentity in eclipse.members
join memtomships in eclipse.membertomships on tsgentity.member_Id equals memtomships.member_Id
join mshipoptiions in eclipse.mshipoptions on memtomships.mshipOption_Id equals mshipoptiions.mshipOption_Id
join mshiptypes in eclipse.mshiptypes on mshipoptiions.mshipType_Id equals mshiptypes.mshipType_Id
join mshipstatus in eclipse.mshipstatustypes on memtomships.mshipStatusType_Id equals mshipstatus.mshipStatusType_Id
where tsgentity.member_Postcode.StartsWith(txtpostcode.Text)
select new {
tsgentity.member_Id,
tsgentity.member_Lastname,
tsgentity.member_Firstname,
tsgentity.member_Postcode,
tsgentity.member_Reference,
tsgentity.member_CardNum,
tsgentity.member_IsBiometric,
tsgentity.member_Dob,
mshiptypes.mshipType_Name,
mshipstatus.mshipStatusType_Name,
memtomships.memberToMship_EndDate
};
dgvReportMembers.DataSource = totalmembers;
}
if (cbGEStatustype.Text != null)
{
var totalmembers = from tsgentity in eclipse.members
join memtomships in eclipse.membertomships on tsgentity.member_Id equals memtomships.member_Id
join mshipoptiions in eclipse.mshipoptions on memtomships.mshipOption_Id equals mshipoptiions.mshipOption_Id
join mshiptypes in eclipse.mshiptypes on mshipoptiions.mshipType_Id equals mshiptypes.mshipType_Id
join mshipstatus in eclipse.mshipstatustypes on memtomships.mshipStatusType_Id equals mshipstatus.mshipStatusType_Id
where mshipstatus.mshipStatusType_Name.StartsWith(cbGEStatustype.Text)
select new {
tsgentity.member_Id,
tsgentity.member_Lastname,
tsgentity.member_Firstname,
tsgentity.member_Postcode,
tsgentity.member_Reference,
tsgentity.member_CardNum,
tsgentity.member_IsBiometric,
tsgentity.member_Dob,
mshiptypes.mshipType_Name,
mshipstatus.mshipStatusType_Name,
memtomships.memberToMship_EndDate
};
dgvReportMembers.DataSource = totalmembers;
}
}
would nay oen pls help on this.....
Many thanks in advance.... | c# | .net | linq | refactoring | null | 09/14/2011 09:43:55 | not a real question | how do i refactorise the below code using c#
===
i have two text boxes and one combobox and i am retrieving the data based upon the text entered into the text boxes and combobox selecion ...by using the following method....
private void textboxfillnames()
{
if (txtlastname.Text != "")
{
var totalmembers = from tsgentity in eclipse.members
join memtomships in eclipse.membertomships on tsgentity.member_Id equals memtomships.member_Id
join mshipoptiions in eclipse.mshipoptions on memtomships.mshipOption_Id equals mshipoptiions.mshipOption_Id
join mshiptypes in eclipse.mshiptypes on mshipoptiions.mshipType_Id equals mshiptypes.mshipType_Id
join mshipstatus in eclipse.mshipstatustypes on memtomships.mshipStatusType_Id equals mshipstatus.mshipStatusType_Id
where tsgentity.member_Lastname.StartsWith(txtlastname.Text)
select new {
tsgentity.member_Id,
tsgentity.member_Lastname,
tsgentity.member_Firstname,
tsgentity.member_Postcode,
tsgentity.member_Reference,
tsgentity.member_CardNum,
tsgentity.member_IsBiometric,
tsgentity.member_Dob,
mshiptypes.mshipType_Name,
mshipstatus.mshipStatusType_Name,
memtomships.memberToMship_EndDate
};
dgvReportMembers.DataSource = totalmembers;
}
if (txtpostcode.Text != "")
{
var totalmembers = from tsgentity in eclipse.members
join memtomships in eclipse.membertomships on tsgentity.member_Id equals memtomships.member_Id
join mshipoptiions in eclipse.mshipoptions on memtomships.mshipOption_Id equals mshipoptiions.mshipOption_Id
join mshiptypes in eclipse.mshiptypes on mshipoptiions.mshipType_Id equals mshiptypes.mshipType_Id
join mshipstatus in eclipse.mshipstatustypes on memtomships.mshipStatusType_Id equals mshipstatus.mshipStatusType_Id
where tsgentity.member_Postcode.StartsWith(txtpostcode.Text)
select new {
tsgentity.member_Id,
tsgentity.member_Lastname,
tsgentity.member_Firstname,
tsgentity.member_Postcode,
tsgentity.member_Reference,
tsgentity.member_CardNum,
tsgentity.member_IsBiometric,
tsgentity.member_Dob,
mshiptypes.mshipType_Name,
mshipstatus.mshipStatusType_Name,
memtomships.memberToMship_EndDate
};
dgvReportMembers.DataSource = totalmembers;
}
if (cbGEStatustype.Text != null)
{
var totalmembers = from tsgentity in eclipse.members
join memtomships in eclipse.membertomships on tsgentity.member_Id equals memtomships.member_Id
join mshipoptiions in eclipse.mshipoptions on memtomships.mshipOption_Id equals mshipoptiions.mshipOption_Id
join mshiptypes in eclipse.mshiptypes on mshipoptiions.mshipType_Id equals mshiptypes.mshipType_Id
join mshipstatus in eclipse.mshipstatustypes on memtomships.mshipStatusType_Id equals mshipstatus.mshipStatusType_Id
where mshipstatus.mshipStatusType_Name.StartsWith(cbGEStatustype.Text)
select new {
tsgentity.member_Id,
tsgentity.member_Lastname,
tsgentity.member_Firstname,
tsgentity.member_Postcode,
tsgentity.member_Reference,
tsgentity.member_CardNum,
tsgentity.member_IsBiometric,
tsgentity.member_Dob,
mshiptypes.mshipType_Name,
mshipstatus.mshipStatusType_Name,
memtomships.memberToMship_EndDate
};
dgvReportMembers.DataSource = totalmembers;
}
}
would nay oen pls help on this.....
Many thanks in advance.... | 1 |
2,585,214 | 04/06/2010 13:41:20 | 32,826 | 10/30/2008 16:40:25 | 1,315 | 53 | Morphing from an image to a shape in Silverlight 3 | I have a requirement to morph from an image (png) to a shape (polygon) in Silverlight 3 as an effect, but of course there is no built in transition or method to do this.
At the moment the best I have is fade one out and the other in, but can anyone suggest a decent alternative that may work or look better?
Regards
Moo | silverlight-3.0 | silverlight | null | null | null | null | open | Morphing from an image to a shape in Silverlight 3
===
I have a requirement to morph from an image (png) to a shape (polygon) in Silverlight 3 as an effect, but of course there is no built in transition or method to do this.
At the moment the best I have is fade one out and the other in, but can anyone suggest a decent alternative that may work or look better?
Regards
Moo | 0 |
9,511,190 | 03/01/2012 05:41:19 | 1,241,857 | 10/11/2010 06:29:02 | 1 | 0 | How can i handle split view in android sdk using | how to split the screen into two..and making left screen constant and how to navigate the screen which is on the right side..![the expected result attached to the mail,have a look @ image and can any one let me know the how to approach these kind of requirement..
i already got the split using fragments ...now the problem is like ..i've make left side view constant and have to navigate the right side screen..
if anyone know about these kind of functionality ..please let me know..if u have any sample project please send me @
krupatheja.bollavarapu@gmail.com
thanks in advance..
| android | null | null | null | null | null | open | How can i handle split view in android sdk using
===
how to split the screen into two..and making left screen constant and how to navigate the screen which is on the right side..![the expected result attached to the mail,have a look @ image and can any one let me know the how to approach these kind of requirement..
i already got the split using fragments ...now the problem is like ..i've make left side view constant and have to navigate the right side screen..
if anyone know about these kind of functionality ..please let me know..if u have any sample project please send me @
krupatheja.bollavarapu@gmail.com
thanks in advance..
| 0 |
7,359,651 | 09/09/2011 09:32:30 | 894,701 | 08/15/2011 09:08:23 | 13 | 0 | Mac os: move from 1 widget to another in Dashboard (hotkey) | Is there a hotkey to move from 1 widget to another in Dashboard in Mac OS X?
As I understand, tab doesn`t work there. | osx | widget | dashboard | null | null | null | open | Mac os: move from 1 widget to another in Dashboard (hotkey)
===
Is there a hotkey to move from 1 widget to another in Dashboard in Mac OS X?
As I understand, tab doesn`t work there. | 0 |
4,635,824 | 01/08/2011 19:56:11 | 568,268 | 01/08/2011 19:25:55 | 1 | 0 | 4.0 framework Request validation will not allow code-behind to htmlencode textboxes | I have a form that I have been getting submissions that have punctuation and special characters that trigger the potentially dangerous Request.Form value error. I have been trying use the httpUtility.htmlencode and Server.htmlencode method to sanitize textboxes and textareas.
All my tests do not fire because the built-in request validation of the 4.0 framework prevents the code-behind from executing to perform the sanitization. I have included the ValidateRequest in the page header but no matter what I set it too it still does the same thing.
This is the code I have so far.
Session("RequestID") = Server.HtmlEncode(txtRequestID.Value)
Session("FirstName") = Server.HtmlEncode(txtInstFirstName.Text)
Session("LastName") = Server.HtmlEncode(txtInstLastName.Text)
Session("CNumber") = Server.HtmlEncode(txtCNumber.Text)
Session("Email") = Server.HtmlEncode(txtInstEmail.Text)
Session("Phone") = Server.HtmlEncode(txtInstPhone.Text)
Session("Department") = ddlDept.SelectedValue
Session("Location") = ddlLocation.SelectedValue
That did not work so I tried this:
Session("FirstName") = QuoteString(Trim(txtInstFirstName.Text))
Dim sanFN As String = Session("FirstName")
Server.HtmlEncode(sanFN)
What can I do to make this work? According to all the websites I have visited it should work.
Thanks,
Tyler | asp.net | vb.net | null | null | null | 10/14/2011 12:48:48 | too localized | 4.0 framework Request validation will not allow code-behind to htmlencode textboxes
===
I have a form that I have been getting submissions that have punctuation and special characters that trigger the potentially dangerous Request.Form value error. I have been trying use the httpUtility.htmlencode and Server.htmlencode method to sanitize textboxes and textareas.
All my tests do not fire because the built-in request validation of the 4.0 framework prevents the code-behind from executing to perform the sanitization. I have included the ValidateRequest in the page header but no matter what I set it too it still does the same thing.
This is the code I have so far.
Session("RequestID") = Server.HtmlEncode(txtRequestID.Value)
Session("FirstName") = Server.HtmlEncode(txtInstFirstName.Text)
Session("LastName") = Server.HtmlEncode(txtInstLastName.Text)
Session("CNumber") = Server.HtmlEncode(txtCNumber.Text)
Session("Email") = Server.HtmlEncode(txtInstEmail.Text)
Session("Phone") = Server.HtmlEncode(txtInstPhone.Text)
Session("Department") = ddlDept.SelectedValue
Session("Location") = ddlLocation.SelectedValue
That did not work so I tried this:
Session("FirstName") = QuoteString(Trim(txtInstFirstName.Text))
Dim sanFN As String = Session("FirstName")
Server.HtmlEncode(sanFN)
What can I do to make this work? According to all the websites I have visited it should work.
Thanks,
Tyler | 3 |
9,438,197 | 02/24/2012 21:18:40 | 464,253 | 10/01/2010 21:13:13 | 281 | 7 | how do you upload an attachment to github wiki? | I know how to reference it from wikis but where in github site do I upload the attachment? Thanks a lot! | github | wiki | null | null | null | 02/25/2012 02:33:24 | off topic | how do you upload an attachment to github wiki?
===
I know how to reference it from wikis but where in github site do I upload the attachment? Thanks a lot! | 2 |
10,308,419 | 04/25/2012 02:02:45 | 553,508 | 12/24/2010 18:59:54 | 136 | 9 | Declaring objects of type option in Java | How is it possible to declare an object of type `option` in Java? I was told that the following code would convert a Vector of Strings into a Vector of Option, but `new Option(String)` is not a valid constructor:
private <T> Vector<Option> convertToOptions( Vector<T> convert )
{
Vector<Option> options = new Vector<Option>();
for ( T temp : convert )
options.add( new Option( temp.toString() ) );
return options;
} | java | string | option | null | null | null | open | Declaring objects of type option in Java
===
How is it possible to declare an object of type `option` in Java? I was told that the following code would convert a Vector of Strings into a Vector of Option, but `new Option(String)` is not a valid constructor:
private <T> Vector<Option> convertToOptions( Vector<T> convert )
{
Vector<Option> options = new Vector<Option>();
for ( T temp : convert )
options.add( new Option( temp.toString() ) );
return options;
} | 0 |
11,527,504 | 07/17/2012 17:14:23 | 1,365,760 | 04/30/2012 11:55:50 | 1 | 0 | PHP guestbook error | <?php
$sql = mysql_connect("localhost" , "root" , "usbw") or die(mysql_error);
mysql_select_db("guestbook" , $sql);
if($_SERVER['REQUEST_METHOD'] == 'POST') (
$user = mysql_real_escape_string($_POST['user']);
$message = mysql_real_escape_string($_POST['message']);
$query = mysql_query("INSERT INTO message (user,message) VALUES ('$user' , '$message'");
echo ("Message succesfully added.");
)
?>
<html>
<head>
<title>Guestbook</title>
</head>
<form action="index.php" method="post">
User: <input type="text" name="user"/><br>
Message: <textarea name="message"></textarea>
<input type="submit" value="Post!"/>
</form>
</html>
<?php
$result = mysql_query("SELECT * FROM message ORDER BY id DESC");
while($row = mysql_fetch_array($result)) (
)
?>
<table>
<tr>
<td>User:</td>
<td><?php echo $row['user'] ?></td>
</tr>
<td>Message:</td>
<td><?php echo $row['message'] ?></td>
</table>
<hr />
<?php
)
?>
Hey! I'm trying to create a simple php guestbook but I keep getting the following error:
Parse error: syntax error, unexpected ';' in /Applications/XAMPP/xamppfiles/htdocs/g_book/index.php on line 7
Can anybody see where I'm going wrong?
Thanks! | php | parsing | syntax | null | null | 07/17/2012 21:42:00 | too localized | PHP guestbook error
===
<?php
$sql = mysql_connect("localhost" , "root" , "usbw") or die(mysql_error);
mysql_select_db("guestbook" , $sql);
if($_SERVER['REQUEST_METHOD'] == 'POST') (
$user = mysql_real_escape_string($_POST['user']);
$message = mysql_real_escape_string($_POST['message']);
$query = mysql_query("INSERT INTO message (user,message) VALUES ('$user' , '$message'");
echo ("Message succesfully added.");
)
?>
<html>
<head>
<title>Guestbook</title>
</head>
<form action="index.php" method="post">
User: <input type="text" name="user"/><br>
Message: <textarea name="message"></textarea>
<input type="submit" value="Post!"/>
</form>
</html>
<?php
$result = mysql_query("SELECT * FROM message ORDER BY id DESC");
while($row = mysql_fetch_array($result)) (
)
?>
<table>
<tr>
<td>User:</td>
<td><?php echo $row['user'] ?></td>
</tr>
<td>Message:</td>
<td><?php echo $row['message'] ?></td>
</table>
<hr />
<?php
)
?>
Hey! I'm trying to create a simple php guestbook but I keep getting the following error:
Parse error: syntax error, unexpected ';' in /Applications/XAMPP/xamppfiles/htdocs/g_book/index.php on line 7
Can anybody see where I'm going wrong?
Thanks! | 3 |
7,233,573 | 08/29/2011 17:28:53 | 503,569 | 11/10/2010 17:42:07 | 93 | 1 | SenchTouch onItemDisclosure load detailed view problem | I'm trying to get my test project working and have it set out with various viewports js files for each screen. I have now managed to load the data onto the screen with the code below however I am struggling with trying to set-up the onItemDisclosure function so that it switches to a detailed view which shows more information about the selection item.
MobileApp.views.Settings_screen = Ext.extend(Ext.Panel, {
title: "Settings ",
iconCls: "settings",
fullscreen: true,
layout: 'card',
dockedItems: [{
xtype: "toolbar",
title: "Settings"
}],
initComponent: function() {
detailPanel = new Ext.Panel({
id: 'detailPanel',
tpl: 'Hello, World'
}),
this.list = new Ext.List({
id: 'indexlist',
store: MobileApp.listStore,
itemTpl: '<div class="contact">{firstName} {lastName}</div>',
grouped: false,
onItemDisclosure: function() {
MobileApp.views.setActiveItem('detailPanel');
}
});
this.items = [this.list];
MobileApp.views.Settings_screen.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg('settings_screen', MobileApp.views.Settings_screen);
I have tried to put some code here to switch to the detailPanel but it comes up with an undefined error.
onItemDisclosure: function() {
MobileApp.views.setActiveItem('detailPanel');
}
Thanks Aaron | javascript | mvc | sencha-touch | null | null | null | open | SenchTouch onItemDisclosure load detailed view problem
===
I'm trying to get my test project working and have it set out with various viewports js files for each screen. I have now managed to load the data onto the screen with the code below however I am struggling with trying to set-up the onItemDisclosure function so that it switches to a detailed view which shows more information about the selection item.
MobileApp.views.Settings_screen = Ext.extend(Ext.Panel, {
title: "Settings ",
iconCls: "settings",
fullscreen: true,
layout: 'card',
dockedItems: [{
xtype: "toolbar",
title: "Settings"
}],
initComponent: function() {
detailPanel = new Ext.Panel({
id: 'detailPanel',
tpl: 'Hello, World'
}),
this.list = new Ext.List({
id: 'indexlist',
store: MobileApp.listStore,
itemTpl: '<div class="contact">{firstName} {lastName}</div>',
grouped: false,
onItemDisclosure: function() {
MobileApp.views.setActiveItem('detailPanel');
}
});
this.items = [this.list];
MobileApp.views.Settings_screen.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg('settings_screen', MobileApp.views.Settings_screen);
I have tried to put some code here to switch to the detailPanel but it comes up with an undefined error.
onItemDisclosure: function() {
MobileApp.views.setActiveItem('detailPanel');
}
Thanks Aaron | 0 |
11,303,296 | 07/03/2012 01:19:55 | 1,445,052 | 06/08/2012 16:54:51 | 39 | 8 | File seems to lock up while writing to it in C | I'm trying to write randomly generated names, last names and ages to a file in C++, i'm using turbo C, i have to do it this way, it's for a school project and they require me to do it like this.
<br/>
The problem is when i'm writing to the file it stops generating names at the 136th iteration, and it stops generating ages at the 122nd generation.
<br/>
Here is the problematic part of my code :<br/>
char nombres[][30] = {"David","Miguel","Oscar","Esteban","Leonardo"};
char apellidos [][30] ={"Gonzalez","Carrasco","Gutierrez","Lopez","Garcia"};
char *archivo = "info.txt";
FILE *datos;
datos = fopen (archivo,"r");
if(datos == NULL){
printf("El archivo no existe \n");
fclose(datos);
printf("Creando el archivo \n");
// HERE IS THE PROBLEM !!!!!
while(contEmpleados < 1300){
datos = fopen(archivo,"a");
int nombreR = rand() % 5;
int apellidoR = rand() % 5;
int cateR = rand() % 5;
strcpy(nombre [contEmpleados], nombres[nombreR]);
strcpy(apellido[contEmpleados], apellidos[apellidoR]);
edad[contEmpleados] = rand() % (60 - 18) + 18; // rango de edades = 60 a 18
puesto[contEmpleados] = puestoObrero;
categoria[contEmpleados] = categorias[cateR];
switch(cateR){
case 0 :
sueldoI[contEmpleados] = 1400;
break;
case 1 :
sueldoI[contEmpleados] = 1500;
break;
case 2 :
sueldoI[contEmpleados] = 1600;
break;
case 3 :
sueldoI[contEmpleados] = 1700;
break;
case 4 :
sueldoI[contEmpleados] = 1800;
break;
}
// i tried opening and closing the file every time, and it worked better, but not a lot better
fprintf(datos,"%s %s %d \n",nombres[nombreR],apellidos[apellidoR],edad[contEmpleados]);
fclose(datos);
contEmpleados++;
}
printf("Se han creado los obreros\n");
fclose(datos);
} else {
printf("El archivo si existe \n");
}
| c++ | c | homework | file | turbo-c | 07/03/2012 06:44:48 | too localized | File seems to lock up while writing to it in C
===
I'm trying to write randomly generated names, last names and ages to a file in C++, i'm using turbo C, i have to do it this way, it's for a school project and they require me to do it like this.
<br/>
The problem is when i'm writing to the file it stops generating names at the 136th iteration, and it stops generating ages at the 122nd generation.
<br/>
Here is the problematic part of my code :<br/>
char nombres[][30] = {"David","Miguel","Oscar","Esteban","Leonardo"};
char apellidos [][30] ={"Gonzalez","Carrasco","Gutierrez","Lopez","Garcia"};
char *archivo = "info.txt";
FILE *datos;
datos = fopen (archivo,"r");
if(datos == NULL){
printf("El archivo no existe \n");
fclose(datos);
printf("Creando el archivo \n");
// HERE IS THE PROBLEM !!!!!
while(contEmpleados < 1300){
datos = fopen(archivo,"a");
int nombreR = rand() % 5;
int apellidoR = rand() % 5;
int cateR = rand() % 5;
strcpy(nombre [contEmpleados], nombres[nombreR]);
strcpy(apellido[contEmpleados], apellidos[apellidoR]);
edad[contEmpleados] = rand() % (60 - 18) + 18; // rango de edades = 60 a 18
puesto[contEmpleados] = puestoObrero;
categoria[contEmpleados] = categorias[cateR];
switch(cateR){
case 0 :
sueldoI[contEmpleados] = 1400;
break;
case 1 :
sueldoI[contEmpleados] = 1500;
break;
case 2 :
sueldoI[contEmpleados] = 1600;
break;
case 3 :
sueldoI[contEmpleados] = 1700;
break;
case 4 :
sueldoI[contEmpleados] = 1800;
break;
}
// i tried opening and closing the file every time, and it worked better, but not a lot better
fprintf(datos,"%s %s %d \n",nombres[nombreR],apellidos[apellidoR],edad[contEmpleados]);
fclose(datos);
contEmpleados++;
}
printf("Se han creado los obreros\n");
fclose(datos);
} else {
printf("El archivo si existe \n");
}
| 3 |
6,597,083 | 07/06/2011 13:20:56 | 831,649 | 07/06/2011 13:20:56 | 1 | 0 | Linq to xml-How to retrieve xml file from column | I have save xml file in mt table having column data type as xml now I want to retrieve that file in xml format,How I can do this? | .net | sql | linq | sql-server-2005 | server | 07/06/2011 14:23:34 | not a real question | Linq to xml-How to retrieve xml file from column
===
I have save xml file in mt table having column data type as xml now I want to retrieve that file in xml format,How I can do this? | 1 |
3,805,995 | 09/27/2010 16:54:41 | 459,739 | 09/27/2010 16:46:27 | 1 | 0 | Complicated problem. Need help with regular expression replace. | I'm in the process of updating a program that fixes subtitles.
Till now I got away without using regular expressions, but the last problem that has come up might benefit by their use. (I've already solved it without regular expressions, but it's a very unoptimized method that slows my program significantly).
TL;DR;
I'm trying to make the following work:
I want all instances of:
"! ." , "!." and "! . " to become: "!"
unless the dot is followed by another dot, in which case I want all instances of:
"!.." , "! .." , "! . . " and "!. ." to become: "!..."
I've tried this code:
the_str = Regex.Replace(the_str, "\\! \\. [^.]", "\\! [^.]");
that comes close to the first part of what I want to do, but I can't make the [^.] character of the replacement string to be the same character as the one in the original string... Please help!
I'm interested in both C# and pHp implementations... | c# | php | regex | string | null | null | open | Complicated problem. Need help with regular expression replace.
===
I'm in the process of updating a program that fixes subtitles.
Till now I got away without using regular expressions, but the last problem that has come up might benefit by their use. (I've already solved it without regular expressions, but it's a very unoptimized method that slows my program significantly).
TL;DR;
I'm trying to make the following work:
I want all instances of:
"! ." , "!." and "! . " to become: "!"
unless the dot is followed by another dot, in which case I want all instances of:
"!.." , "! .." , "! . . " and "!. ." to become: "!..."
I've tried this code:
the_str = Regex.Replace(the_str, "\\! \\. [^.]", "\\! [^.]");
that comes close to the first part of what I want to do, but I can't make the [^.] character of the replacement string to be the same character as the one in the original string... Please help!
I'm interested in both C# and pHp implementations... | 0 |
2,081,113 | 01/17/2010 13:34:33 | 116,522 | 06/03/2009 11:09:03 | 207 | 20 | jquery date picker split into multiple fields | I have the usual Jquery datepicker working fine. But I want to feed it into a set of selectboxes rather than one textfield. I have had success feeding it into one select field with a specific format but am unsure how to feed all three into different fields with different formats.
$(document).ready(function(){
$("#search_startdate").datepicker({showOn: 'button',
buttonImage: '/images/cal/calendar.gif',
buttonImageOnly: true,
minDate: 0,
maxDate: '+6M +10D',
showAnim: 'fadeIn',
altField: '#startdate_month',
altFormat: 'MM',
altField: '#startdate_day',
altFormat: 'dd'});
//$("#datepicker").datepicker({showOn: 'button', buttonImage: 'images/calendar.gif', buttonImageOnly: true});
});
This doesn't work, it works on the last field, but ignores the first. If I remove the second set of altField and altFormat lines, the first works.
I also tried putting them in a series,
altField: '#startdate_month', '#start_day', altFormat: 'MM', 'dd'
The problem is the same as here:
[http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_24767646.html][1]
Any ideas?
Thanks,
[1]: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_24767646.html | jquery | jquery-ui | datepicker | jquery-datepicker | ruby-on-rails | null | open | jquery date picker split into multiple fields
===
I have the usual Jquery datepicker working fine. But I want to feed it into a set of selectboxes rather than one textfield. I have had success feeding it into one select field with a specific format but am unsure how to feed all three into different fields with different formats.
$(document).ready(function(){
$("#search_startdate").datepicker({showOn: 'button',
buttonImage: '/images/cal/calendar.gif',
buttonImageOnly: true,
minDate: 0,
maxDate: '+6M +10D',
showAnim: 'fadeIn',
altField: '#startdate_month',
altFormat: 'MM',
altField: '#startdate_day',
altFormat: 'dd'});
//$("#datepicker").datepicker({showOn: 'button', buttonImage: 'images/calendar.gif', buttonImageOnly: true});
});
This doesn't work, it works on the last field, but ignores the first. If I remove the second set of altField and altFormat lines, the first works.
I also tried putting them in a series,
altField: '#startdate_month', '#start_day', altFormat: 'MM', 'dd'
The problem is the same as here:
[http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_24767646.html][1]
Any ideas?
Thanks,
[1]: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_24767646.html | 0 |
1,325,434 | 08/25/2009 00:13:03 | 86,878 | 04/03/2009 19:32:44 | 66 | 2 | Crystal Reports: Suppresing a field conditionaly acording to group name in current page | I have a group named: "Group #1 Name" and as you know when viewing the report at the first page in Group 1 section we see the title of group but this is not appears in next page till we navigate to next group.<br/>
Now i want to display the current Group Title navigating by user in the header of page to help user know currently is in witch group( for ex: if group name is name of countries, Products in Country "A" is continued in next page and other next pages and we vant see these products country).<br/><br/>
I copied my "Group #1 Name" and put it on the page header this working but there is a problem:<br/>
when navigating the report from viewer and when we see the next group(Ex: Country B) at the header the value is still Country A and if you continue navigatin to the next page it will be correct.<br/>
this is my Q:<br/>
How Can I Suppress The header field According to the Group Name?<br/>
cleary I want to Suppress Field that shows Country A in the header when The Group Counrty B is Displaying In the Current Page.
<br/>
was my Q Clear? | crystal-reports | suppression | suppress | null | null | null | open | Crystal Reports: Suppresing a field conditionaly acording to group name in current page
===
I have a group named: "Group #1 Name" and as you know when viewing the report at the first page in Group 1 section we see the title of group but this is not appears in next page till we navigate to next group.<br/>
Now i want to display the current Group Title navigating by user in the header of page to help user know currently is in witch group( for ex: if group name is name of countries, Products in Country "A" is continued in next page and other next pages and we vant see these products country).<br/><br/>
I copied my "Group #1 Name" and put it on the page header this working but there is a problem:<br/>
when navigating the report from viewer and when we see the next group(Ex: Country B) at the header the value is still Country A and if you continue navigatin to the next page it will be correct.<br/>
this is my Q:<br/>
How Can I Suppress The header field According to the Group Name?<br/>
cleary I want to Suppress Field that shows Country A in the header when The Group Counrty B is Displaying In the Current Page.
<br/>
was my Q Clear? | 0 |
367,656 | 12/15/2008 07:11:18 | 36,254 | 11/10/2008 17:33:18 | 1 | 0 | String extraction. | Currently I am working very basic game using the C++ environment. The game used to be a school project but now that I am done with that programming class, I wanted to expand my skills and put some more flourish on this old assignment.
I have already made a lot of changes that I am pleased with. I have centralized all the data into folder hierarchies and I have gotten the code to read those locations.
However my problem stems from a very fundamental flaw that has been stumping me.
In order to access the image data that I am using I have used the code:
string imageLocation = "..\\DATA\\Images\\";
string bowImage = imageLocation + "bow.png";
The problem is that when the player picks up an item on the gameboard my code is supposed to use the code:
hud.addLine("You picked up a " + (*itt)->name() + "!");
to print to the command line, "You picked up a Bow!". But instead it shows "You picked up a ..\\DATA\\Images\\!".
Before I centralized my data I used to use:
name_(item_name.substr(0, item_name.find('.')))
in my Item class constructor to chop the item name to just something like bow or candle. After I changed how my data was structured I realized that I would have to change how I chop the name down to the same simple 'bow' or 'candle'.
I have changed the above code to reflect my changes in data structure to be:
name_(item_name.substr(item_name.find("..\\DATA\\Images\\"), item_name.find(".png")))
but unfortunately as I alluded to earlier this change of code is not working as well as I planned it to be.
So now that I have given that real long winded introduction to what my problem is, here is my question.
How do you extract the middle of a string between two sections that you do not want? Also that middle part that is your target is of an unknown length.
Thank you so very much for any help you guys can give. If you need anymore information please ask; I will be more than happy to upload part or even my entire code for more help. Again thank you very much. | c++ | string | middle | extraction | extract | null | open | String extraction.
===
Currently I am working very basic game using the C++ environment. The game used to be a school project but now that I am done with that programming class, I wanted to expand my skills and put some more flourish on this old assignment.
I have already made a lot of changes that I am pleased with. I have centralized all the data into folder hierarchies and I have gotten the code to read those locations.
However my problem stems from a very fundamental flaw that has been stumping me.
In order to access the image data that I am using I have used the code:
string imageLocation = "..\\DATA\\Images\\";
string bowImage = imageLocation + "bow.png";
The problem is that when the player picks up an item on the gameboard my code is supposed to use the code:
hud.addLine("You picked up a " + (*itt)->name() + "!");
to print to the command line, "You picked up a Bow!". But instead it shows "You picked up a ..\\DATA\\Images\\!".
Before I centralized my data I used to use:
name_(item_name.substr(0, item_name.find('.')))
in my Item class constructor to chop the item name to just something like bow or candle. After I changed how my data was structured I realized that I would have to change how I chop the name down to the same simple 'bow' or 'candle'.
I have changed the above code to reflect my changes in data structure to be:
name_(item_name.substr(item_name.find("..\\DATA\\Images\\"), item_name.find(".png")))
but unfortunately as I alluded to earlier this change of code is not working as well as I planned it to be.
So now that I have given that real long winded introduction to what my problem is, here is my question.
How do you extract the middle of a string between two sections that you do not want? Also that middle part that is your target is of an unknown length.
Thank you so very much for any help you guys can give. If you need anymore information please ask; I will be more than happy to upload part or even my entire code for more help. Again thank you very much. | 0 |
5,387,468 | 03/22/2011 06:03:50 | 1,126,761 | 02/23/2011 06:08:40 | 24 | 0 | program for windows in c++ | i need to develop silverlight application for windows embedded ce 6.0
and for that i need to programming in c++ can you suggest me to give some useful materials to get success | c++ | null | null | null | null | 03/22/2011 19:38:23 | off topic | program for windows in c++
===
i need to develop silverlight application for windows embedded ce 6.0
and for that i need to programming in c++ can you suggest me to give some useful materials to get success | 2 |
7,164,427 | 08/23/2011 16:36:43 | 616,017 | 02/14/2011 10:13:30 | 28 | 1 | nginx rewrite rules to php files open a download dialog box? | I have a nginx server with work with php by fast cgi. when I use a rewrite like this:
rewrite "^/tested\.html" /index.html last;
everything is ok, and page index.html shown for tested.html, but when my target is a php file like this:
rewrite "^/tested\.html" /index.php last;
a download dialogbox is opened and when I save the file, I saw it contain my php codes!!!
anyone can help me? | php | nginx | rewrite | null | null | 08/24/2011 02:09:45 | off topic | nginx rewrite rules to php files open a download dialog box?
===
I have a nginx server with work with php by fast cgi. when I use a rewrite like this:
rewrite "^/tested\.html" /index.html last;
everything is ok, and page index.html shown for tested.html, but when my target is a php file like this:
rewrite "^/tested\.html" /index.php last;
a download dialogbox is opened and when I save the file, I saw it contain my php codes!!!
anyone can help me? | 2 |
4,528,272 | 12/24/2010 20:41:54 | 244,681 | 01/06/2010 12:07:18 | 350 | 7 | Is MVC now the only way to write PHP? | Hey... its XMAS Eve and something is bugging me... yes, I have work on my mind even when I am on holiday. The vast amount of frameworks available for PHP now use MVC. Even ASP.net has its own MVC module.
I can see the attraction of MVC, I really can and I use it frequently. The only downside that I can see is that you have to fire up the whole system to execute a page request. Depending on your task this can be a little wasteful.
So the question. In a professional environment is this the only way to use PHP nowadays or are their other design methods which have alternative benefits? | php | mvc | null | null | null | 12/25/2010 02:51:17 | off topic | Is MVC now the only way to write PHP?
===
Hey... its XMAS Eve and something is bugging me... yes, I have work on my mind even when I am on holiday. The vast amount of frameworks available for PHP now use MVC. Even ASP.net has its own MVC module.
I can see the attraction of MVC, I really can and I use it frequently. The only downside that I can see is that you have to fire up the whole system to execute a page request. Depending on your task this can be a little wasteful.
So the question. In a professional environment is this the only way to use PHP nowadays or are their other design methods which have alternative benefits? | 2 |
4,439,369 | 12/14/2010 12:55:07 | 528,696 | 12/02/2010 23:15:42 | 61 | 1 | [SQL][MSaccess] Question about ms access query (combining 2 query) | I have this query:
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/Count(*),15) AS Support
FROM (SELECT *
FROM Prune AS t
WHERE t.Trans_ID IN
(SELECT t1.Trans_ID FROM (
SELECT *FROM Prune WHERE [Nama]="I1") AS t1
INNER JOIN (SELECT * FROM Prune WHERE [Nama]="I2") AS t2 ON t1.Trans_ID = t2.Trans_ID)
AND t.Nama IN ("I1","I2")) AS T1;
And ttrans query
SELECT Count([Trans_ID].[Trans_ID]) AS Expr1
FROM Trans_ID;
i need to change **Count (*)** from :
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/Count(*),15)
into ttrans query.
i've tried using
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/ttrans.Expr1,15) AS Support
FROM (SELECT *
FROM Prune AS t
WHERE t.Trans_ID IN
(SELECT t1.Trans_ID FROM (
SELECT *FROM Prune WHERE [Nama]="I1") AS t1
INNER JOIN (SELECT * FROM Prune WHERE [Nama]="I2") AS t2 ON t1.Trans_ID = t2.Trans_ID)
AND t.Nama IN ("I1","I2")) AS T1, ttrans;
But i got error like this :
You tried to execute a query that does not include the specified expression
'Round(sum([T1].Fuzzy_Value/ttrans.Expr1,15)' as part of an aggregate function
any idea how to fix it?
**note : i'm trying to find 2 combination of all item in transaction database and get a result like this
ITEM Support
I1, I2 0.xxxxxxxxx
where support is (total transaction containing item I1 and I2 / total transaction) -> note that i'm using ttrans query to get total transaction value
**note2 : i'm using msaccess
**note3 :
Ttrans table will look like this
Expr1
270200 | sql | query | ms-access | null | null | null | open | [SQL][MSaccess] Question about ms access query (combining 2 query)
===
I have this query:
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/Count(*),15) AS Support
FROM (SELECT *
FROM Prune AS t
WHERE t.Trans_ID IN
(SELECT t1.Trans_ID FROM (
SELECT *FROM Prune WHERE [Nama]="I1") AS t1
INNER JOIN (SELECT * FROM Prune WHERE [Nama]="I2") AS t2 ON t1.Trans_ID = t2.Trans_ID)
AND t.Nama IN ("I1","I2")) AS T1;
And ttrans query
SELECT Count([Trans_ID].[Trans_ID]) AS Expr1
FROM Trans_ID;
i need to change **Count (*)** from :
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/Count(*),15)
into ttrans query.
i've tried using
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/ttrans.Expr1,15) AS Support
FROM (SELECT *
FROM Prune AS t
WHERE t.Trans_ID IN
(SELECT t1.Trans_ID FROM (
SELECT *FROM Prune WHERE [Nama]="I1") AS t1
INNER JOIN (SELECT * FROM Prune WHERE [Nama]="I2") AS t2 ON t1.Trans_ID = t2.Trans_ID)
AND t.Nama IN ("I1","I2")) AS T1, ttrans;
But i got error like this :
You tried to execute a query that does not include the specified expression
'Round(sum([T1].Fuzzy_Value/ttrans.Expr1,15)' as part of an aggregate function
any idea how to fix it?
**note : i'm trying to find 2 combination of all item in transaction database and get a result like this
ITEM Support
I1, I2 0.xxxxxxxxx
where support is (total transaction containing item I1 and I2 / total transaction) -> note that i'm using ttrans query to get total transaction value
**note2 : i'm using msaccess
**note3 :
Ttrans table will look like this
Expr1
270200 | 0 |
2,389,234 | 03/05/2010 19:08:34 | 132,270 | 07/02/2009 12:51:32 | 135 | 9 | rendering pdf on webside ala google documents | In a current project i need to display PDFs in a webpage. Right now we are embedding them with the Adobe PDF Reader but i would rather have something more elegant (the reader does not integrate well, it can not be overlaid with transparent regions, ...).
I envision something close google documents, where they display PDFs as image but also allow text to be selected and copied out of the PDF (an requirement we have).
Does anybody know how they do this? Or of any library we could use to obtain a comparable result?
I know we could split the PDFs into images on server side, but this would not allow for the selection of text ...
Thanks in advance for any help
PS: Java based project, using wicket. | java | pdf | null | null | null | null | open | rendering pdf on webside ala google documents
===
In a current project i need to display PDFs in a webpage. Right now we are embedding them with the Adobe PDF Reader but i would rather have something more elegant (the reader does not integrate well, it can not be overlaid with transparent regions, ...).
I envision something close google documents, where they display PDFs as image but also allow text to be selected and copied out of the PDF (an requirement we have).
Does anybody know how they do this? Or of any library we could use to obtain a comparable result?
I know we could split the PDFs into images on server side, but this would not allow for the selection of text ...
Thanks in advance for any help
PS: Java based project, using wicket. | 0 |
8,128,140 | 11/14/2011 21:09:01 | 1,046,379 | 11/14/2011 21:04:48 | 1 | 0 | jquery + html get | I what to know ho to make something like this :
I have link
`<a href="#" id="123">Link</a>`
And when I click on it i whant to get `id=123` with jQuery or somtehing like that.
And then add this `id=123` to another div :
Like this
`<div class='info'>id=123</div>`
Can you help me ? | jquery | html | class | null | null | 11/14/2011 22:11:54 | not a real question | jquery + html get
===
I what to know ho to make something like this :
I have link
`<a href="#" id="123">Link</a>`
And when I click on it i whant to get `id=123` with jQuery or somtehing like that.
And then add this `id=123` to another div :
Like this
`<div class='info'>id=123</div>`
Can you help me ? | 1 |
7,561,558 | 09/26/2011 21:30:38 | 613,967 | 07/22/2010 06:45:54 | 1 | 1 | How Do You Handle Expired Access Tokens for the New OpenGraph Publish Actions Feature? | It looks like, even when you have publish_actions permission, the access_token still expires after a few hours. If the goal of publish_actions is to be able to do things for the user in the background without having to ask for permissions over and over again, how do we renew the token without input from the user?
I also read here: https://developers.facebook.com/docs/beta/opengraph/actions/:
Note - Apps can also use an App Access Token to publish actions for authenticated users.
But that doesn't work for me either, I get:
{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException"}} | facebook | opengraph | beta | null | null | null | open | How Do You Handle Expired Access Tokens for the New OpenGraph Publish Actions Feature?
===
It looks like, even when you have publish_actions permission, the access_token still expires after a few hours. If the goal of publish_actions is to be able to do things for the user in the background without having to ask for permissions over and over again, how do we renew the token without input from the user?
I also read here: https://developers.facebook.com/docs/beta/opengraph/actions/:
Note - Apps can also use an App Access Token to publish actions for authenticated users.
But that doesn't work for me either, I get:
{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException"}} | 0 |
10,128,389 | 04/12/2012 17:07:59 | 602,175 | 02/03/2011 20:12:19 | 34 | 1 | What's different from using UploadProgress with Lighttpd vs Upload Progress module in Nginx? | I have an app that successfully tracks upload's progress using UploadProgress & Lighttpd, and I'm porting it over to Nginx.
After reading the documentation: http://wiki.nginx.org/HttpUploadProgressModule I'm not very clear on wether they work the same way or not.
Currently, the process goes like this:
1. I have an HTML page with a form whose action is an iframe on the same page (so the upload doesn't take the visitor out of it).
2. I have the uploadprogress PHP extension installed and also have it installed as a Lighttpd module.
3. Then, once I submit the file, I make AJAX requests to a PHP script of mine that uses uploadprogress_get_info() to get info on the file upload progress, and report it back.
Seems like using Nginx, there's no PHP extension, ¿so how do I get the progress info (bytes total vs bytes sent)? ¿and what process/script or whatever gets to update the progressbar?
A full explanation of how Nginx Upload Progress module works behind the scenes and how all components relate to each other (my html page, my php page where the form is submitted to, nginx, the file, etc)
Thanks! | file-upload | nginx | null | null | null | null | open | What's different from using UploadProgress with Lighttpd vs Upload Progress module in Nginx?
===
I have an app that successfully tracks upload's progress using UploadProgress & Lighttpd, and I'm porting it over to Nginx.
After reading the documentation: http://wiki.nginx.org/HttpUploadProgressModule I'm not very clear on wether they work the same way or not.
Currently, the process goes like this:
1. I have an HTML page with a form whose action is an iframe on the same page (so the upload doesn't take the visitor out of it).
2. I have the uploadprogress PHP extension installed and also have it installed as a Lighttpd module.
3. Then, once I submit the file, I make AJAX requests to a PHP script of mine that uses uploadprogress_get_info() to get info on the file upload progress, and report it back.
Seems like using Nginx, there's no PHP extension, ¿so how do I get the progress info (bytes total vs bytes sent)? ¿and what process/script or whatever gets to update the progressbar?
A full explanation of how Nginx Upload Progress module works behind the scenes and how all components relate to each other (my html page, my php page where the form is submitted to, nginx, the file, etc)
Thanks! | 0 |
8,976,585 | 01/23/2012 18:21:04 | 1,158,801 | 01/19/2012 15:14:51 | 3 | 0 | Unable to instantiate activity | as allways, i get a problem, never a solution...LOL!
In this oportunity i tray to do a simple activity that get a EditText, a Button and make an intent when i press the button to call to the number in the edittext.
The activity start, but throw an exception like this...
01-23 14:41:13.760: E/AndroidRuntime(305): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{android.testcall/android.testcall.TestCallActivity}: java.lang.NullPointerException
tell me if u need more info, or code to view...
Really thnakz again and sorry for my bad english! | android | android-layout | android-intent | android-activity | null | null | open | Unable to instantiate activity
===
as allways, i get a problem, never a solution...LOL!
In this oportunity i tray to do a simple activity that get a EditText, a Button and make an intent when i press the button to call to the number in the edittext.
The activity start, but throw an exception like this...
01-23 14:41:13.760: E/AndroidRuntime(305): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{android.testcall/android.testcall.TestCallActivity}: java.lang.NullPointerException
tell me if u need more info, or code to view...
Really thnakz again and sorry for my bad english! | 0 |
11,736,143 | 07/31/2012 08:35:27 | 1,565,031 | 07/31/2012 07:43:14 | 1 | 0 | c# Multithreaded min-max algorithm | I have written a single-threaded min-max algorithm for a chess game that works fine. Now I am trying to rewrite it to use all avaliable cpu-cores, but I can not get it to work correctly.
My idea is to spawn as many threads as there are cores on the system (in my case 4) and to let the threads add and remove work items from a queue. Each of these work items is a "CalculateState" that holds information about a possible chessboard after x number of moves on the board.
When a workitem is spawned at maxDepth it will evaluate the chessboard and "return" its value. The return is done by propegating its value upwards in the tree of examined moves (to simulate recursion).
Algorithm start:
private readonly ConcurrentPriorityQueue<int, CalculateState> _calculateStates = new ConcurrentPriorityQueue<int, CalculateState>();
private Thread[] _threads = new Thread[Environment.ProcessorCount];
private const int MaxDepth = 3;
private PlayerColor _maxPlayer;
public Move CalculateMoveMultithreaded(ChessBoard board)
{
_maxPlayer = board.TurnToMove;
var parentState = new CalculateState(null, null, 0, null, int.MaxValue, int.MinValue, board.TurnToMove);
foreach (var move in board.GetPossibleMoves())
{
move.MakeMove(board);
var newState = ChessStateTransforms.TransformChessBoardToState(board);
move.UnMakeMove(board);
_calculateStates.Enqueue(MaxDepth, new CalculateState(move, newState, 1, parentState, int.MaxValue, int.MinValue, Player.OppositeColor(board.TurnToMove)));
}
for (var i = 0; i < _threads.Length; i++)
{
var calculationThread = new Thread(DoWork);
_threads[i] = calculationThread;
calculationThread.Start();
}
foreach (var thread in _threads)
{
thread.Join();
}
return parentState.MoveToMake;
}
Thread execution:
private void DoWork()
{
while (true)
{
KeyValuePair<int, CalculateState> queueItem;
if (!_calculateStates.TryDequeue(out queueItem))
break;
var calculateState = queueItem.Value;
var board = ChessStateTransforms.TransformChessStateIntoChessBoard(calculateState.ChessState);
if (calculateState.Depth == MaxDepth)
{
var boardValue = board.ValueOfBoard(_maxPlayer);
calculateState.PropergateValue(boardValue);
continue;
}
foreach (var move in board.GetPossibleMoves())
{
move.MakeMove(board);
var newState = ChessStateTransforms.TransformChessBoardToState(board);
move.UnMakeMove(board);
_calculateStates.Enqueue(MaxDepth - calculateState.Depth, new CalculateState(calculateState.MoveToMake, newState, calculateState.Depth + 1, calculateState, calculateState.MinValue, calculateState.MaxValue, Player.OppositeColor(board.TurnToMove)));
}
}
}
Work item context.
private class CalculateState
{
public readonly PlayerColor Turn;
public int MaxValue;
public int MinValue;
public readonly int Depth;
public readonly ChessState ChessState;
public Move MoveToMake;
private readonly CalculateState _parentState;
public CalculateState(Move moveToMake, ChessState chessState, int depth, CalculateState parentState, int minValue, int maxValue, PlayerColor turn)
{
Depth = depth;
_parentState = parentState;
MoveToMake = moveToMake;
ChessState = chessState;
MaxValue = maxValue;
Turn = turn;
MinValue = minValue;
}
public void PropergateValue(int value, Move firstMove = null)
{
lock (this)
{
if (Turn == _maxPlayer)
{
if (value > MaxValue)
{
MaxValue = value;
if (Depth == 0)
{
MoveToMake = firstMove;
return;
}
_parentState.PropergateValue(MaxValue, MoveToMake);
}
}
else
{
if (value < MinValue)
{
MinValue = value;
if (Depth == 0)
{
MoveToMake = firstMove;
return;
}
_parentState.PropergateValue(MinValue, MoveToMake);
}
}
}
}
}
As it is the algorithm will return moves that takes the enemies pieces, but does not protect its own at all.
I am confident that the code in chessboard, move, valueofboard etc is correct. The problem must like in the multithreading/propegate value code. I have torn my hair over this for over a week and would really appreciate any help.
Thanks | c# | multithreading | chess | minmax | null | null | open | c# Multithreaded min-max algorithm
===
I have written a single-threaded min-max algorithm for a chess game that works fine. Now I am trying to rewrite it to use all avaliable cpu-cores, but I can not get it to work correctly.
My idea is to spawn as many threads as there are cores on the system (in my case 4) and to let the threads add and remove work items from a queue. Each of these work items is a "CalculateState" that holds information about a possible chessboard after x number of moves on the board.
When a workitem is spawned at maxDepth it will evaluate the chessboard and "return" its value. The return is done by propegating its value upwards in the tree of examined moves (to simulate recursion).
Algorithm start:
private readonly ConcurrentPriorityQueue<int, CalculateState> _calculateStates = new ConcurrentPriorityQueue<int, CalculateState>();
private Thread[] _threads = new Thread[Environment.ProcessorCount];
private const int MaxDepth = 3;
private PlayerColor _maxPlayer;
public Move CalculateMoveMultithreaded(ChessBoard board)
{
_maxPlayer = board.TurnToMove;
var parentState = new CalculateState(null, null, 0, null, int.MaxValue, int.MinValue, board.TurnToMove);
foreach (var move in board.GetPossibleMoves())
{
move.MakeMove(board);
var newState = ChessStateTransforms.TransformChessBoardToState(board);
move.UnMakeMove(board);
_calculateStates.Enqueue(MaxDepth, new CalculateState(move, newState, 1, parentState, int.MaxValue, int.MinValue, Player.OppositeColor(board.TurnToMove)));
}
for (var i = 0; i < _threads.Length; i++)
{
var calculationThread = new Thread(DoWork);
_threads[i] = calculationThread;
calculationThread.Start();
}
foreach (var thread in _threads)
{
thread.Join();
}
return parentState.MoveToMake;
}
Thread execution:
private void DoWork()
{
while (true)
{
KeyValuePair<int, CalculateState> queueItem;
if (!_calculateStates.TryDequeue(out queueItem))
break;
var calculateState = queueItem.Value;
var board = ChessStateTransforms.TransformChessStateIntoChessBoard(calculateState.ChessState);
if (calculateState.Depth == MaxDepth)
{
var boardValue = board.ValueOfBoard(_maxPlayer);
calculateState.PropergateValue(boardValue);
continue;
}
foreach (var move in board.GetPossibleMoves())
{
move.MakeMove(board);
var newState = ChessStateTransforms.TransformChessBoardToState(board);
move.UnMakeMove(board);
_calculateStates.Enqueue(MaxDepth - calculateState.Depth, new CalculateState(calculateState.MoveToMake, newState, calculateState.Depth + 1, calculateState, calculateState.MinValue, calculateState.MaxValue, Player.OppositeColor(board.TurnToMove)));
}
}
}
Work item context.
private class CalculateState
{
public readonly PlayerColor Turn;
public int MaxValue;
public int MinValue;
public readonly int Depth;
public readonly ChessState ChessState;
public Move MoveToMake;
private readonly CalculateState _parentState;
public CalculateState(Move moveToMake, ChessState chessState, int depth, CalculateState parentState, int minValue, int maxValue, PlayerColor turn)
{
Depth = depth;
_parentState = parentState;
MoveToMake = moveToMake;
ChessState = chessState;
MaxValue = maxValue;
Turn = turn;
MinValue = minValue;
}
public void PropergateValue(int value, Move firstMove = null)
{
lock (this)
{
if (Turn == _maxPlayer)
{
if (value > MaxValue)
{
MaxValue = value;
if (Depth == 0)
{
MoveToMake = firstMove;
return;
}
_parentState.PropergateValue(MaxValue, MoveToMake);
}
}
else
{
if (value < MinValue)
{
MinValue = value;
if (Depth == 0)
{
MoveToMake = firstMove;
return;
}
_parentState.PropergateValue(MinValue, MoveToMake);
}
}
}
}
}
As it is the algorithm will return moves that takes the enemies pieces, but does not protect its own at all.
I am confident that the code in chessboard, move, valueofboard etc is correct. The problem must like in the multithreading/propegate value code. I have torn my hair over this for over a week and would really appreciate any help.
Thanks | 0 |
5,763,043 | 04/23/2011 08:01:01 | 707,808 | 04/14/2011 11:03:12 | 1 | 0 | IndexTank: how to query without a query string, geolocation only | I know how to query IndexTank with a query string, with or without geolocation. But how do you query with no query string and only geolocation?
index.addFunction(5, "-miles(d[0], d[1], q[0], q[1])");
results = index.search(Query.forString(queryString)
.withScoringFunction(5)
.withQueryVariable(0, latitude)
.withQueryVariable(1, longitude));
If the queryString is null or an empty string it doesn't work.
Thanks. | java | search | null | null | null | null | open | IndexTank: how to query without a query string, geolocation only
===
I know how to query IndexTank with a query string, with or without geolocation. But how do you query with no query string and only geolocation?
index.addFunction(5, "-miles(d[0], d[1], q[0], q[1])");
results = index.search(Query.forString(queryString)
.withScoringFunction(5)
.withQueryVariable(0, latitude)
.withQueryVariable(1, longitude));
If the queryString is null or an empty string it doesn't work.
Thanks. | 0 |
10,482,124 | 05/07/2012 12:30:56 | 1,030,726 | 02/14/2010 05:17:51 | 1 | 0 | can we validate image height and width using paperclip gem | I would like to add validations for the image that uses paerclip gem.
can we validate image height and width using paperclip gem
Thank You,
Uma Mahesh | paperclip-validation | null | null | null | null | null | open | can we validate image height and width using paperclip gem
===
I would like to add validations for the image that uses paerclip gem.
can we validate image height and width using paperclip gem
Thank You,
Uma Mahesh | 0 |
3,790,419 | 09/24/2010 19:42:11 | 245,762 | 01/07/2010 17:35:15 | 132 | 5 | Why an Operation System(OS) is called as hardware dependent? | Why we are saying that the OS is purely hardware dependent (other than peripherals)?
Can you please give me the exact hardware dependencies in a simple/common OS? Meaning exactly in which are all points the OS is accessing the hardware or depending on the platform?
Also is it possible to write a simple OS(using C language) with out any hardware dependency(ie without any VM concept)?
__Kanu | c | operating-system | hardware | platform | null | 09/25/2010 19:05:58 | not a real question | Why an Operation System(OS) is called as hardware dependent?
===
Why we are saying that the OS is purely hardware dependent (other than peripherals)?
Can you please give me the exact hardware dependencies in a simple/common OS? Meaning exactly in which are all points the OS is accessing the hardware or depending on the platform?
Also is it possible to write a simple OS(using C language) with out any hardware dependency(ie without any VM concept)?
__Kanu | 1 |
3,096,096 | 06/22/2010 18:38:56 | 373,504 | 06/22/2010 18:38:56 | 1 | 0 | python and xml integration | how to i get the output of a python code in an XML file?(URGENT) | python | null | null | null | null | 06/24/2010 05:13:41 | not a real question | python and xml integration
===
how to i get the output of a python code in an XML file?(URGENT) | 1 |
11,648,815 | 07/25/2012 11:35:24 | 828,261 | 07/04/2011 14:12:35 | 1,688 | 132 | Google maps in china "Are they actually blocked"? | Hi guys im working on a site which has a majority of chinese users. The problem is that it has been reported that google maps is not working for our users in china, because it is blocked.
I have trawled the net looking for a definitive answer but cant seem to find one, does any one know for sure weather it is blocked or not.
When I use a Chinese proxy I cannot reproduce the issue, and I am also not using https for my calls.
| google-maps | null | null | null | null | 07/25/2012 11:53:25 | off topic | Google maps in china "Are they actually blocked"?
===
Hi guys im working on a site which has a majority of chinese users. The problem is that it has been reported that google maps is not working for our users in china, because it is blocked.
I have trawled the net looking for a definitive answer but cant seem to find one, does any one know for sure weather it is blocked or not.
When I use a Chinese proxy I cannot reproduce the issue, and I am also not using https for my calls.
| 2 |
11,105,444 | 06/19/2012 16:38:28 | 1,070,422 | 11/29/2011 01:21:27 | 40 | 0 | unix - run a command as another user | I am a newbie to Unix. I am trying to run a shell script and command as another user.
For example:
I am logged in as user1 and want to execute a script as user2. I dont want the password prompt and I want it to be auto-entered. I am aware of the public key authentication but I am trying to find if there is something like:
sudo -u user2 script.sh
I am trying to cron this, so I dont want the password prompt. I want it to be handled in the sudo command itself.
please help | unix | script | sudo | null | null | 06/20/2012 03:00:37 | off topic | unix - run a command as another user
===
I am a newbie to Unix. I am trying to run a shell script and command as another user.
For example:
I am logged in as user1 and want to execute a script as user2. I dont want the password prompt and I want it to be auto-entered. I am aware of the public key authentication but I am trying to find if there is something like:
sudo -u user2 script.sh
I am trying to cron this, so I dont want the password prompt. I want it to be handled in the sudo command itself.
please help | 2 |
3,807,837 | 09/27/2010 21:01:19 | 251,153 | 01/14/2010 23:18:20 | 10,163 | 323 | FileNotFoundException trying to load a DLL from managed code | To start off, I'd like to say I'm rather unfamiliar with the Windows linking system.
This is my setup: I've got two projects in the same solution. The first is a C++/CLI project we'll call `Foo`. `Foo` is a library project that depends on an external library (the Java Runtime Environment), and thus has the appropriate reference to the appropriate (I believe since it compiles) .lib file. (I changed no other project setting related to loading that library.) My other project, `Bar` is a C# console executable project that references `Foo`.
Both compile just fine.
However, when I execute my `Bar.exe` C# program, it dies before the construction of the first object that requires types from `Foo`. The exception is a `FileNotFoundException` that states the `Foo.dll` assembly or one of its dependencies couldn't be found.
So I launched `fuslogvw` to see what went wrong, but I don't really understand how it works, and the documentation I found on it is rather unhelpful. From what I think I understand, both `Foo` and `Bar` failed to load as native images, but were found to be correct IL and were properly loaded that way. There is no other relevant mention of failure, though, obviously it _does_ fail at some point. I'd post the logs, but they're in French and I think it would be pretty useless.
Any idea? | .net | dll | dynamic-linking | null | null | null | open | FileNotFoundException trying to load a DLL from managed code
===
To start off, I'd like to say I'm rather unfamiliar with the Windows linking system.
This is my setup: I've got two projects in the same solution. The first is a C++/CLI project we'll call `Foo`. `Foo` is a library project that depends on an external library (the Java Runtime Environment), and thus has the appropriate reference to the appropriate (I believe since it compiles) .lib file. (I changed no other project setting related to loading that library.) My other project, `Bar` is a C# console executable project that references `Foo`.
Both compile just fine.
However, when I execute my `Bar.exe` C# program, it dies before the construction of the first object that requires types from `Foo`. The exception is a `FileNotFoundException` that states the `Foo.dll` assembly or one of its dependencies couldn't be found.
So I launched `fuslogvw` to see what went wrong, but I don't really understand how it works, and the documentation I found on it is rather unhelpful. From what I think I understand, both `Foo` and `Bar` failed to load as native images, but were found to be correct IL and were properly loaded that way. There is no other relevant mention of failure, though, obviously it _does_ fail at some point. I'd post the logs, but they're in French and I think it would be pretty useless.
Any idea? | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.