PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
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 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,594,353 | 07/21/2012 17:28:20 | 1,101,095 | 12/16/2011 01:41:39 | 349 | 3 | Two parameters right next to each other in a PDO query? | I have run across a problem. When I use PDO::prepare() to build a certain query, then pass parameters to execute, the query will execute correctly but one of the parameters does not seem to be inserted into the database. The prepare statement looks like this:
... SET col = :par1-:par2 ...
So what I'm trying to do is put the value "[par1]-[par2]" into the column in the database. The problem is that the first parameter is not being stored in the database, but the dash and the second parameter are. So the resulting value being stored in the database from the above query is "-[par2]".
Why would that be? | php | mysql | query | pdo | null | null | open | Two parameters right next to each other in a PDO query?
===
I have run across a problem. When I use PDO::prepare() to build a certain query, then pass parameters to execute, the query will execute correctly but one of the parameters does not seem to be inserted into the database. The prepare statement looks like this:
... SET col = :par1-:par2 ...
So what I'm trying to do is put the value "[par1]-[par2]" into the column in the database. The problem is that the first parameter is not being stored in the database, but the dash and the second parameter are. So the resulting value being stored in the database from the above query is "-[par2]".
Why would that be? | 0 |
11,594,363 | 07/21/2012 17:30:06 | 929,728 | 09/06/2011 00:18:28 | 47 | 2 | How do I avoid getting out-of-memory errors when compiling TouchDB for Android? | I'm trying to use touchDB for an Android project (https://github.com/couchbaselabs/TouchDB-Android) but when I try to compile the sample project or make one myself, it says it couldn't compile the dex because it ran out of memory or exceeded the heap size. Then Eclipse crashes, yada yada yada I end up waiting 10 minutes every time I try to change something to fix the issue.
I've got a pretty generous heap size set, and TouchDB isn't a huge project. So I think that I must be missing some critical bit of the puzzle.
Has anybody else had this problem and found a solution? I'm using Eclipse (version Juno) on a Mac. | android | couchdb | touchdb | null | null | null | open | How do I avoid getting out-of-memory errors when compiling TouchDB for Android?
===
I'm trying to use touchDB for an Android project (https://github.com/couchbaselabs/TouchDB-Android) but when I try to compile the sample project or make one myself, it says it couldn't compile the dex because it ran out of memory or exceeded the heap size. Then Eclipse crashes, yada yada yada I end up waiting 10 minutes every time I try to change something to fix the issue.
I've got a pretty generous heap size set, and TouchDB isn't a huge project. So I think that I must be missing some critical bit of the puzzle.
Has anybody else had this problem and found a solution? I'm using Eclipse (version Juno) on a Mac. | 0 |
11,594,369 | 07/21/2012 17:30:58 | 1,482,542 | 06/26/2012 11:17:19 | 63 | 2 | Selected form options | I currently have a form in which I can select a list of options from the database. I'm trying to get it to show the users selected option. It doesn't seem to be working.
<form action="include/validate.info.php" method="POST" target="ifr2">
Gender - <select name="gender">
<?php $sql = "SELECT * FROM settings_options WHERE option_type='gender'";
$query=mysql_query($sql);
while($option=mysql_fetch_array($query)){
if($option['option_value']==$user['gender']){
echo "<option value='".$option['option_value']."' selected='selected'>".$option['option_value']."</option>";
}else{
echo "<option value='".$option['option_value']."'>".$option['option_value']."</option>";}} ?> </select>
<input type="submit" value="save" class="settings_submit">
</form> | php | forms | null | null | null | 07/21/2012 18:32:13 | too localized | Selected form options
===
I currently have a form in which I can select a list of options from the database. I'm trying to get it to show the users selected option. It doesn't seem to be working.
<form action="include/validate.info.php" method="POST" target="ifr2">
Gender - <select name="gender">
<?php $sql = "SELECT * FROM settings_options WHERE option_type='gender'";
$query=mysql_query($sql);
while($option=mysql_fetch_array($query)){
if($option['option_value']==$user['gender']){
echo "<option value='".$option['option_value']."' selected='selected'>".$option['option_value']."</option>";
}else{
echo "<option value='".$option['option_value']."'>".$option['option_value']."</option>";}} ?> </select>
<input type="submit" value="save" class="settings_submit">
</form> | 3 |
11,594,379 | 07/21/2012 17:31:35 | 487,940 | 10/26/2010 18:03:57 | 143 | 6 | Creating Custom URLs in Asp.Net | I'm in the process of writing a blogging software, as a learning excercise. Everything is going well, except I'm not sure how to create user-fieldly, SEO friendly URLs.
For instance:
http://myblogsite.com/blogs/default.aspx?ID=12
should be something more user friendly:
http://myblogsite.com/blogs/how-to-create-custom-urls-in-asp-net
I did look around, but couldn't find anything helpful. I want to create a permanent url and people can share and link to on otehr websites. On existing blog applications, it is referred to as "slug", I believe. But, I'm not sure how it works in Asp.Net.
Many Thanks! | c# | asp.net | null | null | null | null | open | Creating Custom URLs in Asp.Net
===
I'm in the process of writing a blogging software, as a learning excercise. Everything is going well, except I'm not sure how to create user-fieldly, SEO friendly URLs.
For instance:
http://myblogsite.com/blogs/default.aspx?ID=12
should be something more user friendly:
http://myblogsite.com/blogs/how-to-create-custom-urls-in-asp-net
I did look around, but couldn't find anything helpful. I want to create a permanent url and people can share and link to on otehr websites. On existing blog applications, it is referred to as "slug", I believe. But, I'm not sure how it works in Asp.Net.
Many Thanks! | 0 |
11,594,381 | 07/21/2012 17:31:39 | 589,562 | 01/25/2011 19:36:19 | 114 | 3 | C# Mouse PreMove Event? | Can anyone tell me if exist an event MousePreMove with an eventargs which inform me for the cursors movement direction?
I've found a Win API to block any user input but it isn't what I'm looking for. | c# | winforms | winforms-interop | null | null | null | open | C# Mouse PreMove Event?
===
Can anyone tell me if exist an event MousePreMove with an eventargs which inform me for the cursors movement direction?
I've found a Win API to block any user input but it isn't what I'm looking for. | 0 |
11,594,388 | 07/21/2012 17:32:38 | 440,093 | 02/13/2010 15:15:43 | 1,678 | 1 | Django: How to get current URLConf rule from a view? | In a Django view, is there a name to get the name of the URLConf rule which triggered activated the view? | django | null | null | null | null | null | open | Django: How to get current URLConf rule from a view?
===
In a Django view, is there a name to get the name of the URLConf rule which triggered activated the view? | 0 |
11,350,085 | 07/05/2012 18:10:24 | 1,398,978 | 05/16/2012 15:06:40 | 6 | 0 | Custom camera Andorid preview picture is different from show picture | I am working on an Android app that uses the phone's camera and I'm using a custom code ().
The problem is that the image is showing in the preview is not correct (the image aspect ratio is not OK).
If I use the following code:
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
Camera.Parameters params = mCamera.getParameters();
List<Camera.Size> sizes = params.getSupportedPreviewSizes();
Camera.Size selected = sizes.get(0);
params.setPreviewSize(selected.width,selected.height);
mCamera.setParameters(params);
mCamera.startPreview();
the preview image is OK (I think little part of the image top and bottom is not showed), but the captured image showed after takePicture method is not showing correctly (the image aspect ratio is not OK, the image appears to be compressed into the view), even so if I save the picture to a file image appears to be OK.
Suggestions?? | android | camera | null | null | null | null | open | Custom camera Andorid preview picture is different from show picture
===
I am working on an Android app that uses the phone's camera and I'm using a custom code ().
The problem is that the image is showing in the preview is not correct (the image aspect ratio is not OK).
If I use the following code:
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
Camera.Parameters params = mCamera.getParameters();
List<Camera.Size> sizes = params.getSupportedPreviewSizes();
Camera.Size selected = sizes.get(0);
params.setPreviewSize(selected.width,selected.height);
mCamera.setParameters(params);
mCamera.startPreview();
the preview image is OK (I think little part of the image top and bottom is not showed), but the captured image showed after takePicture method is not showing correctly (the image aspect ratio is not OK, the image appears to be compressed into the view), even so if I save the picture to a file image appears to be OK.
Suggestions?? | 0 |
11,350,086 | 07/05/2012 18:10:36 | 1,462,393 | 06/17/2012 21:30:07 | 11 | 0 | pervasive sql database to ruby on rails | Hey guys i am wondering how is it possible to either sync pervasive sql to another database or directly connect it to ruby on rails?
My accounting system uses pervasive sql and at the moment i am trying to use an ODBC connection from the database to my ruby application.
I am currently working with this website:
http://odbc-rails.rubyforge.org/
Has anyone made this happen before because so far i am getting really confused with how to do the connection and get data from the remote database. | ruby-on-rails | pervasive | null | null | null | null | open | pervasive sql database to ruby on rails
===
Hey guys i am wondering how is it possible to either sync pervasive sql to another database or directly connect it to ruby on rails?
My accounting system uses pervasive sql and at the moment i am trying to use an ODBC connection from the database to my ruby application.
I am currently working with this website:
http://odbc-rails.rubyforge.org/
Has anyone made this happen before because so far i am getting really confused with how to do the connection and get data from the remote database. | 0 |
11,350,090 | 07/05/2012 18:10:58 | 84,398 | 03/29/2009 23:44:22 | 1,125 | 12 | Displaying a 3D model in JavaScript/HTML5 | I am looking at rendering a 3D model in a browser. What tools should I use/what places should I look at?
I don't know what data format the model will be, I can likely request that data to formatted in any way I want.
I am looking at [three.js][1] but it seems that it needs WebGL to work, which appears to be unsupported in IE.
Does a "cross-browser compatible HTML 3d rendering engine" exists? :)
[1]: http://mrdoob.github.com/three.js/ | javascript | html5 | 3d | webgl | null | null | open | Displaying a 3D model in JavaScript/HTML5
===
I am looking at rendering a 3D model in a browser. What tools should I use/what places should I look at?
I don't know what data format the model will be, I can likely request that data to formatted in any way I want.
I am looking at [three.js][1] but it seems that it needs WebGL to work, which appears to be unsupported in IE.
Does a "cross-browser compatible HTML 3d rendering engine" exists? :)
[1]: http://mrdoob.github.com/three.js/ | 0 |
11,350,091 | 07/05/2012 18:11:00 | 702,534 | 04/11/2011 16:22:57 | 228 | 13 | Websphere not using welcome-file-list after mapping *.html to a servlet | I am using IBM WebSphere (WAS) 7.0.0.19 to host a java-based web-app, and I needed to map the extension *.html to a particular servlet so that I could do some server-side scrubbing of user-supplied HTML files. (The server reads the file, augments it with some extra information, and serves up the modified content transparently to the person viewing the page.)
Unfortunately, when I did this, welcome-files stopped working. Previously, if I typed in the URL for a directory, the server would look for index.html and serve up that. Now, I'm just getting a 403 forbidden rule ("Forbidden - by rule."). The access logs don't show anything more--they simply state that directory indexing is forbidden by rule for the server, which is correct. I don't want the webserver to build a table of contents for directories with no index.html, but when there is an index.html, I want it to serve up that file.
My first thought was that it was trying to serve the index.html through my servlet, the servlet was failing to find the file (because the url lacked "index.html"), and therefore it thought there was no index.html. However, I put in some debug code and am quite confident that the servlet code is never getting run when I go simply to the directory itself.
I don't really care whether index.html is served through the servlet or not--in the case of this particular file, the servlet would just spit back the original file anyway. I just want index.html to be served by something.
Here is the relevant section of my web.xml
<servlet-mapping>
<servlet-name>PageScrubber</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
For what it's worth, index.htm and index.jsp were not working before the addition of the servlet mapping. Only index.html worked before. However, now none of them work.
I have used the same web.xml with two Oracle products: WebLogic (WLS) and Oracle Application Server (OAS) with no issues.
I am quite confident that it is just the addition of this scrubber servlet that has caused the problem, because removing that directive caused directory indexing to start working again.
I did find some notes about welcome-file-list not working when using an extended document root, and I tried setting com.ibm.ws.webcontainer.EnablePartialURLtoExtendedDocumentRoot to be true, but that did not seem to change anything.
I'm pretty much out of ideas. Does anyone out there have any thoughts as to why it's not finding my index.html? Thanks in advance! | websphere | web.xml | null | null | null | null | open | Websphere not using welcome-file-list after mapping *.html to a servlet
===
I am using IBM WebSphere (WAS) 7.0.0.19 to host a java-based web-app, and I needed to map the extension *.html to a particular servlet so that I could do some server-side scrubbing of user-supplied HTML files. (The server reads the file, augments it with some extra information, and serves up the modified content transparently to the person viewing the page.)
Unfortunately, when I did this, welcome-files stopped working. Previously, if I typed in the URL for a directory, the server would look for index.html and serve up that. Now, I'm just getting a 403 forbidden rule ("Forbidden - by rule."). The access logs don't show anything more--they simply state that directory indexing is forbidden by rule for the server, which is correct. I don't want the webserver to build a table of contents for directories with no index.html, but when there is an index.html, I want it to serve up that file.
My first thought was that it was trying to serve the index.html through my servlet, the servlet was failing to find the file (because the url lacked "index.html"), and therefore it thought there was no index.html. However, I put in some debug code and am quite confident that the servlet code is never getting run when I go simply to the directory itself.
I don't really care whether index.html is served through the servlet or not--in the case of this particular file, the servlet would just spit back the original file anyway. I just want index.html to be served by something.
Here is the relevant section of my web.xml
<servlet-mapping>
<servlet-name>PageScrubber</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
For what it's worth, index.htm and index.jsp were not working before the addition of the servlet mapping. Only index.html worked before. However, now none of them work.
I have used the same web.xml with two Oracle products: WebLogic (WLS) and Oracle Application Server (OAS) with no issues.
I am quite confident that it is just the addition of this scrubber servlet that has caused the problem, because removing that directive caused directory indexing to start working again.
I did find some notes about welcome-file-list not working when using an extended document root, and I tried setting com.ibm.ws.webcontainer.EnablePartialURLtoExtendedDocumentRoot to be true, but that did not seem to change anything.
I'm pretty much out of ideas. Does anyone out there have any thoughts as to why it's not finding my index.html? Thanks in advance! | 0 |
11,350,075 | 07/05/2012 18:09:35 | 1,504,823 | 07/05/2012 17:58:46 | 1 | 0 | Freeradius server monitoring tool | I have an remote authentication server, which is under Freeradius and want to monitor its health status. Anybody can help me recommend some monitoring tool for my server? | monitoring | freeradius | null | null | null | 07/07/2012 13:17:54 | off topic | Freeradius server monitoring tool
===
I have an remote authentication server, which is under Freeradius and want to monitor its health status. Anybody can help me recommend some monitoring tool for my server? | 2 |
11,350,094 | 07/05/2012 18:11:20 | 1,030,989 | 11/05/2011 10:55:16 | 51 | 2 | How can one restrict the "open with" flow to single files? | I would like to prevent multiple file ids from being sent to my app when a user clicks open...
OR i would like my app removed from the open with when multiple files are selected.
Similar to the selection of multiple native Google documents.
How can this be done? | google-drive-sdk | google-drive | null | null | null | null | open | How can one restrict the "open with" flow to single files?
===
I would like to prevent multiple file ids from being sent to my app when a user clicks open...
OR i would like my app removed from the open with when multiple files are selected.
Similar to the selection of multiple native Google documents.
How can this be done? | 0 |
11,350,096 | 07/05/2012 18:11:33 | 1,276,952 | 03/18/2012 13:47:45 | 80 | 0 | Difference b/w int p = *(int *)i and int p = *(int *)&i | The following question was asked in a recent microsoft interview.
What is the difference between the two declarations?
int p=\*(int*)i;
int p=\*(int*)&i;
i think in the first one i is a pointer and in the second one i is a variable
is there anything else? | c++ | c | null | null | null | null | open | Difference b/w int p = *(int *)i and int p = *(int *)&i
===
The following question was asked in a recent microsoft interview.
What is the difference between the two declarations?
int p=\*(int*)i;
int p=\*(int*)&i;
i think in the first one i is a pointer and in the second one i is a variable
is there anything else? | 0 |
11,350,097 | 07/05/2012 18:11:36 | 413,174 | 08/06/2010 14:50:58 | 1,406 | 17 | asp.net authentication for any third party | I would like to make the user to be able of logging to my website using any accounts: facebook, yahoo, windows live, ...
It is something like stackoverflow account authentication.
I need to do it with asp.net (.NET). how can I do that?
Thanks in advance. | c# | asp.net | null | null | null | null | open | asp.net authentication for any third party
===
I would like to make the user to be able of logging to my website using any accounts: facebook, yahoo, windows live, ...
It is something like stackoverflow account authentication.
I need to do it with asp.net (.NET). how can I do that?
Thanks in advance. | 0 |
11,089,487 | 06/18/2012 19:12:37 | 9,858 | 09/15/2008 20:13:40 | 122 | 7 | Autofac modules with their own dependencies | I'm struggling with how to organize my Autofac component registrations in modules given that some of the modules themselves have dependencies.
I've implemented an abstraction of configuration data (_i.e._ web.config) in an interface:
interface IConfigurationProvider
{ ... }
along with implementations for ASP.NET (`WebConfigurationProvider`) and "desktop" applications (`ExeConfigurationProvider`).
Some of my autofac modules then require an `IConfigurationProvider` as a constructor parameter, but some don't:
class DependentModule : Module
{
public DependentModule(IConfigurationProvider config)
{
_config = config;
}
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType(_config.TypeFromConfig);
}
private readonly IConfigurationProvider _config;
}
class IndependentModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.Register(/* other stuff not based on configuration */);
}
}
Since the `RegisterType()` extension method doesn't accept a registration delegate (`Func<IComponentContext, T>`), like `Register()` does, I can't register the `IConfigurationProvider` up-front and then resolve it when I go to register the type specified in the configuration, something like:
// this would be nice...
builder.RegisterType(c => c.Resolve<IConfigurationProvider>().TypeFromConfig);
This means that I need to be able to register modules **with and without** a dependency on `IConfigurationProvider`.
It's obvious how to manually instantiate each module and register it:
IConfigurationProvider configProvider = ...;
var builder = new ContainerBuilder();
builder.RegisterModule(new DependentModule(configProvider));
builder.RegisterModule(new IndependentModule());
using (var container = builder.Build())
{
...
}
But I don't want to manually instantiate my modules - I want to scan assemblies for modules and register them automatically (as discussed [in this question](http://stackoverflow.com/questions/10018831/autofac-module-scanning-for-various-applications)). So I have to use reflection to scan the assembly for `IModule` types, and use `Activator.CreateInstance` to make registerable instances. But how do I know whether or not to pass an `IConfigurationProvider` as a constructor parameter. And what happens when other modules have additional or different dependencies?
There's got to be a more straightforward way of accomplishing the basic task: register a type specified in some configuration provided via an interface, right? So how do I do that? | autofac | autofac-scanning | null | null | null | null | open | Autofac modules with their own dependencies
===
I'm struggling with how to organize my Autofac component registrations in modules given that some of the modules themselves have dependencies.
I've implemented an abstraction of configuration data (_i.e._ web.config) in an interface:
interface IConfigurationProvider
{ ... }
along with implementations for ASP.NET (`WebConfigurationProvider`) and "desktop" applications (`ExeConfigurationProvider`).
Some of my autofac modules then require an `IConfigurationProvider` as a constructor parameter, but some don't:
class DependentModule : Module
{
public DependentModule(IConfigurationProvider config)
{
_config = config;
}
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType(_config.TypeFromConfig);
}
private readonly IConfigurationProvider _config;
}
class IndependentModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.Register(/* other stuff not based on configuration */);
}
}
Since the `RegisterType()` extension method doesn't accept a registration delegate (`Func<IComponentContext, T>`), like `Register()` does, I can't register the `IConfigurationProvider` up-front and then resolve it when I go to register the type specified in the configuration, something like:
// this would be nice...
builder.RegisterType(c => c.Resolve<IConfigurationProvider>().TypeFromConfig);
This means that I need to be able to register modules **with and without** a dependency on `IConfigurationProvider`.
It's obvious how to manually instantiate each module and register it:
IConfigurationProvider configProvider = ...;
var builder = new ContainerBuilder();
builder.RegisterModule(new DependentModule(configProvider));
builder.RegisterModule(new IndependentModule());
using (var container = builder.Build())
{
...
}
But I don't want to manually instantiate my modules - I want to scan assemblies for modules and register them automatically (as discussed [in this question](http://stackoverflow.com/questions/10018831/autofac-module-scanning-for-various-applications)). So I have to use reflection to scan the assembly for `IModule` types, and use `Activator.CreateInstance` to make registerable instances. But how do I know whether or not to pass an `IConfigurationProvider` as a constructor parameter. And what happens when other modules have additional or different dependencies?
There's got to be a more straightforward way of accomplishing the basic task: register a type specified in some configuration provided via an interface, right? So how do I do that? | 0 |
11,349,929 | 07/05/2012 18:00:29 | 292,808 | 03/13/2010 04:50:07 | 154 | 17 | Need help tuning sql query | My mysql DB has become CPU hungry trying to execute a particularly slow query. When I do an explain, mysql says "Using where; Using temporary; Using filesort". Please help deciphering and solving this puzzle.
Table structure:
CREATE TABLE `topsources` (
`USER_ID` varchar(255) NOT NULL,
`UPDATED_TIME` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`URL_ID` int(11) NOT NULL,
`SOURCE_SLUG` varchar(100) NOT NULL,
`FEED_PAGE_URL` varchar(255) NOT NULL,
`CATEGORY_SLUG` varchar(100) NOT NULL,
`REFERRER` varchar(2048) DEFAULT NULL,
PRIMARY KEY (`USER_ID`,`DATE_AND_HOUR`(30),`ITEM_ID`),
KEY `USER_ID` (`USER_ID`),
KEY `FEED_PAGE_URL` (`FEED_PAGE_URL`),
KEY `SOURCE_SLUG` (`SOURCE_SLUG`),
KEY `CATEGORY_SLUG` (`CATEGORY_SLUG`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
The table has 370K rows...sometimes higher. The below query takes 10+ seconds.
SELECT topsources.SOURCE_SLUG, COUNT(topsources.SOURCE_SLUG) AS VIEW_COUNT FROM topsources WHERE CATEGORY_SLUG = '/newssource' GROUP BY topsources.SOURCE_SLUG HAVING MAX(CASE WHEN topsources.USER_ID = 'xxxx' THEN 1 ELSE 0 END) = 0 ORDER BY VIEW_COUNT DESC;
Is there a way to improve this query? Also, are there any mysql settings that can help in reducing CPU load? I can allocate more memory that's available on my server. | mysql | sql | tuning | null | null | null | open | Need help tuning sql query
===
My mysql DB has become CPU hungry trying to execute a particularly slow query. When I do an explain, mysql says "Using where; Using temporary; Using filesort". Please help deciphering and solving this puzzle.
Table structure:
CREATE TABLE `topsources` (
`USER_ID` varchar(255) NOT NULL,
`UPDATED_TIME` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`URL_ID` int(11) NOT NULL,
`SOURCE_SLUG` varchar(100) NOT NULL,
`FEED_PAGE_URL` varchar(255) NOT NULL,
`CATEGORY_SLUG` varchar(100) NOT NULL,
`REFERRER` varchar(2048) DEFAULT NULL,
PRIMARY KEY (`USER_ID`,`DATE_AND_HOUR`(30),`ITEM_ID`),
KEY `USER_ID` (`USER_ID`),
KEY `FEED_PAGE_URL` (`FEED_PAGE_URL`),
KEY `SOURCE_SLUG` (`SOURCE_SLUG`),
KEY `CATEGORY_SLUG` (`CATEGORY_SLUG`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
The table has 370K rows...sometimes higher. The below query takes 10+ seconds.
SELECT topsources.SOURCE_SLUG, COUNT(topsources.SOURCE_SLUG) AS VIEW_COUNT FROM topsources WHERE CATEGORY_SLUG = '/newssource' GROUP BY topsources.SOURCE_SLUG HAVING MAX(CASE WHEN topsources.USER_ID = 'xxxx' THEN 1 ELSE 0 END) = 0 ORDER BY VIEW_COUNT DESC;
Is there a way to improve this query? Also, are there any mysql settings that can help in reducing CPU load? I can allocate more memory that's available on my server. | 0 |
11,350,099 | 07/05/2012 18:11:39 | 1,456,235 | 06/14/2012 12:44:14 | 3 | 0 | Update a datetime variable in mysql | Im trying to update my mysql-database with a DateTime-Variable.
$interval = 'P' . $days . 'DT' . $hours. 'H' . $minutes. 'M' . $seconds . 'S' ;
$date = new DateTime("NOW");
$date->add(new DateInterval($interval));
Now the sql-update:
$query = "UPDATE table
SET table.table_date = '$date' ";
mysql_query($query);
mysql_query($query);
If I vardump the $date-variable, it shows the right properties
object(DateTime)#4 (3) { ["date"]=> string(19) "2012-07-05 20:04:14" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
but it just wont be inserted. If I try NOW() instead of $date, it works perfectly. Whats my mistake? | php | mysql | datetime | null | null | null | open | Update a datetime variable in mysql
===
Im trying to update my mysql-database with a DateTime-Variable.
$interval = 'P' . $days . 'DT' . $hours. 'H' . $minutes. 'M' . $seconds . 'S' ;
$date = new DateTime("NOW");
$date->add(new DateInterval($interval));
Now the sql-update:
$query = "UPDATE table
SET table.table_date = '$date' ";
mysql_query($query);
mysql_query($query);
If I vardump the $date-variable, it shows the right properties
object(DateTime)#4 (3) { ["date"]=> string(19) "2012-07-05 20:04:14" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
but it just wont be inserted. If I try NOW() instead of $date, it works perfectly. Whats my mistake? | 0 |
11,270,028 | 06/29/2012 23:09:00 | 1,022,851 | 10/31/2011 23:06:25 | 32 | 2 | Ajax/Rails Nested Comments | I have an application where book_comments belongs_to books.
My routes file :
resources :books do
resources :book_comments
end
I have a book_comment form on show.html.erb for books.
def show
@book = Book.find(params[:id])
@new_book_comment = @book.book_comments.build
end
I'm using ajax to post the book_comments to the book show page via a partial: _book_comment_form.html.erb :
<%= form_for([@book, @new_book_comment], remote: :true) do |f| %>
<div class="field" style="margin-top:60px;">
<%= f.text_area :comment, rows: 3 %>
<%= f.submit "Add Comment" %>
</div>
<% end %>
When @new_book_comment is called it refers to a book_comments_controller create action:
def create
@book = Book.find(params[:book_id])
@book_comment = current_user.book_comments.build(params[:book_comment]) do |f|
f.book_id = @book.id
end
if @book_comment.save
respond_to do |format|
format.html { redirect_to @book }
format.js { render :layout => false }
end
end
end
The book_comment is saved but my problem comes in when trying to render via ajax in the _book_comments partial:
<div id="comments">
<% @book_comments.each do |book_comment| %>
<%= render 'comment', :book_comment => comment %>
</div>
<% end %>
</div>
via: create.js.erb in the book_comments folder
$("div#comments").append("<%= escape_javascript(render('books/comment'))%>")
To sum, I'm having trouble making the create.js.erb in book_comments render to the book show page. Why wouldn't create.js.erb in the book_comments folder know to look at the objects in the <div id="comments"> and infer the new book comment should go inside the div?
My error message:
undefined method `comment' for nil:NilClass
don't understnd why. Seeing that I'm passing the instance variable to the comment partial. | javascript | ruby-on-rails | ajax | null | null | null | open | Ajax/Rails Nested Comments
===
I have an application where book_comments belongs_to books.
My routes file :
resources :books do
resources :book_comments
end
I have a book_comment form on show.html.erb for books.
def show
@book = Book.find(params[:id])
@new_book_comment = @book.book_comments.build
end
I'm using ajax to post the book_comments to the book show page via a partial: _book_comment_form.html.erb :
<%= form_for([@book, @new_book_comment], remote: :true) do |f| %>
<div class="field" style="margin-top:60px;">
<%= f.text_area :comment, rows: 3 %>
<%= f.submit "Add Comment" %>
</div>
<% end %>
When @new_book_comment is called it refers to a book_comments_controller create action:
def create
@book = Book.find(params[:book_id])
@book_comment = current_user.book_comments.build(params[:book_comment]) do |f|
f.book_id = @book.id
end
if @book_comment.save
respond_to do |format|
format.html { redirect_to @book }
format.js { render :layout => false }
end
end
end
The book_comment is saved but my problem comes in when trying to render via ajax in the _book_comments partial:
<div id="comments">
<% @book_comments.each do |book_comment| %>
<%= render 'comment', :book_comment => comment %>
</div>
<% end %>
</div>
via: create.js.erb in the book_comments folder
$("div#comments").append("<%= escape_javascript(render('books/comment'))%>")
To sum, I'm having trouble making the create.js.erb in book_comments render to the book show page. Why wouldn't create.js.erb in the book_comments folder know to look at the objects in the <div id="comments"> and infer the new book comment should go inside the div?
My error message:
undefined method `comment' for nil:NilClass
don't understnd why. Seeing that I'm passing the instance variable to the comment partial. | 0 |
11,471,996 | 07/13/2012 13:59:13 | 1,326,676 | 04/11/2012 13:16:11 | 29 | 2 | Error reading Json from PHP inro C# | I'm receiving this error when trying to read a JObject in C# from PHP, it is the result of a basic query "SELECT * FROM items"...
"Unexpected character encountered while parsing value: S. Path '', line 0, position 0."
PHP
$query = ($_POST["test"]);
if ($result = $mysqli->query($query))
{
$jsonResult = json_encode($result);
}
echo $jsonResult;
C#
public JObject GetThat()
{
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
Stream Answer = WebResp.GetResponseStream();
string phpResponse = Answer.ToString();
JObject myResult = JObject.Parse(phpResponse);
return myResult;
}
What am I doing wrong? Thanks. | c# | php | json | null | null | null | open | Error reading Json from PHP inro C#
===
I'm receiving this error when trying to read a JObject in C# from PHP, it is the result of a basic query "SELECT * FROM items"...
"Unexpected character encountered while parsing value: S. Path '', line 0, position 0."
PHP
$query = ($_POST["test"]);
if ($result = $mysqli->query($query))
{
$jsonResult = json_encode($result);
}
echo $jsonResult;
C#
public JObject GetThat()
{
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
Stream Answer = WebResp.GetResponseStream();
string phpResponse = Answer.ToString();
JObject myResult = JObject.Parse(phpResponse);
return myResult;
}
What am I doing wrong? Thanks. | 0 |
11,471,997 | 07/13/2012 13:59:14 | 583,638 | 01/20/2011 21:31:37 | 15 | 0 | How can you access the RavenDB Management Studio when you have an embedded instance in a WPF application? | I'm writing a simple WPF application that will use embedded RavenDB as it's datastore. I got everything needed to get RavenDB working via NuGet (including the Xap file for Management Studio), however, it is not clear how to make use of the Xap file in this situation.
Has anyone managed to make use of the Management Studio in the super simple situation of an embedded instance in a WPF application without jumping through hoops, creating a hosting site on your box in which to place the Xap? | ravendb | null | null | null | null | null | open | How can you access the RavenDB Management Studio when you have an embedded instance in a WPF application?
===
I'm writing a simple WPF application that will use embedded RavenDB as it's datastore. I got everything needed to get RavenDB working via NuGet (including the Xap file for Management Studio), however, it is not clear how to make use of the Xap file in this situation.
Has anyone managed to make use of the Management Studio in the super simple situation of an embedded instance in a WPF application without jumping through hoops, creating a hosting site on your box in which to place the Xap? | 0 |
11,471,999 | 07/13/2012 13:59:42 | 1,417,494 | 05/25/2012 13:23:59 | 103 | 10 | Facebook Page likes | I know that the count that is shown by the Like button social plugin is made up of:
- The number of likes of this URL
- The number of shares of this URL
(this includes copy/pasting a link back to Facebook)
- The number of
likes and comments on stories on Facebook about this URL
- The number of inbox messages containing this URL as an attachment.
Does anyone know for certain if the **Page like count**, as accessible from [this kind of call][1], is also made up of the above rules or is it a pure Like count only (i.e. only counts people clicking the Like button of the Page)?
Cheers!
Lee
[1]: https://graph.facebook.com/cocacola | facebook | facebook-like | page | null | null | null | open | Facebook Page likes
===
I know that the count that is shown by the Like button social plugin is made up of:
- The number of likes of this URL
- The number of shares of this URL
(this includes copy/pasting a link back to Facebook)
- The number of
likes and comments on stories on Facebook about this URL
- The number of inbox messages containing this URL as an attachment.
Does anyone know for certain if the **Page like count**, as accessible from [this kind of call][1], is also made up of the above rules or is it a pure Like count only (i.e. only counts people clicking the Like button of the Page)?
Cheers!
Lee
[1]: https://graph.facebook.com/cocacola | 0 |
11,472,000 | 07/13/2012 13:59:44 | 1,133,306 | 01/05/2012 23:50:22 | 386 | 9 | magento custom url rewrites to .html for cms pages | I am moving an ecommerce site into magento and would like to preserve as many indexed links as possible. For example: the about page's url is `domain.com/about.html`. Magento writes the url as `domain.com/about`. If I add a custom rewrite and force the .html to be re-written to the end I get a 404 page not found error.
Is what I am trying to do possible? I have also tried re-indexing the store and that did not help. | url | magento | url-rewriting | null | null | null | open | magento custom url rewrites to .html for cms pages
===
I am moving an ecommerce site into magento and would like to preserve as many indexed links as possible. For example: the about page's url is `domain.com/about.html`. Magento writes the url as `domain.com/about`. If I add a custom rewrite and force the .html to be re-written to the end I get a 404 page not found error.
Is what I am trying to do possible? I have also tried re-indexing the store and that did not help. | 0 |
11,472,002 | 07/13/2012 13:59:57 | 1,479,585 | 06/25/2012 09:50:30 | 3 | 0 | Null Pointer Exception of MapView | I've been trying to find the cause of this error:
>07-13 23:44:06.715: E/AndroidRuntime(2932): FATAL EXCEPTION: main
07-13 23:44:06.715: E/AndroidRuntime(2932): java.lang.NullPointerException
07-13 23:44:06.715: E/AndroidRuntime(2932): at android.app.Activity.findViewById(Activity.java:1825)
07-13 23:44:06.715: E/AndroidRuntime(2932): at com.example.usignasync.MainActivity.runOverlaysAgain(MainActivity.java:141)
My aim is to reload some map overlays when the location of the GPS changes, so I have the GPS set up and onLocationChanged() called runOverlaysAgain(), however it never seems to be able to add overlays outside of onCreate() and I can't figure out why. The variable mapView is declared outside of any functions but instantiated in onCreate() but for some reason still returns null. Below is runOverlaysAgain() and the second line is line 141 as mentioned in the error:
protected void runOverlaysAgain(){
mapView = (MapView) findViewById(R.id.mapview);
mapOverlays = mapView.getOverlays();
Log.d("A", Integer.toString(mapOverlays.size()));
mapOverlays.clear();
String latitude;
String longitude;
if(lastKnownLocation!=null){
latitude = GPSTracker.yourLocation.substring(3,GPSTracker.yourLocation.indexOf("Long"));
longitude = GPSTracker.yourLocation.substring(GPSTracker.yourLocation.indexOf("Long")+4, GPSTracker.yourLocation.length());
}
else{
latitude="92000";
longitude ="92000";
}
A lot of the re-declarations were just me trying to figure out what was going on, to no prevail. They can be removed and a similar error will be generated again. So there are two possible things I need, either how to fix this error or how to create mapOverlays outside of onCreate(). Any help is appreciated, thank you. | java | android | google-maps | null | null | null | open | Null Pointer Exception of MapView
===
I've been trying to find the cause of this error:
>07-13 23:44:06.715: E/AndroidRuntime(2932): FATAL EXCEPTION: main
07-13 23:44:06.715: E/AndroidRuntime(2932): java.lang.NullPointerException
07-13 23:44:06.715: E/AndroidRuntime(2932): at android.app.Activity.findViewById(Activity.java:1825)
07-13 23:44:06.715: E/AndroidRuntime(2932): at com.example.usignasync.MainActivity.runOverlaysAgain(MainActivity.java:141)
My aim is to reload some map overlays when the location of the GPS changes, so I have the GPS set up and onLocationChanged() called runOverlaysAgain(), however it never seems to be able to add overlays outside of onCreate() and I can't figure out why. The variable mapView is declared outside of any functions but instantiated in onCreate() but for some reason still returns null. Below is runOverlaysAgain() and the second line is line 141 as mentioned in the error:
protected void runOverlaysAgain(){
mapView = (MapView) findViewById(R.id.mapview);
mapOverlays = mapView.getOverlays();
Log.d("A", Integer.toString(mapOverlays.size()));
mapOverlays.clear();
String latitude;
String longitude;
if(lastKnownLocation!=null){
latitude = GPSTracker.yourLocation.substring(3,GPSTracker.yourLocation.indexOf("Long"));
longitude = GPSTracker.yourLocation.substring(GPSTracker.yourLocation.indexOf("Long")+4, GPSTracker.yourLocation.length());
}
else{
latitude="92000";
longitude ="92000";
}
A lot of the re-declarations were just me trying to figure out what was going on, to no prevail. They can be removed and a similar error will be generated again. So there are two possible things I need, either how to fix this error or how to create mapOverlays outside of onCreate(). Any help is appreciated, thank you. | 0 |
11,472,005 | 07/13/2012 14:00:07 | 1,367,801 | 05/01/2012 13:13:48 | 1 | 1 | Disable output caching on individual web part (MOSS 2007) | We run our external website on Sharepoint 2007, and all the content is pulled from list data and generated using C# web parts.
Here is my problem: I have a web part on the home page that displays a random header banner on every page load. Unfortunately, Sharepoint seems to be caching this header and showing the same image every time, rather than randomizing it. I know this because the web part works properly for logged in users, and we've told SP to disable output caching for logged in users.
I would like to keep output caching enabled for anonymous users, but somehow tell sharepoint not to cache this particular web part. I know there's a way to do this, but it seems like there are so many different ways to approach caching and I don't know which one will work. I should note, I've tried using the PartCacheInvalidate method within the web part code, with no luck. Any ideas? | asp.net | caching | sharepoint2007 | webparts | null | null | open | Disable output caching on individual web part (MOSS 2007)
===
We run our external website on Sharepoint 2007, and all the content is pulled from list data and generated using C# web parts.
Here is my problem: I have a web part on the home page that displays a random header banner on every page load. Unfortunately, Sharepoint seems to be caching this header and showing the same image every time, rather than randomizing it. I know this because the web part works properly for logged in users, and we've told SP to disable output caching for logged in users.
I would like to keep output caching enabled for anonymous users, but somehow tell sharepoint not to cache this particular web part. I know there's a way to do this, but it seems like there are so many different ways to approach caching and I don't know which one will work. I should note, I've tried using the PartCacheInvalidate method within the web part code, with no luck. Any ideas? | 0 |
11,472,009 | 07/13/2012 14:00:17 | 1,523,729 | 07/13/2012 13:47:11 | 1 | 0 | SSRS 2008 R2 Drill Down On-Demand to Sub Report | In SSRS 2008 R2, I was under the impression that a drill down to a sub-report would query the data on-demand.
This isn't the case when my report gets rendered.
Specifically, I have a Tablix that initially loads rows grouped by Person.
When someone clicks the drilldown icon on that Person, a subreport displays some more data pertinent to that Person.
The problem here is that every subreport is being loaded initially when the main report is being rendered. This takes forever to load. But if I remove the subreport, just for testing purposes, the report loads almost instantly.
I've tried setting the visibility of the subreport to Hide initially, then Show when the user drills down, but it didn't change anything.
I read a similar question on stackoverflow, but the answer was to use Drill-Throughs instead.
This unfortunately isn't an option in my case.
Any suggestions?
| reporting-services | ssrs-2008 | subreport | ssrs-tablix | ondemand | null | open | SSRS 2008 R2 Drill Down On-Demand to Sub Report
===
In SSRS 2008 R2, I was under the impression that a drill down to a sub-report would query the data on-demand.
This isn't the case when my report gets rendered.
Specifically, I have a Tablix that initially loads rows grouped by Person.
When someone clicks the drilldown icon on that Person, a subreport displays some more data pertinent to that Person.
The problem here is that every subreport is being loaded initially when the main report is being rendered. This takes forever to load. But if I remove the subreport, just for testing purposes, the report loads almost instantly.
I've tried setting the visibility of the subreport to Hide initially, then Show when the user drills down, but it didn't change anything.
I read a similar question on stackoverflow, but the answer was to use Drill-Throughs instead.
This unfortunately isn't an option in my case.
Any suggestions?
| 0 |
11,650,620 | 07/25/2012 13:18:30 | 801,434 | 06/16/2011 12:22:47 | 2,351 | 162 | JSF 2.0: data not updated before the view is rendered | In my application, I have the following beans:
@Named(value = "mrBean")
@SessionScoped
public class MrBean implements Serializable {
@EJB
private MrsBean mrsBean;
private Item item;
public void updateItem() {
this.item = mrsBean.updateItem(item.getId());
}
}
@Named(value = "itemBean")
@RequestScoped
public class itemBean {
@Inject
private MrBean mrBean;
@PostConstruct
public void init() {
if (FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("update") != null) mrBean.updateItem();
}
}
Before showing the item's information on the `ViewItem.xhtml` page, I will check if the `update` parameter is submitted to update the item before showing.
When I test the page with the parameter `update=true`, I have no idea why the old data was rendered instead of the new updated one. In fact, I have to refresh the page before the new data is rendered.
From the above result, I wonder if the `@PostConstruct` method was called after the view was rendered.
I'd be very grateful if you could give me an advice.
Best regards,
| java | jsf-2.0 | updates | null | null | null | open | JSF 2.0: data not updated before the view is rendered
===
In my application, I have the following beans:
@Named(value = "mrBean")
@SessionScoped
public class MrBean implements Serializable {
@EJB
private MrsBean mrsBean;
private Item item;
public void updateItem() {
this.item = mrsBean.updateItem(item.getId());
}
}
@Named(value = "itemBean")
@RequestScoped
public class itemBean {
@Inject
private MrBean mrBean;
@PostConstruct
public void init() {
if (FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("update") != null) mrBean.updateItem();
}
}
Before showing the item's information on the `ViewItem.xhtml` page, I will check if the `update` parameter is submitted to update the item before showing.
When I test the page with the parameter `update=true`, I have no idea why the old data was rendered instead of the new updated one. In fact, I have to refresh the page before the new data is rendered.
From the above result, I wonder if the `@PostConstruct` method was called after the view was rendered.
I'd be very grateful if you could give me an advice.
Best regards,
| 0 |
11,650,564 | 07/25/2012 13:15:40 | 1,260,472 | 03/10/2012 01:47:07 | 30 | 1 | how to programmatically make a function opened by exactly one process? | I have a device driver and I want it to be opened by only one process exactly.
What structures do I have to use to actually set this property?
Freebsd OS, C language, Kernel Device drivers
Any tips on it? | kernel | device-driver | freebsd | null | null | null | open | how to programmatically make a function opened by exactly one process?
===
I have a device driver and I want it to be opened by only one process exactly.
What structures do I have to use to actually set this property?
Freebsd OS, C language, Kernel Device drivers
Any tips on it? | 0 |
11,650,565 | 07/25/2012 13:15:43 | 1,338,124 | 04/17/2012 07:41:09 | 1 | 1 | ajax update not working inside ui:composition | When I fully insert the form in the main page it works, but when I use ui:include it doesn't.
<!-- Main JSF -->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<ui:include src="main.xhtml" />
</h:body>
</html>
<!-- to be included -->
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:form>
<h:outputLabel value="ID" for="userId" />
<p:inputText value="#{managedEmployee.userId}" />
<p:commandButton value="Show" update="result" />
<p:panel id="result">
<h:outputText value="#{managedEmployee.userId}" />
</p:panel>
</h:form>
</ui:composition>
Hope this explains my intentions.
I've been searching for an answer the whole day but without success. Thanks in advance. | primefaces | null | null | null | null | null | open | ajax update not working inside ui:composition
===
When I fully insert the form in the main page it works, but when I use ui:include it doesn't.
<!-- Main JSF -->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<ui:include src="main.xhtml" />
</h:body>
</html>
<!-- to be included -->
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:form>
<h:outputLabel value="ID" for="userId" />
<p:inputText value="#{managedEmployee.userId}" />
<p:commandButton value="Show" update="result" />
<p:panel id="result">
<h:outputText value="#{managedEmployee.userId}" />
</p:panel>
</h:form>
</ui:composition>
Hope this explains my intentions.
I've been searching for an answer the whole day but without success. Thanks in advance. | 0 |
11,650,514 | 07/25/2012 13:13:14 | 1,551,550 | 07/25/2012 12:17:23 | 1 | 0 | Java Code to Run JIRA Jelly Script | This is my Jelly Script to perform IssueLinking in Jira 4.2...This works fine when trying to ru directly in Jira4.2.
<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib">
<jira:Login username="jiraloginname" password="jirapwd">
<jira:LinkIssue key="issuekey1" linkKey="issuekey2" linkDesc="duplicates"/>
</jira:Login>
</JiraJelly>
This is my Java Code to call the JellyScript and Execute. But this throws some exception.
JellyContext context = new JellyContext();
Writer objWriter = new StringWriter();
XMLWriter xmlWriter = new XMLWriter(objWriter);
XMLOutput objOut = XMLOutput.createXMLOutput(objWriter);
context.runScript("IssueLinking-Jelly.jelly", objOut);
When this code is executed, the following exceptions are caught.
org.apache.commons.jelly.JellyTagException: <jira:Login> com.atlassian.jira.jelly.tag.login.Login doesn't have any satisfiable constructors. Unsatisfiable dependencies: [[interface com.atlassian.jira.security.JiraAuthenticationContext]]
Caused by: org.picocontainer.defaults.UnsatisfiableDependenciesException: com.atlassian.jira.jelly.tag.login.Login doesn't have any satisfiable constructors. Unsatisfiable dependencies: [[interface com.atlassian.jira.security.JiraAuthenticationContext]]
| java | jira | jelly | null | null | null | open | Java Code to Run JIRA Jelly Script
===
This is my Jelly Script to perform IssueLinking in Jira 4.2...This works fine when trying to ru directly in Jira4.2.
<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib">
<jira:Login username="jiraloginname" password="jirapwd">
<jira:LinkIssue key="issuekey1" linkKey="issuekey2" linkDesc="duplicates"/>
</jira:Login>
</JiraJelly>
This is my Java Code to call the JellyScript and Execute. But this throws some exception.
JellyContext context = new JellyContext();
Writer objWriter = new StringWriter();
XMLWriter xmlWriter = new XMLWriter(objWriter);
XMLOutput objOut = XMLOutput.createXMLOutput(objWriter);
context.runScript("IssueLinking-Jelly.jelly", objOut);
When this code is executed, the following exceptions are caught.
org.apache.commons.jelly.JellyTagException: <jira:Login> com.atlassian.jira.jelly.tag.login.Login doesn't have any satisfiable constructors. Unsatisfiable dependencies: [[interface com.atlassian.jira.security.JiraAuthenticationContext]]
Caused by: org.picocontainer.defaults.UnsatisfiableDependenciesException: com.atlassian.jira.jelly.tag.login.Login doesn't have any satisfiable constructors. Unsatisfiable dependencies: [[interface com.atlassian.jira.security.JiraAuthenticationContext]]
| 0 |
11,650,518 | 07/25/2012 13:13:25 | 1,441,404 | 06/07/2012 05:55:44 | 156 | 0 | Error :java.lang.UnsupportedOperationException: No image data is available when using App Engine's BlobStore and Image API | I need to retrieve the height and width of uploaded image using App Engine BlobStore. For finding that i used following code :
try {
Image im = ImagesServiceFactory.makeImageFromBlob(blobKey);
if (im.getHeight() == ht && im.getWidth() == wd) {
flag = true;
}
} catch (UnsupportedOperationException e) {
}
i can upload the image and generate the BlobKey but when pass the Blobkey to makeImageFromBlob(), it generate the following error :**java.lang.UnsupportedOperationException: No image data is available** . How to solve this problem or any other way to find image height and width directly from BlobKey. | image | google-app-engine | file-upload | blobstore | null | null | open | Error :java.lang.UnsupportedOperationException: No image data is available when using App Engine's BlobStore and Image API
===
I need to retrieve the height and width of uploaded image using App Engine BlobStore. For finding that i used following code :
try {
Image im = ImagesServiceFactory.makeImageFromBlob(blobKey);
if (im.getHeight() == ht && im.getWidth() == wd) {
flag = true;
}
} catch (UnsupportedOperationException e) {
}
i can upload the image and generate the BlobKey but when pass the Blobkey to makeImageFromBlob(), it generate the following error :**java.lang.UnsupportedOperationException: No image data is available** . How to solve this problem or any other way to find image height and width directly from BlobKey. | 0 |
11,650,627 | 07/25/2012 13:18:49 | 1,141,346 | 01/10/2012 16:45:28 | 71 | 2 | jquery set element hover | I have a page with 6 menu buttons. Each button has he's own background for hover event (CSS). Everything works fine, but now I want to make that when I'm selecting a page, I want to make that background static. Is it possible to make it with javascript? This would help the visitor to know what type of buttons he was selected.
If you don't get what I mean, I'll wrote a small code in jquery (is this just an example):
$(document).ready(function(){
$("#button-index1").makeItStaticBackground();
});
| javascript | jquery | static | hover | null | null | open | jquery set element hover
===
I have a page with 6 menu buttons. Each button has he's own background for hover event (CSS). Everything works fine, but now I want to make that when I'm selecting a page, I want to make that background static. Is it possible to make it with javascript? This would help the visitor to know what type of buttons he was selected.
If you don't get what I mean, I'll wrote a small code in jquery (is this just an example):
$(document).ready(function(){
$("#button-index1").makeItStaticBackground();
});
| 0 |
11,650,628 | 07/25/2012 13:18:50 | 1,486,061 | 06/27/2012 15:01:52 | 9 | 0 | getting a desired layout- android | i know this might be too match to ask but need help getting the right layout
here is what i want it to look like-
http://s7.postimage.org/4oay4d2sb/layout.png
the things i got stuck on were the spaces and the text view and the alignment of the buttons (pretty much everything)-
1- is there a way for me to assure the text view will allays be at the same size even when there is no text in it or when there is too match text in it?
2- if there isnt a way to do that can i tell the spaces to fill in the remaining part between the text view and the point i want the buttons to appear?
3- is there a way for me to align the buttons to the buttom to make sure they always stay there at the same place
| android | android-layout | layout | alignment | null | null | open | getting a desired layout- android
===
i know this might be too match to ask but need help getting the right layout
here is what i want it to look like-
http://s7.postimage.org/4oay4d2sb/layout.png
the things i got stuck on were the spaces and the text view and the alignment of the buttons (pretty much everything)-
1- is there a way for me to assure the text view will allays be at the same size even when there is no text in it or when there is too match text in it?
2- if there isnt a way to do that can i tell the spaces to fill in the remaining part between the text view and the point i want the buttons to appear?
3- is there a way for me to align the buttons to the buttom to make sure they always stay there at the same place
| 0 |
11,650,629 | 07/25/2012 13:18:55 | 740,067 | 05/05/2011 13:49:58 | 84 | 2 | Why isActive doesn't work with keybinder? | After http://stackoverflow.com/questions/6398417/why-wxframe-isnt-raised-from-a-function-called-with-global-gtk-binder i hit another weird behaviour..
Could anyone give me a solution (hint also would be good :) ) for this..?
import wx, os
import gtk
import keybinder
class FrameWithHotKey(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
hotkey = "<Ctrl>period"
keybinder.bind(hotkey, self.toggle_shown)
def toggle_shown(self):
# windowNow id
if self.IsShown():
self.Hide()
else:
self.Show()
self.Raise()
print self.IsActive()
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = FrameWithHotKey(None)
app.MainLoop()
If hotkey is pressed isActive always return false. Why? | window | gtk | wxpython | activate | null | null | open | Why isActive doesn't work with keybinder?
===
After http://stackoverflow.com/questions/6398417/why-wxframe-isnt-raised-from-a-function-called-with-global-gtk-binder i hit another weird behaviour..
Could anyone give me a solution (hint also would be good :) ) for this..?
import wx, os
import gtk
import keybinder
class FrameWithHotKey(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
hotkey = "<Ctrl>period"
keybinder.bind(hotkey, self.toggle_shown)
def toggle_shown(self):
# windowNow id
if self.IsShown():
self.Hide()
else:
self.Show()
self.Raise()
print self.IsActive()
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = FrameWithHotKey(None)
app.MainLoop()
If hotkey is pressed isActive always return false. Why? | 0 |
11,650,630 | 07/25/2012 13:18:59 | 779,111 | 06/01/2011 09:35:01 | 1,250 | 5 | Difference between a shared memory based pipe , in Posix vs System V? | As part of my homework project I had to implement a library that implements a pipe using shared memory. Both the anonymous and named pipe .
I chose the `Posix` implementation , meaning , I used the following calls :
mmap()
shm_open()
ftruncate()
shm_unlink()
For semaphores and synchronization
sem_init()
sem_getvalue()
sem_wait()
sem_post()
(I might forgot one or two calls)
My TA told me that he prefers that I'd implement that library with `System V` version ,
however since I'm in the middle of my exams , I have no extra time to do that (would take a least a week , I guess) .
My questions are :
1. What's is the difference between a pipe that's implemented in Posix vs a pipe that's implemented in System-V ?
2. What calls would I need for implementing the above library using the `Sys V` version ?
Thanks
| c | homework | operating-system | posix | shared-memory | null | open | Difference between a shared memory based pipe , in Posix vs System V?
===
As part of my homework project I had to implement a library that implements a pipe using shared memory. Both the anonymous and named pipe .
I chose the `Posix` implementation , meaning , I used the following calls :
mmap()
shm_open()
ftruncate()
shm_unlink()
For semaphores and synchronization
sem_init()
sem_getvalue()
sem_wait()
sem_post()
(I might forgot one or two calls)
My TA told me that he prefers that I'd implement that library with `System V` version ,
however since I'm in the middle of my exams , I have no extra time to do that (would take a least a week , I guess) .
My questions are :
1. What's is the difference between a pipe that's implemented in Posix vs a pipe that's implemented in System-V ?
2. What calls would I need for implementing the above library using the `Sys V` version ?
Thanks
| 0 |
11,650,631 | 07/25/2012 13:18:59 | 1,391,627 | 05/12/2012 23:16:22 | 15 | 0 | Web SRC Confusion | I think i am still havng issues with firefox, I though I solved this issue using @ to remove all \. My code behind constructs the FileName value = `/office/charts/temp/chart.jpg` but when I run it on server I get `office\charts\temp/chart.jpg`. Thanks `office\charts\temp/chart.jpg` will still show the image on IE not on Firefox.
Any advice greatly appreciated. | path | filenames | src | null | null | null | open | Web SRC Confusion
===
I think i am still havng issues with firefox, I though I solved this issue using @ to remove all \. My code behind constructs the FileName value = `/office/charts/temp/chart.jpg` but when I run it on server I get `office\charts\temp/chart.jpg`. Thanks `office\charts\temp/chart.jpg` will still show the image on IE not on Firefox.
Any advice greatly appreciated. | 0 |
11,650,633 | 07/25/2012 13:19:08 | 1,511,837 | 07/09/2012 11:32:02 | 9 | 0 | window.open only in Firefox? | sorry if this is a repeat question!
I have the following Javascript which works fine in Firefox and produces a pop up window. In IE 9 however it does nothing at all and in Chrome it works like a link and changes the current page!
Any advice appreciated!
window.open(page,name,'width='+width+', height='+height+',location=yes,menubar=no,resizable=no,toolbar=no,scrollbars=yes');
Thanks in advance. | php | javascript | html | null | null | null | open | window.open only in Firefox?
===
sorry if this is a repeat question!
I have the following Javascript which works fine in Firefox and produces a pop up window. In IE 9 however it does nothing at all and in Chrome it works like a link and changes the current page!
Any advice appreciated!
window.open(page,name,'width='+width+', height='+height+',location=yes,menubar=no,resizable=no,toolbar=no,scrollbars=yes');
Thanks in advance. | 0 |
11,650,637 | 07/25/2012 13:19:14 | 1,551,697 | 07/25/2012 13:00:49 | 1 | 0 | Auto increment in excel for alternative cell? | Please check the eg.
> row - value
> 1 - test1
> 2 - test1
> 3 - test2
> 4 - test2
> 5 - test3
> 6 - test3
Like this automatically have to increment in MS-Excel without using any scripts
Please give me a suggestion
Thanks in advance | excel | auto-increment | null | null | null | null | open | Auto increment in excel for alternative cell?
===
Please check the eg.
> row - value
> 1 - test1
> 2 - test1
> 3 - test2
> 4 - test2
> 5 - test3
> 6 - test3
Like this automatically have to increment in MS-Excel without using any scripts
Please give me a suggestion
Thanks in advance | 0 |
11,650,626 | 07/25/2012 13:18:43 | 145,650 | 07/27/2009 10:16:12 | 124 | 2 | Change visibility timeout for an SQS message using ruby aws-sdk [ruby newbie] | could someone help with an example how to change visibility timeout for an sqs message using ruby aws-sdk ?
here is the code that I've used for my tests using the method batch_change_message_visibility, but I get the error "undefined method 'batch_change_message_visibility'"
require 'rubygems'
require 'aws-sdk'
sqs = AWS::SQS.new(
:access_key_id => access_key,
:secret_access_key => access_secret)
queue = sqs.queues.named(queue_name)
messages = []
messages << { :message => message_handle, :visibility_timeout => 5 }
queue.batch_change_message_visibility(messages)
Any Idea? Any help would the very welcome :)
Thanks | ruby | amazon-web-services | amazon-sqs | null | null | null | open | Change visibility timeout for an SQS message using ruby aws-sdk [ruby newbie]
===
could someone help with an example how to change visibility timeout for an sqs message using ruby aws-sdk ?
here is the code that I've used for my tests using the method batch_change_message_visibility, but I get the error "undefined method 'batch_change_message_visibility'"
require 'rubygems'
require 'aws-sdk'
sqs = AWS::SQS.new(
:access_key_id => access_key,
:secret_access_key => access_secret)
queue = sqs.queues.named(queue_name)
messages = []
messages << { :message => message_handle, :visibility_timeout => 5 }
queue.batch_change_message_visibility(messages)
Any Idea? Any help would the very welcome :)
Thanks | 0 |
11,650,639 | 07/25/2012 13:19:17 | 1,166,931 | 01/24/2012 12:03:03 | 75 | 0 | android search contact after phone number | I have the following code:
public String getContactDisplayNameByNumber(String number) {
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
String name = "?";
ContentResolver contentResolver = getContentResolver();
Cursor contactLookup = contentResolver.query(uri, new String[] {BaseColumns._ID,
ContactsContract.PhoneLookup.DISPLAY_NAME }, null, null, null);
try {
if (contactLookup != null && contactLookup.getCount() > 0) {
contactLookup.moveToNext();
name = contactLookup.getString(contactLookup.getColumnIndex(ContactsContract.Data.DISPLAY_NAME));
//String contactId = contactLookup.getString(contactLookup.getColumnIndex(BaseColumns._ID));
}
} finally {
if (contactLookup != null) {
contactLookup.close();
}
}
Toast.makeText(this, name, Toast.LENGTH_LONG).show();
return name;
}
Here I am searching a contact name based on the full contact phone nummber. Is it possible to search contacs based just on 4 numbers from the phone number? | android | contacts | null | null | null | null | open | android search contact after phone number
===
I have the following code:
public String getContactDisplayNameByNumber(String number) {
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
String name = "?";
ContentResolver contentResolver = getContentResolver();
Cursor contactLookup = contentResolver.query(uri, new String[] {BaseColumns._ID,
ContactsContract.PhoneLookup.DISPLAY_NAME }, null, null, null);
try {
if (contactLookup != null && contactLookup.getCount() > 0) {
contactLookup.moveToNext();
name = contactLookup.getString(contactLookup.getColumnIndex(ContactsContract.Data.DISPLAY_NAME));
//String contactId = contactLookup.getString(contactLookup.getColumnIndex(BaseColumns._ID));
}
} finally {
if (contactLookup != null) {
contactLookup.close();
}
}
Toast.makeText(this, name, Toast.LENGTH_LONG).show();
return name;
}
Here I am searching a contact name based on the full contact phone nummber. Is it possible to search contacs based just on 4 numbers from the phone number? | 0 |
11,650,640 | 07/25/2012 13:19:18 | 596,979 | 01/31/2011 14:34:08 | 499 | 19 | Why isn't _SERVER["HTTPS"] set to 1? | My site has an SSL cert and I'm hitting https://mysite.com/info.php which looks like this:
<?php phpinfo(); ?>
But under the PHP Variables section _SERVER["HTTPS"] is not being reported. I believe this is causing a problem with a Drupal site where some URLs are being written to the page as https://... where others are being written as http://...
What determines if _SERVER["HTTPS"] is set? | php | apache | webserver | null | null | null | open | Why isn't _SERVER["HTTPS"] set to 1?
===
My site has an SSL cert and I'm hitting https://mysite.com/info.php which looks like this:
<?php phpinfo(); ?>
But under the PHP Variables section _SERVER["HTTPS"] is not being reported. I believe this is causing a problem with a Drupal site where some URLs are being written to the page as https://... where others are being written as http://...
What determines if _SERVER["HTTPS"] is set? | 0 |
11,650,645 | 07/25/2012 13:19:24 | 1,551,721 | 07/25/2012 13:09:56 | 1 | 0 | MVVM Light Commands within an DataTemplate | I created a User Control which contains a ListView. I want to add a RelayCommand when the user change the text of a nested TextBox (using MVVM Light) :
<UserControl xmlns:my="clr-namespace:UI.View" x:Class="UI.View.MontureView"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" >
<ListView ItemsSource="{Binding Path=Monture}" Margin="0,39,0,95" Height="600" HorizontalAlignment="Center">
<ListView.View>
<GridView>
<GridViewColumn Header="Qte" Width="50" >
<GridViewColumn.CellTemplate >
<DataTemplate>
<TextBox Text="{Binding Path=Qte}" Width="40" TextAlignment="Right" Name="a">
<i:Interaction.Triggers>
<i:EventTrigger EventName="TextChanged" >
<cmd:EventToCommand Command="{Binding MontureViewModel.MyProperty}" CommandParameter="{Binding ElementName=a}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</UserControl>
In my VM I have : (I removed some parts of the code)
namespace UI.ViewModel
{
public class MontureViewModel : ViewModelBase
{
public MontureViewModel()
{
MyProperty = new RelayCommand<TextBox>(e =>
{
MessageBox.Show("test");
});
}
public RelayCommand<TextBox> MyProperty { get; set; }
}
}
I tryied to add an event on a TextBox which isn't nested into a DataTemplate (outside of the ListView) and it works.
I think that I have to modify the code when I'm into the DataTemplate.
Any idea ? | c# | mvvm-light | null | null | null | null | open | MVVM Light Commands within an DataTemplate
===
I created a User Control which contains a ListView. I want to add a RelayCommand when the user change the text of a nested TextBox (using MVVM Light) :
<UserControl xmlns:my="clr-namespace:UI.View" x:Class="UI.View.MontureView"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" >
<ListView ItemsSource="{Binding Path=Monture}" Margin="0,39,0,95" Height="600" HorizontalAlignment="Center">
<ListView.View>
<GridView>
<GridViewColumn Header="Qte" Width="50" >
<GridViewColumn.CellTemplate >
<DataTemplate>
<TextBox Text="{Binding Path=Qte}" Width="40" TextAlignment="Right" Name="a">
<i:Interaction.Triggers>
<i:EventTrigger EventName="TextChanged" >
<cmd:EventToCommand Command="{Binding MontureViewModel.MyProperty}" CommandParameter="{Binding ElementName=a}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</UserControl>
In my VM I have : (I removed some parts of the code)
namespace UI.ViewModel
{
public class MontureViewModel : ViewModelBase
{
public MontureViewModel()
{
MyProperty = new RelayCommand<TextBox>(e =>
{
MessageBox.Show("test");
});
}
public RelayCommand<TextBox> MyProperty { get; set; }
}
}
I tryied to add an event on a TextBox which isn't nested into a DataTemplate (outside of the ListView) and it works.
I think that I have to modify the code when I'm into the DataTemplate.
Any idea ? | 0 |
11,650,647 | 07/25/2012 13:19:29 | 1,551,719 | 07/25/2012 13:09:42 | 1 | 0 | I want to add multiple image at one go by using struts2.0 tag.And if i don't add image in betwwen than it should insert null | I have multiple browse button on the page and if i don't enter image in one browse button it should insert null on that index rather than putting the next image in same tag.
Example:--Suppose there are 3 browse buttons on a page and I enter image for the first and third browse button than the File Array I get on action is of size 2 because it has mapped that third image in the second index.But I want the array should be of same size as there are number of browse button.How could i do this. | struts2 | null | null | null | null | null | open | I want to add multiple image at one go by using struts2.0 tag.And if i don't add image in betwwen than it should insert null
===
I have multiple browse button on the page and if i don't enter image in one browse button it should insert null on that index rather than putting the next image in same tag.
Example:--Suppose there are 3 browse buttons on a page and I enter image for the first and third browse button than the File Array I get on action is of size 2 because it has mapped that third image in the second index.But I want the array should be of same size as there are number of browse button.How could i do this. | 0 |
11,430,308 | 07/11/2012 10:09:23 | 1,517,395 | 07/11/2012 10:03:15 | 1 | 0 | Getting kAXErrorIllegalArgument when Setting value to secure text field in IOS Automation | Whenever user tap any key cursor move to the next position automatically but when i am setting value in secureTextField as shown below i am getting following error :
***Script threw an uncaught JavaScript error: Unexpected error in -[UIASecureTextField_0x6e70b50 setValue:], /SourceCache/UIAutomation_Sim/UIAutomation-
198.2/Framework/UIAElement.m line 1102, kAXErrorIllegalArgument***
*I have written script as shown below :*
var target = UIATarget.localTarget();
var window = UIATarget.localTarget().frontMostApp().mainWindow();
var keyboard = UIATarget.localTarget().frontMostApp().keyboard();
keyboard.logElementTree();
var firstDigitTextField = window.scrollViews()[0].secureTextFields()[0];
firstDigitTextField.setValue(keyboard.keys()["1"].tap());
| ios | ui-automation | null | null | null | null | open | Getting kAXErrorIllegalArgument when Setting value to secure text field in IOS Automation
===
Whenever user tap any key cursor move to the next position automatically but when i am setting value in secureTextField as shown below i am getting following error :
***Script threw an uncaught JavaScript error: Unexpected error in -[UIASecureTextField_0x6e70b50 setValue:], /SourceCache/UIAutomation_Sim/UIAutomation-
198.2/Framework/UIAElement.m line 1102, kAXErrorIllegalArgument***
*I have written script as shown below :*
var target = UIATarget.localTarget();
var window = UIATarget.localTarget().frontMostApp().mainWindow();
var keyboard = UIATarget.localTarget().frontMostApp().keyboard();
keyboard.logElementTree();
var firstDigitTextField = window.scrollViews()[0].secureTextFields()[0];
firstDigitTextField.setValue(keyboard.keys()["1"].tap());
| 0 |
11,430,310 | 07/11/2012 10:09:32 | 546,033 | 12/17/2010 12:09:11 | 275 | 31 | Make in clause to match all items ot any alternative? | I have a table `hotel [hotelid,hotelname,etc]`
and another table `facilities[facilityid,facilityname]`
these 2 tables are linked through table `hotel_to_facilities_map[hotelid,facility_id]`
so the table `hotel_to_facilities_map` might contain values as
hotelid facility_id
-------------------
1 3
1 5
1 6
2 6
2 2
2 5
now i want to retrieve all the hotels which match ALL facilities asked for
select * from hotel_to_facilities_map where facility_id IN (3,5,2)
but this will cause the match as an `OR` Expression while i need `AND`.
is there any workaround or solution for this?
| sql-server-2008 | query | join | in-clause | null | null | open | Make in clause to match all items ot any alternative?
===
I have a table `hotel [hotelid,hotelname,etc]`
and another table `facilities[facilityid,facilityname]`
these 2 tables are linked through table `hotel_to_facilities_map[hotelid,facility_id]`
so the table `hotel_to_facilities_map` might contain values as
hotelid facility_id
-------------------
1 3
1 5
1 6
2 6
2 2
2 5
now i want to retrieve all the hotels which match ALL facilities asked for
select * from hotel_to_facilities_map where facility_id IN (3,5,2)
but this will cause the match as an `OR` Expression while i need `AND`.
is there any workaround or solution for this?
| 0 |
11,430,269 | 07/11/2012 10:07:24 | 1,517,376 | 07/11/2012 09:54:08 | 1 | 0 | c# unable to convert mysql date/time value | I have a weird problem with my code.I'm still newbie in c#,so please don't lough. :)
I have this code:
string MyConString = "SERVER=206.217.142.xxx;" +
"DATABASE=soft_test;" +
"UID=soft_test;" +
"PASSWORD=123456";
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "SELECT * FROM `wp_posts` ORDER BY `wp_posts`.`ID` ASC";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
string thisrow = "";
for (int i = 0; i < Reader.FieldCount; i++)
thisrow += Reader.GetValue(i).ToString() + ",";
listBox1.Items.Add(thisrow);
}
connection.Close();
The programm is connecting to a mysql database and it should receive back a **number** , but when I run the program,I'm getting this error:
Unable to convert MySQL date/time value to System.DateTime
I really can't understand what's wrong,because the value returned by the query is a number,not date/time...
Please someone help me! | c# | mysql | query | null | null | null | open | c# unable to convert mysql date/time value
===
I have a weird problem with my code.I'm still newbie in c#,so please don't lough. :)
I have this code:
string MyConString = "SERVER=206.217.142.xxx;" +
"DATABASE=soft_test;" +
"UID=soft_test;" +
"PASSWORD=123456";
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "SELECT * FROM `wp_posts` ORDER BY `wp_posts`.`ID` ASC";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
string thisrow = "";
for (int i = 0; i < Reader.FieldCount; i++)
thisrow += Reader.GetValue(i).ToString() + ",";
listBox1.Items.Add(thisrow);
}
connection.Close();
The programm is connecting to a mysql database and it should receive back a **number** , but when I run the program,I'm getting this error:
Unable to convert MySQL date/time value to System.DateTime
I really can't understand what's wrong,because the value returned by the query is a number,not date/time...
Please someone help me! | 0 |
11,430,326 | 07/11/2012 10:10:20 | 1,253,834 | 03/07/2012 04:48:44 | 20 | 0 | How to recover data after partitions are deleted | I want to recover my data from hard disk . Actually what happened i was deleting one partitions drive from Manage in windows XP but by mistake 3 drives partitions are deleted .
I want to recover my data from hard disk their is any solution for that please help me. | data | data-recovery | harddisk | null | null | 07/19/2012 03:19:30 | off topic | How to recover data after partitions are deleted
===
I want to recover my data from hard disk . Actually what happened i was deleting one partitions drive from Manage in windows XP but by mistake 3 drives partitions are deleted .
I want to recover my data from hard disk their is any solution for that please help me. | 2 |
11,430,331 | 07/11/2012 10:10:36 | 1,144,851 | 01/12/2012 06:37:04 | 164 | 5 | Python parent in QTreeWidget | I am working on python plugins.I used QTreeWidget to list items.
[listing in qtreewidget][1] this link helped me a lot.
My code is:
valestimate=QTreeWidgetItem(str(parent_name))
for row in c.fetchall():
strval=QTreeWidgetItem(unicode(row[0]))
valestimate.addChild(strval)
self.treeWidget.addTopLevelItem((valestimate))
**parent_name** is name of my parent in **QTreeWidget**.
EX: **'ACO_233'**
But output is :
![enter image description here][2]
If i set columncount as more then one then it is shown as:
![enter image description here][3]
How do i list full string as parent in Qtreewidget??
following this link [single character in qtreewidget][4] ..inserttoplevelitem takes list as parameter..But if i want to make any item as parent ,we cannot add list to qtreewidget type item. How do i do it??
[1]: http://stackoverflow.com/questions/11357783/python-query-result-in-qtreewidget/11372740#comment15026417_11372740
[2]: http://i.stack.imgur.com/VxQty.png
[3]: http://i.stack.imgur.com/cLpfI.png
[4]: http://stackoverflow.com/questions/11357783/python-query-result-in-qtreewidget/11372740#comment15026417_11372740 | python | pyqt4 | addchild | qtreewidget | null | null | open | Python parent in QTreeWidget
===
I am working on python plugins.I used QTreeWidget to list items.
[listing in qtreewidget][1] this link helped me a lot.
My code is:
valestimate=QTreeWidgetItem(str(parent_name))
for row in c.fetchall():
strval=QTreeWidgetItem(unicode(row[0]))
valestimate.addChild(strval)
self.treeWidget.addTopLevelItem((valestimate))
**parent_name** is name of my parent in **QTreeWidget**.
EX: **'ACO_233'**
But output is :
![enter image description here][2]
If i set columncount as more then one then it is shown as:
![enter image description here][3]
How do i list full string as parent in Qtreewidget??
following this link [single character in qtreewidget][4] ..inserttoplevelitem takes list as parameter..But if i want to make any item as parent ,we cannot add list to qtreewidget type item. How do i do it??
[1]: http://stackoverflow.com/questions/11357783/python-query-result-in-qtreewidget/11372740#comment15026417_11372740
[2]: http://i.stack.imgur.com/VxQty.png
[3]: http://i.stack.imgur.com/cLpfI.png
[4]: http://stackoverflow.com/questions/11357783/python-query-result-in-qtreewidget/11372740#comment15026417_11372740 | 0 |
10,087,386 | 04/10/2012 10:54:29 | 70,339 | 02/24/2009 12:46:07 | 753 | 6 | CSS: Why is the indentation of these list elements not lining up? | I've got a simple CSS issue on my hands here —_or so I thought…_— where I basically just want to create a nicely __left aligned__ list (`ul`) using `::before` pseudo elements with generated `content: "» "` as list markers.
Now matter what I try though I simply cannot reproduce the results from this [A List Apart: Taming Lists][1] article. In the linked to example the list is exactly how I'd like to style mine.
I have reproduced the example in a JS Fiddle here which shows the issue of the misaligned text: http://jsfiddle.net/jannis/f8TxN/
Here is also a quick image to illustrate this point better. Example from ALA on the left, my version on the right:
![List Misalignment][2]
However as you will be able to see in the Fiddle, the first line within the `li` simply will not align left with the rest of the text within this `li`.
I would really appreciate someone taking a look and telling me what I'm doing wrong here.
Many thanks for reading,
Jannis
[1]: http://www.alistapart.com/articles/taminglists#custom-gen
[2]: http://i.stack.imgur.com/cxsIN.png | css | html-lists | alignment | indentation | text-alignment | null | open | CSS: Why is the indentation of these list elements not lining up?
===
I've got a simple CSS issue on my hands here —_or so I thought…_— where I basically just want to create a nicely __left aligned__ list (`ul`) using `::before` pseudo elements with generated `content: "» "` as list markers.
Now matter what I try though I simply cannot reproduce the results from this [A List Apart: Taming Lists][1] article. In the linked to example the list is exactly how I'd like to style mine.
I have reproduced the example in a JS Fiddle here which shows the issue of the misaligned text: http://jsfiddle.net/jannis/f8TxN/
Here is also a quick image to illustrate this point better. Example from ALA on the left, my version on the right:
![List Misalignment][2]
However as you will be able to see in the Fiddle, the first line within the `li` simply will not align left with the rest of the text within this `li`.
I would really appreciate someone taking a look and telling me what I'm doing wrong here.
Many thanks for reading,
Jannis
[1]: http://www.alistapart.com/articles/taminglists#custom-gen
[2]: http://i.stack.imgur.com/cxsIN.png | 0 |
11,430,335 | 07/11/2012 10:10:49 | 1,517,375 | 07/11/2012 09:54:01 | 1 | 0 | PHP SimpleXML Breaking when trying to traverse nodes | I'm trying to read the xml information that tumblr provides to create a kind of news feed off the tumblr, but I'm very stuck.
<?php
$request_url = 'http://candybrie.tumblr.com/api/read?type=post&start=0&num=5&type=text';
$xml = simplexml_load_file($request_url);
if (!$xml)
{
exit('Failed to retrieve data.');
}
else
{
$posts = $xml->tumblr->posts;
foreach ($posts as $post)
{
$title = $post->{'regular-title'};
$post = $post->{'regular-body'};
$small_post = substr($post,0,320);
echo .$title.;
echo '<p>'.$small_post.'</p>';
}
}
?>
Which always breaks as soon as it tries to go through the nodes. So basically "tumblr->posts;....ect" is displayed on my html page.
I've tried saving the information as a local xml file. I've tried using different ways to create the simplexml object, like loading it as a string (probably a silly idea). I double checked that my webhosting was running PHP5. So basically, I'm stuck on why this wouldn't be working. | xml | php5 | simplexml | null | null | null | open | PHP SimpleXML Breaking when trying to traverse nodes
===
I'm trying to read the xml information that tumblr provides to create a kind of news feed off the tumblr, but I'm very stuck.
<?php
$request_url = 'http://candybrie.tumblr.com/api/read?type=post&start=0&num=5&type=text';
$xml = simplexml_load_file($request_url);
if (!$xml)
{
exit('Failed to retrieve data.');
}
else
{
$posts = $xml->tumblr->posts;
foreach ($posts as $post)
{
$title = $post->{'regular-title'};
$post = $post->{'regular-body'};
$small_post = substr($post,0,320);
echo .$title.;
echo '<p>'.$small_post.'</p>';
}
}
?>
Which always breaks as soon as it tries to go through the nodes. So basically "tumblr->posts;....ect" is displayed on my html page.
I've tried saving the information as a local xml file. I've tried using different ways to create the simplexml object, like loading it as a string (probably a silly idea). I double checked that my webhosting was running PHP5. So basically, I'm stuck on why this wouldn't be working. | 0 |
11,541,896 | 07/18/2012 12:54:59 | 1,095,837 | 12/13/2011 13:29:08 | 1 | 0 | ksoap2 issue java.net.ConnectException | I am using kSoap2 for accessing soap web services. I am getting java.net.connectException while executing the below line
" androidHttpTransport.call(Constants.SOAP_ACTION_GET_METHOD_NAME, envelope) "
This is not happening always, but some of the times. Is this the problem with connection time out to the server? How to increase the connection time out in kSoap ? I googled, but can't find out the solution .
Can anyone suggest me the solution to fix this error.
Logcat details follows:
07-17 14:46:24.800: W/System.err(8103): java.net.ConnectException: failed to connect to www.yahoo.com/175.41.138.237 (port 80) after 20000ms: isConnected failed: ENETUNREACH (Network is unreachable)
07-17 14:46:24.800: W/System.err(8103): at libcore.io.IoBridge.isConnected(IoBridge.java:214)
07-17 14:46:24.800: W/System.err(8103): at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
07-17 14:46:24.800: W/System.err(8103): at libcore.io.IoBridge.connect(IoBridge.java:112)
07-17 14:46:24.800: W/System.err(8103): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
07-17 14:46:24.800: W/System.err(8103): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
07-17 14:46:24.800: W/System.err(8103): at java.net.Socket.connect(Socket.java:842)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
07-17 14:46:24.810: W/System.err(8103): at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:80) | android | ksoap | null | null | null | null | open | ksoap2 issue java.net.ConnectException
===
I am using kSoap2 for accessing soap web services. I am getting java.net.connectException while executing the below line
" androidHttpTransport.call(Constants.SOAP_ACTION_GET_METHOD_NAME, envelope) "
This is not happening always, but some of the times. Is this the problem with connection time out to the server? How to increase the connection time out in kSoap ? I googled, but can't find out the solution .
Can anyone suggest me the solution to fix this error.
Logcat details follows:
07-17 14:46:24.800: W/System.err(8103): java.net.ConnectException: failed to connect to www.yahoo.com/175.41.138.237 (port 80) after 20000ms: isConnected failed: ENETUNREACH (Network is unreachable)
07-17 14:46:24.800: W/System.err(8103): at libcore.io.IoBridge.isConnected(IoBridge.java:214)
07-17 14:46:24.800: W/System.err(8103): at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
07-17 14:46:24.800: W/System.err(8103): at libcore.io.IoBridge.connect(IoBridge.java:112)
07-17 14:46:24.800: W/System.err(8103): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
07-17 14:46:24.800: W/System.err(8103): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
07-17 14:46:24.800: W/System.err(8103): at java.net.Socket.connect(Socket.java:842)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
07-17 14:46:24.800: W/System.err(8103): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
07-17 14:46:24.810: W/System.err(8103): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
07-17 14:46:24.810: W/System.err(8103): at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:80) | 0 |
11,541,855 | 07/18/2012 12:52:45 | 235,555 | 12/20/2009 17:03:54 | 136 | 3 | How can I let my customers have their own domains redirect to my server and identify them? | I have a question that I couldn't find the answer because I don't know how to search it in English :)
How can I let my customers have their own domains redirect to my server and identify them? Like Wordpress.
For example, I have created a simple CMS system and customers can register and have their own pages like john.mysite.com. But if they want to use their domains, do I have to create all of those domains on Plesk? By the way, I'm using IIS 7.5 with Plesk.
I also don't want to use iframe.
Example;
> john.mywebsite.com/categories-150.html -->
> www.johnswebsite.com/categories-150.html
But it should be using the same code. I shouldn't have to copy all the source codes and create seperate domains for this purpose.
For sure, I can make them change their ns to my server and specify an A record but how can I identify it by code? (C# ASP.NET MVC) I assume I can search for the domain name over database and get the ID but how can I pass the domain name?
I hope you can understand :)
Thanks and regards
| c# | asp.net-mvc | dns | iis-7.5 | nameservers | null | open | How can I let my customers have their own domains redirect to my server and identify them?
===
I have a question that I couldn't find the answer because I don't know how to search it in English :)
How can I let my customers have their own domains redirect to my server and identify them? Like Wordpress.
For example, I have created a simple CMS system and customers can register and have their own pages like john.mysite.com. But if they want to use their domains, do I have to create all of those domains on Plesk? By the way, I'm using IIS 7.5 with Plesk.
I also don't want to use iframe.
Example;
> john.mywebsite.com/categories-150.html -->
> www.johnswebsite.com/categories-150.html
But it should be using the same code. I shouldn't have to copy all the source codes and create seperate domains for this purpose.
For sure, I can make them change their ns to my server and specify an A record but how can I identify it by code? (C# ASP.NET MVC) I assume I can search for the domain name over database and get the ID but how can I pass the domain name?
I hope you can understand :)
Thanks and regards
| 0 |
11,541,856 | 07/18/2012 12:52:46 | 1,452,914 | 06/13/2012 06:10:56 | 1 | 0 | How to start a process instance in jbpm 5.3 from external source? | After successfully login to my application i want to run a jBPM process instances by clicking a button or image.
Can anyone help me with a link please.. | jbpm | null | null | null | null | null | open | How to start a process instance in jbpm 5.3 from external source?
===
After successfully login to my application i want to run a jBPM process instances by clicking a button or image.
Can anyone help me with a link please.. | 0 |
11,541,901 | 07/18/2012 12:55:20 | 1,299,606 | 03/29/2012 01:31:58 | 12 | 0 | iOS 5.x forward geocoding returns different result than googlemaps | The problem is like the title says and heres the relevant codepart:
NSString *adressString = [NSString stringWithFormat:@"%@, %@", searchBar.text, @"sweden"];
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
//NSArray *tempmarks;
[geocoder geocodeAddressString:adressString completionHandler:^(NSArray *placemarks, NSError *error) {
if(placemarks && [placemarks count] >0){
CLPlacemark *placemark = [placemarks objectAtIndex:0];
CLLocation *temp = placemark.location;
//CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(placemark.region.center.latitude, placemark.region.center.longitude);
[parkingMap setCenterCoordinate:temp.coordinate zoomLevel:15 animated:NO];
}
}];
All results I want to find is within sweden, so I add that to the searchString. The searchstring comes from a UISearchBar.
But for some reasons the location where my mapview ends up differs slightly from if I do a search on maps.google.com, it's not totaly off in most cases, just slightly.
Does anyone know why? Do I use the centercoordinate in the wrong way?
Thanks in advance. | ios | mkmapview | mkmapkit | clgeocoder | null | null | open | iOS 5.x forward geocoding returns different result than googlemaps
===
The problem is like the title says and heres the relevant codepart:
NSString *adressString = [NSString stringWithFormat:@"%@, %@", searchBar.text, @"sweden"];
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
//NSArray *tempmarks;
[geocoder geocodeAddressString:adressString completionHandler:^(NSArray *placemarks, NSError *error) {
if(placemarks && [placemarks count] >0){
CLPlacemark *placemark = [placemarks objectAtIndex:0];
CLLocation *temp = placemark.location;
//CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(placemark.region.center.latitude, placemark.region.center.longitude);
[parkingMap setCenterCoordinate:temp.coordinate zoomLevel:15 animated:NO];
}
}];
All results I want to find is within sweden, so I add that to the searchString. The searchstring comes from a UISearchBar.
But for some reasons the location where my mapview ends up differs slightly from if I do a search on maps.google.com, it's not totaly off in most cases, just slightly.
Does anyone know why? Do I use the centercoordinate in the wrong way?
Thanks in advance. | 0 |
11,541,908 | 07/18/2012 12:55:36 | 1,182,036 | 02/01/2012 06:23:42 | 3 | 0 | temporary remove Html from string for google api translation to save dollars | I have to translate some details using google API which is now paid.Details also contains HTML and google charge for each character, so i dont want to send complete content but only English text, removing html. I can remove html tags and entities using PHP functions , but I have to place english content back in HTML tags after translation for proper display. It will also include CSS.
Example
<strong>This is a test</strong><br /> <custom tag>This is a test</custom tag><br />
After translation to Spanish I need
<strong>Translated content </strong><br /> <p>Translated content </p><br />
How can i preserver HTML format with out sending HTML to API ???
| php | api | tags | html-parsing | translation | null | open | temporary remove Html from string for google api translation to save dollars
===
I have to translate some details using google API which is now paid.Details also contains HTML and google charge for each character, so i dont want to send complete content but only English text, removing html. I can remove html tags and entities using PHP functions , but I have to place english content back in HTML tags after translation for proper display. It will also include CSS.
Example
<strong>This is a test</strong><br /> <custom tag>This is a test</custom tag><br />
After translation to Spanish I need
<strong>Translated content </strong><br /> <p>Translated content </p><br />
How can i preserver HTML format with out sending HTML to API ???
| 0 |
11,541,910 | 07/18/2012 12:55:49 | 1,423,007 | 05/29/2012 06:37:37 | 42 | 7 | Select statement to display Minutes in HH:MM Format | I am having a table (Table Name -Production) in SQL Server.The Production table have a Column TimeSpent (Datatype- varchar(25)) and stores Number of minutes spent . Example 60,78,23 etc.
I want to display TimeSpent in HH:MM Format in a select statement. for example it display 01:00 for 60, 01:18 for 78 and so on.
Please help me that how i will write this query. | sql-server | null | null | null | null | null | open | Select statement to display Minutes in HH:MM Format
===
I am having a table (Table Name -Production) in SQL Server.The Production table have a Column TimeSpent (Datatype- varchar(25)) and stores Number of minutes spent . Example 60,78,23 etc.
I want to display TimeSpent in HH:MM Format in a select statement. for example it display 01:00 for 60, 01:18 for 78 and so on.
Please help me that how i will write this query. | 0 |
11,541,911 | 07/18/2012 12:55:52 | 644,874 | 03/04/2011 14:26:25 | 8 | 0 | Randomize Joomla/K2 article URLS | I am looking for a way to add a random string/value to all Joomla article URLs. The reason for this is that people will be able to access URLs provided they have the link to the content however they should not be able to get at other content by substituting the article id in the URL (i.e: index.php/category/1, index.php/category/2). Regardless of alias text placing the article id onto the url with url rewriting enabled will access the article. I am using the K2 component so would be applying this to K2 articles (Items).
I had thought about hard coding the alias to a random value on article creation but this won't solve the issue. Even a way of obfuscating the URL should work, although the plugins I tried for Joomla only do external links.
Any ideas?
Nick
//Software: Joomla 2.5/K2 2.5/Apache server
| joomla | article | null | null | null | null | open | Randomize Joomla/K2 article URLS
===
I am looking for a way to add a random string/value to all Joomla article URLs. The reason for this is that people will be able to access URLs provided they have the link to the content however they should not be able to get at other content by substituting the article id in the URL (i.e: index.php/category/1, index.php/category/2). Regardless of alias text placing the article id onto the url with url rewriting enabled will access the article. I am using the K2 component so would be applying this to K2 articles (Items).
I had thought about hard coding the alias to a random value on article creation but this won't solve the issue. Even a way of obfuscating the URL should work, although the plugins I tried for Joomla only do external links.
Any ideas?
Nick
//Software: Joomla 2.5/K2 2.5/Apache server
| 0 |
11,541,913 | 07/18/2012 12:55:56 | 1,297,670 | 03/28/2012 08:56:03 | 27 | 1 | Finish an activity when memoy is low | I have an Activity A start Activity B in my App. When my App is stopped and the memory of the android system is low, my App will be cleared from the back stack. When I launch my App again, an exception occur during instantiate Activity B. So I want to make sure Activity B is finished when the memory is low, thus the exception will not occur. I have tried putting finish() in onMemoryLow(), but it didn't work. What else can I do? | android | back-stack | null | null | null | null | open | Finish an activity when memoy is low
===
I have an Activity A start Activity B in my App. When my App is stopped and the memory of the android system is low, my App will be cleared from the back stack. When I launch my App again, an exception occur during instantiate Activity B. So I want to make sure Activity B is finished when the memory is low, thus the exception will not occur. I have tried putting finish() in onMemoryLow(), but it didn't work. What else can I do? | 0 |
11,728,322 | 07/30/2012 19:34:03 | 432,198 | 08/26/2010 18:20:53 | 77 | 4 | Eclipse p2 mirrorApplication artifact filtering | I am trying to mirror an update site (m2e) with the following commands.
eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -writeMode clean -source http://download.eclipse.org/technology/m2e/releases/1.1/1.1.0.20120530-0009 -destination file:/C:/m2ecore
eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -writeMode clean -source http://download.eclipse.org/technology/m2e/releases/1.1/1.1.0.20120530-0009 -destination file:/C:/m2ecore
That works, but it downloads all the artifacts twice, both in canonical form and pack200 form. For example
Mirroring: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009 (Descriptor: packed: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009)
Mirroring: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009 (Descriptor: canonical: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009)
Is there a way to specify that I only want to mirror the canonical forms?
If not, could someone please tell me if and HOW to modify the repository once it's been downloaded? My idea is to delete the pack200 files manually and then regenerate the metadata. I'm guessing with `org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher`?
Using this command, can I be sure that the resulting repository will be equivalent to the source, just without the pack200 files?
Thanks. | eclipse | mirroring | p2 | null | null | null | open | Eclipse p2 mirrorApplication artifact filtering
===
I am trying to mirror an update site (m2e) with the following commands.
eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -writeMode clean -source http://download.eclipse.org/technology/m2e/releases/1.1/1.1.0.20120530-0009 -destination file:/C:/m2ecore
eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -writeMode clean -source http://download.eclipse.org/technology/m2e/releases/1.1/1.1.0.20120530-0009 -destination file:/C:/m2ecore
That works, but it downloads all the artifacts twice, both in canonical form and pack200 form. For example
Mirroring: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009 (Descriptor: packed: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009)
Mirroring: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009 (Descriptor: canonical: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009)
Is there a way to specify that I only want to mirror the canonical forms?
If not, could someone please tell me if and HOW to modify the repository once it's been downloaded? My idea is to delete the pack200 files manually and then regenerate the metadata. I'm guessing with `org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher`?
Using this command, can I be sure that the resulting repository will be equivalent to the source, just without the pack200 files?
Thanks. | 0 |
11,728,324 | 07/30/2012 19:34:10 | 490,374 | 10/28/2010 16:39:07 | 860 | 45 | EntLib 5.0, runtime configuration, SystemConfigurationSource, and connectionStrings | I am using the EntLib in an environment where database connection strings are retrieved from a separate library call that decrypts a proprietary config file. I have no say over this practice or the format of the config file.
I want to do EntLib exception logging to the database in this setting. I therefore need to set up a EntLib database configuration instance with the name of the database, with the connection string. Since I can't get the connection string until run time, but EntLib does allow run-time configuration, I use the following code, as described in [this][1]:
builder.ConfigureData()
.ForDatabaseNamed("Ann")
.ThatIs.ASqlDatabase()
.WithConnectionString(connectionString)
.AsDefault();
The parameter `connectionString` is the one I've retrieved from the separate library.
The sample code goes on to merge the created configuration info with an empty DictionaryConfigurationSource. I, however, need to merge it with the rest of the configuration code from the app.config. So I do this:
var configSource = new SystemConfigurationSource();
builder.UpdateConfigurationWithReplace(configSource);
EnterpriseLibraryContainer.Current
= EnterpriseLibraryContainer.CreateDefaultContainer(configSource);
... which is based very closely on the sample code.
But: I get an internal error in Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource.Save. The failing code is this:
var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = ConfigurationFilePath };
var config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
config.Sections.Remove(section);
config.Sections.Add(section, configurationSection);
config.Save();
... where 'section' is "connectionStrings". The code fails on the Add method call, saying that you can't add a duplicate section. Inspection shows that the connectionStrings section is still there even after the Remove.
I know from experience that there's always a default entry under connectionStrings when the configuration files are actually read and interpreted, inherited from the machine.config. So perhaps you can never really remove the connectionStrings section.
That would appear to leave me out of luck, though, unless I want to modify the EntLib source, which I do not.
I could perhaps build all the configuration information for the EntLib at run time, using the fluent API. But I'd rather not. The users want their Operations staff to be able to make small changes to the logging without having to involve a developer.
So my question, in several parts: is there a nice simple workaround for this? Does it require a change to the EntLib source? Or have I missed something really simple that would do away with the problem?
Many thanks.
[1]: http://msdn.microsoft.com/en-us/library/ff664363%28v=pandp.50%29 | configuration | app-config | enterprise-library | null | null | null | open | EntLib 5.0, runtime configuration, SystemConfigurationSource, and connectionStrings
===
I am using the EntLib in an environment where database connection strings are retrieved from a separate library call that decrypts a proprietary config file. I have no say over this practice or the format of the config file.
I want to do EntLib exception logging to the database in this setting. I therefore need to set up a EntLib database configuration instance with the name of the database, with the connection string. Since I can't get the connection string until run time, but EntLib does allow run-time configuration, I use the following code, as described in [this][1]:
builder.ConfigureData()
.ForDatabaseNamed("Ann")
.ThatIs.ASqlDatabase()
.WithConnectionString(connectionString)
.AsDefault();
The parameter `connectionString` is the one I've retrieved from the separate library.
The sample code goes on to merge the created configuration info with an empty DictionaryConfigurationSource. I, however, need to merge it with the rest of the configuration code from the app.config. So I do this:
var configSource = new SystemConfigurationSource();
builder.UpdateConfigurationWithReplace(configSource);
EnterpriseLibraryContainer.Current
= EnterpriseLibraryContainer.CreateDefaultContainer(configSource);
... which is based very closely on the sample code.
But: I get an internal error in Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource.Save. The failing code is this:
var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = ConfigurationFilePath };
var config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
config.Sections.Remove(section);
config.Sections.Add(section, configurationSection);
config.Save();
... where 'section' is "connectionStrings". The code fails on the Add method call, saying that you can't add a duplicate section. Inspection shows that the connectionStrings section is still there even after the Remove.
I know from experience that there's always a default entry under connectionStrings when the configuration files are actually read and interpreted, inherited from the machine.config. So perhaps you can never really remove the connectionStrings section.
That would appear to leave me out of luck, though, unless I want to modify the EntLib source, which I do not.
I could perhaps build all the configuration information for the EntLib at run time, using the fluent API. But I'd rather not. The users want their Operations staff to be able to make small changes to the logging without having to involve a developer.
So my question, in several parts: is there a nice simple workaround for this? Does it require a change to the EntLib source? Or have I missed something really simple that would do away with the problem?
Many thanks.
[1]: http://msdn.microsoft.com/en-us/library/ff664363%28v=pandp.50%29 | 0 |
11,728,329 | 07/30/2012 19:34:26 | 464,744 | 10/02/2010 17:47:48 | 33,974 | 1,646 | Loosening GTK WebKit's security | I'm writing a WebKit greeter for LightDM, but the security settings in WebKit prevent me from loading images from the filesystem into `Canvas` objects (I'm extracting dominant colors from them):
** Message: console message: @0: Unable to get image data from canvas because
the canvas has been tainted by cross-origin
data.
** Message: console message: undefined @0: SECURITY_ERR: DOM Exception 18: An
attempt was made to break through the security
policy of the user agent.
I'm fine with modifying the source code of the greeter itself, which essentially is this:
web_view = webkit_web_view_new ();
webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme));
All of the solutions that I've found online force me to comment out some lines in WebKit's source and recompile it, which I'd rather not do.
One possible hack is to create a custom JS method in the `lightdm` object called `lightdm.read_file()` that returns the contents of a file as a string, given its filename. This is pretty hacky I'd rather find a clean way of accomplishing this.
Is there any way to disable XSS-checking with WebKit's GTK API? | c++ | webkit | gtk | null | null | null | open | Loosening GTK WebKit's security
===
I'm writing a WebKit greeter for LightDM, but the security settings in WebKit prevent me from loading images from the filesystem into `Canvas` objects (I'm extracting dominant colors from them):
** Message: console message: @0: Unable to get image data from canvas because
the canvas has been tainted by cross-origin
data.
** Message: console message: undefined @0: SECURITY_ERR: DOM Exception 18: An
attempt was made to break through the security
policy of the user agent.
I'm fine with modifying the source code of the greeter itself, which essentially is this:
web_view = webkit_web_view_new ();
webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme));
All of the solutions that I've found online force me to comment out some lines in WebKit's source and recompile it, which I'd rather not do.
One possible hack is to create a custom JS method in the `lightdm` object called `lightdm.read_file()` that returns the contents of a file as a string, given its filename. This is pretty hacky I'd rather find a clean way of accomplishing this.
Is there any way to disable XSS-checking with WebKit's GTK API? | 0 |
11,728,331 | 07/30/2012 19:34:29 | 860,228 | 07/24/2011 12:59:24 | 44 | 0 | What is the difference between human action recognition and human activity recognition? | I would like to know what is the difference between human action recognition and human activity recognition? Are these terms used interchangeably ? | computer-vision | gesture-recognition | surveillance | null | null | null | open | What is the difference between human action recognition and human activity recognition?
===
I would like to know what is the difference between human action recognition and human activity recognition? Are these terms used interchangeably ? | 0 |
11,728,332 | 07/30/2012 19:34:30 | 1,354,606 | 04/24/2012 19:37:56 | 13 | 0 | How do I access Jinja2 for loop variables outside the loop? | I have a Jinja2 template page which contains two separate {% for %} loops. If neither of these loops contain any items, I want the page to redirect.
I'm trying to do something like
loop1 = loop.length (in first loop)
loop2 = loop.length (in second loop)
if loop1 + loop2 = 0, redirect (outside both loops)
Is this even possible? Is there a way to make the loop.length variables available outside their respective loops? | python | jinja2 | null | null | null | null | open | How do I access Jinja2 for loop variables outside the loop?
===
I have a Jinja2 template page which contains two separate {% for %} loops. If neither of these loops contain any items, I want the page to redirect.
I'm trying to do something like
loop1 = loop.length (in first loop)
loop2 = loop.length (in second loop)
if loop1 + loop2 = 0, redirect (outside both loops)
Is this even possible? Is there a way to make the loop.length variables available outside their respective loops? | 0 |
11,728,336 | 07/30/2012 19:34:48 | 1,125,394 | 01/01/2012 20:49:24 | 621 | 13 | git rebase further | I don't know much how to use rebase, but it seems the rebase only change the starting point to a more recent commit
in my case I did stuff on branch *test* that was pushed, another person pulled the changes B to E
In the mean time I changed slightly a commit, and I deleted (bad idea) my remote branch to recreate one with the same commits
so because of this now it looks after a merge:
A---B---C---D---E--F--G--H master
\--B'--C'--D'--E'/ test
B and B' are the same, at same time, same commit message..., C, C' also, ..D and D' , E and E'
Is there other solution than git rebase -i, I tried it but you lose other branches merge history
I would actually like to remove B, C, D, E, Is it possible if the branches are already merged?
I have no right to push on remote master, only pulling
I tried pruning but those unecessary commits are not removed since they point to others
I would really like to rebase master A onto master E', if it's possible
thx for tips | git | delete | commit | rebase | null | null | open | git rebase further
===
I don't know much how to use rebase, but it seems the rebase only change the starting point to a more recent commit
in my case I did stuff on branch *test* that was pushed, another person pulled the changes B to E
In the mean time I changed slightly a commit, and I deleted (bad idea) my remote branch to recreate one with the same commits
so because of this now it looks after a merge:
A---B---C---D---E--F--G--H master
\--B'--C'--D'--E'/ test
B and B' are the same, at same time, same commit message..., C, C' also, ..D and D' , E and E'
Is there other solution than git rebase -i, I tried it but you lose other branches merge history
I would actually like to remove B, C, D, E, Is it possible if the branches are already merged?
I have no right to push on remote master, only pulling
I tried pruning but those unecessary commits are not removed since they point to others
I would really like to rebase master A onto master E', if it's possible
thx for tips | 0 |
11,728,343 | 07/30/2012 19:35:17 | 420,661 | 08/14/2010 22:02:13 | 412 | 14 | Set-Cookie session not being set after sign_in with cross-domain | I have a rails application that is basically separated into 2 subdomains:
- **API** (CORS) => `api.myapp.dev`
- **Web App** => `myapp.dev`
I can only access my API via `auth_token` when I need to `authenticate_user!`, however I also have an login path, that when user send their credentials (email/password) I return the `auth_token` if it matches.
class Api::V1::SessionsController < Api::V1::BaseController
def create
@user = User.find_for_database_authentication(:email => params[:user][:email])
if @user and @user.valid_password?(params[:user][:password])
sign_in @user # Set-Cookie header response with the session
render "api/v1/users/preview", :handlers => :rabl # return auth_token here
else
flash[:error] = I18n.t('devise.failure.invalid')
render "api/v1/base/error", :handlers => :rabl, :status => :unprocessable_entity
end
end
end
The problem I have is that when my application is a web/mobile browser I would like to set the session cookie after I do ajax login to my API, instead of store the auth_token like most native mobile apps do (iphone/android). My goal with it is that everytime when the user access my website, I'll make a `init` request to my Web App and it will return informations if the user have its session cookies set, like `auth_token` and others, so then I can make all the requests to the API with this token.
So, devise is already setting the `Set-Cookie` header with the response when I success login, but my client side is not setting those cookies. I dont think is a CORS problem and even a configuration with rails sessions, because the domain is already set to match all subdomains also `.myapp.dev`
Do I miss anything? Or am I doing right this authentication? | jquery | ruby-on-rails | api | devise | cors | null | open | Set-Cookie session not being set after sign_in with cross-domain
===
I have a rails application that is basically separated into 2 subdomains:
- **API** (CORS) => `api.myapp.dev`
- **Web App** => `myapp.dev`
I can only access my API via `auth_token` when I need to `authenticate_user!`, however I also have an login path, that when user send their credentials (email/password) I return the `auth_token` if it matches.
class Api::V1::SessionsController < Api::V1::BaseController
def create
@user = User.find_for_database_authentication(:email => params[:user][:email])
if @user and @user.valid_password?(params[:user][:password])
sign_in @user # Set-Cookie header response with the session
render "api/v1/users/preview", :handlers => :rabl # return auth_token here
else
flash[:error] = I18n.t('devise.failure.invalid')
render "api/v1/base/error", :handlers => :rabl, :status => :unprocessable_entity
end
end
end
The problem I have is that when my application is a web/mobile browser I would like to set the session cookie after I do ajax login to my API, instead of store the auth_token like most native mobile apps do (iphone/android). My goal with it is that everytime when the user access my website, I'll make a `init` request to my Web App and it will return informations if the user have its session cookies set, like `auth_token` and others, so then I can make all the requests to the API with this token.
So, devise is already setting the `Set-Cookie` header with the response when I success login, but my client side is not setting those cookies. I dont think is a CORS problem and even a configuration with rails sessions, because the domain is already set to match all subdomains also `.myapp.dev`
Do I miss anything? Or am I doing right this authentication? | 0 |
11,713,721 | 07/29/2012 23:03:09 | 1,294,207 | 03/26/2012 23:01:39 | 537 | 25 | Move sets of files with date encoded names | I have a set of files that have dates in them.
lets call them:
a20120528_120001.log
b20120528_120003.log
(name)(year)(month)(day)_(hour)(minute)(second).log
It is easy enough to move these two files simultaneously by doing:
mv *20120528_12* file/
But now I have a situation where I want to move several hours worth of files in the same day ie:
a20120528_120001.log
b20120528_120003.log
a20120528_130001.log
b20120528_130003.log
a20120528_140001.log
b20120528_140003.log
Now if i wanted to transfer all of them i could just do the day:
mv *20120528* file/
but what can I do if I only want to move hours 12 and 13, but exclude 14.
Please note this will need to be generic enough that i can input the date, because this will extend to be used across multiple days where there are 24 logs per day and several (between 3-8) will be excluded from each day.
How would I do this? | unix | ubuntu | mv | null | null | null | open | Move sets of files with date encoded names
===
I have a set of files that have dates in them.
lets call them:
a20120528_120001.log
b20120528_120003.log
(name)(year)(month)(day)_(hour)(minute)(second).log
It is easy enough to move these two files simultaneously by doing:
mv *20120528_12* file/
But now I have a situation where I want to move several hours worth of files in the same day ie:
a20120528_120001.log
b20120528_120003.log
a20120528_130001.log
b20120528_130003.log
a20120528_140001.log
b20120528_140003.log
Now if i wanted to transfer all of them i could just do the day:
mv *20120528* file/
but what can I do if I only want to move hours 12 and 13, but exclude 14.
Please note this will need to be generic enough that i can input the date, because this will extend to be used across multiple days where there are 24 logs per day and several (between 3-8) will be excluded from each day.
How would I do this? | 0 |
11,713,722 | 07/29/2012 23:03:12 | 1,469,025 | 06/20/2012 11:15:23 | 1 | 0 | passsing <a href value between html and javascript | i am using this slideshow made with html and javascript:
http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/
the slideshow works good hovewer the large images are not clickable. It has the <a href> property but how to make them work so when i click to a picture to send me to the specific link (the link that i write in href="")
it gets the values from this:
<div class="es-carousel">
<ul>
<li><a href="http://www.google.com"><img src="images/cityPlaces_images/thumbs/1.jpg" data-large="images/cityPlaces_images/1.jpg" alt="image01" data-description="From off a hill whose concave womb reworded" /></a></li>
and it generates in this gallery.js:
var $thumb = $item.find('img'),
largesrc = $thumb.data('large'),
title = $thumb.data('description');
$('<img/>').load( function() {
$rgGallery.find('div.rg-image').empty().append('<img src="' + largesrc + '"/>');
if( title )
$rgGallery.find('div.rg-caption').show().children('p').empty().text( title );
| javascript | jquery | html | css | html5 | null | open | passsing <a href value between html and javascript
===
i am using this slideshow made with html and javascript:
http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/
the slideshow works good hovewer the large images are not clickable. It has the <a href> property but how to make them work so when i click to a picture to send me to the specific link (the link that i write in href="")
it gets the values from this:
<div class="es-carousel">
<ul>
<li><a href="http://www.google.com"><img src="images/cityPlaces_images/thumbs/1.jpg" data-large="images/cityPlaces_images/1.jpg" alt="image01" data-description="From off a hill whose concave womb reworded" /></a></li>
and it generates in this gallery.js:
var $thumb = $item.find('img'),
largesrc = $thumb.data('large'),
title = $thumb.data('description');
$('<img/>').load( function() {
$rgGallery.find('div.rg-image').empty().append('<img src="' + largesrc + '"/>');
if( title )
$rgGallery.find('div.rg-caption').show().children('p').empty().text( title );
| 0 |
11,713,718 | 07/29/2012 23:02:49 | 1,404,343 | 05/18/2012 21:32:02 | 13 | 1 | How do I load an image from a webserver to an Android widget | Im trying to load an image from my webserver and display it as an Android widget. Im trying to have the widget update every 60 minutes as well since the image can change. The image should be clickable as well. I had the clickable part working perfectly with a button, but when i change it to an ImageView instead in my layout, the click portion ceases to work. And I cannot get the image to load at all. Here is my code
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
Toast.makeText(context, "onUpdate", Toast.LENGTH_SHORT).show();
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
Intent i = new Intent(context, LoadPage.class);
i.setAction(ACTION_WIDGET_LOAD);
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
remoteViews.setOnClickPendingIntent(R.id.button, pi);
appWidgetManager.updateAppWidget(appWidgetIds, remoteViews);
Timer timer = new Timer();
timer.scheduleAtFixedRate(new MyButton(context, appWidgetManager), 1, 5000);
}
private class MyButton extends TimerTask {
RemoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;
public MyButton(Context context, AppWidgetManager appWidgetManager) {
this.appWidgetManager = appWidgetManager;
remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
thisWidget = new ComponentName(context, ButtonWidget.class);
}
@Override
public void run() {
Bitmap buttonimg = null;
try {
//String name = "http://www.keen.com/calls/callimage.asp?sid=701420&ImageType=1";
String name = "http://badams.ca/otwstats/get_stats.php?user=badams";
URL url_value = new URL(name);
buttonimg = BitmapFactory.decodeStream(url_value.openConnection().getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i++;
remoteViews.setBitmap(R.id.button, "setButton", buttonimg);
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
} | android | widget | null | null | null | null | open | How do I load an image from a webserver to an Android widget
===
Im trying to load an image from my webserver and display it as an Android widget. Im trying to have the widget update every 60 minutes as well since the image can change. The image should be clickable as well. I had the clickable part working perfectly with a button, but when i change it to an ImageView instead in my layout, the click portion ceases to work. And I cannot get the image to load at all. Here is my code
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
Toast.makeText(context, "onUpdate", Toast.LENGTH_SHORT).show();
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
Intent i = new Intent(context, LoadPage.class);
i.setAction(ACTION_WIDGET_LOAD);
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
remoteViews.setOnClickPendingIntent(R.id.button, pi);
appWidgetManager.updateAppWidget(appWidgetIds, remoteViews);
Timer timer = new Timer();
timer.scheduleAtFixedRate(new MyButton(context, appWidgetManager), 1, 5000);
}
private class MyButton extends TimerTask {
RemoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;
public MyButton(Context context, AppWidgetManager appWidgetManager) {
this.appWidgetManager = appWidgetManager;
remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
thisWidget = new ComponentName(context, ButtonWidget.class);
}
@Override
public void run() {
Bitmap buttonimg = null;
try {
//String name = "http://www.keen.com/calls/callimage.asp?sid=701420&ImageType=1";
String name = "http://badams.ca/otwstats/get_stats.php?user=badams";
URL url_value = new URL(name);
buttonimg = BitmapFactory.decodeStream(url_value.openConnection().getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i++;
remoteViews.setBitmap(R.id.button, "setButton", buttonimg);
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
} | 0 |
11,713,724 | 07/29/2012 23:03:28 | 1,218,599 | 02/19/2012 00:02:54 | 381 | 0 | Reading from standard in using ios::binary | I'm trying to read from standard input and distinguish each character from one another by its decimal value. From what I understand, a Line Feed (10) and a Carriage Return (13) will be interpreted as the same character. I want to distinguish between the two. I know if I was reading from a file I could open it using the ios::binary parameter. But what about if I am reading from standard input? | c++ | null | null | null | null | null | open | Reading from standard in using ios::binary
===
I'm trying to read from standard input and distinguish each character from one another by its decimal value. From what I understand, a Line Feed (10) and a Carriage Return (13) will be interpreted as the same character. I want to distinguish between the two. I know if I was reading from a file I could open it using the ios::binary parameter. But what about if I am reading from standard input? | 0 |
11,713,725 | 07/29/2012 23:03:32 | 1,561,617 | 07/29/2012 22:31:17 | 1 | 0 | Xcode Webview Output "null" | I'm developing an iPad app that supposed to output a website to another view, but when the second view loads, it comes up null. I'm using storyboard to link a button to push the web view controller and load the webpage into that view. The code works fine in the first view (indicated by NSLOG), but NSURL never makes it to the second view (NSLOG "Null").
Code in IBAction on first view:
>self.sanctuaryWebViewController = [[SanctuaryWebViewController alloc]init];
self.sanctuaryWebViewController.URL = [NSURL URLWithString:@"http://www.website.org"];
Code in ViewDidLoad Second View:
>NSURLRequest *requestObject = [NSURLRequest requestWithURL:URL];
[webView loadRequest:requestObject];
I have done this in an Iphone app fine declaring a nav delegate to push the view, but not sure if using storyboard or splitview has anything to do with the problem. I spent hours searching for help and tried several different ways to code, but no go. I think I'm close, but not quite there. Using Xcode 4.4 and running on OS 10.8; IOS 5.1
Thanks for any suggestions | xcode | null | null | null | null | null | open | Xcode Webview Output "null"
===
I'm developing an iPad app that supposed to output a website to another view, but when the second view loads, it comes up null. I'm using storyboard to link a button to push the web view controller and load the webpage into that view. The code works fine in the first view (indicated by NSLOG), but NSURL never makes it to the second view (NSLOG "Null").
Code in IBAction on first view:
>self.sanctuaryWebViewController = [[SanctuaryWebViewController alloc]init];
self.sanctuaryWebViewController.URL = [NSURL URLWithString:@"http://www.website.org"];
Code in ViewDidLoad Second View:
>NSURLRequest *requestObject = [NSURLRequest requestWithURL:URL];
[webView loadRequest:requestObject];
I have done this in an Iphone app fine declaring a nav delegate to push the view, but not sure if using storyboard or splitview has anything to do with the problem. I spent hours searching for help and tried several different ways to code, but no go. I think I'm close, but not quite there. Using Xcode 4.4 and running on OS 10.8; IOS 5.1
Thanks for any suggestions | 0 |
11,713,728 | 07/29/2012 23:04:18 | 1,390,647 | 05/12/2012 05:13:25 | 30 | 6 | Win32 C++ - Check if the Window PositionX/PositionY and Width/Height changed | It is possible to check whenever the X/Y position of the window changed? Also, if it's possible to check if the Window Width/Height changed too. | c++ | winapi | window | height | width | null | open | Win32 C++ - Check if the Window PositionX/PositionY and Width/Height changed
===
It is possible to check whenever the X/Y position of the window changed? Also, if it's possible to check if the Window Width/Height changed too. | 0 |
11,713,732 | 07/29/2012 23:05:43 | 493,829 | 11/01/2010 16:55:15 | 82 | 4 | mysql - Weird behavior with varchar column in WHERE clause | I have a table called course_list on in my mysql DB. The SPECIALITY column is of type varchar.
When I do a simple
SELECT * FROM COURSE_LIST WHERE SPECIALITY='IM';
There is around 386 rows with IM value in the SPECIALITY column but not all rows are returned. I am running it on godaddy hosted mysql through phpmyadmin.
Not sure what is happening. Please help. | mysql | phpmyadmin | null | null | null | null | open | mysql - Weird behavior with varchar column in WHERE clause
===
I have a table called course_list on in my mysql DB. The SPECIALITY column is of type varchar.
When I do a simple
SELECT * FROM COURSE_LIST WHERE SPECIALITY='IM';
There is around 386 rows with IM value in the SPECIALITY column but not all rows are returned. I am running it on godaddy hosted mysql through phpmyadmin.
Not sure what is happening. Please help. | 0 |
11,713,733 | 07/29/2012 23:05:57 | 539,484 | 12/12/2010 11:18:15 | 556 | 18 | PHP 'Allowed memory size of 67108864 bytes exhausted' when looping through MySQL result set | Ever since developing my first mySQL project about 7 years ago, I've been using the same set of simple functions for accessing the database (though, have recently put these into a Database class). As the projects I develop have become more complex, there are many more records in the database and, as a result, greater likelihood of memory issues.
I'm getting the PHP error `Allowed memory size of 67108864 bytes exhausted` when looping through a mySQL result set and was wondering whether there was a better way to achieve the flexibility I have without the high memory usage.
My function looks like this:
function get_resultset($query) {
$resultset = array();
if (!($result = mysql_unbuffered_query($query))) {
$men = mysql_errno();
$mem = mysql_error();
echo ('<h4>' . $query . ' ' . $men . ' ' . $mem . '</h4>');
exit;
} else {
$xx = 0 ;
while ( $row = mysql_fetch_array ($result) ) {
$resultset[$xx] = $row;
$xx++ ;
}
mysql_free_result($result);
return $resultset;
}
}
I can then write a query and use the function to get all results, e.g.:
$query = 'SELECT * FROM `members`';
$resultset = get_resultset($query);
I can then loop through the `$resultset` and display the results, e.g.:
$total_results = count($resultset);
for($i=0;$i<$total_results;$i++) {
$record = $resultset[$i];
$firstname = $record['firstname'];
$lastname = $record['lastname'];
// etc, etc display in a table, or whatever
}
Is there a better way of looping through results while still having access to each record's properties for displaying the result list? I've been searching around for people having similar issues and the answers given don't seem to suit my situation or are a little vague. Any help would be greatly appreciated.
| php | mysql | memory | resultset | result | null | open | PHP 'Allowed memory size of 67108864 bytes exhausted' when looping through MySQL result set
===
Ever since developing my first mySQL project about 7 years ago, I've been using the same set of simple functions for accessing the database (though, have recently put these into a Database class). As the projects I develop have become more complex, there are many more records in the database and, as a result, greater likelihood of memory issues.
I'm getting the PHP error `Allowed memory size of 67108864 bytes exhausted` when looping through a mySQL result set and was wondering whether there was a better way to achieve the flexibility I have without the high memory usage.
My function looks like this:
function get_resultset($query) {
$resultset = array();
if (!($result = mysql_unbuffered_query($query))) {
$men = mysql_errno();
$mem = mysql_error();
echo ('<h4>' . $query . ' ' . $men . ' ' . $mem . '</h4>');
exit;
} else {
$xx = 0 ;
while ( $row = mysql_fetch_array ($result) ) {
$resultset[$xx] = $row;
$xx++ ;
}
mysql_free_result($result);
return $resultset;
}
}
I can then write a query and use the function to get all results, e.g.:
$query = 'SELECT * FROM `members`';
$resultset = get_resultset($query);
I can then loop through the `$resultset` and display the results, e.g.:
$total_results = count($resultset);
for($i=0;$i<$total_results;$i++) {
$record = $resultset[$i];
$firstname = $record['firstname'];
$lastname = $record['lastname'];
// etc, etc display in a table, or whatever
}
Is there a better way of looping through results while still having access to each record's properties for displaying the result list? I've been searching around for people having similar issues and the answers given don't seem to suit my situation or are a little vague. Any help would be greatly appreciated.
| 0 |
11,713,734 | 07/29/2012 23:05:58 | 1,561,485 | 07/29/2012 20:25:46 | 1 | 0 | Only follows second parameter | in the following code script for google Spreadsheets, I tried to make a program in which two pieces of information would be inputted to return a desired value that depends on BOTH values. Say, getValcharge ("OptionA", 2000) would return "76", or getValcharge ("OptionB",6000) would return 70. However, it seems to me that I keep getting returned the very last value possible: getValcharge("OptionA"/"OptionB"/"OptionC",1000) would return me "30". Even if I were to put an "OptionD" for the value, it would return "30" if the second number is under 5001.
Thus, it seems to only follow the second parameter --and thus only the second--even when closed off and is supposed to be not accessible to the first.
I am new to Script editor but do have modest Java experience (it'd work were this Java..) Could someone offer any advice/fixes? Any is appreciated. Thanks.
function getValcharge (valType, valAmount) {
var valcost =0;
if(valType="OptionA"){
if(valAmount < 5001)
{valcost = 76;}
if(valAmount > 5000 && valAmount <10001)
{valcost = 113;}
}
if(valType="OptionB"){
if(valAmount < 5001)
{valcost=43; }
if(valAmount > 5000 && valAmount <10001)
{valcost = 70;}
}
if(valType="OptionC")
{
if(valAmount < 5001)
{ valcost = 30; }
if(valAmount > 5000 && valAmount <10001)
{ valcost = 46; }
}
return valcost;
} | google-apps-script | null | null | null | null | null | open | Only follows second parameter
===
in the following code script for google Spreadsheets, I tried to make a program in which two pieces of information would be inputted to return a desired value that depends on BOTH values. Say, getValcharge ("OptionA", 2000) would return "76", or getValcharge ("OptionB",6000) would return 70. However, it seems to me that I keep getting returned the very last value possible: getValcharge("OptionA"/"OptionB"/"OptionC",1000) would return me "30". Even if I were to put an "OptionD" for the value, it would return "30" if the second number is under 5001.
Thus, it seems to only follow the second parameter --and thus only the second--even when closed off and is supposed to be not accessible to the first.
I am new to Script editor but do have modest Java experience (it'd work were this Java..) Could someone offer any advice/fixes? Any is appreciated. Thanks.
function getValcharge (valType, valAmount) {
var valcost =0;
if(valType="OptionA"){
if(valAmount < 5001)
{valcost = 76;}
if(valAmount > 5000 && valAmount <10001)
{valcost = 113;}
}
if(valType="OptionB"){
if(valAmount < 5001)
{valcost=43; }
if(valAmount > 5000 && valAmount <10001)
{valcost = 70;}
}
if(valType="OptionC")
{
if(valAmount < 5001)
{ valcost = 30; }
if(valAmount > 5000 && valAmount <10001)
{ valcost = 46; }
}
return valcost;
} | 0 |
11,713,736 | 07/29/2012 23:06:10 | 1,543,165 | 07/21/2012 19:58:27 | 1 | 0 | Packet Sniffer for Android phones using VPN services | I'm sorry that my question looks non technical or no sense. But I need to ask with no option.
I am doing project for my degree and I have been asked to design a "Packet Sniffer for Android Phones" which should work on non rooted phones, which can not only sniff but should read those IP packets. I am new to this feild and am not such a developer. Based on my studies, i found out that packet sniffers can be developed using VPN services in android, but i dont kno to which extent this is true. Please help with this where to and how to start ?? | java | null | null | null | null | null | open | Packet Sniffer for Android phones using VPN services
===
I'm sorry that my question looks non technical or no sense. But I need to ask with no option.
I am doing project for my degree and I have been asked to design a "Packet Sniffer for Android Phones" which should work on non rooted phones, which can not only sniff but should read those IP packets. I am new to this feild and am not such a developer. Based on my studies, i found out that packet sniffers can be developed using VPN services in android, but i dont kno to which extent this is true. Please help with this where to and how to start ?? | 0 |
11,713,737 | 07/29/2012 23:06:24 | 452,640 | 08/27/2010 22:48:29 | 361 | 6 | Sorting directory files and getting the highest file name | C# WPF | I have a directory with 40 files with names from 0 to 39 (for example),
I am trying to get the file with the largest number in its name (which means I need to get "39")
I am trying to sort the directory..
I have tried using the following topics:
http://stackoverflow.com/questions/6956672/c-sharp-how-to-retrieve-list-of-files-in-directory-sorted-by-name
http://stackoverflow.com/questions/6294275/sorting-the-result-of-directory-getfiles-in-c-sharp
Nothing works for me..
I tried each of the methods - using Linq and the others..
and I dunno why..
I get the following result of the sorting (check picture below):
![enter image description here][1]
[1]: http://i.stack.imgur.com/X1Y2Q.jpg
Thanks for the help,
Din Bracha. | c# | wpf | file | sorting | null | null | open | Sorting directory files and getting the highest file name | C# WPF
===
I have a directory with 40 files with names from 0 to 39 (for example),
I am trying to get the file with the largest number in its name (which means I need to get "39")
I am trying to sort the directory..
I have tried using the following topics:
http://stackoverflow.com/questions/6956672/c-sharp-how-to-retrieve-list-of-files-in-directory-sorted-by-name
http://stackoverflow.com/questions/6294275/sorting-the-result-of-directory-getfiles-in-c-sharp
Nothing works for me..
I tried each of the methods - using Linq and the others..
and I dunno why..
I get the following result of the sorting (check picture below):
![enter image description here][1]
[1]: http://i.stack.imgur.com/X1Y2Q.jpg
Thanks for the help,
Din Bracha. | 0 |
11,713,707 | 07/29/2012 23:00:39 | 808,203 | 06/21/2011 10:08:03 | 377 | 18 | What happens internally when passing a pointer by value? | Suppose I have a following linked list structure:
struct linked_list
{
struct linked_list *next;
int data;
};
typedef struct linked_list node;
And the following function to print the linked list.
void print(node *ptr)
{
while(ptr!=NULL)
{
printf("%d ->",ptr->data);
ptr=ptr->next;
}
}
Now in the `main()` function when I write like this:
`print(head);` //Assume head is the pointer pointing to the head of the list
This is essentially call by value. Because `ptr` in print will receive a copy of `head`. And we can't modify `head` from the `print()` function because its call by value.
But my doubt is, since `ptr` receives a copy of `head` but its able to print the value of linked list. So does that means the `print()` function receives whole copy of linked list? If it does not receives the whole copy of linked list how its able to print the list? | c | pointers | null | null | null | null | open | What happens internally when passing a pointer by value?
===
Suppose I have a following linked list structure:
struct linked_list
{
struct linked_list *next;
int data;
};
typedef struct linked_list node;
And the following function to print the linked list.
void print(node *ptr)
{
while(ptr!=NULL)
{
printf("%d ->",ptr->data);
ptr=ptr->next;
}
}
Now in the `main()` function when I write like this:
`print(head);` //Assume head is the pointer pointing to the head of the list
This is essentially call by value. Because `ptr` in print will receive a copy of `head`. And we can't modify `head` from the `print()` function because its call by value.
But my doubt is, since `ptr` receives a copy of `head` but its able to print the value of linked list. So does that means the `print()` function receives whole copy of linked list? If it does not receives the whole copy of linked list how its able to print the list? | 0 |
11,713,710 | 07/29/2012 23:01:17 | 1,337,478 | 04/16/2012 23:40:54 | 17 | 0 | grab without regex? | I have a url that I want to grab the values for the variable "key2"
http://google.com/dyn_v8/flash/nice-323.swf?file=http://www.yahoo.com/sda/vdsd.ashx?key2=0038003500000077002a001300790002001d0026000e00250008
I simply want to grab just: 0038003500000077002a001300790002001d0026000e00250008 via php.
Please help, thank you in advance. | php | strip | substr | grab | null | null | open | grab without regex?
===
I have a url that I want to grab the values for the variable "key2"
http://google.com/dyn_v8/flash/nice-323.swf?file=http://www.yahoo.com/sda/vdsd.ashx?key2=0038003500000077002a001300790002001d0026000e00250008
I simply want to grab just: 0038003500000077002a001300790002001d0026000e00250008 via php.
Please help, thank you in advance. | 0 |
11,401,449 | 07/09/2012 19:07:13 | 1,440,343 | 06/06/2012 16:56:44 | 1 | 0 | "Can't map name to dispid" error using jacob for subclass method | I am using Jacob (java com bridge) to access MicroStrategy objects.
I have 2 classes IDSSObjectInfo & IDSSFolder and IDSSFolder is a subclass of IDSSObjectInfo (as per the MicroStrategy API).
I do the following:
IDSSObjectInfo objInfo = new IDSSObjectInfo();
IDSSFolder folder = new IDSSFolder(objInfo);
folder.findTypedObjects(8, 0);
Even though IDSSFolder class has the findTypedObjects() method defined, I get the following error on line 3
SEVERE: Can't map name to dispid: FindTypedObjects
com.jacob.com.ComFailException: Can't map name to dispid: FindTypedObjects
This is the snippet of generated code from jacobgen for these classes:
public class IDSSObjectInfo extends Dispatch {
public static final String componentName = "DSSCOMMasterLib.IDSSObjectInfo";
public IDSSObjectInfo() {
super(componentName);
}
}
public class IDSSFolder extends Dispatch {
public static final String componentName = "DSSCOMMasterLib.IDSSFolder";
public IDSSFolder() {
super(componentName);
}
public IDSSFolder(Dispatch d) {
// take over the IDispatch pointer
m_pDispatch = d.m_pDispatch;
// null out the input's pointer
d.m_pDispatch = 0;
}
public IDSSFolder findTypedObjects(int objectType, int flags) {
return new IDSSFolder(Dispatch.call(this, "FindTypedObjects", new Variant(objectType), new Variant(flags)).toDispatch());
}
}
Any help will be greatly appreciated. Thanks!
| jacob | null | null | null | null | null | open | "Can't map name to dispid" error using jacob for subclass method
===
I am using Jacob (java com bridge) to access MicroStrategy objects.
I have 2 classes IDSSObjectInfo & IDSSFolder and IDSSFolder is a subclass of IDSSObjectInfo (as per the MicroStrategy API).
I do the following:
IDSSObjectInfo objInfo = new IDSSObjectInfo();
IDSSFolder folder = new IDSSFolder(objInfo);
folder.findTypedObjects(8, 0);
Even though IDSSFolder class has the findTypedObjects() method defined, I get the following error on line 3
SEVERE: Can't map name to dispid: FindTypedObjects
com.jacob.com.ComFailException: Can't map name to dispid: FindTypedObjects
This is the snippet of generated code from jacobgen for these classes:
public class IDSSObjectInfo extends Dispatch {
public static final String componentName = "DSSCOMMasterLib.IDSSObjectInfo";
public IDSSObjectInfo() {
super(componentName);
}
}
public class IDSSFolder extends Dispatch {
public static final String componentName = "DSSCOMMasterLib.IDSSFolder";
public IDSSFolder() {
super(componentName);
}
public IDSSFolder(Dispatch d) {
// take over the IDispatch pointer
m_pDispatch = d.m_pDispatch;
// null out the input's pointer
d.m_pDispatch = 0;
}
public IDSSFolder findTypedObjects(int objectType, int flags) {
return new IDSSFolder(Dispatch.call(this, "FindTypedObjects", new Variant(objectType), new Variant(flags)).toDispatch());
}
}
Any help will be greatly appreciated. Thanks!
| 0 |
11,401,452 | 07/09/2012 19:07:21 | 1,148,396 | 01/13/2012 19:43:26 | 13 | 2 | Decimals not displaying with XSL transformation | The background for this is that I am working with Solr search results. The results are returned in XML. I am using an XSL transformation to display the results.
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Latitude</th>
<th>Longitude</th>
</tr>
</thead>
<xsl:for-each select="response/result/doc">
<xsl:sort select="str[@name='Name']"/>
<xsl:sort select="int[@name='Age']"/>
<xsl:sort select="???[@name='lat']"/>
<xsl:sort select="???[@name='lng']"/>
<tbody>
<tr>
<td><xsl:value-of select="str[@name='Name']"/></td>
<td><xsl:value-of select="int[@name='Age']"/></td>
<td><xsl:value-of select="???[@name='lat']"/></td>
<td><xsl:value-of select="???[@name='lng']"/></td>
</tr>
</tbody>
</xsl:for-each>
</table>
I had originally indexed every field as string. Once I changed it and indexed the numbers as integers they didn't display in the output. I completely guess and went with int since I indexed them as integers and it worked. ;)
Here are the data types I'm indexing the latitude and longitude with in Solr:
<field name="lat" type="latLongDouble" indexed="true" stored="true"/>
<field name="lng" type="latLongDouble" indexed="true" stored="true"/>
I am not sure of any of the proper XSL datatypes that can be used for the "???" above.
1. Can you provide me a list of these to try out?
2. Can you provide me an alternative XSL method to display the output?
Many thanks!
Pérez | xslt | xpath | solr | null | null | null | open | Decimals not displaying with XSL transformation
===
The background for this is that I am working with Solr search results. The results are returned in XML. I am using an XSL transformation to display the results.
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Latitude</th>
<th>Longitude</th>
</tr>
</thead>
<xsl:for-each select="response/result/doc">
<xsl:sort select="str[@name='Name']"/>
<xsl:sort select="int[@name='Age']"/>
<xsl:sort select="???[@name='lat']"/>
<xsl:sort select="???[@name='lng']"/>
<tbody>
<tr>
<td><xsl:value-of select="str[@name='Name']"/></td>
<td><xsl:value-of select="int[@name='Age']"/></td>
<td><xsl:value-of select="???[@name='lat']"/></td>
<td><xsl:value-of select="???[@name='lng']"/></td>
</tr>
</tbody>
</xsl:for-each>
</table>
I had originally indexed every field as string. Once I changed it and indexed the numbers as integers they didn't display in the output. I completely guess and went with int since I indexed them as integers and it worked. ;)
Here are the data types I'm indexing the latitude and longitude with in Solr:
<field name="lat" type="latLongDouble" indexed="true" stored="true"/>
<field name="lng" type="latLongDouble" indexed="true" stored="true"/>
I am not sure of any of the proper XSL datatypes that can be used for the "???" above.
1. Can you provide me a list of these to try out?
2. Can you provide me an alternative XSL method to display the output?
Many thanks!
Pérez | 0 |
11,401,454 | 07/09/2012 19:07:33 | 465,495 | 10/04/2010 03:14:16 | 46 | 4 | Set table to a certain position that does not change during Javascript | In HTML, I have a div that contains a table of labels and textboxes
![Before writing in password textbox][1]
the following HTML code belongs to the 'td' that contains the 'Password':
<asp:TextBox ID="Password" runat="server" TextMode="Password" onkeyup="return passwordChanged();"></asp:TextBox>
<span id="strengthID"></span>
passwordChanged is a javascript function to determine the strength of the password. This function changes the innerHTML of the span 'strengthID'
My problem is simple: when 'stengthID' changes its content (on onkeyup event), the whole table shifts left.
![After writing in password textbox][2]
My goal is to keep everything as it is while changing the inner text of the span. I couldn't get rid of this behavior. Please can you point to some possible css attribute I would need to use? or any other suggestions?
Thanks,
[1]: http://i.stack.imgur.com/2syXB.jpg
[2]: http://i.stack.imgur.com/F5yKb.jpg | javascript | asp.net | html | null | null | null | open | Set table to a certain position that does not change during Javascript
===
In HTML, I have a div that contains a table of labels and textboxes
![Before writing in password textbox][1]
the following HTML code belongs to the 'td' that contains the 'Password':
<asp:TextBox ID="Password" runat="server" TextMode="Password" onkeyup="return passwordChanged();"></asp:TextBox>
<span id="strengthID"></span>
passwordChanged is a javascript function to determine the strength of the password. This function changes the innerHTML of the span 'strengthID'
My problem is simple: when 'stengthID' changes its content (on onkeyup event), the whole table shifts left.
![After writing in password textbox][2]
My goal is to keep everything as it is while changing the inner text of the span. I couldn't get rid of this behavior. Please can you point to some possible css attribute I would need to use? or any other suggestions?
Thanks,
[1]: http://i.stack.imgur.com/2syXB.jpg
[2]: http://i.stack.imgur.com/F5yKb.jpg | 0 |
11,401,458 | 07/09/2012 19:07:55 | 470,687 | 10/08/2010 21:40:16 | 488 | 9 | Is it possible to configure an Android install to have a quick boot time? (<5 seconds) | I am looking at Android for a project (in car entertainment*) in which power consumption, especially when not in use, is a great concern, but the environment is tightly controlled and *predictable*.
The problem however is that Android has no hibernate mode, and is pretty liberal with allowing Apps processor cycles in standby making it hard to gauge power consumption when the device is not in use and so I would like to shut it down entirely when not needed, which means it needs to boot ***fast***.
I know many Linux variants have achieved [very quick boot times][1] and less than 10 seconds on some could be considered standard. I have also [read about Androids long boot times][2] and it seems a lot of the delays in loading, like on any OS, could be considered optional?
For example, the presentation states that
> "Android can boot without preloading any classes"
and that this
> "can result in bad application load times and memory usage later"
But this is not a concern as long as it is deterministic - if you can find which classes an MP3 player required for example, and turned off all the others and gained 10 seconds it doesn't matter that other apps would take 20 seconds to load because it will never load them.
The same thing goes for the network stack which wouldn't be needed, and for many of the packages, certificate checking, etc.
I know 50 seconds to 5 seconds is a **very** tall order, but is there any reason it is not doable?
Has anyone attempted something like it before? Is Android customizable enough to allow this?
**If Android were to be "streamlined" enough, could it boot in 5 seconds?**
EDIT: The hardware this would be targetting would be 'embedded PC level': think http://store.tinygreenpc.com/tiny-green-pcs/trim-slice/h-diskless.html
(*I like Android over 'standard' Linux distros for this because the entire UI design and ecosystem has been geared around simplicity and portability which makes it perfect for this.)
[1]: http://www.linuxquestions.org/questions/linux-desktop-74/linux-distro-with-the-fastest-boot-598972/page2.html
[2]: http://elinux.org/Improving_Android_Boot_Time | android | android-performance | null | null | null | null | open | Is it possible to configure an Android install to have a quick boot time? (<5 seconds)
===
I am looking at Android for a project (in car entertainment*) in which power consumption, especially when not in use, is a great concern, but the environment is tightly controlled and *predictable*.
The problem however is that Android has no hibernate mode, and is pretty liberal with allowing Apps processor cycles in standby making it hard to gauge power consumption when the device is not in use and so I would like to shut it down entirely when not needed, which means it needs to boot ***fast***.
I know many Linux variants have achieved [very quick boot times][1] and less than 10 seconds on some could be considered standard. I have also [read about Androids long boot times][2] and it seems a lot of the delays in loading, like on any OS, could be considered optional?
For example, the presentation states that
> "Android can boot without preloading any classes"
and that this
> "can result in bad application load times and memory usage later"
But this is not a concern as long as it is deterministic - if you can find which classes an MP3 player required for example, and turned off all the others and gained 10 seconds it doesn't matter that other apps would take 20 seconds to load because it will never load them.
The same thing goes for the network stack which wouldn't be needed, and for many of the packages, certificate checking, etc.
I know 50 seconds to 5 seconds is a **very** tall order, but is there any reason it is not doable?
Has anyone attempted something like it before? Is Android customizable enough to allow this?
**If Android were to be "streamlined" enough, could it boot in 5 seconds?**
EDIT: The hardware this would be targetting would be 'embedded PC level': think http://store.tinygreenpc.com/tiny-green-pcs/trim-slice/h-diskless.html
(*I like Android over 'standard' Linux distros for this because the entire UI design and ecosystem has been geared around simplicity and portability which makes it perfect for this.)
[1]: http://www.linuxquestions.org/questions/linux-desktop-74/linux-distro-with-the-fastest-boot-598972/page2.html
[2]: http://elinux.org/Improving_Android_Boot_Time | 0 |
11,401,462 | 07/09/2012 19:08:02 | 807,769 | 06/21/2011 04:32:20 | 82 | 3 | How can i show a thresholded black/white image in real time camera mode in iphone sdk? | I want to show user real time thresholded black and white image when he open the ipad camera. Before i was just getting the picture from camera then showing the user black/white image but now i want user can see everthing in the cammera in black/white like a preview The code for black and white is here :
ImageWrapper* Image::autoLocalThreshold() {
const int local_size=8;
// now produce the thresholded image
uint8_t *result=(uint8_t*) malloc(m_width*m_height);
// get the initial total
int total=0;
for(int y=0; y<local_size; y++) {
for(int x=0; x<local_size; x++) {
total+=(*this)[y][x];
}
}
// process the image
int lastIndex=m_width*m_height-(m_width*local_size/2+local_size/2);
for(int index=m_width*local_size/2+local_size/2; index<lastIndex; index++) {
int threshold=total/64;
if(m_imageData[index]>threshold*0.9)
result[index]=0;
else
result[index]=255;
// calculate the new total
for(int index2=index-m_width*local_size/2-local_size/2; index2<index+m_width*local_size/2-local_size/2; index2+=m_width) {
total-=m_imageData[index2];
total+=m_imageData[index2+local_size];
}
}
return Image::createImage(result, m_width, m_height, true);
}
I have tried to use avvideocapturesession with the code :
AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput
deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]
error:nil];
AVCaptureVideoDataOutput *captureOutput = [[AVCaptureVideoDataOutput alloc] init] ;
captureOutput.alwaysDiscardsLateVideoFrames = YES;
captureOutput.minFrameDuration = CMTimeMake(1, 25);
dispatch_queue_t queue;
queue = dispatch_queue_create("cameraQueue", NULL);
[captureOutput setSampleBufferDelegate:self queue:queue];
dispatch_release(queue);
NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey;
NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA];
NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key];
[captureOutput setVideoSettings:videoSettings];
captureSession = [[AVCaptureSession alloc] init] ;
[captureSession addInput:captureInput];
[captureSession addOutput:captureOutput];
captureSession.sessionPreset=AVCaptureSessionPresetLow;
/*sessionPresent choose appropriate value to get desired speed*/
[captureSession startRunning];
I can see the camera opens up with this code but how can i implement
my black and white code with this so the user sees thresholded video in camera mode ?
Thanks in advance .i will really appreciate your help
| objective-c | iphone-sdk-4.0 | avcapturesession | avcapturedevice | null | null | open | How can i show a thresholded black/white image in real time camera mode in iphone sdk?
===
I want to show user real time thresholded black and white image when he open the ipad camera. Before i was just getting the picture from camera then showing the user black/white image but now i want user can see everthing in the cammera in black/white like a preview The code for black and white is here :
ImageWrapper* Image::autoLocalThreshold() {
const int local_size=8;
// now produce the thresholded image
uint8_t *result=(uint8_t*) malloc(m_width*m_height);
// get the initial total
int total=0;
for(int y=0; y<local_size; y++) {
for(int x=0; x<local_size; x++) {
total+=(*this)[y][x];
}
}
// process the image
int lastIndex=m_width*m_height-(m_width*local_size/2+local_size/2);
for(int index=m_width*local_size/2+local_size/2; index<lastIndex; index++) {
int threshold=total/64;
if(m_imageData[index]>threshold*0.9)
result[index]=0;
else
result[index]=255;
// calculate the new total
for(int index2=index-m_width*local_size/2-local_size/2; index2<index+m_width*local_size/2-local_size/2; index2+=m_width) {
total-=m_imageData[index2];
total+=m_imageData[index2+local_size];
}
}
return Image::createImage(result, m_width, m_height, true);
}
I have tried to use avvideocapturesession with the code :
AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput
deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]
error:nil];
AVCaptureVideoDataOutput *captureOutput = [[AVCaptureVideoDataOutput alloc] init] ;
captureOutput.alwaysDiscardsLateVideoFrames = YES;
captureOutput.minFrameDuration = CMTimeMake(1, 25);
dispatch_queue_t queue;
queue = dispatch_queue_create("cameraQueue", NULL);
[captureOutput setSampleBufferDelegate:self queue:queue];
dispatch_release(queue);
NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey;
NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA];
NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key];
[captureOutput setVideoSettings:videoSettings];
captureSession = [[AVCaptureSession alloc] init] ;
[captureSession addInput:captureInput];
[captureSession addOutput:captureOutput];
captureSession.sessionPreset=AVCaptureSessionPresetLow;
/*sessionPresent choose appropriate value to get desired speed*/
[captureSession startRunning];
I can see the camera opens up with this code but how can i implement
my black and white code with this so the user sees thresholded video in camera mode ?
Thanks in advance .i will really appreciate your help
| 0 |
11,401,465 | 07/09/2012 19:08:05 | 1,426,436 | 05/30/2012 15:44:07 | 88 | 1 | How to source remote scripts and assign variables remotely in rsh? | There is this problem that's been bothering me lately.
I'm trying to do the following using rsh or remsh (in HPUX):
#!/bin/sh
rsh myDNS"
DIRECTORY=/tmp/foo1/foo2
echo $DIRECTORY
"
When I try to run the above script, however, I get blank output for $DIRECTORY. Consequently, when this issue is applied to the actual scripts I'm working on, bash claims that it could not find the specified script that I was trying to source.
| linux | bash | hp-ux | rsh | null | null | open | How to source remote scripts and assign variables remotely in rsh?
===
There is this problem that's been bothering me lately.
I'm trying to do the following using rsh or remsh (in HPUX):
#!/bin/sh
rsh myDNS"
DIRECTORY=/tmp/foo1/foo2
echo $DIRECTORY
"
When I try to run the above script, however, I get blank output for $DIRECTORY. Consequently, when this issue is applied to the actual scripts I'm working on, bash claims that it could not find the specified script that I was trying to source.
| 0 |
11,401,473 | 07/09/2012 19:08:25 | 582,136 | 01/19/2011 21:29:19 | 1,514 | 63 | Dynamically modify column DataGrid | I'm having trouble dynamically setting the data for a column in a DataGrid. I successfully added columns set the column headers dynamically, but I can't seem to set the data. Here's what the result is:
![A data grid without rows][1]
The data is being read, and columnData contains the correct values, as the logger tells me. (I'm not using the Debug class because I'm testing on a machine that doesn't have Visual C#).
My DataGrid class is where the problem lies, I think. Moreover, I think the problem lies in how I'm using the binding (I don't have a good grasp of how to do it, yet)
This is my class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
namespace mdr
{
class MDRResult : System.Windows.Controls.DataGrid
{
private string[] headers;
private string[][] fields;
public MDRResult(string[] headers, string[][] fields) : base()
{
int columnNumber = 0;
foreach (string s in headers)
{
System.Windows.Controls.DataGridTextColumn column = new System.Windows.Controls.DataGridTextColumn();
column.Header = s;
string[] columnData = new string[fields.Length];
int rowNumber = 0;
foreach (string[] row in fields)
{
columnData[rowNumber] = row[columnNumber];
rowNumber++;
}
SurfaceWindow1.logger.WriteLine("Adding column " + s + " with data ");
foreach (string str in columnData)
SurfaceWindow1.logger.WriteLine("\t" + str);
Binding b = new Binding();
//b.Mode = BindingMode.OneTime;
b.Source = columnData;
column.Binding = b;
Columns.Add(column);
columnNumber++;
}
}
}
}
[1]: http://i.stack.imgur.com/k5m1a.png
| c# | .net | wpf | datagrid | null | null | open | Dynamically modify column DataGrid
===
I'm having trouble dynamically setting the data for a column in a DataGrid. I successfully added columns set the column headers dynamically, but I can't seem to set the data. Here's what the result is:
![A data grid without rows][1]
The data is being read, and columnData contains the correct values, as the logger tells me. (I'm not using the Debug class because I'm testing on a machine that doesn't have Visual C#).
My DataGrid class is where the problem lies, I think. Moreover, I think the problem lies in how I'm using the binding (I don't have a good grasp of how to do it, yet)
This is my class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
namespace mdr
{
class MDRResult : System.Windows.Controls.DataGrid
{
private string[] headers;
private string[][] fields;
public MDRResult(string[] headers, string[][] fields) : base()
{
int columnNumber = 0;
foreach (string s in headers)
{
System.Windows.Controls.DataGridTextColumn column = new System.Windows.Controls.DataGridTextColumn();
column.Header = s;
string[] columnData = new string[fields.Length];
int rowNumber = 0;
foreach (string[] row in fields)
{
columnData[rowNumber] = row[columnNumber];
rowNumber++;
}
SurfaceWindow1.logger.WriteLine("Adding column " + s + " with data ");
foreach (string str in columnData)
SurfaceWindow1.logger.WriteLine("\t" + str);
Binding b = new Binding();
//b.Mode = BindingMode.OneTime;
b.Source = columnData;
column.Binding = b;
Columns.Add(column);
columnNumber++;
}
}
}
}
[1]: http://i.stack.imgur.com/k5m1a.png
| 0 |
11,401,474 | 07/09/2012 19:08:30 | 1,512,318 | 07/09/2012 14:50:56 | 8 | 1 | An objective-c float is supposed to be signed, so why is subtraction causing a wrap-around? | float test=-1;
produces a float with value -1. However,
float test=arc4random()%500-500;
produces enormous values that clearly resulted from a buffer overflow ~ the numbers wrapping around. This should not happen with a float; for kicks I tried to see if xcode would let me make a "signed float", but it told me "floats cannot be signed or unsigned."
I produced a work-around where I made a signed int, then cast it to a float, but I'd really appreciate knowing how/why this happened. | objective-c | null | null | null | null | null | open | An objective-c float is supposed to be signed, so why is subtraction causing a wrap-around?
===
float test=-1;
produces a float with value -1. However,
float test=arc4random()%500-500;
produces enormous values that clearly resulted from a buffer overflow ~ the numbers wrapping around. This should not happen with a float; for kicks I tried to see if xcode would let me make a "signed float", but it told me "floats cannot be signed or unsigned."
I produced a work-around where I made a signed int, then cast it to a float, but I'd really appreciate knowing how/why this happened. | 0 |
11,350,106 | 07/05/2012 18:12:11 | 535,296 | 12/08/2010 16:48:13 | 113 | 2 | How to prevent text highlighting on mousedown and keep hover states while dragging? | I'm stopping a `mousedown` event when my users press on a custom dropdown list. This is to avoid the default text-highlighting behaviour of the browser while the user is effectively dragging the mouse.
I'm doing this with a jQuery `event.preventDefault()` call in the handler function and returning false.
This has the desired effect, except that in Chrome it also prevents CSS `:hover` states to work while the mouse is still pressed.
Firefox doesn't suffer the same problem. The text highlighting is cancelled, and the :hover states continue to work as the user rolls over items with the mouse still pressed.
Is there a method that will work in Chrome too?
I could add further `mouseover` handlers to add custom classes, but I'd prefer a more graceful solution so I can use the :hover pseudo classes in my CSS. | javascript | jquery | dom | event-handling | null | null | open | How to prevent text highlighting on mousedown and keep hover states while dragging?
===
I'm stopping a `mousedown` event when my users press on a custom dropdown list. This is to avoid the default text-highlighting behaviour of the browser while the user is effectively dragging the mouse.
I'm doing this with a jQuery `event.preventDefault()` call in the handler function and returning false.
This has the desired effect, except that in Chrome it also prevents CSS `:hover` states to work while the mouse is still pressed.
Firefox doesn't suffer the same problem. The text highlighting is cancelled, and the :hover states continue to work as the user rolls over items with the mouse still pressed.
Is there a method that will work in Chrome too?
I could add further `mouseover` handlers to add custom classes, but I'd prefer a more graceful solution so I can use the :hover pseudo classes in my CSS. | 0 |
11,350,108 | 07/05/2012 18:12:32 | 1,504,820 | 07/05/2012 17:57:42 | 1 | 0 | Loading images from CSS stylesheet that is on remote host | I have the following files structure:
On server 'site1.com':
- images\background.jpg
- index.html
On server 'site2.com':
- css\main.css
On the file 'index.html', on site1.com, i am point to the stylesheet on site2.com/css/main.css.
On the file 'main.css' i have a rule that says: `background-image: url(images/background.jpg);`
The problem is that the file 'index.html' is not loading 'background.jpg' as its background. How can I fix that? The only way is writing the absolute path `background-image: url(site1.com/images/background.jpg);` at the stylesheet rule?
Thanks in advance.
| css | image | remote | loading | null | null | open | Loading images from CSS stylesheet that is on remote host
===
I have the following files structure:
On server 'site1.com':
- images\background.jpg
- index.html
On server 'site2.com':
- css\main.css
On the file 'index.html', on site1.com, i am point to the stylesheet on site2.com/css/main.css.
On the file 'main.css' i have a rule that says: `background-image: url(images/background.jpg);`
The problem is that the file 'index.html' is not loading 'background.jpg' as its background. How can I fix that? The only way is writing the absolute path `background-image: url(site1.com/images/background.jpg);` at the stylesheet rule?
Thanks in advance.
| 0 |
3,453,274 | 08/10/2010 20:44:46 | 40,015 | 11/23/2008 03:15:17 | 5,540 | 268 | Using Linq to get the last N elements of a collection? | Given a collection, is there a way to get the last N elements of that collection? If there isn't a method in the framework, what would be the best way to write an extension method to do this? | c# | linq | null | null | null | null | open | Using Linq to get the last N elements of a collection?
===
Given a collection, is there a way to get the last N elements of that collection? If there isn't a method in the framework, what would be the best way to write an extension method to do this? | 0 |
11,350,109 | 07/05/2012 18:12:35 | 1,499,854 | 07/03/2012 19:59:44 | 1 | 0 | Why isn't my app parsing the link correctly for video? | So I'm extremely new to coding in general (my background is in video production) and I've been tasked with creating an iPhone app. Xcode has actually been pretty easy with tutorials and the like, but I've run into a brick wall of things outside of my knowledge. Anyway...here goes.
I followed a tutorial on YouTube about parsing XML in iOS. Works great. However, the tutorial parses the XML into labels. That part works perfectly. However, I'm attempting to parse a podcast RSS feed, using a custom made XML document, and I'd like the link to the video to go to a button that plays, rather than fill a label. So I assumed I could pass the link that's already working into a button that uses the MPMoviePlayerViewController. Didn't work.
It gave an error about passing an NSString as a URL. I then used NSUrl to make the video link. No error, but the video doesn't play. Any ideas of what I'm doing wrong?
The only code I'm including is the DetailViewController.m file, as everything else works, even the link showing up correctly in the label. It just doesn't connect to the button correctly. When you tap the play button in the simulator, it launches the movie player and just shows the "Loading..." screen.Any help would be greatly appreciated.
#import "DetailViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@implementation DetailViewController
@synthesize theList;
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = theList.title;
theTitle.text = theList.title;
theAuthor.text = theList.author;
playAudio.text = theList.audio;
playVideo.text = theList.video;
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (IBAction)playVid:(id)sender {
NSURL *playVid = [NSURL URLWithString:theList.video];
MPMoviePlayerViewController *mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:playVid];
[mpViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:YES];
[self presentMoviePlayerViewControllerAnimated:mpViewController];
}
@end
| ios | xml-parsing | mpmovieplayercontroller | null | null | null | open | Why isn't my app parsing the link correctly for video?
===
So I'm extremely new to coding in general (my background is in video production) and I've been tasked with creating an iPhone app. Xcode has actually been pretty easy with tutorials and the like, but I've run into a brick wall of things outside of my knowledge. Anyway...here goes.
I followed a tutorial on YouTube about parsing XML in iOS. Works great. However, the tutorial parses the XML into labels. That part works perfectly. However, I'm attempting to parse a podcast RSS feed, using a custom made XML document, and I'd like the link to the video to go to a button that plays, rather than fill a label. So I assumed I could pass the link that's already working into a button that uses the MPMoviePlayerViewController. Didn't work.
It gave an error about passing an NSString as a URL. I then used NSUrl to make the video link. No error, but the video doesn't play. Any ideas of what I'm doing wrong?
The only code I'm including is the DetailViewController.m file, as everything else works, even the link showing up correctly in the label. It just doesn't connect to the button correctly. When you tap the play button in the simulator, it launches the movie player and just shows the "Loading..." screen.Any help would be greatly appreciated.
#import "DetailViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@implementation DetailViewController
@synthesize theList;
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = theList.title;
theTitle.text = theList.title;
theAuthor.text = theList.author;
playAudio.text = theList.audio;
playVideo.text = theList.video;
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (IBAction)playVid:(id)sender {
NSURL *playVid = [NSURL URLWithString:theList.video];
MPMoviePlayerViewController *mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:playVid];
[mpViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:YES];
[self presentMoviePlayerViewControllerAnimated:mpViewController];
}
@end
| 0 |
11,350,102 | 07/05/2012 18:11:47 | 570,009 | 01/10/2011 15:16:00 | 337 | 16 | Yii framework: How do I use CActiveRecord.beforeFind()? | I'm in a need to use beforeFind() in a child class of CActiveRecord.
Basically, I need to convert some data from before actual search in the DB is performed.
How do I alter the about-to-occur-find-operation that is about to take place, inside beforeFind()? Messing with '$this' attributes is not useful since its not even populated, which is a little surprise.
I've seen the documentation mentions a "hidden CDbCriteria parameter" but I just couldn't guess how to use it... . Unfortunately, the documentation on this subject is slim.
Help!
TIA :) | activerecord | yii | yii-events | null | null | null | open | Yii framework: How do I use CActiveRecord.beforeFind()?
===
I'm in a need to use beforeFind() in a child class of CActiveRecord.
Basically, I need to convert some data from before actual search in the DB is performed.
How do I alter the about-to-occur-find-operation that is about to take place, inside beforeFind()? Messing with '$this' attributes is not useful since its not even populated, which is a little surprise.
I've seen the documentation mentions a "hidden CDbCriteria parameter" but I just couldn't guess how to use it... . Unfortunately, the documentation on this subject is slim.
Help!
TIA :) | 0 |
11,344,759 | 07/05/2012 12:52:44 | 1,300,827 | 03/29/2012 12:56:03 | 28 | 0 | Blink WPF DataGrid cell based on data value | ###Setup:
I have a DataGrid bound to a collection of POCOs, which implement INotifyPropertyChanged interface and fire PropertyChanged events. One of the properties is a double value, let's call it Price.
###Goal:
When Price goes up, DataGrid cell displaying it should blink green, when it goes down it should blink red. By blink I mean change background color for certain (small) amount of time.
###Problem:
I'm unable to achieve this, have tried using data triggers with specially added properties in the data object (eg. PriceUp and PriceDown), but the problem is when and how to reset these flags to false, so that subsequent change would again run the trigger. Pulsing the flag false then true on update doesn't work. EventTrigger (on TargetUpdated) is of no help either, as far as I can tell, since I can't combine it with data conditions.
####Note:
I found similar (or same) [question](http://english.stackexchange.com/questions/11481), but although marked as answered, it actually is not. | c# | wpf | wcf-binding | datatrigger | eventtrigger | null | open | Blink WPF DataGrid cell based on data value
===
###Setup:
I have a DataGrid bound to a collection of POCOs, which implement INotifyPropertyChanged interface and fire PropertyChanged events. One of the properties is a double value, let's call it Price.
###Goal:
When Price goes up, DataGrid cell displaying it should blink green, when it goes down it should blink red. By blink I mean change background color for certain (small) amount of time.
###Problem:
I'm unable to achieve this, have tried using data triggers with specially added properties in the data object (eg. PriceUp and PriceDown), but the problem is when and how to reset these flags to false, so that subsequent change would again run the trigger. Pulsing the flag false then true on update doesn't work. EventTrigger (on TargetUpdated) is of no help either, as far as I can tell, since I can't combine it with data conditions.
####Note:
I found similar (or same) [question](http://english.stackexchange.com/questions/11481), but although marked as answered, it actually is not. | 0 |
11,660,395 | 07/25/2012 23:50:27 | 1,533,174 | 07/17/2012 22:53:45 | 29 | 0 | How to autopopulate an HTML form and submit it instantly? | I have a simple HTML form with a username and password.
This HTML form contains a login for both free and paid users. Paid users need to enter a username and password, while free users have to enter default usernames e.g. Username = myname, and Password = password.
I managed to auto populate the values of the form using an HTML link -
<a href="#" onclick="document.getElementById('name').value='myname';document.getElementById('password').value='mypassword';" >Free User</a>
This worked smoothly. Now I would like to add the possibility that when the Free User clicks the button, the values are auto populated as above and the said HTML form is submitted immediately.
When I tried it using various methods, the fields would populate but the HTML form will not submit.
Thanks you.
| javascript | html | null | null | null | null | open | How to autopopulate an HTML form and submit it instantly?
===
I have a simple HTML form with a username and password.
This HTML form contains a login for both free and paid users. Paid users need to enter a username and password, while free users have to enter default usernames e.g. Username = myname, and Password = password.
I managed to auto populate the values of the form using an HTML link -
<a href="#" onclick="document.getElementById('name').value='myname';document.getElementById('password').value='mypassword';" >Free User</a>
This worked smoothly. Now I would like to add the possibility that when the Free User clicks the button, the values are auto populated as above and the said HTML form is submitted immediately.
When I tried it using various methods, the fields would populate but the HTML form will not submit.
Thanks you.
| 0 |
11,660,401 | 07/25/2012 23:50:53 | 1,370,564 | 05/02/2012 16:42:10 | 18 | 1 | File.md5Checksum equivalent for Google Doc files | For non-Google Doc files in a Google Drive, I can detect a change by comparing the File.md5Checksum with a previous value.
md5Checksum is null for Google Doc files:
application/vnd.google-apps.*
Is there any method besides File.modifiedDate?
Admittedly, it's sort of a corner case: if a doc goes from state A => B => A, then the modifiedDate will change but not the content. | google-drive-sdk | null | null | null | null | null | open | File.md5Checksum equivalent for Google Doc files
===
For non-Google Doc files in a Google Drive, I can detect a change by comparing the File.md5Checksum with a previous value.
md5Checksum is null for Google Doc files:
application/vnd.google-apps.*
Is there any method besides File.modifiedDate?
Admittedly, it's sort of a corner case: if a doc goes from state A => B => A, then the modifiedDate will change but not the content. | 0 |
11,660,113 | 07/25/2012 23:18:19 | 1,294,247 | 03/03/2010 01:48:55 | 1 | 0 | Report and Graphic in access 2007 - calculating values on queries | Picture a table with fields (Id, Valid, Value)
Valid = boolean
Value = number from 0 to 100
What I want is a report that counts the number of records where (valid = 0), and then gives me the total number of cases where (value < 70) and the number of cases where (value >= 70).
The problem is that the "value" field could be empty on some of the records and I only want the records where the value field is not empty.
I know that the second value (value>=70) is going to be calculated, but the problem is that I can't simply do (total number of records - number of records where value < 70), because there's the problem with the records where "value" is null...
And then I want to create graphic with these values, to see the percentage of records below and above 70. | query | report | ms-access-2007 | null | null | null | open | Report and Graphic in access 2007 - calculating values on queries
===
Picture a table with fields (Id, Valid, Value)
Valid = boolean
Value = number from 0 to 100
What I want is a report that counts the number of records where (valid = 0), and then gives me the total number of cases where (value < 70) and the number of cases where (value >= 70).
The problem is that the "value" field could be empty on some of the records and I only want the records where the value field is not empty.
I know that the second value (value>=70) is going to be calculated, but the problem is that I can't simply do (total number of records - number of records where value < 70), because there's the problem with the records where "value" is null...
And then I want to create graphic with these values, to see the percentage of records below and above 70. | 0 |
11,660,397 | 07/25/2012 23:50:32 | 759,316 | 05/18/2011 13:54:19 | 1,625 | 68 | Cache results for functions? | In Javascript, is there a way to cache results for functions that are:
- a). Computationally expensive.
- b). Called multiple times.
Take for example a recursive factorial function that gets called frequently. Usually I'd create a separate array such as `facotrialResults = [];` and add my results to them when I calculate them, `factorialResults[x] = result;` However, is there a better way to accomplish this caching without the use of adding a new variable to the global namespace? | javascript | caching | null | null | null | null | open | Cache results for functions?
===
In Javascript, is there a way to cache results for functions that are:
- a). Computationally expensive.
- b). Called multiple times.
Take for example a recursive factorial function that gets called frequently. Usually I'd create a separate array such as `facotrialResults = [];` and add my results to them when I calculate them, `factorialResults[x] = result;` However, is there a better way to accomplish this caching without the use of adding a new variable to the global namespace? | 0 |
11,660,400 | 07/25/2012 23:50:50 | 1,477,153 | 06/23/2012 17:48:30 | 1 | 0 | Convert MS Access Crosstab query to SQL stored procedure | I'm trying to convert MS Access Cross Tab query into SQL Sever stored procedure but having issue with pivoting data in SQL. Here's the MS Access cross query I want to convert -
TRANSFORM Sum(NZ(Actuals!Amount,0)) AS Amount
SELECT Actuals.PS_OV, Actuals.Period, Actuals.Program, Actuals.Actuals_Year
FROM Actuals
GROUP BY Actuals.PS_OV, Actuals.Period, Actuals.Program, Actuals.Actuals_Year
PIVOT Actuals.Source;
Values from the Source field (i.e. Equipment, Expense, Furniture, Leasehold) are pivoted to columns. Kindly advise how to do this in SQL stored procedure?
Many Thanks.
| sql | null | null | null | null | null | open | Convert MS Access Crosstab query to SQL stored procedure
===
I'm trying to convert MS Access Cross Tab query into SQL Sever stored procedure but having issue with pivoting data in SQL. Here's the MS Access cross query I want to convert -
TRANSFORM Sum(NZ(Actuals!Amount,0)) AS Amount
SELECT Actuals.PS_OV, Actuals.Period, Actuals.Program, Actuals.Actuals_Year
FROM Actuals
GROUP BY Actuals.PS_OV, Actuals.Period, Actuals.Program, Actuals.Actuals_Year
PIVOT Actuals.Source;
Values from the Source field (i.e. Equipment, Expense, Furniture, Leasehold) are pivoted to columns. Kindly advise how to do this in SQL stored procedure?
Many Thanks.
| 0 |
11,660,405 | 07/25/2012 23:52:02 | 1,541,913 | 07/20/2012 22:39:53 | 8 | 0 | Adding/replacing records in SQL table from PHP: Grab entire table first, or use SELECT as needed? | I am making a piece of PHP code that takes user XML input (containing multiple records/items, usually around 20 to 100), parses it, and then checks it against a database of records. If a record is not in the database, the PHP script should INSERT it. If the record is in the database, the script should either discard it or run an UPDATE of that record, depending on whether the user has a 'replace records' checkbox checked.
My question is, which is faster: To SELECT the columns of the entire table that determine uniqueness, then sort through them in PHP? Or, for *each* record, to do a SELECT COUNT() FROM table WHERE name=(input name) AND region=(input region) and see if any records come back?
One big SQL query + quite a lot of PHP sorting time, or 100 small SQL queries and one PHP comparison? | php | mysql | performance | query | search | null | open | Adding/replacing records in SQL table from PHP: Grab entire table first, or use SELECT as needed?
===
I am making a piece of PHP code that takes user XML input (containing multiple records/items, usually around 20 to 100), parses it, and then checks it against a database of records. If a record is not in the database, the PHP script should INSERT it. If the record is in the database, the script should either discard it or run an UPDATE of that record, depending on whether the user has a 'replace records' checkbox checked.
My question is, which is faster: To SELECT the columns of the entire table that determine uniqueness, then sort through them in PHP? Or, for *each* record, to do a SELECT COUNT() FROM table WHERE name=(input name) AND region=(input region) and see if any records come back?
One big SQL query + quite a lot of PHP sorting time, or 100 small SQL queries and one PHP comparison? | 0 |
11,565,038 | 07/19/2012 16:17:32 | 694,449 | 04/06/2011 08:36:56 | 45 | 2 | Yii with ob_gzhandler; Compression html | I have add this code to configration file `main.php` on Yii to compress html markups
'preload'=>array('log'),
'onBeginRequest' => create_function('$event', 'return ob_start("ob_gzhandler");'),
'onEndRequest' => create_function('$event', 'return ob_end_flush();'),
but I have conflict with zlib how can I fix that ?
ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression' | php | html | yii | null | null | null | open | Yii with ob_gzhandler; Compression html
===
I have add this code to configration file `main.php` on Yii to compress html markups
'preload'=>array('log'),
'onBeginRequest' => create_function('$event', 'return ob_start("ob_gzhandler");'),
'onEndRequest' => create_function('$event', 'return ob_end_flush();'),
but I have conflict with zlib how can I fix that ?
ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression' | 0 |
11,565,039 | 07/19/2012 16:17:39 | 469,775 | 10/08/2010 02:17:04 | 40 | 4 | using mongoskin with in node.js, cannot deep copy result array | I am unsure how to return a mongoskin collection through my restify server.
I have:
function clone(x)
{
if (x.clone)
return x.clone();
if (x.constructor == Array)
{
var r = [];
for (var i=0,n=x.length; i<n; i++)
r.push(clone(x[i]));
return r;
}
return x;
}
function getCollection(collectionName){
var ret = [];
db.collection(collectionName).find().toArray(function(err, result) {
ret = clone(result);
});
return ret;
}
But when I call:
var col = getCollection('person');
getCollection returns undefined.
How do I get the array back out of the callback so I can send it back to the client? | node.js | restify | mongoskin | null | null | null | open | using mongoskin with in node.js, cannot deep copy result array
===
I am unsure how to return a mongoskin collection through my restify server.
I have:
function clone(x)
{
if (x.clone)
return x.clone();
if (x.constructor == Array)
{
var r = [];
for (var i=0,n=x.length; i<n; i++)
r.push(clone(x[i]));
return r;
}
return x;
}
function getCollection(collectionName){
var ret = [];
db.collection(collectionName).find().toArray(function(err, result) {
ret = clone(result);
});
return ret;
}
But when I call:
var col = getCollection('person');
getCollection returns undefined.
How do I get the array back out of the callback so I can send it back to the client? | 0 |
11,571,698 | 07/20/2012 01:36:57 | 1,484,008 | 06/26/2012 21:23:46 | 1 | 0 | Combining MKOverlays | I need to draw many (hundreds to thousands) of square overlays on a map. The positions and sizes of these overlays stay constant. I think that I can speed up rendering by combining these square overlays into a single overlay so drawMapRect only needs to be called once. Is this possible? | uiview | mapkit | null | null | null | null | open | Combining MKOverlays
===
I need to draw many (hundreds to thousands) of square overlays on a map. The positions and sizes of these overlays stay constant. I think that I can speed up rendering by combining these square overlays into a single overlay so drawMapRect only needs to be called once. Is this possible? | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.