unified_texts stringlengths 32 30.1k | OpenStatus_id int64 0 4 | input_ids list | token_type_ids list | attention_mask list |
|---|---|---|---|---|
How to store multiple trees in Django? Different tree structures with same nodes?
===
I have been investigating using django-mptt to store tree structures. Suppose for example I have a Users model and I want users to be able to store a hierarchy (tree) of other users. Is there any preferred way of accomplishing this? All I can think of is having models for Users, treeitem, and tree. Tree would associate a user id with a tree id. Treeitem would be an mptt model with a userid field. Essentially treeitem would be one big tree which many root nodes, one for each individual user tree.
Does this sound reasonable or have I missed something? Thanks in advance. | 0 | [
2,
184,
20,
1718,
1886,
1913,
19,
3857,
14541,
60,
421,
1541,
3815,
29,
205,
16272,
60,
800,
3726,
3726,
31,
57,
74,
12490,
568,
3857,
14541,
8,
2554,
38,
38,
20,
1718,
1541,
3815,
9,
5787,
26,
823,
31,
57,
21,
3878,
1061,
17,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
JS game development libs?
===
I have a realtime tile set / map strategy style game that I'm building with JavaScript on the client side, however I want to leverage an existing library or libraries that have perhaps thought through some issues more methodically than I'd be able to just starting off.
For example, I'm looking at Ember.js (playing with Backbone a little and even Meteor), however it seems that I'm missing some options as far as leveraging utilities that may already be in place. What game js development libs have you used or seen that may be useful in this context? | 0 | [
2,
487,
18,
250,
522,
13,
8326,
18,
60,
800,
3726,
3726,
31,
57,
21,
683,
891,
13,
9802,
309,
13,
118,
2942,
4427,
1034,
250,
30,
31,
22,
79,
353,
29,
8247,
8741,
27,
14,
6819,
270,
15,
207,
31,
259,
20,
19414,
40,
3149,
124... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how to query BlogEngine.Net for posts
===
I'm looking to implement BlogEngine.Net. My goal is to have multiple authors submitting posts. I'm using SQL Server db to store the blog and posts.
I need to pull posts for a couple of different scenarios:
1. pull latest 5 posts across all authors
2. pull last 10 posts by author
I'm hoping there's a way to retrieve posts in JSON format.
Since the posts are saved in database, I could create a connection directly to the database and retrieve the posts outside of BlogEngine.Net. I'd rather not do that as I feel that's re-inventing the wheel. So, how can I query BlogEngine.Net for posts? | 0 | [
2,
184,
20,
25597,
8146,
16847,
9,
2328,
26,
9868,
800,
3726,
3726,
31,
22,
79,
699,
20,
8713,
8146,
16847,
9,
2328,
9,
51,
1195,
25,
20,
57,
1886,
5152,
28848,
9868,
9,
31,
22,
79,
568,
4444,
255,
8128,
13,
9007,
20,
1718,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Shove knowing about an object but unable to retrieve it
===
After a lot of playing around I found a workaround for some weird behaviour but would like to understand what's going on. Sorry if I am missing elementary stuff but I am pretty inexperienced in python.
So...
I am storing an object in Shove in one script and retrieving in another one - all works fine if I use my workaround
**`shove_repro_class.y`**
class MyClass():
def __init__(self, name ):
self.name = name
self.othername = "%s" % name ## <=== workaround for
## <=== self.othername = name
def __repr__(self):
return 'Object "%s"' % self.name
**`shove_repro.py` (this is the first script to run)**
from shove import Shove
from shove_repro_class import MyClass
location = 'file://test'
# location = 'sqlite:///test.db' # this won't work any better
data = Shove(location)
data['somename'] = MyClass('somename')
data.close()
**`shove_repro2.py` (this is the second script to run)**
from shove import Shove
from shove_repro_class import MyClass
location = 'file://test'
# location = 'sqlite:///test.db' ## same remark as before
data = Shove(location)
print data.keys() # prints [ 'somename' ]
print data[data.keys()[0]] # throws an exception in some cases (see 1. below) !
**Couple of questions:**
1. If I replace `self.othername = "%s" % name` by `self.othername = name` then I won't be able to retrieve the data from Shove. This workaround took me a long while to figure out and so I feel there's something fishy going out that I need to find out about otherwise I'm going to be surprised very often. I was thinking that maybe there's a deep/shallow copy issue here but given that I would think strings are immutable there should be no other possible copy than deep - right?
2. Irrespective of my workaround, how's it possible that `data.keys()` has my `'somename'` key but yet `data['somename']` does not work?
3. Seems like `shove_repro2.py` still works if `MyClass` is not explicitly imported. Does this mean that the shove object stores the class definition?
Thx so much! | 0 | [
2,
14166,
2506,
88,
40,
3095,
47,
2343,
20,
11917,
32,
800,
3726,
3726,
75,
21,
865,
16,
791,
140,
31,
216,
21,
170,
10037,
26,
109,
5455,
7727,
47,
83,
101,
20,
1369,
98,
22,
18,
228,
27,
9,
1875,
100,
31,
589,
2863,
3210,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Pre-fill structure with chars and its array
===
Easy question...I know a lot of the values ahead of time, and need to add others later, but why doesn't this compile on the line "direc[i] = {L"Jim",L"Smith"};" where I know the values?
struct NARRAY
{
TCHAR *sFName;
TCHAR *sLName;
};
void main()
{
struct NARRAY direc[1000];
DWORD i = 0;
direc[i].sFName = calloc(512,sizeof(TCHAR));
direc[i].sLName = calloc(512,sizeof(TCHAR));
direc[i] = {L"Jim",L"Smith"};
} | 0 | [
2,
782,
8,
19971,
1411,
29,
4892,
18,
17,
82,
7718,
800,
3726,
3726,
2010,
1301,
9,
9,
9,
49,
143,
21,
865,
16,
14,
4070,
2173,
16,
85,
15,
17,
376,
20,
3547,
654,
138,
15,
47,
483,
1437,
22,
38,
48,
26561,
27,
14,
293,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Why system.float does not exist in .net?
===
<br/>
Why .net does not have system.float like System.String , System.Double etc<br/>
Thanks. | 0 | [
2,
483,
329,
9,
14712,
721,
630,
52,
3182,
19,
13,
9,
2328,
60,
800,
3726,
3726,
13,
1,
5145,
118,
1,
483,
13,
9,
2328,
630,
52,
57,
329,
9,
14712,
721,
101,
329,
9,
11130,
13,
15,
329,
9,
14368,
2722,
1,
5145,
118,
1,
366... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
MPMoviePlayerController not working properly in iOS 5
===
I have the following code that works just fine on my test phone with iOS 4.3. But when I test it on another phone with iOS 5.1 it doesn't seem to work. Can you help me?
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:
[NSURL URLWithString: [defaults objectForKey:@"videoPath"]]];
player.view.frame = CGRectMake( 0, 0, 320, 198);
self.thePlayer = player;
[player release];
[self.cameraOverlayView addSubview:self.thePlayer.view];
[self.thePlayer play]; | 0 | [
2,
4628,
22607,
14049,
12898,
1252,
52,
638,
7428,
19,
13,
7760,
331,
800,
3726,
3726,
31,
57,
14,
249,
1797,
30,
693,
114,
1123,
27,
51,
1289,
1132,
29,
13,
7760,
268,
9,
240,
9,
47,
76,
31,
1289,
32,
27,
226,
1132,
29,
13,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Facebook image post
===
I post an image in Facebook wall by the help of Tutorial. Problem is that my image post with comment **42 minutes ago via iCodeBlog Demo** over it. i wants remove the tutorial blog comment. I use the following link.
[http://www.icodeblog.com/2011/03/28/facebook-sdk-posting-to-user-news-feed/][1]
graphPath = @"me/photos";
[params setObject:self.image forKey:@"source"];// I set the image
[params setObject:self.caption forKey:@"message"];// I set the caption
[[FBRequestWrapper defaultManager] sendFBRequestWithGraphPath:graphPath params:params andDelegate:self];
[1]: http://www.icodeblog.com/2011/03/28/facebook-sdk-posting-to-user-news-feed/ | 0 | [
2,
9090,
1961,
678,
800,
3726,
3726,
31,
678,
40,
1961,
19,
9090,
769,
34,
14,
448,
16,
29724,
9,
1448,
25,
30,
51,
1961,
678,
29,
6484,
13,
1409,
3941,
902,
1464,
1197,
31,
9375,
220,
5567,
8376,
1409,
84,
32,
9,
31,
2846,
46... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to send push messages to multiple users uisng C2DM?
===
So far I have succeeded with send messages to one device using the registration Id and authtoken with signed C2DM role account. Now i have send messages to multiple users . I dont know how to achieve this.
Could anyone help to overcome this issue. | 0 | [
2,
184,
20,
2660,
3250,
7561,
20,
1886,
3878,
287,
403,
2723,
272,
135,
43,
79,
60,
800,
3726,
3726,
86,
463,
31,
57,
2914,
29,
2660,
7561,
20,
53,
3646,
568,
14,
8587,
4924,
17,
10343,
96,
262,
2853,
29,
908,
272,
135,
43,
79... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Call word macro from php error
===
I worte a macro in 2010 office(macro is to conncet mysql database and get data put in word table)
I am trying to call this macro from php. this is the code i wrote.
ini_set('com.autoregister_typelib', 1);
ini_set('com.autoregister_verbose', 0);
$word = new COM("Word.Application") or die('Start Word automation failed.');
printr($word);
$word->visible = 1;
$worddocfile = JPATH_BASE.DS."testmacro.docx";
printr($worddocfile);
$word->Documents->Open($worddocfile);
echo $word->ActiveDocument->Variables(1)->Name;
//$word->Activate;
$word->Run("Normal.Module.activeTab");
$word->Quit();
Any configuration needed for opening a word document. I am getting this error.
( ! ) Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word
Description: This command is not available because no document is open.' in C:\wamp\www\joomla\components\com_mycomponent\models\callmacro.php on line 1265
( ! ) com_exception: Source: Microsoft Word
Description: This command is not available because no document is open. in C:\wamp\www\joomla\components\com_mycomponent\models\callmacro.php on line 1265
can you please tell me what i did wrong in the code or need some configuration.
with out using this code i tried to call a bat file but calling a bat file is also not working. I just want run that word macro form php code.
Thank you... | 0 | [
2,
645,
833,
9069,
37,
13,
26120,
7019,
800,
3726,
3726,
31,
13,
20313,
62,
21,
9069,
19,
498,
488,
5,
540,
7638,
25,
20,
15201,
10312,
51,
18,
22402,
6018,
17,
164,
1054,
442,
19,
833,
859,
6,
31,
589,
749,
20,
645,
48,
9069,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
handling images, videos, docs for custom cms
===
I am in the process of building a CMS using php, however I am struggling on how to handle the various different assets that a dynamic page could serve, typically an average page will contain pictures of various sizes(thumb, body, main, etc), inline images and various different assets(pdf, flv, mp4, doc, etc).
At the moment a user can upload assets and create a folder on the server, I just wanted some techniques and concepts on how to manage this in terms of deleting, editing and linking to my dynamic pages within the cms? I already have a content table which contains all the content(meta_stuff, title, friendly_url, content_text, etc).
On upload should a reference be stored somewhere in say a asset table?
Should all paths to assets(images, docs, videos,etc) be stored in one table? or separate for each asset?
Should multiple image sizes(small, medium, large, etc) be stored in different fields e.g(assetid, smallpath, mediumpath, largepath?
What technique to use to link assets to the dynamic page? should this be a joined table or single? how do I go about retrieving the different assets for a page several pdfs and several images?
How to handle deleting of assets as this could be referenced to another dynamic page?
and anything else you think would be beneficial?
Thanks for all your help
| 0 | [
2,
7988,
3502,
15,
6610,
15,
9765,
18,
26,
5816,
2390,
18,
800,
3726,
3726,
31,
589,
19,
14,
953,
16,
353,
21,
2390,
18,
568,
13,
26120,
15,
207,
31,
589,
7587,
27,
184,
20,
3053,
14,
617,
421,
6223,
30,
21,
7782,
2478,
110,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
what kind of web service (REST or SOAP) is more efficient to be called from a mobile applicatiohat
===
I have to develop a mobile application, and i want to know if there is a web service framework
which make developing easier and offers scalability, security and faster in parsing messages. | 0 | [
2,
98,
825,
16,
2741,
365,
13,
5,
11466,
54,
6447,
6,
25,
91,
8243,
20,
44,
227,
37,
21,
3241,
4865,
16904,
15752,
6775,
800,
3726,
3726,
31,
57,
20,
2803,
21,
3241,
3010,
15,
17,
31,
259,
20,
143,
100,
80,
25,
21,
2741,
365... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Organizing web services for mobile applications
===
**Background**
I've written an internal use Playbook application for my company where users may login and gather certain sets of information from our database. However, not all users request the same information.
The app is written in the Adobe AIR framework as front-end and I use PHP/MSSQL as the back-end.
So far I've organized the PHP scripts in the following hierarchy on our internal webserver:
// Contains class whose constructor connects to our database
// and every method is a seperate query
./MyApp/liveScripts/service/Connection.php
// These are example php files that take POST inputs and executes the query
./MyApp/liveScripts/service/getDataX.php
./MyApp/liveScripts/service/getDataY.php
./MyApp/liveScripts/service/getDataZ.php
Each query returns data in XML format to be read by my app and then displayed.
**Problem**
At first I only had a few special queries, but now I'm facing around 40+ unique queries and the connection class is bloating with lots of unique methods.
In addition I find myself creating a lot of separate php files doing these queries and it feels very inefficient. Here is what 90% of my php files look like:
<?php
include("Connection.php");
$userid = $_POST['userid'];
$fooid = $_POST['fooid'];
$barid= $_POST['barid'];
$service = new Connection();
echo $service->getDataX($userid, $fooid, $barid);
?>
**Question**
My question is, from your experience what is the best way to organize PHP scripts when there are lots of unique queries to handle? Is having a Connection class that stores each separate query as a separate method and having a unique PHP file for each method a viable solution?
I've tried Googling other solutions and hierarchies but haven't come across anything yet.
Thanks!
| 0 | [
2,
11725,
2741,
687,
26,
3241,
3767,
800,
3726,
3726,
13,
1409,
1958,
8810,
1409,
31,
22,
195,
642,
40,
3117,
275,
418,
5199,
3010,
26,
51,
237,
113,
3878,
123,
6738,
108,
17,
7442,
1200,
3415,
16,
676,
37,
318,
6018,
9,
207,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Android: How to Toggle Between Vibrate Settings (Always, Never, Only in Silent Mode, Only When Not in Silent Mode)? Revisited
===
**Problem**
Finding methods to toggle between:
- Always
- Never
- Only in Silent Mode
- Only When Not in Silent Mode
These choices are found by the path --- Menu >> Settings >> Sound >> Vibrate --- on the phone.
It is simple to change by navigation on the phone (by the way, my phone is a Motorola Atrix 2 with Android 2.3.3), but I have yet to come across methods to use in my code.
**Code**
I basically have buttons that should manipulate the vibrate settings when clicked. One of these buttons is shown here:
bSilent.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_OFF);
Toast.makeText(getBaseContext(), "Set to Never", Toast.LENGTH_SHORT).show();
}
});
audioManager is defined somewhere above this code as:
final AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
Android offers the AudioManager.setVibrateSetting, but it is now deprecated. Instead, they reference you to the getRingerMode method.
http://developer.android.com/reference/android/media/AudioManager.html
However, using these functions (and any combination of them) do not efficiently move between the four vibrate settings. For example, if I start at "Always", it is seemingly impossible for me to get to "Never". All combinations of vibrate methods will only move between "Always" and "Only in Silent Mode". On the other hand, if I start at "Never", the offered methods will only toggle between "Never" and "Only When Not in Silent Mode".
Therefore, suppose I want to have my phone in silent mode and want it to vibrate. Then, I decide I do not wish it to vibrate any longer. I am unable to switch from "Always" or "Only in Silent Mode" to "Never".
**Past Solutions and Posts**
I am aware that this is somewhat of a duplicate post on StackOverflow. The issue has been brought up before...
Here: http://stackoverflow.com/questions/3742323/vibrate-settings-on-android-2-2
And (more recently) here: http://stackoverflow.com/questions/11264550/changing-vibrate-setting
The former of the links provides an "answer". LuTHieR ends up in a large discussion and eventually figures out a way on his own. He references the site:
http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob;f=src/com/android/settings/SoundSettings.java;h=a735268b119dda3f91b4f3e987df054eead99f5c;hb=HEAD
and says "I looked at the source code of the com.android.settings.Settings class and copied part of the methods that enable and disable vibrate".
I looked through this site vigorously and could not find what he did. Could anyone clarify his solution?
**Question**
Does anyone have a way to precisely toggle between "Always", "Never", "Only in Silent Mode", and "Only When Not in Silent Mode"?
Thank you! | 0 | [
2,
13005,
45,
184,
20,
20,
263,
4875,
128,
20779,
12410,
13,
5,
21284,
15,
243,
15,
104,
19,
2690,
3740,
15,
104,
76,
52,
19,
2690,
3740,
6,
60,
26932,
800,
3726,
3726,
13,
1409,
2740,
2854,
79,
1409,
3007,
3195,
20,
20,
263,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
vertically centering jquery wmu slider
===
I have a slider that I've set up, I'm having a hard time getting the images to go fullscreen with out overflowing, as well as keeping it vertically centered and keeping the navigation dots at the very bottom of the screen.
any help I can get on this would be greatly appreciated.
This is the site url:
http://www.klossal.com/js/wmuSlider/demo/demo3.html
and this is the code,
HTML:
<div style="top:50%;">
<div class="wmuSlider example1">
<div class="wmuSliderWrapper" style="height:100%;">
<article>
<img width="612" height="612" src="http://www.klossal.com/portfolio/space_1_header.png"
/>
</article>
<article>
<img width="612" height="612" src="http://www.klossal.com/portfolio/space_2_header.png"
/>
</article>
<article>
<img width="612" height="612"
src="http://farm6.static.flickr.com/5201/5296457034_5688b25c15_z.jpg" />
</article>
<article>
<img width="612" height="612"
src="http://farm6.static.flickr.com/5245/5291874922_35ca47cc3d_z.jpg" />
</article>
</div>
</div>
</div>
<script>
$('.example1').wmuSlider({
touch: Modernizr.touch,
animation: 'slide',
slideshow: false
});
</script>
and CSS:
/* Demo */
.wmuSlider,
.wmuGallery {
margin-bottom: 20px;
}
/* mwuSlider */
.wmuSlider {
position: relative;
overflow: hidden;
}
.wmuSlider .wmuSliderWrapper {
display: none;
}
.wmuSlider .wmuSliderWrapper article {
position: relative;
text-align: center;
}
.wmuSlider .wmuSliderWrapper article img {
max-width: 100%;
height: auto;
}
/* mwuGallery */
.wmuGallery .wmuGalleryImage {
position: relative;
text-align: center;
}
.wmuGallery .wmuGalleryImage img {
max-width: 100%;
height: 100%;
}
/* Default Skin */
.wmuGallery .wmuGalleryImage {
margin-bottom: 10px;
}
.wmuSliderPrev, .wmuSliderNext {
position: absolute;
width: 40px;
height: 80px;
text-indent: -9999px;
background: url(http://klossal.com/js/wmuSlider/demo/images/sprites.png) no-repeat 0 0;
top: 50%;
margin-top: -40px;
z-index: 2;
}
.wmuSliderPrev {
background-position: 100% 0;
left: 20px;
}
.wmuSliderNext {
right: 20px;
}
.wmuSliderPagination {
z-index: 2;
position: absolute;
left: 50%;
bottom: 0px;
}
.wmuSliderPagination li {
float: left;
margin: 0 5px 0 0;
list-style-type: none;
}
.wmuSliderPagination a {
display: block;
text-indent: -9999px;
width: 10px;
height: 10px;
background: url(http://klossal.com/js/wmuSlider/demo/images/sprites.png) no-repeat 0
-80px;
}
.wmuSliderPagination a.wmuActive {
background-position: -10px -80px;
}
body{
background:#141414;
} | 0 | [
2,
23300,
459,
68,
487,
8190,
93,
619,
3677,
3295,
106,
800,
3726,
3726,
31,
57,
21,
3295,
106,
30,
31,
22,
195,
309,
71,
15,
31,
22,
79,
452,
21,
552,
85,
1017,
14,
3502,
20,
162,
503,
7187,
29,
70,
20285,
68,
15,
28,
134,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Look for specific character in string and place it at different positions after a defined separator in the same string
===
let's define the following string `s`:
s <- "$ A; B; C;"
I need to translate `s` into:
"$ A; $B; $C;"
the semicolon is the separator. However, $ is only one of 3 special characters which can appear in the string. The data frame `m` holds all 3 special characters:
m <- data.frame(sp = c("$", "%", "&"))
I first used `strsplit` to split the string using the semicolon as the separator
> strsplit(s, ";")
[[1]]
[1] "$ A" " B" " C"
I think the next step would be to use grep or match to check if the first string contains any of the 3 special characters defined in data frame `m`. If so, maybe use gsub to insert the matched special character into the remaining sub strings. Then simple use paste with collapse = "" to merge the substrings together again. Does that make sense?
Cheers
| 0 | [
2,
361,
26,
1903,
925,
19,
3724,
17,
209,
32,
35,
421,
3062,
75,
21,
2811,
1353,
3574,
3457,
19,
14,
205,
3724,
800,
3726,
3726,
408,
22,
18,
9267,
14,
249,
3724,
13,
1,
18,
1,
45,
13,
18,
13,
1,
8,
13,
7,
4403,
21,
73,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
GCM server jar and GCM with GWT
===
Hi am new bee to the GCM and GWT and i was worndering from where do i get the jar for the gcm-server implementation,i was literally not able to find the jar for the download.
Can anyone please guide me from where do i get the gcm-server.jar for my appengine server.
And also how do i go ahead with the GWT push implementation to android using GCM.
[link for the GCM-android][1]
i have found this link but i was not sure if this page had any source for the gcm-server jar for download.
[1]: http://developer.android.com/guide/google/gcm/gs.html | 0 | [
2,
489,
9095,
8128,
5112,
17,
489,
9095,
29,
14094,
38,
800,
3726,
3726,
4148,
589,
78,
12092,
20,
14,
489,
9095,
17,
14094,
38,
17,
31,
23,
5177,
1157,
68,
37,
113,
107,
31,
164,
14,
5112,
26,
14,
489,
9095,
8,
10321,
106,
61... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
select "step" records
===
Given the following table
group | index | value
----------------------
a | 1 | 1
a | 2 | 1
a | 3 | 1
a | 4 | 2
a | 5 | 2
a | 6 | 4
b | 1 | 1
b | 2 | 1
b | 3 | 1
b | 4 | 3
b | 5 | 3
b | 6 | 4
I need to select the following:
group | index | value
----------------------
a | 1 | 1
a | 4 | 2
a | 6 | 4
b | 1 | 1
b | 4 | 3
b | 6 | 4
That is for each group, each record where the value is different to the proceeding value (ordered by index). So each record where the value "steps".
what would be the most efficient way to achieve this?
thanks. | 0 | [
2,
5407,
13,
7,
8375,
7,
742,
800,
3726,
3726,
504,
14,
249,
859,
214,
13,
1,
4348,
13,
1,
1923,
13,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
21,
13,
1,
137,
13,
1,
137,
21,
13,
1,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How can I tell nginx to silently ignore requests that dont match and let them time out instead of actively refusing them?
===
I have a server block listening to 80 port requests on a specific server name along with some location directives. How can I make nginx treat any request that doesnt match as if it hadnt received it, that is let it time out? Currently those requests are refused. | 0 | [
2,
184,
92,
31,
494,
13,
2723,
108,
396,
20,
8555,
7174,
12279,
30,
1049,
730,
17,
408,
105,
85,
70,
700,
16,
8754,
11697,
105,
60,
800,
3726,
3726,
31,
57,
21,
8128,
1921,
4948,
20,
2972,
1295,
12279,
27,
21,
1903,
8128,
204,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Rails: errors.add displays HTML tags
===
Today, i have started getting a strange issue on validations.
Here is the code.
self.errors.add("", 'Must confirm your current password to set a new one')
But i am getting HTML tags in output. Like the one below.
<div id="errorList" class="errorList"><div class="errorListInner"><h5>1 error prohibited saving your profile</h5><ul><li> Must confirm your current password to set a new one</li></ul></div></div>
CSS isn't getting applied, i think. I am working on rails 3.1.3 and ruby 1.9.2.
Can anyone help me out.
Thanks in advance. | 0 | [
2,
2240,
18,
45,
11908,
9,
14854,
9412,
13,
15895,
3383,
18,
800,
3726,
3726,
786,
15,
31,
57,
373,
1017,
21,
2578,
1513,
27,
27999,
18,
9,
235,
25,
14,
1797,
9,
1119,
9,
29992,
18,
9,
14854,
5,
7,
7,
15,
13,
22,
3605,
38,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Ajax form submission with Valums plugins in asp.net mvc 3
===
I have used Valums uploader plugins for file uploads in asp.net mvc 3. Following is the views which have form fields and ajax query upload button inside form. I am not sure that I am doing it right or not. What I have to change on view so that When I Choose the file to upload the form field's value is also send.
**Views:**
<link href="@Url.Content("~/Content/css/fileuploader.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Content/js/fileuploader.js")" type="text/javascript"></script>
@using (Html.BeginForm("Upload","AjaxUpload")) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Upload Image File</legend>
<div class="editor-label">
@Html.Label("Select Language")
</div>
<div>
@Html.DropDownList("Language1", (SelectList) ViewBag.lang)
</div>
<div class="editor-label">
@Html.Label("Select Category")
</div>
<div>
@Html.DropDownList("ParentCategoryID", ViewBag.ParentCategoryID as SelectList)
</div>
<div id="file-uploader">
<noscript>
<p>
Please enable JavaScript to use file uploader.</p>
</noscript>
</div>
</fieldset>
}
**<script type="text/javascript">
var uploader = new qq.FileUploader
({
element: document.getElementById('file-uploader'),
action: '@Url.Action("upload")', // put here a path to your page to handle uploading
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'], // user this if you want to upload only pictures
sizeLimit: 4000000, // max size, about 4MB
minSizeLimit: 0 // min size
});
</script>**
How Can I passed the value of form to controller of HTTPOST Action So that I can save data to the database. Here, I have Upload action which save the data in database but I don't know to retrieve to those value send by form post.
**HttpPost Action**
[HttpPost]
public ActionResult Upload(HttpPostedFileBase qqfile)
{
var wav = new PlayWav
{
Name = ***filename***,
CategoryID = ***value from category dropdown select list***,
UserID = repository.GetUserID(HttpContext.User.Identity.Name),
LanguageID = int.Parse(***value from language dropdown select list***),
UploadDateTime = DateTime.Now,
ActiveDateTime = DateTime.Now,
FilePath = "n/a"
};
if (qqfile != null)
{
// this works for IE
var filename = Path.Combine(Server.MapPath("~/App_Data/Uploads"), Path.GetFileName(qqfile.FileName));
qqfile.SaveAs(filename);
return Json(new { success = true }, "text/html");
}
else
{
// this works for Firefox, Chrome
var filename = Request["qqfile"];
if (!string.IsNullOrEmpty(filename))
{
filename = Path.Combine(Server.MapPath("~/App_Data/Uploads"), Path.GetFileName(filename));
using (var output = System.IO.File.Create(filename))
{
Request.InputStream.CopyTo(output);
}
**db.PlayWavs.Attach(wav);
db.SaveChanges();**
return Json(new { success = true });
}
}
return Json(new { success = false });
} | 0 | [
2,
20624,
505,
10923,
29,
3347,
723,
18,
10922,
108,
18,
19,
28,
306,
9,
2328,
307,
8990,
203,
800,
3726,
3726,
31,
57,
147,
3347,
723,
18,
71,
8294,
106,
10922,
108,
18,
26,
3893,
71,
8294,
18,
19,
28,
306,
9,
2328,
307,
8990... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Example of Camera preview using SurfaceTexture in Android
===
I am trying to render camera preview using [SurfaceTexture][1]. I read the document but unable to understand how it works.
Can anyone provide one sample example(very basic one) or link which uses [SurfaceTexture][2] to preview camera. I googled this but not found what I am looking for.
Thanks in advance.
[1]: http://developer.android.com/reference/android/graphics/SurfaceTexture.html
[2]: http://developer.android.com/reference/android/graphics/SurfaceTexture.html | 0 | [
2,
823,
16,
3336,
16121,
568,
1490,
11969,
4221,
19,
13005,
800,
3726,
3726,
31,
589,
749,
20,
16535,
3336,
16121,
568,
636,
18830,
11969,
4221,
500,
2558,
165,
500,
9,
31,
1302,
14,
4492,
47,
2343,
20,
1369,
184,
32,
693,
9,
92,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
android HMAC showing unexpected error
===
I was trying to generate HMAC using md5 , everythings seems to be perfect but it is showing unexpected error
The code is as below
public String calcHmac(String src) throws Exception {
String key = "PFhNTD48VUlEPlNYWUFOR0VUPC9VSUQ+PEVUUkFOQVVUSD48WFNQUk9MRT5BbGw8L1hTUFJPTEU+PFhTUFNlY3VyaXR5SUQ+MzMzPC9YU1BTZWN1cml0eUlEPjxYU1BTZWN1cml0eUlEPjk5NzwvWFNQU2VjdXJpdHlJRD48WFNQU2VjdXJpdHlJRD5HQjwvWFNQU2VjdXJpdHlJRD48WFNQU2VjdXJpdHlJRD5YMDM8L1hTUFNlY3VyaXR5SUQ+PFhTUFNlY3VyaXR5SUQ+WDAxPC9YU1BTZWN1cml0eUlEPjxYU1BSZWNpcGllbnQ+NDlBQ0NULVNZQU5HRVRSQU48L1hTUFJlY2lwaWVudD48L0VUUkFOQVVUSD48L1hNTD4=";
SecretKeySpec keySpec = new SecretKeySpec(
key.getBytes(),
"HmacMD5");
Mac mac = Mac.getInstance("HmacMD5");
mac.init(keySpec);
byte[] result = mac.doFinal(src.getBytes());
return Hex.encodeHexString(result);
}
| 0 | [
2,
13005,
746,
6893,
3187,
9380,
7019,
800,
3726,
3726,
31,
23,
749,
20,
7920,
746,
6893,
568,
8138,
264,
13,
15,
796,
18,
2206,
20,
44,
2107,
47,
32,
25,
3187,
9380,
7019,
14,
1797,
25,
28,
1021,
317,
3724,
3550,
673,
6893,
5,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
sliding images with lazy loader for multiple slides
===
I have used stackoverflow for the past year and has really helped for design, this is the first time im truely stuck and I really dont have a clue have to do this...
I have a website im building which has 60 items on a page with thumbs, On mouseover I want the thumb to to change to 5 other img like a fast slideshow, using lazy loader so the alternative img's don't load until mouseover
I have just started learning Javascript and Jquery in my spare time, and unfortuantely this is way beyond my capabilities :(
I have this http://jsfiddle.net/razzabazza17/hRErs/ but this is just to load when scrolling what I need is this to overflow: hidden; around the container then when mouse over on primary img it will flick through the other 4 thumbs in sequence. It also need to stop this function when stop on mouseover.
I appreciate any help or advice you can give, thanks in advance :) | 0 | [
2,
7609,
3502,
29,
16792,
6305,
106,
26,
1886,
18066,
800,
3726,
3726,
31,
57,
147,
7566,
2549,
9990,
26,
14,
640,
159,
17,
63,
510,
1456,
26,
704,
15,
48,
25,
14,
64,
85,
797,
1151,
102,
4549,
17,
31,
510,
1049,
57,
21,
8906,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
call stored procedure in vb script
===
I have created a stored procedure. I tested it in the query analyser like this EXEC test '10/12/2012'. It is OK. But I called it following way in the vb script. It not OK.
InstanceVar = CreateObject("ADODB.Recordset")
InstanceVar.ActiveConnection = ConnVar
InstanceVar.Source = "EXEC Test '" & Date() & "'"
InstanceVar.CursorType = 3
InstanceVar.CursorLocation = 3
InstanceVar.Open()
I have got 80040E14 error. How can I solve it | 0 | [
2,
645,
8214,
7004,
19,
13,
20468,
3884,
800,
3726,
3726,
31,
57,
679,
21,
8214,
7004,
9,
31,
7631,
32,
19,
14,
25597,
13,
21702,
139,
101,
48,
1396,
3319,
1289,
13,
22,
1036,
11698,
9298,
3212,
22,
9,
32,
25,
5854,
9,
47,
31,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Advantages of using CursorAdapter against CustomAdapter
===
I'm using a custom adapter to retrieve data for a ListView. Initialize this data was not being fetched from database, but now it is. I was using a custom adapter retrieving data from server. Now the data is retrieved before filling the adapter.
Now, I have a doubt: Reading about CursorAdapters it seems pretty easy to implement, but I'm very comfortable with the actual implementation.
I have to say that data size will no exceed 10 items or so.... So it's not a memory problem.
So, in this situation... which are the advantages of using CursorAdapter?
Thanks in advance! | 0 | [
2,
14683,
16,
568,
29588,
27576,
106,
149,
5816,
27576,
106,
800,
3726,
3726,
31,
22,
79,
568,
21,
5816,
9924,
106,
20,
11917,
1054,
26,
21,
968,
4725,
9,
2104,
2952,
48,
1054,
23,
52,
142,
13,
28998,
37,
6018,
15,
47,
130,
32,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to Share the same Session id in Tomcat Cluster
===
I have two tomcat instances running in Clustered Environment
Assume we have test.jsp is there in both Instances.
Suppose test.jsp is giving session ID(S1ID) in instance One, how to get the same session ID(S2ID) from instance Two
Is this correct S1ID will be equal to S2ID??
Could you suggest how to configure tomcat cluster session replication. if they are equal (S1ID==S2ID) | 0 | [
2,
184,
20,
1891,
14,
205,
3723,
4924,
19,
2067,
5782,
7460,
800,
3726,
3726,
31,
57,
81,
2067,
5782,
13946,
946,
19,
7460,
69,
2307,
7158,
95,
57,
1289,
9,
728,
3401,
25,
80,
19,
156,
13946,
9,
5787,
1289,
9,
728,
3401,
25,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to specify column names through parameter in Stored Procedure?
===
USE Database
GO
CREATE PROCEDURE FillTable
@Id nvarchar(50),
@ColumnNameArray nvarchar(4000),
@ColumnValueArray nvarchar(4000)
AS
INSERT INTO Table(@ColumnNameArray)
VALUES (@ColumnValueArray)
GO
This is the functionality i require in my stored procedure. But i get the error as
`Invalid column name '@zoneNameArray'.`
So whats the work around?
How can I make this work? | 0 | [
2,
184,
20,
19077,
4698,
1817,
120,
18906,
19,
8214,
7004,
60,
800,
3726,
3726,
275,
6018,
162,
1600,
7004,
3509,
5924,
13,
1,
1340,
13,
103,
3311,
5433,
5,
2290,
6,
15,
13,
1,
716,
4404,
103,
7259,
8576,
93,
13,
103,
3311,
5433... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Searching multiple xml for children in notepad ++
===
Not very familar with regex, but basically im trying to pull out the fund price from multiple xml files. So basically i want search to return, all the dates and prices for C001 in the files i have open.
<fund>
<fund_code>C001</fund_code>
<fund_name>Full fund name</fund_name>
<fund_price_point>
<price_point_dt>01/01/2012</price_point_dt>
<fund_price>50.04</fund_price>
</fund_price_point>
</fund
Any suggestions would be great. Thanks
| 0 | [
2,
5792,
1886,
23504,
26,
391,
19,
1945,
8240,
13,
20512,
800,
3726,
3726,
52,
253,
1399,
14494,
139,
29,
7953,
1706,
15,
47,
11374,
797,
749,
20,
2201,
70,
14,
2780,
2162,
37,
1886,
23504,
6488,
9,
86,
11374,
31,
259,
2122,
20,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Java - HttpURLConnection - How to insert user data into Header Response
===
I have a java servlet class that is performing a GET to a specific URL. I am also passing data as part of the GET.
What I need, is in my HTTP Server code that recieves this data, how do I insert user based response data into the Header back so my calling Java servlet class can read it.
I can read standard response things like .getResponseCode() etc, but I need to insert my own response into the header some how. How can this be done? and how can I read it?
This is my java servlet send class:
public void sendRequest(String data, String sendUrl) throws Throwable{
String messageEncoded = URLEncoder.encode(data, "UTF-8");
String message = URLDecoder.decode(messageEncoded);
System.out.println("messageEncoded : " + messageEncoded);
System.out.println("messageDecoded : " + message);
try {
URL url = new URL(sendUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("GET");
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(message);
writer.close();
BufferedReader rd = null;
StringBuilder sb = null;
String line = null;
System.out.println(" *** headers ***");
for (Entry<String, List<String>> headernew : connection.getHeaderFields().entrySet()) {
System.out.println(headernew.getKey() + "=" + headernew.getValue());
}
System.out.println(" \n\n*** Body ***");
rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
sb = new StringBuilder();
while ((line = rd.readLine()) != null) {
sb.append(line + '\n');
}
System.out.println("body=" + sb.toString());
System.out.println("connection.getResponseCode() : " + connection.getResponseCode());
System.out.println("connection.getResponseMessage()" + connection.getResponseMessage());
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
// Ok
} else {
// Server returned HTTP error code.
}
} catch (MalformedURLException e) {
// ...
System.out.println(this.getClass() + " : MalformedURLException Error occured due to: " + e);
} catch (IOException e) {
System.out.println(this.getClass() + " : IOException Error occured due to: " + e);
}
} | 0 | [
2,
8247,
13,
8,
7775,
911,
255,
25996,
872,
13,
8,
184,
20,
14692,
4155,
1054,
77,
157,
106,
1627,
800,
3726,
3726,
31,
57,
21,
8247,
13,
10321,
1336,
718,
30,
25,
2955,
21,
164,
20,
21,
1903,
287,
6362,
9,
31,
589,
67,
2848,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Two step rewriting rule in .htaccess
===
for a few days I fight with some problem, read many articles but still I don't now how to solve it. I have site with existing .htaccess rewriting rules. Now I wanted to add language variable into URL, like this:
www.example.com/en/
This variable can but don't have to exist. I want to add some more or less simple rule(s) on the beginning of .htaccess which could remove this language path from URL so other rules doesn't see it. So I added this one
RewriteRule ^([a-z]{2}/)?(.*)$ $2
It works with most other rules but doesn't work with this one:
RewriteRule ^menubox/(.*)$ ?menubox=$1 [L]
For
www.example.com/en/menubox/compare
it should return
echo $_GET['menubox']; // -> 'compare'
But return
'compare/menubox/compare'
It works for:
RewriteRule ^login$ index.php?login=true [L]
But for:
RewriteRule ^index\.html$ index.php? [L]
RewriteRule ^index\.html(.*)$ index.php$1 [L]
When I go to:
www.example.com/en/index.html
it gives me
No input file specified.
But it works for:
www.example.com/index.html
Any ideas? | 0 | [
2,
81,
1424,
302,
12646,
1828,
19,
13,
9,
9020,
20604,
800,
3726,
3726,
26,
21,
310,
509,
31,
1074,
29,
109,
1448,
15,
1302,
151,
3376,
47,
174,
31,
221,
22,
38,
130,
184,
20,
8402,
32,
9,
31,
57,
689,
29,
3149,
13,
9,
9020,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Salesforce Rest API with android - NullPointerException @ AsyncRequestCallback
===
I'm trying to get the Salesforce REST API working with Android and new to android programming, followed the sample code to connect with SFDC http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_Android#Authentication
I'm trying to get a few records from SFDC and display them in the android app, looks like when the Async Call is made at "client.sendAsync(sfRequest, new AsyncRequestCallback()" - NullPointerException is thrown.
I did see a couple of similar issues online, but didn't help me. Hoping if some one would point me in the right direction to troubleshoot this. Thanks much.
public class GetAccountsActivity extends Activity {
private PasscodeManager passcodeManager;
private String soql;
private String apiVersion;
private RestClient client;
private TextView resultText;
private RestRequest sfRequest;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get Api Version
apiVersion = getString(R.string.api_version);
//Create Query
soql = "select id, name from Account limit 10";
// Setup view
setContentView(R.layout.get_accounts_activity);
((TextView) findViewById(R.id.Acc_Title)).setText(apiVersion);
// Passcode manager
passcodeManager = ForceApp.APP.getPasscodeManager();
}
@Override
public void onResume() {
super.onResume();
//Get SFClient
// Login options
String accountType = ForceApp.APP.getAccountType();
LoginOptions loginOptions = new LoginOptions(
null, // login host is chosen by user through the server picker
ForceApp.APP.getPasscodeHash(),
getString(R.string.oauth_callback_url),
getString(R.string.oauth_client_id),
new String[] {"api"});
new ClientManager(this, accountType, loginOptions).getRestClient(this, new RestClientCallback() {
@Override
public void authenticatedRestClient(RestClient client) {
if (client == null) {
ForceApp.APP.logout(GetAccountsActivity.this);
return;
}
GetAccountsActivity.this.client = client;
}
});
//Get Rest Object to query
try {
sfRequest = RestRequest.getRequestForQuery(apiVersion, soql);
//Use SF Rest Client to send the request
client.sendAsync(sfRequest, new AsyncRequestCallback(){
@Override
public void onSuccess(RestRequest request, RestResponse response){
//Check responses and display results
// EventsObservable.get().notifyEvent(EventType.RenditionComplete);
}//end onSuccess
@Override
public void onError(Exception exception) {
//printException(exception);
EventsObservable.get().notifyEvent(EventType.RenditionComplete);
}//End Exception for Async Method
});
}catch (UnsupportedEncodingException e) {
//printHeader("Could Send Query request");
//printException(e);
return;
}
}
}enter code here | 0 | [
2,
2598,
8774,
760,
21,
2159,
29,
13005,
13,
8,
16203,
3132,
106,
10066,
872,
13,
1,
21,
9507,
6037,
10351,
9200,
1958,
800,
3726,
3726,
31,
22,
79,
749,
20,
164,
14,
2598,
8774,
760,
21,
2159,
638,
29,
13005,
17,
78,
20,
13005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
htaccess wildcard redirect to query string
===
Quick question, and I've seen it asked hundreds of times, but I just can't seem to get it to work (shame on me).
I'm trying to redirect anything other than index.php to view.php?id=$1 where $1 is anything other than index.php - but I can't seem to get it to work.
For example:
http://domain.com/ should use index.php
http://domain.com/index.php as should this
but..
http://domain.com/sdgoi3 should use http://domain.com/view.php?id=sdgoi3 etc
I've tried a few things and gone down through the questions above but to no avail.
Anyone got a solution? Appreciated. | 0 | [
2,
13,
9020,
20604,
23003,
302,
14706,
20,
25597,
3724,
800,
3726,
3726,
2231,
1301,
15,
17,
31,
22,
195,
541,
32,
411,
4541,
16,
436,
15,
47,
31,
114,
92,
22,
38,
2260,
20,
164,
32,
20,
170,
13,
5,
9582,
62,
27,
55,
6,
9,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Using JavaScript/jQuery to insert an image into last last column when using CSS3 webkit-columns
===
I have content flowing in 3 columns using -webkit-columns: 3 and want to insert an image in the top of the last column (far right column). CSS3 Regions is possible future solution but not ready for primetime. This solution is my only work around. A possible solution is to use "webkitColumnCount" with JavaScript and insert the image to the top of the 3rd column. Is this the right approach? I'm looking for creative solutions or suggestions. This only needs to work for Webkit as this is an iPad only implementation. | 0 | [
2,
568,
8247,
8741,
118,
728,
8190,
93,
20,
14692,
40,
1961,
77,
236,
236,
4698,
76,
568,
272,
18,
18,
240,
2741,
13703,
8,
716,
4404,
2172,
800,
3726,
3726,
31,
57,
2331,
8964,
19,
203,
7498,
568,
13,
8,
14113,
13703,
8,
716,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
node.js require relative paths
===
I have node.js modules in several directories because I am following MVC pattern. I am in need to call **require** to several modules which are located outside current directory. How can I do that?
/app/controller/c1.js
...
/app/model/m1.js
...
/app/view/v1.js
...
/app/view/v2.js
// this works
require('./v2');
// these doesn't work
require('../model/m1.js');
require('~/model/m1.js');
...
Why is that so?
| 0 | [
2,
15421,
9,
728,
18,
4077,
4543,
12074,
800,
3726,
3726,
31,
57,
15421,
9,
728,
18,
17113,
19,
238,
559,
1596,
185,
31,
589,
249,
307,
8990,
3732,
9,
31,
589,
19,
376,
20,
645,
13,
1409,
99,
3003,
99,
1409,
20,
238,
17113,
56... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Error: Symbol not found: ___CFObjCIsCollectable
===
today I was working in xcode when this error showed up on start up of the app, whats wrong with my app?
2012-07-29 19:29:58.682 Champagne Pop[10601:1b03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-29 19:29:58.690 Champagne Pop[10601:1b03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-29 19:29:58.703 Champagne Pop[10601:1b03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-29 19:29:58.710 Champagne Pop[10601:1b03] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security | 0 | [
2,
7019,
45,
4678,
52,
216,
45,
13,
1,
150,
4120,
11741,
7654,
15015,
579,
800,
3726,
3726,
786,
31,
23,
638,
19,
993,
9375,
76,
48,
7019,
1908,
71,
27,
799,
71,
16,
14,
4865,
15,
98,
18,
1389,
29,
51,
4865,
60,
563,
8,
2984... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
PHP script not redirecting via header
===
I am looking for some kind of bug in my code which is causing this PHP page to not redirect. I'm looking to see if someone might know the cause of this problem (it may have something to do with the cookies).
inc_vars.php:
<?php
//some of the variables have been omitted.
$pid = 'gbb';
$dbtable ='';
$dbname = '';
$dbuser = '';
$dbpass = '';
$connect = mysql_connect('localhost', $dbuser, $dbpass);
if(!$connect){
header('Location: http://jacoblot.com');
die();
}
mysql_select_db ($dbname, $connect);
$webroot = 'http://jacoblot.com/free-stuff/gig-brokering-blueprint';
$share_page = $webroot . '/share-the-training';
$gift = $webroot . '/free-video?setuser=1199';
$bonus_content = $webroot . '/awesome-bonus';
$share_php = $webroot . '/viral/share.php';
?>
refresh_id.php:
<?php
include_once('inc_vars.php');
$results = mysql_query("SELECT id FROM " . $dbtable . " WHERE email='" . $_GET['email'] . "'");
if(!$results || mysql_num_rows($results)==0){
header('Location: ' . $share_page . '?errorcode=1');
die();
}
$res_arr = mysql_fetch_assoc ($results);
setcookie($pid . "_viral", (string)$res_arr['id'], time() + 3600 * 365);
move_on();
function move_on(){
header ('Location: ' . $share_php);
die();
}
?>
When the person visits refresh_id.php?email=their_email they should redirect to the $share_php page. This is not working.
However, if this scenario happens: refresh_id.php?email=an-email-that-is-not-in-database then the script redirects to $share_page absolutely fine.
I have tried this with and without the gbb_viral cookie in place. I'm not sure why this isn't working. All pages are live and on the internet right now in case you want to look for yourself.
[http://jacoblot.com/free-stuff/gig-brokering-blueprint/viral/][1]
An email that exists in the database is as follows: acctrafficcop@gmail.com (for those that want to test this)
[1]: http://jacoblot.com/free-stuff/gig-brokering-blueprint/viral/ | 0 | [
2,
13,
26120,
3884,
52,
302,
14706,
68,
1197,
157,
106,
800,
3726,
3726,
31,
589,
699,
26,
109,
825,
16,
6256,
19,
51,
1797,
56,
25,
3242,
48,
13,
26120,
2478,
20,
52,
302,
14706,
9,
31,
22,
79,
699,
20,
196,
100,
737,
530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
eror in rawquery :near ","
===
while trying to insert data i am getting this error
07-29 18:15:19.909: E/sqlite(863): android.database.sqlite.SQLiteException: near ",": syntax error: , while compiling: INSERT INTO transactions (details , amount) VALUES( , );
i think the error is in this line unable to sort it help anyone
String insertQuery = "INSERT INTO " +stdb.tname+" (" + stdb.details+" , "+stdb.amt+") VALUES("+setdet+" , "+setamt+");";
thanks in advance
| 0 | [
2,
13,
106,
248,
19,
4333,
8190,
93,
13,
45,
14114,
13,
7,
15,
7,
800,
3726,
3726,
133,
749,
20,
14692,
1054,
31,
589,
1017,
48,
7019,
13,
2984,
8,
2738,
474,
45,
1193,
45,
1433,
9,
518,
2545,
45,
13,
62,
118,
18,
1251,
1060... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Is there a recommended design pattern for Unsaved Changes client and server-side changes on a page?
===
Looking for best how to handle transient data that might get loaded and then validated as well as dirty data on a page. How should I deal with users navigating away, back buttons, or canceling without saving changes? | 0 | [
2,
25,
80,
21,
5773,
704,
3732,
26,
367,
19863,
43,
1693,
6819,
17,
8128,
8,
1416,
1693,
27,
21,
2478,
60,
800,
3726,
3726,
699,
26,
246,
184,
20,
3053,
26008,
1054,
30,
530,
164,
8572,
17,
94,
7394,
1669,
28,
134,
28,
6121,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
extremely large objects and managed heap in C#
===
What will happen when i`ll try to save in physical memory very large objects, which are larger than managed heap?
For example, the size of a film is 4.5 GB, and the size of virtual memory (RAM) is only 2 GB. How will garbage collector work in this case? | 0 | [
2,
3898,
370,
3916,
17,
1471,
15414,
19,
272,
5910,
800,
3726,
3726,
98,
129,
2384,
76,
31,
1,
211,
1131,
20,
2079,
19,
1825,
1912,
253,
370,
3916,
15,
56,
50,
1662,
119,
1471,
15414,
60,
26,
823,
15,
14,
1072,
16,
21,
171,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Android application Dissapeared after running for some hours
===
I am developing a mobile application, which is used to do travel billing based on GPS Distance Traveled,
I am facing one situation where application is getting vanished after running for more that 10 hours, Any help
Waiting for the reply
Regards
Shashank | 0 | [
2,
13005,
3010,
1460,
18,
2552,
21511,
75,
946,
26,
109,
974,
800,
3726,
3726,
31,
589,
3561,
21,
3241,
3010,
15,
56,
25,
147,
20,
107,
1773,
1071,
68,
432,
27,
18298,
1583,
5082,
15,
31,
589,
4325,
53,
1858,
113,
3010,
25,
1017... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Inserting into Databse through Edittext Field in android
===
i am new to android.I am not able to insert data into my database.Although it is accepting text through editText field but it is not saving in database.
I want to insert data into database table using the XML button's android:onClick attribute.
when i click on on my save Button my app crashes immediately
//InterviewActivity.java
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.RemoteViews.ActionException;
import android.widget.Toast;
import android.content.ContentValues;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
public class InterviewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcomeactivity);
}
public void onQuestionClicked(View view) {
EditText Q = (EditText)findViewById(R.id.Questiont);
EditText A = (EditText)findViewById(R.id.Answert);
Q.setVisibility(View.VISIBLE);
A.setVisibility(View.INVISIBLE);
Toast.makeText(this, "Enter your Question here", Toast.LENGTH_LONG).show();
}
public void onAnswerClicked(View view) {
EditText Q = (EditText)findViewById(R.id.Questiont);
EditText A = (EditText)findViewById(R.id.Answert);
A.setVisibility(View.VISIBLE);
Q.setVisibility(View.INVISIBLE);
Toast.makeText(this, "Enter your Answer here", Toast.LENGTH_LONG).show();
}
public void onSave(View view) {
EditText Q = (EditText)findViewById(R.id.Questiont);
EditText A = (EditText)findViewById(R.id.Answert);
String q = Q.getText().toString();
String a = A.getText().toString();
Toast.makeText(this,"Question :"+" " + q + "\n" +
"Answer :"+" " + a, Toast.LENGTH_LONG).show();
}
public void onCancel(View view) {
finish();
}
}
//trying.java
package com.ques.ans;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class trying extends SQLiteOpenHelper{
public static final String DB_NAME = "save.db";
public static final int DB_VERSION=2;
public static final String TABLE="qnadb";
public static final String SNO = "Sno";
public static final String QUESTION = "Question";
public static final String ANSWER = "Answer";
public trying(Context context) {
super(context,DB_NAME, null, DB_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "create table TABLE (SNO integer autoincrement primary key not null, QUESTION text , ANSWER text);";
// TODO Auto-generated method stub
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE);
onCreate(db);
}
public void onsaving(String q,String a) {
SQLiteDatabase db=this.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(SNO, 1);
cv.put(QUESTION, q);
cv.put(ANSWER, a);
db.insert(TABLE,null, cv);
db.close();
}
}
| 0 | [
2,
14692,
68,
77,
1054,
220,
870,
120,
9392,
11969,
575,
19,
13005,
800,
3726,
3726,
31,
589,
78,
20,
13005,
9,
49,
589,
52,
777,
20,
14692,
1054,
77,
51,
6018,
9,
8655,
32,
25,
10894,
1854,
120,
9392,
11969,
575,
47,
32,
25,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
WCF service: Failed to add a service. Unable to connect to the remote server
===
I know this is a FAQ, and I've read all similar Q's and A's but I'm still not coming right.
I'm a newb at web services and ASP.NET in general. I have a small WCF service application written by a colleague which worked and was demo'ed on his pc. On my pc, and with no changes, I can't get it to be accepted by the WCF Test Client program when adding it as a service (error message below). My colleague is now on leave!
The project properties are set to start `WcfTestClient.exe` using the VS development server with an auto-assigned port number. The project has a `webform.aspx` and a `Global.asax` file added which are needed for the service.
I have run "`netsh http add urlacl url=http://localhost:51568/Service1.svc user=<loginname>`".
My questions are how do I get the service started by WcfTestClient, and the webform on the browser?
I have looked at various SO answers to similar questions but am still stumped.
> Failed to add a service. Service metadata may not be accessible. Make
> sure your service is running and exposing metadata. Error: Cannot
> obtain Metadata from `http://localhost:51568/Service1.svc` If this is a
> Windows (R) Communication Foundation service to which you have access,
> please check that you have enabled metadata publishing at the
> specified address. For help enabling metadata publishing, please
> refer to ... Error URI: `http://localhost:51568/Service1.svc`
> Metadata contains a reference that cannot be resolved:
> '`http://localhost:51568/Service1.svc`'. There was no endpoint
> listening at `http://localhost:51568/Service1.svc` that could accept the
> message. This is often caused by an incorrect address or SOAP action.
> See InnerException, if present, for more details. Unable to connect
> to the remote server No connection could be made because the target
> machine actively refused it 127.0.0.1:51568HTTP GET Error URI:
> `http://localhost:51568/Service1.svc` There was an error downloading
> '`http://localhost:51568/Service1.svc`'. Unable to connect to the
> remote server No connection could be made because the target
> machine actively refused it 127.0.0.1:51568
This is my web.config:
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Service1"
behaviorConfiguration="DefaultBehavior">
<endpoint address="http://localhost:*/Service1"
binding="basicHttpBinding"
contract="IService1" />
<endpoint address="http://localhost:*/Service1/mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Something strange to me regarding port numbers is that if I don't set the project to start with the external program then the browser lists the directory listing at localhost port 50345 which is a different port number to 51568.
Please help! | 0 | [
2,
11801,
410,
365,
45,
1702,
20,
3547,
21,
365,
9,
2343,
20,
6379,
20,
14,
5388,
8128,
800,
3726,
3726,
31,
143,
48,
25,
21,
1399,
1251,
15,
17,
31,
22,
195,
1302,
65,
835,
2593,
22,
18,
17,
21,
22,
18,
47,
31,
22,
79,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Creating your own HTTP web services for XMPP
===
Given the many issues with sockets and XMPP in WP7 (and WP7.5) I thought of doing something to make this a better world... but then came the catch, I don't much about web servers (actually not much about the web in general).
Note that I'm not asking about web servers nor security nor hardware nor hosting but actual code. Also I don't intend for this to be globally used service, but rather a fee-free-to-use-under-your-own-risk service.
Question is, What would I need to do to create a web service that could act as a layer in between wp7+ push notifications and XMPP? I intend to do this in .NET (C# or Visual Basic, whichever). The main goal of this is to provide the means to create a service for a gTalk client that could work over push, but it could be generalized to support any other XMPP service (if the latter doesn't become to much of a trouble). | 0 | [
2,
2936,
154,
258,
7775,
2741,
687,
26,
993,
79,
3421,
800,
3726,
3726,
504,
14,
151,
1549,
29,
18482,
18,
17,
993,
79,
3421,
19,
13,
13790,
465,
13,
5,
290,
13,
13790,
465,
9,
264,
6,
31,
289,
16,
845,
301,
20,
233,
48,
21,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Action Listeners
===
Im new to java and have started of with a first project being a TicTacToe game. I created a gui but now i don't know how to use the action listeners that are attached to the buttons. And how would i make it work form a different class file? | 1 | [
2,
1028,
15672,
800,
3726,
3726,
797,
78,
20,
8247,
17,
57,
373,
16,
29,
21,
64,
669,
142,
21,
13,
1786,
6981,
262,
62,
250,
9,
31,
679,
21,
9457,
47,
130,
31,
221,
22,
38,
143,
184,
20,
275,
14,
1028,
15672,
30,
50,
3638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Add Distance from current location to NSMutableArray
===
I'm trying to load the distance from my current location into my Array, but I seem to be missing something. My TableView only shows "?", which should only show if my currentLoc is not working, but my NSLog is showing the correct location. Please help
#import "AuthorViewController.h"
#import "Author.h"
#import <sqlite3.h>
@implementation AuthorViewController
@synthesize theauthors;
@synthesize currentLoc;
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
currentLoc = newLocation;
if (newLocation.horizontalAccuracy <= 100.0f) {
[locMgr stopUpdatingLocation];
}
NSLog(@"Lat: %f, Long: %f", currentLoc.coordinate.latitude, currentLoc.coordinate.longitude);
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSString *msg = [[NSString alloc]initWithString:@"Error obtaining location"];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:msg delegate:nil cancelButtonTitle:@"Done" otherButtonTitles:nil];
[alert show];
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[self barList];
[super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
locMgr = [[CLLocationManager alloc] init];
locMgr.delegate = self;
[locMgr startUpdatingLocation];
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.theauthors count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
int rowCount = indexPath.row;
Author *author = [self.theauthors objectAtIndex:rowCount];
cell.textLabel.text = author.barName;
if (currentLoc == nil) {
cell.detailTextLabel.text = [NSString stringWithFormat:@"?"];
}else
{
cell.detailTextLabel.text = [NSString stringWithFormat:@"%.02f km", author.cachedDist];
}
return cell;
}
-(NSMutableArray *) barList{
theauthors = [[NSMutableArray alloc] init];
@try {
NSFileManager *fileMgr = [NSFileManager defaultManager];
NSString *dbPath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"TulsaBars.sqlite"];
BOOL success = [fileMgr fileExistsAtPath:dbPath];
if(!success)
{
NSLog(@"Cannot locate database file '%@'.", dbPath);
}
if(!(sqlite3_open([dbPath UTF8String], &db) == SQLITE_OK))
{
NSLog(@"An error has occured: %@", sqlite3_errmsg(db));
}
const char *sql = "SELECT * FROM TulsaBars";
sqlite3_stmt *sqlStatement;
if(sqlite3_prepare(db, sql, -1, &sqlStatement, NULL) != SQLITE_OK)
{
NSLog(@"Problem with prepare statement: %@", sqlite3_errmsg(db));
}else{
while (sqlite3_step(sqlStatement)==SQLITE_ROW) {
Author * author = [[Author alloc] init];
author.barName = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,1)];
author.barAddress = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,2)];
author.barState = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 5)];
author.barLat = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 8)];
author.barLong = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 9)];
author.cachedDist = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 10)];
CLLocation *barLocation = [[CLLocation alloc] initWithLatitude:[author.barLat doubleValue] longitude:[author.barLong doubleValue]];
CLLocationDistance distancekm = [currentLoc distanceFromLocation: barLocation]/1000;
NSString *distanceString = [[NSString alloc] initWithFormat: @"%f", distancekm];
author.cachedDist = distanceString;
[theauthors addObject:author];
}
}
sqlite3_finalize(sqlStatement);
}
@catch (NSException *exception) {
NSLog(@"Problem with prepare statement: %@", sqlite3_errmsg(db));
}
@finally {
sqlite3_close(db);
return theauthors;
}
}
@end | 0 | [
2,
3547,
1583,
37,
866,
1474,
20,
13,
2172,
7903,
579,
8576,
93,
800,
3726,
3726,
31,
22,
79,
749,
20,
6305,
14,
1583,
37,
51,
866,
1474,
77,
51,
7718,
15,
47,
31,
2260,
20,
44,
2863,
301,
9,
51,
859,
4725,
104,
1285,
13,
7,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Validate object instance type against gereric 'T' type
===
I have a Class with generic type:
class Foo<T> {
protected boolean validateType(Object obj){
if (obj instanceof T) {
return true;
}
return false;
}
}
To test:
Foo foo = new Foo<String>();
foo.validateType(new String()); // should return true
foo.validateType(new Long()); // should return false;
And have a function that needs to validate an object against the generic type 'T', obviously the code above have errors?
How can I do such
| 0 | [
2,
7394,
1373,
3095,
4851,
1001,
149,
5389,
14744,
13,
22,
38,
22,
1001,
800,
3726,
3726,
31,
57,
21,
718,
29,
12733,
1001,
45,
718,
4310,
111,
1,
38,
1,
13,
1,
3803,
9827,
413,
210,
7394,
1373,
4474,
5,
23793,
5122,
728,
6,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Registering touches on CCSprite characters of a CCLabelBMFont label
===
The problem I encounter is that the positions of the CCLabelBMFont label and the one of the CCSprite characters composing that label seem to be different so I cannot manage the touch events...
To test more in details this issue I tried this :
-(id)init
{
if ((self = [super init])
{
CCLabelBMFont *label = [CCLabelBMFont labelWithString:"welcome" fntFile:@"Arial.fnt"];
CGSize size = [[CCDirector sharedDirector] winSize];
label.position = ccp(size.width/2, size.height/2);
[self addChild: self.label];
self.isTouchEnabled = YES;
}
return self;
}
-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView:[touch view]];
touchLocation = [[CCDirector sharedDirector] convertToGL:touchLocation];
NSLog(@"point touched: x:%f, y:%f", touchLocation.x, touchLocation.y);
for (CCSprite *character in [label children])
{
if (CGRectContainsPoint([character boundingBox], touchLocation))
{
[character setColor:ccRED];
}
}
}
And whatever the letter of the label I touch it didn't turn red as it should.
And the reason why I think the position of the sprites composing the CCLabelBMFont and the label itself are different is that when I insert :
NSLog(@"character position: x:%f y: %f", character.position.x, character.position.y);
in the ccTouchesBegan touch handling, the position of the sprites are listed to be on the lower left corner of the screen.
So maybe I'm missing something simple but is there a way to convert the sprites position to be at the same place as the label to enable the recognition of the touches on the letters of a label?
Thanks in advance. | 0 | [
2,
2243,
68,
13935,
27,
8093,
3401,
8011,
1766,
16,
21,
8093,
21018,
13178,
21931,
1899,
800,
3726,
3726,
14,
1448,
31,
7007,
25,
30,
14,
3062,
16,
14,
8093,
21018,
13178,
21931,
1899,
17,
14,
53,
16,
14,
8093,
3401,
8011,
1766,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Mysterious blank lines in Outlook
===
I have found a strange behaviour in Outlook. It has happend to me a couple of times. It's perhaps nothing important, but I think it's very weird... I'd be grateful if someone could tell me what's causing it!
Create a new e-mail in Outlook. (I use Outlook 2010.) Then paste the following (Swedish) text:
Även den nya KOBRASERV-versionen måste ut till kunderna. Observera dock, som vi sa innan, att servern inte har någon versionskontroll mot klient/COBOL. Den nya servern får absolut inte installeras i en miljö där det fortfarande finns kvar INSPECT på COBOL-sidan. Då kommer packning av [502]-meddelanden att göra att export från DR går märkbart långsammare med den nya servern än med den gamla... Dock bör servern finnas på plats när den nya klienten installeras, för att dra nytta av den snabbare bearbetningen.
Så installationsordningen bör vara COBOL-program,
(Maybe you first have to paste it in e.g. Notepad, so that you just get the unformated text.)
There was one blank line between the paragraphs in the original text, right? But when you paste it in an e-mail you get two. Try to delete the extra line, then save (Ctrl-S) the e-mail and close the window. Then open the e-mail again. And the extra blank line is back...
I've done a lot of tests. E.g. moved the text to Notepad and inspected it with a hex editor - there are no hidden control characters. And if I remove some of the text the problem disappears. It is just this sequence of characters in the first paragraph that causes Outlook to add an extra newline - a newline you can't get rid off...
Does anybody know what this is? Is there any way to avoid it?
Best regards
Anders from Sweden
| 2 | [
2,
6896,
6463,
1560,
19,
19837,
800,
3726,
3726,
31,
57,
216,
21,
2578,
7727,
19,
19837,
9,
32,
63,
2384,
43,
20,
55,
21,
1335,
16,
436,
9,
32,
22,
18,
1774,
626,
681,
15,
47,
31,
277,
32,
22,
18,
253,
5455,
9,
9,
9,
31,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Convert 2012-06-28T14:30:00-04:00 to yyyyMMddTHHmm format in C#
===
I want to convert a date in c# like 2012-06-28T14:30:00-04:00 in to "yyyyMMddTHHmm" format both dates are in string.
like.
string currentDate="2012-06-28T14:30:00-04:00";
string requiredDate="yyyyMMddTHHmm"
When i am trying to convert this date with Convert.ToDateTime() then C# return "20120629T0000-04:00" but this is not correct date.
Please help me. | 0 | [
2,
8406,
563,
8,
3370,
8,
2714,
38,
1419,
45,
1762,
45,
2032,
8,
387,
23719,
20,
13,
93,
93,
93,
93,
3363,
8096,
96,
15530,
2595,
19,
272,
5910,
800,
3726,
3726,
31,
259,
20,
8406,
21,
1231,
19,
272,
5910,
101,
563,
8,
3370,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Dynamic Web Project with Seam Faces
===
I tried to start a new dynamic Web Project with Seam-Faces(Eclipse). I created a new JSF-Facility and addeed all the jar-Files from the official Seam-Faces homepage. When i try to create a dynamic web project eclipse says that the following File ist not found:
javax.faces.FactoryFinder
What i am doing wrong ? Is ist possible to use Seam-Faces without the Seam-Framework ?
| 0 | [
2,
7782,
2741,
669,
29,
13927,
4904,
800,
3726,
3726,
31,
794,
20,
799,
21,
78,
7782,
2741,
669,
29,
13927,
8,
6413,
18,
5,
3319,
6013,
870,
6,
9,
31,
679,
21,
78,
487,
18,
410,
8,
1473,
150,
20901,
17,
3547,
62,
69,
65,
14,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Renaming file in NERDTREE
===
Is it possible to rename file in NERDTree? I know about the m menu but there is no rename option. | 0 | [
2,
25934,
3893,
19,
25758,
8101,
800,
3726,
3726,
25,
32,
938,
20,
302,
7259,
3893,
19,
25758,
8101,
60,
31,
143,
88,
14,
307,
11379,
47,
80,
25,
90,
302,
7259,
4255,
9,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
porting boucycastle certificate building from java to c#
===
I'm trying to write an application that creates certificates from java to c#.
this is the existing code:
KeyStore ks = KeyStore.getInstance("mykeystore");
ks.load(null, null);
Key key = ks.getKey(CertCA, null);
byte bInputData[] = bOut.toByteArray(); //-> this is a certificate
Signature sig = Signature.getInstance("SHA1withRSA");
sig.initSign((PrivateKey) key);
sig.update(bInputData);
byte signature[] = sig.sign();
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(tbsCert); //-> tbsCert is a TBSCertificateStructure of the certificate
v.add(sigAlgId); //-> sigAlgId is a AlgorithmIdentifier for SHA1WithRSAEncryption
v.add(new DERBitString(signature));
X509CertificateObject clientCert = new X509CertificateObject(
new X509CertificateStructure(new DERSequence(v)));
clientCert.verify(CA.getPublicKey()); // CA is the certification authority certificate
KeyStore store = KeyStore.getInstance("PKCS12");
store.load(null, null);
X509Certificate[] chain = new X509Certificate[1];
chain[0] = clientCert;
store.setKeyEntry(dn, privKey, pswd.toCharArray(), chain);
FileOutputStream fOut = new FileOutputStream("certificate\\" + dn + ".p12");
store.store(fOut, pswd.toCharArray());
c# code I wrote follow;
byte[] signature = hsmEngine.getSignaturePrivateKey(CertCA, bInputData); //-> bInputData is the certificate byte array that is signed with the private key of the CA certificate
if (signature == null)
{
Console.WriteLine("No private key found in HSM");
return;
}
//-> tbsCert is a TbsCertificateStructure of the certificate
//-> sigAlgId is a AlgorithmIdentifier for SHA1WithRSAEncryption
X509CertificateStructure certStruct = new X509CertificateStructure(tbsCert, sigAlgId, new DerBitString(signature));
Org.BouncyCastle.X509.X509Certificate cc = new Org.BouncyCastle.X509.X509Certificate(certStruct);
cc.Verify(newCACert.GetPublicKey());
X509CertificateEntry[] chain = new X509CertificateEntry[1];
chain[0] = new X509CertificateEntry(cc);
IDictionary bagAttr = new Hashtable();
bagAttr.Add(PkcsObjectIdentifiers.Pkcs9AtFriendlyName.Id, new DerBmpString(dn));
bagAttr.Add(PkcsObjectIdentifiers.Pkcs9AtLocalKeyID.Id,
new SubjectKeyIdentifierStructure(publicKey));
Pkcs12Store store = new Pkcs12StoreBuilder().Build();
store.SetKeyEntry(dn, new AsymmetricKeyEntry(privateKey, bagAttr), chain);
FileStream fOut = File.Create("certificate\\" + dn + ".p12");
store.Save(fOut, pswd.ToCharArray(), new SecureRandom());
fOut.Close();
Since there is no X509CertificateObject in c# i used X509CertificateStructure directly but probably is not the same. Anyway the error is:
Org.BouncyCastle.Security.SecurityUtilityException: algorithm identifier in key not recognised: 1.2.840.113549.1.1.5
at Org.BouncyCastle.Security.PublicKeyFactory.CreateKey(SubjectPublicKeyInfo keyInfo)
at Org.BouncyCastle.X509.X509Certificate.GetPublicKey()
at Org.BouncyCastle.Pkcs.Pkcs12Store.SetKeyEntry(String alias, AsymmetricKeyEntry keyEntry, X509CertificateEntry[] chain)
at GeneratorCard.certificate.CreateCertCard.createCert(HSMEngine hsmEngine, String dn, String pswd, String inizioValidataCertificato, String fineValidataCertificato)
at GeneratorCard.certificate.CreateCertCard.createCertificateClient(HSMEngine hsmEngine, String dn, String pswd, String inizioValidataCertificato, String fineValidataCertificato)
at GeneratorCard.certificate.Certificate.createClientCertificate(HSMEngine hsmEngine, String dn, String pswd, String inizioValidataCertificato, String fineValidataCertificato)
at GeneratorCard.gencard.GeneratorCardEngine.generateKey(String ID, Int32 numberCards, Int32 tipoCarta)
at GeneratorCard.GeneratorCard.Main(String[] args)
Any help will be really appreciated.
thanks. | 0 | [
2,
1295,
68,
5963,
2731,
16736,
6259,
353,
37,
8247,
20,
272,
5910,
800,
3726,
3726,
31,
22,
79,
749,
20,
2757,
40,
3010,
30,
9695,
6259,
18,
37,
8247,
20,
272,
5910,
9,
48,
25,
14,
3149,
1797,
45,
1246,
16828,
13,
4020,
800,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Using getValue for JFormattedText to display in another JFormattedText field
===
I have a program where I calculate for either 1 of 2 variables depending on the radio button selected. I'm trying to use getValue to get a value from a JFormattedText field and display it on another JFormattedText field (eventually I will do some calculations with the number).
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.text.DecimalFormat;
public class FutureValueFrame extends JFrame {
public FutureValueFrame() {
setTitle("Sample App");
setSize(400,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
JFrame f = new FutureValueFrame();
//GUI and BUTTONS
JRadioButton monthlyRadioButton = new JRadioButton("Monthly Payment");
JRadioButton loanAmountButton = new JRadioButton("Loan Amount");
ButtonGroup selection = new ButtonGroup();
selection.add(monthlyRadioButton);
selection.add(loanAmountButton);
JFormattedTextField loanAmountField = new JFormattedTextField(new DecimalFormat("####.##"));
JFormattedTextField interestRateField = new JFormattedTextField(new DecimalFormat("####.##"));
JFormattedTextField yearField = new JFormattedTextField(new DecimalFormat("####.##"));
JFormattedTextField monthlyPaymentField = new JFormattedTextField(new DecimalFormat("####.##"));
JPanel menuPanel = new JPanel();
menuPanel.setLayout(new GridLayout(1,2));
//ACTION LISTENER FOR RADIO BUTTONS
monthlyRadioButton.addActionListener(new SelectionListener(monthlyRadioButton, loanAmountButton, loanAmountField, monthlyPaymentField));
loanAmountButton.addActionListener(new SelectionListener(monthlyRadioButton, loanAmountButton, loanAmountField, monthlyPaymentField));
JPanel topPanel = new JPanel();
topPanel.setLayout(new GridLayout(1,2));
topPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
topPanel.add(monthlyRadioButton);
topPanel.add(loanAmountButton);
JPanel botPanel = new JPanel();
botPanel.setLayout(new GridLayout(4,2));
botPanel.add(new JLabel("Loan Amount:"));
botPanel.add(loanAmountField);
botPanel.add(new JLabel("Yearly Interest Rate:"));
botPanel.add(interestRateField);
botPanel.add(new JLabel("Number of Years:"));
botPanel.add(yearField);
botPanel.add(new JLabel("Monthly Payment:"));
botPanel.add(monthlyPaymentField);
JPanel container = new JPanel();
container.setLayout(new GridLayout(3,1));
container.add(topPanel);
container.add(botPanel);
container.add(menuPanel);
f.add(container);
JButton calculateButton = new JButton("Calculate");
calculateButton.addActionListener(new CalculateMonthlyListener(loanAmountField, interestRateField, yearField, monthlyPaymentField, selection, monthlyRadioButton, loanAmountButton));
JButton exitButton = new JButton("Exit");
exitButton.addActionListener(new ExitListener());
menuPanel.add(calculateButton);
menuPanel.add(exitButton);
f.setVisible(true);
f.setLocationRelativeTo(null);
}
class CalculateMonthlyListener implements ActionListener {
private JFormattedTextField loanAmountField;
private JFormattedTextField monthlyPaymentField;
private JFormattedTextField interestRateField;
private JFormattedTextField yearField;
private double result;
private ButtonGroup selection;
private JRadioButton monthlyRadioButton;
private JRadioButton loanAmountButton;
public CalculateMonthlyListener (JFormattedTextField loanAmountField, JFormattedTextField interestRateField, JFormattedTextField yearField, JFormattedTextField monthlyPaymentField, ButtonGroup selection, JRadioButton monthlyRadioButton, JRadioButton loanAmountButton)
{
this.interestRateField = interestRateField;
this.yearField = yearField;
this.loanAmountField = loanAmountField;
this.selection = selection;
this.monthlyRadioButton = monthlyRadioButton;
this.loanAmountButton = loanAmountButton;
this.monthlyPaymentField = monthlyPaymentField;
}
public void actionPerformed(ActionEvent e) {
if (selection.getSelection().equals(monthlyRadioButton.getModel())) {
result = ((Double) interestRateField.getValue()).floatValue();
monthlyPaymentField.setValue(new Double(result));
System.out.println("You selected monthly");
} else {
loanAmountField.setValue(new Double(12.22));
System.out.println("You selected loan");
}
}
}
class ExitListener implements ActionListener {
public void actionPerformed(ActionEvent event){
//f.dispose();
System.exit(0);
//System.out.println("You clicked exit");
}
}
class SelectionListener implements ActionListener {
private JRadioButton monthlyRadioButton;
private JRadioButton loanAmountButton;
private JFormattedTextField loanAmountField;
private JFormattedTextField monthlyPaymentField;
public SelectionListener (JRadioButton monthlyRadioButton, JRadioButton loanAmountButton, JFormattedTextField loanAmountField, JFormattedTextField monthlyPaymentField)
{
this.monthlyRadioButton = monthlyRadioButton;
this.loanAmountButton = loanAmountButton;
this.loanAmountField = loanAmountField;
this.monthlyPaymentField = monthlyPaymentField;
}
public void actionPerformed(ActionEvent event){
if(event.getSource() == monthlyRadioButton){
loanAmountField.setEditable(false);
monthlyPaymentField.setEditable(true);
}
else {
monthlyPaymentField.setEditable(false);
loanAmountField.setEditable(true);
}
}
}
}
My problem occurs in the snippet of code below:
public void actionPerformed(ActionEvent e) {
if (selection.getSelection().equals(monthlyRadioButton.getModel())) {
result = ((Double) interestRateField.getValue()).floatValue();
monthlyPaymentField.setValue(new Double(result));
System.out.println("You selected monthly");
} else {
loanAmountField.setValue(new Double(12.22));
System.out.println("You selected loan");
}
}
Here, I am trying to assign the getValue to result. I've looked Oracle documentation and it seems like the code to get the value is simply `interestRateField.getValue();` When I tried this though, I got an error saying `Can't convert object to double` so I added floatValue() and casted it to remove the error.
When I press calculate, it does not display the input from interestRateField in monthlyPaymentField.
**How do I get my value (from JFormattedTextField using DecimalFormat) using getValue and then display it in a different JFormattedTextField?**
Thanks for reading! | 0 | [
2,
568,
164,
15165,
26,
487,
29850,
11969,
20,
3042,
19,
226,
487,
29850,
11969,
575,
800,
3726,
3726,
31,
57,
21,
625,
113,
31,
18469,
26,
694,
137,
16,
172,
12157,
4758,
27,
14,
603,
5167,
1704,
9,
31,
22,
79,
749,
20,
275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Compiling a C++ subclass
===
I'm getting confused with my C++ class structure below:
A.h:
class A{
}
A.cpp
//implementation for A
void A::someMethod();
B.cpp:
#include "A.h"
B : public A{
//stuff for B
}
int main{
B b();
b.someMethod();
}
g++ A.cpp A.h --> compiles fine
g++ B.cpp --> undefined reference to main
| 1 | [
2,
24378,
21,
272,
20512,
972,
1898,
800,
3726,
3726,
31,
22,
79,
1017,
4230,
29,
51,
272,
20512,
718,
1411,
1021,
45,
21,
9,
252,
45,
718,
21,
1,
13,
1,
21,
9,
150,
3421,
12894,
8983,
413,
1130,
857,
26,
21,
11364,
21,
45,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
JavaScript getMonth() returns 50 for the month value
===
Good morning gang.
I have a jQuery Datepicker object that is prepoulated using a javscript Date object, and I have getMonth() returning 50 as the month, instead of 5. This was previously working as recent as 4/27/2012.
Here's the code:
$(document).ready(function(){
$('#datepicker1').attr('readonly', 'readonly');
var press_date = new Date(); //This is the Date object that you're getting from external source
$('#datepicker1').val(press_date.getFullYear()+'-'
+press_date.getMonth()+1+'-'
+press_date.getDate());
$('#datepicker1').datepicker({
showAnim:'slide',showOn: 'button',
dateFormat : 'yy-mm-dd',
buttonImage: 'images/calendar.jpg',
buttonImageOnly: true,onSelect: function(dateText, inst) {}
});
$('#datepicker').attr('readonly', 'readonly');
$('#datepicker').datepicker({
showAnim:'slide',showOn: 'button',
dateFormat : 'yy-mm-dd',
buttonImage: 'images/calendar.jpg',
buttonImageOnly: true,onSelect: function(dateText, inst) {}
});
});
My guess is that this is a simple issue to resolve, but I haven't seen anything around the web to explain it. | 0 | [
2,
8247,
8741,
164,
6444,
5,
6,
4815,
1222,
26,
14,
1617,
1923,
800,
3726,
3726,
254,
959,
3285,
9,
31,
57,
21,
487,
8190,
93,
1231,
16855,
106,
3095,
30,
25,
782,
1638,
13045,
568,
21,
3009,
710,
8741,
1231,
3095,
15,
17,
31,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Php can't exec ('convert') after Homebrew ImageMagick install
===
I installed Imagemagick using Homebrew on Lion, everything is fine except that it doesn't work at all when being called from php. Console:
$ convert -version
Version: ImageMagick 6.7.1-1 2011-07-29 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
$ which convert
/usr/local/bin/convert
PHP:
echo exec ('convert -version');
Produces nothing.
I was hoping to switch to Homebrew from Mac Ports after reading the good stuff about it, this is the first time it manage to successful install itself and now this. New computer, no MacPorts or anything was installed here. | 0 | [
2,
13,
26120,
92,
22,
38,
1396,
3319,
13,
5,
22,
1126,
8122,
22,
6,
75,
213,
13712,
1961,
21200,
197,
16146,
800,
3726,
3726,
31,
4066,
1961,
21200,
197,
568,
213,
13712,
27,
6023,
15,
796,
25,
1123,
1613,
30,
32,
1437,
22,
38,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Installing XCode 3.2.6 but no Xcode app in the Applications folder
===
I just installed Xcode 3.2.6 a couple times in a custom directory. I am installing that in addition to Xcode 4.2 that is installed in my developer folder. I can't seem to find the Xcode app in the Applications folder in the custom directory. All I see is a Utilities folder. Any ideas as to what might have happened? | 0 | [
2,
25429,
993,
9375,
203,
9,
135,
9,
379,
47,
90,
993,
9375,
4865,
19,
14,
3767,
19294,
800,
3726,
3726,
31,
114,
4066,
993,
9375,
203,
9,
135,
9,
379,
21,
1335,
436,
19,
21,
5816,
16755,
9,
31,
589,
25429,
30,
19,
848,
20,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
VBS change IE integrity level win 7
===
I am creating a login script
the issue is which IE integrity level. I need the internet window opened to be a emdium integrity window as in low integrity the script does not run correctly and the page is displayed wrong.
I have found references to CLSID and I have tried the code but it will still not open correctly
Set m_objIEBrowser = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
With m_objIEBrowser
.Visible = True
.Navigate "about:blank"
.AddressBar = False
.ToolBar = False
.StatusBar = False
.Resizable = False
.Width = 509
.Height = 300
.Left = 0
.Top = 0
.Visible = True
.Navigate2 "\\" & m_strLogonServer & "\NETLOGON\Logon\default.htm"
End With
Do While(m_objIEBrowser.Busy)
Loop
End Sub | 0 | [
2,
13,
20468,
18,
753,
13,
660,
11961,
662,
628,
453,
800,
3726,
3726,
31,
589,
2936,
21,
6738,
108,
3884,
14,
1513,
25,
56,
13,
660,
11961,
662,
9,
31,
376,
14,
2620,
1463,
520,
20,
44,
21,
3579,
43,
2187,
11961,
1463,
28,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Crashed With Implementing Multiple Sections In UITableView
===
I'm now learning UITableView class on iOS development,i want to implement three sections in my tableView,but always crashed when i tapped the tabBarItem which contains the tableView.my code is below:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = @"Settings";
self.tabBarItem.image = [UIImage imageNamed:@"19-gear.png"];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSArray *list1 = [[NSMutableArray alloc] initWithObjects:@"fbfb", @"dfhbfh", @"rtjtj", @"rgrrth", @"grhh", @"tyjtyj", nil];
NSArray *list2 = [[NSMutableArray alloc] initWithObjects:@"fgngg", @"yjyj", @"rhrht", @"rthfh", @"tjtyjyj", @"fsfsdf", nil];
NSArray *list3 = [[NSMutableArray alloc] initWithObjects:@"24242", @"24242", @"24242", @"4242", @"4242", @"24242", nil];
self.array1 = list1;
self.array2 = list2;
self.array3 = list3;
[list1 release];
[list2 release];
[list3 release];
}
#pragma mark -
#pragma mark - TableView Data Source Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
switch (section) {
case 0:
return [array1 count];
break;
case 1:
return [array2 count];
case 2:
return [array3 count];
default:
break;
}
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cells = @"Cells";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cells];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cells];
}
switch (indexPath.section) {
case 0:
cell.textLabel.text = [array1 objectAtIndex:indexPath.row];
break;
case 1:
cell.textLabel.text = [array2 objectAtIndex:indexPath.row];
case 2:
cell.textLabel.text = [array3 objectAtIndex:indexPath.row];
default:
break;
}
return cell;
}
| 0 | [
2,
7579,
29,
17333,
1886,
4501,
19,
13,
11193,
579,
4725,
800,
3726,
3726,
31,
22,
79,
130,
2477,
13,
11193,
579,
4725,
718,
27,
13,
7760,
522,
15,
49,
259,
20,
8713,
132,
4501,
19,
51,
859,
4725,
15,
811,
550,
7579,
76,
31,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
rebar generate error
===
I'm attempting to use `rebar` to generate a node, and I've followed the instructions from [here](https://github.com/basho/rebar/wiki/Release-handling).
Running `rebar get-deps compile` works fine, but running `rebar generate` gives me
ERROR: Unable to generate spec: read file info /home/inaimathi/common/rebar.config~ failed
ERROR: Unexpected error: rebar_abort
ERROR: generate failed while processing /home/inaimathi/common/rel: rebar_abort
Odd, given that `rebar.config~` shouldn't figure anywhere in the `generate` process. Removing `rebar.config~` and trying again gives me the same error, but relating to `rebar.config` instead.
My `rebar.config` looks like
{sub_dirs, ["rel"]}.
{lib_dirs, ["deps"]}.
{deps, [{erlsha2, ".*", {git, "git://github.com/vinoski/erlsha2.git", "HEAD"}}]}.
and my `reltool.config` looks like
{sys, [
{lib_dirs, []},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "common", "1",
[
kernel,
stdlib,
sasl,
common
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "common"},
{profile, embedded},
{incl_cond, derived},
{mod_cond, derived},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]},
{app, common, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}
]}.
{target_dir, "common"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/common", "bin/common"},
{copy, "files/common.cmd", "bin/common.cmd"},
{copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
{copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
{copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
{copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
]}.
(entirely `rebar`-generated except that I had to add `{lib_dir, ".."}` as per the instructions I linked).
What am I doing wrong?
| 0 | [
2,
302,
1850,
7920,
7019,
800,
3726,
3726,
31,
22,
79,
6314,
20,
275,
13,
1,
99,
1850,
1,
20,
7920,
21,
15421,
15,
17,
31,
22,
195,
709,
14,
7650,
37,
636,
6836,
500,
5,
21127,
18,
6903,
10404,
20926,
9,
960,
118,
969,
9468,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
C# - SendMessage - How to handle multiple locals/languages/regions?
===
I'm currently using SendMessage in my app to send keyboard commands, and it works VERY well if the keybaord layout is set to US-EN.
Of course, a lot of my users aren't based in the US. Does anyone have any ideas how I can detect + change what is being sent based on the keyboard layout?
I also tried to use http://stackoverflow.com/questions/1542409/how-to-get-current-regional-settings-in-c to help a bit, but of course it always says US unless I restart my app after changing the settings.
Thanks in advance! | 0 | [
2,
272,
5910,
13,
8,
2660,
3845,
18,
1303,
13,
8,
184,
20,
3053,
1886,
375,
18,
118,
7020,
18,
118,
18790,
18,
60,
800,
3726,
3726,
31,
22,
79,
871,
568,
2660,
3845,
18,
1303,
19,
51,
4865,
20,
2660,
8896,
14294,
15,
17,
32,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Understanding Cormen post office location solution
===
The book "Introduction to algorithms" by Cormen has a question **post office location problem** in chap 9.
> We are given n points p1,p2,...pn with weights w1,w2,....wn. Find a point p that minimizes the sum wi*d(pi,pj) where d(a,b) = distance between points a,b.
Looking at the solution to the same , I understand that the ***weighed median*** would be the best solution for this problem.
But I have some fundamental doubts about the actual coding part.
- If all elements have equal weight , then to find the weighed median, we find the point till which summation of all weights < 1/2. How to extend it here ?
- Given a real scenario having say the number of letters to be delivered at various houses as the weights and we want to minimize the distance to be traveled by finding the location of the post office, x coordinates given ( assuming all houses are in 1 single dimension) , how would we actually go about it ? | 0 | [
2,
3260,
2827,
755,
678,
488,
1474,
4295,
800,
3726,
3726,
14,
360,
13,
7,
26123,
20,
15935,
7,
34,
2827,
755,
63,
21,
1301,
13,
1409,
6962,
488,
1474,
1448,
1409,
19,
13724,
561,
9,
13,
1,
95,
50,
504,
13,
103,
819,
351,
165,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Search and Highlight in some PDFs doesn't work with fastPDFKit
===
I'm using fastPdfKit to open pdf files in my IPAD app, it is a great kit do search, get bookmarks, go to specific pages and zooming, but when I opened an pdf document created in some aplications like BrOffice, libreOffice he doesn't work, I find words with syllables separated. For example there is the document the words "Love and Peace", but when I try to check for example the word love, can not find. But if I put "Lo" for example it appears, but with separate syllables, where a piece of text appears on mini search. How to fix this? Any Suggestion?
Thank you! | 0 | [
2,
2122,
17,
14373,
19,
109,
13,
11124,
18,
1437,
22,
38,
170,
29,
1512,
11124,
13703,
800,
3726,
3726,
31,
22,
79,
568,
1512,
11124,
13703,
20,
368,
13,
11124,
6488,
19,
51,
31,
8240,
4865,
15,
32,
25,
21,
374,
6346,
107,
2122,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
glSurfaceView moving its self to the front onDraw - ANDROID
===
I have a `relativeLayout` that i am adding a `cameraView`, `glSurfaceView`, and an `imageView` to in that order.
It appears that since the `glSurfaceView` has a native method of onDraw, that when it redraws it's self it also brings it's self to the top of the view order. but i want the image view to remain on top. I am building this view all with java no xml like so...
RelativeLayout rel = new RelativeLayout(this);
// set as main view
setContentView(rel);
rel.addView(camPreview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
rel.addView(glView);
RelativeLayout.LayoutParams pNav = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
pNav.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,1);
pNav.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
pNav.rightMargin = 20;
rel.addView(sprayBTN,pNav);
| 0 | [
2,
13,
8430,
18830,
4725,
1219,
82,
1119,
20,
14,
431,
27,
43,
12404,
13,
8,
13005,
800,
3726,
3726,
31,
57,
21,
13,
1,
7256,
3366,
4414,
1320,
1,
30,
31,
589,
4721,
21,
13,
1,
24636,
4725,
1,
15,
13,
1,
8430,
18830,
4725,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Why are products called minterms and sums called maxterms?
===
Do they have a reason for doing so? I mean in the Sum of minterms you look for the terms with the output 1, i don't get why they call it minterms. Why not maxterms because 1 is well bigger than 0. Is there a reason behind this that idk? Or should I just remember it and dont ask why. | 0 | [
2,
483,
50,
1985,
227,
4232,
3964,
18,
17,
3907,
18,
227,
2049,
3964,
18,
60,
800,
3726,
3726,
107,
59,
57,
21,
1215,
26,
845,
86,
60,
31,
884,
19,
14,
3907,
16,
4232,
3964,
18,
42,
361,
26,
14,
1663,
29,
14,
5196,
137,
15,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to italicize text in NSAlert?
===
How can I add italicize certain parts of text in an NSAlert?
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Warning", nil)
defaultButton:NSLocalizedString(@"OK", nil)
alternateButton:nil
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"I want to italicize the word awesome in this text", nil)];
| 0 | [
2,
184,
20,
32,
192,
596,
2952,
1854,
19,
13,
16938,
1252,
38,
60,
800,
3726,
3726,
184,
92,
31,
3547,
32,
192,
596,
2952,
1200,
1341,
16,
1854,
19,
40,
13,
16938,
1252,
38,
60,
13,
16938,
1252,
38,
1637,
192,
6767,
800,
636,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Magento changes layout dynamically via system variable
===
Is there a way we could changes the layout of a Magento page (let's say a product category page) dynamically by using system variable which have been set on our own module? I want to be able to set my category page's default layout via my own module admin config panel. So that I don't have to deal with those confusing XML layout file each time I want to change my default layout for a certain magento page.
I know, on a phtml file, we could simply call our own module's system variable by calling `Mage::getStoreConfig('module/scope/...')` to use that system variable. but what if we want to use that system variable to change the whole layout which is set on the XML layout file by default.
I don't see any ways to pull that system variable value on the XML Layout file.
But I'm pretty sure there must be a right way to do that. So far, this is the closest clue that I've got
http://stackoverflow.com/questions/5596193/magento-xml-layouts-specify-value-for-ifconfig
But, still, I couldn't find any direct answer for what I really want to achieve | 0 | [
2,
4723,
17050,
1693,
9106,
7782,
1326,
1197,
329,
7612,
800,
3726,
3726,
25,
80,
21,
161,
95,
110,
1693,
14,
9106,
16,
21,
4723,
17050,
2478,
13,
5,
1336,
22,
18,
395,
21,
2374,
3230,
2478,
6,
7782,
1326,
34,
568,
329,
7612,
56... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
@Transactional cause nosuchbeandefinitionexception in spring framework
===
I have a problem when annotating with @transactional a method of my service class. Such annotation cause a NoSuchBeanDefinitionExcpetion in my test class where the service class is autowired. If the transactional annotation is removed it works fine again. Why is this happening, I couldn't find a clue in spring documentation.
This is my application-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="<mypackage...>" />
<import resource="data-context.xml"/>
<import resource="resources-context.xml"/>
<import resource="persistence-context.xml"/>
</beans>
This is part of my persistence-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSourceConnection" />
<property name="configLocation"
value="classpath:configuration/mybatis/config.xml"></property>
</bean>
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSourceConnection" />
</bean>
<tx:annotation-driven transaction-manager="txManager" />
<bean id="accessDao" class="dao.impl.AccessDaoImpl">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<bean id="utilitiesDao" class="dao.impl.UtilitiesDaoImpl">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<bean id="portafoglioDao" class="dao.impl.PortafoglioDaoImpl">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
</beans>
part of my test class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:configuration/applicationContext.xml" })
public class MyTest {
@Autowired
ApplicationContext context;
@Autowired
DriverManagerDataSource dataSourceConnection;
@Autowired
AccessAppDelegate accessApp;
the class that generates the problem
@Service
public class AccessAppDelegate extends Delegate implements DelegateInterface {
private PersonalCodesManager pcm;
AccessApp accessReq;
@Override
@Transactional
public void elaborateRequestImpl() throws Exception {
accessReq = (AccessApp) requestBean;
if (accessReq.getLan() != null) {
lang = StringUtilities.toLan(accessReq.getLan());
accessDao.updateDeviceLanguage(accessReq.getUser().getImei(),
accessReq.getLan());
}
if (requestWrap.getRequestType().compareTo(
ApplicativeConsts.INTESTAZIONE_REQUEST_LOGIN) == 0)
elaborateRequestLogin();
else
elaborateRequestAttivazione();
}
some private methods...
public PersonalCodesManager getPcm() {
return pcm;
}
public void setPcm(PersonalCodesManager pcm) {
this.pcm = pcm;
}
@Override
public String getUserId() {
accessReq = (AccessApp) requestBean;
return accessReq.getUser().getId();
}
@Override
public Class getRequestType() {
return AccessApp.class;
}
}
the class Delegate
@Component
public class Delegate{
String jsonReq;
String jsonRes;
@Autowired
ApplicationContext ctx;
@Autowired
AccessDao accessDao;
Locale lang;
java.sql.Timestamp timestamp;
RequestWrapper requestWrap;
UserAndDeviceTable userInfo;
AuthUserTable auth;
BaseResponse responseBean;
BaseRequest requestBean;
public void elaborateRequest(String body,boolean authenticationRequired){
DelegateInterface endpointImplementation = (DelegateInterface) this;
timestamp = new java.sql.Timestamp(new java.util.Date().getTime());
if (body.startsWith("json=")){
body = body.split("json=")[1];
}
requestWrap = new RequestWrapper(body);
requestBean=requestWrap.getReq(endpointImplementation.getRequestType());
this.jsonReq = requestWrap.getRequestBody();
lang = StringUtilities.toLan("en");
try {
if (authenticationRequired) {
auth = this.accessDao.checkSessioneAperta(requestBean.getSessionID(), timestamp);
if(auth==null) {
throw new Exception("Unauthorized Access");
}else{
setUserInfo(auth.getEmail());
}
}else{
setUserInfo(endpointImplementation.getUserId());
}
if(userInfo!=null){
lang=StringUtilities.toLan(userInfo.getLanguage());
}
endpointImplementation.elaborateRequestImpl();
} catch (Exception e) {
responseBean= new BaseResponse(String.valueOf(ApplicativeConsts.RC_ERRORE),ctx.getMessage(ApplicativeConsts.MSG_ERRORE_GENERAL, null, lang));
e.printStackTrace();
}
try {
ObjectMapper mapper = new ObjectMapper();
this.jsonRes = mapper.writeValueAsString(responseBean);
} catch (Exception e) {
e.printStackTrace();
}
}
public ModelMap getResponse(ModelMap model) {
// TODO Auto-generated method stub
model.addAttribute(ApplicativeConsts.INTESTAZIONE_RESPONSE, responseBean);
return model;
}
public void setUserInfo(String email) {
List<UserAndDeviceTable> userList = accessDao.findUserAndDeviceTableByEmail(email);
if (userList.size()==1){
this.userInfo = userList.get(0);
}
}
public String getJsonReq() {
return jsonReq;
}
public String getJsonRes() {
return jsonRes;
}
public BaseResponse getResponseBean() {
return responseBean;
}
}
the interface
public interface DelegateInterface {
public void elaborateRequestImpl() throws Exception;
public ModelMap getResponse(ModelMap response);
public String getUserId();
public Class getRequestType();
}
The exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TestClass': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: it.something.be.delegates.AccessAppDelegate it.something.controller.somethingControllerTestAuto.accessApp; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [it.something.be.delegates.AccessAppDelegate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: it.something.be.delegates.AccessAppDelegate it.something.controller.somethingControllerTestAuto.accessApp; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [it.something.be.delegates.AccessAppDelegate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:506)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
... 26 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [it.something.be.delegates.AccessAppDelegate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
... 28 more
| 0 | [
2,
13,
1,
7028,
8645,
192,
1679,
90,
4289,
863,
210,
28643,
10066,
872,
19,
1573,
6596,
800,
3726,
3726,
31,
57,
21,
1448,
76,
40,
1270,
1880,
29,
13,
1,
7028,
8645,
192,
21,
2109,
16,
51,
365,
718,
9,
145,
40,
1270,
857,
1679... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
File name compatible hash values in Java
===
To generate some uniqueness in file system names of user-provided files, I generate a hash value of some other user-supplied data (in this case the user's IP address and a random integer) and prefix the filename with it. I chose the SHA-1 algorithm to perform this hash. Unfortunately, the String returned from
md = MessageDigest.getInstance("SHA-1");
// Add values to the digest
String ipAddrHash = new String(md.digest());
...of course contains all sorts of weird exotic characters, most of which are not allowed in file names.
So, either:
- How do I transform the hash value string in a string that contains 'regular characters' that I can use in file names?
- Is there a simple one-way function in Java for me to use that generates a irreversible value for me to use in a file name right away? | 0 | [
2,
3893,
204,
14961,
19170,
4070,
19,
8247,
800,
3726,
3726,
20,
7920,
109,
2619,
720,
19,
3893,
329,
1817,
16,
4155,
8,
26735,
43,
6488,
15,
31,
7920,
21,
19170,
1923,
16,
109,
89,
4155,
8,
18,
576,
15540,
69,
1054,
13,
5,
108,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
conditional operation on numpy multidimensional array
===
I am a naive numpy user, need your help for the following problem: I want to replace some elements of a multidimensional array which are less than a second array by a third array; e.g.:
`x = np.arange(16).reshape((2, 8))` i.e.: x:
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]]
`y = np.array([[2],[13]])` i.e.: y:[[ 2][13]]
now, find out where x is greater than y, and if there is at least one True in x>y array, count these instances, create another array (z) and replace x in these elements with z:
`x>y` i.e.:
[[False False False **True** **True** **True** **True** **True**]
[False False False **False** **False** **False** **True** **True**]]
in this case 5 elements of x, x[:,3:], should be replaced, so we create a (5, 2) array:
`z = np.array([[20,21],[22,23],[24,25],[26,27],[28,29]])`
The result I want is
x: [[ 0 1 2 20 22 24 26 28]
[ 8 9 10 21 23 25 27 29]]
Thanks. | 0 | [
2,
21206,
1453,
27,
13,
6336,
6448,
1889,
7865,
7718,
800,
3726,
3726,
31,
589,
21,
16288,
13,
6336,
6448,
4155,
15,
376,
154,
448,
26,
14,
249,
1448,
45,
31,
259,
20,
3934,
109,
2065,
16,
21,
1889,
7865,
7718,
56,
50,
787,
119,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
What or who should interrupt a Thread?
===
According to Goetz in his book JCIP :
> Because each thread has its own interruption policy , you should not interrupt a thread unless you know what interruption means to that thread .
Why did the Java language provide a `public interrupt ()` method then ?Is this a design flaw? Who or what is supposed to interrupt a thread then ? | 0 | [
2,
98,
54,
72,
378,
15811,
21,
9322,
60,
800,
3726,
3726,
496,
20,
162,
11889,
19,
33,
360,
487,
11526,
13,
45,
13,
1,
185,
206,
9322,
63,
82,
258,
21786,
1486,
13,
15,
42,
378,
52,
15811,
21,
9322,
4003,
42,
143,
98,
21786,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Cocoa- TCP Client
===
I want to make a simples cliente of TCP. But I'm getting one error. When I make "inputStream = (NSInputStream *)readStream;" and "outputStream = (NSOutputStream *)writeStream;" it suggest's me to introduce the prefix __bridge or __bridge__transfer. First, what is it? Second, I tried both and still can't send messages. I followed this tutorial: http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server. And I've the send messages and stream too. I installed the Wireshark and the send message is been called, but it's not sending any packet to the ip.
I've just posted here the initNetworkCommunication because is where I get the "bridge" error.
- (void) initNetworkCommunication {
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"54.xxx.xxx.xxx", 1333, &readStream, &writeStream);
inputStream = (NSInputStream *)readStream;
outputStream = (NSOutputStream *)writeStream;
[inputStream setDelegate:self];
[outputStream setDelegate:self];
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[inputStream open];
[outputStream open];
}
The server is fine, because i've tried the sample code and I get a response.
Can you help me?
TKS a lot! | 0 | [
2,
24507,
8,
13,
38,
7439,
6819,
800,
3726,
3726,
31,
259,
20,
233,
21,
1935,
18,
6819,
62,
16,
13,
38,
7439,
9,
47,
31,
22,
79,
1017,
53,
7019,
9,
76,
31,
233,
13,
7,
108,
4881,
11260,
800,
13,
5,
2172,
108,
4881,
11260,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
numberOfRowsInSection: not called on reloadData
===
I have a UITableView that uses an array to list data. This works fine.
I also have an UISearchBar for searching in that tableview. When data is matched in the tableviews array those rows are added to another mutable array, and cellForRowAtIndexPath: displays data from that mutable array instead.
But numberOfRowsInSection: is never called when I call reloadData. Therefore the tableview crashes when scrolling, because it's trying to get data from the mutable array, but for rows that are in the original array (which has more items)
I've debugged for quite a while now, but can not for the love of god find the reasons for this. Datasource and Delegate are hooked up in the tableview, because it can show the data from the original array.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(@"isSearching: %d", isSearching);
// Return the number of rows in the section.
if(!isSearching)
return [originalArray count];
NSLog(@"isSearching - Return searchCopyListOfItems");
return [searchCopyListOfItems count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
if(!searching)
cell.textLabel.text = [originalArray objectAtIndex:indexPath.row];
else
cell.textLabel.text = [searchCopyListOfItems objectAtIndex:indexPath.row];
return cell;
} | 0 | [
2,
234,
1041,
5417,
18,
108,
10579,
45,
52,
227,
27,
27339,
18768,
800,
3726,
3726,
31,
57,
21,
13,
11193,
579,
4725,
30,
2027,
40,
7718,
20,
968,
1054,
9,
48,
693,
1123,
9,
31,
67,
57,
40,
13,
5661,
25136,
1850,
26,
5792,
19,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Reuse Browser tab
===
My app is supposed to open multiple Url on user request . However I want to load this Urls in a single window.In other words,I dont want to open in multiple tabs ,reuse the previously opened by my app.
And the second one (I think I know the answer to this ,) I have multiple browsers and wants to let user choose the browser user wishes to use.
I am using code as below
BrowserSession browserSession = Browser.getDefaultSession();
browserSession.displayPage("whatever url user configured!!!!");
Thanks,
And for 4.5 or more.
l | 0 | [
2,
302,
3699,
16495,
6523,
800,
3726,
3726,
51,
4865,
25,
2293,
20,
368,
1886,
287,
6362,
27,
4155,
3772,
13,
9,
207,
31,
259,
20,
6305,
48,
13,
911,
7532,
19,
21,
345,
1463,
9,
108,
89,
715,
15,
49,
1049,
259,
20,
368,
19,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Postgresql - return entire row as array
===
Is there a way how you can cast the following result to array?
select pg_tables from pg_tables
This will return one column only, however the data type is not array. | 0 | [
2,
678,
6879,
18,
22402,
13,
8,
788,
1078,
3131,
28,
7718,
800,
3726,
3726,
25,
80,
21,
161,
184,
42,
92,
1325,
14,
249,
829,
20,
7718,
60,
5407,
13,
9623,
1,
5924,
18,
37,
13,
9623,
1,
5924,
18,
48,
129,
788,
53,
4698,
104,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0... |
focus parent fiew swtbot
===
Using bot.viewByTitle() is not finding the view in which the present view is contained.I mean after selecting project name in project explorer in eclipse ,I am unable to select project explorer view again.
please help | 0 | [
2,
1776,
4766,
6028,
4460,
8783,
38,
6813,
800,
3726,
3726,
568,
11012,
9,
4725,
779,
22235,
5,
6,
25,
52,
3007,
14,
1418,
19,
56,
14,
734,
1418,
25,
3437,
9,
49,
884,
75,
20764,
669,
204,
19,
669,
8520,
19,
11652,
13,
15,
49,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0... |
How to Extend our own class in ExtJS4
===
I have created the class in Ext JS 4, and now I want to extend that in another class. I use <code>extend</code> properties, to extend the class. But I am not able to extend the class. Do I want to use require to include the class file. But I keep both the files in the same directory.
How to do it, please help me with the same.
Thanks,
Boopathy. | 0 | [
2,
184,
20,
7206,
318,
258,
718,
19,
1396,
38,
728,
18,
300,
800,
3726,
3726,
31,
57,
679,
14,
718,
19,
1396,
38,
487,
18,
268,
15,
17,
130,
31,
259,
20,
7206,
30,
19,
226,
718,
9,
31,
275,
13,
1,
9375,
1,
1706,
1316,
43,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Serialize dictionarly containg custom object which includes two dictionaries
===
In my program, I save some data in a custom object:
[Serializable]
[XmlInclude(typeof(MsgTimerSettings))]
public class MsgTimerSettings
{
public string t_name { get; set; }
public string t_subj { get; set; }
public string t_nmsg { get; set; }
public UUID t_attach { get; set; }
public string t_attachName { get; set; }
public Dictionary<string, UUID> t_ngroups { get; set; }
public Dictionary<string, UUID> t_imgroups { get; set; }
public string t_IMmsg { get; set; }
public string t_SLURL { get; set; }
public int t_Type { get; set; }
public int t_IMsetting { get; set; }
public int t_ImgIndex { get; set; }
public bool t_StartNow { get; set; }
public DateTime t_StartTime { get; set; }
public bool t_EndAt { get; set; }
public DateTime t_EndTime { get; set; }
public int t_Number { get; set; }
public string t_Period { get; set; }
public int t_Interval { get; set; }
public bool t_Active { get; set; }
}
Each of these objects are then stored in a Dictionary(Dictionary<string, MsgTimerSettings> MsgTimers;)
The dictionary key is the name of the timer.
Now, what I would like to do is to save each of these objects into an XML file so that I can read the timers back next time I start the program.
I know that dictionaries isn't serializable and I have tried to find different solutions to work around the problem, but to no avail.
I have tried to use the SerializableDictionary workaround presented at: http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx in order to make serializable dictionaries, but others than just making my dictionaries into SerializableDictionaries, I still have no clue...
The code I have tried to serialize with, is the following:
static public void SerializeToXML(SerializableDictionary<string, object> ST)
{
XmlSerializer serializer = new XmlSerializer(typeof(SerializableDictionary<string,object>));
TextWriter textWriter = new StreamWriter(@"C:\ST.xml");
serializer.Serialize(textWriter, ST);
textWriter.Close();
}
Hope anyone could help me out. | 0 | [
2,
5956,
2952,
13,
22595,
512,
102,
3717,
263,
5816,
3095,
56,
1103,
81,
29783,
800,
3726,
3726,
19,
51,
625,
15,
31,
2079,
109,
1054,
19,
21,
5816,
3095,
45,
636,
4104,
2815,
3186,
579,
500,
636,
396,
8184,
22640,
5,
4474,
1041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to add new sheet in a closed excel without opening?
===
I have an excel "Closed.Xls" which is not opened currently .
Please let me know how to add new sheets in a closed excel without opening the excel sheet.
i know how to add new sheets in current excel.
Dim WS as Worksheet
Set WS = Sheets.Add
Please let me know how to add new sheets in a closed excel ? | 0 | [
2,
184,
20,
3547,
78,
6125,
19,
21,
827,
20700,
366,
1214,
60,
800,
3726,
3726,
31,
57,
40,
20700,
13,
7,
20372,
9,
396,
7532,
7,
56,
25,
52,
520,
871,
13,
9,
2247,
408,
55,
143,
184,
20,
3547,
78,
8801,
19,
21,
827,
20700,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Triggering an event when YouTube video reaches certain timestamp?
===
The API documentation does not contain an obvious way to trigger a javascript event when a YouTube video reaches a certain time stamp. Do you know any workaround? | 0 | [
2,
7286,
68,
40,
807,
76,
7330,
763,
5539,
1200,
436,
38,
10158,
60,
800,
3726,
3726,
14,
21,
2159,
13945,
630,
52,
3717,
40,
4674,
161,
20,
7286,
21,
8247,
8741,
807,
76,
21,
7330,
763,
5539,
21,
1200,
85,
10151,
9,
107,
42,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
Loading dynamic images from SQLite
===
I returned a string from SQLite table and want to load image from the drawable folder. Is it possible?
For example :
String name = sql.getName(1); //name is now Barney
img.setImageResource(R.drawable.name);
Is it possible to load it this way?
I've tried.
int imageid = getResources().getIdentifier("com.tes.test.main:drawable/" + name.toLowerCase(), null, null);
img.setImageResource(imageid);
Doesn't work either. :(
Any help is appreciated. Thanks. | 0 | [
2,
12797,
7782,
3502,
37,
4444,
10601,
800,
3726,
3726,
31,
587,
21,
3724,
37,
4444,
10601,
859,
17,
259,
20,
6305,
1961,
37,
14,
2003,
579,
19294,
9,
25,
32,
938,
60,
26,
823,
13,
45,
3724,
204,
800,
4444,
255,
9,
3060,
7259,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
JAX-WS SOAP and/or JAX-RS REST Android, the data didn't appear on my apps
===
My projection is to build a web service that can be read on my Android apps and any web framework like CodeIgniter or YII, but I want it to be implemented on Android first.
I'd already try to figure out what I need, but I just can get a few source, because I don't have any experience in this.
I tried to learn between REST and SOAP,
**REST** :
I choose the REST first, and I try this [tutorial][1], but I have a problem with the webservice that I build both on Eclipse and Netbeans IDE, and this is what happen when I run my webservice on my tomcat server, Tomcat failed to start and appear like this on the console. (actually, I'd already post the problem on that tutorial page, but the author is not answering my question yet).
Jun 21, 2012 7:49:11 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\Java\jdk1.6.0_16\bin;C:\Program Files\Java\jdk1.7.0_01\bin;C:\opencv\build\common\tbb\ia32\vc10\;C:\opencv\build\x86\vc10\bin\;C:\Server\apache-tomcat-6.0.26\bin;;D:\Progima\Eclipse JEE Indigo\eclipse;;.
Jun 21, 2012 7:49:11 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:Luna’ did not find a matching property.
Jun 21, 2012 7:49:12 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 21, 2012 7:49:12 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 21, 2012 7:49:12 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 612 ms
Jun 21, 2012 7:49:12 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 21, 2012 7:49:12 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
java.lang.IllegalAccessError: class com.sun.media.sound.AbstractPlayer cannot access its superclass com.sun.media.sound.AbstractMidiDevice
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1591)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:1956)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1919)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1806)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1765)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1751)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1255)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:882)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5081)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
But when I try to right click the Tomcat server on Eclipse >> General >> Switch Location, then run again, the Tomcat is can started.
The tomcat is started, but when I run localhost:8080[slash]RestWebServiceDemo[slash]rest[slash]person (based on this [tutorial][1]) it still error 404. I don't know what happen.
**SOAP**:Then, I want to try the other solution beside REST. I found this [tutorial][2], and I'd already try it, I build the web service on both side, Eclipse and Netbeans. In Eclipse, the same thing like I describe above happen again when I try to start server. On Netbeans, the webservice is run normally, and I can start it normally, and I can run the wsdl localhost:9090[slash]Ladodi[slash]Hello?wsdl. But, when I try to get it from my Android, the data is didn't appear on my TextView.
The code on my Netbeans is look like this. I build two operations, with and without parameter, because on the tutorial, the operation is without parameter, and of course I need the parameter on my operations later.
package love.care;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
/**
*
* @author Setyadi
*/
@WebService()
public class Hello {
/**
* Web service operation
*/
@WebMethod(operationName = "Hai")
public String Hai(@WebParam(name = "nama")
String nama) {
//TODO write your implementation code here:
return "Hai";
}
/**
* Web service operation
*/
@WebMethod(operationName = "Kerupuk")
public String Kerupuk() {
//TODO write your implementation code here:
return "Cocote";
}
}
and here is the android code on my Eclipse to get "Kerupuk" operation (without parameter).
package in.figure.on.mobile;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class WebServiceActivity extends Activity{
private static final String NAMESPACE = "http://care.love/";
private static String URL = "http://localhost:9090/Ladodi/Hello?wsdl";
private static final String METHOD_NAME = "Kerupuk";
private static final String SOAP_ACTION = "http://care.love/Kerupuk";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
try {
ht.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
TextView helloTV = (TextView) findViewById(R.id.textHello);
helloTV.setText("Asaa :"+response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
and here is the android code on my Eclipse to get "Hai" operation (with parameter) and I want to pass "AdityaSetyadi" as parameter.
package in.figure.on.mobile;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class WebServiceActivity extends Activity{
private static final String NAMESPACE = "http://care.love/";
private static String URL = "http://localhost:9090/Ladodi/Hello?wsdl";
private static final String METHOD_NAME = "Hai";
private static final String SOAP_ACTION = "http://care.love/Hai";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo propInfo = new PropertyInfo();
propInfo.setName("nama");
propInfo.setValue("AdityaSetyadi");
propInfo.setType(PropertyInfo.STRING_CLASS);
request.addProperty(propInfo);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
try {
ht.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
TextView helloTV = (TextView) findViewById(R.id.textHello);
helloTV.setText("Asaa :"+response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
The different between the two is on PropertyInfo. I try to pass the parameter with addProperty, I try the the code from this [tutorial][3], but when try to code like this.
but the addProperty is deprecated, so I try to code above.
PropertyInfo propInfo=new PropertyInfo();
propInfo.name="arg0";
propInfo.type=PropertyInfo.STRING_CLASS;
request.addProperty(propInfo, "John Smith");
**But** the data is still not appear on my TextView, I don't know what to do.
Does anybody can help? Or give me another tutorial.
Thanks in advance,
best Regards, @AdityaSetyadi
:'(
[1]: http://avilyne.com/?p=105
[2]: http://javatutorialspoint.blogspot.com/2012/02/android-web-service-access-using-ksoap2.html
[3]: http://www.ibm.com/developerworks/webservices/library/ws-android/index.html
| 0 | [
2,
11712,
8,
10268,
6447,
17,
118,
248,
11712,
8,
1224,
760,
13005,
15,
14,
1054,
223,
22,
38,
1893,
27,
51,
4865,
18,
800,
3726,
3726,
51,
11607,
25,
20,
1895,
21,
2741,
365,
30,
92,
44,
1302,
27,
51,
13005,
4865,
18,
17,
186... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to override !important?
===
I have created a custom style sheet that overrides the original css for my wordpress template. However, on my calendar page, the original css has the height of each table cell set with the !important declaration:
td {height: 100px !important}
Is there some way I can override this? | 0 | [
2,
184,
20,
84,
11891,
13,
187,
25716,
60,
800,
3726,
3726,
31,
57,
679,
21,
5816,
1034,
6125,
30,
84,
11891,
18,
14,
501,
272,
18,
18,
26,
51,
833,
5890,
22894,
9,
207,
15,
27,
51,
7036,
2478,
15,
14,
501,
272,
18,
18,
63,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
RequireJS & Jquery - Multiple templates in one file?
===
I am loading some template files into my application using require.js like so:
define(function(require) {
var App = require('app'),
TeamListTmpl = require('text!templates/team-list.html'),
PlayerListTmpl = require('text!templates/player-list.html'),
PlayerItemTmpl = require('text!templates/player-item.html');
Then, using Backbone, I am referencing the template like so:
var PlayerItemView = Backbone.View.extend({
tagName: "li",
template: _.template(PlayerItemTmpl),
It's kind of annoying having individual template files and I'd like to combine all the templates into one html file and pull out individual elements. I tried this:
define(function(require) {
var App = require('app'),
Templates = require('text!templates/templates-combined.html');
Where the templates-combined html file looks like this:
<div id="some-element-1">1</div>
<div id="some-element-2">2</div>
<div id="some-element-3">3</div>
But this doesn't work for some reason:
$(Templates).find("#some-element-1").html();
I also tried:
$('#some-element-1', Templates).html();
Is there any way to extract the individual template files from the one combined file without adding it to the DOM first? Perhaps using javascript templates instead? Any help would be greatly appreciated. | 0 | [
2,
4077,
728,
18,
279,
487,
8190,
93,
13,
8,
1886,
22894,
18,
19,
53,
3893,
60,
800,
3726,
3726,
31,
589,
12797,
109,
22894,
6488,
77,
51,
3010,
568,
4077,
9,
728,
18,
101,
86,
45,
9267,
5,
22359,
5,
99,
3003,
99,
6,
13,
1,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
VLC compilation error in Eclipse (in Ubuntu)
===
I am trying to export VLC to Eclipse and compile it from there (in Ubuntu).
There have been a number of errors mostly related to the location of some of the header files that I could fix. But now I am getting two errors that I don't know how to fix. The errors are:
**unknown type name ‘pthread_rwlock_t’**
**unknown type name ‘pthread_spinlock_t’**
both of these are used in **"vlc_threads.h"**
Any help is highly appreciated.
Thank you very much,
TJ | 2 | [
2,
566,
6109,
4868,
7019,
19,
11652,
13,
5,
108,
287,
12968,
2473,
6,
800,
3726,
3726,
31,
589,
749,
20,
7487,
566,
6109,
20,
11652,
17,
26561,
32,
37,
80,
13,
5,
108,
287,
12968,
2473,
6,
9,
80,
57,
74,
21,
234,
16,
11908,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
list of lists creation
===
in my python code i want to create a list of lists...in a loop ...
but after completion of the loop i end up with the same list in all elements...is it because the lists are pointed to and not stored ? If so, how can i come up with a solution to my problem ?
Following is my code
list_lists=list()
list_temp=list()
for i in xrange(n):
ind_count =0
del list_temp[0:len(list_temp)]
for j in xrange(no_words):
if inp[i] == words[j]:
list_temp.append(j)
list_lists.append(list_temp) | 0 | [
2,
968,
16,
7227,
2502,
800,
3726,
3726,
19,
51,
20059,
1797,
31,
259,
20,
1600,
21,
968,
16,
7227,
9,
9,
9,
108,
21,
5293,
13,
9,
9,
9,
47,
75,
5392,
16,
14,
5293,
31,
241,
71,
29,
14,
205,
968,
19,
65,
2065,
9,
9,
9,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Can we extend Spring source code when working for a commercial app?
===
I always have used Spring Framework classes as-is.
However I am thinking of customizing the Spring-WS (WebService) behavior by extending its WebServiceTemplate class.
The WebServiceTemplate currently offers only 'sendAndReceive', but I want to make it do only a 'send'. And then a separate thread do a 'receive'. (This is being done to mirror existing work flow that relies on Messaging).
So I was thinking of extending the class..
What sort of things do I need to be aware of, before extending from an Open Source code, for a commercial app? Also, Am I free to use the source code and copy it as need be? | 0 | [
2,
92,
95,
7206,
1573,
1267,
1797,
76,
638,
26,
21,
1439,
4865,
60,
800,
3726,
3726,
31,
550,
57,
147,
1573,
6596,
2684,
28,
8,
403,
9,
207,
31,
589,
1440,
16,
5816,
3335,
14,
1573,
8,
10268,
13,
5,
14113,
11449,
6,
3257,
34,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Extremely long garbage collection times
===
We have a web application running Java 6, Tomcat 6, Spring Framework 3, Hibernate 4, EhCache.
We have a problem with extremely long garbage collection times which can take 30 seconds or longer, leaving the application unresponsive.
We're currently in testing but apart from the obvious: add more memory, I was wondering if there are aspects we could tune to reduce garbage collection time.
The major contributor to memory use is EHCache as we are aggressively caching. But I always find it hard to size the EHCache stores (the new EhCache byte size stores, lead to all sorts of problems with us because the cached object graphs can be quite large).
These are my settings for the JVM
JAVA_OPTS="$JAVA_OPTS -server -Xms256m -Xmx704m XX:OnOutOfMemoryError=/usr/share/scripts/on_server_crash.sh -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tomcat6 -XX:MaxPermSize=192m -XX:+UseConcMarkSweepGC
| 0 | [
2,
3898,
175,
15024,
1206,
436,
800,
3726,
3726,
95,
57,
21,
2741,
3010,
946,
8247,
400,
15,
2067,
5782,
400,
15,
1573,
6596,
203,
15,
4148,
2102,
8820,
268,
15,
16177,
793,
2569,
9,
95,
57,
21,
1448,
29,
3898,
175,
15024,
1206,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
insert a block of fixed size on the home page
===
I would like to make a block whose content is equal to the last article inserted.
also must have a fixed size, and always stay on the home. How do?
see also image:
![enter image description here][1]
[1]: http://i.stack.imgur.com/iTyhm.jpg | 0 | [
2,
14692,
21,
1921,
16,
3535,
1072,
27,
14,
213,
2478,
800,
3726,
3726,
31,
83,
101,
20,
233,
21,
1921,
1196,
2331,
25,
2747,
20,
14,
236,
2002,
14215,
9,
67,
491,
57,
21,
3535,
1072,
15,
17,
550,
1179,
27,
14,
213,
9,
184,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How do I stop iOS from converting a small pointing right triangle character into a rectangluar boxed triangle symbol?
===
I've tried entering the small pointing right triangle and the right arrow characters, both are converted by iOS into rectangular icons with a right triangle and a right arrow, respectively. Can I declare a different font to stop this from happening? Or is there a default setting I need to turn off?
All a want is a black small pointing right triangle:
Decimal Hex
▸ 9656 ▸ 25B8
Any suggestions would be appreciated. | 0 | [
2,
184,
107,
31,
747,
13,
7760,
37,
19583,
21,
284,
6832,
193,
8676,
925,
77,
21,
6042,
12113,
2377,
512,
1649,
69,
8676,
4678,
60,
800,
3726,
3726,
31,
22,
195,
794,
4604,
14,
284,
6832,
193,
8676,
17,
14,
193,
7409,
1766,
15,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
static variable in the class declaration or definition?
===
I am new to c++.
I have a class something like this:
class CodeTest
{
private:
static const int TOTAL=100;
}
is TOTAL is 'declaration' or 'definition'.
When i was reading scott mayer book, it was mentioned that in the implementation file,
we need to define something like:
const int CodeTest::TOTAL;
Why is it required ? Kindly provide few inputs?
| 0 | [
2,
12038,
7612,
19,
14,
718,
7098,
54,
5465,
60,
800,
3726,
3726,
31,
589,
78,
20,
272,
20512,
9,
31,
57,
21,
718,
301,
101,
48,
45,
718,
1797,
10543,
13,
1,
932,
45,
12038,
11608,
38,
19,
38,
600,
3726,
4031,
73,
13,
1,
25,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
reload page after login via wp-login.php popup by thickbox
===
I open wp-login.php in a popup, so I can login, but everything remains into the thickbox popup.<br>
I want to close the popup and reload the page after the succesfull login but I've no idea about what I've to do.
Thanks | 0 | [
2,
27339,
2478,
75,
6738,
108,
1197,
13,
13790,
8,
5567,
108,
9,
26120,
1675,
576,
34,
2318,
5309,
800,
3726,
3726,
31,
368,
13,
13790,
8,
5567,
108,
9,
26120,
19,
21,
1675,
576,
15,
86,
31,
92,
6738,
108,
15,
47,
796,
1678,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How can I use AvalonEdit to edit XML files
===
I would like to include an XML editor in my app - similar to VS's XML editor with auto-coloring, etc.
AvalonEdit sounds like a great solution.
However, AvalonEdit comes with a sample for C# syntax, not XML syntax. Is there a sample for XML syntax somewhere?
| 0 | [
2,
184,
92,
31,
275,
22396,
69,
242,
20,
9392,
23504,
6488,
800,
3726,
3726,
31,
83,
101,
20,
468,
40,
23504,
1835,
19,
51,
4865,
13,
8,
835,
20,
4611,
22,
18,
23504,
1835,
29,
3108,
8,
11282,
68,
15,
2722,
9,
22396,
69,
242,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Check a checkbox and change the font color of another option
===
Here is my demo code [http://jsfiddle.net/Wwdmm/3/][1]
But nothing is happening when I click on `require`. I want to click `require` and then change the font color of `option2` and upon uncheck `option2` removes its class.
What's the mistake? The selection is there.
Thanks
jQuery(document).ready(function(){
$('#id_run_options_0').change(function(){
if (this.checked){
alert('checked');
$('#id_run_options_1').addClass('highlight-option2');
}else{
alert('unchecked');
$('#id_run_options_1').removeClass('highlight-option2');
}});
});
[1]: http://jsfiddle.net/Wwdmm/3/ | 0 | [
2,
2631,
21,
2631,
5309,
17,
753,
14,
9978,
1665,
16,
226,
4255,
800,
3726,
3726,
235,
25,
51,
8376,
1797,
636,
21127,
6903,
728,
18,
1707,
12312,
9,
2328,
118,
14178,
43,
3363,
118,
9280,
500,
2558,
165,
500,
47,
626,
25,
4942,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Ajax method displays the wrong input
===
I am posting again a question about which I didn't have a satisfactory answer :
I am new to AJAX methods. I want to post some infos that are processes by a php page, call it page.php
In my html page, I have put this code :
<script type="text/javascript" charset="utf-8">
//I have put the function getXMLHttpRequest() on a separate js file
function getXMLHttpRequest() {
var xhr = null;
if (window.XMLHttpRequest || window.ActiveXObject) {
if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
} else {
xhr = new XMLHttpRequest();
}
} else {
alert("Votre navigateur ne supporte pas l'objet XMLHTTPRequest...");
return null;
}
return xhr;
}
function request(callback) {
var xhr = getXMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
callback(xhr.responseText);
}
};
xhr.open("POST", "page.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("name=proposition");
}
function postData(Data) {
alert(Data);
}
</script>
<button onclick="request(postData);">...</button>
In page.php, I have a method
function comment(){
//some code processing the posted infos (that works fine)...
//to debug, I have put a
echo('Hello world');
}
More precisely : the structure of page.php is page.php?page='mypage'&post='post'.So first there is a direction to a mypage.php, and then in mypage.php there is an instanciation of a class. The __construct method takes the post variable to call a method within the class which is comment().
The fact is I don't get any 'Hello world' but a huge alert message with all my webpage code displayed.
Anyone has an idea ?
Best, Newben
| 0 | [
2,
20624,
2109,
9412,
14,
1389,
6367,
800,
3726,
3726,
31,
589,
15669,
188,
21,
1301,
88,
56,
31,
223,
22,
38,
57,
21,
25549,
1623,
13,
45,
31,
589,
78,
20,
20624,
3195,
9,
31,
259,
20,
678,
109,
15404,
18,
30,
50,
5102,
34,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to get queued Messages when using SetviceThrottlingBehavior
===
I have WCF service which is regulated with helps ServiceThrottlingBehavior. I use property MaxConcurrentCalls which restricts calls, but I need know how many calls stopped/waiting. | 0 | [
2,
184,
20,
164,
22521,
43,
7561,
76,
568,
309,
18507,
96,
19879,
802,
863,
20358,
248,
800,
3726,
3726,
31,
57,
11801,
410,
365,
56,
25,
14191,
29,
7778,
365,
96,
19879,
802,
863,
20358,
248,
9,
31,
275,
1354,
2049,
1126,
17657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0... |
Rails Convention for Sharing Resources Among Many Users?
===
In my app I have Users who will perform CRUD actions on Patient Record resources. Normally, after a Patient Record is created, it will just be read by the Users. However in the rare case that two (or more) Users decide that for whatever reason they want to edit that shared resource, what is the best way to resolve this?
I have been reading about optimistic and pessimistic locking, but what is still unclear to me is whether this applies just to the update action, or does locking occur every time someone tries to read a resource as well?
What I was thinking about was if there was a way in rails to see when two or more Users are on the same page, thereby notifying the second User to come to the edit page that another User is already using this resource, and therefore just wait for the first User to finish before proceeding.
How would you approach this? Thanks! | 0 | [
2,
2240,
18,
3087,
26,
6126,
2566,
497,
151,
3878,
60,
800,
3726,
3726,
19,
51,
4865,
31,
57,
3878,
72,
129,
2985,
11498,
43,
3078,
27,
4836,
571,
2566,
9,
4147,
15,
75,
21,
4836,
571,
25,
679,
15,
32,
129,
114,
44,
1302,
34,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Static / Non-Static Method Issue
===
I am working on a simple ORM solution and have run into a tricky situation. Ideally, I'd like to be able to use methods in both a static context, and object context depending on how it is called. I am not sure if this is possible, but here is what I mean:
Say a User model wants to call find() statically, this currently works fine, for example:
$user = User::find();
Now, I also support relationships, for example a user can have messages. When this relationship is established I simply store a blank copy of a message model in the user model and set a foreign key. For example:
$user -> messages = new Message();
$user -> messages -> foreign_key = 'user_id';
Now, ideally, I would like to be able to call:
$user -> messages -> find();
In a non-static context and make use of $this -> foreign_key when in this context so as to only pull messages where the foreign key matches the user's id. Is this type of context-switching possible in PHP? Any reference to $this from static context throws an error as its a static method and should not rely on $this (for obvious reasons, when being called from a static context, $this won't exist)
Are there any clever ways around this? I tried overloading the method to have two different prototypes, both with and without the static keyword but this threw a re-declaration error. | 0 | [
2,
12038,
13,
118,
538,
8,
18077,
2109,
1513,
800,
3726,
3726,
31,
589,
638,
27,
21,
1935,
54,
79,
4295,
17,
57,
485,
77,
21,
5514,
93,
1858,
9,
5628,
102,
15,
31,
22,
43,
101,
20,
44,
777,
20,
275,
3195,
19,
156,
21,
12038,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Google AppEngine launcher fails to deploy static files correctly on a mac but it works on linux
===
I've deployed the current version of the site using the terminal on a Ubuntu machine perfectly fine and yet, when I try to do it using AppEngine Launcher or the terminal on mac OS x the static files do not work (both CSS and images).
AppEngine launcher gives no error message but when I try it on the terminal on the mac it says 'ImportError: No module named webob
I have the latest version of the launcher as well and I've used it to successfully deploy other 'smaller' sites.
I like the launcher and I'd prefer to carry on using the mac rather than the other machine... | 0 | [
2,
8144,
4865,
16847,
19755,
13614,
20,
17617,
12038,
6488,
12044,
27,
21,
1572,
47,
32,
693,
27,
13024,
800,
3726,
3726,
31,
22,
195,
6698,
14,
866,
615,
16,
14,
689,
568,
14,
3855,
27,
21,
287,
12968,
2473,
1940,
5759,
1123,
17,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.