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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,731,957 | 03/16/2012 04:36:36 | 1,273,148 | 03/16/2012 03:34:31 | 1 | 0 | How to serve OpenLayers tiles from the local JavaScript script, not HTTP | First, THANKS!
I am trying to find a way to add a tiled overlay to an OpenLayers map, using OpenStreetMap as the base layer, where the tiles are locally generated in JavaScript. The overlay is for adding GPS datapoints. I need to display 10K-100K points, so I can't use markers for the datapoints (it crashes the browser). Instead, I plan to maintain a database in JavaScript and plot the points on a tiled canvas (I'll re-render the tiled canvas each time the zoom value changes). So, I need to find a way to get OpenLayers to request new tiles from the local JavaScript, not from a PNG file served over HTTP. Can I do this? I thought I could simply specify a JavaScript function, thus:
==> new OpenLayers.Layer.XYZ("GPS Tracking Points", 'javascript:GetTileGPS(${z},${x},${y});')
But I can't get this to work. [Wikipedia][1] says that 'javascript:' is not officially supported (even though all browsers implement it), and even if it were officially supported, it may still be that OpenLayers does not. Unfortunately, I can't find any mention in OpenLayers docs. I tried removing the Z/X/Y parameters to see if that is the problem:
==> new OpenLayers.Layer.XYZ("GPS Tracking Points", 'javascript:GetTileGPS();')
But no luck. One problem I see is that the data returned by the GetTileGPS() function gives no external indication of the file type it is returning; this function creates a PNG file image. But PNG file images have an 8-byte unique signature at the start that OpenLayers could be used to discriminate between PNG and JPG, but I don't know if this is done.
Any ideas what I'm doing wrong, or is there another way that I can serve tiles to OpenLayers from JavaScript?
[1]: http://en.wikipedia.org/wiki/URI_scheme | javascript | openlayers | tiles | openstreetmap | null | 03/19/2012 18:02:48 | not a real question | How to serve OpenLayers tiles from the local JavaScript script, not HTTP
===
First, THANKS!
I am trying to find a way to add a tiled overlay to an OpenLayers map, using OpenStreetMap as the base layer, where the tiles are locally generated in JavaScript. The overlay is for adding GPS datapoints. I need to display 10K-100K points, so I can't use markers for the datapoints (it crashes the browser). Instead, I plan to maintain a database in JavaScript and plot the points on a tiled canvas (I'll re-render the tiled canvas each time the zoom value changes). So, I need to find a way to get OpenLayers to request new tiles from the local JavaScript, not from a PNG file served over HTTP. Can I do this? I thought I could simply specify a JavaScript function, thus:
==> new OpenLayers.Layer.XYZ("GPS Tracking Points", 'javascript:GetTileGPS(${z},${x},${y});')
But I can't get this to work. [Wikipedia][1] says that 'javascript:' is not officially supported (even though all browsers implement it), and even if it were officially supported, it may still be that OpenLayers does not. Unfortunately, I can't find any mention in OpenLayers docs. I tried removing the Z/X/Y parameters to see if that is the problem:
==> new OpenLayers.Layer.XYZ("GPS Tracking Points", 'javascript:GetTileGPS();')
But no luck. One problem I see is that the data returned by the GetTileGPS() function gives no external indication of the file type it is returning; this function creates a PNG file image. But PNG file images have an 8-byte unique signature at the start that OpenLayers could be used to discriminate between PNG and JPG, but I don't know if this is done.
Any ideas what I'm doing wrong, or is there another way that I can serve tiles to OpenLayers from JavaScript?
[1]: http://en.wikipedia.org/wiki/URI_scheme | 1 |
5,998,496 | 05/13/2011 22:47:33 | 753,128 | 05/13/2011 22:47:33 | 1 | 0 | C++ STL map storing null pointers. | I'm trying to write a copy constructor for an object managing a STL map containing pointers, where the key is a string. However, when I attempt to insert new values in the map, the pointers are set to NULL:
// ...
for(std::map<std::string, data_base*, order>::const_iterator it = other.elements.begin();
it != other.elements.end(); ++it){
data_base *t = it->second->clone();
std::cout << "CLONE: " << std::hex << t << std::endl;
elements[it->first] = t;
std::cout << "INSERTED: " << std::hex << elements[it->first] << std::endl;
}
// ...
`other` is the object being copied and `elements` the map. The `clone()` method returns a pointer to a new object (via `new`).
Running the code above I get something like:
CLONE: 0xcfbbc0
INSERTED: 0
I'm not a very experienced programmer and this issue is probably simple to fix, but I didnt find any solution to it searching around.
Thanks a lot for your time. | c++ | null | null | null | null | null | open | C++ STL map storing null pointers.
===
I'm trying to write a copy constructor for an object managing a STL map containing pointers, where the key is a string. However, when I attempt to insert new values in the map, the pointers are set to NULL:
// ...
for(std::map<std::string, data_base*, order>::const_iterator it = other.elements.begin();
it != other.elements.end(); ++it){
data_base *t = it->second->clone();
std::cout << "CLONE: " << std::hex << t << std::endl;
elements[it->first] = t;
std::cout << "INSERTED: " << std::hex << elements[it->first] << std::endl;
}
// ...
`other` is the object being copied and `elements` the map. The `clone()` method returns a pointer to a new object (via `new`).
Running the code above I get something like:
CLONE: 0xcfbbc0
INSERTED: 0
I'm not a very experienced programmer and this issue is probably simple to fix, but I didnt find any solution to it searching around.
Thanks a lot for your time. | 0 |
5,312,915 | 03/15/2011 14:04:21 | 491,379 | 10/29/2010 14:05:36 | 76 | 4 | Show button in DataView row on mouseover (ExtJS) | I would like to show a (delete) button in a DataView row in ExtJS. I don't want the delete button to be always visible but just on a mouseover.
If anyone has an example that would be greatly appreciated. | extjs | mouseover | dataview | null | null | null | open | Show button in DataView row on mouseover (ExtJS)
===
I would like to show a (delete) button in a DataView row in ExtJS. I don't want the delete button to be always visible but just on a mouseover.
If anyone has an example that would be greatly appreciated. | 0 |
10,652,604 | 05/18/2012 12:24:29 | 1,229,909 | 02/24/2012 04:17:42 | 71 | 9 | How to create custom home button which shows for all activities of my project? | ![enter image description here][1]
[1]: http://i.stack.imgur.com/2VZYM.png
How to create picture type of home button which shows for all activities of my project.
i have 4 or 5 activities is there.
I want to click that button go back to main window. please give me code | android | button | menu | home | null | 05/18/2012 22:56:19 | not a real question | How to create custom home button which shows for all activities of my project?
===
![enter image description here][1]
[1]: http://i.stack.imgur.com/2VZYM.png
How to create picture type of home button which shows for all activities of my project.
i have 4 or 5 activities is there.
I want to click that button go back to main window. please give me code | 1 |
1,629,592 | 10/27/2009 09:15:40 | 162,767 | 08/25/2009 13:50:05 | 46 | 2 | which one is better javaFX or Adobe Flex? | I am new to both the technologies.Which scenarios is better for using Adobe Flex , and which is the best place to use Java Flex? | java | javafx | null | null | null | 10/27/2009 19:40:38 | not constructive | which one is better javaFX or Adobe Flex?
===
I am new to both the technologies.Which scenarios is better for using Adobe Flex , and which is the best place to use Java Flex? | 4 |
7,258,417 | 08/31/2011 14:24:51 | 921,807 | 08/31/2011 14:24:51 | 1 | 0 | How to create a custom symbol list item in Textmate? | I am looking to create a custom "Symbol" for the "Symbol List" in Textmate so that I can have named bookmarks and jump to sections more easily.
Specifically I am trying to duplicate (from the CSS bundle)<br>
<pre>/** something **/</pre>
<p>
That basically adds to Symbol List * something *<br>
I would like this in HTML and JavaScript as well. But can't figure out how to make it work.
</p>
<p>
Hope someone out there can help...
</p>
| javascript | html | textmate | textmatebundles | null | null | open | How to create a custom symbol list item in Textmate?
===
I am looking to create a custom "Symbol" for the "Symbol List" in Textmate so that I can have named bookmarks and jump to sections more easily.
Specifically I am trying to duplicate (from the CSS bundle)<br>
<pre>/** something **/</pre>
<p>
That basically adds to Symbol List * something *<br>
I would like this in HTML and JavaScript as well. But can't figure out how to make it work.
</p>
<p>
Hope someone out there can help...
</p>
| 0 |
861,939 | 05/14/2009 07:07:38 | 72,760 | 03/02/2009 11:15:24 | 386 | 26 | Connection pooling and single sign on | An ASP.NET 3.5 app with SQL Server 2005 must provide single sign on on an intranet environment. This is done by using the Windows Authentication mode in the web.config.
I want to use connection pooling as much as possible. When using SSPI as database access in the connection string I will not gain any benefits from connection pooling....
Is there a way of using connection pooling and single sign on mechanism for ASP.NET apps ? | asp.net | connection-pooling | connection-string | null | null | null | open | Connection pooling and single sign on
===
An ASP.NET 3.5 app with SQL Server 2005 must provide single sign on on an intranet environment. This is done by using the Windows Authentication mode in the web.config.
I want to use connection pooling as much as possible. When using SSPI as database access in the connection string I will not gain any benefits from connection pooling....
Is there a way of using connection pooling and single sign on mechanism for ASP.NET apps ? | 0 |
8,976,320 | 01/23/2012 18:00:25 | 854,416 | 07/20/2011 17:00:46 | 6 | 1 | How to configure Spring to NO SET Pragma No-Cache | My system is Spring MVC based and I checked that Spring automatically sets **PRAGMA: no-cache**. The system is available to the users through SSL. When the users try to download something using the INTERNET EXPLORER 7 or 8 an error like *"Internet Explorer cannot download file from server"* appears (more details: http://support.microsoft.com/default.aspx?scid=KB;EN-US;q316431&).
I tried to configure the **WebContentInterceptor** like the code bellow but does not work:
<mvc:interceptors>
<bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor">
<property name="cacheSeconds" value="2100" />
<property name="useExpiresHeader" value="false" />
<property name="useCacheControlHeader" value="false" />
<property name="useCacheControlNoStore" value="false" />
</bean>
</mvc:interceptors>
What can I do avoid Spring send the Pragma: no-cache and related to Cache Control?
Regards! | java | spring | java-ee | spring-mvc | null | null | open | How to configure Spring to NO SET Pragma No-Cache
===
My system is Spring MVC based and I checked that Spring automatically sets **PRAGMA: no-cache**. The system is available to the users through SSL. When the users try to download something using the INTERNET EXPLORER 7 or 8 an error like *"Internet Explorer cannot download file from server"* appears (more details: http://support.microsoft.com/default.aspx?scid=KB;EN-US;q316431&).
I tried to configure the **WebContentInterceptor** like the code bellow but does not work:
<mvc:interceptors>
<bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor">
<property name="cacheSeconds" value="2100" />
<property name="useExpiresHeader" value="false" />
<property name="useCacheControlHeader" value="false" />
<property name="useCacheControlNoStore" value="false" />
</bean>
</mvc:interceptors>
What can I do avoid Spring send the Pragma: no-cache and related to Cache Control?
Regards! | 0 |
11,585,271 | 07/20/2012 18:49:52 | 1,321,826 | 04/09/2012 12:11:58 | 6 | 0 | Cant set Linq-to-sql-objects in viewstate | When I try to set a Linq-to-sql-object to my viewstate I will get a runtime exception that says that I must make the object serializable.
I have googled on my problem but can not find a solution on my problem. Is it possible to make these objects serializable? These objects are auto-generated so its impossible to just add a [Serializable]-attribut before the class and I cant find any settings for this in the particular dbml-file.
Thanks in advance! | asp.net | linq-to-sql | null | null | null | null | open | Cant set Linq-to-sql-objects in viewstate
===
When I try to set a Linq-to-sql-object to my viewstate I will get a runtime exception that says that I must make the object serializable.
I have googled on my problem but can not find a solution on my problem. Is it possible to make these objects serializable? These objects are auto-generated so its impossible to just add a [Serializable]-attribut before the class and I cant find any settings for this in the particular dbml-file.
Thanks in advance! | 0 |
1,166,552 | 07/22/2009 16:36:19 | 15,622 | 09/17/2008 11:18:33 | 2,092 | 74 | asp.net wizard control non-clickable sidebar | I would like to set the sidebar in an asp.net wizard control so that it just displays the step names and the current step, but without letting the user click on them; I want the user to navigate the wizard control only with the next/previous buttons.
Is this possible? | asp.net | wizard | c# | null | null | null | open | asp.net wizard control non-clickable sidebar
===
I would like to set the sidebar in an asp.net wizard control so that it just displays the step names and the current step, but without letting the user click on them; I want the user to navigate the wizard control only with the next/previous buttons.
Is this possible? | 0 |
3,852,333 | 10/04/2010 01:38:01 | 195,716 | 10/24/2009 02:07:54 | 79 | 0 | How to get values of all the occurence of same element in XSLT? | I have an XML File like :
<company>
<dept>
<name> Dept-A</name>
<proj>
<id> A1 </id>
<noOfPeople> 5 <noOfPeople>
<proj>
<id>A11</id>
<noOfPeople> 2 <noOfPeople>
</proj>
</proj>
</dept>
<dept>
....
</dept>
<company>
Now:<br/>
1. I want to have a list of all the projects. Even if they are Sub Projects like A11 inside A1, I want every distinct proj id. <br/>
2. Also, I want to have this list available to me at multiple locations, Ex. While parsing project A1, or while parsing A11 or any other nesting level of proj.
Is there any way of achieving this in XSLT?
Thank You.<br/>
Tara Singh
| xslt | null | null | null | null | null | open | How to get values of all the occurence of same element in XSLT?
===
I have an XML File like :
<company>
<dept>
<name> Dept-A</name>
<proj>
<id> A1 </id>
<noOfPeople> 5 <noOfPeople>
<proj>
<id>A11</id>
<noOfPeople> 2 <noOfPeople>
</proj>
</proj>
</dept>
<dept>
....
</dept>
<company>
Now:<br/>
1. I want to have a list of all the projects. Even if they are Sub Projects like A11 inside A1, I want every distinct proj id. <br/>
2. Also, I want to have this list available to me at multiple locations, Ex. While parsing project A1, or while parsing A11 or any other nesting level of proj.
Is there any way of achieving this in XSLT?
Thank You.<br/>
Tara Singh
| 0 |
4,025,692 | 10/26/2010 16:23:01 | 392,514 | 07/15/2010 09:25:17 | 69 | 3 | mysql "group by" very slow query. | i have this query in a table with about 100k records, it runs quite slow (3-4s), when I take out the group it's much faster (less than 0.5s). I'm quite at loss what to do to fix this :
select msg.id, msg.thread_id, msg.senderid,msg.recipientid,
from_user.username as from_name, to_user.username as to_name
from msgtable as msg
left join usertable as from_user on msg.senderid = from_user.id
left join usertabe as to_user on msg.recipientid = to_user.id
GROUP BY msg.thread_id ORDER BY msg.id desc
msgtable has indexes on thread_id and id
Any ideas how to speed this up while returning the same result (there are multiple messages per thread, i want to return only one message per thread in this query).
thanks in advance. | sql | mysql | sql-optimization | null | null | null | open | mysql "group by" very slow query.
===
i have this query in a table with about 100k records, it runs quite slow (3-4s), when I take out the group it's much faster (less than 0.5s). I'm quite at loss what to do to fix this :
select msg.id, msg.thread_id, msg.senderid,msg.recipientid,
from_user.username as from_name, to_user.username as to_name
from msgtable as msg
left join usertable as from_user on msg.senderid = from_user.id
left join usertabe as to_user on msg.recipientid = to_user.id
GROUP BY msg.thread_id ORDER BY msg.id desc
msgtable has indexes on thread_id and id
Any ideas how to speed this up while returning the same result (there are multiple messages per thread, i want to return only one message per thread in this query).
thanks in advance. | 0 |
3,597,693 | 08/30/2010 03:33:08 | 82,320 | 03/25/2009 00:56:36 | 13,380 | 550 | How does the pimpl idiom reduce dependencies? | Consider the following:
PImpl.hpp
class Impl;
class PImpl
{
Impl* pimpl;
PImpl() : pimpl(new Impl) { }
~PImpl() { delete pimpl; }
void DoSomething();
};
PImpl.cpp
#include "PImpl.hpp"
#include "Impl.hpp"
void PImpl::DoSomething() { pimpl->DoSomething(); }
Impl.hpp
class Impl
{
int data;
public:
void DoSomething() {}
}
client.cpp
#include "Pimpl.hpp"
int main()
{
PImpl unitUnderTest;
PImpl.DoSomething();
}
The idea behind this pattern is that `Impl`'s interface can change, yet clients do not have to be recompiled. Yet, I fail to see how this can truly be the case. Let's say I wanted to add a method to this class -- clients would *still* have to recompile.
Basically, the only kinds of changes like this that I can see *ever* needing to change the header file for a class for are things for which the interface of the class changes. And when that happens, pimpl or no pimpl, clients have to recompile.
What kinds of editing here give us benefits in terms of not recompiling client code? | c++ | pimpl-idiom | null | null | null | null | open | How does the pimpl idiom reduce dependencies?
===
Consider the following:
PImpl.hpp
class Impl;
class PImpl
{
Impl* pimpl;
PImpl() : pimpl(new Impl) { }
~PImpl() { delete pimpl; }
void DoSomething();
};
PImpl.cpp
#include "PImpl.hpp"
#include "Impl.hpp"
void PImpl::DoSomething() { pimpl->DoSomething(); }
Impl.hpp
class Impl
{
int data;
public:
void DoSomething() {}
}
client.cpp
#include "Pimpl.hpp"
int main()
{
PImpl unitUnderTest;
PImpl.DoSomething();
}
The idea behind this pattern is that `Impl`'s interface can change, yet clients do not have to be recompiled. Yet, I fail to see how this can truly be the case. Let's say I wanted to add a method to this class -- clients would *still* have to recompile.
Basically, the only kinds of changes like this that I can see *ever* needing to change the header file for a class for are things for which the interface of the class changes. And when that happens, pimpl or no pimpl, clients have to recompile.
What kinds of editing here give us benefits in terms of not recompiling client code? | 0 |
11,223,851 | 06/27/2012 10:12:01 | 1,480,237 | 06/25/2012 14:09:29 | 16 | 0 | Application strongly coupled |
Please, I would create a strongly coupled application, each process runs on a machine and communicates with other processes, I thought about doing a client and server in C, the client connects to the server, the server do sleep (20 seconds) and sends a letter to the client
the client also do the same thing
![application strongly coupled][1]
Is it good that I did? i wait your comments , thank you so much
[1]: http://i.stack.imgur.com/JIMhk.png | c | null | null | null | null | 06/27/2012 10:55:17 | not constructive | Application strongly coupled
===
Please, I would create a strongly coupled application, each process runs on a machine and communicates with other processes, I thought about doing a client and server in C, the client connects to the server, the server do sleep (20 seconds) and sends a letter to the client
the client also do the same thing
![application strongly coupled][1]
Is it good that I did? i wait your comments , thank you so much
[1]: http://i.stack.imgur.com/JIMhk.png | 4 |
6,646,920 | 07/11/2011 07:20:09 | 464,465 | 10/02/2010 06:58:29 | 237 | 3 | How to create a analog clock in iphone | i want to develop a clock application for iphone.initially when the app launches the app should show the current time on the view in analog clock format.i have the images for the clock screen and hands(minutes,hours) of the clock.Please can anybody help me in how to make an analog clock using this.Thanks | iphone | objective-c | null | null | null | 07/11/2011 08:05:54 | not a real question | How to create a analog clock in iphone
===
i want to develop a clock application for iphone.initially when the app launches the app should show the current time on the view in analog clock format.i have the images for the clock screen and hands(minutes,hours) of the clock.Please can anybody help me in how to make an analog clock using this.Thanks | 1 |
8,606,765 | 12/22/2011 16:22:57 | 785,937 | 06/06/2011 12:55:17 | 851 | 34 | When will g++ not need -std=c++0x | Is there someone on the list "in the know" that can tell us when c++11 features in g++ will no longer be "experimental"? That is, when will "-std=c++0x" not be necessary to get current standard (C++11)? (Presumably, that would also speak to how confident that community is in the supported features.)
I am similarly interested in Clang.
| g++ | c++11 | null | null | null | 12/23/2011 20:10:35 | not constructive | When will g++ not need -std=c++0x
===
Is there someone on the list "in the know" that can tell us when c++11 features in g++ will no longer be "experimental"? That is, when will "-std=c++0x" not be necessary to get current standard (C++11)? (Presumably, that would also speak to how confident that community is in the supported features.)
I am similarly interested in Clang.
| 4 |
7,908,014 | 10/26/2011 19:47:58 | 935,549 | 09/08/2011 19:09:30 | 1 | 0 | Copyrighted images for user generated content | With an app that displays community generated content what is the responsibility of the app author? I am quite willing to remove the images on request but wouldn't want to find myself in court without a warning.
Sould it be a criminal offence from the app author without default, then how does it work over borders / if there is disclaimer about the image (courtesy of xxx).
Noticed from http://stackoverflow.com/questions/5984678/automated-checking-of-copyright-and-trademarks that there is a tool for checking images but its not 100% so I want my facts checked.
Thanks in advance!
Timo | image | copyright | copyright-law | null | null | 10/26/2011 19:58:20 | off topic | Copyrighted images for user generated content
===
With an app that displays community generated content what is the responsibility of the app author? I am quite willing to remove the images on request but wouldn't want to find myself in court without a warning.
Sould it be a criminal offence from the app author without default, then how does it work over borders / if there is disclaimer about the image (courtesy of xxx).
Noticed from http://stackoverflow.com/questions/5984678/automated-checking-of-copyright-and-trademarks that there is a tool for checking images but its not 100% so I want my facts checked.
Thanks in advance!
Timo | 2 |
5,804,676 | 04/27/2011 13:12:52 | 31,480 | 10/25/2008 19:38:50 | 6,917 | 245 | How do you create a shallow copy of an Array in ActionScript 3 | Title says it all really.
var a:Array = ["a","b","c"];
var b:Array;
/* insert code here to copy 'a' and assign it to 'b'*/ | actionscript-3 | flex3 | lazyweb | null | null | null | open | How do you create a shallow copy of an Array in ActionScript 3
===
Title says it all really.
var a:Array = ["a","b","c"];
var b:Array;
/* insert code here to copy 'a' and assign it to 'b'*/ | 0 |
1,939,556 | 12/21/2009 11:24:13 | 219,335 | 11/26/2009 11:20:11 | 16 | 0 | overloading operator delete, or how to kill a cat? | I am experimenting with overloading operator delete, so that I can return a plain pointer to those who don't wish to work with smart pointers, and yet be able to control when the object is deleted.
I define a class Cat that is constructed with several souls, has an overloaded operator delete that does nothing, and destructor that decrements the number of souls (and also does some bragging). When souls reaches 0 the destructor calls the global ::delete, and the cat dies.
This sounds quite simple, but does not work as expected. Here's the code:
class Cat {
public:
Cat(string n): name(n), souls(9)
{ cout << "Myaou... " << name << " is born\n"; }
~Cat();
void operator delete(void *p) { cout << "!!! operator delete called\n"; }
void report()
{ cout << name << "'s here, " << souls << " souls to spend\n"; }
friend ostream& operator<< (const ostream& o, const Cat& cat);
private:
void kill();
const string name;
int souls;
};
Cat::~Cat()
{
cout << "!!! dtor called\n";
kill();
}
void Cat::kill()
{
if (--souls)
cout << name << " is still alive! I have " << souls << " souls left.\n";
else {
cout << name << " is dying... good bye world!\n";
::delete((void*)this);
}
}
ostream& operator<< (const ostream& o, const Cat& cat)
{
return o << cat.name << "'s here, " << cat.souls << " souls to spend\n";
}
here's the main:
int main()
{
Cat *p = new Cat("Mitzi");
for (;;)
{
char c[100];
// cout << *p;
p->report();
cout << "come on, hit me!";
cin >> c;
delete p;
}
}
I'd expect that the loop would run for 9 times, and then something unpleasant (crash) would happen. However, this is the output:
Myaou... Mitzi is born
Mitzi's here, 9 souls to spend
come on, hit me!c
!!! dtor called
Mitzi is still alive! I have 8 souls left.
!!! operator delete called
's here, 8 souls to spend
come on, hit me!c
!!! dtor called
is still alive! I have 7 souls left.
*** glibc detected *** /home/davidk/workspace/string_test/Debug/string_test: double free or corruption (fasttop): 0x080cd008 ***
Seems that after the first delete the name member is destroyed, and the next delete causes a crash. Any explanations? I am compiling with gcc on Linux, can be a compiler bug?
BTW, when I used the operator<<() as in cout << *p instead of repotr(), it was also weird: it entered an infinite loop of calling the constructor from within the operator<<(). What's going on here? :)
thanks! | c++ | operator-overloading | delete-overload | reference-counting | null | null | open | overloading operator delete, or how to kill a cat?
===
I am experimenting with overloading operator delete, so that I can return a plain pointer to those who don't wish to work with smart pointers, and yet be able to control when the object is deleted.
I define a class Cat that is constructed with several souls, has an overloaded operator delete that does nothing, and destructor that decrements the number of souls (and also does some bragging). When souls reaches 0 the destructor calls the global ::delete, and the cat dies.
This sounds quite simple, but does not work as expected. Here's the code:
class Cat {
public:
Cat(string n): name(n), souls(9)
{ cout << "Myaou... " << name << " is born\n"; }
~Cat();
void operator delete(void *p) { cout << "!!! operator delete called\n"; }
void report()
{ cout << name << "'s here, " << souls << " souls to spend\n"; }
friend ostream& operator<< (const ostream& o, const Cat& cat);
private:
void kill();
const string name;
int souls;
};
Cat::~Cat()
{
cout << "!!! dtor called\n";
kill();
}
void Cat::kill()
{
if (--souls)
cout << name << " is still alive! I have " << souls << " souls left.\n";
else {
cout << name << " is dying... good bye world!\n";
::delete((void*)this);
}
}
ostream& operator<< (const ostream& o, const Cat& cat)
{
return o << cat.name << "'s here, " << cat.souls << " souls to spend\n";
}
here's the main:
int main()
{
Cat *p = new Cat("Mitzi");
for (;;)
{
char c[100];
// cout << *p;
p->report();
cout << "come on, hit me!";
cin >> c;
delete p;
}
}
I'd expect that the loop would run for 9 times, and then something unpleasant (crash) would happen. However, this is the output:
Myaou... Mitzi is born
Mitzi's here, 9 souls to spend
come on, hit me!c
!!! dtor called
Mitzi is still alive! I have 8 souls left.
!!! operator delete called
's here, 8 souls to spend
come on, hit me!c
!!! dtor called
is still alive! I have 7 souls left.
*** glibc detected *** /home/davidk/workspace/string_test/Debug/string_test: double free or corruption (fasttop): 0x080cd008 ***
Seems that after the first delete the name member is destroyed, and the next delete causes a crash. Any explanations? I am compiling with gcc on Linux, can be a compiler bug?
BTW, when I used the operator<<() as in cout << *p instead of repotr(), it was also weird: it entered an infinite loop of calling the constructor from within the operator<<(). What's going on here? :)
thanks! | 0 |
9,259,295 | 02/13/2012 10:57:20 | 592,015 | 01/27/2011 10:24:46 | 997 | 64 | JTA timeout Weblogic | I have an MDB that reads from a queue quite big messages that are inserted in the database.
So it's JMS + JDBC so I use JTA.
On weblogic level I can specify the transaction timeout and set to 10,15 min. (i know is not a good practice for such long transactions but is legacy code)
I still have worries regarding the JDBC and JMS configuration...: is the JTA overriding the configuration for JDBC or JMS transactions ?
IF JDBC is configured for a shorter period to timeout ?
I did not manages to read the specs to see how this should be generally done but i assume is particular from server to server...
Thanks. | java | transactions | weblogic | jta | null | null | open | JTA timeout Weblogic
===
I have an MDB that reads from a queue quite big messages that are inserted in the database.
So it's JMS + JDBC so I use JTA.
On weblogic level I can specify the transaction timeout and set to 10,15 min. (i know is not a good practice for such long transactions but is legacy code)
I still have worries regarding the JDBC and JMS configuration...: is the JTA overriding the configuration for JDBC or JMS transactions ?
IF JDBC is configured for a shorter period to timeout ?
I did not manages to read the specs to see how this should be generally done but i assume is particular from server to server...
Thanks. | 0 |
4,697,326 | 01/15/2011 00:32:46 | 286,802 | 03/05/2010 03:13:31 | 932 | 3 | How can I push my changes to a remote branch | I am on a master branch 'master' and I have 1 commit ahead
I want to create a new remote branch called 'new_remote' and push my commit there?
$ git branch
* master
$ git remote
old_remote
$ git status
# On branch master
# Your branch is ahead of 'old_remote/master' by 1 commit.
I want to push my commit to a new branch on remote called 'new remote'
Thank you.
| git | null | null | null | null | null | open | How can I push my changes to a remote branch
===
I am on a master branch 'master' and I have 1 commit ahead
I want to create a new remote branch called 'new_remote' and push my commit there?
$ git branch
* master
$ git remote
old_remote
$ git status
# On branch master
# Your branch is ahead of 'old_remote/master' by 1 commit.
I want to push my commit to a new branch on remote called 'new remote'
Thank you.
| 0 |
6,975,234 | 08/07/2011 19:30:00 | 384,936 | 07/06/2010 20:20:05 | 102 | 1 | copy images using wordpress |
When I blog, I want to store the images in my own server. is there a way in Wordpress that I can can provide the url of the images and it automatically copies it over to my server and links it locally?
How can i post url and Wordpress can automatccally copy the images to local to my blog? | wordpress | null | null | null | null | 08/07/2011 20:17:46 | off topic | copy images using wordpress
===
When I blog, I want to store the images in my own server. is there a way in Wordpress that I can can provide the url of the images and it automatically copies it over to my server and links it locally?
How can i post url and Wordpress can automatccally copy the images to local to my blog? | 2 |
10,488,064 | 05/07/2012 19:41:04 | 1,135,506 | 01/07/2012 03:19:08 | 45 | 1 | Searching Multiple Models Simultaneously in Sunspot/Solr for Rails | I found a question on stackoverflow very similar to this but they didn't post their code..so I apologize for any redundancy.
Simple question, How do I search multiple models?...I'm using Sunspot with Rails, and I can't seem to find how I search across multiple models. Do I need to create a separate controller or can I use the Gear Controller with the index action?
Thanks for the help.
I have the following in my view:
<div class="side_bar_search">
<%= form_tag gears_path, :method => :get do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
<% end %>
</div>
and the following models
**Gear**
class Gear < ActiveRecord::Base
attr_accessible :title, :size, :price, :sub_category_id, :user_id, :image, :image_a, :remote_image_url
belongs_to :user
belongs_to :sub_category
has_one :category, :through => :sub_category
has_many :comments, :dependent => :destroy
require 'carrierwave/orm/activerecord'
mount_uploader :image, GearpicUploader
mount_uploader :image_a, GearpicUploader
searchable do
text :title, :size, :price #need to add sub-category, and User Name.
end...
**User**
class User < ActiveRecord::Base
attr_accessible :first_name, :last_name, :email, :password, :password_confirmation, :userimage, :remove_userimage
has_secure_password
has_many :gears
has_many :comments, :dependent => :destroy
has_one :store, :dependent => :destroy
before_save :create_remember_token
require 'carrierwave/orm/activerecord'
mount_uploader :userimage, UserpicUploader
searchable do
text :first_name, :last_name
end...
**Gears Controller**
class GearsController < ApplicationController
def index
@search = Gear.search do
fulltext params[:search]
paginate(page: params[:page])
end
@gears = @search.results
end... | ruby-on-rails | model | solr | sunspot | null | null | open | Searching Multiple Models Simultaneously in Sunspot/Solr for Rails
===
I found a question on stackoverflow very similar to this but they didn't post their code..so I apologize for any redundancy.
Simple question, How do I search multiple models?...I'm using Sunspot with Rails, and I can't seem to find how I search across multiple models. Do I need to create a separate controller or can I use the Gear Controller with the index action?
Thanks for the help.
I have the following in my view:
<div class="side_bar_search">
<%= form_tag gears_path, :method => :get do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
<% end %>
</div>
and the following models
**Gear**
class Gear < ActiveRecord::Base
attr_accessible :title, :size, :price, :sub_category_id, :user_id, :image, :image_a, :remote_image_url
belongs_to :user
belongs_to :sub_category
has_one :category, :through => :sub_category
has_many :comments, :dependent => :destroy
require 'carrierwave/orm/activerecord'
mount_uploader :image, GearpicUploader
mount_uploader :image_a, GearpicUploader
searchable do
text :title, :size, :price #need to add sub-category, and User Name.
end...
**User**
class User < ActiveRecord::Base
attr_accessible :first_name, :last_name, :email, :password, :password_confirmation, :userimage, :remove_userimage
has_secure_password
has_many :gears
has_many :comments, :dependent => :destroy
has_one :store, :dependent => :destroy
before_save :create_remember_token
require 'carrierwave/orm/activerecord'
mount_uploader :userimage, UserpicUploader
searchable do
text :first_name, :last_name
end...
**Gears Controller**
class GearsController < ApplicationController
def index
@search = Gear.search do
fulltext params[:search]
paginate(page: params[:page])
end
@gears = @search.results
end... | 0 |
7,629,600 | 10/02/2011 22:16:28 | 311,130 | 04/07/2010 15:18:03 | 589 | 14 | fetch a string using regex c# | I probably don't use the right serach term, because I keep finding
'matching\valudating' string with regex (returns boolean)
while I'm looking for fetching.
How can I fetch some parts of a string using a regex pattern?
Thanks guys, | regex | c#-4.0 | string-matching | null | null | 10/03/2011 08:31:56 | not a real question | fetch a string using regex c#
===
I probably don't use the right serach term, because I keep finding
'matching\valudating' string with regex (returns boolean)
while I'm looking for fetching.
How can I fetch some parts of a string using a regex pattern?
Thanks guys, | 1 |
10,045,576 | 04/06/2012 15:26:10 | 1,317,738 | 04/06/2012 15:18:48 | 1 | 0 | MYSQL Trigger to update table that is based on two other tables | Okay here is the deal, I've created a table name 'combined_data' using data from two tables 'store_data' and 'hd_data'. The two tables share a common column which I used to link the data when creating the new table and that is 'store_num'. What happens is when a user submits information to 'store_data' I want info from that submit such as store_num, store_name, etc to move into the 'combined_data' table as well as pull information from the 'hd_data' that pertains to the particular store_num entered such as region, division etc. Trying to come up with the structure to do this, I can fill in table names and column names just fine. Just curious if this is doable or if another solution should be sought out. | mysql | database | table | update | triggers | null | open | MYSQL Trigger to update table that is based on two other tables
===
Okay here is the deal, I've created a table name 'combined_data' using data from two tables 'store_data' and 'hd_data'. The two tables share a common column which I used to link the data when creating the new table and that is 'store_num'. What happens is when a user submits information to 'store_data' I want info from that submit such as store_num, store_name, etc to move into the 'combined_data' table as well as pull information from the 'hd_data' that pertains to the particular store_num entered such as region, division etc. Trying to come up with the structure to do this, I can fill in table names and column names just fine. Just curious if this is doable or if another solution should be sought out. | 0 |
11,444,869 | 07/12/2012 04:07:36 | 811,772 | 06/23/2011 07:42:06 | 7 | 0 | License for Team Anywhere and TFS | Our development organization consists of developers for .net and java.
We are migrating to TFS from clearcase and would like to know the cost.
We are already having the TFS server up and running.
The .net developers are havinf Vs2010 installed and TFS comes integrated with it to work with sourcecontrol .they have MSDN license and hence they are licensed users.
For Java developers they dont have MSDN license and they use eclipse .heard about teamanywhere which gives plugin to work with TFS.
Now, let know is this product need to be bought and how is the licensing for the same | tfs2010 | null | null | null | null | 07/12/2012 05:26:53 | off topic | License for Team Anywhere and TFS
===
Our development organization consists of developers for .net and java.
We are migrating to TFS from clearcase and would like to know the cost.
We are already having the TFS server up and running.
The .net developers are havinf Vs2010 installed and TFS comes integrated with it to work with sourcecontrol .they have MSDN license and hence they are licensed users.
For Java developers they dont have MSDN license and they use eclipse .heard about teamanywhere which gives plugin to work with TFS.
Now, let know is this product need to be bought and how is the licensing for the same | 2 |
11,467,571 | 07/13/2012 09:18:27 | 1,520,266 | 07/12/2012 09:10:50 | 6 | 0 | How to integrate my website with zoho invoice api key using php souce code | hi how to integrate my website with zoho invoice api key using php souce code.I need to know how api key is send to zoho invoice and how the ticket is return using php code.i have zoho invoice email id and password can any one help me... | php | website | integration | invoice | zoho | 07/13/2012 09:25:12 | not a real question | How to integrate my website with zoho invoice api key using php souce code
===
hi how to integrate my website with zoho invoice api key using php souce code.I need to know how api key is send to zoho invoice and how the ticket is return using php code.i have zoho invoice email id and password can any one help me... | 1 |
11,436,485 | 07/11/2012 15:48:32 | 137,404 | 07/13/2009 12:30:29 | 705 | 17 | How to design a Composite object with varying logic executed between sub items | I'm designing a framework and I have composite objects that have sub objects that are executed asynchronously or synchronously. For the synchronous executing ones, there's usually a certain type of logic that has to run in the composite object after a certain sub item finished.
The issue is there's a number of sub items and for each sub item, there could be a different processing done after each sub item, and because i was aiming for simplicity, i had the synchronous items on a queue and composite item would just pop them one by one and run them.. Now what would be the cleanest way to track the sub items so that I can say something like "after sub item #2 is finished, take the data it returned and do xyz()"? | java | design-patterns | design | composite-pattern | null | null | open | How to design a Composite object with varying logic executed between sub items
===
I'm designing a framework and I have composite objects that have sub objects that are executed asynchronously or synchronously. For the synchronous executing ones, there's usually a certain type of logic that has to run in the composite object after a certain sub item finished.
The issue is there's a number of sub items and for each sub item, there could be a different processing done after each sub item, and because i was aiming for simplicity, i had the synchronous items on a queue and composite item would just pop them one by one and run them.. Now what would be the cleanest way to track the sub items so that I can say something like "after sub item #2 is finished, take the data it returned and do xyz()"? | 0 |
2,176,602 | 02/01/2010 12:35:43 | 193,133 | 10/20/2009 13:52:13 | 211 | 1 | automation testing of pdf forms | is there any tool that can help in automation testing of PDF forms ?
any help appreciated | pdf | automation | testing | null | null | null | open | automation testing of pdf forms
===
is there any tool that can help in automation testing of PDF forms ?
any help appreciated | 0 |
4,410,293 | 12/10/2010 15:19:56 | 404,604 | 07/28/2010 14:06:44 | 11 | 1 | How to setup and use local Maven repository | Good day, everyone.
I'm trying to setup an internal repository that I can share with some people within a local network with no access to the Internet. So far, I have setup Archiva in my local machine and point the repository to my ~/.m2/repository. I asked those people to setup their Maven settings.xml and add the following profile:
<profile>
<id>archiva</id>
<repositories>
<repository>
<id>archiva</id>
<url>http://mymachine:8087/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>archiva</id>
<url>http://mymachine:8087/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
I've also asked them to set this profile as always active. However, when they try to generate a new Java project using `mvn archetype:generate`, they always get an error. I actually forgot what the error was but it had something to do with the goal. They can download the jars from Archiva but the generation still fails. I also gave them a copy of the archetype catalog but it's still failing. What am I missing? | repository | maven | null | null | null | null | open | How to setup and use local Maven repository
===
Good day, everyone.
I'm trying to setup an internal repository that I can share with some people within a local network with no access to the Internet. So far, I have setup Archiva in my local machine and point the repository to my ~/.m2/repository. I asked those people to setup their Maven settings.xml and add the following profile:
<profile>
<id>archiva</id>
<repositories>
<repository>
<id>archiva</id>
<url>http://mymachine:8087/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>archiva</id>
<url>http://mymachine:8087/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
I've also asked them to set this profile as always active. However, when they try to generate a new Java project using `mvn archetype:generate`, they always get an error. I actually forgot what the error was but it had something to do with the goal. They can download the jars from Archiva but the generation still fails. I also gave them a copy of the archetype catalog but it's still failing. What am I missing? | 0 |
9,032,554 | 01/27/2012 11:21:54 | 1,058,183 | 11/21/2011 16:22:20 | 17 | 0 | .htaccess generic mod_rewrite rules | I have a site where I'm trying to change the urls using mod_rewrite from: /directory/filename.php to directory/filename/
/directory/filename.php?id=7 to directory/filename/7/
/directory/filename.php?id=7&file_id=1 to directory/filename/7/1/
I can't work out the regular expressions to use for these pages though. Here is the entire .htaccess file:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^(.*)/?$ /directory/$1 [L] #Rewrite a page without $_GET variables
RewriteRule ^([^/]+)/([0-9]+)/?$ /directory/$1?id=$2 [L] #Rewrite a page with 1 $_GET variables
RewriteRule ^([^/]+)/([0-9]+)/([0-9]+)/?$ /directory/$1?id=$2&file_id=$3 [L] #Rewrite a page with 2 $_GET variables | regex | .htaccess | mod-rewrite | url-rewriting | apache2 | 01/29/2012 06:04:11 | off topic | .htaccess generic mod_rewrite rules
===
I have a site where I'm trying to change the urls using mod_rewrite from: /directory/filename.php to directory/filename/
/directory/filename.php?id=7 to directory/filename/7/
/directory/filename.php?id=7&file_id=1 to directory/filename/7/1/
I can't work out the regular expressions to use for these pages though. Here is the entire .htaccess file:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^(.*)/?$ /directory/$1 [L] #Rewrite a page without $_GET variables
RewriteRule ^([^/]+)/([0-9]+)/?$ /directory/$1?id=$2 [L] #Rewrite a page with 1 $_GET variables
RewriteRule ^([^/]+)/([0-9]+)/([0-9]+)/?$ /directory/$1?id=$2&file_id=$3 [L] #Rewrite a page with 2 $_GET variables | 2 |
10,107,097 | 04/11/2012 13:39:13 | 1,290,169 | 03/24/2012 16:06:01 | 13 | 2 | How to add strings to array from user input - Java | Is there a way to use ArrayList() method to add strings to an array from user input? I have a program that prompts the user to enter a certain input from a JTextBox and I would like to store this input into an array.
I am student therefore hints and explanations would be preferred over simple answers.
Thanks in advance! | java | self-improvement | null | null | null | 04/12/2012 13:57:59 | not a real question | How to add strings to array from user input - Java
===
Is there a way to use ArrayList() method to add strings to an array from user input? I have a program that prompts the user to enter a certain input from a JTextBox and I would like to store this input into an array.
I am student therefore hints and explanations would be preferred over simple answers.
Thanks in advance! | 1 |
8,605,340 | 12/22/2011 14:33:56 | 187,730 | 10/10/2009 17:45:27 | 2,077 | 154 | How to use PC Internet Connection from Android Device via USB? | I've an Samsung Galaxy S2 and I want to use the PC Internet (Windows XP) to do some testing.
How to use PC Internet Connection from Android Device via USB? | android | windows | usb | internet | null | 12/22/2011 15:47:29 | off topic | How to use PC Internet Connection from Android Device via USB?
===
I've an Samsung Galaxy S2 and I want to use the PC Internet (Windows XP) to do some testing.
How to use PC Internet Connection from Android Device via USB? | 2 |
3,416,311 | 08/05/2010 15:26:00 | 287,553 | 03/06/2010 01:48:22 | 36 | 0 | Manipulating maps. | Given a set of floorplans (in Autocad, svg, or whatever format need be...), I would like to programatically generate directions from point A to point B. Basically I would like to say: "How do I get from room 101 to room 143?" (or for triple bonus points, from room 101 to room 323). Anyone have any ideas how to go about this? I am pretty language agnostic at this point, although I know C(++), Erlang, PHP and Python the best. I do realize this is a tall order.
Thanks! | php | mapping | svg | gis | autocad | null | open | Manipulating maps.
===
Given a set of floorplans (in Autocad, svg, or whatever format need be...), I would like to programatically generate directions from point A to point B. Basically I would like to say: "How do I get from room 101 to room 143?" (or for triple bonus points, from room 101 to room 323). Anyone have any ideas how to go about this? I am pretty language agnostic at this point, although I know C(++), Erlang, PHP and Python the best. I do realize this is a tall order.
Thanks! | 0 |
10,140,182 | 04/13/2012 11:45:04 | 663,660 | 03/17/2011 04:15:58 | 1,170 | 15 | set environment variable in shell scrip and access it in java program | I want to set environment using shell scrip in ubuntu 10.04 and want to access in java program. I have wrote shell script like this:
#! /bin/sh
export JAVA=/home/ubuntu
echo "Variable $JAVA"
and my java program is :
import java.util.Map;
public class SystemEnv
{
public static void main(String[] args)
{
Map<String, String> variables = System.getenv();
for (Map.Entry<String, String> entry : variables.entrySet())
{
String name = entry.getKey();
String value = entry.getValue();
System.out.println(name + "=" + value);
}
System.out.println(System.getenv(("JAVA")));
}
}
When i execute this command without shell script it works well but in shell script its not.
| java | linux | shell | ubuntu-10.04 | null | null | open | set environment variable in shell scrip and access it in java program
===
I want to set environment using shell scrip in ubuntu 10.04 and want to access in java program. I have wrote shell script like this:
#! /bin/sh
export JAVA=/home/ubuntu
echo "Variable $JAVA"
and my java program is :
import java.util.Map;
public class SystemEnv
{
public static void main(String[] args)
{
Map<String, String> variables = System.getenv();
for (Map.Entry<String, String> entry : variables.entrySet())
{
String name = entry.getKey();
String value = entry.getValue();
System.out.println(name + "=" + value);
}
System.out.println(System.getenv(("JAVA")));
}
}
When i execute this command without shell script it works well but in shell script its not.
| 0 |
4,968,872 | 02/11/2011 12:16:52 | 512,150 | 11/18/2010 13:13:51 | 76 | 3 | Server Busy Dialog | When I run my application I get server busy dialog. Does anyone know how to disable server busy dialog in c# application? | c# | visual-studio | null | null | null | 02/11/2011 15:50:20 | not a real question | Server Busy Dialog
===
When I run my application I get server busy dialog. Does anyone know how to disable server busy dialog in c# application? | 1 |
7,551,859 | 09/26/2011 07:32:30 | 849,900 | 07/18/2011 11:13:06 | 3 | 0 | target to a div without reloading the page in javascript | i wrote a web page that included some stuff. There, i need to create a input text box after clicking on a button, but it will be at the bottom due to existing stuff and i can't see the input box as it is in the out of visible area.there i'v to scroll down to find that.I tried with focus method , it focuses to the input box, it is unable to take the input box to visible area.in the top , i'v some javascript stuff .so i need to do this without refreshing.Here is the code snippet i'v tried.
<script>
function create(){
var inputBox=document.createElement('input');
inputBox.setAttribute('id','myInput');
var body=document.getElementsByTagName('body')[0];
body.appendChild(inputBox);
document.getElementById('myInput').focus();
}
</script>
<body>
<button onclick="create()">Click me</button>
</body>
Can anyone help me !
| javascript | null | null | null | null | null | open | target to a div without reloading the page in javascript
===
i wrote a web page that included some stuff. There, i need to create a input text box after clicking on a button, but it will be at the bottom due to existing stuff and i can't see the input box as it is in the out of visible area.there i'v to scroll down to find that.I tried with focus method , it focuses to the input box, it is unable to take the input box to visible area.in the top , i'v some javascript stuff .so i need to do this without refreshing.Here is the code snippet i'v tried.
<script>
function create(){
var inputBox=document.createElement('input');
inputBox.setAttribute('id','myInput');
var body=document.getElementsByTagName('body')[0];
body.appendChild(inputBox);
document.getElementById('myInput').focus();
}
</script>
<body>
<button onclick="create()">Click me</button>
</body>
Can anyone help me !
| 0 |
4,981,871 | 02/13/2011 01:35:35 | 131,875 | 07/01/2009 17:59:55 | 42 | 2 | Need help refactoring code that checks for union between a list of users and the current users FB friends | Got a page in my app that lists events the current user has added to their personal calendar.
For each event I'm checking to see if any of the current user's FB friends are among the other users on my site that have also added the event to their personal calendar.
It works fine...if you're willing to wait.
Because there's not quick way to check for the union of two arrays, that I'm aware of, I want to move this checking to a background job (Delayed Job on Heroku) and use AJAX to update the page as the job(s) are completed.
Not sure how to proceed...any tips, links, snippets or smart remarks are appreciated.
Please disregard the embedded styles and other stuff that can be improved...JUST getting started and for now I'm really just trying to solve this key issue because the performance hit of what I'm doing makes the app basically useless in it's present state.
**user.rb**
has_many :events_users
has_many :events, :through => :events_users, :order => 'start'
**event.rb**
has_many :events_users
has_many :users, :through => :events_users
**events_users.rb**
belongs_to :event
belongs_to :user
validates_uniqueness_of :event_id, :scope => :user_id
**show.erb.html**
<% @user.events.each do |event| %>
<h4 style="margin:0;"><%= link_to event.name, event %><% if @user == current_user %> - <%= link_to 'X', remove_from_bucket_url(:id => event.id), :style => 'color:#cc0000;' %> <% end %><br/>
<%= event.start.to_s(:month) %> <%= number_to_ordinal(event.start.to_s(:day)) %> in <%= event.city %>, <%= event.state %></h4>
<% if current_user %>
<a href="/users/<%= current_user %>"><img src="https://graph.facebook.com/<%= current_user.uid %>/picture" style="margin:10px 10px 20px 0px;" /></a>
<% event.users.each do |user| %>
<% @fb_user.friends.each do |friend| %>
<% if friend.identifier == user.uid %>
<a href="/users/<%= user.id %>"><img src="https://graph.facebook.com/<%= user.uid %>/picture" style="margin:10px 10px 20px 0px;" /></a>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %> | ruby-on-rails | null | null | null | null | null | open | Need help refactoring code that checks for union between a list of users and the current users FB friends
===
Got a page in my app that lists events the current user has added to their personal calendar.
For each event I'm checking to see if any of the current user's FB friends are among the other users on my site that have also added the event to their personal calendar.
It works fine...if you're willing to wait.
Because there's not quick way to check for the union of two arrays, that I'm aware of, I want to move this checking to a background job (Delayed Job on Heroku) and use AJAX to update the page as the job(s) are completed.
Not sure how to proceed...any tips, links, snippets or smart remarks are appreciated.
Please disregard the embedded styles and other stuff that can be improved...JUST getting started and for now I'm really just trying to solve this key issue because the performance hit of what I'm doing makes the app basically useless in it's present state.
**user.rb**
has_many :events_users
has_many :events, :through => :events_users, :order => 'start'
**event.rb**
has_many :events_users
has_many :users, :through => :events_users
**events_users.rb**
belongs_to :event
belongs_to :user
validates_uniqueness_of :event_id, :scope => :user_id
**show.erb.html**
<% @user.events.each do |event| %>
<h4 style="margin:0;"><%= link_to event.name, event %><% if @user == current_user %> - <%= link_to 'X', remove_from_bucket_url(:id => event.id), :style => 'color:#cc0000;' %> <% end %><br/>
<%= event.start.to_s(:month) %> <%= number_to_ordinal(event.start.to_s(:day)) %> in <%= event.city %>, <%= event.state %></h4>
<% if current_user %>
<a href="/users/<%= current_user %>"><img src="https://graph.facebook.com/<%= current_user.uid %>/picture" style="margin:10px 10px 20px 0px;" /></a>
<% event.users.each do |user| %>
<% @fb_user.friends.each do |friend| %>
<% if friend.identifier == user.uid %>
<a href="/users/<%= user.id %>"><img src="https://graph.facebook.com/<%= user.uid %>/picture" style="margin:10px 10px 20px 0px;" /></a>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %> | 0 |
4,073,874 | 11/01/2010 23:12:40 | 494,091 | 11/01/2010 21:29:13 | 1 | 0 | How can we implement urllib2's urlopen and read functionality using WinInet functions? | I've trying to implemnet the python lib's urllib2's urlopen function using WinInet function. I think python automatically takes care of the cookies and sessions.
Here's the code snippet of python:
urllib2.urlopen('http://www.example.com/get_req_info?&id=123&&url=exampleurl')
I tried to debug it:
>>> urllib2._opener.handlers[1].set_http_debuglevel(100)
>>> urllib2.urlopen('http://www.example.com/get_req_info?&id=123&&url=exampleurl')
send: 'GET /get_req_info?&id=123&&url=exampleurl HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: www.example.com\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Mon, 01 Nov 2010 07:34:12 GMT
header: Server: Apache
header: X-Content-Type-Options: nosniff
header: Set-Cookie: use_hitbox=72c46ff6cbcdb7c5585c36411b6b334edAEAAAAw; path=/; domain=.example.com
header: Set-Cookie: VISITOR_INFO=mweg8xdT-eM; path=/; domain=.eample.com; expires=Wed, 29-Jun-2011 07:34:12 GMT
header: Set-Cookie: GEO=84c341d263a69c0c02cc2c8f8b77dfcccwsAAAAzVVMYEEtITM5tdA==; path=/; domain=.example.com
header: Set-Cookie: s_gl=18f5cd48020458e865a469a7155238dacwIAAABVUw==; path=/; domain=.example.com
header: Expires: Tue, 27 Apr 1971 19:44:06 EST
header: Cache-Control: no-cache
header: Content-Length: 6266
header: Content-Type: application/x-www-form-urlencoded
header: Connection: close
I'm trying to implement using the same using WinInet functions. I have tried the following sequence:
InternetOpen
InternetConnect
HttpOpenRequest
InternetGetCookie
// I'm getting only one cookie here
// VISITOR_INFO=mweg8xdT-eM;
// I'm sure that either I'm missing something here or
// I might be doing something wrong here
HttpSendRequest
InternetReadFile
Now, the problem is... the data I'm getting from both the sources are different and I doubt that it's due to Cookie/Session problem.
Also tried by sending the common headers as follows but din't work:
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'Accept-Language': 'en-us,en;q=0.5',
I'm sure there must be a way so that I can get exactly the same response as I'm getting in Python.
Any help would be highly appreciated?
| python | http-headers | urllib2 | wininet | urlopen | null | open | How can we implement urllib2's urlopen and read functionality using WinInet functions?
===
I've trying to implemnet the python lib's urllib2's urlopen function using WinInet function. I think python automatically takes care of the cookies and sessions.
Here's the code snippet of python:
urllib2.urlopen('http://www.example.com/get_req_info?&id=123&&url=exampleurl')
I tried to debug it:
>>> urllib2._opener.handlers[1].set_http_debuglevel(100)
>>> urllib2.urlopen('http://www.example.com/get_req_info?&id=123&&url=exampleurl')
send: 'GET /get_req_info?&id=123&&url=exampleurl HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: www.example.com\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Mon, 01 Nov 2010 07:34:12 GMT
header: Server: Apache
header: X-Content-Type-Options: nosniff
header: Set-Cookie: use_hitbox=72c46ff6cbcdb7c5585c36411b6b334edAEAAAAw; path=/; domain=.example.com
header: Set-Cookie: VISITOR_INFO=mweg8xdT-eM; path=/; domain=.eample.com; expires=Wed, 29-Jun-2011 07:34:12 GMT
header: Set-Cookie: GEO=84c341d263a69c0c02cc2c8f8b77dfcccwsAAAAzVVMYEEtITM5tdA==; path=/; domain=.example.com
header: Set-Cookie: s_gl=18f5cd48020458e865a469a7155238dacwIAAABVUw==; path=/; domain=.example.com
header: Expires: Tue, 27 Apr 1971 19:44:06 EST
header: Cache-Control: no-cache
header: Content-Length: 6266
header: Content-Type: application/x-www-form-urlencoded
header: Connection: close
I'm trying to implement using the same using WinInet functions. I have tried the following sequence:
InternetOpen
InternetConnect
HttpOpenRequest
InternetGetCookie
// I'm getting only one cookie here
// VISITOR_INFO=mweg8xdT-eM;
// I'm sure that either I'm missing something here or
// I might be doing something wrong here
HttpSendRequest
InternetReadFile
Now, the problem is... the data I'm getting from both the sources are different and I doubt that it's due to Cookie/Session problem.
Also tried by sending the common headers as follows but din't work:
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'Accept-Language': 'en-us,en;q=0.5',
I'm sure there must be a way so that I can get exactly the same response as I'm getting in Python.
Any help would be highly appreciated?
| 0 |
9,927,101 | 03/29/2012 14:09:26 | 1,208,824 | 02/14/2012 10:23:11 | 1 | 0 | Simle maths with javascript not changing fields in form | I can't get this part of my form to work. It is a two stage form. The second part is the same and it is working fine, it is just not as long
function calcTotal1()
{
var qty1, qty2, qty3, qty4, qty5, qty6, qty7, qty8, qty9, qty10, qty11, qty12, qty13;
var ocost1, ocost2, ocost3, ocost4, ocost5, ocost6, ocost7, ocost8, ocost9, ocost10, ocost11, ocost12, ocost13;
var otot1, otot2, otot3, otot4, otot5, otot6, otot7, otot8, otot9, otot10, otot11, otot12, otot13;
var oSubTot6, oSubTot9;
var oGrandTot;
qty1 = document.orderform.sWorkbook8qty.value * 1.00;
qty2 = document.orderform.sAnswerbook8qty.value * 1.00;
qty3 = document.orderform.sWorkbook9qty.value * 1.00;
qty4 = document.orderform.sAnswerbook9qty.value * 1.00;
qty5 = document.orderform.sWorkbook10qty.value * 1.00;
qty6 = document.orderform.sAnswerbook10qty.value * 1.00;
qty7 = document.orderform.sStudentAnswerbook10qty.value * 1.00;
qty8 = document.orderform.sWorkbook11qty.value * 1.00;
qty9 = document.orderform.sAnswerbook11qty.value * 1.00;
qty10 = document.orderform.sStudentAnswerbook11qty.value * 1.00;
qty11 = document.orderform.sWorkbook12qty.value * 1.00;
qty12 = document.orderform.sAnswerbook12qty.value * 1.00;
qty13 = document.orderform.sStudentAnswerbook12qty.value * 1.00;
ocost1 = document.orderform.sWorkbook8cost.value * 1.00;
ocost2 = document.orderform.sAnswerbook8cost.value * 1.00;
ocost3 = document.orderform.sWorkbook9cost.value * 1.00;
ocost4 = document.orderform.sAnswerbook9cost.value * 1.00;
ocost5 = document.orderform.sWorkbook10cost.value * 1.00;
ocost6 = document.orderform.sAnswerbook10cost.value * 1.00;
ocost7 = document.orderform.sStudentAnswerbook10cost.value * 1.00;
ocost8 = document.orderform.sWorkbook11cost.value * 1.00;
ocost9 = document.orderform.sAnswerbook11cost.value * 1.00;
ocost10 = document.orderform.sStudentAnswerbook11cost.value * 1.00;
ocost11 = document.orderform.sWorkbook12hgcost.value * 1.00;
ocost12 = document.orderform.sAnswerbook12hgcost.value * 1.00;
ocost13 = document.orderform.sStudentAnswerbook12hgcost.value * 1.00;
otot1 = (eval(ocost1 * qty1)) * 1.00;
otot2 = (eval(ocost2 * qty2)) * 1.00;
otot3 = (eval(ocost3 * qty3)) * 1.00;
otot4 = (eval(ocost4 * qty4)) * 1.00;
otot5 = (eval(ocost5 * qty5)) * 1.00;
otot6 = (eval(ocost6 * qty6)) * 1.00;
otot7 = (eval(ocost7 * qty7)) * 1.00;
otot8 = (eval(ocost8 * qty8)) * 1.00;
otot9 = (eval(ocost9 * qty9)) * 1.00;
otot10 = (eval(ocost10 * qty10)) * 1.00;
otot11 = (eval(ocost11 * qty11)) * 1.00;
otot12 = (eval(ocost12 * qty12)) * 1.00;
otot13 = (eval(ocost13 * qty13)) * 1.00;
document.orderform.sWorkbook8ttl.value = otot1;
document.orderform.sAnswerbook8ttl.value = otot2;
document.orderform.sWorkbook9ttl.value = otot3;
document.orderform.sAnswerbook9ttl.value = otot4;
document.orderform.sWorkbook10ttl.value = otot5;
document.orderform.sAnswerbook10ttl.value = otot6;
document.orderform.sStudentAnswerbook10ttl.value = otot7;
document.orderform.sWorkbook11ttl.value = otot8;
document.orderform.sAnswerbook11ttl.value = otot9;
document.orderform.sStudentAnswerbook11ttl.value = otot10;
document.orderform.sWorkbook12hgttl.value = otot11;
document.orderform.sAnswerbook12hgttl.value = otot12;
document.orderform.sStudentAnswerbook12hgttl.value = otot13;
oSubTot6 = (oTot1 + oTot2) + (oTot3 + oTot4) + (oTot5 + oTot6) + (oTot7 + oTot8) + (oTot9 + oTot10) + (oTot11 + oTot12 + oTot13);
document.orderform.sSubtotal1.value = oSubTot6
document.orderform.sGrandTotal.value = oSubTot6;
} | javascript | javascript-functions | null | null | null | 03/30/2012 18:57:58 | not a real question | Simle maths with javascript not changing fields in form
===
I can't get this part of my form to work. It is a two stage form. The second part is the same and it is working fine, it is just not as long
function calcTotal1()
{
var qty1, qty2, qty3, qty4, qty5, qty6, qty7, qty8, qty9, qty10, qty11, qty12, qty13;
var ocost1, ocost2, ocost3, ocost4, ocost5, ocost6, ocost7, ocost8, ocost9, ocost10, ocost11, ocost12, ocost13;
var otot1, otot2, otot3, otot4, otot5, otot6, otot7, otot8, otot9, otot10, otot11, otot12, otot13;
var oSubTot6, oSubTot9;
var oGrandTot;
qty1 = document.orderform.sWorkbook8qty.value * 1.00;
qty2 = document.orderform.sAnswerbook8qty.value * 1.00;
qty3 = document.orderform.sWorkbook9qty.value * 1.00;
qty4 = document.orderform.sAnswerbook9qty.value * 1.00;
qty5 = document.orderform.sWorkbook10qty.value * 1.00;
qty6 = document.orderform.sAnswerbook10qty.value * 1.00;
qty7 = document.orderform.sStudentAnswerbook10qty.value * 1.00;
qty8 = document.orderform.sWorkbook11qty.value * 1.00;
qty9 = document.orderform.sAnswerbook11qty.value * 1.00;
qty10 = document.orderform.sStudentAnswerbook11qty.value * 1.00;
qty11 = document.orderform.sWorkbook12qty.value * 1.00;
qty12 = document.orderform.sAnswerbook12qty.value * 1.00;
qty13 = document.orderform.sStudentAnswerbook12qty.value * 1.00;
ocost1 = document.orderform.sWorkbook8cost.value * 1.00;
ocost2 = document.orderform.sAnswerbook8cost.value * 1.00;
ocost3 = document.orderform.sWorkbook9cost.value * 1.00;
ocost4 = document.orderform.sAnswerbook9cost.value * 1.00;
ocost5 = document.orderform.sWorkbook10cost.value * 1.00;
ocost6 = document.orderform.sAnswerbook10cost.value * 1.00;
ocost7 = document.orderform.sStudentAnswerbook10cost.value * 1.00;
ocost8 = document.orderform.sWorkbook11cost.value * 1.00;
ocost9 = document.orderform.sAnswerbook11cost.value * 1.00;
ocost10 = document.orderform.sStudentAnswerbook11cost.value * 1.00;
ocost11 = document.orderform.sWorkbook12hgcost.value * 1.00;
ocost12 = document.orderform.sAnswerbook12hgcost.value * 1.00;
ocost13 = document.orderform.sStudentAnswerbook12hgcost.value * 1.00;
otot1 = (eval(ocost1 * qty1)) * 1.00;
otot2 = (eval(ocost2 * qty2)) * 1.00;
otot3 = (eval(ocost3 * qty3)) * 1.00;
otot4 = (eval(ocost4 * qty4)) * 1.00;
otot5 = (eval(ocost5 * qty5)) * 1.00;
otot6 = (eval(ocost6 * qty6)) * 1.00;
otot7 = (eval(ocost7 * qty7)) * 1.00;
otot8 = (eval(ocost8 * qty8)) * 1.00;
otot9 = (eval(ocost9 * qty9)) * 1.00;
otot10 = (eval(ocost10 * qty10)) * 1.00;
otot11 = (eval(ocost11 * qty11)) * 1.00;
otot12 = (eval(ocost12 * qty12)) * 1.00;
otot13 = (eval(ocost13 * qty13)) * 1.00;
document.orderform.sWorkbook8ttl.value = otot1;
document.orderform.sAnswerbook8ttl.value = otot2;
document.orderform.sWorkbook9ttl.value = otot3;
document.orderform.sAnswerbook9ttl.value = otot4;
document.orderform.sWorkbook10ttl.value = otot5;
document.orderform.sAnswerbook10ttl.value = otot6;
document.orderform.sStudentAnswerbook10ttl.value = otot7;
document.orderform.sWorkbook11ttl.value = otot8;
document.orderform.sAnswerbook11ttl.value = otot9;
document.orderform.sStudentAnswerbook11ttl.value = otot10;
document.orderform.sWorkbook12hgttl.value = otot11;
document.orderform.sAnswerbook12hgttl.value = otot12;
document.orderform.sStudentAnswerbook12hgttl.value = otot13;
oSubTot6 = (oTot1 + oTot2) + (oTot3 + oTot4) + (oTot5 + oTot6) + (oTot7 + oTot8) + (oTot9 + oTot10) + (oTot11 + oTot12 + oTot13);
document.orderform.sSubtotal1.value = oSubTot6
document.orderform.sGrandTotal.value = oSubTot6;
} | 1 |
7,684,311 | 10/07/2011 07:36:27 | 246,622 | 01/08/2010 18:12:35 | 491 | 17 | Set width and height of ASP.NET (4.0) listbox to fit the items | I have a listbox on a page that is bound to a linqdatasource.
In the ondatabound event I am trying to make the size of the listbox on screen fit the items, to avoid having to scroll and to avoid excessive white space.
How can I do this?
| c# | asp.net | listbox | size | null | null | open | Set width and height of ASP.NET (4.0) listbox to fit the items
===
I have a listbox on a page that is bound to a linqdatasource.
In the ondatabound event I am trying to make the size of the listbox on screen fit the items, to avoid having to scroll and to avoid excessive white space.
How can I do this?
| 0 |
3,393,900 | 08/03/2010 05:54:57 | 396,574 | 07/20/2010 08:31:05 | 1 | 0 | Is Plain vanilla Javascript better than using frameworks like jQuery/mootools ? | I am wondering if it is a good idea to rely on frameworks like jQuery/mootools or should we just use plain javascript ?
Apart from avoiding the re-invention of wheel, do they add any specific value ?
Since the frameworks are open to public, can there be possibility of exploitation of any security holes that might appear(of course, unintentionally :) ) in the frameworks ?
Are there any other points that are to be considered when choosing a framework or otherwise ?
Thanks | javascript | jquery | mootools | null | null | 11/19/2011 13:48:58 | not constructive | Is Plain vanilla Javascript better than using frameworks like jQuery/mootools ?
===
I am wondering if it is a good idea to rely on frameworks like jQuery/mootools or should we just use plain javascript ?
Apart from avoiding the re-invention of wheel, do they add any specific value ?
Since the frameworks are open to public, can there be possibility of exploitation of any security holes that might appear(of course, unintentionally :) ) in the frameworks ?
Are there any other points that are to be considered when choosing a framework or otherwise ?
Thanks | 4 |
8,467,914 | 12/11/2011 22:09:53 | 929,596 | 09/05/2011 21:30:01 | 409 | 0 | Is a function return-value constant by default (an rvalue)? | I'm learning about rvalue references, and the tutorial told me this:
X foo();
X x;
x = foo();
[.....]
Rather obviously, it would be ok, and much more efficient, to swap resource pointers (handles) between x and the temporary, and then let the temporary's destructor destruct x's original resource.
In other words, **in the special case where the right hand side of the assignment is an rvalue**, we want the copy assignment operator to act like this
[.....]
So, does this mean that return values from functions are always constant by default, and thereby an rvalue? If yes: Are they always constant, or are there exceptions too? | c++ | constants | return-value | rvalue | null | null | open | Is a function return-value constant by default (an rvalue)?
===
I'm learning about rvalue references, and the tutorial told me this:
X foo();
X x;
x = foo();
[.....]
Rather obviously, it would be ok, and much more efficient, to swap resource pointers (handles) between x and the temporary, and then let the temporary's destructor destruct x's original resource.
In other words, **in the special case where the right hand side of the assignment is an rvalue**, we want the copy assignment operator to act like this
[.....]
So, does this mean that return values from functions are always constant by default, and thereby an rvalue? If yes: Are they always constant, or are there exceptions too? | 0 |
8,959,199 | 01/22/2012 05:27:06 | 888,958 | 08/10/2011 23:52:56 | 166 | 8 | A Good, Complete Mono compatible game engine for C# | I am a linux enthusiast and developer, I've gotten back into c# development after a hiatus from my switch to linux. Are there any good game engines/libraries that are actively developed, free, and linux compatible? I have seen Axiom, And am considering it (although the example sigsegv's every time), brume, monogame, opentk, and netgore. MonoGame looks to be the best, but I just wanted to know if anyone else had a good library I could use. | c# | linux | mono | null | null | 01/22/2012 15:46:52 | not constructive | A Good, Complete Mono compatible game engine for C#
===
I am a linux enthusiast and developer, I've gotten back into c# development after a hiatus from my switch to linux. Are there any good game engines/libraries that are actively developed, free, and linux compatible? I have seen Axiom, And am considering it (although the example sigsegv's every time), brume, monogame, opentk, and netgore. MonoGame looks to be the best, but I just wanted to know if anyone else had a good library I could use. | 4 |
7,447,904 | 09/16/2011 16:43:06 | 674,991 | 03/24/2011 13:43:44 | 548 | 37 | Does this sorting algorithm have a name? | I just thought of an interesting way to do a sort. I'm sure someone has thought of it before, but I've never seen it. It goes like this (written in Python for listiness and readability):
items = len(unsorted)
sortedBins = []
# Pull out bins of sorted numbers, until the unsorted list is depleted:
while( len(unsorted) > 0 ):
highest = float("-inf")
newBin = []
for i in range( 0, len(unsorted) ):
# Find items in unsorted list that are in order, pop them out:
if( unsorted[i] > highest ):
highest = unsorted[i]
newBin.append( unsorted.pop(i) )
sortedBins.append(newBin)
# Merge all of the sorted bins together:
sorted = []
while( len(sorted) < items ):
lowBin = 0
for j in range( 0, len(sortedBins) ):
if( sortedBins[j][0] < sortedBins[lowBin][0] ):
lowBin = j
sorted.append( sortedBins[lowBin].pop(0) )
if( len(sortedBins[lowBin]) == 0 ):
del sortedBins[lowBin]
It seems like the worst case (a completely reversed list) would take **n(n+1)** time if I'm not crazy (that is, n(n+1)/2 for each loop). The best case (an already sorted list) would take **2*n** time. | python | algorithm | sorting | null | null | 09/17/2011 09:07:49 | not a real question | Does this sorting algorithm have a name?
===
I just thought of an interesting way to do a sort. I'm sure someone has thought of it before, but I've never seen it. It goes like this (written in Python for listiness and readability):
items = len(unsorted)
sortedBins = []
# Pull out bins of sorted numbers, until the unsorted list is depleted:
while( len(unsorted) > 0 ):
highest = float("-inf")
newBin = []
for i in range( 0, len(unsorted) ):
# Find items in unsorted list that are in order, pop them out:
if( unsorted[i] > highest ):
highest = unsorted[i]
newBin.append( unsorted.pop(i) )
sortedBins.append(newBin)
# Merge all of the sorted bins together:
sorted = []
while( len(sorted) < items ):
lowBin = 0
for j in range( 0, len(sortedBins) ):
if( sortedBins[j][0] < sortedBins[lowBin][0] ):
lowBin = j
sorted.append( sortedBins[lowBin].pop(0) )
if( len(sortedBins[lowBin]) == 0 ):
del sortedBins[lowBin]
It seems like the worst case (a completely reversed list) would take **n(n+1)** time if I'm not crazy (that is, n(n+1)/2 for each loop). The best case (an already sorted list) would take **2*n** time. | 1 |
10,979,323 | 06/11/2012 11:38:20 | 1,058,131 | 11/21/2011 15:57:27 | 106 | 8 | New foursquare venue detail map | I really love the way foursquare designed venue detail view. Especially the map with venue location in the "header" of view ... How was it done? Details are obviously some uiscrollview (maybe uitableview?) and behind it (in the header) there is a map so when you scroll up the map is beeing uncovered as the scroll view bounces... does anyone has an idea how to do this?
![enter image description here][1]
[1]: http://i.stack.imgur.com/0vEDT.png | ios | foursquare | null | null | null | null | open | New foursquare venue detail map
===
I really love the way foursquare designed venue detail view. Especially the map with venue location in the "header" of view ... How was it done? Details are obviously some uiscrollview (maybe uitableview?) and behind it (in the header) there is a map so when you scroll up the map is beeing uncovered as the scroll view bounces... does anyone has an idea how to do this?
![enter image description here][1]
[1]: http://i.stack.imgur.com/0vEDT.png | 0 |
10,532,496 | 05/10/2012 10:53:30 | 1,217,435 | 02/18/2012 01:06:15 | 24 | 4 | JavaScript game loop not working | I'm having an issue with a game that I'm trying to make. Here is my code (very basic):
var canvas = document.createElement("canvas");
var gameCanvas = canvas.getContext("2d");
canvas.width = 500;
canvas.height = 500;
document.body.appendChild(canvas);
// Global variables
var game;
game.fps = 60;
game._intervalId = setInterval(game.run, 1000 / game.fps);
// Game loop
game.run = function() {
game.draw();
};
// Functions
game.draw = function() {
// Background image
var bgImage = new Image();
bgImage.src = "img/background.png";
// Player image
var playerImage = new Image();
playerImage.src = "img/player.png";
// Draw
gameCanvas.drawImage(bgImage, 0, 0);
gameCanvas.drawImage(playerImage, 10, 10);
}
// Game over
document.getElementById('end').onclick = function stop(){
clearInterval(game._intervalId);
}
// Run
window.onload = game.run();
The game doesn't run properly. Have I done anything wrong, or is there something I have missed out? Here is a link to the page: http://dl.dropbox.com/u/33213779/Game/demo_me.html
Thanks. | javascript | loops | null | null | null | 05/11/2012 15:59:07 | too localized | JavaScript game loop not working
===
I'm having an issue with a game that I'm trying to make. Here is my code (very basic):
var canvas = document.createElement("canvas");
var gameCanvas = canvas.getContext("2d");
canvas.width = 500;
canvas.height = 500;
document.body.appendChild(canvas);
// Global variables
var game;
game.fps = 60;
game._intervalId = setInterval(game.run, 1000 / game.fps);
// Game loop
game.run = function() {
game.draw();
};
// Functions
game.draw = function() {
// Background image
var bgImage = new Image();
bgImage.src = "img/background.png";
// Player image
var playerImage = new Image();
playerImage.src = "img/player.png";
// Draw
gameCanvas.drawImage(bgImage, 0, 0);
gameCanvas.drawImage(playerImage, 10, 10);
}
// Game over
document.getElementById('end').onclick = function stop(){
clearInterval(game._intervalId);
}
// Run
window.onload = game.run();
The game doesn't run properly. Have I done anything wrong, or is there something I have missed out? Here is a link to the page: http://dl.dropbox.com/u/33213779/Game/demo_me.html
Thanks. | 3 |
8,374,928 | 12/04/2011 11:20:55 | 622,097 | 02/17/2011 20:41:53 | 72 | 2 | How to pass a matrix of constant values as an argument of a procedure call | I want to test a number of matrices by a procedure. Each matrix should be passsed as a matrix, something like:
type TMatrix = array of array of integer;
procedure test_kernel (mat: TMatrix);
....
test_kernel ([[1, 2], [1, 3]]); // <== does not compile
I cannot find the right syntax to do this correctly (tried with round brackets as well). Does anyone know how to pass a matrix of constant values as a procedure argument? Is it possible at all? | delphi | multidimensional-array | null | null | null | null | open | How to pass a matrix of constant values as an argument of a procedure call
===
I want to test a number of matrices by a procedure. Each matrix should be passsed as a matrix, something like:
type TMatrix = array of array of integer;
procedure test_kernel (mat: TMatrix);
....
test_kernel ([[1, 2], [1, 3]]); // <== does not compile
I cannot find the right syntax to do this correctly (tried with round brackets as well). Does anyone know how to pass a matrix of constant values as a procedure argument? Is it possible at all? | 0 |
7,126,532 | 08/19/2011 19:35:12 | 804,329 | 06/18/2011 07:56:14 | 32 | 1 | Update Manipulate[]'d plots when parameters change | I've been fighting with Mathematica's Manipulate function for the last few days for a project.
I'm working on tweaking assumptions and boundary conditions that go into a physical model. For this, I want to be able to plot different equations and adjust the parameters and have the graphs update on the fly. Manipulate seems to be the perfect tool for the job -- except that I can't get it to work. The plots won't update when the parameters are changed.
Basic example:
a =.;
func1[x_] := a*x;
func2[x_] := a*x^2;
funcList := {func1[x], func2[x]}
Manipulate[
Plot[function, {x, -5, 5}], {function, funcList}, {a, -5, 5}, LocalizeVariables -> False]
]
I can get, for example, `func1` to refresh by clicking `func1`, adjusting `a`, and then clicking`func1` again, but I'm hoping to have it update when I adjust `a` because the real functions I'm using are rather temperamental with respect to their parameters.
-Because I'll be dealing with long functions that have different parameters, using a list of functions is useful. | mathematica | null | null | null | null | null | open | Update Manipulate[]'d plots when parameters change
===
I've been fighting with Mathematica's Manipulate function for the last few days for a project.
I'm working on tweaking assumptions and boundary conditions that go into a physical model. For this, I want to be able to plot different equations and adjust the parameters and have the graphs update on the fly. Manipulate seems to be the perfect tool for the job -- except that I can't get it to work. The plots won't update when the parameters are changed.
Basic example:
a =.;
func1[x_] := a*x;
func2[x_] := a*x^2;
funcList := {func1[x], func2[x]}
Manipulate[
Plot[function, {x, -5, 5}], {function, funcList}, {a, -5, 5}, LocalizeVariables -> False]
]
I can get, for example, `func1` to refresh by clicking `func1`, adjusting `a`, and then clicking`func1` again, but I'm hoping to have it update when I adjust `a` because the real functions I'm using are rather temperamental with respect to their parameters.
-Because I'll be dealing with long functions that have different parameters, using a list of functions is useful. | 0 |
11,159,563 | 06/22/2012 15:41:46 | 1,387,501 | 05/10/2012 15:17:25 | 423 | 33 | How to transfer blackberry 9700 contacts to android phone? | I have a BlackBerry 9700 BOLD and a Samsung Galaxy SIII and I need to transfer as much of my contact info from the BB to the Galaxy SIII. I already know that if I save numbers on my SIM card they will be transferred but I can't save everything on it.
I read a lot of articles about using "Google Sync" app for black berry to sync with Google's cloud and then back to android again. But the problem is that I went there now [http://www.google.com/mobile/sync/][1] and it seems they stopped BlackBerry support for Google Sync.
So my question is how to sync as much of my data from black berry to my android phone without using Google Sync?
[1]: http://www.google.com/mobile/sync/ | android | blackberry | contacts | sync | android-contacts | 06/22/2012 15:45:42 | off topic | How to transfer blackberry 9700 contacts to android phone?
===
I have a BlackBerry 9700 BOLD and a Samsung Galaxy SIII and I need to transfer as much of my contact info from the BB to the Galaxy SIII. I already know that if I save numbers on my SIM card they will be transferred but I can't save everything on it.
I read a lot of articles about using "Google Sync" app for black berry to sync with Google's cloud and then back to android again. But the problem is that I went there now [http://www.google.com/mobile/sync/][1] and it seems they stopped BlackBerry support for Google Sync.
So my question is how to sync as much of my data from black berry to my android phone without using Google Sync?
[1]: http://www.google.com/mobile/sync/ | 2 |
8,661,742 | 12/28/2011 21:56:11 | 1,119,992 | 12/28/2011 20:57:54 | 1 | 0 | Javascript: dynamic var names with php? | Probably a dead simple and idiotic question (I'm totally new to javascript):
I have this code that loads a new post by clicking on a "next" or "back"-link. The clicks variable is used to scroll up and down in the sql-limit-statement (using the swapContent function), means you move backward or forward in the database by clicking the links. It works easy and perfectly:
<script type="text/javascript">
var clicks = -1;
function increase()
{
clicks++;
return false;
}
function decrease()
{
clicks--;
return false;
}
</script>
<div id="<?php echo $post['id'].'-multipost'; ?>">
<?php include('views/posts/_postmultipost.php'); ?>
</div>
<div id="<?php echo $post['id']; ?>-next" class="rightbutton" style="display:block;">
<a href="#" onmousedown="increase(); javascript:swapContent('next', clicks, '<?php echo $post['id']; ?>', '<?php echo $post['title']; ?>', '<?php echo $_SESSION['user']['id']; ?>');">next</a>
</div>
<div id="<?php echo $post['id']; ?>-back" class="leftbutton" style="display:none;">
<a href="#" onmousedown="decrease(); javascript:swapContent('back', clicks, '<?php echo $post['id']; ?>', '<?php echo $post['title']; ?>', '<?php echo $_SESSION['user']['id']; ?>');">back</a>
</div>
The only problem: As you see I have several posts (post-IDs). But the javascript var "clicks" is always the same. How can I add the post-id into the javascript variable name "clicks", well, something like this :
var <?php echo $post['id']; ?>-clicks = -1;
Of course it doesn't work this way, but I have no clue how to manage it. Any advice? Sorry for this stupid question...
Thanks for your help! | php | javascript | dynamic | variable-names | null | null | open | Javascript: dynamic var names with php?
===
Probably a dead simple and idiotic question (I'm totally new to javascript):
I have this code that loads a new post by clicking on a "next" or "back"-link. The clicks variable is used to scroll up and down in the sql-limit-statement (using the swapContent function), means you move backward or forward in the database by clicking the links. It works easy and perfectly:
<script type="text/javascript">
var clicks = -1;
function increase()
{
clicks++;
return false;
}
function decrease()
{
clicks--;
return false;
}
</script>
<div id="<?php echo $post['id'].'-multipost'; ?>">
<?php include('views/posts/_postmultipost.php'); ?>
</div>
<div id="<?php echo $post['id']; ?>-next" class="rightbutton" style="display:block;">
<a href="#" onmousedown="increase(); javascript:swapContent('next', clicks, '<?php echo $post['id']; ?>', '<?php echo $post['title']; ?>', '<?php echo $_SESSION['user']['id']; ?>');">next</a>
</div>
<div id="<?php echo $post['id']; ?>-back" class="leftbutton" style="display:none;">
<a href="#" onmousedown="decrease(); javascript:swapContent('back', clicks, '<?php echo $post['id']; ?>', '<?php echo $post['title']; ?>', '<?php echo $_SESSION['user']['id']; ?>');">back</a>
</div>
The only problem: As you see I have several posts (post-IDs). But the javascript var "clicks" is always the same. How can I add the post-id into the javascript variable name "clicks", well, something like this :
var <?php echo $post['id']; ?>-clicks = -1;
Of course it doesn't work this way, but I have no clue how to manage it. Any advice? Sorry for this stupid question...
Thanks for your help! | 0 |
6,819,857 | 07/25/2011 17:15:09 | 27,457 | 10/13/2008 15:01:44 | 3,285 | 138 | Recursive INSERT query for a grouped sequence | I have two tables like this:
Table1ID Table2ID Table1ID SomeDate
-------- ------------------------------
1 1 1 2011-01-01
2 2 1 2011-01-02
3 3 2 2011-01-01
4 4 3 2011-01-01
5 3 2011-01-02
6 3 2011-01-03
7 4 2011-01-01
8 4 2011-01-02
I need to insert values into a third table that give me both values from Table2, as well as a "sequence" value grouped on Table1ID. I tried this, but I'm always getting a value of 1 for the sequence.
;WITH Sequences AS (
SELECT t1.Table1ID,
MAX(ISNULL(t3.Sequence, 0)) AS [MaxSequence]
FROM Table1 t1
LEFT JOIN Table3 t3 (NOLOCK) ON t1.Table1ID = t3.Table1ID
GROUP BY t1.Table1ID
)
INSERT INTO Table3 ( Table1ID, Table2ID, Sequence )
SELECT t1.Table1ID,
t2.Table2ID,
s.MaxSequence + 1
FROM Table1 t1 (NOLOCK)
JOIN Table2 t2 (NOLOCK) ON t1.Table1ID = t2.Table2ID
JOIN Sequences s ON t2.Table1ID = s.Table1ID
ORDER BY t2.SomeDate
What I want is a result-set like this:
Table2ID Table1ID Sequence
------------------------------
1 1 1
2 1 2
3 2 1
4 3 1
5 3 2
6 3 3
7 4 1
8 4 2
I know I'm probably missing something stupidly simple here, but I'm stuck.
| sql-server | tsql | recursive-query | null | null | null | open | Recursive INSERT query for a grouped sequence
===
I have two tables like this:
Table1ID Table2ID Table1ID SomeDate
-------- ------------------------------
1 1 1 2011-01-01
2 2 1 2011-01-02
3 3 2 2011-01-01
4 4 3 2011-01-01
5 3 2011-01-02
6 3 2011-01-03
7 4 2011-01-01
8 4 2011-01-02
I need to insert values into a third table that give me both values from Table2, as well as a "sequence" value grouped on Table1ID. I tried this, but I'm always getting a value of 1 for the sequence.
;WITH Sequences AS (
SELECT t1.Table1ID,
MAX(ISNULL(t3.Sequence, 0)) AS [MaxSequence]
FROM Table1 t1
LEFT JOIN Table3 t3 (NOLOCK) ON t1.Table1ID = t3.Table1ID
GROUP BY t1.Table1ID
)
INSERT INTO Table3 ( Table1ID, Table2ID, Sequence )
SELECT t1.Table1ID,
t2.Table2ID,
s.MaxSequence + 1
FROM Table1 t1 (NOLOCK)
JOIN Table2 t2 (NOLOCK) ON t1.Table1ID = t2.Table2ID
JOIN Sequences s ON t2.Table1ID = s.Table1ID
ORDER BY t2.SomeDate
What I want is a result-set like this:
Table2ID Table1ID Sequence
------------------------------
1 1 1
2 1 2
3 2 1
4 3 1
5 3 2
6 3 3
7 4 1
8 4 2
I know I'm probably missing something stupidly simple here, but I'm stuck.
| 0 |
2,892,680 | 05/23/2010 17:20:33 | 348,385 | 05/23/2010 17:13:30 | 1 | 0 | Website Replication using Wordpress | Hi I have a wordpress installed on
> h*ttp://domainname.com
and I would like to have replication of the same website on a subdomain for example
>h*ttp://sub1.domainname.com
>h*ttp://sub2.domainname.com
What should I do to make this happen without copying any database and the wordpress should be smart enough to recognize the "sub1" and "sub2" to be used later in the program. | php | wordpress | replication | subdomain | null | 10/11/2011 13:18:57 | off topic | Website Replication using Wordpress
===
Hi I have a wordpress installed on
> h*ttp://domainname.com
and I would like to have replication of the same website on a subdomain for example
>h*ttp://sub1.domainname.com
>h*ttp://sub2.domainname.com
What should I do to make this happen without copying any database and the wordpress should be smart enough to recognize the "sub1" and "sub2" to be used later in the program. | 2 |
3,568,542 | 08/25/2010 17:18:58 | 111,331 | 05/22/2009 22:22:59 | 2,256 | 137 | What features of Rational Application Developer for WebSphere make you the most productive | I am mainly interested in the 'integration features' between the IDE and the application server.
One example would be GUI editors for various server specific deployment descriptors.
Another example, from the NetBeans IDE integration with GlassFish, is the ability to:
- edit a java file that is part of a
web application,
- save the file and
- see the effect of the change that you
just saved in the browser (without a
bunch of reloading). | websphere | rad | null | null | null | null | open | What features of Rational Application Developer for WebSphere make you the most productive
===
I am mainly interested in the 'integration features' between the IDE and the application server.
One example would be GUI editors for various server specific deployment descriptors.
Another example, from the NetBeans IDE integration with GlassFish, is the ability to:
- edit a java file that is part of a
web application,
- save the file and
- see the effect of the change that you
just saved in the browser (without a
bunch of reloading). | 0 |
9,912,324 | 03/28/2012 17:02:27 | 1,291,774 | 03/25/2012 20:36:52 | 6 | 0 | Can i connect two differents application authentication with c# in mvc3 | Hello I have two app and i pass a parameter with the user from the app 1 in the url to the app 2. I create a table with each authentication to can get the user and pass in the next app 2.
My question is how can i create a session variable in my second application? or can i create a session variable in my new app mvc 3?.
Sorry for my english. Thanks | c# | asp.net-mvc-3 | authentication | null | null | 03/29/2012 06:40:51 | not a real question | Can i connect two differents application authentication with c# in mvc3
===
Hello I have two app and i pass a parameter with the user from the app 1 in the url to the app 2. I create a table with each authentication to can get the user and pass in the next app 2.
My question is how can i create a session variable in my second application? or can i create a session variable in my new app mvc 3?.
Sorry for my english. Thanks | 1 |
7,900,399 | 10/26/2011 08:37:27 | 877,226 | 08/03/2011 18:29:49 | 1 | 0 | What's the best approach for selectively displaying content in views (MVC) | I was wondering if I am doing the right thing when it comes to selectively displaying content (based on a user level, for example).
At the moment I am just putting the checks directly in the views, I query the session data to check the user level and then use an if statement to display the content if required.
I'm not sure what my other options would be really, but some of my views have a fair amount of PHP 'logic' as a result. | php | mvc | codeigniter-2 | null | null | 10/26/2011 09:26:55 | not constructive | What's the best approach for selectively displaying content in views (MVC)
===
I was wondering if I am doing the right thing when it comes to selectively displaying content (based on a user level, for example).
At the moment I am just putting the checks directly in the views, I query the session data to check the user level and then use an if statement to display the content if required.
I'm not sure what my other options would be really, but some of my views have a fair amount of PHP 'logic' as a result. | 4 |
6,277,503 | 06/08/2011 10:44:30 | 700,069 | 04/09/2011 15:25:02 | 1 | 0 | How to link to my apps on Amazon Android website | I have developed some apps that serves both free version and paid version and was uploaded to the Amazon Android market. The install files are being rejected because it contains an Android market link which direct the user to the paid version and some how facilitate the user to buy my app. Now I want to do the same on Amazon Android Market website, but I do not know what is the link of that? For example, the package name of my app is com.abc.apple, how can i browse my app in Amazon Android Market? | android | amazon | market | null | null | 06/08/2011 12:36:26 | off topic | How to link to my apps on Amazon Android website
===
I have developed some apps that serves both free version and paid version and was uploaded to the Amazon Android market. The install files are being rejected because it contains an Android market link which direct the user to the paid version and some how facilitate the user to buy my app. Now I want to do the same on Amazon Android Market website, but I do not know what is the link of that? For example, the package name of my app is com.abc.apple, how can i browse my app in Amazon Android Market? | 2 |
10,096,529 | 04/10/2012 21:11:32 | 628,864 | 02/22/2011 18:27:19 | 153 | 21 | NSWindow FullScreen Mode Lion | For anyone interested here are some methods you can categorize or use as is. I spent some time looking for how to do this and thought it can help someone else out:
This one will tell you if you are or are not in full screen mode:
@implementation MyWindow
- (void) setStyleMask:(NSUInteger)styleMask {
MyWindowController *wndController = (MyWindowController *)self.windowController;
wndController.fullScreenMode = (styleMask & NSFullScreenWindowMask);
[super setStyleMask:styleMask];
}
@end
I am setting a property in my window controller.
These two methods will enable / disable the ability to go into or out of full screen mode:
- (void) enableFullScreen {
NSWindowCollectionBehavior behavior = [self.window collectionBehavior];
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
[self.window setCollectionBehavior:behavior];
}
- (void) disableFullScreen {
NSWindowCollectionBehavior behavior = [self.window collectionBehavior];
behavior ^= NSWindowCollectionBehaviorFullScreenPrimary;
[self.window setCollectionBehavior:behavior];
}
Rename methods as you please. | objective-c | null | null | null | null | null | open | NSWindow FullScreen Mode Lion
===
For anyone interested here are some methods you can categorize or use as is. I spent some time looking for how to do this and thought it can help someone else out:
This one will tell you if you are or are not in full screen mode:
@implementation MyWindow
- (void) setStyleMask:(NSUInteger)styleMask {
MyWindowController *wndController = (MyWindowController *)self.windowController;
wndController.fullScreenMode = (styleMask & NSFullScreenWindowMask);
[super setStyleMask:styleMask];
}
@end
I am setting a property in my window controller.
These two methods will enable / disable the ability to go into or out of full screen mode:
- (void) enableFullScreen {
NSWindowCollectionBehavior behavior = [self.window collectionBehavior];
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
[self.window setCollectionBehavior:behavior];
}
- (void) disableFullScreen {
NSWindowCollectionBehavior behavior = [self.window collectionBehavior];
behavior ^= NSWindowCollectionBehaviorFullScreenPrimary;
[self.window setCollectionBehavior:behavior];
}
Rename methods as you please. | 0 |
6,277,027 | 06/08/2011 09:57:32 | 275,109 | 02/17/2010 09:47:22 | 37 | 5 | Suds over https with cert | I have soap service under Apache with ssl, suds works greate without ssl.<br/>
I have client certificate (my.crt and user.p12 files).<br/>
How I need to configure suds client ot make it work with service over https? | python | ssl | https | suds | null | null | open | Suds over https with cert
===
I have soap service under Apache with ssl, suds works greate without ssl.<br/>
I have client certificate (my.crt and user.p12 files).<br/>
How I need to configure suds client ot make it work with service over https? | 0 |
3,057,257 | 06/16/2010 21:18:11 | 51,496 | 01/05/2009 01:35:03 | 62 | 3 | Ubuntu 10.04 (Lucid) OpenLDAP invalid credentials issue | This won't be a question, but a solution to an infuriating problem on Ubuntu 10.04.
If you tried to deploy an LDAP server using this distro following the tutorials below, you'll be on serious trouble.
Tutorials:
[https://help.ubuntu.com/9.10/serverguide/C/openldap-server.html][1]
[https://help.ubuntu.com/9.10/serverguide/C/samba-ldap.html][2]
The error first appear, on the line:
"ldapsearch -xLLL -b cn=config -D cn=admin,cn=config -W olcDatabase=hdb olcAccess"
It simply won't allow admin to access the "cn=config", thus you won't be able to deploy the LDAP server correctly.
After almost a week searching for a solution, I've found this page:
https://bugs.launchpad.net/ubuntu-docs/+bug/333733
On comment #5, the solution is presented. Quoting the author:
> when you get to the setting up ACL part you all of a sudden need to use a cn=admin,cn=config, that doesn't exist
> creating a config.ldif with
> dn: olcDatabase={0}config,cn=config
> changetype: modify
> add: olcRootDN
> olcRootDN: cn=admin,cn=config
> dn: olcDatabase={0}config,cn=config
> changetype: modify
> add: olcRootPW
> olcRootPW: secret
> dn: olcDatabase={0}config,cn=config
> changetype: modify
> delete: olcAccess
> and adding it with
> ldapadd -Y EXTERNAL -H ldapi:/// -f config.ldif
It's unacceptable that a Linux distribution, popular like Ubuntu, have such ridiculous bug.
Hope it helps everyone!
[1]: https://help.ubuntu.com/9.10/serverguide/C/openldap-server.html
[2]: https://help.ubuntu.com/9.10/serverguide/C/samba-ldap.html | ubuntu | ldap | openldap | ubuntu-lucid | null | 06/17/2010 13:44:24 | off topic | Ubuntu 10.04 (Lucid) OpenLDAP invalid credentials issue
===
This won't be a question, but a solution to an infuriating problem on Ubuntu 10.04.
If you tried to deploy an LDAP server using this distro following the tutorials below, you'll be on serious trouble.
Tutorials:
[https://help.ubuntu.com/9.10/serverguide/C/openldap-server.html][1]
[https://help.ubuntu.com/9.10/serverguide/C/samba-ldap.html][2]
The error first appear, on the line:
"ldapsearch -xLLL -b cn=config -D cn=admin,cn=config -W olcDatabase=hdb olcAccess"
It simply won't allow admin to access the "cn=config", thus you won't be able to deploy the LDAP server correctly.
After almost a week searching for a solution, I've found this page:
https://bugs.launchpad.net/ubuntu-docs/+bug/333733
On comment #5, the solution is presented. Quoting the author:
> when you get to the setting up ACL part you all of a sudden need to use a cn=admin,cn=config, that doesn't exist
> creating a config.ldif with
> dn: olcDatabase={0}config,cn=config
> changetype: modify
> add: olcRootDN
> olcRootDN: cn=admin,cn=config
> dn: olcDatabase={0}config,cn=config
> changetype: modify
> add: olcRootPW
> olcRootPW: secret
> dn: olcDatabase={0}config,cn=config
> changetype: modify
> delete: olcAccess
> and adding it with
> ldapadd -Y EXTERNAL -H ldapi:/// -f config.ldif
It's unacceptable that a Linux distribution, popular like Ubuntu, have such ridiculous bug.
Hope it helps everyone!
[1]: https://help.ubuntu.com/9.10/serverguide/C/openldap-server.html
[2]: https://help.ubuntu.com/9.10/serverguide/C/samba-ldap.html | 2 |
11,669,715 | 07/26/2012 12:51:33 | 1,092,437 | 12/11/2011 16:39:31 | 46 | 2 | Error installing XFCE4 "partition too full" | Installed Archlinux yesterday without any problems in a vm, but is the first time I try to install Archlinux (archlinux-2012.07.15-netinstall-dual) from usb to HDD. But when I go to install xfce4 xfce4-goodies got this error:
error: Partition /usr/share too full: 279300 blocks needed, 208144 blocks free
error: Partition / too full: 46353 blocks needed, 28856 blocks free
error: Not enough free disk space
error: Failed to commit transaction (not enough free disk space)
Errors occurred, no packages were upgraded.
: / (My face)
For the first try's I have used **/boot /swap /home** and **/** with at least 250GB
For next try's I have created a **/usr** mount point with 80GB
I used 250GB and 80GB just to emphasize that the partitions has de sufficient capacity.
I have Tried to use **resize2fs** to extend the partitions without success.
Could anyone help me ? thank you. | linux | archlinux | xfce | null | null | 07/26/2012 12:53:58 | off topic | Error installing XFCE4 "partition too full"
===
Installed Archlinux yesterday without any problems in a vm, but is the first time I try to install Archlinux (archlinux-2012.07.15-netinstall-dual) from usb to HDD. But when I go to install xfce4 xfce4-goodies got this error:
error: Partition /usr/share too full: 279300 blocks needed, 208144 blocks free
error: Partition / too full: 46353 blocks needed, 28856 blocks free
error: Not enough free disk space
error: Failed to commit transaction (not enough free disk space)
Errors occurred, no packages were upgraded.
: / (My face)
For the first try's I have used **/boot /swap /home** and **/** with at least 250GB
For next try's I have created a **/usr** mount point with 80GB
I used 250GB and 80GB just to emphasize that the partitions has de sufficient capacity.
I have Tried to use **resize2fs** to extend the partitions without success.
Could anyone help me ? thank you. | 2 |
9,019,023 | 01/26/2012 13:46:27 | 684,534 | 03/30/2011 18:53:05 | 1,349 | 5 | REST service and big files | Can `REST` web service (which usually produces e.g. simple `JSONs`) both handle and return big binary input/output data?
I mean, to call a `REST` service by a HTTP POST providing big file and afterwards reading the big result back? Is REST ok for that? ("Big" = few megabytes) | c# | .net | web-services | rest | soap | null | open | REST service and big files
===
Can `REST` web service (which usually produces e.g. simple `JSONs`) both handle and return big binary input/output data?
I mean, to call a `REST` service by a HTTP POST providing big file and afterwards reading the big result back? Is REST ok for that? ("Big" = few megabytes) | 0 |
3,462,274 | 08/11/2010 19:54:20 | 269,970 | 02/10/2010 02:14:15 | 459 | 36 | Monetizing iPhone Apps for 16-year-old developer? | I'm getting tired of creating free apps that are of a high quality, but they don't do much for me. I looked into selling paid apps and iAds, but they both require the intervention of the tax man, who I really don't want to get into trouble with.
What is the best thing I can do, as a 16-year-old developer, to monetize my iPhone app? | iphone | app-store | null | null | null | 08/12/2010 04:06:55 | off topic | Monetizing iPhone Apps for 16-year-old developer?
===
I'm getting tired of creating free apps that are of a high quality, but they don't do much for me. I looked into selling paid apps and iAds, but they both require the intervention of the tax man, who I really don't want to get into trouble with.
What is the best thing I can do, as a 16-year-old developer, to monetize my iPhone app? | 2 |
3,061,404 | 06/17/2010 11:57:11 | 362,585 | 06/09/2010 15:11:52 | 1 | 0 | jQuery Cycle plugin | do you have any ideas why jQuery cycle plugin breaks backgorund image centering when sliding images? (without the plugin activated it works okay)
Here is a demo of my page (try to resize the window or zoom out and see what I mean - the background image gets cropped)
http://j.mp/czX3DD | jquery | cycle | null | null | null | null | open | jQuery Cycle plugin
===
do you have any ideas why jQuery cycle plugin breaks backgorund image centering when sliding images? (without the plugin activated it works okay)
Here is a demo of my page (try to resize the window or zoom out and see what I mean - the background image gets cropped)
http://j.mp/czX3DD | 0 |
4,105,255 | 11/05/2010 10:59:51 | 244,413 | 01/06/2010 02:46:19 | 1,295 | 0 | Why Can't I do this in C++ ? | #include <iostream.h>
#include <string.h>
Class People
{
public:
char* getName();
private:
char* name;
};
char* People::getName()
{ return name; } | c++ | null | null | null | null | 11/05/2010 11:20:38 | not a real question | Why Can't I do this in C++ ?
===
#include <iostream.h>
#include <string.h>
Class People
{
public:
char* getName();
private:
char* name;
};
char* People::getName()
{ return name; } | 1 |
7,776,637 | 10/15/2011 08:13:52 | 980,019 | 10/05/2011 08:59:52 | 60 | 2 | Failure in installation of lancet and running it | <https://github.com/stuarthalloway/lancet> following these steps isn't helping. Exception are coming. Can anyone help? | clojure | null | null | null | null | 10/15/2011 16:10:40 | not a real question | Failure in installation of lancet and running it
===
<https://github.com/stuarthalloway/lancet> following these steps isn't helping. Exception are coming. Can anyone help? | 1 |
9,992,596 | 04/03/2012 11:46:55 | 1,299,147 | 03/28/2012 19:53:39 | 1 | 1 | how to make linked string in perl? | I want to make linked string in my perl script
#!/usr/bin/env perl
print "this is mysite";
I want to mysite be linked to my blog : http://myblog.com | string | perl | hyperlink | null | null | 04/09/2012 13:15:38 | not a real question | how to make linked string in perl?
===
I want to make linked string in my perl script
#!/usr/bin/env perl
print "this is mysite";
I want to mysite be linked to my blog : http://myblog.com | 1 |
11,203,108 | 06/26/2012 08:04:28 | 881,850 | 08/06/2011 10:47:13 | 18 | 3 | send email from wamp localhost using pear | I have installed pear. it's working fine. I want to send email via pear's mail() but it giving following error.
Failed to connect to mailserver at "ssl://smtp.gmail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\wamp\bin\php\php5.3.10\PEAR\Mail-1.2.0\Mail\mail.php on line 153
is there any solution for it. If not then how to send email via pear's sendmail or pear's SMTP
please guide
Many Thanks | email | smtp | pear | sendmail | null | null | open | send email from wamp localhost using pear
===
I have installed pear. it's working fine. I want to send email via pear's mail() but it giving following error.
Failed to connect to mailserver at "ssl://smtp.gmail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\wamp\bin\php\php5.3.10\PEAR\Mail-1.2.0\Mail\mail.php on line 153
is there any solution for it. If not then how to send email via pear's sendmail or pear's SMTP
please guide
Many Thanks | 0 |
7,372,395 | 09/10/2011 14:31:48 | 126,353 | 06/21/2009 00:34:56 | 4,797 | 133 | Append To The Beginning of The List | I'm appending some items dynamically to an unordered list, but the jQuery `.append()` function only appends to the bottom of the list, like this:
> * Appended 1
> * Appended 2
> * Appended 3
> * Appended 4
But what I want to do is append like this:
> * Appended 4
> * Appended 3
> * Appended 2
> * Appended 1
How can I do this? | jquery | list | append | null | null | null | open | Append To The Beginning of The List
===
I'm appending some items dynamically to an unordered list, but the jQuery `.append()` function only appends to the bottom of the list, like this:
> * Appended 1
> * Appended 2
> * Appended 3
> * Appended 4
But what I want to do is append like this:
> * Appended 4
> * Appended 3
> * Appended 2
> * Appended 1
How can I do this? | 0 |
10,754,486 | 05/25/2012 12:31:05 | 1,239,509 | 02/29/2012 06:06:57 | 88 | 1 | Distribution certificate error:"This certificate is yet not valid." | I have downloaded distribution certificate from itunesconnect website.
By double clicking I add it to keychain access.
but in keychain access it shows me that "This certificate is yet not valid."
then what is the problem?
thanx in advance. | iphone | itunesconnect | null | null | null | 05/28/2012 05:35:58 | off topic | Distribution certificate error:"This certificate is yet not valid."
===
I have downloaded distribution certificate from itunesconnect website.
By double clicking I add it to keychain access.
but in keychain access it shows me that "This certificate is yet not valid."
then what is the problem?
thanx in advance. | 2 |
6,399,226 | 06/18/2011 22:18:04 | 432,715 | 08/27/2010 08:41:39 | 71 | 1 | How to upload binary files in mod_perl with CGI.pm? | I have a big piece of production code, that works. But after I setup a new environment in virtual machine I have one issue -- everytime I need to upload a binary file it become messed up with unicode conversions.
So there is a sub, where issue is:
sub save_uploaded_file
{
# $file is obtained by param(zip)
my ($file) = @_;
my ($fh, $fname) = tmpnam;
my ($br, $buffer);
# commenting out next 2 lines doesn't help either
binmode $file, ':raw';
binmode $fh, ':raw';
while ($br = sysread($file, $buffer, 16384))
{
syswrite($fh, $buffer, $br);
}
close $fh;
return $fname;
}
Its used to upload zip archives, but they are uploaded as malformed (their size is always bigger than in original) and I looked inside of them with hex editor and found that there are lots unicode replacement charaters inside (EF BF BD).
Text files uploads well. | perl | unicode | binary | cgi | mod-perl | null | open | How to upload binary files in mod_perl with CGI.pm?
===
I have a big piece of production code, that works. But after I setup a new environment in virtual machine I have one issue -- everytime I need to upload a binary file it become messed up with unicode conversions.
So there is a sub, where issue is:
sub save_uploaded_file
{
# $file is obtained by param(zip)
my ($file) = @_;
my ($fh, $fname) = tmpnam;
my ($br, $buffer);
# commenting out next 2 lines doesn't help either
binmode $file, ':raw';
binmode $fh, ':raw';
while ($br = sysread($file, $buffer, 16384))
{
syswrite($fh, $buffer, $br);
}
close $fh;
return $fname;
}
Its used to upload zip archives, but they are uploaded as malformed (their size is always bigger than in original) and I looked inside of them with hex editor and found that there are lots unicode replacement charaters inside (EF BF BD).
Text files uploads well. | 0 |
9,556,611 | 03/04/2012 16:27:53 | 1,205,011 | 02/12/2012 11:38:11 | 1 | 0 | Android - Emulator internet is not working | I know there are many other post regarding to same issue but please help me and really fed of it.
I am a student making a project on android. Suddenly when i run my application i found my emulator internet is not working and got a network failure error.
Am using android 2.2 and connected to LAN connection using a dial-up connection so i can't set my proxy and port number on the emulator. Please give me some idea or suggestion so that i can start my application am feeling helpless. Please....
Thank you in advance. | android | emulator | null | null | null | 03/16/2012 03:53:42 | off topic | Android - Emulator internet is not working
===
I know there are many other post regarding to same issue but please help me and really fed of it.
I am a student making a project on android. Suddenly when i run my application i found my emulator internet is not working and got a network failure error.
Am using android 2.2 and connected to LAN connection using a dial-up connection so i can't set my proxy and port number on the emulator. Please give me some idea or suggestion so that i can start my application am feeling helpless. Please....
Thank you in advance. | 2 |
7,930,358 | 10/28/2011 14:11:02 | 492,067 | 10/30/2010 10:22:40 | 152 | 4 | Configurable URL with ACRA for Android when sending report to self hosted server? | I'm using [ACRA][1] for Android, and I want to send the crash reports to my own server. I've set it up alright, and everything works fine. However, I would like to make the URL that the reports are sent to configurable. But I do not know how to do it.
Here is the code I use to set the URL
@ReportsCrashes(formKey = "", // will not be used
formUri = "http://yourserver.com/yourscript",
formUriBasicAuthLogin = "yourlogin", // optional
formUriBasicAuthPassword = "y0uRpa$$w0rd", // optional
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
public class MyApplication extends Application {
...
So basically, I wan't to be able to configure `formUri` from within the application. Is it possible?
[1]: http://code.google.com/p/acra/ | android | null | null | null | null | null | open | Configurable URL with ACRA for Android when sending report to self hosted server?
===
I'm using [ACRA][1] for Android, and I want to send the crash reports to my own server. I've set it up alright, and everything works fine. However, I would like to make the URL that the reports are sent to configurable. But I do not know how to do it.
Here is the code I use to set the URL
@ReportsCrashes(formKey = "", // will not be used
formUri = "http://yourserver.com/yourscript",
formUriBasicAuthLogin = "yourlogin", // optional
formUriBasicAuthPassword = "y0uRpa$$w0rd", // optional
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
public class MyApplication extends Application {
...
So basically, I wan't to be able to configure `formUri` from within the application. Is it possible?
[1]: http://code.google.com/p/acra/ | 0 |
4,887,282 | 02/03/2011 14:21:24 | 601,640 | 02/03/2011 14:21:24 | 1 | 0 | Using jsp:setProperty | I would like to know how to use jsp:setProperty in the following scenario. Here is a simple example of two java classes.
public class MyExample {
private MyName myNameExample = new MyName();
public MyExample() {}
public MyName getMyNameExample() {
return myNameExample;
}
public void setMyNameExample(MyName setTo) {
myNameExample = setTo;
}
}
public class MyName {
private String firstName;
public MyName() {}
public String getFirstName() {
return firstName;
}
public String setFirstName(String setTo) {
firstName = setTo;
}
}
I was trying to use something like:
<jsp:useBean id="example" class="MyExample" scope="page"/>
<jsp:setProperty name="example" property="????" value="aFirstName"/>
The important part here is that I want to reference the MyName object from within MyExample. Therefore, creating a bean to directly access MyName will not help me. So I am not looking for this answer:
<jsp:useBean id="name" class="MyName" scope="page"/>
<jsp:setProperty name="name" property="firstName" value="aFirstName"/>
| java | jsp | null | null | null | null | open | Using jsp:setProperty
===
I would like to know how to use jsp:setProperty in the following scenario. Here is a simple example of two java classes.
public class MyExample {
private MyName myNameExample = new MyName();
public MyExample() {}
public MyName getMyNameExample() {
return myNameExample;
}
public void setMyNameExample(MyName setTo) {
myNameExample = setTo;
}
}
public class MyName {
private String firstName;
public MyName() {}
public String getFirstName() {
return firstName;
}
public String setFirstName(String setTo) {
firstName = setTo;
}
}
I was trying to use something like:
<jsp:useBean id="example" class="MyExample" scope="page"/>
<jsp:setProperty name="example" property="????" value="aFirstName"/>
The important part here is that I want to reference the MyName object from within MyExample. Therefore, creating a bean to directly access MyName will not help me. So I am not looking for this answer:
<jsp:useBean id="name" class="MyName" scope="page"/>
<jsp:setProperty name="name" property="firstName" value="aFirstName"/>
| 0 |
11,439,605 | 07/11/2012 19:01:28 | 1,518,792 | 07/11/2012 18:57:39 | 1 | 0 | Yii - Create `gridview` from `multi model` and `filter` link with `multi model` | In yii,
I have 2 table:
`terms`(`**term_id**`,`name`,`slug`,`term_group`) ('01','A1','B1','C1') ('02','A2','B2','C2') ('03','A3','B3','C3') ('04','A4','B4','C4')
`term_taxonomy`(`**term_id**`,`taxonomy`,`description`,`parent`,`count`) ('01','category','','0','') ('02','category','','1','') ('03','category','','2','') ('04','category','','1','')
I want: show with `Gridview` (name,slug,taxonomy,description,parent,count) and with every column, how to `filter` (`textField`) in any column of any table
ex:
In gridview, if I filter in column parent is '1' then result: (A2,B2,category,,`**1**`,) (A4,B4,category,,`**1**`,)
End, How to organization code in model,controller and view - gridview(value and filter) to have this result .
Please help me, Thanks you very much! | gridview | model | filter | controller | yii | 07/12/2012 12:33:24 | not constructive | Yii - Create `gridview` from `multi model` and `filter` link with `multi model`
===
In yii,
I have 2 table:
`terms`(`**term_id**`,`name`,`slug`,`term_group`) ('01','A1','B1','C1') ('02','A2','B2','C2') ('03','A3','B3','C3') ('04','A4','B4','C4')
`term_taxonomy`(`**term_id**`,`taxonomy`,`description`,`parent`,`count`) ('01','category','','0','') ('02','category','','1','') ('03','category','','2','') ('04','category','','1','')
I want: show with `Gridview` (name,slug,taxonomy,description,parent,count) and with every column, how to `filter` (`textField`) in any column of any table
ex:
In gridview, if I filter in column parent is '1' then result: (A2,B2,category,,`**1**`,) (A4,B4,category,,`**1**`,)
End, How to organization code in model,controller and view - gridview(value and filter) to have this result .
Please help me, Thanks you very much! | 4 |
6,462,675 | 06/24/2011 02:18:46 | 780,848 | 06/02/2011 09:13:57 | 10 | 0 | faced some problem in sql and oracle |
1. my current system is retrieve data from sql server and insert into oracle server every 6 hours. i use own program to do this process. i want to remove the 6 hours gap, mean i hope the data can insert into 2 side at the same time, how can i do it??
2. how can i export part of the data from the database to .pdf, excel and text file format when new data insert
3. i want to know any new database backend software that can help me to manage data in sql and oracle server database | mysql | sql | oracle | null | null | 06/24/2011 11:28:36 | not a real question | faced some problem in sql and oracle
===
1. my current system is retrieve data from sql server and insert into oracle server every 6 hours. i use own program to do this process. i want to remove the 6 hours gap, mean i hope the data can insert into 2 side at the same time, how can i do it??
2. how can i export part of the data from the database to .pdf, excel and text file format when new data insert
3. i want to know any new database backend software that can help me to manage data in sql and oracle server database | 1 |
3,183,452 | 07/06/2010 04:11:24 | 384,150 | 07/06/2010 04:11:24 | 1 | 0 | common NSConnection for various data proccessing from web server in iphone | How to have common NSConnection for various data proccessing from web server in iphone. if possible can i have code for it
Regards,
sathish
| iphone | data | nsconnection | null | null | null | open | common NSConnection for various data proccessing from web server in iphone
===
How to have common NSConnection for various data proccessing from web server in iphone. if possible can i have code for it
Regards,
sathish
| 0 |
10,630,492 | 05/17/2012 05:47:44 | 1,358,524 | 04/11/2012 06:41:42 | 1 | 0 | Custom PHP plugin | Can you help me to build a plugin for custom php site?Actually I want to create a plugin in custom php and want to install it in a site,but i don't know the process how to creat this.i have developed some pluin for wordpress site but this one is different.I need to develope it with custom php code and it will be easy to install. | php | plugins | custom | null | null | 06/23/2012 21:59:39 | not a real question | Custom PHP plugin
===
Can you help me to build a plugin for custom php site?Actually I want to create a plugin in custom php and want to install it in a site,but i don't know the process how to creat this.i have developed some pluin for wordpress site but this one is different.I need to develope it with custom php code and it will be easy to install. | 1 |
3,183,192 | 07/06/2010 02:42:50 | 366,801 | 06/15/2010 00:21:47 | 15 | 2 | string to RemoteEndPoint C# by sendto | How can I convert a string to RemoteEndPoint ? | c# | casting | null | null | null | null | open | string to RemoteEndPoint C# by sendto
===
How can I convert a string to RemoteEndPoint ? | 0 |
7,083,539 | 08/16/2011 18:59:15 | 574,220 | 01/13/2011 12:39:41 | 1 | 0 | Wireless document scanner compatible with WIA or Twain or both? | Would like to know if there is any compatibility limitation for wireless document scanners w.r.t WIA and TWAIN. And how different is it interfacing a WPF app to a wireless scanner than to a flatbed USB scanner.
FYI, we could successfully interface the WPF app to a flatbed USB scanner using WIA, the same does not seem to be working with a wireless scanner.
Note: This question is in general to any wireless document scanner and not specific to any particular make. | wia | twain | null | null | null | null | open | Wireless document scanner compatible with WIA or Twain or both?
===
Would like to know if there is any compatibility limitation for wireless document scanners w.r.t WIA and TWAIN. And how different is it interfacing a WPF app to a wireless scanner than to a flatbed USB scanner.
FYI, we could successfully interface the WPF app to a flatbed USB scanner using WIA, the same does not seem to be working with a wireless scanner.
Note: This question is in general to any wireless document scanner and not specific to any particular make. | 0 |
5,138,112 | 02/28/2011 04:14:15 | 260,127 | 01/27/2010 14:03:49 | 4,689 | 30 | Getting date info into an array in Objective-C Cocoa framework. | I have a function that returns an array to hold date info.
- (NSArray*) getTodayArray
{
NSDate *today = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY"];
NSString *year = [dateFormatter stringFromDate:today];
[dateFormatter setDateFormat:@"MM"];
NSString *month = [dateFormatter stringFromDate:today];
[dateFormatter release];
NSArray *res = [NSArray arrayWithObjects: year, month, nil];
return res;
}
* Q1 : Is there any easy way to get all the info (year, month, date, hour, minute ...) in an array not using `setDateFormat` over and over again?
* Q2 : Is there a way so that I can access the content of array using `res['year']` or similar? I mean using dictionary?
* Q3 : Do I need to release `NSArray *res` in the caller of this function? | objective-c | cocoa | null | null | null | null | open | Getting date info into an array in Objective-C Cocoa framework.
===
I have a function that returns an array to hold date info.
- (NSArray*) getTodayArray
{
NSDate *today = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY"];
NSString *year = [dateFormatter stringFromDate:today];
[dateFormatter setDateFormat:@"MM"];
NSString *month = [dateFormatter stringFromDate:today];
[dateFormatter release];
NSArray *res = [NSArray arrayWithObjects: year, month, nil];
return res;
}
* Q1 : Is there any easy way to get all the info (year, month, date, hour, minute ...) in an array not using `setDateFormat` over and over again?
* Q2 : Is there a way so that I can access the content of array using `res['year']` or similar? I mean using dictionary?
* Q3 : Do I need to release `NSArray *res` in the caller of this function? | 0 |
9,049,928 | 01/29/2012 00:40:34 | 693,754 | 04/05/2011 20:52:30 | 1,033 | 45 | Finding Approximate Physical Location of Client | Is there a way to find where a client is located physically with Jquery? I have found how to get their [IP address][1], and also how to geocode their location with [geoplugin][2], but I am wondering if there are other ways to do this? I don't need an exact location. Just approximate enough to know what state they are in to estimate a tax rate before they enter their actual state. Is this possible?
[1]: http://stackoverflow.com/questions/1641868/how-to-get-client-ip-address-using-jquery
[2]: http://www.geoplugin.com/ | javascript | jquery | geocoding | null | null | null | open | Finding Approximate Physical Location of Client
===
Is there a way to find where a client is located physically with Jquery? I have found how to get their [IP address][1], and also how to geocode their location with [geoplugin][2], but I am wondering if there are other ways to do this? I don't need an exact location. Just approximate enough to know what state they are in to estimate a tax rate before they enter their actual state. Is this possible?
[1]: http://stackoverflow.com/questions/1641868/how-to-get-client-ip-address-using-jquery
[2]: http://www.geoplugin.com/ | 0 |
5,310,345 | 03/15/2011 10:26:06 | 640,657 | 03/02/2011 06:12:28 | 37 | 0 | how to install any tools gui in linux? | how to install any cppcheck gui in linux?
how to find whether the related packages installed or not in linux?
| cppcheck | null | null | null | null | 04/09/2011 03:51:58 | off topic | how to install any tools gui in linux?
===
how to install any cppcheck gui in linux?
how to find whether the related packages installed or not in linux?
| 2 |
10,558,947 | 05/11/2012 21:34:16 | 1,003,667 | 10/19/2011 16:55:33 | 1 | 2 | ORDER BY RAND() returns duplicates | I tried using distinct as well and it returns duplicates.
$cubes = mysql_query("SELECT distinct * FROM posts ORDER BY RAND() $limit ") or die(mysql_error());
I just want to take my posts table... and return it in a random order without duplicates.
| php | mysql | sql | query | null | null | open | ORDER BY RAND() returns duplicates
===
I tried using distinct as well and it returns duplicates.
$cubes = mysql_query("SELECT distinct * FROM posts ORDER BY RAND() $limit ") or die(mysql_error());
I just want to take my posts table... and return it in a random order without duplicates.
| 0 |
10,321,074 | 04/25/2012 17:53:47 | 850,010 | 07/18/2011 12:28:15 | 115 | 1 | How to structure a project in Winforms using MVP pattern? | I intend to build application with Winform and I would like to use MVP pattern.
Since I have never used MVP pattern before, I am not sure how to structure the new project.
Should I use same convention as in ASP.NET MVC like creating in the project separate folders for Models,Presenters and Views, then maybe using naming convention for Presenter classes so that their name ends with word "Presenter" (the same way the names of controllers in MVC end with "Controller")
Or should I create separate projects for Presenter and Model?
| c# | .net | winforms | mvp | projects-and-solutions | 04/25/2012 21:11:00 | not constructive | How to structure a project in Winforms using MVP pattern?
===
I intend to build application with Winform and I would like to use MVP pattern.
Since I have never used MVP pattern before, I am not sure how to structure the new project.
Should I use same convention as in ASP.NET MVC like creating in the project separate folders for Models,Presenters and Views, then maybe using naming convention for Presenter classes so that their name ends with word "Presenter" (the same way the names of controllers in MVC end with "Controller")
Or should I create separate projects for Presenter and Model?
| 4 |
7,458,146 | 09/17/2011 22:06:55 | 147,458 | 07/29/2009 22:10:32 | 803 | 21 | A way to find the size of an iPhone app store category? | I'm wondering if anyone knows of a way to determine the number of apps in an iTunes app store category?
In particular, I'm interested in the games categories since there are several of them and I'm only allowed to be in 2. Need to pick my choices wisely...
Seems like there might be a website somewhere that has this data? | iphone | ipad | itunes | itunes-store | null | 09/18/2011 00:23:39 | off topic | A way to find the size of an iPhone app store category?
===
I'm wondering if anyone knows of a way to determine the number of apps in an iTunes app store category?
In particular, I'm interested in the games categories since there are several of them and I'm only allowed to be in 2. Need to pick my choices wisely...
Seems like there might be a website somewhere that has this data? | 2 |
6,211,556 | 06/02/2011 07:12:25 | 780,672 | 06/02/2011 06:52:46 | 1 | 0 | what is the math formula behind excel cumprinc function ? i want to implement in php | I am creating a calculator and need to implement cumprinc excel formula.
Thanks in Advance
| excel | php5 | null | null | null | 06/02/2011 12:57:33 | not a real question | what is the math formula behind excel cumprinc function ? i want to implement in php
===
I am creating a calculator and need to implement cumprinc excel formula.
Thanks in Advance
| 1 |
6,380,582 | 06/17/2011 01:46:40 | 802,346 | 06/16/2011 21:42:21 | 1 | 0 | Selenium Grid - Remote Controls always being unregistered by hub | I have Selenium Grid 1.0.8 running well with the hub and several remote controls on the same machine. My testNG tests all run successfully.
When I start a remote control on a different machine, everything initially appears to be fine. The hub console shows the remote control to be available with the default environment "*firefox".
However, when I run the tests (still on the hub machine), the remote controls on the other box never work properly. They keep getting deregistered from the hub.
I've disabled the firewalls and I can ping betweeen the two boxes. Has anyone encountered similar issues?
The Remote Control Log:
[java] 21:34:19.479 WARN - Hub at http://192.168.1.129:4444/heartbeat?host=localhost&port=5539 does not have us as registered
[java] 21:34:49.496 INFO - Checking connection to hub...
[java] 21:34:49.496 INFO - Ping Hub at http://192.168.1.129:4444/heartbeat?host=localhost&port=5539
The hub log:
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
| selenium-rc | selenium-grid | null | null | null | null | open | Selenium Grid - Remote Controls always being unregistered by hub
===
I have Selenium Grid 1.0.8 running well with the hub and several remote controls on the same machine. My testNG tests all run successfully.
When I start a remote control on a different machine, everything initially appears to be fine. The hub console shows the remote control to be available with the default environment "*firefox".
However, when I run the tests (still on the hub machine), the remote controls on the other box never work properly. They keep getting deregistered from the hub.
I've disabled the firewalls and I can ping betweeen the two boxes. Has anyone encountered similar issues?
The Remote Control Log:
[java] 21:34:19.479 WARN - Hub at http://192.168.1.129:4444/heartbeat?host=localhost&port=5539 does not have us as registered
[java] 21:34:49.496 INFO - Checking connection to hub...
[java] 21:34:49.496 INFO - Ping Hub at http://192.168.1.129:4444/heartbeat?host=localhost&port=5539
The hub log:
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
| 0 |
6,087,291 | 05/22/2011 10:18:59 | 764,684 | 05/22/2011 10:13:31 | 1 | 0 | BeautifulSoup Cannot Extract Metadata | I am trying to create a function which will extract meta keywords from a given URL and return it. However no matter what URLs I pass to it, it will always fail.
def GetKeywords(url):
soup = BeautifulSoup(url)
keywords = soup.findAll('meta', attrs={'name':re.compile("^keywords$", re.I)}) #Find all meta keywords on that page
if len(keywords) == 0: #Check to see if that page has any meta keywords to begin with
print "No meta keywords for: " + str(url)
return -1
else: #If so then return them
return keywords
| python | metadata | beautifulsoup | web-scraping | null | null | open | BeautifulSoup Cannot Extract Metadata
===
I am trying to create a function which will extract meta keywords from a given URL and return it. However no matter what URLs I pass to it, it will always fail.
def GetKeywords(url):
soup = BeautifulSoup(url)
keywords = soup.findAll('meta', attrs={'name':re.compile("^keywords$", re.I)}) #Find all meta keywords on that page
if len(keywords) == 0: #Check to see if that page has any meta keywords to begin with
print "No meta keywords for: " + str(url)
return -1
else: #If so then return them
return keywords
| 0 |
3,765,273 | 09/21/2010 23:37:49 | 258,594 | 01/25/2010 16:44:36 | 115 | 8 | css a:link style text and images | I've got a quick css questions that bugging me, and I can't seem to figure out right now.
I've styled the links on my page to have a bottom border on on hover, but it the bottom border is appearing on image that have links as well and I can't figure out how to keep the border from appearing on the images.
#main p a:link, #main p a:visited, #main td a:link, #main td a:visited {
color:#7b9a04;
text-decoration:none;
}
#main p a:hover, #main td a:hover {
color:#333;
border-bottom:solid 1px #7b9a04;
}
Here's what I've tried to keep the border from appearing on the images, but I haven't had any luck.
#main p a:hover img, #main td a:hover img {
border-bottom:none;
} | css | image | coding-style | hover | border | null | open | css a:link style text and images
===
I've got a quick css questions that bugging me, and I can't seem to figure out right now.
I've styled the links on my page to have a bottom border on on hover, but it the bottom border is appearing on image that have links as well and I can't figure out how to keep the border from appearing on the images.
#main p a:link, #main p a:visited, #main td a:link, #main td a:visited {
color:#7b9a04;
text-decoration:none;
}
#main p a:hover, #main td a:hover {
color:#333;
border-bottom:solid 1px #7b9a04;
}
Here's what I've tried to keep the border from appearing on the images, but I haven't had any luck.
#main p a:hover img, #main td a:hover img {
border-bottom:none;
} | 0 |
3,182,871 | 07/06/2010 00:39:30 | 311,509 | 04/08/2010 01:12:42 | 60 | 0 | How Can i Rename All Files in a Directory using For Loop? | Here is my snippet:
#!/bin/sh
for fname in *
do
if [! -d "$fname"]
then
WHAT CAN I DO
fi
done
All new named files has to have this format O.fname - as you see preceeded by O.
Can you please help? I know i have to use mv somewhere. | bash | shell | null | null | null | null | open | How Can i Rename All Files in a Directory using For Loop?
===
Here is my snippet:
#!/bin/sh
for fname in *
do
if [! -d "$fname"]
then
WHAT CAN I DO
fi
done
All new named files has to have this format O.fname - as you see preceeded by O.
Can you please help? I know i have to use mv somewhere. | 0 |
11,337,006 | 07/05/2012 01:51:46 | 1,224,829 | 02/22/2012 03:14:22 | 3 | 0 | Importing requests error | When every I import requests I get the error "ImportError: cannot import name ssl_match_hostname"
I have no idea what to do anyone have a idea? | python | error-message | requests | null | null | 07/06/2012 12:24:12 | not a real question | Importing requests error
===
When every I import requests I get the error "ImportError: cannot import name ssl_match_hostname"
I have no idea what to do anyone have a idea? | 1 |
3,274,675 | 07/18/2010 07:16:08 | 360,890 | 06/07/2010 23:03:28 | 133 | 13 | Expanded form in C# validation toggle | I've a radio button list which expands a section of a form depending on which item is selected. While I've got this working, how do I switch off the validation for the (additional) form items when the form is not in the expanded state? Do I group the expanded section form control validations and turn off that validation group? Is that the best way to do it and if so, how do I do that in C#.net? | c# | validation | form | toggle | group | null | open | Expanded form in C# validation toggle
===
I've a radio button list which expands a section of a form depending on which item is selected. While I've got this working, how do I switch off the validation for the (additional) form items when the form is not in the expanded state? Do I group the expanded section form control validations and turn off that validation group? Is that the best way to do it and if so, how do I do that in C#.net? | 0 |
8,304,234 | 11/29/2011 00:20:37 | 519,333 | 11/24/2010 20:08:00 | 134 | 5 | Newsletter send using AJAX to avoid PHP timeout | I need to send newsletters. I have already a PHP script that sends mass emails but it won't work for long as email database is growing because of PHP max script run time.
So, to avoid it I came up with a solution: I would call my PHP script using AJAX in javascript and I will give it $_GET parameter with a count 20 so the script would sent only 20 emails. Than AJAX would receive success response, and call my script again and again till all emails are send.
Is it possible? I'm asking because I have never seen such a solution so I'm wondering if it is real (It's kinda hard to implement this into my PHP framework so I'm asking experts here first)
To sum it up here's a code skeleton:
<script>
var emailCount = 1000; //would get this from DB
var runCount = 20; //number of emails sent in one cycle
var from = 0; //start number
function sendMail(){
if(from<emailCount){
jQuery.ajaxfunction({
path: 'script.php?from='+from+'&count='+runCount
successFc: function(){
from+=runCount;
sendMail();
}
})
}
}
sendMail();
</script>
So, are there any obstacles? Thanks a lot. | php | javascript | ajax | newsletter | null | null | open | Newsletter send using AJAX to avoid PHP timeout
===
I need to send newsletters. I have already a PHP script that sends mass emails but it won't work for long as email database is growing because of PHP max script run time.
So, to avoid it I came up with a solution: I would call my PHP script using AJAX in javascript and I will give it $_GET parameter with a count 20 so the script would sent only 20 emails. Than AJAX would receive success response, and call my script again and again till all emails are send.
Is it possible? I'm asking because I have never seen such a solution so I'm wondering if it is real (It's kinda hard to implement this into my PHP framework so I'm asking experts here first)
To sum it up here's a code skeleton:
<script>
var emailCount = 1000; //would get this from DB
var runCount = 20; //number of emails sent in one cycle
var from = 0; //start number
function sendMail(){
if(from<emailCount){
jQuery.ajaxfunction({
path: 'script.php?from='+from+'&count='+runCount
successFc: function(){
from+=runCount;
sendMail();
}
})
}
}
sendMail();
</script>
So, are there any obstacles? Thanks a lot. | 0 |
4,630,370 | 01/07/2011 21:16:49 | 238,975 | 12/26/2009 22:14:44 | 70 | 0 | Php Zend Framework : Connecting to multiple databases one at a time | I have written a script that goes through my application ini.
The problem I am having now is that when I get to the next database, its still selecting from the first database and not the new one.
Is it possible to close a connection and then open a new connection while running a script. Remember this is just a script I have no bootstrap set. I just setup a autoload to that I can load my models.
While looping through sections of the ini
try {
$db = Zend_Db::factory($section->database->type, $section->database->toArray());
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
} catch(Zend_Db_Adapter_Exception $e) {
continue;
}
| php | zend-framework | zend | zend-db | null | null | open | Php Zend Framework : Connecting to multiple databases one at a time
===
I have written a script that goes through my application ini.
The problem I am having now is that when I get to the next database, its still selecting from the first database and not the new one.
Is it possible to close a connection and then open a new connection while running a script. Remember this is just a script I have no bootstrap set. I just setup a autoload to that I can load my models.
While looping through sections of the ini
try {
$db = Zend_Db::factory($section->database->type, $section->database->toArray());
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
} catch(Zend_Db_Adapter_Exception $e) {
continue;
}
| 0 |
8,177,497 | 11/18/2011 03:42:29 | 972,202 | 09/30/2011 00:26:57 | 183 | 0 | Specify parent divs opacity but make it not affect children HTML elements | I have a paragraph element inside a div. The div has an opacity of 0.3 & the paragraph has an opacity of 1.
When I show the elements, it appears the paragraph is transparent, like it has an opacity of 0.3.
**Is there a way to make the paragraph inside the div have full opacity? Maybe I can set a CSS value for this?**
<div style="opacity: 0.3; background-color: red;">
<p style="opacity: 1;">abcde</p>
</div> | javascript | html | css | null | null | null | open | Specify parent divs opacity but make it not affect children HTML elements
===
I have a paragraph element inside a div. The div has an opacity of 0.3 & the paragraph has an opacity of 1.
When I show the elements, it appears the paragraph is transparent, like it has an opacity of 0.3.
**Is there a way to make the paragraph inside the div have full opacity? Maybe I can set a CSS value for this?**
<div style="opacity: 0.3; background-color: red;">
<p style="opacity: 1;">abcde</p>
</div> | 0 |
7,879,109 | 10/24/2011 16:58:54 | 1,000,341 | 10/18/2011 03:40:22 | 5 | 0 | monitor CPU usage | I want to know the CPU usage relates to what factors. I checked the task manager and it seems whenever more threads are running CPU usage increased but why when I have my virus detection software running the CPU usage increases a lot?! Do you know any software that monitors CPU usage?
| cpu | null | null | null | null | 11/12/2011 23:31:43 | off topic | monitor CPU usage
===
I want to know the CPU usage relates to what factors. I checked the task manager and it seems whenever more threads are running CPU usage increased but why when I have my virus detection software running the CPU usage increases a lot?! Do you know any software that monitors CPU usage?
| 2 |
5,552,268 | 04/05/2011 13:03:11 | 663,755 | 03/17/2011 05:47:26 | 3 | 0 | SQLite Query in Android Application | I need a sample code to fetch data from sqlite in android application.
1. based on user id i need to display data in textview.
eg. if i give Id:1
i need to display the corresponding values in textview below.
Pls Help me with the code
Thanks in advance
Raghav Raajagopalan | android | sqlite | null | null | null | 06/23/2012 23:36:28 | not a real question | SQLite Query in Android Application
===
I need a sample code to fetch data from sqlite in android application.
1. based on user id i need to display data in textview.
eg. if i give Id:1
i need to display the corresponding values in textview below.
Pls Help me with the code
Thanks in advance
Raghav Raajagopalan | 1 |
8,066,757 | 11/09/2011 14:51:08 | 1,037,898 | 11/09/2011 14:44:55 | 1 | 0 | Forex YQL (hourly) | I would like hourly forex currency (USD/EUR) since 2011-10-01 with YQL or other API via XML or JSON. Sorry, I speak a little english. | yql | forex | null | null | null | 11/10/2011 13:43:31 | off topic | Forex YQL (hourly)
===
I would like hourly forex currency (USD/EUR) since 2011-10-01 with YQL or other API via XML or JSON. Sorry, I speak a little english. | 2 |
6,232,210 | 06/03/2011 20:17:56 | 695,101 | 04/06/2011 15:07:00 | 110 | 0 | Computer info identify for Multi-factor authentication purpose | I am developing a web-based application(.NET/C#). Due to the high secure standard, we are required to perform multi-factor authentication on the log in process. That is to say if our client log in the system through a different computer which he/she used to use, an extra function will be trigered to do the authentication. Right now, we want to store the IP address of their computers and compare their visit IP with the IP stored, if different extra authentication process is trigered. However, I am thinking just using IP address is not accurate because it could be dynamic in some situations. Then I want to use MAC address, however, it is hard to get MAC address if not in a same lan. I know some of you must have such experience. Please let me know how do you perform multi-factor authentication. Thank you for your time. | c# | .net | authentication | null | null | 06/04/2011 23:13:13 | not a real question | Computer info identify for Multi-factor authentication purpose
===
I am developing a web-based application(.NET/C#). Due to the high secure standard, we are required to perform multi-factor authentication on the log in process. That is to say if our client log in the system through a different computer which he/she used to use, an extra function will be trigered to do the authentication. Right now, we want to store the IP address of their computers and compare their visit IP with the IP stored, if different extra authentication process is trigered. However, I am thinking just using IP address is not accurate because it could be dynamic in some situations. Then I want to use MAC address, however, it is hard to get MAC address if not in a same lan. I know some of you must have such experience. Please let me know how do you perform multi-factor authentication. Thank you for your time. | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.