PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
30k
⌀ | Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,627,958 | 07/24/2012 09:30:26 | 827,306 | 07/03/2011 22:14:00 | 206 | 1 | How i can position on WebView on the place (html tag in the page) | I have WebView control. How I can set display position on HTML tag.
Is it possible?
for example: on the center of my content I have tag with id "see_here". How can I set display on this element? | android | android-layout | android-widget | null | null | null | open | How i can position on WebView on the place (html tag in the page)
===
I have WebView control. How I can set display position on HTML tag.
Is it possible?
for example: on the center of my content I have tag with id "see_here". How can I set display on this element? | 0 |
11,627,959 | 07/24/2012 09:30:27 | 187,650 | 10/10/2009 13:32:23 | 1,109 | 48 | Entity Framework data updates in a multi-user environment with central database | Let me explain the title.
I'm using Entity Framework Code First in an application **(TestApp)**.
For debugging purposes the *TestApp* connects to an SQLExpress database (central database server).
To keep things simple here, the database contains one table "Products" and the TestApp shows all "Products" from the database in a datagrid and TestApp can add/delete a "Product" or modify the ProductName.
public class Product {
public int ProductId { get; set; }
public string ProductName { get; set; }
}
public DbSet<Product> Products { get; set; }
I have for example 3 pc's where TestApp is installed and running (I'll call them Client_X). If I add a new "Product" via Client_1, than this is not directly visible in the TestApp on Client_2 and Client_3. Only when Client_2 and Client_3 fetch all the data again (manual refresh) than I see the newly added record.
What I want to know:
How can I be aware of changes in the database via EF Code First?
How would Client_2 and Client_3 get their datagrid automatically updated because a new item was added or removed?
I'm not sure if it is asked too much but a simple sample project or simple code to demonstrate this would be useful.
*FYI:
I'm fairly new to EF Code First.
(I'm using .NET 4.0 and EF Code First 4.3.1)*
Thanks in advance.
**Scheme:**
Client_3<
\
\
\
\
\>
Client_1 <---> [Central Database] <----> Client_2 | c# | entity-framework | multi-user | null | null | null | open | Entity Framework data updates in a multi-user environment with central database
===
Let me explain the title.
I'm using Entity Framework Code First in an application **(TestApp)**.
For debugging purposes the *TestApp* connects to an SQLExpress database (central database server).
To keep things simple here, the database contains one table "Products" and the TestApp shows all "Products" from the database in a datagrid and TestApp can add/delete a "Product" or modify the ProductName.
public class Product {
public int ProductId { get; set; }
public string ProductName { get; set; }
}
public DbSet<Product> Products { get; set; }
I have for example 3 pc's where TestApp is installed and running (I'll call them Client_X). If I add a new "Product" via Client_1, than this is not directly visible in the TestApp on Client_2 and Client_3. Only when Client_2 and Client_3 fetch all the data again (manual refresh) than I see the newly added record.
What I want to know:
How can I be aware of changes in the database via EF Code First?
How would Client_2 and Client_3 get their datagrid automatically updated because a new item was added or removed?
I'm not sure if it is asked too much but a simple sample project or simple code to demonstrate this would be useful.
*FYI:
I'm fairly new to EF Code First.
(I'm using .NET 4.0 and EF Code First 4.3.1)*
Thanks in advance.
**Scheme:**
Client_3<
\
\
\
\
\>
Client_1 <---> [Central Database] <----> Client_2 | 0 |
11,627,963 | 07/24/2012 09:30:42 | 1,434,509 | 06/04/2012 06:25:35 | 3 | 0 | Use if else in magento homepage content | I am trying to display a grid view with sale items shown on the homepage filtered by category.
I tried to put php if/else block in the homepage content in CMS section of admin, but it doesn't work. Any PHP code in the CMS is being commented automatically!
Is there any other way to filter homepage sale/featured products by category? I am using Magento 1.7.x
I have added the following code into the homepage which works:
{{block type="catalog/product_special" template="catalog/product/list1.phtml"}}
I just want to filter result of above code using categories when the user clicks on a category link on the homepage itself (not on the main menu)
Thanks
Anyone please? | magento | if-statement | customization | homepage | null | null | open | Use if else in magento homepage content
===
I am trying to display a grid view with sale items shown on the homepage filtered by category.
I tried to put php if/else block in the homepage content in CMS section of admin, but it doesn't work. Any PHP code in the CMS is being commented automatically!
Is there any other way to filter homepage sale/featured products by category? I am using Magento 1.7.x
I have added the following code into the homepage which works:
{{block type="catalog/product_special" template="catalog/product/list1.phtml"}}
I just want to filter result of above code using categories when the user clicks on a category link on the homepage itself (not on the main menu)
Thanks
Anyone please? | 0 |
11,627,964 | 07/24/2012 09:30:42 | 879,766 | 08/05/2011 02:41:17 | 77 | 0 | PHP json encode and decode | I'm new to json. I have existing json data in a file. here it looks like:
{
"qwqw":{
"id":3,
"item1":{
"id":15,
"price":31.85
},
"item2":{
"id":17,
"price":26
},
"item3":{
"id":16,
"price":57.85
}
}
}
I can get this value using json_decode. I will add another entry using this code.
$data = json_decode( file_get_contents('test.ini'), true );
$data[] = array(
'id'=>4,
'item1'=>array(
'id'=>15,
'price'=>11
),
'item2'=>array(
'id'=>17,
'price'=>12
),
'item3'=>array(
'id'=>16,
'price'=>13.50
)
);
file_put_contents('test.ini', json_encode($data) );
This works properply. When I decoded it again. this how it looks.
{
"qwqw":{
"id":3,
"item1":{
"id":15,
"price":31.85
},
"item2":{
"id":17,
"price":26
},
"item3":{
"id":16,
"price":57.85
}
},
"0":{
"id":3,
"item1":{
"id":15,
"price":11
},
"item2":{
"id":17,
"price":12
},
"item3":{
"id":16,
"price":13.5
}
}
}
My problem is, can I change the value "0" ? to a string.
anyone who can help ? | php | json | null | null | null | null | open | PHP json encode and decode
===
I'm new to json. I have existing json data in a file. here it looks like:
{
"qwqw":{
"id":3,
"item1":{
"id":15,
"price":31.85
},
"item2":{
"id":17,
"price":26
},
"item3":{
"id":16,
"price":57.85
}
}
}
I can get this value using json_decode. I will add another entry using this code.
$data = json_decode( file_get_contents('test.ini'), true );
$data[] = array(
'id'=>4,
'item1'=>array(
'id'=>15,
'price'=>11
),
'item2'=>array(
'id'=>17,
'price'=>12
),
'item3'=>array(
'id'=>16,
'price'=>13.50
)
);
file_put_contents('test.ini', json_encode($data) );
This works properply. When I decoded it again. this how it looks.
{
"qwqw":{
"id":3,
"item1":{
"id":15,
"price":31.85
},
"item2":{
"id":17,
"price":26
},
"item3":{
"id":16,
"price":57.85
}
},
"0":{
"id":3,
"item1":{
"id":15,
"price":11
},
"item2":{
"id":17,
"price":12
},
"item3":{
"id":16,
"price":13.5
}
}
}
My problem is, can I change the value "0" ? to a string.
anyone who can help ? | 0 |
11,627,250 | 07/24/2012 08:45:07 | 1,254,579 | 03/07/2012 11:45:22 | 1 | 1 | SSIS how to redirect the rows in OLEDB Destination when the fast load option is turned on and maximum insert commit size set to zero |
I am using a Fast load enabled OLEDB destination.In the error output there are 3 options Fail component,Ignore failure and Redirect.If I chose the Redirect It shows Fast load option enabled OLEDB can not redirect.Is there any alternative to handle the error going to happen with these type of Oledb destination(oledb with fast load option). | sql | sql-server | ssis | ssis-data-transformations | null | null | open | SSIS how to redirect the rows in OLEDB Destination when the fast load option is turned on and maximum insert commit size set to zero
===
I am using a Fast load enabled OLEDB destination.In the error output there are 3 options Fail component,Ignore failure and Redirect.If I chose the Redirect It shows Fast load option enabled OLEDB can not redirect.Is there any alternative to handle the error going to happen with these type of Oledb destination(oledb with fast load option). | 0 |
11,226,889 | 06/27/2012 13:04:37 | 453,271 | 09/20/2010 22:26:00 | 5,310 | 279 | how to build a static library properly? | I use log4cxx logging library. I need to link with its static version to avoid additional binary dependencies. I use it in my dynamic library. Default build of log4cxx produces static library but I cannot link with it because it was compiled w/o -fPIC flag. So I changed log4cxx bulding as:
CPPFLAGS="-fPIC -static" ./configure
make
As a result I received a `liblog4cxx.a` that I can link with my .so library. Linking was done by Cmake, something like:
target_link_libraries(my_dynamic_lib log4cxx)
link_directories(relative_path_to_dir_where_liblog4cxx.a_lives)
Everything looked fine until runtime. I cannot load my_dynamic_lib.so because of `undefined symbol "logger"`
Please explain me what's wrong and how to resolve this problem.
thanks | c++ | c | linker | make | cmake | null | open | how to build a static library properly?
===
I use log4cxx logging library. I need to link with its static version to avoid additional binary dependencies. I use it in my dynamic library. Default build of log4cxx produces static library but I cannot link with it because it was compiled w/o -fPIC flag. So I changed log4cxx bulding as:
CPPFLAGS="-fPIC -static" ./configure
make
As a result I received a `liblog4cxx.a` that I can link with my .so library. Linking was done by Cmake, something like:
target_link_libraries(my_dynamic_lib log4cxx)
link_directories(relative_path_to_dir_where_liblog4cxx.a_lives)
Everything looked fine until runtime. I cannot load my_dynamic_lib.so because of `undefined symbol "logger"`
Please explain me what's wrong and how to resolve this problem.
thanks | 0 |
11,226,892 | 06/27/2012 13:04:45 | 648,371 | 03/07/2011 15:22:45 | 1,833 | 19 | Why does it take UIDocument 40 seconds to load? | I'm trying to load an UIDocument for a quick preview of its contents (which are wrapped up in a file wrapper). I call this code:
-(void)previewLoadDocAtURL:(NSURL*)fileURL {
NSLog(@"... loading for preview: %@", [fileURL lastPathComponent]);
FRNBDocument *doc = [[FRNBDocument alloc] initWithFileURL:fileURL];
[doc openWithCompletionHandler:^(BOOL success) {
NSLog(@"... loaded for preview: %@", [doc.fileURL lastPathComponent]);
The problem is that it sometimes takes 40 seconds until I get the log and at other times it only takes a couple of milli seconds. Here are the 40 seconds:
2012-06-27 13:58:31.612 Meernotes[4444:11303] ... loading for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
2012-06-27 13:59:11.870 Meernotes[4444:11303] ... loaded for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
Here are the couple of milliseconds:
2012-06-27 14:02:50.829 Meernotes[4510:11303] ... loading for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
2012-06-27 14:02:50.896 Meernotes[4510:11303] ... loaded for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
Why is this so and how can I prevent that it takes 40 seconds? | iphone | objective-c | icloud | uidocument | null | null | open | Why does it take UIDocument 40 seconds to load?
===
I'm trying to load an UIDocument for a quick preview of its contents (which are wrapped up in a file wrapper). I call this code:
-(void)previewLoadDocAtURL:(NSURL*)fileURL {
NSLog(@"... loading for preview: %@", [fileURL lastPathComponent]);
FRNBDocument *doc = [[FRNBDocument alloc] initWithFileURL:fileURL];
[doc openWithCompletionHandler:^(BOOL success) {
NSLog(@"... loaded for preview: %@", [doc.fileURL lastPathComponent]);
The problem is that it sometimes takes 40 seconds until I get the log and at other times it only takes a couple of milli seconds. Here are the 40 seconds:
2012-06-27 13:58:31.612 Meernotes[4444:11303] ... loading for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
2012-06-27 13:59:11.870 Meernotes[4444:11303] ... loaded for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
Here are the couple of milliseconds:
2012-06-27 14:02:50.829 Meernotes[4510:11303] ... loading for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
2012-06-27 14:02:50.896 Meernotes[4510:11303] ... loaded for preview: NOTEBOOK-C759AD40-E6DE-4241-9E5A-22C458BEF8DA.MBOOK
Why is this so and how can I prevent that it takes 40 seconds? | 0 |
11,226,894 | 06/27/2012 13:04:47 | 1,104,823 | 12/18/2011 19:15:58 | 312 | 3 | Sql Server Reporting Services Must Declare the scalar variable @param | I have a Sql Server reporting services project. I have a dataset query called Total where I select certain data based on a parameter:
select ...
from ...
group by ...
having prop_id = @PropID
Now to populate a list of multiple values for this parameter, I have a dataset query called AllProps that selects all possible prop_id's:
select prop_id from proposal
order by prop_id
Now in the Report Data Pane I select the parameter properties from @PropID and fill out the forms as follows:
Under General I have,
Name: PropID
Data type: Text
(I select "Allow multiple values")
Under Available values I have,
Get values from a query
Dataset: AllProps
Value Fields: prop_id
label field: prop_id
Under Default Values I have,
Get values from a query
Dataset: AllProps
Valuefield: prop_id
When I click the preview tab to see my report I get the following error:
An error occurred during local report processing. An error has occurred during report processing. Query execution failed for dataset 'Total'.
MUST DECLARE THE SCALAR VARIABLE '@PropID'.
Where did I go wrong? What is scalar variable in SSRS and how is it properly used?
Thanks
| sql-server | reporting-services | parameters | null | null | null | open | Sql Server Reporting Services Must Declare the scalar variable @param
===
I have a Sql Server reporting services project. I have a dataset query called Total where I select certain data based on a parameter:
select ...
from ...
group by ...
having prop_id = @PropID
Now to populate a list of multiple values for this parameter, I have a dataset query called AllProps that selects all possible prop_id's:
select prop_id from proposal
order by prop_id
Now in the Report Data Pane I select the parameter properties from @PropID and fill out the forms as follows:
Under General I have,
Name: PropID
Data type: Text
(I select "Allow multiple values")
Under Available values I have,
Get values from a query
Dataset: AllProps
Value Fields: prop_id
label field: prop_id
Under Default Values I have,
Get values from a query
Dataset: AllProps
Valuefield: prop_id
When I click the preview tab to see my report I get the following error:
An error occurred during local report processing. An error has occurred during report processing. Query execution failed for dataset 'Total'.
MUST DECLARE THE SCALAR VARIABLE '@PropID'.
Where did I go wrong? What is scalar variable in SSRS and how is it properly used?
Thanks
| 0 |
11,226,902 | 06/27/2012 13:05:11 | 785,534 | 06/06/2011 07:43:39 | 43 | 8 | Magento Javascript merge - why does it break in some cases? | Okay I've been doing JS merges for some time now and still can't figure out the logic behind making a successful merge. It comes down to repositioning libraries upwards and downwars on merge list. Sometimes jquery must be on top, sometimes it doesn't. Sometimes fancybox needs to be added as addJs, sometimes as addItem.
So, what is in your experience causing JS libraries to break when you use Magento's merge JS? Are there any rules for sucessful merge?
UPDATE: Just now in my local.xml I moved from
<action method="addItem"><type>skin_js</type><name>js/magiczoomplus.js</name></action>
to
<action method="addJs"><script>jquery/magiczoomplus.js</script></action>
and that solved the magiczoomplus error I was getting on the page. How so?
I'm trying to understand this problem so I can better tackle it in the future | magento | null | null | null | null | null | open | Magento Javascript merge - why does it break in some cases?
===
Okay I've been doing JS merges for some time now and still can't figure out the logic behind making a successful merge. It comes down to repositioning libraries upwards and downwars on merge list. Sometimes jquery must be on top, sometimes it doesn't. Sometimes fancybox needs to be added as addJs, sometimes as addItem.
So, what is in your experience causing JS libraries to break when you use Magento's merge JS? Are there any rules for sucessful merge?
UPDATE: Just now in my local.xml I moved from
<action method="addItem"><type>skin_js</type><name>js/magiczoomplus.js</name></action>
to
<action method="addJs"><script>jquery/magiczoomplus.js</script></action>
and that solved the magiczoomplus error I was getting on the page. How so?
I'm trying to understand this problem so I can better tackle it in the future | 0 |
11,226,903 | 06/27/2012 13:05:14 | 1,469,168 | 06/20/2012 12:04:37 | 42 | 3 | Constructor ArrayAdapter onclick issue | I need to display image and text in my listview when i click a button search but it giving me an error in my `setListAdapter(new MobileArrayAdapter(this, PNames,PImages));`.. I have two classes.
When I display onformLoad it working but, now I need to display it using a buttton, here my two classess :
B_KZN.setOnClickListener(new View .OnClickListener() {
@Override
public void onClick(View Kv) {
// TODO Auto-generated method stub
JSONObject json = JSONfunctions.getJSONfromURL("http://10.0.2.2/php/p.php");
try{
JSONArray earthquakes = json.getJSONArray("SKZN");
for(int i=0;i<earthquakes.length();i++){
JSONObject e = earthquakes.getJSONObject(i);
String BookName = e.getString("P_City");
PNames.add(BookName);
String BookImg = e.getString("Pname");
PImages.add(BookImg);
}
}catch(JSONException e){
Log.e("log_tag", "Error parsing data "+e.toString());
}
setListAdapter(new MobileArrayAdapter(this, PNames,PImages));
And my second Class, :
public class MobileArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] myBookNamelist = null;
private ArrayList<String> MyP = new ArrayList<String>();
private ArrayList<String> myPurl = new ArrayList<String>();
public MobileArrayAdapter(Context context,ArrayList<String> Bname,ArrayList<String> BUrl) {
super(context, R.layout.list_mobile, Bname);
this.context = context;
this.MyP = Bname;
this.myPurl = BUrl;
}
here my error : `The constructor MobileArrayAdapter(new View.OnClickListener(){}, ArrayList<String>, ArrayList<String>) is undefined`...**it showing me red line.**
| android | listview | null | null | null | null | open | Constructor ArrayAdapter onclick issue
===
I need to display image and text in my listview when i click a button search but it giving me an error in my `setListAdapter(new MobileArrayAdapter(this, PNames,PImages));`.. I have two classes.
When I display onformLoad it working but, now I need to display it using a buttton, here my two classess :
B_KZN.setOnClickListener(new View .OnClickListener() {
@Override
public void onClick(View Kv) {
// TODO Auto-generated method stub
JSONObject json = JSONfunctions.getJSONfromURL("http://10.0.2.2/php/p.php");
try{
JSONArray earthquakes = json.getJSONArray("SKZN");
for(int i=0;i<earthquakes.length();i++){
JSONObject e = earthquakes.getJSONObject(i);
String BookName = e.getString("P_City");
PNames.add(BookName);
String BookImg = e.getString("Pname");
PImages.add(BookImg);
}
}catch(JSONException e){
Log.e("log_tag", "Error parsing data "+e.toString());
}
setListAdapter(new MobileArrayAdapter(this, PNames,PImages));
And my second Class, :
public class MobileArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] myBookNamelist = null;
private ArrayList<String> MyP = new ArrayList<String>();
private ArrayList<String> myPurl = new ArrayList<String>();
public MobileArrayAdapter(Context context,ArrayList<String> Bname,ArrayList<String> BUrl) {
super(context, R.layout.list_mobile, Bname);
this.context = context;
this.MyP = Bname;
this.myPurl = BUrl;
}
here my error : `The constructor MobileArrayAdapter(new View.OnClickListener(){}, ArrayList<String>, ArrayList<String>) is undefined`...**it showing me red line.**
| 0 |
11,226,906 | 06/27/2012 13:05:21 | 1,395,782 | 05/15/2012 09:30:54 | 46 | 1 | How to differentiae between the Visitor and User of the system? | I am a new ASP.NET developer and I did two projects on it. Right now, I am developing a simple intranet training development web-based application where I have three different roles: Admin, Contribute and User. The difference between all of them is that a new menu tab will be appeared in case of Admin and Contribute. I developed this by making the menu bar as a User Control and for role I created property for showing the tab particular for each role.
**Code of the User Control (Menu Tab)(.ascx file):**
<ul class="menu" runat="server" >
<li><a href="Default.aspx">Home</a></li>
<li><a href="Services.aspx">Services</a>
<ul>
<li><a href="Quiz.aspx">Quiz Engine</a></li>
<li><a href="Suggestion.aspx">Safety Suggestions Box</a></li>
<li><a href="#">PMOD Saftey Management System</a></li>
</ul>
</li>
<li><a href="BeSafe.aspx">Be Safe !</a>
<ul>
<li><a href="Newsletter.aspx">Newsletter</a></li>
<li><a href="Library.aspx">PSSP Library</a></li>
<li><a href="Links.aspx">Useful Links</a></li>
</ul>
</li>
<li><a href="UserProfile.aspx">Profile</a></li>
<li><a href="About.aspx">About</a></li>
<li><a href="Contact.aspx">Contact Us</a></li>
<li><a href="Faq.aspx">FAQ</a></li>
<li><a href="Help.aspx">Help</a></li>
<li id="menuItem1ToHide" runat="server"><a href="Admin.aspx">Admin</a>
</li>
<li id="menuItem2ToHide" runat="server"><a href="Contribute.aspx">Settings</a>
<ul>
<li><a href="KPIReport.aspx">PMOD Safety Training Detailed Matrix</a></li>
<li><a href="UpdateKPIReport.aspx">Update Safety Training Matrix</a></li>
</ul>
</li>
<li id="menuItem3ToHide" runat="server"><a href="Contribute.aspx">Management</a>
<ul>
<li><a href="Dashboard.aspx">Department Dashboard</a></li>
<li><a href="KPIReport.aspx">PMOD Safety Training Detailed Matrix</a></li>
</ul>
</li>
</ul>
The system is only accessible by my division employees. Now, they asked me to make it accessible to everybody without showing them the real functionality that contains the division data. I am confused how I will develop this, because it seems that my way that I used for the Admin and Contribute role does not work here. Because the visitor will be able to view most of the pages like any employee in my division with User role.
**How to differentiate between both of them?** | c# | asp.net | usercontrols | null | null | null | open | How to differentiae between the Visitor and User of the system?
===
I am a new ASP.NET developer and I did two projects on it. Right now, I am developing a simple intranet training development web-based application where I have three different roles: Admin, Contribute and User. The difference between all of them is that a new menu tab will be appeared in case of Admin and Contribute. I developed this by making the menu bar as a User Control and for role I created property for showing the tab particular for each role.
**Code of the User Control (Menu Tab)(.ascx file):**
<ul class="menu" runat="server" >
<li><a href="Default.aspx">Home</a></li>
<li><a href="Services.aspx">Services</a>
<ul>
<li><a href="Quiz.aspx">Quiz Engine</a></li>
<li><a href="Suggestion.aspx">Safety Suggestions Box</a></li>
<li><a href="#">PMOD Saftey Management System</a></li>
</ul>
</li>
<li><a href="BeSafe.aspx">Be Safe !</a>
<ul>
<li><a href="Newsletter.aspx">Newsletter</a></li>
<li><a href="Library.aspx">PSSP Library</a></li>
<li><a href="Links.aspx">Useful Links</a></li>
</ul>
</li>
<li><a href="UserProfile.aspx">Profile</a></li>
<li><a href="About.aspx">About</a></li>
<li><a href="Contact.aspx">Contact Us</a></li>
<li><a href="Faq.aspx">FAQ</a></li>
<li><a href="Help.aspx">Help</a></li>
<li id="menuItem1ToHide" runat="server"><a href="Admin.aspx">Admin</a>
</li>
<li id="menuItem2ToHide" runat="server"><a href="Contribute.aspx">Settings</a>
<ul>
<li><a href="KPIReport.aspx">PMOD Safety Training Detailed Matrix</a></li>
<li><a href="UpdateKPIReport.aspx">Update Safety Training Matrix</a></li>
</ul>
</li>
<li id="menuItem3ToHide" runat="server"><a href="Contribute.aspx">Management</a>
<ul>
<li><a href="Dashboard.aspx">Department Dashboard</a></li>
<li><a href="KPIReport.aspx">PMOD Safety Training Detailed Matrix</a></li>
</ul>
</li>
</ul>
The system is only accessible by my division employees. Now, they asked me to make it accessible to everybody without showing them the real functionality that contains the division data. I am confused how I will develop this, because it seems that my way that I used for the Admin and Contribute role does not work here. Because the visitor will be able to view most of the pages like any employee in my division with User role.
**How to differentiate between both of them?** | 0 |
11,226,909 | 06/27/2012 13:05:23 | 825,634 | 07/01/2011 23:35:33 | 1 | 0 | comparing strategies to avoid flash of unstyled content (fouc) | I need to control certain styling features according to a cookie setting and I'd be grateful for advice about how to ensure that the styling dictated by the cookie is available as the page is loaded, so that the page doesn't load first with some other style and then flash to the desired one. The site has a few hundred pages that require similar styling, which is to say that when the user chooses a style through a control I include on all of the pages, that setting needs to persist, so that it is loaded automatically for all other pages on the site until it is reset explicitly by the user (or until the cookie expires naturally). I know how to set and read the cookie, but I don't know the best strategy for ensuring that the styling is available and used when the text is first rendered.
Goals and non-goals: No jquery or other library or framework; I'm looking for a solution that is small and easy to understand and maintain. I need to support the most recent versions of all of the major browsers (IE, Firefox, Chrome, Opera, Safari on Windows; the last four on MacOS; Safari on iOS; Firefox and Chrome on Linux), but I don't care about older versions of the browsers, and I don't care much (i.e., if it happens anyway, so much the better, but I don't want to include extra code to deal with it) about degrading gracefully for users who turn off javascript.
The features I want to control include: 1) have a particular web font used to render the text of elements that have a specific @class attribute value; 2) have the text of a <button> element (and therefore the width of the button, since the texts may vary in length) set to a particular value; and 3) have a checkbox loaded as either checked or unchecked. In all cases the page needs to come up initially with these features set correctly. It can't, for example, display one text in the button briefly and then switch to another, or have the checkbox checked briefly and then uncheck it, or vice versa.
My first strategy was to set an onload handler on the <body> element to read the cookie and set the values, but that resulted in precisely the fouc that I'm trying to avoid, since the page is loaded (and rendered) before the onload handler fires. I've seen discussion of at least two other approaches. One uses document.write to create a <link> to a stylesheet in the <head> as the page is being built. The other (see, for example, http://www.thesitewizard.com/javascripts/change-style-sheets.shtml) creates a set of small stylesheets and lets the user set one at a time to be active. This second approach sets the style in an onload handler on the <body> element, and I'm not sure how it's supposed to work; doesn't this mean that the cookie gets read and the various micro-stylesheets get enabled or disabled only after the content has been loaded (and rendered with perhaps some other style)? Should the onload handler for the stylesheet selector be attached to the <head> element instead of the <body>, since the <head> is loaded first, and this would mean that the stylesheet configuration would be ready before the <body> began to load?
I'd be grateful for advice about choosing a strategy that is easy to code and maintain and that provides the functionality I need in the browsers I need to support. | javascript | cookies | dhtml | fouc | null | null | open | comparing strategies to avoid flash of unstyled content (fouc)
===
I need to control certain styling features according to a cookie setting and I'd be grateful for advice about how to ensure that the styling dictated by the cookie is available as the page is loaded, so that the page doesn't load first with some other style and then flash to the desired one. The site has a few hundred pages that require similar styling, which is to say that when the user chooses a style through a control I include on all of the pages, that setting needs to persist, so that it is loaded automatically for all other pages on the site until it is reset explicitly by the user (or until the cookie expires naturally). I know how to set and read the cookie, but I don't know the best strategy for ensuring that the styling is available and used when the text is first rendered.
Goals and non-goals: No jquery or other library or framework; I'm looking for a solution that is small and easy to understand and maintain. I need to support the most recent versions of all of the major browsers (IE, Firefox, Chrome, Opera, Safari on Windows; the last four on MacOS; Safari on iOS; Firefox and Chrome on Linux), but I don't care about older versions of the browsers, and I don't care much (i.e., if it happens anyway, so much the better, but I don't want to include extra code to deal with it) about degrading gracefully for users who turn off javascript.
The features I want to control include: 1) have a particular web font used to render the text of elements that have a specific @class attribute value; 2) have the text of a <button> element (and therefore the width of the button, since the texts may vary in length) set to a particular value; and 3) have a checkbox loaded as either checked or unchecked. In all cases the page needs to come up initially with these features set correctly. It can't, for example, display one text in the button briefly and then switch to another, or have the checkbox checked briefly and then uncheck it, or vice versa.
My first strategy was to set an onload handler on the <body> element to read the cookie and set the values, but that resulted in precisely the fouc that I'm trying to avoid, since the page is loaded (and rendered) before the onload handler fires. I've seen discussion of at least two other approaches. One uses document.write to create a <link> to a stylesheet in the <head> as the page is being built. The other (see, for example, http://www.thesitewizard.com/javascripts/change-style-sheets.shtml) creates a set of small stylesheets and lets the user set one at a time to be active. This second approach sets the style in an onload handler on the <body> element, and I'm not sure how it's supposed to work; doesn't this mean that the cookie gets read and the various micro-stylesheets get enabled or disabled only after the content has been loaded (and rendered with perhaps some other style)? Should the onload handler for the stylesheet selector be attached to the <head> element instead of the <body>, since the <head> is loaded first, and this would mean that the stylesheet configuration would be ready before the <body> began to load?
I'd be grateful for advice about choosing a strategy that is easy to code and maintain and that provides the functionality I need in the browsers I need to support. | 0 |
11,298,313 | 07/02/2012 17:25:41 | 1,496,702 | 07/02/2012 17:12:07 | 1 | 0 | Show an Image and Text in a ListView | I'm developing an App, that shows a ListView with 30 items.
In each row, there should be a text and an Image.
I searches for different tutorials, but unfortunately all don't work for me.
So I'm asking you to have a short look to my code and tell me what's wrong in there, because when I start the app, the ListView is empty.
mainActivity.java:
setContentView(R.layout.auswertung);
ListView list = (ListView) findViewById(R.id.listView1);
list.setAdapter(new MyListAdapter(this, fragen));
MyListAdapter.java
import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MyListAdapter extends ArrayAdapter<Frage>{
private final Context context;
private ArrayList<Frage> fragen;
public MyListAdapter(Context context, ArrayList<Frage> f) {
super(context, R.layout.reihe);
this.context = context;
fragen = f;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
if(rowView == null)
{
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.reihe, parent, false);
}
TextView textView = (TextView) rowView.findViewById(R.id.textView4);
ImageView imageView = (ImageView) rowView.findViewById(R.id.img1);
textView.setText("Frage " + (position+1));
if (fragen.get(position).getRichtig()==true)
{
imageView.setImageResource(R.drawable.richtig);
}
else
{
imageView.setImageResource(R.drawable.falsch);
}
return rowView;
}
}
auswertung.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.96"
android:background="@drawable/hintergrund"
android:orientation="vertical" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="19dp"
android:text="Auswertung"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="460dp"
android:layout_marginTop="60dp">
</ListView>
</RelativeLayout>
reihe.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/textView4"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="5"
android:textSize="16dp"
android:textColor="#000000" />
<ImageView
android:id="@+id/img1"
android:layout_width="25dp"
android:layout_height="25dp" />
</LinearLayout>
As you see, I have a background image, and would also ask you, how can I make the background of the ListView invisible, so that I can see my background behind the text and the Image? | java | android | xml | null | null | null | open | Show an Image and Text in a ListView
===
I'm developing an App, that shows a ListView with 30 items.
In each row, there should be a text and an Image.
I searches for different tutorials, but unfortunately all don't work for me.
So I'm asking you to have a short look to my code and tell me what's wrong in there, because when I start the app, the ListView is empty.
mainActivity.java:
setContentView(R.layout.auswertung);
ListView list = (ListView) findViewById(R.id.listView1);
list.setAdapter(new MyListAdapter(this, fragen));
MyListAdapter.java
import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MyListAdapter extends ArrayAdapter<Frage>{
private final Context context;
private ArrayList<Frage> fragen;
public MyListAdapter(Context context, ArrayList<Frage> f) {
super(context, R.layout.reihe);
this.context = context;
fragen = f;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
if(rowView == null)
{
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.reihe, parent, false);
}
TextView textView = (TextView) rowView.findViewById(R.id.textView4);
ImageView imageView = (ImageView) rowView.findViewById(R.id.img1);
textView.setText("Frage " + (position+1));
if (fragen.get(position).getRichtig()==true)
{
imageView.setImageResource(R.drawable.richtig);
}
else
{
imageView.setImageResource(R.drawable.falsch);
}
return rowView;
}
}
auswertung.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.96"
android:background="@drawable/hintergrund"
android:orientation="vertical" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="19dp"
android:text="Auswertung"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="460dp"
android:layout_marginTop="60dp">
</ListView>
</RelativeLayout>
reihe.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/textView4"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="5"
android:textSize="16dp"
android:textColor="#000000" />
<ImageView
android:id="@+id/img1"
android:layout_width="25dp"
android:layout_height="25dp" />
</LinearLayout>
As you see, I have a background image, and would also ask you, how can I make the background of the ListView invisible, so that I can see my background behind the text and the Image? | 0 |
11,298,314 | 07/02/2012 17:25:41 | 1,440,061 | 06/06/2012 14:48:10 | 67 | 0 | Perl search for specific subdirectory then process | So for the program I am writing, what I would like for it to do is search through all of the subdirectories within a directory. If the subdirectory name contains a word, let's say "foo", then the program will open this subdirectory and perform a function on the files within the subdirectory. Can anybody give me some help on how to go about this? it also needs to be recursive. Thanks in advance | perl | subdirectory | null | null | null | null | open | Perl search for specific subdirectory then process
===
So for the program I am writing, what I would like for it to do is search through all of the subdirectories within a directory. If the subdirectory name contains a word, let's say "foo", then the program will open this subdirectory and perform a function on the files within the subdirectory. Can anybody give me some help on how to go about this? it also needs to be recursive. Thanks in advance | 0 |
11,296,995 | 07/02/2012 15:47:51 | 1,496,379 | 07/02/2012 14:52:03 | 1 | 0 | Splitting a sequence of unknown length into a certain number of sets in R | I have a sequence which varies in length e.g. something like:
items <- 1:4
I want to split it into every possible combination of `n` number of sets. So say `n` is two, I want to return:
Set A Set B
----- -----
1 2 3 4
1 2 3 4
1 2 3 4
1 3 2 4
etc. The arrangement within sets doesn't matter i.e. the set {`1`, `2`, `3`} is the same as {`2`, `1`, `3`}. Sets cannot be empty.
Best I could come up with (using `permn` from the package `combinat`) is:
n <- 2
r <- 1:length(items)
arrangements <- NULL
for (i in 1:(n-1)) {
A <- r[(1:i)]
B <- r[-(1:i)]
arrangements <- c(arrangements, apply(do.call(rbind, permn(1:length(items))), 1, function(z) list(z[A], z[B])))
}
Which is fairly useless because it returns sets that are equal i.e. {`1`, `2`, `3`} and {`2`, `1`, `3`} and isn't flexible enough to handle different values of `n`. Anyone have any ideas how I can do this? Thanks. | r | null | null | null | null | null | open | Splitting a sequence of unknown length into a certain number of sets in R
===
I have a sequence which varies in length e.g. something like:
items <- 1:4
I want to split it into every possible combination of `n` number of sets. So say `n` is two, I want to return:
Set A Set B
----- -----
1 2 3 4
1 2 3 4
1 2 3 4
1 3 2 4
etc. The arrangement within sets doesn't matter i.e. the set {`1`, `2`, `3`} is the same as {`2`, `1`, `3`}. Sets cannot be empty.
Best I could come up with (using `permn` from the package `combinat`) is:
n <- 2
r <- 1:length(items)
arrangements <- NULL
for (i in 1:(n-1)) {
A <- r[(1:i)]
B <- r[-(1:i)]
arrangements <- c(arrangements, apply(do.call(rbind, permn(1:length(items))), 1, function(z) list(z[A], z[B])))
}
Which is fairly useless because it returns sets that are equal i.e. {`1`, `2`, `3`} and {`2`, `1`, `3`} and isn't flexible enough to handle different values of `n`. Anyone have any ideas how I can do this? Thanks. | 0 |
11,298,401 | 07/02/2012 17:31:40 | 1,231,509 | 02/24/2012 19:30:15 | 130 | 0 | Google app engine 100 URLMap entries limitation | I have been using google app engine to build my website, and met a problem about the maximum number of URLMap (I had 101 URLs, but the limit is 100). Here is the error message:
Fatal error when loading application configuration:
Invalid object:
Found more than 100 URLMap entries in application configuration
in "C:\Users\th\Dropbox\AppPest\app.yaml", line 269, column 28
I tried to change the setting `MAX_URL_MAPS = 1000` in the file appinfo.py, but it did not work. Can anyone give me some suggestions?
Another question is that some of my URLs are similar, like a_input.html, b_input.html, c_input.html. Is there a way to simplify it in order to reduce the number of URLs?
| google-app-engine | yaml | null | null | null | null | open | Google app engine 100 URLMap entries limitation
===
I have been using google app engine to build my website, and met a problem about the maximum number of URLMap (I had 101 URLs, but the limit is 100). Here is the error message:
Fatal error when loading application configuration:
Invalid object:
Found more than 100 URLMap entries in application configuration
in "C:\Users\th\Dropbox\AppPest\app.yaml", line 269, column 28
I tried to change the setting `MAX_URL_MAPS = 1000` in the file appinfo.py, but it did not work. Can anyone give me some suggestions?
Another question is that some of my URLs are similar, like a_input.html, b_input.html, c_input.html. Is there a way to simplify it in order to reduce the number of URLs?
| 0 |
11,298,404 | 07/02/2012 17:31:47 | 1,058,393 | 11/21/2011 18:42:05 | 318 | 4 | The connection was reset ASP.NET | I have some code that pulls data from SQL DB, then loops through the records to generate a string, which will eventually be written to a text file.
The code runs fine on my local, from VS, but on the live server, after about a minute and half, I get "No Data Received" error (chrome). The code stops in middle of looping through the DataTable. Hosting support said "The connection was reset" error was thrown.
I"m not sure if this is a timeout issue or what. I've set the executionTimeout in my web.config (with debug = false) and it didn't seem to help. I also checked the Server.ScriptTimeout property, and it does match the executionTimeout value set in the web.config.
Additionally, a timeout would normally give "Page not available" message.
Any suggestions are appreciated.
| c# | asp.net | timeout | null | null | null | open | The connection was reset ASP.NET
===
I have some code that pulls data from SQL DB, then loops through the records to generate a string, which will eventually be written to a text file.
The code runs fine on my local, from VS, but on the live server, after about a minute and half, I get "No Data Received" error (chrome). The code stops in middle of looping through the DataTable. Hosting support said "The connection was reset" error was thrown.
I"m not sure if this is a timeout issue or what. I've set the executionTimeout in my web.config (with debug = false) and it didn't seem to help. I also checked the Server.ScriptTimeout property, and it does match the executionTimeout value set in the web.config.
Additionally, a timeout would normally give "Page not available" message.
Any suggestions are appreciated.
| 0 |
11,298,406 | 07/02/2012 17:31:53 | 1,496,682 | 07/02/2012 17:01:55 | 1 | 0 | ‘layout’ was not declared+QT | My name in Vahid, i'm beginning qt programming some days age.
I have a problem with layout, I write this example, save it in a .cpp file:
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *window = new QWidget;
window -> setWindowTitle("Enter your age please:");
QSpinBox *spinBox = new QSpinBox;
layout -> addWidget(spinBox);
window -> show();
return app.exec();
}
and compile with these commands:
qmake -project
qmake
make
bug get this error:
age.cpp: In function ‘int main(int, char**)’:
age.cpp:13:3: error: ‘layout’ was not declared in this scope
make: *** [age.o] Error 1
i search in internet about this error but i could not find any solution about that.
Who can help me? :( | c++ | qt | layout | qmake | null | 07/03/2012 11:13:21 | too localized | ‘layout’ was not declared+QT
===
My name in Vahid, i'm beginning qt programming some days age.
I have a problem with layout, I write this example, save it in a .cpp file:
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *window = new QWidget;
window -> setWindowTitle("Enter your age please:");
QSpinBox *spinBox = new QSpinBox;
layout -> addWidget(spinBox);
window -> show();
return app.exec();
}
and compile with these commands:
qmake -project
qmake
make
bug get this error:
age.cpp: In function ‘int main(int, char**)’:
age.cpp:13:3: error: ‘layout’ was not declared in this scope
make: *** [age.o] Error 1
i search in internet about this error but i could not find any solution about that.
Who can help me? :( | 3 |
11,298,407 | 07/02/2012 17:31:56 | 867,674 | 07/28/2011 14:14:42 | 82 | 2 | Error 324 (Chrome) when sending SMTP Mail using PEAR | My page continues to error out (Error 324 - Chrome) when attempting to send e-mails with attachments using PHP's PEAR Mail extension. Although the page error's out - I do receive one of the approximately 800 e-mails. Here's what I'm working with:
function email_statements($type) {
switch($type) {
// Determine the type of statement to be e-mailed
case 'monthly':
// Array holding all unique AP e-mail addresses
$ap_email_addresses = array();
include('../path/to/db/connection/params.php');
// Grab the unique AP e-mail address set to receive statements
$stmt = $mysqli->prepare("SELECT email FROM statements GROUP BY email ORDER BY email ASC");
$stmt->execute();
$stmt->bind_result($ap_email_address);
// Add unique e-mail address to AP E-mail Addresses array
while($row = $stmt->fetch()) $ap_email_addresses[] = $ap_email_address;
$stmt->close();
$mysqli->close();
// Verify we grabbed the e-mail addresses
if(count($ap_email_addresses) == 0) {
// Exit and return error code if unable to grab e-mail addresses
$return_message = 1;
exit;
}
// E-mail addresses grabbed - proceed
else {
// PDF formatted date
date_default_timezone_set('America/New_York');
$formatted_date = date('m_d_Y');
// Now we have the unique e-mail addresses - associate those with the account numbers
include('../path/to/db/connection/params.php');
foreach($ap_email_addresses as $email_address) {
$file_names = array();
$stmt = $mysqli->prepare("SELECT customer_number FROM statements WHERE email = ?");
$stmt->bind_param("s", $email_address);
$stmt->execute();
$stmt->bind_result($ap_account_number);
// Constructs the name of the statement (PDF) file to be sent
while($output = $stmt->fetch()) $file_names[] = $ap_account_number . '_' . $formatted_date . '.pdf';
// Send e-mails
include('Mail.php');
include('Mail/mime.php');
// Include SMTP authentication parameters
include('../path/to/email/info.php');
// Set the e-mail recipients
$recipients = '[email protected]';
// Set the e-mail subject
$subject = 'Monthly Account Statement';
// Create the e-mail body
$html =
'<html>
<body>
<p>Test E-mail</p>
</body>
</html>';
// Construct the message headers
$headers = array(
'From' => $from,
'Subject' => $subject,
'Content-Type' => 'text/html; charset=UTF-8',
'MIME-Version' => '1.0'
);
$mimeparams = array();
$mimeparams['text_encoding'] = '8bit';
$mimeparams['text_charset'] = 'UTF-8';
$mimeparams['html_charset'] = 'UTF-8';
$mimeparams['head_charset'] = 'UTF-8';
// Create a new instance
$mime = new Mail_mime();
// Specify the e-mail body
$mime->setHTMLBody($html);
// Attach the statements (PDF)
foreach($file_names as $attached_file) {
$file = '../path/to/the/pdf/file/' . $attached_file;
$file_name = $attached_file;
$content_type = "Application/pdf";
$mime->addAttachment ($file, $content_type, $file_name, 1);
}
// Create the body
$body = $mime->get($mimeparams);
// Add the headers
$headers = $mime->headers($headers);
// Create SMTP connect array to be passed
$smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
// Send the message
$mail = $smtp->send($recipients, $headers, $body);
if(PEAR::isError($mail)) echo 'Error';
else echo 'Sent';
// Close this account and cycle through the rest
$stmt->close();
}
$mysqli->close();
}
break;
}
}
Now I thought maybe I wasn't giving the script enough time to execute - so I set it ridiculously high `set_time_limit(99999999)` to ensure it had plenty of time, although it normally times out within 10-15 seconds. So basically it works like this, I have an internal DB that stores customer account numbers and e-mail addresses. Accounts can have the same e-mail address (It's sent to their company's AP department) - aka one e-mail address receives statements for multiple branches. From their each statement is already constructed with the format being ACCOUNTNUMBER_MM_DD_YYYY.pdf.
So I'm simply trying to have a short message in the body, and attach the monthly statements. Again, not sure why it's failing, and even though the script halts, I do receive ONE of the e-mails (I'm sending them all to myself at the moment just to test). Can anyone see where I may have an issue? | php | email | pear | attachments | null | null | open | Error 324 (Chrome) when sending SMTP Mail using PEAR
===
My page continues to error out (Error 324 - Chrome) when attempting to send e-mails with attachments using PHP's PEAR Mail extension. Although the page error's out - I do receive one of the approximately 800 e-mails. Here's what I'm working with:
function email_statements($type) {
switch($type) {
// Determine the type of statement to be e-mailed
case 'monthly':
// Array holding all unique AP e-mail addresses
$ap_email_addresses = array();
include('../path/to/db/connection/params.php');
// Grab the unique AP e-mail address set to receive statements
$stmt = $mysqli->prepare("SELECT email FROM statements GROUP BY email ORDER BY email ASC");
$stmt->execute();
$stmt->bind_result($ap_email_address);
// Add unique e-mail address to AP E-mail Addresses array
while($row = $stmt->fetch()) $ap_email_addresses[] = $ap_email_address;
$stmt->close();
$mysqli->close();
// Verify we grabbed the e-mail addresses
if(count($ap_email_addresses) == 0) {
// Exit and return error code if unable to grab e-mail addresses
$return_message = 1;
exit;
}
// E-mail addresses grabbed - proceed
else {
// PDF formatted date
date_default_timezone_set('America/New_York');
$formatted_date = date('m_d_Y');
// Now we have the unique e-mail addresses - associate those with the account numbers
include('../path/to/db/connection/params.php');
foreach($ap_email_addresses as $email_address) {
$file_names = array();
$stmt = $mysqli->prepare("SELECT customer_number FROM statements WHERE email = ?");
$stmt->bind_param("s", $email_address);
$stmt->execute();
$stmt->bind_result($ap_account_number);
// Constructs the name of the statement (PDF) file to be sent
while($output = $stmt->fetch()) $file_names[] = $ap_account_number . '_' . $formatted_date . '.pdf';
// Send e-mails
include('Mail.php');
include('Mail/mime.php');
// Include SMTP authentication parameters
include('../path/to/email/info.php');
// Set the e-mail recipients
$recipients = '[email protected]';
// Set the e-mail subject
$subject = 'Monthly Account Statement';
// Create the e-mail body
$html =
'<html>
<body>
<p>Test E-mail</p>
</body>
</html>';
// Construct the message headers
$headers = array(
'From' => $from,
'Subject' => $subject,
'Content-Type' => 'text/html; charset=UTF-8',
'MIME-Version' => '1.0'
);
$mimeparams = array();
$mimeparams['text_encoding'] = '8bit';
$mimeparams['text_charset'] = 'UTF-8';
$mimeparams['html_charset'] = 'UTF-8';
$mimeparams['head_charset'] = 'UTF-8';
// Create a new instance
$mime = new Mail_mime();
// Specify the e-mail body
$mime->setHTMLBody($html);
// Attach the statements (PDF)
foreach($file_names as $attached_file) {
$file = '../path/to/the/pdf/file/' . $attached_file;
$file_name = $attached_file;
$content_type = "Application/pdf";
$mime->addAttachment ($file, $content_type, $file_name, 1);
}
// Create the body
$body = $mime->get($mimeparams);
// Add the headers
$headers = $mime->headers($headers);
// Create SMTP connect array to be passed
$smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
// Send the message
$mail = $smtp->send($recipients, $headers, $body);
if(PEAR::isError($mail)) echo 'Error';
else echo 'Sent';
// Close this account and cycle through the rest
$stmt->close();
}
$mysqli->close();
}
break;
}
}
Now I thought maybe I wasn't giving the script enough time to execute - so I set it ridiculously high `set_time_limit(99999999)` to ensure it had plenty of time, although it normally times out within 10-15 seconds. So basically it works like this, I have an internal DB that stores customer account numbers and e-mail addresses. Accounts can have the same e-mail address (It's sent to their company's AP department) - aka one e-mail address receives statements for multiple branches. From their each statement is already constructed with the format being ACCOUNTNUMBER_MM_DD_YYYY.pdf.
So I'm simply trying to have a short message in the body, and attach the monthly statements. Again, not sure why it's failing, and even though the script halts, I do receive ONE of the e-mails (I'm sending them all to myself at the moment just to test). Can anyone see where I may have an issue? | 0 |
11,298,415 | 07/02/2012 17:32:32 | 736,967 | 05/03/2011 21:39:51 | 546 | 25 | Why is this code returning a line break before the echo? | So I have this login php script that I am using and it works fine on one server (returns "success" || "invalid login") and then this other server it breaks because it returns a line break and then "success" or "invalid login"
My guess is a php.ini setting. I am just not sure which one.
<?php
include("../config.php");
include("../connect.php");
$adminCheck = mysql_query("SELECT * FROM admins WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" . mysql_real_escape_string($_POST['password']) . "'");
if (mysql_num_rows($adminCheck) == 1)
{
$result = mysql_fetch_array($adminCheck);
$_SESSION['user']['level'] = "admin";
$_SESSION['user']['userid'] = $result['id'];
$_SESSION['user']['username'] = $result['username'];
echo "success";
}
else
{
$clientCheck = mysql_query("SELECT * FROM clients WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" . mysql_real_escape_string($_POST['password']) . "'");
if (mysql_num_rows($clientCheck) == 1)
{
$result = mysql_fetch_array($clientCheck);
$_SESSION['user']['level'] = "client";
$_SESSION['user']['userid'] = $result['id'];
$_SESSION['user']['username'] = $result['username'];
$_SESSION['user']['client'] = $result['client'];
echo "success";
}
else
{
echo "invalid login";
}
}
?>
| php | php.ini | line-breaks | null | null | null | open | Why is this code returning a line break before the echo?
===
So I have this login php script that I am using and it works fine on one server (returns "success" || "invalid login") and then this other server it breaks because it returns a line break and then "success" or "invalid login"
My guess is a php.ini setting. I am just not sure which one.
<?php
include("../config.php");
include("../connect.php");
$adminCheck = mysql_query("SELECT * FROM admins WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" . mysql_real_escape_string($_POST['password']) . "'");
if (mysql_num_rows($adminCheck) == 1)
{
$result = mysql_fetch_array($adminCheck);
$_SESSION['user']['level'] = "admin";
$_SESSION['user']['userid'] = $result['id'];
$_SESSION['user']['username'] = $result['username'];
echo "success";
}
else
{
$clientCheck = mysql_query("SELECT * FROM clients WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" . mysql_real_escape_string($_POST['password']) . "'");
if (mysql_num_rows($clientCheck) == 1)
{
$result = mysql_fetch_array($clientCheck);
$_SESSION['user']['level'] = "client";
$_SESSION['user']['userid'] = $result['id'];
$_SESSION['user']['username'] = $result['username'];
$_SESSION['user']['client'] = $result['client'];
echo "success";
}
else
{
echo "invalid login";
}
}
?>
| 0 |
11,298,417 | 07/02/2012 17:32:41 | 551,811 | 12/22/2010 23:16:01 | 123 | 17 | How do I run specflow unit tests from a browser | I was able to run SpecFlow scenarios from a test project. Now I would like to be able to run these scenarios from a browser. How do I get that to work? | bdd | specflow | null | null | null | null | open | How do I run specflow unit tests from a browser
===
I was able to run SpecFlow scenarios from a test project. Now I would like to be able to run these scenarios from a browser. How do I get that to work? | 0 |
11,298,419 | 07/02/2012 17:32:55 | 1,492,135 | 06/29/2012 20:41:49 | 1 | 0 | Convert .264 to .ts using ffmpeg library | I'm currently working on converting h.264 elementary stream (file with postfiix .264) to transport stream (file with postfix .ts). I have finished the conversion successfully using ffmpeg command line "ffmpeg -i in.264 -an -vcodec copy -f mpegts out.ts".
Now I want to implement this conversion using my own C++ code, by calling ffmpeg's libraries. I have downloaded precompiled ffmpeg libraries (libavcodec, libavformat etc). My input h.264 is prerecorded file, not live stream, and so as my output .ts file. So my question is which functions in the library should I call to implement the conversion? I'm still new for ffmpeg, so please forgive me about the naive questions.
Thanks very much. | c++ | ffmpeg | h.264 | libav | null | null | open | Convert .264 to .ts using ffmpeg library
===
I'm currently working on converting h.264 elementary stream (file with postfiix .264) to transport stream (file with postfix .ts). I have finished the conversion successfully using ffmpeg command line "ffmpeg -i in.264 -an -vcodec copy -f mpegts out.ts".
Now I want to implement this conversion using my own C++ code, by calling ffmpeg's libraries. I have downloaded precompiled ffmpeg libraries (libavcodec, libavformat etc). My input h.264 is prerecorded file, not live stream, and so as my output .ts file. So my question is which functions in the library should I call to implement the conversion? I'm still new for ffmpeg, so please forgive me about the naive questions.
Thanks very much. | 0 |
11,298,305 | 07/02/2012 17:24:44 | 802,050 | 06/16/2011 18:09:43 | 1,194 | 4 | How to check the html version any web application is using? | how can i check what html version my web application is using? I have complete code base but i am not sure where to check the html version? In jsp i do not see see anything related to html version. | html | html5 | null | null | null | null | open | How to check the html version any web application is using?
===
how can i check what html version my web application is using? I have complete code base but i am not sure where to check the html version? In jsp i do not see see anything related to html version. | 0 |
11,298,306 | 07/02/2012 17:24:44 | 1,403,957 | 05/18/2012 17:27:29 | 3 | 0 | SQL query for wp_links in multiple categories | I can get links from the WordPress database that are in a specific category like this (I have added line breaks to the SQL part for clarity):
$category1 = 'stuff';
$category2 = 'other_stuff';
$q = 'select * from wp_links l
inner join wp_term_relationships r on l.link_id = r.object_id
inner join wp_term_taxonomy using (term_taxonomy_id)
inner join wp_terms using (term_id)
where taxonomy = "link_category"
and name = '.$category1;
$results = $wpdb->get_results($q);
How would I retrieve links that are in *both* `$category1` and `$category2` (I do mean *both* categories, not *either* category)? | php | mysql | sql | wordpress | null | null | open | SQL query for wp_links in multiple categories
===
I can get links from the WordPress database that are in a specific category like this (I have added line breaks to the SQL part for clarity):
$category1 = 'stuff';
$category2 = 'other_stuff';
$q = 'select * from wp_links l
inner join wp_term_relationships r on l.link_id = r.object_id
inner join wp_term_taxonomy using (term_taxonomy_id)
inner join wp_terms using (term_id)
where taxonomy = "link_category"
and name = '.$category1;
$results = $wpdb->get_results($q);
How would I retrieve links that are in *both* `$category1` and `$category2` (I do mean *both* categories, not *either* category)? | 0 |
11,387,104 | 07/08/2012 22:05:00 | 1,321,564 | 04/09/2012 09:29:42 | 50 | 3 | How do I assign a JSONObject or JavaScriptObject to $wnd[x] in GWT? | I read some `var` from my HTML-Page using GWT Dictionary. The `var` looks like this:
var test = {
"a" : "123",
"b" : "jg34l",
...
}
Now I get via AJAX-Call new content for my JS var. At the moment I overwrite it like this:
public native void set(String key, String value) /*-{
$wnd["test"][key] = value;
}-*/;
public void onResponseReceived(Request request, Response response) {
JSONObject obj = (JSONObject) JSONParser.parseLenient(response.getText());
for (String key : obj.keySet()) {
JSONString val = (JSONString) obj.get(key);
set(key, val.stringValue());
}
}
As you can see I get a JSON-String. Parse it. Cast it to JSONObject. Take every key-value-pair and use the JSNI-method to set the pairs.
There must be an easier way to do this?! I want simply to say: $wnd["test"] = myJsonObject
Please help me, 'cause it is performance-critical step (up to 1000 key-value-pairs). | javascript | json | gwt | jsni | null | null | open | How do I assign a JSONObject or JavaScriptObject to $wnd[x] in GWT?
===
I read some `var` from my HTML-Page using GWT Dictionary. The `var` looks like this:
var test = {
"a" : "123",
"b" : "jg34l",
...
}
Now I get via AJAX-Call new content for my JS var. At the moment I overwrite it like this:
public native void set(String key, String value) /*-{
$wnd["test"][key] = value;
}-*/;
public void onResponseReceived(Request request, Response response) {
JSONObject obj = (JSONObject) JSONParser.parseLenient(response.getText());
for (String key : obj.keySet()) {
JSONString val = (JSONString) obj.get(key);
set(key, val.stringValue());
}
}
As you can see I get a JSON-String. Parse it. Cast it to JSONObject. Take every key-value-pair and use the JSNI-method to set the pairs.
There must be an easier way to do this?! I want simply to say: $wnd["test"] = myJsonObject
Please help me, 'cause it is performance-critical step (up to 1000 key-value-pairs). | 0 |
11,387,100 | 07/08/2012 22:04:13 | 558,866 | 12/31/2010 01:29:08 | 55 | 3 | Symfony2: Can bundle routes be namespaced? | I have a MagazineBundle which in one of its Twig templates has `path('portfolio')`, the root of a different bundle that has been prefixed.
# app/config/routing.yml
LameMagazineBundle:
resource: "@LameMagazineBundle/Resources/config/routing.yml"
prefix: /
LamePortfolioBundle:
resource: "@LamePortfolioBundle/Resources/config/routing.yml"
prefix: /portfolio
and
# src/Lame/PortfolioBundle/Resources/config/routing.yml
portfolio:
pattern: /
defaults: { _controller: LamePortfolioBundle:Default:index }
But if I add a third bundle, possibly one I've downloaded and installed, and that bundle also happened to also have a route named 'portfolio', would I have to renamed the routes or is there a way to namespace them?
An experiment I tried with two matching route names results in the last declared one overriding the first. | symfony-2.0 | routing | namespaces | twig | null | null | open | Symfony2: Can bundle routes be namespaced?
===
I have a MagazineBundle which in one of its Twig templates has `path('portfolio')`, the root of a different bundle that has been prefixed.
# app/config/routing.yml
LameMagazineBundle:
resource: "@LameMagazineBundle/Resources/config/routing.yml"
prefix: /
LamePortfolioBundle:
resource: "@LamePortfolioBundle/Resources/config/routing.yml"
prefix: /portfolio
and
# src/Lame/PortfolioBundle/Resources/config/routing.yml
portfolio:
pattern: /
defaults: { _controller: LamePortfolioBundle:Default:index }
But if I add a third bundle, possibly one I've downloaded and installed, and that bundle also happened to also have a route named 'portfolio', would I have to renamed the routes or is there a way to namespace them?
An experiment I tried with two matching route names results in the last declared one overriding the first. | 0 |
11,387,106 | 07/08/2012 22:05:12 | 1,311,827 | 04/04/2012 03:02:44 | 25 | 1 | How to use physical address in MOV instruction? | I got a physical address 0xfee00020, which is a location of memory map of APIC registers. I want to read or write data to this location using "MOV" instruction. Should I do physical to virtual address translation first? How should I use this address? (How should write a code piece in inline assembly?)
p.s I am writing code in kernel.
Thanks. | c | linux | assembly | linux-kernel | x86 | null | open | How to use physical address in MOV instruction?
===
I got a physical address 0xfee00020, which is a location of memory map of APIC registers. I want to read or write data to this location using "MOV" instruction. Should I do physical to virtual address translation first? How should I use this address? (How should write a code piece in inline assembly?)
p.s I am writing code in kernel.
Thanks. | 0 |
11,387,107 | 07/08/2012 22:05:12 | 1,330,254 | 04/12/2012 21:28:29 | 1 | 0 | iOS 5: RestKit RKObjectManager crashes on instantiation | all ...
I'm new to RestKit. When my app first starts, it does this:
RKObjectManager *objectManager = [RKObjectManager objectManagerWithBaseURLString:@"http://something"];
... and promptly crashes like so:
2012-07-08 14:36:09.002 captureproof[20340:707] -[NSPathStore2 stringByAppendingQueryParameters:]: unrecognized selector sent to instance 0xf65a170
2012-07-08 14:36:09.007 captureproof[20340:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 stringByAppendingQueryParameters:]: unrecognized selector sent to instance 0xf65a170'
I've looked for solutions, but while a few others have reported the issue, i've not seen anyone suggest a fix. Any help would be appreciated very much :-)
Regards,
John
| ios5 | restkit | null | null | null | null | open | iOS 5: RestKit RKObjectManager crashes on instantiation
===
all ...
I'm new to RestKit. When my app first starts, it does this:
RKObjectManager *objectManager = [RKObjectManager objectManagerWithBaseURLString:@"http://something"];
... and promptly crashes like so:
2012-07-08 14:36:09.002 captureproof[20340:707] -[NSPathStore2 stringByAppendingQueryParameters:]: unrecognized selector sent to instance 0xf65a170
2012-07-08 14:36:09.007 captureproof[20340:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 stringByAppendingQueryParameters:]: unrecognized selector sent to instance 0xf65a170'
I've looked for solutions, but while a few others have reported the issue, i've not seen anyone suggest a fix. Any help would be appreciated very much :-)
Regards,
John
| 0 |
11,387,112 | 07/08/2012 22:06:06 | 1,421,204 | 05/28/2012 07:39:45 | 4 | 0 | Implement factory design pattern with spring annotaion | I have a factory class which should return me an instance of another classA or classB.This instance of classA or classB are concrete implementor of interface XYZ
interface xyz;
getInstance()
@service
classA implements xyz{
public void checkStatus(){
}
}
@service classB implements xyz
{public void checkStatus(){
}
}
Factory class
@component
class ABCFactory{
@Autowire classA A;
public static getInstance(str a){
return classA;}
}
client code
Class A a = ABCFactory.getInstance("A");
a.checkStatus();
I get nullpointer exception probably a is returned as null
What is the best approach to implent fectory pattern with spring annotation and autowired bean | spring | design | annotations | patterns | factory | null | open | Implement factory design pattern with spring annotaion
===
I have a factory class which should return me an instance of another classA or classB.This instance of classA or classB are concrete implementor of interface XYZ
interface xyz;
getInstance()
@service
classA implements xyz{
public void checkStatus(){
}
}
@service classB implements xyz
{public void checkStatus(){
}
}
Factory class
@component
class ABCFactory{
@Autowire classA A;
public static getInstance(str a){
return classA;}
}
client code
Class A a = ABCFactory.getInstance("A");
a.checkStatus();
I get nullpointer exception probably a is returned as null
What is the best approach to implent fectory pattern with spring annotation and autowired bean | 0 |
11,387,116 | 07/08/2012 22:06:44 | 1,294,251 | 03/26/2012 23:39:03 | 46 | 0 | Color Cells in a Worksheet Based on Data From Another Worksheet in Same Workbook | I have the following worksheet called **Data**:
![enter image description here][1]
In the same workbook I have another worksheet called **Employee Database**.
![enter image description here][2]
In Excel, how can I color the "Employee E-mail Address" and the corresponding "Company" and "Company URL" cells red from the **Data** worksheet if the "Employee E-mail Address" is not in the **Employee Database**?
In otherwords, I am looking for the following result:
![enter image description here][3]
I've just given an example and in reality I have over 10,000 cells worth of data to do this to. I started doing this manually and realized it will take me forever.
I'd love to know if there is a macro that can do this in Excel?
Help would be so much appreciated! I have the example workbook of the screenshots above available for download here:
http://www.mediafire.com/?dttztp66dvjkzn8
[1]: http://i.stack.imgur.com/6fXX9.jpg
[2]: http://i.stack.imgur.com/EUWOJ.jpg
[3]: http://i.stack.imgur.com/CdrcN.jpg | excel | excel-vba | excel-2007 | excel-2010 | null | null | open | Color Cells in a Worksheet Based on Data From Another Worksheet in Same Workbook
===
I have the following worksheet called **Data**:
![enter image description here][1]
In the same workbook I have another worksheet called **Employee Database**.
![enter image description here][2]
In Excel, how can I color the "Employee E-mail Address" and the corresponding "Company" and "Company URL" cells red from the **Data** worksheet if the "Employee E-mail Address" is not in the **Employee Database**?
In otherwords, I am looking for the following result:
![enter image description here][3]
I've just given an example and in reality I have over 10,000 cells worth of data to do this to. I started doing this manually and realized it will take me forever.
I'd love to know if there is a macro that can do this in Excel?
Help would be so much appreciated! I have the example workbook of the screenshots above available for download here:
http://www.mediafire.com/?dttztp66dvjkzn8
[1]: http://i.stack.imgur.com/6fXX9.jpg
[2]: http://i.stack.imgur.com/EUWOJ.jpg
[3]: http://i.stack.imgur.com/CdrcN.jpg | 0 |
11,387,118 | 07/08/2012 22:07:07 | 1,401,731 | 05/17/2012 18:36:51 | 29 | 0 | Android tablet for development | Can some one please suggest what kind of a tablet should I get for testing my apps ? I've just started learning Android development and mobile web app development. I was looking at the Ainol Elf 2, Ainol Aurora 2 and Nexus 7 but I'm not sure. | android | tablet | null | null | null | null | open | Android tablet for development
===
Can some one please suggest what kind of a tablet should I get for testing my apps ? I've just started learning Android development and mobile web app development. I was looking at the Ainol Elf 2, Ainol Aurora 2 and Nexus 7 but I'm not sure. | 0 |
11,387,120 | 07/08/2012 22:07:21 | 230,377 | 12/12/2009 17:46:13 | 1,668 | 75 | appharbor not deploying static content | I just started hosting a web application on AppHarbor, and i configured it to listen to my github repository commits.
After each commit, I see on AppHarbor the build running the tests, and deploying, but when i go to my app page, hosted on AppHarbor I don't see any images, and the js scripts are missing.
I can actually see them in the github source, but when I download the package from AppHarbor, they seem to be missing from my 'static' folder...
Anyone else run into this problem ?... Any possible causes for this ?... | static-libraries | web-deployment | appharbor | null | null | null | open | appharbor not deploying static content
===
I just started hosting a web application on AppHarbor, and i configured it to listen to my github repository commits.
After each commit, I see on AppHarbor the build running the tests, and deploying, but when i go to my app page, hosted on AppHarbor I don't see any images, and the js scripts are missing.
I can actually see them in the github source, but when I download the package from AppHarbor, they seem to be missing from my 'static' folder...
Anyone else run into this problem ?... Any possible causes for this ?... | 0 |
11,349,647 | 07/05/2012 17:42:19 | 1,469,622 | 06/20/2012 14:46:36 | 1 | 0 | How to show a link to attachments in ssrs that replaces the output "True" and "False"? from a sharepoint list | I am currently getting true/false outputs where there are attachments, but I was wondering how I can turn those true or false outputs into a link where the user will be able to click it and sends them to that document. I am using a sharepoint database to get my values.
Please advise on how I can accomplish this.
Thank you
Lucky | sharepoint2010 | reporting-services | ssrs-2008 | attachments | null | null | open | How to show a link to attachments in ssrs that replaces the output "True" and "False"? from a sharepoint list
===
I am currently getting true/false outputs where there are attachments, but I was wondering how I can turn those true or false outputs into a link where the user will be able to click it and sends them to that document. I am using a sharepoint database to get my values.
Please advise on how I can accomplish this.
Thank you
Lucky | 0 |
11,349,649 | 07/05/2012 17:42:35 | 434,218 | 08/29/2010 13:00:14 | 1,520 | 10 | Best Eclipse version for PHP | I would like to use Eclipse for PHP development. Also I need to have subversion for source control. Not having used that tool before I see there's so many flavors. Which one shall I use for PHP and what plugins I'll need to add?
Thanks. | php | eclipse | null | null | null | 07/05/2012 17:47:41 | not constructive | Best Eclipse version for PHP
===
I would like to use Eclipse for PHP development. Also I need to have subversion for source control. Not having used that tool before I see there's so many flavors. Which one shall I use for PHP and what plugins I'll need to add?
Thanks. | 4 |
11,349,641 | 07/05/2012 17:41:31 | 1,333,078 | 04/14/2012 08:59:27 | 41 | 4 | Javascript object check | I have this object from AJAX returned:
<pre>
reseeds: [,…]
0: {id:1, t:13447, userid:1, time:2012-07-04 19:07:54, username:x, userlevel:8, donor:no,}
1: {id:2, t:13447, userid:2, time:2012-07-04 09:04:27, username:y, userlevel:0, donor:no,}
2: {id:3, t:13447, userid:3, time:2012-07-04 09:04:30, username:z, userlevel:0, donor:no,}
3: {id:4, t:13447, userid:4, time:2012-07-04 09:04:35, username:w, userlevel:0, donor:no,}
</pre><br>
And I need to check if this object contains in "userid" some value.<br>
**I.E.:**<br>
I have value = 2, so how can I check if one of object arrays in userid == 2??
I need to return TRUE if any of userid == 2, and FALSE if no.
If value = 5, i need tor return FALSE, because no one of userid in object contains userid = 5.
Is there some function for it or I need to write my own for cycle?
| javascript | null | null | null | null | null | open | Javascript object check
===
I have this object from AJAX returned:
<pre>
reseeds: [,…]
0: {id:1, t:13447, userid:1, time:2012-07-04 19:07:54, username:x, userlevel:8, donor:no,}
1: {id:2, t:13447, userid:2, time:2012-07-04 09:04:27, username:y, userlevel:0, donor:no,}
2: {id:3, t:13447, userid:3, time:2012-07-04 09:04:30, username:z, userlevel:0, donor:no,}
3: {id:4, t:13447, userid:4, time:2012-07-04 09:04:35, username:w, userlevel:0, donor:no,}
</pre><br>
And I need to check if this object contains in "userid" some value.<br>
**I.E.:**<br>
I have value = 2, so how can I check if one of object arrays in userid == 2??
I need to return TRUE if any of userid == 2, and FALSE if no.
If value = 5, i need tor return FALSE, because no one of userid in object contains userid = 5.
Is there some function for it or I need to write my own for cycle?
| 0 |
11,349,663 | 07/05/2012 17:43:12 | 265,629 | 02/03/2010 20:39:44 | 2,349 | 11 | Can I perform queries to get books that contain a phrase using the Google Books API? | I want to find books that contain particular phrases in the google books corpus. Is there any way I can do this using the google books API? As far as I can tell, the API only supports dinky things like manipulation of google bookshelves and whatnot. | python | google-books | null | null | null | null | open | Can I perform queries to get books that contain a phrase using the Google Books API?
===
I want to find books that contain particular phrases in the google books corpus. Is there any way I can do this using the google books API? As far as I can tell, the API only supports dinky things like manipulation of google bookshelves and whatnot. | 0 |
11,348,893 | 07/05/2012 16:46:59 | 835,698 | 07/08/2011 16:03:15 | 445 | 0 | How can I give this table rounded borders and still maintain the color scheme I have? | I'd prefer not to use tables while doing this, but I don't know how else to go about it. Basically, I want a table with alternating white & grey rows. The table needs to have a rounded border and there should be borders in between the individual rows (but NO column borders).
Here's what I've got so far:
http://jsfiddle.net/zVDyh/1/
Even though I am setting the border radius, it doesn't seem to affect the table's border at all. | html | css | null | null | null | null | open | How can I give this table rounded borders and still maintain the color scheme I have?
===
I'd prefer not to use tables while doing this, but I don't know how else to go about it. Basically, I want a table with alternating white & grey rows. The table needs to have a rounded border and there should be borders in between the individual rows (but NO column borders).
Here's what I've got so far:
http://jsfiddle.net/zVDyh/1/
Even though I am setting the border radius, it doesn't seem to affect the table's border at all. | 0 |
11,349,669 | 07/05/2012 17:43:25 | 1,432,813 | 06/02/2012 19:41:50 | 8 | 0 | iAD implementation in .xib display add fault | I am building a single view application that only operates in portrait.I need to implement iAD but the tutorials online I dont exactly understand. I have dragged the ad view onto the xib and on my device it is there but displays a blank banner. I know that this is what is suppose to happen this is just to let you know how far I have reached. What do I need to do from here?
All help greatly appreciated!
Thanks | add | xib | iad | banner | null | null | open | iAD implementation in .xib display add fault
===
I am building a single view application that only operates in portrait.I need to implement iAD but the tutorials online I dont exactly understand. I have dragged the ad view onto the xib and on my device it is there but displays a blank banner. I know that this is what is suppose to happen this is just to let you know how far I have reached. What do I need to do from here?
All help greatly appreciated!
Thanks | 0 |
11,349,603 | 07/05/2012 17:38:47 | 596,691 | 01/31/2011 10:40:33 | 842 | 6 | removing first letters in a string using bash under cgi | I'm trying to path a web address to a bash script run under cgi. I search a little and found this [link][1]. From what I understood, this line should separate the variable from it's value:
USERNAME=`echo "$QUERY_STRING" | sed -n 's/^.*username=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"
So, reading about sed, I have concluded that this line should be sufficient for my needs:
url='echo "$QUERY_STRING" | sed "s/url=\(.*\)/\1/"'
where the input is
>url=www.web.address.com
However, the variable get is the string is:
>echo "$QUERY_STRING" | sed "s/url=\(.*\)/\1/"
if I tried to remove the apostrophes I get an empty variable. Note that if I simply to the ``echo`` command I the desired effect.
How can I separate the url value?
[1]: http://www.team2053.org/docs/bashcgi/gettingstarted.html | string | bash | cgi | null | null | null | open | removing first letters in a string using bash under cgi
===
I'm trying to path a web address to a bash script run under cgi. I search a little and found this [link][1]. From what I understood, this line should separate the variable from it's value:
USERNAME=`echo "$QUERY_STRING" | sed -n 's/^.*username=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"
So, reading about sed, I have concluded that this line should be sufficient for my needs:
url='echo "$QUERY_STRING" | sed "s/url=\(.*\)/\1/"'
where the input is
>url=www.web.address.com
However, the variable get is the string is:
>echo "$QUERY_STRING" | sed "s/url=\(.*\)/\1/"
if I tried to remove the apostrophes I get an empty variable. Note that if I simply to the ``echo`` command I the desired effect.
How can I separate the url value?
[1]: http://www.team2053.org/docs/bashcgi/gettingstarted.html | 0 |
11,349,605 | 07/05/2012 17:38:51 | 180,862 | 09/29/2009 03:40:19 | 1,488 | 8 | How to seed the root device of an EBS backed EC2 instance from snapshot? | As I understood, for an EBS backed EC2 instance, it's root device will be an EBS volume. Now if I want to have the content of the EBS volume to be a snapshot that I took earlier (for the root device of another EBS backed EC2 instance), how can I do that? | snapshot | amazon-ebs | null | null | null | null | open | How to seed the root device of an EBS backed EC2 instance from snapshot?
===
As I understood, for an EBS backed EC2 instance, it's root device will be an EBS volume. Now if I want to have the content of the EBS volume to be a snapshot that I took earlier (for the root device of another EBS backed EC2 instance), how can I do that? | 0 |
11,571,572 | 07/20/2012 01:16:58 | 1,522,316 | 07/13/2012 00:33:45 | 1 | 0 | How to use output of C program as variables in a Bash script | I'm trying to come up with a work around to perform a few math functions for a script since bash apparently cannot do anything other than integer math (or can it even do that?).
The script I'm coming up with needs to write a series of macros which will eventually be used for a simulation program. I'm currently just trying to output positions of a particle source which are used as parameters of the macro.
The C Program I wrote is very simple, it takes in i and outputs x and y as such:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double i;
double theta = 11 * (3.1415926535897932384626/180);
cin >> i;
double b = 24.370;
double y = (b/i)*sin(theta);
double x = (b/i)*cos(theta);
cout << x << " " << y << endl;
return 0;
}
The script I'm writing outputs a bunch of stuff that has to do with the macros i'm trying to create, but the line I'm stuck on (labled as (1) ) needs to do something like this...
for i in {1..100}
do
echo "./a.out" #calling the C program
echo "$i" #entering i as input
x = first output of a.out, y = second output a.out #(1) Confused on how to do this part!
echo -n "/gps/position $x $y 0 27.7 cm" > mymacro.mac
done
I know there has to be a really easy way to do this but I'm not exactly sure what to do. I basically just need to use the output of a c program as variables in the script.
Thanks for the Help!
| c++ | scripting | output | null | null | null | open | How to use output of C program as variables in a Bash script
===
I'm trying to come up with a work around to perform a few math functions for a script since bash apparently cannot do anything other than integer math (or can it even do that?).
The script I'm coming up with needs to write a series of macros which will eventually be used for a simulation program. I'm currently just trying to output positions of a particle source which are used as parameters of the macro.
The C Program I wrote is very simple, it takes in i and outputs x and y as such:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double i;
double theta = 11 * (3.1415926535897932384626/180);
cin >> i;
double b = 24.370;
double y = (b/i)*sin(theta);
double x = (b/i)*cos(theta);
cout << x << " " << y << endl;
return 0;
}
The script I'm writing outputs a bunch of stuff that has to do with the macros i'm trying to create, but the line I'm stuck on (labled as (1) ) needs to do something like this...
for i in {1..100}
do
echo "./a.out" #calling the C program
echo "$i" #entering i as input
x = first output of a.out, y = second output a.out #(1) Confused on how to do this part!
echo -n "/gps/position $x $y 0 27.7 cm" > mymacro.mac
done
I know there has to be a really easy way to do this but I'm not exactly sure what to do. I basically just need to use the output of a c program as variables in the script.
Thanks for the Help!
| 0 |
11,571,574 | 07/20/2012 01:17:11 | 1,024,973 | 11/02/2011 05:14:28 | 123 | 4 | Excel VBA: Inserting a Page Break between charts | I have an Excel worksheet on which I am organizing a bunch of charts. The charts stack vertically, on upon the other (with some spacing and labels in between for organization). The charts don't fit on a single printed page, so I have to insert page breaks at the right places. The number of charts and the size of each chart can change, so I don't know exactly where to put the page break until run time.
I do know that I want to print two charts on each page, however. So, what I want to do is to put a page break either after the second chart or before the third chart (either way). But it looks to me like page breaks are always associated with a row, not with an object (like a chart).
Is there a way to either:
1) associate a page break with an object (e.g. ActiveSheet.HPageBreaks.Add before:=ActiveSheet.ChartObject("myChart3") )
2) determine which row the top of the object sits in. If I could determine this, then I can easily place the page break at that row. For example, I can get ActiveSheet.ChartObject("myChart").Top, but I don't know what row this corresponds to. I tried setting every row to a height of 1 and then doing a one-to-one correspondence, but it doesn't match up.
Thank you! | excel-vba | null | null | null | null | null | open | Excel VBA: Inserting a Page Break between charts
===
I have an Excel worksheet on which I am organizing a bunch of charts. The charts stack vertically, on upon the other (with some spacing and labels in between for organization). The charts don't fit on a single printed page, so I have to insert page breaks at the right places. The number of charts and the size of each chart can change, so I don't know exactly where to put the page break until run time.
I do know that I want to print two charts on each page, however. So, what I want to do is to put a page break either after the second chart or before the third chart (either way). But it looks to me like page breaks are always associated with a row, not with an object (like a chart).
Is there a way to either:
1) associate a page break with an object (e.g. ActiveSheet.HPageBreaks.Add before:=ActiveSheet.ChartObject("myChart3") )
2) determine which row the top of the object sits in. If I could determine this, then I can easily place the page break at that row. For example, I can get ActiveSheet.ChartObject("myChart").Top, but I don't know what row this corresponds to. I tried setting every row to a height of 1 and then doing a one-to-one correspondence, but it doesn't match up.
Thank you! | 0 |
11,571,575 | 07/20/2012 01:17:11 | 668,970 | 03/21/2011 06:21:45 | 1,614 | 127 | How can know, the server will accept specific type of content-type | I want to know , what kind of content type does the server accepts and then i can post the data in that format only. | java | http | null | null | null | null | open | How can know, the server will accept specific type of content-type
===
I want to know , what kind of content type does the server accepts and then i can post the data in that format only. | 0 |
11,571,544 | 07/20/2012 01:11:39 | 1,533,395 | 07/18/2012 02:05:44 | 1 | 0 | How do I send requests to multiple directory structures to one page? | How do I send requests to multiple directory structures to one page? For example, how would I send requests to somesite.com/users/new and requests to somesite.com/users/delete to somesite.com/users/index.php so that the index.php page can see what the original url was. I need to do this without redirects. I know this is very easily possible because tons of php frameworks and CMSes have that feature. (Wordpress, Codeigiter, TinyMVC, just to name a few.)
I am programming in PHP.
Thanks in advance. | php | url | url-rewriting | null | null | null | open | How do I send requests to multiple directory structures to one page?
===
How do I send requests to multiple directory structures to one page? For example, how would I send requests to somesite.com/users/new and requests to somesite.com/users/delete to somesite.com/users/index.php so that the index.php page can see what the original url was. I need to do this without redirects. I know this is very easily possible because tons of php frameworks and CMSes have that feature. (Wordpress, Codeigiter, TinyMVC, just to name a few.)
I am programming in PHP.
Thanks in advance. | 0 |
11,571,577 | 07/20/2012 01:17:47 | 134,692 | 07/08/2009 04:53:07 | 392 | 4 | SCons libraries and sub-libraries | I have a hierarchical build system based on SCons. I have a root SConstruct that calls into a SConscript that builds a shared library and then into a different SConscript that builds an executable that depends on the shared library.
So here's my question: my understanding of shared libraries on linux is that when you want to do the final `ld` link for the executable that will be using the shared lib, the shared lib has to be included on the executable's `ld` command line as a source to reference it (unless it's in a standard location in which case the `-l` option works).
So here's something like what my SCons files look like:
=== rootdir/SConstruct
env=DefaultEnvironment()
shared_lib = SConscript('foolib/SConscript')
env.Append( LIBS=[shared_lib] )
executable = SConscript('barexec/SConscript')
=== rootdir/foolib/SConscript
env=DefaultEnvironment()
env.Append(CPPPATH=Glob('inc'))
penv = env.Clone()
penv.Append(CPPPATH=Glob('internal/inc'))
lib = penv.SharedLibrary( 'foo', source=['foo.c', 'morefoo.c']
Return("lib")
=== rootdir/barexec/SConscript
env=DefaultEnvironment()
exe = env.Program( 'bar', source=['main.c', 'bar.c', 'rod.c'] )
Return("exe")
So the hitch here is this line:
env.Append( LIBS=[shared_lib] )
This would be a great way to add generated libraries to the command line for any other libs that need them, EXCEPT that because SCons is doing a two-pass run through the SConscripts (first to generate it's dependency tree, then to do the work), `rootdir/foolib/libfoo.so` winds up on the command line for ALL products, EVEN `libfoo.so` itself:
gcc -g -Wall -Werror -o libfoo.so foo.o morefoo.o libfoo.so
So how is this best done with SCons? For now I've resorted to this hack:
=== rootdir/SConstruct
env=DefaultEnvironment()
shared_lib = SConscript('foolib/SConscript')
env['shared_lib'] = shared_lib
executable = SConscript('barexec/SConscript')
...
=== rootdir/barexec/SConscript
env=DefaultEnvironment()
exe = env.Program( 'bar', source=['main.c', 'bar.c', 'rod.c'] + env['shared_lib'] )
Return("exe")
Is there a more SCons-y way of doing this?
| c++ | c | build | build-process | scons | null | open | SCons libraries and sub-libraries
===
I have a hierarchical build system based on SCons. I have a root SConstruct that calls into a SConscript that builds a shared library and then into a different SConscript that builds an executable that depends on the shared library.
So here's my question: my understanding of shared libraries on linux is that when you want to do the final `ld` link for the executable that will be using the shared lib, the shared lib has to be included on the executable's `ld` command line as a source to reference it (unless it's in a standard location in which case the `-l` option works).
So here's something like what my SCons files look like:
=== rootdir/SConstruct
env=DefaultEnvironment()
shared_lib = SConscript('foolib/SConscript')
env.Append( LIBS=[shared_lib] )
executable = SConscript('barexec/SConscript')
=== rootdir/foolib/SConscript
env=DefaultEnvironment()
env.Append(CPPPATH=Glob('inc'))
penv = env.Clone()
penv.Append(CPPPATH=Glob('internal/inc'))
lib = penv.SharedLibrary( 'foo', source=['foo.c', 'morefoo.c']
Return("lib")
=== rootdir/barexec/SConscript
env=DefaultEnvironment()
exe = env.Program( 'bar', source=['main.c', 'bar.c', 'rod.c'] )
Return("exe")
So the hitch here is this line:
env.Append( LIBS=[shared_lib] )
This would be a great way to add generated libraries to the command line for any other libs that need them, EXCEPT that because SCons is doing a two-pass run through the SConscripts (first to generate it's dependency tree, then to do the work), `rootdir/foolib/libfoo.so` winds up on the command line for ALL products, EVEN `libfoo.so` itself:
gcc -g -Wall -Werror -o libfoo.so foo.o morefoo.o libfoo.so
So how is this best done with SCons? For now I've resorted to this hack:
=== rootdir/SConstruct
env=DefaultEnvironment()
shared_lib = SConscript('foolib/SConscript')
env['shared_lib'] = shared_lib
executable = SConscript('barexec/SConscript')
...
=== rootdir/barexec/SConscript
env=DefaultEnvironment()
exe = env.Program( 'bar', source=['main.c', 'bar.c', 'rod.c'] + env['shared_lib'] )
Return("exe")
Is there a more SCons-y way of doing this?
| 0 |
11,570,490 | 07/19/2012 22:53:38 | 450,259 | 09/17/2010 05:07:35 | 50 | 3 | Is there any way to disable upfront indexing in Eclipse CDT? | When I'm using Eclipse CDT (the problem has existed for several versions now), the upfront indexing indexes a bunch of C header files, and pollutes the code completion with 100's of C functions which I will never ever use.
That prevents me from easily seeing what's actually in the namespace that I'm in at a glance, which is really annoying.
Why are they even included by default, and is there a way to remove them? Even an ugly workaround is fine, I just want a way to get rid of them that does not break my code. | eclipse-cdt | null | null | null | null | null | open | Is there any way to disable upfront indexing in Eclipse CDT?
===
When I'm using Eclipse CDT (the problem has existed for several versions now), the upfront indexing indexes a bunch of C header files, and pollutes the code completion with 100's of C functions which I will never ever use.
That prevents me from easily seeing what's actually in the namespace that I'm in at a glance, which is really annoying.
Why are they even included by default, and is there a way to remove them? Even an ugly workaround is fine, I just want a way to get rid of them that does not break my code. | 0 |
11,571,584 | 07/20/2012 01:19:06 | 40,015 | 11/23/2008 03:15:17 | 6,638 | 283 | CakePHP hidden _method POST | When using the FormHelper->create(...), the HTML that gets rendered looks like this:
<form action="/blogs/add" method="post" accept-charset="utf-8">
<div style="display:none;">
<input type="hidden" name="_method" value="POST">
</div>
<!-- omitted: form inputs -->
</form>
Why is that div with the display:none; style there? How do I make it not show up?
| html | cakephp | null | null | null | null | open | CakePHP hidden _method POST
===
When using the FormHelper->create(...), the HTML that gets rendered looks like this:
<form action="/blogs/add" method="post" accept-charset="utf-8">
<div style="display:none;">
<input type="hidden" name="_method" value="POST">
</div>
<!-- omitted: form inputs -->
</form>
Why is that div with the display:none; style there? How do I make it not show up?
| 0 |
11,541,610 | 07/18/2012 12:39:52 | 1,137,881 | 01/09/2012 02:27:41 | 25 | 0 | PHP class extends a public variable | I have two classes
class validate {
public $mediaFlag;
function ValidateTypeOfMedia($SOEmag,$SOEtab,$Soct,$DAL,$insertMeda,$other){
if($SOEmag==""){
return "Must select Media Type";
}
else{
$this->mediaFlag=1;
}
}
function whatever()
{
if( $this->mediaFlag==1)
{ echo "flag is here";
}
else {
echo "flag didn't work";
}
}
}/// Class validate Ends
class InsertINDB extends validate
{
function test(){
if( $this->mediaFlag==1)
{ echo "flag is here";
}
else {
echo "flag didn't work";
}
}
}
The problem I am having is in class insertINDB , function test does not recognize that the mediaFlag variable has been set...however, function whatever in the parent class does recognize so. so my question, how come function test in class InsertINDB does not know that the flag has been set in the parent class.
| php | homework | null | null | null | null | open | PHP class extends a public variable
===
I have two classes
class validate {
public $mediaFlag;
function ValidateTypeOfMedia($SOEmag,$SOEtab,$Soct,$DAL,$insertMeda,$other){
if($SOEmag==""){
return "Must select Media Type";
}
else{
$this->mediaFlag=1;
}
}
function whatever()
{
if( $this->mediaFlag==1)
{ echo "flag is here";
}
else {
echo "flag didn't work";
}
}
}/// Class validate Ends
class InsertINDB extends validate
{
function test(){
if( $this->mediaFlag==1)
{ echo "flag is here";
}
else {
echo "flag didn't work";
}
}
}
The problem I am having is in class insertINDB , function test does not recognize that the mediaFlag variable has been set...however, function whatever in the parent class does recognize so. so my question, how come function test in class InsertINDB does not know that the flag has been set in the parent class.
| 0 |
11,541,624 | 07/18/2012 12:40:35 | 1,428,198 | 05/31/2012 10:49:20 | 101 | 7 | Why am I getting the error for assigning values to list here in python? | Instead of appending a value by **list.append()** to the list , Why can;t I assign a value to it like this?
In [24]: def a():
....: a1=[5]
....: print a1[0]
....:
In [25]: a()
5
In [28]: def a():
....: a1=[5]
....: a1[1]=12
....: print a1[1]
....:
In [29]: a()
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/home/dubizzle/webapps/django/dubizzle/<ipython-input-29-72f2e37b262f> in <module>()
----> 1 a()
/home/dubizzle/webapps/django/dubizzle/<ipython-input-28-681d86164e67> in a()
1 def a():
2 a1=[5]
----> 3 a1[1]=12
4 print a1[1]
5
IndexError: list assignment index out of range
| python | null | null | null | null | null | open | Why am I getting the error for assigning values to list here in python?
===
Instead of appending a value by **list.append()** to the list , Why can;t I assign a value to it like this?
In [24]: def a():
....: a1=[5]
....: print a1[0]
....:
In [25]: a()
5
In [28]: def a():
....: a1=[5]
....: a1[1]=12
....: print a1[1]
....:
In [29]: a()
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/home/dubizzle/webapps/django/dubizzle/<ipython-input-29-72f2e37b262f> in <module>()
----> 1 a()
/home/dubizzle/webapps/django/dubizzle/<ipython-input-28-681d86164e67> in a()
1 def a():
2 a1=[5]
----> 3 a1[1]=12
4 print a1[1]
5
IndexError: list assignment index out of range
| 0 |
11,541,433 | 07/18/2012 12:32:00 | 1,494,105 | 07/01/2012 09:50:17 | 84 | 3 | Can't open phone application programmatically | NSString *phoneStr = @"tel:";
phoneStr = [phoneStr stringByAppendingFormat:@"tel:%@" , self.ContactPhone];
NSURL * phoneURL = (NSURL *)[NSURL URLWithString:phoneStr];
[[UIApplication sharedApplication] openURL:phoneURL];
This code does not working and not open phone application, and when I print the value of the phoneURL it is always null
why this is happens?
Thx | iphone | ios | null | null | null | null | open | Can't open phone application programmatically
===
NSString *phoneStr = @"tel:";
phoneStr = [phoneStr stringByAppendingFormat:@"tel:%@" , self.ContactPhone];
NSURL * phoneURL = (NSURL *)[NSURL URLWithString:phoneStr];
[[UIApplication sharedApplication] openURL:phoneURL];
This code does not working and not open phone application, and when I print the value of the phoneURL it is always null
why this is happens?
Thx | 0 |
11,541,434 | 07/18/2012 12:32:06 | 872,902 | 08/01/2011 14:06:51 | 166 | 6 | Algorithm for mixing a nuber variables | Example: I have the numbers form 1 to 10. All possible combinations, where in every combination every variable in included once without any repetition, are... well... 3628800 (10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1 = 3628800).
In my case, the computer has to check ALL of the combinations, instead of picking random ones. Afterwords, the system will store the needed combinations in an array. But I can't think of an algorithm and I can't find one in the internet (probably because I'm not searching the right way).
What algorithm can I use for mixing a number of variables, where all of the combinations have no repeating variables? | algorithm | variables | language-agnostic | combinations | mix | null | open | Algorithm for mixing a nuber variables
===
Example: I have the numbers form 1 to 10. All possible combinations, where in every combination every variable in included once without any repetition, are... well... 3628800 (10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1 = 3628800).
In my case, the computer has to check ALL of the combinations, instead of picking random ones. Afterwords, the system will store the needed combinations in an array. But I can't think of an algorithm and I can't find one in the internet (probably because I'm not searching the right way).
What algorithm can I use for mixing a number of variables, where all of the combinations have no repeating variables? | 0 |
11,541,629 | 07/18/2012 12:40:48 | 1,012,369 | 10/25/2011 08:31:58 | 13 | 0 | Issue accessing to some fields from scaffolded autogenerated views from parent/child extended class in grails | **My problem is**: *I cant update (edit.gsp) the client groups, from the client view I only can see the groups (show.gsp), if I want to assign a Group to a Client I must go to the User view to change it. I want to add new groups from the client view*
I'm working over legacy database and I've this three classes:
Parent class **User**:
I had problems mapping this class but it was solved, you can see the [question](http://stackoverflow.com/questions/11393680/how-to-insert-view-primary-key-email-from-auto-generated-views-with-grails-cr) and how it was solved.
class User {
String email
String password
static hasMany = [groups: Group]
static mappedBy = [groups: 'members']
static constraints = {
email email: true, blank: false, nullable: false, unique: true
password blank:false, nullable:false
}
static mapping = {
table 'usuario'
id generator: 'assigned', name: 'email', type: 'string'
email column: 'id'
groups joinTable: [name: 'usuario_grupo', key: 'idusuario']
}
String getId() {
return email
}
}
Child class **Client**:
class Client extends User {
String name
String surname
String phone
static mapping = {
table 'cliente'
name column: 'nombre'
surname column: 'apellidos'
phone column: 'telf'
id column: 'email', generator: 'assigned', name: 'email', type: 'string'
}
}
**Group** class:
class Group {
Integer id
String kindUser
static belongsTo = User
static hasMany = [members: User]
static constraints = {
kindUser blank:false, nullable:false
}
static mapping = {
table 'grupo'
id generator: 'increment', type: 'integer'
kindUser column: 'tipousuario'
members joinTable: [name: 'usuario_grupo', key: 'idgrupo']
}
}
If you want to see the legacy database tables here are: http://pastebin.com/nDRVjM3N | grails | mapping | gsp | scaffolding | extends | null | open | Issue accessing to some fields from scaffolded autogenerated views from parent/child extended class in grails
===
**My problem is**: *I cant update (edit.gsp) the client groups, from the client view I only can see the groups (show.gsp), if I want to assign a Group to a Client I must go to the User view to change it. I want to add new groups from the client view*
I'm working over legacy database and I've this three classes:
Parent class **User**:
I had problems mapping this class but it was solved, you can see the [question](http://stackoverflow.com/questions/11393680/how-to-insert-view-primary-key-email-from-auto-generated-views-with-grails-cr) and how it was solved.
class User {
String email
String password
static hasMany = [groups: Group]
static mappedBy = [groups: 'members']
static constraints = {
email email: true, blank: false, nullable: false, unique: true
password blank:false, nullable:false
}
static mapping = {
table 'usuario'
id generator: 'assigned', name: 'email', type: 'string'
email column: 'id'
groups joinTable: [name: 'usuario_grupo', key: 'idusuario']
}
String getId() {
return email
}
}
Child class **Client**:
class Client extends User {
String name
String surname
String phone
static mapping = {
table 'cliente'
name column: 'nombre'
surname column: 'apellidos'
phone column: 'telf'
id column: 'email', generator: 'assigned', name: 'email', type: 'string'
}
}
**Group** class:
class Group {
Integer id
String kindUser
static belongsTo = User
static hasMany = [members: User]
static constraints = {
kindUser blank:false, nullable:false
}
static mapping = {
table 'grupo'
id generator: 'increment', type: 'integer'
kindUser column: 'tipousuario'
members joinTable: [name: 'usuario_grupo', key: 'idgrupo']
}
}
If you want to see the legacy database tables here are: http://pastebin.com/nDRVjM3N | 0 |
11,541,630 | 07/18/2012 12:40:48 | 1,534,756 | 07/18/2012 12:18:53 | 1 | 0 | First step's with THREE.js : issues trying to add a blender model to scene | I'm doing my first steps with THREE.js.
For now on I simply tried to modify a sample file found here : http://aerotwist.com/tutorials/getting-started-with-three-js/
The file creates a THREE scene, adds a sphere and a point light.
My issue is :
I don't find how to replace the sphere by a model that I created using blender 2.63 and exported using the blender 2.63 exporter.
I guess my syntax is somehow wrong.
Here's my code below. Can someone tell me what to change to get my blender model to be displayed on stage?
thx.
<head>
<meta charset="utf-8" />
<title>Sample Three.js</title>
<link rel="stylesheet" href="js/Styles.css" />
</head>
<body>
<div id="container">
</div>
</body>
<script src="js/Stats.js"></script>
<script src="js/Three.js"></script>
<script>
var WIDTH = 700,
HEIGHT = 600;
var VIEW_ANGLE = 45,
ASPECT = WIDTH / HEIGHT,
NEAR = 0.1,
FAR = 10000;
var container = window.document.getElementById('container');
var renderer = new THREE.WebGLRenderer();
var camera = new THREE.PerspectiveCamera( VIEW_ANGLE,
ASPECT,
NEAR,
FAR );
var scene = new THREE.Scene();
camera.position.z = 300;
renderer.setSize(WIDTH, HEIGHT);
container.appendChild(renderer.domElement);
var sphereMaterial = new THREE.MeshLambertMaterial(
{
color: 0xCC0000
});
//var radius = 50, segments = 16, rings = 16;
var loader = new THREE.JSONLoader();
loader.load( 'js/ModelTest.js', function ( geometry ) {
mesh = new THREE.Mesh( geometry, sphereMaterial );
scene.add( mesh );
mesh.position.x = 0;
mesh.position.y = 0;
mesh.position.z = 0;
alert(mesh.geometry.vertices.length)
} );
//var sphere = new THREE.Mesh(
//new THREE.SphereGeometry(radius, segments, rings),sphereMaterial);
//scene.add(sphere);
scene.add(camera);
var pointLight = new THREE.PointLight( 0xFFFFFF );
pointLight.position.x = 10;
pointLight.position.y = 50;
pointLight.position.z = 130;
scene.add(pointLight);
renderer.render(scene, camera);
</script>
| javascript | three.js | null | null | null | null | open | First step's with THREE.js : issues trying to add a blender model to scene
===
I'm doing my first steps with THREE.js.
For now on I simply tried to modify a sample file found here : http://aerotwist.com/tutorials/getting-started-with-three-js/
The file creates a THREE scene, adds a sphere and a point light.
My issue is :
I don't find how to replace the sphere by a model that I created using blender 2.63 and exported using the blender 2.63 exporter.
I guess my syntax is somehow wrong.
Here's my code below. Can someone tell me what to change to get my blender model to be displayed on stage?
thx.
<head>
<meta charset="utf-8" />
<title>Sample Three.js</title>
<link rel="stylesheet" href="js/Styles.css" />
</head>
<body>
<div id="container">
</div>
</body>
<script src="js/Stats.js"></script>
<script src="js/Three.js"></script>
<script>
var WIDTH = 700,
HEIGHT = 600;
var VIEW_ANGLE = 45,
ASPECT = WIDTH / HEIGHT,
NEAR = 0.1,
FAR = 10000;
var container = window.document.getElementById('container');
var renderer = new THREE.WebGLRenderer();
var camera = new THREE.PerspectiveCamera( VIEW_ANGLE,
ASPECT,
NEAR,
FAR );
var scene = new THREE.Scene();
camera.position.z = 300;
renderer.setSize(WIDTH, HEIGHT);
container.appendChild(renderer.domElement);
var sphereMaterial = new THREE.MeshLambertMaterial(
{
color: 0xCC0000
});
//var radius = 50, segments = 16, rings = 16;
var loader = new THREE.JSONLoader();
loader.load( 'js/ModelTest.js', function ( geometry ) {
mesh = new THREE.Mesh( geometry, sphereMaterial );
scene.add( mesh );
mesh.position.x = 0;
mesh.position.y = 0;
mesh.position.z = 0;
alert(mesh.geometry.vertices.length)
} );
//var sphere = new THREE.Mesh(
//new THREE.SphereGeometry(radius, segments, rings),sphereMaterial);
//scene.add(sphere);
scene.add(camera);
var pointLight = new THREE.PointLight( 0xFFFFFF );
pointLight.position.x = 10;
pointLight.position.y = 50;
pointLight.position.z = 130;
scene.add(pointLight);
renderer.render(scene, camera);
</script>
| 0 |
11,541,631 | 07/18/2012 12:40:49 | 874,381 | 08/02/2011 10:19:59 | 1,200 | 28 | Reading web contents, getting exception | Im making an Android application, and for that i have to get JSON content from a URL (which is output by some python script).
I found a method for that on SO, but i can't get it to work. This is the code:
public String webGet(String URL) throws Exception
{
BufferedReader in = null;
try
{
HttpClient client = new DefaultHttpClient();
client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "android");
HttpGet request = new HttpGet();
request.setHeader("Content-Type", "text/html; charset=utf-8");
request.setURI(new URI(URL));
// Crashes after executing this line
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null)
{
sb.append(line + NL);
}
in.close();
String page = sb.toString();
//System.out.println(page);
return page;
}
finally
{
if (in != null)
{
try
{
in.close();
}
catch (IOException e)
{
Log.d("BBB", e.toString());
}
}
}
}
This crash happends after this line:
HttpResponse response = client.execute(request);
It then simply jumps to the `finally` part and all i can get from the exception message is that something was `null`. That's all it says.
Anyone any idea what the problem could be? | java | null | null | null | null | null | open | Reading web contents, getting exception
===
Im making an Android application, and for that i have to get JSON content from a URL (which is output by some python script).
I found a method for that on SO, but i can't get it to work. This is the code:
public String webGet(String URL) throws Exception
{
BufferedReader in = null;
try
{
HttpClient client = new DefaultHttpClient();
client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "android");
HttpGet request = new HttpGet();
request.setHeader("Content-Type", "text/html; charset=utf-8");
request.setURI(new URI(URL));
// Crashes after executing this line
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null)
{
sb.append(line + NL);
}
in.close();
String page = sb.toString();
//System.out.println(page);
return page;
}
finally
{
if (in != null)
{
try
{
in.close();
}
catch (IOException e)
{
Log.d("BBB", e.toString());
}
}
}
}
This crash happends after this line:
HttpResponse response = client.execute(request);
It then simply jumps to the `finally` part and all i can get from the exception message is that something was `null`. That's all it says.
Anyone any idea what the problem could be? | 0 |
11,541,637 | 07/18/2012 12:41:10 | 375,942 | 06/25/2010 05:49:20 | 20 | 1 | Open PDF file which has internal links with in pdf using google viewer | I am building android app using cordova-1.7.0 , Jquery mobile. The app is simple list view with links if user clicks i have to show them the links with in app so I solve the issue using childbrowser along with google viewer to show the pdf file now the issue is the pdf file has internal references i.e. in first page there was link which take the user to 5th page I can see that in real pdf viewer in my desktop but when I load via google viewer the pages are displayed as images there was no links at all, can anyone in this big forum help me how to solve this issue?
Thanks for your valuable time | jquery-mobile | google-docs | cordova | childbrowser | null | null | open | Open PDF file which has internal links with in pdf using google viewer
===
I am building android app using cordova-1.7.0 , Jquery mobile. The app is simple list view with links if user clicks i have to show them the links with in app so I solve the issue using childbrowser along with google viewer to show the pdf file now the issue is the pdf file has internal references i.e. in first page there was link which take the user to 5th page I can see that in real pdf viewer in my desktop but when I load via google viewer the pages are displayed as images there was no links at all, can anyone in this big forum help me how to solve this issue?
Thanks for your valuable time | 0 |
11,728,135 | 07/30/2012 19:19:28 | 1,148,103 | 01/13/2012 16:37:36 | 146 | 11 | Facebook graph API: post to feed fails with "link" parameter | I am posting a link to the feed of a page with Graph API. Last time I checked, my code was working a couple month ago. But today I find out that the same code stops working and returns an error.
Basically what I do is:
$ curl -i -F 'access_token=my_application_token' -F 'link=http://www.foodnetwork.com/recipes/tyler-florence/parsnip-puree-recipe2/index.html' -F 'name=Parsnip Puree' -F 'picture=http://img.foodnetwork.com/FOOD/2009/02/25/TU0603-1_Parsnip-Puree_s4x3_tz.jpg' -F 'id=my_page_url' https://graph.facebook.com/feed
It now returns the following result:
HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Origin: *
Cache-Control: no-store
Content-Type: text/javascript; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
WWW-Authenticate: OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
X-FB-Rev: 600290
X-FB-Debug: mTeWwusHg5daIP2IMHlebi8fnLT9PO0CNJQeshMC+Hg=
Date: Mon, 30 Jul 2012 19:07:01 GMT
Connection: keep-alive
Content-Length: 87
{"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}
If I try the same post without the parameter of "link", then it works:
$ curl -i -F 'access_token=my_application_token' -F 'name=Parsnip Puree' -F 'picture=http://img.foodnetwork.com/FOOD/2009/02/25/TU0603-1_Parsnip-Puree_s4x3_tz.jpg' -F 'id=my_page_url' https://graph.facebook.com/feed
This returns the following, and I can see the post on my Facebook wall (without the desired link, of course):
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/javascript; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
X-FB-Rev: 600290
X-FB-Debug: iVVyk65AbEbnXNm0RyurLp/ZQA/oNXJ47w1UkLXXTfw=
Date: Mon, 30 Jul 2012 19:07:19 GMT
Connection: keep-alive
Content-Length: 40
{"id":"155190691260287_268086653304xxx"}
What puzzles me is that the same code with "link" parameter had been working. And the Facebook documentation does not say anything has changed about the "link" parameter for posting to feed.
Any idea what went wrong?
Thanks. | facebook | facebook-graph-api | null | null | null | null | open | Facebook graph API: post to feed fails with "link" parameter
===
I am posting a link to the feed of a page with Graph API. Last time I checked, my code was working a couple month ago. But today I find out that the same code stops working and returns an error.
Basically what I do is:
$ curl -i -F 'access_token=my_application_token' -F 'link=http://www.foodnetwork.com/recipes/tyler-florence/parsnip-puree-recipe2/index.html' -F 'name=Parsnip Puree' -F 'picture=http://img.foodnetwork.com/FOOD/2009/02/25/TU0603-1_Parsnip-Puree_s4x3_tz.jpg' -F 'id=my_page_url' https://graph.facebook.com/feed
It now returns the following result:
HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Origin: *
Cache-Control: no-store
Content-Type: text/javascript; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
WWW-Authenticate: OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
X-FB-Rev: 600290
X-FB-Debug: mTeWwusHg5daIP2IMHlebi8fnLT9PO0CNJQeshMC+Hg=
Date: Mon, 30 Jul 2012 19:07:01 GMT
Connection: keep-alive
Content-Length: 87
{"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}
If I try the same post without the parameter of "link", then it works:
$ curl -i -F 'access_token=my_application_token' -F 'name=Parsnip Puree' -F 'picture=http://img.foodnetwork.com/FOOD/2009/02/25/TU0603-1_Parsnip-Puree_s4x3_tz.jpg' -F 'id=my_page_url' https://graph.facebook.com/feed
This returns the following, and I can see the post on my Facebook wall (without the desired link, of course):
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: text/javascript; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
X-FB-Rev: 600290
X-FB-Debug: iVVyk65AbEbnXNm0RyurLp/ZQA/oNXJ47w1UkLXXTfw=
Date: Mon, 30 Jul 2012 19:07:19 GMT
Connection: keep-alive
Content-Length: 40
{"id":"155190691260287_268086653304xxx"}
What puzzles me is that the same code with "link" parameter had been working. And the Facebook documentation does not say anything has changed about the "link" parameter for posting to feed.
Any idea what went wrong?
Thanks. | 0 |
11,728,136 | 07/30/2012 19:19:32 | 222,427 | 12/01/2009 21:04:28 | 1,636 | 11 | RadComboBoxItems not being added to multiple RadComboBoxes | All I'm really trying to do is populate three different comboboxes with the same item. When this code executes below only one combobox is getting the values. Any help is welcomed. Thanks!
for (int i = 0; i < 100; i++)
{
RadComboBoxItem li = new RadComboBoxItem();
li.Text = i.ToString();
li.Value = i.ToString();
InputPairThousandValueComboBox.Items.Add(li);
InputUsertThousdandValueComboBox.Items.Add(li);
InputCurrentlyListedThousdandComboBox.Items.Add(li);
} | asp.net | combobox | telerik | null | null | null | open | RadComboBoxItems not being added to multiple RadComboBoxes
===
All I'm really trying to do is populate three different comboboxes with the same item. When this code executes below only one combobox is getting the values. Any help is welcomed. Thanks!
for (int i = 0; i < 100; i++)
{
RadComboBoxItem li = new RadComboBoxItem();
li.Text = i.ToString();
li.Value = i.ToString();
InputPairThousandValueComboBox.Items.Add(li);
InputUsertThousdandValueComboBox.Items.Add(li);
InputCurrentlyListedThousdandComboBox.Items.Add(li);
} | 0 |
11,728,242 | 07/30/2012 19:28:19 | 1,093,953 | 12/12/2011 14:53:46 | 54 | 3 | Using javascript to assign value from td to asp.net hiddenfield | I have the same issue as that of a previous poster in which I need to set a session variable prior to page load. Because pageload fires before my gridview.RowCommand, I am trying to use this method found in the article below which incorporates the use of a hiddenfield. My ultimate goal is to remove the onRowCommand event and to use the solution presented in the article. I have been using firebug to debug my javascript but everytime I get an error "is undefined" when I look at this.parent (this is a td and this.parent should be the tr). According to firebug, this.parent.cells[2].textContent is how I get to the OID value I want. As I spend little time writing javascript, any help would be very much appreciated.
My GridView
<asp:GridView ID="gridViewOpenOrders" CssClass="gvOpenOrders" runat="server" AutoGenerateColumns="False"
AllowPaging="True" RowStyle-BorderStyle="None"
DataKeyNames="AccountNumber,OrderID"
Width="802px" OnRowCommand="gridViewOpenOrders_RowCommand">
<Columns>
<asp:ButtonField Text="Select" HeaderStyle-Width="40px" ItemStyle-CssClass="assignOrderID"/>
<asp:BoundField DataField="OrderDate" HeaderText="Date" SortExpression="OrderDate"
DataFormatString="{0:d}">
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="OrderID" HeaderText="OID" SortExpression="OrderID">
<HeaderStyle Width ="40px" />
</asp:BoundField>
</Columns>
<HeaderStyle CssClass="ColumnHeaders" />
<RowStyle CssClass="ColumnRows" />
<SelectedRowStyle BackColor="#D9D9FF" />
</asp:GridView>
My Javascript:
<script type="text/javascript">
$(document).ready(function() {
$(".assignOrderID").click(function () {
var testing = $(".assignOrderID")
alert(this.parent)
alert(this.parent.cells[2])
alert(this.parent.cells[2]).textContent
document.getElementById('ContentPlaceHolder1_formViewOrder_hiddenFieldOrderID').value = this.parent.cells[2].textContent
alert('hi2');
});
});
</script>
Page Load Code:
Dim t As HiddenField = formViewOrder.FindControl("hiddenFieldOrderID")
Session.Add("OrderID", t.Value)
Research:
http://stackoverflow.com/questions/11656345/setting-a-session-variable-before-autopostback-fires-in-an-aspbutton | javascript | asp.net | css | vb.net | null | null | open | Using javascript to assign value from td to asp.net hiddenfield
===
I have the same issue as that of a previous poster in which I need to set a session variable prior to page load. Because pageload fires before my gridview.RowCommand, I am trying to use this method found in the article below which incorporates the use of a hiddenfield. My ultimate goal is to remove the onRowCommand event and to use the solution presented in the article. I have been using firebug to debug my javascript but everytime I get an error "is undefined" when I look at this.parent (this is a td and this.parent should be the tr). According to firebug, this.parent.cells[2].textContent is how I get to the OID value I want. As I spend little time writing javascript, any help would be very much appreciated.
My GridView
<asp:GridView ID="gridViewOpenOrders" CssClass="gvOpenOrders" runat="server" AutoGenerateColumns="False"
AllowPaging="True" RowStyle-BorderStyle="None"
DataKeyNames="AccountNumber,OrderID"
Width="802px" OnRowCommand="gridViewOpenOrders_RowCommand">
<Columns>
<asp:ButtonField Text="Select" HeaderStyle-Width="40px" ItemStyle-CssClass="assignOrderID"/>
<asp:BoundField DataField="OrderDate" HeaderText="Date" SortExpression="OrderDate"
DataFormatString="{0:d}">
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="OrderID" HeaderText="OID" SortExpression="OrderID">
<HeaderStyle Width ="40px" />
</asp:BoundField>
</Columns>
<HeaderStyle CssClass="ColumnHeaders" />
<RowStyle CssClass="ColumnRows" />
<SelectedRowStyle BackColor="#D9D9FF" />
</asp:GridView>
My Javascript:
<script type="text/javascript">
$(document).ready(function() {
$(".assignOrderID").click(function () {
var testing = $(".assignOrderID")
alert(this.parent)
alert(this.parent.cells[2])
alert(this.parent.cells[2]).textContent
document.getElementById('ContentPlaceHolder1_formViewOrder_hiddenFieldOrderID').value = this.parent.cells[2].textContent
alert('hi2');
});
});
</script>
Page Load Code:
Dim t As HiddenField = formViewOrder.FindControl("hiddenFieldOrderID")
Session.Add("OrderID", t.Value)
Research:
http://stackoverflow.com/questions/11656345/setting-a-session-variable-before-autopostback-fires-in-an-aspbutton | 0 |
11,728,248 | 07/30/2012 19:29:00 | 1,546,757 | 07/23/2012 19:22:17 | 9 | 0 | Objective C how to get a Facebook access token | I'm having some trouble pulling a Facebook access token from the web for a Facebook Feed App I'm writing. The problem isn't strictly related to gaining a Facebook token; this just frames the problem. When I go to https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=[APP_ID]&client_secret=[APP_SECRET], I am returned a token on a page that simply says:
access_token=464483653570261|cY9NHFBWCDJ9hSQfswWFg0FDZvw
How can I parse that from the webpage into my app? I'm relatively new to Objective C (and I've only got a year of basic coding experience), so I tried to use part of a method that I found online to get a JSON feed, combined with a simple parsing method, but it didn't work. The code is as follows:
id getToken = [self objectWithUrl:[NSURL URLWithString:@"https://graph.facebook.com/
oauth/access_token?grant_type=client_credentials&
client_id=464483653570261&
client_secret=55bb8395ed0293bf37af695f6cdaa1fb"]];
NSString *fullToken = (NSString *)getToken;
NSLog(@"fullToken: %@", fullToken);
NSArray *components = [fullToken componentsSeparatedByString:@"="];
NSString *token = [components objectAtIndex:1];
NSLog(@"token: %@", token);
Both of my NSLogs say that the respective Strings point to (null). I'm not really certain what I'm doing wrong, and I haven't had much luck finding answers on the internet, as I'm not sure what to call what I'm trying to do. I'd appreciate any help, or alternate methods, that you might have. | objective-c | ios | null | null | null | null | open | Objective C how to get a Facebook access token
===
I'm having some trouble pulling a Facebook access token from the web for a Facebook Feed App I'm writing. The problem isn't strictly related to gaining a Facebook token; this just frames the problem. When I go to https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=[APP_ID]&client_secret=[APP_SECRET], I am returned a token on a page that simply says:
access_token=464483653570261|cY9NHFBWCDJ9hSQfswWFg0FDZvw
How can I parse that from the webpage into my app? I'm relatively new to Objective C (and I've only got a year of basic coding experience), so I tried to use part of a method that I found online to get a JSON feed, combined with a simple parsing method, but it didn't work. The code is as follows:
id getToken = [self objectWithUrl:[NSURL URLWithString:@"https://graph.facebook.com/
oauth/access_token?grant_type=client_credentials&
client_id=464483653570261&
client_secret=55bb8395ed0293bf37af695f6cdaa1fb"]];
NSString *fullToken = (NSString *)getToken;
NSLog(@"fullToken: %@", fullToken);
NSArray *components = [fullToken componentsSeparatedByString:@"="];
NSString *token = [components objectAtIndex:1];
NSLog(@"token: %@", token);
Both of my NSLogs say that the respective Strings point to (null). I'm not really certain what I'm doing wrong, and I haven't had much luck finding answers on the internet, as I'm not sure what to call what I'm trying to do. I'd appreciate any help, or alternate methods, that you might have. | 0 |
11,727,797 | 07/30/2012 18:55:41 | 663,148 | 03/16/2011 19:31:05 | 1,113 | 5 | Executing the windows batch file | **What I am doing currently-**
1. Execute the shell script on `MachineB` from `MachineA` (Windows Environment).
2. Then wait for the shell script to complete its task, in my case it will write the output to a text file.
3.
And after the shell script has completed all its task means it finished writing everything to a txt file, then copy that txt file to `MachineA` (Windows Environment) from `MachineB`.
So for this I wrote a `Windows Batch file` that will do the above task and it is working fine for me. Below is the Windows Bat file that I am using currently.
plink uname@machineB -m email.sh
pscp uname@machineB:/export/home/uname/jk_attachment22.txt C:\PLINK\foo.txt
But by using the above windows batch file, I need to type password two times which is pain, Firstly I need to type for the first line and then again for the second line.
**My Question is-**
So Is there any way I can run the above windows batch file by just typing `password` once at the command prompt. Any suggestions will be appreciated. | shell | unix | batch-file | plink | pscp | null | open | Executing the windows batch file
===
**What I am doing currently-**
1. Execute the shell script on `MachineB` from `MachineA` (Windows Environment).
2. Then wait for the shell script to complete its task, in my case it will write the output to a text file.
3.
And after the shell script has completed all its task means it finished writing everything to a txt file, then copy that txt file to `MachineA` (Windows Environment) from `MachineB`.
So for this I wrote a `Windows Batch file` that will do the above task and it is working fine for me. Below is the Windows Bat file that I am using currently.
plink uname@machineB -m email.sh
pscp uname@machineB:/export/home/uname/jk_attachment22.txt C:\PLINK\foo.txt
But by using the above windows batch file, I need to type password two times which is pain, Firstly I need to type for the first line and then again for the second line.
**My Question is-**
So Is there any way I can run the above windows batch file by just typing `password` once at the command prompt. Any suggestions will be appreciated. | 0 |
11,728,250 | 07/30/2012 19:29:07 | 808,114 | 06/21/2011 09:08:18 | 85 | 0 | Drawing graphs with purely HTML5 | Can any one point me to any resources for making graphs in **HTML5**? Most of resources I have seen through Google use animated graphs, I just want a simple static graph in HTML5. One more thing, I am really very weak in graphs, so a simple, easy to understand solution would be very helpful. I will be using this XML file to display data in graphical format.
[US Canada Mortality][1]
[1]: http://www-acad.sheridanc.on.ca/~joe/SYST35288/2012/assignments/uscanadamortality.xml "US Canada Mortality"
Thanks in advance :-) | css | homework | html5 | html5-canvas | null | null | open | Drawing graphs with purely HTML5
===
Can any one point me to any resources for making graphs in **HTML5**? Most of resources I have seen through Google use animated graphs, I just want a simple static graph in HTML5. One more thing, I am really very weak in graphs, so a simple, easy to understand solution would be very helpful. I will be using this XML file to display data in graphical format.
[US Canada Mortality][1]
[1]: http://www-acad.sheridanc.on.ca/~joe/SYST35288/2012/assignments/uscanadamortality.xml "US Canada Mortality"
Thanks in advance :-) | 0 |
11,728,257 | 07/30/2012 19:29:35 | 453,343 | 09/21/2010 00:06:56 | 113 | 0 | ggplot: Determining breaks for continuous data in geo_map() call | Hopefully this is simple:
I am working on a choropleth map with ggplot.
How can I pass the breaks (quantiles, jenks and such) for a continuous variable being mapped, as opposed to relying on the default gradient? I would ideally like to use the output from `classIntervals` and pass that as an aesthetic, but I tried `scale_y_continuous` but that scales the map frame itself and not the fill variable being mapped.
So, how to pass breaks, and which form do they take?
Thanks!
| r | map | ggplot | null | null | null | open | ggplot: Determining breaks for continuous data in geo_map() call
===
Hopefully this is simple:
I am working on a choropleth map with ggplot.
How can I pass the breaks (quantiles, jenks and such) for a continuous variable being mapped, as opposed to relying on the default gradient? I would ideally like to use the output from `classIntervals` and pass that as an aesthetic, but I tried `scale_y_continuous` but that scales the map frame itself and not the fill variable being mapped.
So, how to pass breaks, and which form do they take?
Thanks!
| 0 |
11,372,735 | 07/07/2012 06:07:57 | 1,379,059 | 05/07/2012 06:07:06 | 10 | 1 | Internationalization in Manifest file | I have some label in the manifest file which has english text how can i have them in other languages also.for e.g.
<activity
android:name=".activity.MainMenuActivity"
android:label="Main Menu Options"
android:configChanges="locale"
>
</activity>
I want to covert the lable to persian text.how can i do it.please help. | android | null | null | null | null | null | open | Internationalization in Manifest file
===
I have some label in the manifest file which has english text how can i have them in other languages also.for e.g.
<activity
android:name=".activity.MainMenuActivity"
android:label="Main Menu Options"
android:configChanges="locale"
>
</activity>
I want to covert the lable to persian text.how can i do it.please help. | 0 |
11,372,736 | 07/07/2012 06:08:01 | 1,398,222 | 05/16/2012 09:22:24 | 72 | 8 | System.Diagnostics.Process.Start throwing threadabort exception on server | In my website I am using System.Diagnostics.Process.Start to preview a particular file. It is working fine on the local server but, it throws ThreadAbortException on the online server when I try to preview the file. | c# | asp.net | system.diagnostics | threadabortexception | null | null | open | System.Diagnostics.Process.Start throwing threadabort exception on server
===
In my website I am using System.Diagnostics.Process.Start to preview a particular file. It is working fine on the local server but, it throws ThreadAbortException on the online server when I try to preview the file. | 0 |
11,372,737 | 07/07/2012 06:08:14 | 734,153 | 05/02/2011 08:31:11 | 392 | 8 | Vimscript - Mapping functions | Let's say I have a function give me ASCII value of a character that is passed as an argument and call it AsciiFunc (It's late and I can't think of creative names). Is it possible to define a single mapping which calls AsciiFunc and passes to it the character typed. For eg. if the function is mapped to `<leader>a` then pressing `<leader>af` will call the function AsciiFunc and pass 'f' as a parameter?
Just to avoid confusion, I know that `ga` gives the ascii and other information of the character under the cursor, that is not what I'm looking for. I'm looking for a way to avoid having to create multiple mappings one each for every possible value that AsciiFunc can take as an argument. | vim | vimscript | null | null | null | null | open | Vimscript - Mapping functions
===
Let's say I have a function give me ASCII value of a character that is passed as an argument and call it AsciiFunc (It's late and I can't think of creative names). Is it possible to define a single mapping which calls AsciiFunc and passes to it the character typed. For eg. if the function is mapped to `<leader>a` then pressing `<leader>af` will call the function AsciiFunc and pass 'f' as a parameter?
Just to avoid confusion, I know that `ga` gives the ascii and other information of the character under the cursor, that is not what I'm looking for. I'm looking for a way to avoid having to create multiple mappings one each for every possible value that AsciiFunc can take as an argument. | 0 |
11,372,901 | 07/07/2012 06:43:32 | 1,152,568 | 01/16/2012 19:48:09 | 17 | 1 | SQL query to select a column with expression of non-aggregate value and aggregate function | Tables used:
> 1) v(date d, name c(25), desc c(50), debit n(7), credit n(7))
> name in 'v' refers name in vn table
> 2) vn(date d, name c(25), type c(25), obal n(7))
> name in 'vn' is a primary key and different names are grouped by type
> ex: names abc, def, ghi belongs to type 'bank', names xyz, pqr belongs to type 'ledger', ...
I've a query like this:
SELECT vn.type, SUM(vn.obal + IIF(v.date < sd, v.credit-v.debit, 0)) OpBal, ;
SUM(IIF(BETWEEN(v.date, sd, ed), v.credit-v.debit, 0)) CurBal ;
FROM v, vn WHERE v.name = vn.name GROUP BY vn.type ;
ORDER BY vn.type HAVING OpBal + CurCr - CurDb != 0
It works fine but the only problem is, obal is a value which is entered only once per name in table 'vn' but with this query for every calculation of credit-debit in table 'v', obal is added multiple times and displayed under OpBal. When the query is modified like below:
SELECT vn.type, vn.obal + SUM(IIF(v.date < sd, v.credit-v.debit, 0)) OpBal, ;
SUM(IIF(BETWEEN(v.date, sd, ed), v.credit-v.debit, 0)) CurBal ;
FROM v, vn WHERE v.name = vn.name GROUP BY vn.type ;
ORDER BY vn.type HAVING OpBal + CurCr - CurDb != 0
it shows an error message like 'Group by clause is missing or invalid'!
RDBMS used MS Visual Foxpro 9. sd and ed are date type variables used for the purpose of query where sd < ed.
Please help me out getting the expected result. Thanks a lot. | sql | foxpro | visual-foxpro | null | null | null | open | SQL query to select a column with expression of non-aggregate value and aggregate function
===
Tables used:
> 1) v(date d, name c(25), desc c(50), debit n(7), credit n(7))
> name in 'v' refers name in vn table
> 2) vn(date d, name c(25), type c(25), obal n(7))
> name in 'vn' is a primary key and different names are grouped by type
> ex: names abc, def, ghi belongs to type 'bank', names xyz, pqr belongs to type 'ledger', ...
I've a query like this:
SELECT vn.type, SUM(vn.obal + IIF(v.date < sd, v.credit-v.debit, 0)) OpBal, ;
SUM(IIF(BETWEEN(v.date, sd, ed), v.credit-v.debit, 0)) CurBal ;
FROM v, vn WHERE v.name = vn.name GROUP BY vn.type ;
ORDER BY vn.type HAVING OpBal + CurCr - CurDb != 0
It works fine but the only problem is, obal is a value which is entered only once per name in table 'vn' but with this query for every calculation of credit-debit in table 'v', obal is added multiple times and displayed under OpBal. When the query is modified like below:
SELECT vn.type, vn.obal + SUM(IIF(v.date < sd, v.credit-v.debit, 0)) OpBal, ;
SUM(IIF(BETWEEN(v.date, sd, ed), v.credit-v.debit, 0)) CurBal ;
FROM v, vn WHERE v.name = vn.name GROUP BY vn.type ;
ORDER BY vn.type HAVING OpBal + CurCr - CurDb != 0
it shows an error message like 'Group by clause is missing or invalid'!
RDBMS used MS Visual Foxpro 9. sd and ed are date type variables used for the purpose of query where sd < ed.
Please help me out getting the expected result. Thanks a lot. | 0 |
11,372,903 | 07/07/2012 06:43:52 | 1,281,940 | 03/20/2012 20:48:13 | 24 | 0 | magento upgrade from 1.6.2 to 1.7.0.2 - Will the db base be changed? | i am looking into upgrading my magento community from 1.6.2 to 1.7.0.2.
First i will do this on my test server, but there are some errors during updating in magento connect, so i have to upload some files my self ...
but when i going to put these data into the live environment, can i just simply copy my data from the ftp to the live website?
Or are there also some new/changed settings in the database?
And if yes on the last question, which lines are changed? | database | magento | update | null | null | null | open | magento upgrade from 1.6.2 to 1.7.0.2 - Will the db base be changed?
===
i am looking into upgrading my magento community from 1.6.2 to 1.7.0.2.
First i will do this on my test server, but there are some errors during updating in magento connect, so i have to upload some files my self ...
but when i going to put these data into the live environment, can i just simply copy my data from the ftp to the live website?
Or are there also some new/changed settings in the database?
And if yes on the last question, which lines are changed? | 0 |
11,372,905 | 07/07/2012 06:44:16 | 1,080,125 | 12/04/2011 14:18:04 | 192 | 1 | Is there any GUI framework with support for both web and desktop apps? | Is there any GUI framework that can render a UI I create both as a web app and a desktop app, like on created with Qt or GTK? What I do not want is a "native" app that just displays the HTML UI in a window. | html5 | gui | null | null | null | null | open | Is there any GUI framework with support for both web and desktop apps?
===
Is there any GUI framework that can render a UI I create both as a web app and a desktop app, like on created with Qt or GTK? What I do not want is a "native" app that just displays the HTML UI in a window. | 0 |
11,372,888 | 07/07/2012 06:41:38 | 1,508,347 | 07/07/2012 06:20:46 | 1 | 1 | Releasing resources of Java 7 WatchService | I am using Java 7 WatchService to watch directories. I constantly change which directories i am watching. I run into the exception:
java.io.IOException: The network BIOS command limit has been reached.
after 50 directories. I am certain i call close() on each WatchService i create before creating a new one.
Does anyone know the proper way to release a WatchService so you do not run into this limit?
Thanks,
Dave | java | watchservice | null | null | null | null | open | Releasing resources of Java 7 WatchService
===
I am using Java 7 WatchService to watch directories. I constantly change which directories i am watching. I run into the exception:
java.io.IOException: The network BIOS command limit has been reached.
after 50 directories. I am certain i call close() on each WatchService i create before creating a new one.
Does anyone know the proper way to release a WatchService so you do not run into this limit?
Thanks,
Dave | 0 |
11,372,890 | 07/07/2012 06:41:57 | 1,508,340 | 07/07/2012 06:14:03 | 1 | 0 | OAuthException (#368) The action attempted has been deemed abusive or is otherwise disallowed | I'm trying to post a feed on my wall or on the wall on some of my friends using Graph API. I gave all permissions that this application needs, allow them when i make the request from my page, I'm having a valid access token but even though this exception occurs and no feed is posted. My post request looks pretty good, the permissions are given. What do I need to do to show on facebook app that I'm not an abusive person. The last think I did was to dig in my application Auth Dialog to set all permission I need there, and to write why do I need these permissions.
I would be very grateful if you tell me what is going on and point me into the right direction of what do I need to do to fix this problem. | facebook-graph-api | feed | null | null | null | null | open | OAuthException (#368) The action attempted has been deemed abusive or is otherwise disallowed
===
I'm trying to post a feed on my wall or on the wall on some of my friends using Graph API. I gave all permissions that this application needs, allow them when i make the request from my page, I'm having a valid access token but even though this exception occurs and no feed is posted. My post request looks pretty good, the permissions are given. What do I need to do to show on facebook app that I'm not an abusive person. The last think I did was to dig in my application Auth Dialog to set all permission I need there, and to write why do I need these permissions.
I would be very grateful if you tell me what is going on and point me into the right direction of what do I need to do to fix this problem. | 0 |
11,372,913 | 07/07/2012 06:46:04 | 1,496,354 | 07/02/2012 14:43:53 | 11 | 1 | Telerik Listview in ASP.net | I just want to include the Telerik ListView in my Project.
I m getting confused very much that what to do with this? How can i use telerik rad list view in my project what files i have to attached with it.
Please let me know what important files i need to attach in my project. | c# | asp.net | .net | telerik | null | 07/08/2012 15:47:19 | not a real question | Telerik Listview in ASP.net
===
I just want to include the Telerik ListView in my Project.
I m getting confused very much that what to do with this? How can i use telerik rad list view in my project what files i have to attached with it.
Please let me know what important files i need to attach in my project. | 1 |
11,471,691 | 07/13/2012 13:42:48 | 67,606 | 02/17/2009 22:36:20 | 49,265 | 1,738 | REST APIs, HTTP verbs and ACCESS LOGs | I've been trying to follow good RESTful APIs practices when designing them. One of them which happens to be very simple and common keeps getting hard to follow:
* Use `GET` http verb to retrieve resources
Why? Consider you have a URI to get account information like this:
* http://www.example.com/account/AXY_883772
Where `AXY_883772` is an account id in a bank system. Security auditing will raise a warning stating that:
1. Account ID will appear on HTTP ACCESS LOGS
2. Account ID might get cached on browser's history (even though is unlikely to use a *browser* regularly to access a RESTful API)
And they end up by "recommending" that `POST` verb should be used instead.
So, my question is:
What can we do about it? Just follow security recommendations and avoid using `GET` most of the times? Use some kind of special APACHE/IIS/NGINX access log configuration to avoid logging access to certain URLs? | http | rest | restful-url | httpverbs | restful-api | null | open | REST APIs, HTTP verbs and ACCESS LOGs
===
I've been trying to follow good RESTful APIs practices when designing them. One of them which happens to be very simple and common keeps getting hard to follow:
* Use `GET` http verb to retrieve resources
Why? Consider you have a URI to get account information like this:
* http://www.example.com/account/AXY_883772
Where `AXY_883772` is an account id in a bank system. Security auditing will raise a warning stating that:
1. Account ID will appear on HTTP ACCESS LOGS
2. Account ID might get cached on browser's history (even though is unlikely to use a *browser* regularly to access a RESTful API)
And they end up by "recommending" that `POST` verb should be used instead.
So, my question is:
What can we do about it? Just follow security recommendations and avoid using `GET` most of the times? Use some kind of special APACHE/IIS/NGINX access log configuration to avoid logging access to certain URLs? | 0 |
11,471,694 | 07/13/2012 13:43:04 | 502,937 | 11/10/2010 08:33:50 | 662 | 25 | function overloading by return type | Perl is one of such language which supports the function overloading by return type.
Simple example of this is [wantarray()][1].
Few nice modules are available in CPAN which extends this wantarray() and provide overloading for many other return types. These modules are [Contextual::Return][2] and [Want][3]. Unfortunately, I can not use these modules as both of these fails the perl critic with perl version 5.8.9 (I can not upgrade this perl version).
So, I am thinking to write my own module like Contextual::Return and Want but with very minimal. I tried to understand Contextual::Return and Want modules code, but I am not an expert.
I need function overloading for return types BOOL, OBJREF, LIST, SCALAR only.
Please help me by providing some guidelines, how can I start for it.
[1]: http://perldoc.perl.org/functions/wantarray.html
[2]: http://search.cpan.org/~dconway/Contextual-Return-0.004003/lib/Contextual/Return.pm
[3]: http://search.cpan.org/~robin/Want-0.21/Want.pm | perl | null | null | null | null | null | open | function overloading by return type
===
Perl is one of such language which supports the function overloading by return type.
Simple example of this is [wantarray()][1].
Few nice modules are available in CPAN which extends this wantarray() and provide overloading for many other return types. These modules are [Contextual::Return][2] and [Want][3]. Unfortunately, I can not use these modules as both of these fails the perl critic with perl version 5.8.9 (I can not upgrade this perl version).
So, I am thinking to write my own module like Contextual::Return and Want but with very minimal. I tried to understand Contextual::Return and Want modules code, but I am not an expert.
I need function overloading for return types BOOL, OBJREF, LIST, SCALAR only.
Please help me by providing some guidelines, how can I start for it.
[1]: http://perldoc.perl.org/functions/wantarray.html
[2]: http://search.cpan.org/~dconway/Contextual-Return-0.004003/lib/Contextual/Return.pm
[3]: http://search.cpan.org/~robin/Want-0.21/Want.pm | 0 |
11,471,695 | 07/13/2012 13:43:15 | 537,936 | 12/10/2010 14:13:41 | 258 | 21 | Google map just shows grey grid and markers | Both in eclipse and when uploaded to Play Store the app just shows the grey grid and the custom markers I added but the actual map is not shown.
I am using the keys from the previous developer before me and the previous versions seem to work on Google Play but when I build it it fails to show the map.
Can anyone help me with this? | android | google-maps | google-maps-api-3 | android-manifest | android-mapview | null | open | Google map just shows grey grid and markers
===
Both in eclipse and when uploaded to Play Store the app just shows the grey grid and the custom markers I added but the actual map is not shown.
I am using the keys from the previous developer before me and the previous versions seem to work on Google Play but when I build it it fails to show the map.
Can anyone help me with this? | 0 |
11,471,701 | 07/13/2012 13:43:42 | 1,380,136 | 05/07/2012 15:47:31 | 26 | 1 | How to change Language in Google TTS API in iOS? | I am using Google Text To Speech Services in iOS.
I am ok in English TTS with following codes.
NSString *queryTTS = [text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=en&q=%@",queryTTS];
NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
[_googlePlayer play];
So i changed url address to speech thailand TTS like following link.
NSString *queryTTS = [text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=th&q=%@",queryTTS];
NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
[_googlePlayer play];
After i changed that link into `"th"` , that google TTS services not speech my thai text.
Am i wrong in my codes?
Or If no , how can i change languages in Google Text To Speech API?
Thanks you for reading. | ios | tts | null | null | null | null | open | How to change Language in Google TTS API in iOS?
===
I am using Google Text To Speech Services in iOS.
I am ok in English TTS with following codes.
NSString *queryTTS = [text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=en&q=%@",queryTTS];
NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
[_googlePlayer play];
So i changed url address to speech thailand TTS like following link.
NSString *queryTTS = [text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=th&q=%@",queryTTS];
NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
[_googlePlayer play];
After i changed that link into `"th"` , that google TTS services not speech my thai text.
Am i wrong in my codes?
Or If no , how can i change languages in Google Text To Speech API?
Thanks you for reading. | 0 |
11,431,074 | 07/11/2012 10:51:52 | 473,736 | 10/12/2010 19:20:12 | 70 | 0 | Android emulator doesnot connect to local machine with alias ip | I have been trying to connect to a php script from my local machine with the android emulator. I wrote a program to access the script. Here it is.
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
JSONObject j = new JSONObject();
try{
j.put("action", "getQuote");
}catch(JSONException e1){
e1.printStackTrace();
}
String url = "http://10.0.2.2/androidServer1.php";
//Testing
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
EditText tvl = (EditText) findViewById(R.id.editText1);
try{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("APIKey","ultraQuote"));
nameValuePairs.add(new BasicNameValuePair("payload", j.toString()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
String temp = EntityUtils.toString(entity);
tvl.setText(temp);
}catch(ClientProtocolException e){
}catch(IOException e){
}
setContentView(R.layout.activity_main);
}
The php script works fine because i tested it in my browser. However when i tried to run this app it just crashed. I looked at log cat and saw null pointer exception. So i decided to test a script in the android emulator browser like this "10.0.2.2/testmobi.php" and sure enough it didn't work. I tested the same script in the machine's browser like this "localhost/testmobi.php and it worked perfectly. So i assume there is problem accessing scripts form the emulator. Any help or advice. | android | android-emulator | httpclient | null | null | null | open | Android emulator doesnot connect to local machine with alias ip
===
I have been trying to connect to a php script from my local machine with the android emulator. I wrote a program to access the script. Here it is.
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
JSONObject j = new JSONObject();
try{
j.put("action", "getQuote");
}catch(JSONException e1){
e1.printStackTrace();
}
String url = "http://10.0.2.2/androidServer1.php";
//Testing
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
EditText tvl = (EditText) findViewById(R.id.editText1);
try{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("APIKey","ultraQuote"));
nameValuePairs.add(new BasicNameValuePair("payload", j.toString()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
String temp = EntityUtils.toString(entity);
tvl.setText(temp);
}catch(ClientProtocolException e){
}catch(IOException e){
}
setContentView(R.layout.activity_main);
}
The php script works fine because i tested it in my browser. However when i tried to run this app it just crashed. I looked at log cat and saw null pointer exception. So i decided to test a script in the android emulator browser like this "10.0.2.2/testmobi.php" and sure enough it didn't work. I tested the same script in the machine's browser like this "localhost/testmobi.php and it worked perfectly. So i assume there is problem accessing scripts form the emulator. Any help or advice. | 0 |
11,470,829 | 07/13/2012 12:47:30 | 339,500 | 05/12/2010 15:56:53 | 494 | 12 | UISplitViewController transition from top to bottom instead of right to left | I have a root UISplitViewController that contains a UINavigationController related with a DetailViewController. The DetailViewController calls, via a storyboard push segue, another ViewController, called SecondViewController. When the user clicks on the Back button in SecondViewController toolbar, all the UISplitViewController has a transition from top to bottom, instead of a right-to-left transition of the DetailViewController. In the xCode designed all the transition style properties are set as "Flip horizontal". Is there a way to solve it? | uisplitviewcontroller | null | null | null | null | null | open | UISplitViewController transition from top to bottom instead of right to left
===
I have a root UISplitViewController that contains a UINavigationController related with a DetailViewController. The DetailViewController calls, via a storyboard push segue, another ViewController, called SecondViewController. When the user clicks on the Back button in SecondViewController toolbar, all the UISplitViewController has a transition from top to bottom, instead of a right-to-left transition of the DetailViewController. In the xCode designed all the transition style properties are set as "Flip horizontal". Is there a way to solve it? | 0 |
11,470,830 | 07/13/2012 12:47:33 | 1,465,572 | 06/19/2012 06:40:18 | 1 | 0 | Sub headers in Flexigrid | can we have sub headers under main column headers in flexigrid and display data specific to each sub header?
The requirement is that in the grid, i need to display the data for two time frames for each of columns that we have in the grid. Here in the sub headers i will keep the time frame values under the main column header.
Please let me know if this is possible in flexi grid or any other suggestions if you have.
Thanks in advance. | flexigrid | null | null | null | null | null | open | Sub headers in Flexigrid
===
can we have sub headers under main column headers in flexigrid and display data specific to each sub header?
The requirement is that in the grid, i need to display the data for two time frames for each of columns that we have in the grid. Here in the sub headers i will keep the time frame values under the main column header.
Please let me know if this is possible in flexi grid or any other suggestions if you have.
Thanks in advance. | 0 |
11,471,707 | 07/13/2012 13:44:01 | 1,467,076 | 06/19/2012 16:51:13 | 1 | 0 | How to use query for grid\enhancedGrid? | I want to sort information in a dojo EnhancedGrid (connected to database through JsonRestStore). I know dojo grids provide functionality to sort based on a single column. However, in my grid, one column contains combined information from multiple fields (e.g., last name, first name, email, age) of database table. Is there a simple way to sort the grid or the data in the store based on a single filed in database table (e.g., last name)?
It seems I can use "query" to change the view of the store (grid is a view of the store if I understand correctly), but I don't understand how to write a query to do that. Can anyone give me more information about the syntax of using query or how to solve this issue?
Thank you! | query | dojo | grid | store | null | null | open | How to use query for grid\enhancedGrid?
===
I want to sort information in a dojo EnhancedGrid (connected to database through JsonRestStore). I know dojo grids provide functionality to sort based on a single column. However, in my grid, one column contains combined information from multiple fields (e.g., last name, first name, email, age) of database table. Is there a simple way to sort the grid or the data in the store based on a single filed in database table (e.g., last name)?
It seems I can use "query" to change the view of the store (grid is a view of the store if I understand correctly), but I don't understand how to write a query to do that. Can anyone give me more information about the syntax of using query or how to solve this issue?
Thank you! | 0 |
11,471,709 | 07/13/2012 13:44:12 | 998,537 | 10/17/2011 05:01:19 | 197 | 4 | mouse hover, make only the text bold , the underline should be normal | simple html and css.
code:
<div class="link_my"> <a href="a.php">my link</a></div>
css:
.link_my a:hover{
font-weight:bold;
text-decoration:underline;
}
on mouse hover, the text font becomes bold along with the ubderline. But I want the underline to be normal (not bold).
How to do that ? | html | css | null | null | null | null | open | mouse hover, make only the text bold , the underline should be normal
===
simple html and css.
code:
<div class="link_my"> <a href="a.php">my link</a></div>
css:
.link_my a:hover{
font-weight:bold;
text-decoration:underline;
}
on mouse hover, the text font becomes bold along with the ubderline. But I want the underline to be normal (not bold).
How to do that ? | 0 |
11,471,714 | 07/13/2012 13:44:24 | 1,522,075 | 07/12/2012 21:26:22 | 1 | 0 | ASP.Net suppress postback for combobox only for OnSelectedIndexChanged | I am using an AJAX ComboBox in my ASP.Net web application and I have an OnItemInserted event that requires a postback to hit the server side logic however this requires that I have AutoPostBack set to True. This causes an unwanted effect of OnSelectedIndexChanged event triggering a Postback causing the control to lose focus.
More background: This combobox resides inside of a fairly complex gridview which contains other comboboxes, dropdownlists, and textboxes. My objective is to allow the user to smoothly tab through the row while entering data without having to use the mouse to promote rapid data entry.
I believe that I need to utilize javascript to suppress this postback but I am open to suggestions. | javascript | asp.net | ajax | combobox | autopostback | null | open | ASP.Net suppress postback for combobox only for OnSelectedIndexChanged
===
I am using an AJAX ComboBox in my ASP.Net web application and I have an OnItemInserted event that requires a postback to hit the server side logic however this requires that I have AutoPostBack set to True. This causes an unwanted effect of OnSelectedIndexChanged event triggering a Postback causing the control to lose focus.
More background: This combobox resides inside of a fairly complex gridview which contains other comboboxes, dropdownlists, and textboxes. My objective is to allow the user to smoothly tab through the row while entering data without having to use the mouse to promote rapid data entry.
I believe that I need to utilize javascript to suppress this postback but I am open to suggestions. | 0 |
11,471,715 | 07/13/2012 13:44:30 | 965,847 | 09/26/2011 21:12:44 | 140 | 2 | synchronization - accessing attributes | I have an app in Python using pygame (that is running in Thread1). There is a server in Thread2 that waits for pygame to do something (pygame has attribute "server" that referes to object of Thread1.)
Now when I store something in server object in thread1 (pygame) I cant access it from thread2 (server) -> it is something like this:
#Thread1
server = Server()
while not server.from_pygame:
# I am stuck here
time.sleep(2) # <= maybe this could allow access to attribute
continue
print server.from_pygame
#Thread2
pygame = Game(server_running_in_Thread1)
# Game class has in init => self.server = server_running_in_Thread1
# do some stuff
# let thread1 know I did something
self.server.from_pygame = True
# it seems that it never gets there :(
| python | multithreading | attributes | pygame | null | null | open | synchronization - accessing attributes
===
I have an app in Python using pygame (that is running in Thread1). There is a server in Thread2 that waits for pygame to do something (pygame has attribute "server" that referes to object of Thread1.)
Now when I store something in server object in thread1 (pygame) I cant access it from thread2 (server) -> it is something like this:
#Thread1
server = Server()
while not server.from_pygame:
# I am stuck here
time.sleep(2) # <= maybe this could allow access to attribute
continue
print server.from_pygame
#Thread2
pygame = Game(server_running_in_Thread1)
# Game class has in init => self.server = server_running_in_Thread1
# do some stuff
# let thread1 know I did something
self.server.from_pygame = True
# it seems that it never gets there :(
| 0 |
11,471,716 | 07/13/2012 13:44:33 | 1,482,559 | 06/26/2012 11:27:28 | 1 | 2 | window.closeDatabase()? | In phonegap when opening a database you write window.openDatabase().
Is it possible to close the connection and if so, is it necessary?
The reason I'm asking this is because I'm opening the database every time I'm inserting a value. Mayby I have misunderstood exactly how it works connecting to a database via phonegap but in .net I always close the connection after i have inserted something.
Thanks for answers! | phonegap | null | null | null | null | null | open | window.closeDatabase()?
===
In phonegap when opening a database you write window.openDatabase().
Is it possible to close the connection and if so, is it necessary?
The reason I'm asking this is because I'm opening the database every time I'm inserting a value. Mayby I have misunderstood exactly how it works connecting to a database via phonegap but in .net I always close the connection after i have inserted something.
Thanks for answers! | 0 |
11,401,242 | 07/09/2012 18:52:08 | 1,380,094 | 05/07/2012 15:26:40 | 1 | 0 | Can 1 PHP file connects to 2 databases? | I am trying to connect to the first database to pull some information, then update a table in the second database with that information.
However, the second query always tries to pull from the first database if I don't close the connection. If I do close the connection, then it gives me a socket error.
I am using Drupal (so my first database is the Drupal database). I want to get a value from one of those tables and put it in my Member Info database whenever 1 of 3 different PHP pages load.
Is this possible? | php | mysql | null | null | null | null | open | Can 1 PHP file connects to 2 databases?
===
I am trying to connect to the first database to pull some information, then update a table in the second database with that information.
However, the second query always tries to pull from the first database if I don't close the connection. If I do close the connection, then it gives me a socket error.
I am using Drupal (so my first database is the Drupal database). I want to get a value from one of those tables and put it in my Member Info database whenever 1 of 3 different PHP pages load.
Is this possible? | 0 |
11,401,244 | 07/09/2012 18:52:10 | 1,227,344 | 02/23/2012 02:41:31 | 1 | 1 | Jquery focus() variables and Activation Objects | I am not sure that this is a problem , but , I think this issue is actually a deeper one. The problem I am having is:
I have a function that tells what inputs are in focus. I'll call it "focussed_input". This function activates another function that does the dirty work. I'll call this one "dirty_work". When I console.log a variable that is created inside "dirty_work" console.log runs as many times as the input is focused and blurred.
What can I do to make sure that a function is executed only once no matter how many times an input is in focus??
var empty = {chars : null, last : null};
var imf = function (a,b){
console.log(a,b);
a.keypress(function(e){
var code = e.keyCode;
var str_code = String.fromCharCode(code);
if(empty.chars == null || empty.chars == undefined){
empty.chars = $('<img/>').attr('src','../links/images/graphics/characters/'+character_set[str_code]+'').addClass('chars').appendTo(b);
}
if(a.is(fixed.pa)){
var pannel_a_imgs = b.find('img.chars');
console.log($(pannel_a_imgs),$(pannel_a_imgs).length);
}else if(a.is(fixed.pb)){
var pannel_b_imgs = b.find('img.chars');
console.log($(pannel_b_imgs),$(pannel_b_imgs).length);
}
}).keydown(function(e){
}).keyup(function(e){
delete(empty.chars);
delete(empty.last);
});
};
focussed_inputs = function (a){
a.focus(function (e){
var obj = $(this);
if(obj.is(window)){
}else if(obj.is(fixed.pa)){
var pan_a = imf(fixed.pa,fixed.pannel_a);
}else if(obj.is(fixed.pb)){
var pan_b = imf(fixed.pb,fixed.pannel_b);
}
}).blur(function (){
delete(empty.chars);
delete(empty.last);
});
} | jquery | function | focus | variable-assignment | null | null | open | Jquery focus() variables and Activation Objects
===
I am not sure that this is a problem , but , I think this issue is actually a deeper one. The problem I am having is:
I have a function that tells what inputs are in focus. I'll call it "focussed_input". This function activates another function that does the dirty work. I'll call this one "dirty_work". When I console.log a variable that is created inside "dirty_work" console.log runs as many times as the input is focused and blurred.
What can I do to make sure that a function is executed only once no matter how many times an input is in focus??
var empty = {chars : null, last : null};
var imf = function (a,b){
console.log(a,b);
a.keypress(function(e){
var code = e.keyCode;
var str_code = String.fromCharCode(code);
if(empty.chars == null || empty.chars == undefined){
empty.chars = $('<img/>').attr('src','../links/images/graphics/characters/'+character_set[str_code]+'').addClass('chars').appendTo(b);
}
if(a.is(fixed.pa)){
var pannel_a_imgs = b.find('img.chars');
console.log($(pannel_a_imgs),$(pannel_a_imgs).length);
}else if(a.is(fixed.pb)){
var pannel_b_imgs = b.find('img.chars');
console.log($(pannel_b_imgs),$(pannel_b_imgs).length);
}
}).keydown(function(e){
}).keyup(function(e){
delete(empty.chars);
delete(empty.last);
});
};
focussed_inputs = function (a){
a.focus(function (e){
var obj = $(this);
if(obj.is(window)){
}else if(obj.is(fixed.pa)){
var pan_a = imf(fixed.pa,fixed.pannel_a);
}else if(obj.is(fixed.pb)){
var pan_b = imf(fixed.pb,fixed.pannel_b);
}
}).blur(function (){
delete(empty.chars);
delete(empty.last);
});
} | 0 |
11,401,249 | 07/09/2012 18:52:21 | 1,489,244 | 06/28/2012 16:38:42 | 1 | 0 | Javascript/Jquery: Cannot target Sibling Node in Table | I have a function that hides/shows a table by clicking on it's header which is contained in a <`thead`> tag. When clicked the table hides and all that is left is the header, which, by clicking again, can un-hide the table.
I have multiple tables and would like to only have to use on function, instead of writing one for each table. To do this I am trying to pass the arguments (this,this.lastSibling). For some reason **this.lastSibling** is not targeting any object. I've tried every way of navigating the node tree I can think of, but I cannot target the tbody.
**My Javascript/Jquery**
function Toggle(trigger,target){
if(document.getElementById('Test').style.display == 'none'){
$(document).ready(function(){
$(trigger).click(function(){
$(target).show();
Toggle(trigger,target)
});
});
}else{
$(document).ready(function(){
$(trigger).click(function(){
$(target).hide();
Toggle(trigger,target)
});
});
}
}
**My HTML**
<table class="format2" >
<thead onmouseover="Toggle(this,this.lastSibling)">
<!--Title-->
</thead>
<tbody>
<!--Cells with information in here-->
</tbody>
<!--Note No TFooter Tag-->
</table>
<--Other tables similar to the one above-->
Thanks in advance! | javascript | jquery | nodes | siblings | null | null | open | Javascript/Jquery: Cannot target Sibling Node in Table
===
I have a function that hides/shows a table by clicking on it's header which is contained in a <`thead`> tag. When clicked the table hides and all that is left is the header, which, by clicking again, can un-hide the table.
I have multiple tables and would like to only have to use on function, instead of writing one for each table. To do this I am trying to pass the arguments (this,this.lastSibling). For some reason **this.lastSibling** is not targeting any object. I've tried every way of navigating the node tree I can think of, but I cannot target the tbody.
**My Javascript/Jquery**
function Toggle(trigger,target){
if(document.getElementById('Test').style.display == 'none'){
$(document).ready(function(){
$(trigger).click(function(){
$(target).show();
Toggle(trigger,target)
});
});
}else{
$(document).ready(function(){
$(trigger).click(function(){
$(target).hide();
Toggle(trigger,target)
});
});
}
}
**My HTML**
<table class="format2" >
<thead onmouseover="Toggle(this,this.lastSibling)">
<!--Title-->
</thead>
<tbody>
<!--Cells with information in here-->
</tbody>
<!--Note No TFooter Tag-->
</table>
<--Other tables similar to the one above-->
Thanks in advance! | 0 |
11,401,252 | 07/09/2012 18:52:37 | 1,175,599 | 01/28/2012 19:16:33 | 2,943 | 234 | How to toggle class of clickable image | Our users have a table showing their titles. (They're contained in a datatable, if that matters). The idea is to simply have an image that they can click to toggle published or not. The below code *does change the image* as expected, but does *not change the class*.
I've also tried addclass/removeclass, but with the same results. Am I missing something obvious, or am I doing something completely wrong?
<img class="title_publish" src="IsNotPublished.png">'
<img class="title_unpublish" src="IsPublished.png">
$('.title_publish').live('click', function () {
this.src="IsPublished.png";
this.toggleClass("title_publish");
this.toggleClass("title_unpublish");
} );
$('.title_unpublish').live('click', function () {
this.src="IsNotPublished.png";
this.toggleClass="title_publish";
this.toggleClass="title_unpublish";
} );
| jquery | null | null | null | null | null | open | How to toggle class of clickable image
===
Our users have a table showing their titles. (They're contained in a datatable, if that matters). The idea is to simply have an image that they can click to toggle published or not. The below code *does change the image* as expected, but does *not change the class*.
I've also tried addclass/removeclass, but with the same results. Am I missing something obvious, or am I doing something completely wrong?
<img class="title_publish" src="IsNotPublished.png">'
<img class="title_unpublish" src="IsPublished.png">
$('.title_publish').live('click', function () {
this.src="IsPublished.png";
this.toggleClass("title_publish");
this.toggleClass("title_unpublish");
} );
$('.title_unpublish').live('click', function () {
this.src="IsNotPublished.png";
this.toggleClass="title_publish";
this.toggleClass="title_unpublish";
} );
| 0 |
11,401,254 | 07/09/2012 18:52:42 | 1,408,877 | 05/21/2012 21:44:09 | 32 | 1 | What's the difference between now() and time() in Python? | I´d like to know the difference between those two functions in Python (now() and time()) Thanks a lot! | python | null | null | null | null | null | open | What's the difference between now() and time() in Python?
===
I´d like to know the difference between those two functions in Python (now() and time()) Thanks a lot! | 0 |
11,401,256 | 07/09/2012 18:52:47 | 1,510,201 | 07/08/2012 15:23:12 | 3 | 0 | YouTube Fancybox not loading the video | I've setup a PHP video browser on a website (check videos pod) when a video thumbnail is clicked a video should popup and play with the FancyBox script, but instead the video just does not load. Why is this? http://charlieswebsites.co.uk/fearofmobs/site/ | javascript | jquery | youtube | fancybox | null | null | open | YouTube Fancybox not loading the video
===
I've setup a PHP video browser on a website (check videos pod) when a video thumbnail is clicked a video should popup and play with the FancyBox script, but instead the video just does not load. Why is this? http://charlieswebsites.co.uk/fearofmobs/site/ | 0 |
11,401,263 | 07/09/2012 18:53:11 | 267,869 | 02/06/2010 20:05:38 | 73 | 1 | Binding a Selected Value to a DropDownList inside a DetailsView | I have a DropDownList contained inside a DetailsView, but it is failing to work in Edit (Insert is fine). Basically the DropDownList is bound to a String List as the values are hardly going to change, and when in Insert mode I can see my list, which a value along with the rest of the form is being inserted into the database.
However, when a record is selected for editing via my gridview I am getting the following error "ddlAdminCodes has a selectedvalue which is invalid because it does not exist in the list of items. Parameter name:value". This is rubbish because it works in Insert mode and the records I am selecting for edit are the ones that have just been inserted plus I know that there are no other data value errors.
It is throwing this error on the page PreRender event where I am setting my detailsview to edit mode and firing off the select query on the record that needs editing. I cannot do this on the page load event because the gridview I am selecting from is a custom user control where I have set properties to exchange values between the page and the control.
I have also added a detailsview databound event to set up the dropdownlist control, which works on insert. Is there away of setting the dropdownlist when in edit mode?
Thanks
| detailsview | html.dropdownlist | null | null | null | null | open | Binding a Selected Value to a DropDownList inside a DetailsView
===
I have a DropDownList contained inside a DetailsView, but it is failing to work in Edit (Insert is fine). Basically the DropDownList is bound to a String List as the values are hardly going to change, and when in Insert mode I can see my list, which a value along with the rest of the form is being inserted into the database.
However, when a record is selected for editing via my gridview I am getting the following error "ddlAdminCodes has a selectedvalue which is invalid because it does not exist in the list of items. Parameter name:value". This is rubbish because it works in Insert mode and the records I am selecting for edit are the ones that have just been inserted plus I know that there are no other data value errors.
It is throwing this error on the page PreRender event where I am setting my detailsview to edit mode and firing off the select query on the record that needs editing. I cannot do this on the page load event because the gridview I am selecting from is a custom user control where I have set properties to exchange values between the page and the control.
I have also added a detailsview databound event to set up the dropdownlist control, which works on insert. Is there away of setting the dropdownlist when in edit mode?
Thanks
| 0 |
11,401,264 | 07/09/2012 18:53:16 | 190,758 | 10/15/2009 16:49:25 | 187 | 4 | GCMBroadcastReceiver lacks WAKE_LOCK permission that is declared in manifest | I've implemented GCM as closely to Google's examples as I can, but the default GCMBroadcastReceiver is throwing a SecurityException for lack of the WAKE_LOCK permission. I require it in the my manifest, though, so AFAIK it should have that permission at run-time. Here's the relevant portion of my manifest:
<permission
android:name="PACKAGENAME.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="PACKAGENAME.permission.C2D_MESSAGE" />
<permission
android:name="android.permission.WAKE_LOCK"
android:protectionLevel="signatureOrSystem" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application
android:name=".App"
android:icon="@drawable/app"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<service android:name=".GCMIntentService" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="PACKAGENAME" />
</intent-filter>
</receiver>
The exception I see in the log file is:
07-09 13:32:58.238: E/AndroidRuntime(2723): java.lang.RuntimeException: Unable to start receiver com.google.android.gcm.GCMBroadcastReceiver: java.lang.SecurityException: Neither user 10072 nor current process has android.permission.WAKE_LOCK.
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2126)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Looper.loop(Looper.java:137)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-09 13:32:58.238: E/AndroidRuntime(2723): at java.lang.reflect.Method.invokeNative(Native Method)
07-09 13:32:58.238: E/AndroidRuntime(2723): at java.lang.reflect.Method.invoke(Method.java:511)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-09 13:32:58.238: E/AndroidRuntime(2723): at dalvik.system.NativeStart.main(Native Method)
07-09 13:32:58.238: E/AndroidRuntime(2723): Caused by: java.lang.SecurityException: Neither user 10072 nor current process has android.permission.WAKE_LOCK.
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Parcel.readException(Parcel.java:1327)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Parcel.readException(Parcel.java:1281)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.IPowerManager$Stub$Proxy.acquireWakeLock(IPowerManager.java:279)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.PowerManager$WakeLock.acquireLocked(PowerManager.java:285)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.PowerManager$WakeLock.acquire(PowerManager.java:264)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.google.android.gcm.GCMBaseIntentService.runIntentInService(GCMBaseIntentService.java:235)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.google.android.gcm.GCMBroadcastReceiver.onReceive(GCMBroadcastReceiver.java:46)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2119)
07-09 13:32:58.238: E/AndroidRuntime(2723): ... 10 more
| android | android-manifest | android-gcm | android-permissions | null | null | open | GCMBroadcastReceiver lacks WAKE_LOCK permission that is declared in manifest
===
I've implemented GCM as closely to Google's examples as I can, but the default GCMBroadcastReceiver is throwing a SecurityException for lack of the WAKE_LOCK permission. I require it in the my manifest, though, so AFAIK it should have that permission at run-time. Here's the relevant portion of my manifest:
<permission
android:name="PACKAGENAME.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="PACKAGENAME.permission.C2D_MESSAGE" />
<permission
android:name="android.permission.WAKE_LOCK"
android:protectionLevel="signatureOrSystem" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application
android:name=".App"
android:icon="@drawable/app"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<service android:name=".GCMIntentService" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="PACKAGENAME" />
</intent-filter>
</receiver>
The exception I see in the log file is:
07-09 13:32:58.238: E/AndroidRuntime(2723): java.lang.RuntimeException: Unable to start receiver com.google.android.gcm.GCMBroadcastReceiver: java.lang.SecurityException: Neither user 10072 nor current process has android.permission.WAKE_LOCK.
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2126)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Looper.loop(Looper.java:137)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-09 13:32:58.238: E/AndroidRuntime(2723): at java.lang.reflect.Method.invokeNative(Native Method)
07-09 13:32:58.238: E/AndroidRuntime(2723): at java.lang.reflect.Method.invoke(Method.java:511)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-09 13:32:58.238: E/AndroidRuntime(2723): at dalvik.system.NativeStart.main(Native Method)
07-09 13:32:58.238: E/AndroidRuntime(2723): Caused by: java.lang.SecurityException: Neither user 10072 nor current process has android.permission.WAKE_LOCK.
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Parcel.readException(Parcel.java:1327)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.Parcel.readException(Parcel.java:1281)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.IPowerManager$Stub$Proxy.acquireWakeLock(IPowerManager.java:279)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.PowerManager$WakeLock.acquireLocked(PowerManager.java:285)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.os.PowerManager$WakeLock.acquire(PowerManager.java:264)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.google.android.gcm.GCMBaseIntentService.runIntentInService(GCMBaseIntentService.java:235)
07-09 13:32:58.238: E/AndroidRuntime(2723): at com.google.android.gcm.GCMBroadcastReceiver.onReceive(GCMBroadcastReceiver.java:46)
07-09 13:32:58.238: E/AndroidRuntime(2723): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2119)
07-09 13:32:58.238: E/AndroidRuntime(2723): ... 10 more
| 0 |
11,401,266 | 07/09/2012 18:53:24 | 1,428,019 | 05/31/2012 09:30:11 | 75 | 2 | CurrentWorkItem.ID is correct or Not in workflow script editor? | I am using Tridion 2011 SP1, And I am creating workflow like start-->create-->Review-->publish--Stop.
Created and registered the class library, and invoking the c# method using vbscript (Script Editor of WF Tab) as givne below.
Option Explicit
Dim workflowHandler
Set workflowHandler= CreateObject("CoreComponentWorkflow.WorkflowHandler")
If Not workflowHandler Is Nothing Then
Call workflowHandler.PublishComponent(Cstr(CurrentWorkItem.ID))
FinishActivity "Published to WIP"
End If
Set workflowHandler= Nothing
Is the above code is correct? I am sure i could able to create object using the below line.
Set workflowHandler= CreateObject("CoreComponentWorkflow.WorkflowHandler")
And currently i am publishing the currentitem only using the c# code, am calling the c# function as below.
Call workflowHandler.PublishComponent(Cstr(CurrentWorkItem.ID))
After publishing the item, am finishing the activity using below.
FinishActivity "Published to WIP"
I have checked the above code directly in the server by hard coding the currentworkitem, it was working fine. but when i put the same code in vbscript editor, item is not published.
Can any one suggest on this? | tridion | tridion-2011 | null | null | null | null | open | CurrentWorkItem.ID is correct or Not in workflow script editor?
===
I am using Tridion 2011 SP1, And I am creating workflow like start-->create-->Review-->publish--Stop.
Created and registered the class library, and invoking the c# method using vbscript (Script Editor of WF Tab) as givne below.
Option Explicit
Dim workflowHandler
Set workflowHandler= CreateObject("CoreComponentWorkflow.WorkflowHandler")
If Not workflowHandler Is Nothing Then
Call workflowHandler.PublishComponent(Cstr(CurrentWorkItem.ID))
FinishActivity "Published to WIP"
End If
Set workflowHandler= Nothing
Is the above code is correct? I am sure i could able to create object using the below line.
Set workflowHandler= CreateObject("CoreComponentWorkflow.WorkflowHandler")
And currently i am publishing the currentitem only using the c# code, am calling the c# function as below.
Call workflowHandler.PublishComponent(Cstr(CurrentWorkItem.ID))
After publishing the item, am finishing the activity using below.
FinishActivity "Published to WIP"
I have checked the above code directly in the server by hard coding the currentworkitem, it was working fine. but when i put the same code in vbscript editor, item is not published.
Can any one suggest on this? | 0 |
11,401,131 | 07/09/2012 18:44:40 | 1,500,452 | 07/04/2012 03:47:14 | 1 | 0 | How can I populate a JTree with an FTP directory? | I am using FTP4j and I want to populate a JTree with the root directory of an FTP server. I've tried using FTP4j's currentDirectory() method, but that only returns a "/" which isn't useful. I've also tried passing the ftp:// url to a method that initializes the JTree, which doesn't work either. This is my first Swing program so I'm kind of stumped on where to go. Here is the code:
package net.emptybox.ui;
import java.awt.EventQueue;
import javax.swing.JFrame;
import net.miginfocom.swing.MigLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import javax.swing.BoxLayout;
import javax.swing.JSplitPane;
import javax.swing.JSeparator;
import javax.swing.JTree;
import javax.swing.JTextArea;
import java.awt.Component;
import java.io.File;
import net.emptybox.ui.FTP;
import javax.swing.Box;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
public class GUI {
static JFrame frame;
static private JSplitPane splitPane;
static private JLabel lblServer;
static private JTextField serverField;
static private JLabel lblPort;
static private JTextField portField;
static private JLabel lblUsername;
static private JTextField usernameField;
static private JLabel lblPassword;
static private JTextField passwordField;
static private JButton connectButton;
static private JSeparator separator;
static private JTextArea detailArea;
static private JButton downloadButton;
static private JButton uploadButton;
static private Component horizontalGlue;
static private JTextField fileField;
static private JButton goButton;
static private Component horizontalGlue_1;
static FileSystemModel fileSystemModel;
static JLabel consoleLabel;
private static Component verticalGlue;
private static JScrollPane scrollPane;
static JTree fileTree;
/**
* Launch the application.
*/
/**
* Create the application.
*/
public GUI() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
public static void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 648, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new MigLayout("", "[grow]", "[][][][grow][]"));
lblServer = new JLabel("Server:");
frame.getContentPane().add(lblServer, "flowx,cell 0 0");
consoleLabel = new JLabel("");
frame.getContentPane().add(consoleLabel, "flowx,cell 0 1");
separator = new JSeparator();
frame.getContentPane().add(separator, "cell 0 2");
splitPane = new JSplitPane();
splitPane.setOneTouchExpandable(true);
splitPane.setContinuousLayout(true);
frame.getContentPane().add(splitPane, "cell 0 3,grow");
detailArea = new JTextArea();
detailArea.setEditable(false);
splitPane.setRightComponent(detailArea);
scrollPane = new JScrollPane();
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
splitPane.setLeftComponent(scrollPane);
serverField = new JTextField();
frame.getContentPane().add(serverField, "cell 0 0,growx");
lblPort = new JLabel("Port:");
frame.getContentPane().add(lblPort, "cell 0 0");
portField = new JTextField();
frame.getContentPane().add(portField, "cell 0 0,growx");
lblUsername = new JLabel("Username:");
frame.getContentPane().add(lblUsername, "cell 0 0");
usernameField = new JTextField();
frame.getContentPane().add(usernameField, "cell 0 0,growx");
lblPassword = new JLabel("Password:");
frame.getContentPane().add(lblPassword, "cell 0 0");
passwordField = new JTextField();
frame.getContentPane().add(passwordField, "cell 0 0,growx");
connectButton = new JButton("Connect");
frame.getContentPane().add(connectButton, "cell 0 0");
if (serverField.getText() == null || usernameField.getText() == null || passwordField.getText() == null) {
connectButton.disable();
} else {
connectButton.enable();
}
if (portField.getText() == null) {
portField.setText("21");
}
connectButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
FTP.connect(serverField.getText(), portField.getText(), usernameField.getText(), passwordField.getText());
}
});
downloadButton = new JButton("Download");
frame.getContentPane().add(downloadButton, "flowx,cell 0 4");
downloadButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
uploadButton = new JButton("Upload");
frame.getContentPane().add(uploadButton, "cell 0 4");
uploadButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
horizontalGlue_1 = Box.createHorizontalGlue();
frame.getContentPane().add(horizontalGlue_1, "cell 0 4,growx");
fileField = new JTextField();
frame.getContentPane().add(fileField, "cell 0 4");
fileField.setColumns(200);
goButton = new JButton("Go");
goButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
frame.getContentPane().add(goButton, "cell 0 4");
horizontalGlue = Box.createHorizontalGlue();
frame.getContentPane().add(horizontalGlue, "cell 0 4,alignx leading");
verticalGlue = Box.createVerticalGlue();
frame.getContentPane().add(verticalGlue, "cell 0 1");
}
private String getFileDetails(File file) {
if (file == null)
return "";
StringBuffer buffer = new StringBuffer();
buffer.append("Name: " + file.getName() + "\n");
buffer.append("Path: " + file.getPath() + "\n");
buffer.append("Size: " + file.length() + "\n");
return buffer.toString();
}
public static void populateTree(String directory) {
fileSystemModel = new FileSystemModel(new File(directory));
fileTree = new JTree(fileSystemModel);
scrollPane.setViewportView(fileTree);
}
}
Populate tree is called by another class when a connection is successfully established with the server and the user has logged in. | java | swing | jtree | null | null | null | open | How can I populate a JTree with an FTP directory?
===
I am using FTP4j and I want to populate a JTree with the root directory of an FTP server. I've tried using FTP4j's currentDirectory() method, but that only returns a "/" which isn't useful. I've also tried passing the ftp:// url to a method that initializes the JTree, which doesn't work either. This is my first Swing program so I'm kind of stumped on where to go. Here is the code:
package net.emptybox.ui;
import java.awt.EventQueue;
import javax.swing.JFrame;
import net.miginfocom.swing.MigLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import javax.swing.BoxLayout;
import javax.swing.JSplitPane;
import javax.swing.JSeparator;
import javax.swing.JTree;
import javax.swing.JTextArea;
import java.awt.Component;
import java.io.File;
import net.emptybox.ui.FTP;
import javax.swing.Box;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
public class GUI {
static JFrame frame;
static private JSplitPane splitPane;
static private JLabel lblServer;
static private JTextField serverField;
static private JLabel lblPort;
static private JTextField portField;
static private JLabel lblUsername;
static private JTextField usernameField;
static private JLabel lblPassword;
static private JTextField passwordField;
static private JButton connectButton;
static private JSeparator separator;
static private JTextArea detailArea;
static private JButton downloadButton;
static private JButton uploadButton;
static private Component horizontalGlue;
static private JTextField fileField;
static private JButton goButton;
static private Component horizontalGlue_1;
static FileSystemModel fileSystemModel;
static JLabel consoleLabel;
private static Component verticalGlue;
private static JScrollPane scrollPane;
static JTree fileTree;
/**
* Launch the application.
*/
/**
* Create the application.
*/
public GUI() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
public static void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 648, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new MigLayout("", "[grow]", "[][][][grow][]"));
lblServer = new JLabel("Server:");
frame.getContentPane().add(lblServer, "flowx,cell 0 0");
consoleLabel = new JLabel("");
frame.getContentPane().add(consoleLabel, "flowx,cell 0 1");
separator = new JSeparator();
frame.getContentPane().add(separator, "cell 0 2");
splitPane = new JSplitPane();
splitPane.setOneTouchExpandable(true);
splitPane.setContinuousLayout(true);
frame.getContentPane().add(splitPane, "cell 0 3,grow");
detailArea = new JTextArea();
detailArea.setEditable(false);
splitPane.setRightComponent(detailArea);
scrollPane = new JScrollPane();
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
splitPane.setLeftComponent(scrollPane);
serverField = new JTextField();
frame.getContentPane().add(serverField, "cell 0 0,growx");
lblPort = new JLabel("Port:");
frame.getContentPane().add(lblPort, "cell 0 0");
portField = new JTextField();
frame.getContentPane().add(portField, "cell 0 0,growx");
lblUsername = new JLabel("Username:");
frame.getContentPane().add(lblUsername, "cell 0 0");
usernameField = new JTextField();
frame.getContentPane().add(usernameField, "cell 0 0,growx");
lblPassword = new JLabel("Password:");
frame.getContentPane().add(lblPassword, "cell 0 0");
passwordField = new JTextField();
frame.getContentPane().add(passwordField, "cell 0 0,growx");
connectButton = new JButton("Connect");
frame.getContentPane().add(connectButton, "cell 0 0");
if (serverField.getText() == null || usernameField.getText() == null || passwordField.getText() == null) {
connectButton.disable();
} else {
connectButton.enable();
}
if (portField.getText() == null) {
portField.setText("21");
}
connectButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
FTP.connect(serverField.getText(), portField.getText(), usernameField.getText(), passwordField.getText());
}
});
downloadButton = new JButton("Download");
frame.getContentPane().add(downloadButton, "flowx,cell 0 4");
downloadButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
uploadButton = new JButton("Upload");
frame.getContentPane().add(uploadButton, "cell 0 4");
uploadButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
horizontalGlue_1 = Box.createHorizontalGlue();
frame.getContentPane().add(horizontalGlue_1, "cell 0 4,growx");
fileField = new JTextField();
frame.getContentPane().add(fileField, "cell 0 4");
fileField.setColumns(200);
goButton = new JButton("Go");
goButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
frame.getContentPane().add(goButton, "cell 0 4");
horizontalGlue = Box.createHorizontalGlue();
frame.getContentPane().add(horizontalGlue, "cell 0 4,alignx leading");
verticalGlue = Box.createVerticalGlue();
frame.getContentPane().add(verticalGlue, "cell 0 1");
}
private String getFileDetails(File file) {
if (file == null)
return "";
StringBuffer buffer = new StringBuffer();
buffer.append("Name: " + file.getName() + "\n");
buffer.append("Path: " + file.getPath() + "\n");
buffer.append("Size: " + file.length() + "\n");
return buffer.toString();
}
public static void populateTree(String directory) {
fileSystemModel = new FileSystemModel(new File(directory));
fileTree = new JTree(fileSystemModel);
scrollPane.setViewportView(fileTree);
}
}
Populate tree is called by another class when a connection is successfully established with the server and the user has logged in. | 0 |
11,226,917 | 06/27/2012 13:05:35 | 549,557 | 12/21/2010 06:33:54 | 28 | 5 | Sync Related tables with MS Sync framework | I have the following tables in my application.
User (UserID, ......)
Category (CategoryId, ......)
UserCategory (UserId, CategoryId);
Item (ItemId, CategoryId,......)
The "UserCategory" table is used to control access to items. A given user only has access to items that belongs to categories that he has access to. I need to sync this data to a iPad app (its one way sync and no data is modified on the iPad). I use a filter to make sure that only relevant categories and items are sent to the client app. The problem is if later we assign an existing category to a user the items belonging to the category are not synced. | .net | synchronization | microsoft-sync-framework | null | null | null | open | Sync Related tables with MS Sync framework
===
I have the following tables in my application.
User (UserID, ......)
Category (CategoryId, ......)
UserCategory (UserId, CategoryId);
Item (ItemId, CategoryId,......)
The "UserCategory" table is used to control access to items. A given user only has access to items that belongs to categories that he has access to. I need to sync this data to a iPad app (its one way sync and no data is modified on the iPad). I use a filter to make sure that only relevant categories and items are sent to the client app. The problem is if later we assign an existing category to a user the items belonging to the category are not synced. | 0 |
11,226,918 | 06/27/2012 13:05:38 | 1,376,992 | 05/05/2012 15:30:43 | 1 | 0 | Facebook like error - disabled/not visible | We've got a number of content managed sites that use the same functionality. We added a site recently, and the Facebook like button is failing with an error on-click (following Facebook login):
> This page is either disabled or not visible to the current user.
This only happens when the Facebook user isn't an administrator of the page, or of an application we've created for the page.
The site where this is failing is here: http://beachhousemilfordonsea.co.uk/
An example of a site that works (same code): http://monmouthash.co.uk/
The Facebook like code:
<fb:like href="http://beachhousemilfordonsea.co.uk/" width="380"></fb:like>
**Actions already taken**
I've checked with the FB Linter and there are a couple of Opengraph warnings that do need to be fixed (add a description, increase the image size) - but these are the same for all sites so should be affecting this (it's on the dev plan to get these rectified in the next release).
I've taken a look at the Facebook App we've got running on the problem page, and checked it against other working applications and the settings are the same as far as I can see, except there are missing options with this new application:
* Encrypted access token (assume this is default, not changeable now)
* Include recent activity stories
It doesn't feel like the application should have much of an impact on this though, as we use the application for the other functionality within the page (which is all working fine!).
I've searched for possible issues, and checked the more common ones:
* There are no age/geographic restrictions
* I've submitted 2 requests to Facebook in case the content is blocked, but no response or change
Any recommendations as to what else to try?
Thanks in advance,
Kev
P.S. I asked this question a week ago but it wasn't well formed - hopefully this is a better attempt, but if you need anything else please do let me know.
| javascript | facebook-like | null | null | null | null | open | Facebook like error - disabled/not visible
===
We've got a number of content managed sites that use the same functionality. We added a site recently, and the Facebook like button is failing with an error on-click (following Facebook login):
> This page is either disabled or not visible to the current user.
This only happens when the Facebook user isn't an administrator of the page, or of an application we've created for the page.
The site where this is failing is here: http://beachhousemilfordonsea.co.uk/
An example of a site that works (same code): http://monmouthash.co.uk/
The Facebook like code:
<fb:like href="http://beachhousemilfordonsea.co.uk/" width="380"></fb:like>
**Actions already taken**
I've checked with the FB Linter and there are a couple of Opengraph warnings that do need to be fixed (add a description, increase the image size) - but these are the same for all sites so should be affecting this (it's on the dev plan to get these rectified in the next release).
I've taken a look at the Facebook App we've got running on the problem page, and checked it against other working applications and the settings are the same as far as I can see, except there are missing options with this new application:
* Encrypted access token (assume this is default, not changeable now)
* Include recent activity stories
It doesn't feel like the application should have much of an impact on this though, as we use the application for the other functionality within the page (which is all working fine!).
I've searched for possible issues, and checked the more common ones:
* There are no age/geographic restrictions
* I've submitted 2 requests to Facebook in case the content is blocked, but no response or change
Any recommendations as to what else to try?
Thanks in advance,
Kev
P.S. I asked this question a week ago but it wasn't well formed - hopefully this is a better attempt, but if you need anything else please do let me know.
| 0 |
11,226,923 | 06/27/2012 13:06:00 | 126,483 | 06/21/2009 13:47:02 | 1,856 | 10 | Ensuring business rule is not broken with multiple users | Suppose I have an order which has order lines and we have a multi-user system where different users can add order lines. Orders are persisted to the database
One business rule is that only 10 order lines can be created for an order.
What are my options to ensure that this rule is not broken? Should I check in memory and apply a lock or do I handle this in the database via procedures? | sql | database | domain-driven-design | null | null | null | open | Ensuring business rule is not broken with multiple users
===
Suppose I have an order which has order lines and we have a multi-user system where different users can add order lines. Orders are persisted to the database
One business rule is that only 10 order lines can be created for an order.
What are my options to ensure that this rule is not broken? Should I check in memory and apply a lock or do I handle this in the database via procedures? | 0 |
11,226,924 | 06/27/2012 13:06:03 | 660,395 | 03/15/2011 10:41:11 | 37 | 1 | Spring AbstractRoutingDataSource backrgound threads | We are building a multi-tenant server with a database/schema per tenant.
To do this we use Springs AbstractRoutingDataSource to switch the data source based on the tenant.
The tenant is determined by the sub domain of the url in a servlet filter.
This tenant is stored in a thread-local.
This all works fine until a thread is started.
For example when hibernate search re-indexes it starts a lot threads.
When one of these threads tries to get a connection the thread local returns null and i have no way to determine the tenant.
Can anyone point me in the right direction of solving this? | multithreading | spring | null | null | null | null | open | Spring AbstractRoutingDataSource backrgound threads
===
We are building a multi-tenant server with a database/schema per tenant.
To do this we use Springs AbstractRoutingDataSource to switch the data source based on the tenant.
The tenant is determined by the sub domain of the url in a servlet filter.
This tenant is stored in a thread-local.
This all works fine until a thread is started.
For example when hibernate search re-indexes it starts a lot threads.
When one of these threads tries to get a connection the thread local returns null and i have no way to determine the tenant.
Can anyone point me in the right direction of solving this? | 0 |
11,226,926 | 06/27/2012 13:06:06 | 975,959 | 10/03/2011 01:33:30 | 554 | 19 | Java JTable with JComboBox | I'm trying to place a JComboBox inside a certain column of a JTable.
I have this code, and it is working:
model = new DefaultTableModel();
JComboBox<String> optionComboCell = new JComboBox<String>();
optionComboCell.addItem("Option 1");
optionComboCell.addItem("Option 2");
optionComboCell.setSelectedIndex(1);
table = new JTable(model);
// Adding here all the columns, removed for clarity
model.addColumn("Options");
TableColumn optionsColumn = table.getColumn("Options");
optionsColumn.setCellEditor(new DefaultCellEditor(optionComboCell));
My problem with this, is that it doesn't show as JComboBox until a cell in that column is selected.
When the JFrame is loaded, the whole table looks the same, as if all the cells where only text.
When clicked, it shows the combo box's arrow and options, but again when deselected, it looks like a regular cell.
Any way to get around that? | java | swing | gui | null | null | null | open | Java JTable with JComboBox
===
I'm trying to place a JComboBox inside a certain column of a JTable.
I have this code, and it is working:
model = new DefaultTableModel();
JComboBox<String> optionComboCell = new JComboBox<String>();
optionComboCell.addItem("Option 1");
optionComboCell.addItem("Option 2");
optionComboCell.setSelectedIndex(1);
table = new JTable(model);
// Adding here all the columns, removed for clarity
model.addColumn("Options");
TableColumn optionsColumn = table.getColumn("Options");
optionsColumn.setCellEditor(new DefaultCellEditor(optionComboCell));
My problem with this, is that it doesn't show as JComboBox until a cell in that column is selected.
When the JFrame is loaded, the whole table looks the same, as if all the cells where only text.
When clicked, it shows the combo box's arrow and options, but again when deselected, it looks like a regular cell.
Any way to get around that? | 0 |
11,588,061 | 07/20/2012 23:11:07 | 1,123,599 | 12/30/2011 21:58:36 | 49 | 0 | Iconbitmap freezing python application | Hi I am having a really weird problem with the icon. Running the following code freezes (hangs) the application...Any ideas?
import tkinter
import _thread
root = tkinter.Tk()
_thread.start_new_thread(root.mainloop,())
root.iconbitmap(bitmap='email_icon.ico')
| python | bitmap | icons | null | null | null | open | Iconbitmap freezing python application
===
Hi I am having a really weird problem with the icon. Running the following code freezes (hangs) the application...Any ideas?
import tkinter
import _thread
root = tkinter.Tk()
_thread.start_new_thread(root.mainloop,())
root.iconbitmap(bitmap='email_icon.ico')
| 0 |
11,588,090 | 07/20/2012 23:16:43 | 271,619 | 02/12/2010 05:42:07 | 925 | 6 | Lua Comparison Operators (wildcard?) | I'm new to Lua, so I'm learning the operators part now.
Is there a wildcard character that works with strings in Lua?
I come from a PHP background and I'm essentially trying to code this:
--scan the directory's files
for file in lfs.dir(doc_path) do
--> look for any files ending with .jpg
if file is like ".jpg" then
--do something if any files ending with .JPG are scanned
end
end
You'll see I'm looking out for JPG files, while I'm looping through files in a directory.
I'm used to the percentage sign, or asterisk character for searching strings.
But perhaps Lua has a different way?
Also, I'm totally guessing with the statement: "if file is like......."
| lua | operators | null | null | null | null | open | Lua Comparison Operators (wildcard?)
===
I'm new to Lua, so I'm learning the operators part now.
Is there a wildcard character that works with strings in Lua?
I come from a PHP background and I'm essentially trying to code this:
--scan the directory's files
for file in lfs.dir(doc_path) do
--> look for any files ending with .jpg
if file is like ".jpg" then
--do something if any files ending with .JPG are scanned
end
end
You'll see I'm looking out for JPG files, while I'm looping through files in a directory.
I'm used to the percentage sign, or asterisk character for searching strings.
But perhaps Lua has a different way?
Also, I'm totally guessing with the statement: "if file is like......."
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.