Will changing an events Time-Zone affect other people on shared events?
If I were to normalize an EKEvent 's startDate property using a
NSFormatter or by setting the time zone with
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"hh:mm a"];
[formatter setTimeZone:[NSTimeZone systemTimeZone]];
event.startDate = [formatter dateFromString:[NSString
stringWithFormat:@"%@", [event.startDate]]];
and I later make a change to that event requiring me to call
[self.event.eventStore saveEvent:currentEvent span:EKSpanThisEvent
commit:YES error:nil];
Would it override the time-zone on the server, causing issues for the
person (whom uses GCal) in another state that originally created that
shared calendar event, or is it just a local change?
Saturday, 31 August 2013
Printed page information within PDF file
Printed page information within PDF file
I just opened my PDF file using the default PDF reader on Ubuntu, and when
I tried to print it, the "Pages" box was already filled with "108-115". I
was surprised, because that's the page number that I printed from this
file last time, which was many days ago!
I wonder where the "last printed page information" is stored. Is it in the
PDF file itself, or is it somewhere else in the computer?
I just opened my PDF file using the default PDF reader on Ubuntu, and when
I tried to print it, the "Pages" box was already filled with "108-115". I
was surprised, because that's the page number that I printed from this
file last time, which was many days ago!
I wonder where the "last printed page information" is stored. Is it in the
PDF file itself, or is it somewhere else in the computer?
Learning R - progression path from apprentice to guru
Learning R - progression path from apprentice to guru
Inspired by this thread on stackoverflow about learning Python, I want to
ask about how to constantly improve my R programming skills. I am a
stat-focused social science PhD who has fallen in love with R for a year
and who is looking to push my R skills to the level of package writers.
While I understand the importance of "learning by doing," I also feel that
we need a road map to even know what is possible to do, and hence, learn.
(For example, I wish I knew about ggplot2 / plyr much sooner). Another
important reason for a road map is that I want to have a vision of good
coding practices / techniques rather than learning inefficiently by fixing
each bug / inelegant piece of code.
Like the stackoverflow thread,
I don't want to know how to QUICKLY learn R
Nor do I want to find out the best way to get acquainted with the language
Finally, I don't want to know a 'one trick that does it all' approach.
A good road map may look like this:
Read this, pay attention to that kind of details
Code for so manytime/problems/lines of code
Then, read this (eg: this or that book), but this time, pay attention to this
Tackle a few real-life problems
Then, proceed to reading Y.
Be sure to grasp these concepts
Code for X time
Come back to such and such basics or move further to...
I'm sure that, like me, many are more than happy to spend serious time
with R. We just need a road map for that journey.
Inspired by this thread on stackoverflow about learning Python, I want to
ask about how to constantly improve my R programming skills. I am a
stat-focused social science PhD who has fallen in love with R for a year
and who is looking to push my R skills to the level of package writers.
While I understand the importance of "learning by doing," I also feel that
we need a road map to even know what is possible to do, and hence, learn.
(For example, I wish I knew about ggplot2 / plyr much sooner). Another
important reason for a road map is that I want to have a vision of good
coding practices / techniques rather than learning inefficiently by fixing
each bug / inelegant piece of code.
Like the stackoverflow thread,
I don't want to know how to QUICKLY learn R
Nor do I want to find out the best way to get acquainted with the language
Finally, I don't want to know a 'one trick that does it all' approach.
A good road map may look like this:
Read this, pay attention to that kind of details
Code for so manytime/problems/lines of code
Then, read this (eg: this or that book), but this time, pay attention to this
Tackle a few real-life problems
Then, proceed to reading Y.
Be sure to grasp these concepts
Code for X time
Come back to such and such basics or move further to...
I'm sure that, like me, many are more than happy to spend serious time
with R. We just need a road map for that journey.
Knockout + Moment.js Update relative dates inside an observable
Knockout + Moment.js – Update relative dates inside an observable
Inside my list of completed tasks, I used Moment.js's fromNow() to list
the relative date of completion for each task. Here's the task model:
Task.Model = function(data) {
this.id = data.id;
this.title = ko.observable(data.title);
this.status = ko.observable(data.status);
this.completed = ko.observable(moment(data.date_completed).fromNow());
};
The relative date shows up, but the minutes never update, unless I
refresh. Is there any way to update that observable?
Inside my list of completed tasks, I used Moment.js's fromNow() to list
the relative date of completion for each task. Here's the task model:
Task.Model = function(data) {
this.id = data.id;
this.title = ko.observable(data.title);
this.status = ko.observable(data.status);
this.completed = ko.observable(moment(data.date_completed).fromNow());
};
The relative date shows up, but the minutes never update, unless I
refresh. Is there any way to update that observable?
converting a float to decimal type in Python
converting a float to decimal type in Python
I have an array that grows with each iteration of a loop:
for i in range(100):
frac[i] = some fraction between 0 and 1 with many decimal places
This all works fine. When I check the type(frac[i]), I am told that it is
'numpy.float64'.
For my code to be as precise as I need it to be, I need to use the decimal
module and change each frac[i] to the decimal type.
I updated my code:
for i in range(100):
frac[i] = some fraction between 0 and 1 with many decimal places
frac[i] = decimal.Decimal(frac[i])
But when I check the type, I am STILL told that frac[i] is 'numpy.float64'.
I have managed to change other variables to decimal in this way before, so
I wonder if you could tell me why this doesn't seem to work.
Thank you.
I have an array that grows with each iteration of a loop:
for i in range(100):
frac[i] = some fraction between 0 and 1 with many decimal places
This all works fine. When I check the type(frac[i]), I am told that it is
'numpy.float64'.
For my code to be as precise as I need it to be, I need to use the decimal
module and change each frac[i] to the decimal type.
I updated my code:
for i in range(100):
frac[i] = some fraction between 0 and 1 with many decimal places
frac[i] = decimal.Decimal(frac[i])
But when I check the type, I am STILL told that frac[i] is 'numpy.float64'.
I have managed to change other variables to decimal in this way before, so
I wonder if you could tell me why this doesn't seem to work.
Thank you.
How can I prevent a page from loading if there is no javascript, but using php instead of ?
How can I prevent a page from loading if there is no javascript, but using
php instead of ?
I have a page with php and other stuff in the code. What I need to do is a
way to check with php if there is javascript enabled in the browser. This
way, the whole page source will be prevented to be loaded, instead of
using that only prevents the page from loading, but allows the source
code.
php instead of ?
I have a page with php and other stuff in the code. What I need to do is a
way to check with php if there is javascript enabled in the browser. This
way, the whole page source will be prevented to be loaded, instead of
using that only prevents the page from loading, but allows the source
code.
Regex to replace all string literals in a Java file
Regex to replace all string literals in a Java file
In my program I will be reading a java file line by line, and if there is
any string literal in that line, i will replace it with (say) "ABC".
Is there any regex to do so?
Ex. If the Java file passed to my program is:
public class TestClass {
private static final boolean isNotThis = false;
public static void main(String[] args) {
String x = "This is a test String";
dummyMethodCall();
if(isNotThis){
makeItThat();
System.out.println("work is done");
}
}
}
Then the output java file should be:
public class TestClass {
private static final boolean isNotThis = false;
public static void main(String[] args) {
String x = "ABC";
dummyMethodCall();
if(isNotThis){
makeItThat();
System.out.println("ABC");
}
}
}
I am willing to know the regex that will help me to detect all string
literals and replace them with a particular string of my choice.
In my program I will be reading a java file line by line, and if there is
any string literal in that line, i will replace it with (say) "ABC".
Is there any regex to do so?
Ex. If the Java file passed to my program is:
public class TestClass {
private static final boolean isNotThis = false;
public static void main(String[] args) {
String x = "This is a test String";
dummyMethodCall();
if(isNotThis){
makeItThat();
System.out.println("work is done");
}
}
}
Then the output java file should be:
public class TestClass {
private static final boolean isNotThis = false;
public static void main(String[] args) {
String x = "ABC";
dummyMethodCall();
if(isNotThis){
makeItThat();
System.out.println("ABC");
}
}
}
I am willing to know the regex that will help me to detect all string
literals and replace them with a particular string of my choice.
Split strings by 2nd space
Split strings by 2nd space
Input :
"The boy is running on the train"
Output expected:
["The boy", "boy is", "is running", "running on", "on the", "the train"]
What is the easiest solution to achieve this in python.
Input :
"The boy is running on the train"
Output expected:
["The boy", "boy is", "is running", "running on", "on the", "the train"]
What is the easiest solution to achieve this in python.
Friday, 30 August 2013
html 5 website giving different result in chrome and firefox
html 5 website giving different result in chrome and firefox
here is link of website i m developing
http://ashteldemo.com/leonardpatel/index.html it is html 5 based template
site developed using core php site looks fine under fire fox,IE but in
chrome there is vertical line comes at the center of slider area, i am not
able to find whats causing problem
i have tried to solved with help of firebug but was not able to track down
issue
can anyone help me with this ?
here is css code for slider container
#slideshow-container {
background: url("../images/slideshow/bg_slideshow.jpg") no-repeat scroll
center center #999999;
float: left;
margin-bottom: 39px;
overflow: hidden;
position: relative;
width: 100%;
}
here is link of website i m developing
http://ashteldemo.com/leonardpatel/index.html it is html 5 based template
site developed using core php site looks fine under fire fox,IE but in
chrome there is vertical line comes at the center of slider area, i am not
able to find whats causing problem
i have tried to solved with help of firebug but was not able to track down
issue
can anyone help me with this ?
here is css code for slider container
#slideshow-container {
background: url("../images/slideshow/bg_slideshow.jpg") no-repeat scroll
center center #999999;
float: left;
margin-bottom: 39px;
overflow: hidden;
position: relative;
width: 100%;
}
Thursday, 29 August 2013
WCF webHttpBinding & Encryption
WCF webHttpBinding & Encryption
I currently have a WCF service exposed via webHttpBinding &
basicHttpBinding. The SOAP side of things is consumed via a web
application while REST is used for mobile apps. I need to add a level of
encryption to the mobile communication and have read that i need to use a
custom message encoder on my webhttpbinding.
I have an encryption library I wish to use. I have looked at the sample
applications in WCF under extensibility & message encoders but these have
confused me.
Does anyone have a simple example i could follow?
I currently have a WCF service exposed via webHttpBinding &
basicHttpBinding. The SOAP side of things is consumed via a web
application while REST is used for mobile apps. I need to add a level of
encryption to the mobile communication and have read that i need to use a
custom message encoder on my webhttpbinding.
I have an encryption library I wish to use. I have looked at the sample
applications in WCF under extensibility & message encoders but these have
confused me.
Does anyone have a simple example i could follow?
Wednesday, 28 August 2013
Yii Framework website not working on my network
Yii Framework website not working on my network
yii framework website is not working on my office network. When ever I try
to access the website I get "The connection was reset error". I have
checked if the yii website is down using isitdownrightnow.com and it shows
that website is up and running. I talked to my networking team and they
said the website is not blocked by our firewalls. Can you please tell me
what might be the cause of this issue.
FYI : I checked and the website works fine on my home internet connection.
Thanks for your time.
yii framework website is not working on my office network. When ever I try
to access the website I get "The connection was reset error". I have
checked if the yii website is down using isitdownrightnow.com and it shows
that website is up and running. I talked to my networking team and they
said the website is not blocked by our firewalls. Can you please tell me
what might be the cause of this issue.
FYI : I checked and the website works fine on my home internet connection.
Thanks for your time.
This and base and squared bracket parameters
This and base and squared bracket parameters
I stumbled upon this in the project I will be working on:
public int? OrgId
{
get { return base["OrgId"] as int?; }
set { base["OrgId"] = value; }
}
Clicking on OrgId, Resharper takes me to method of this signature :
public override object this[string propertyName] { get; set; }
What does base[""] do ? And what means the this[] part of the override ?
Couldn't find anything meaningful on Google.
I stumbled upon this in the project I will be working on:
public int? OrgId
{
get { return base["OrgId"] as int?; }
set { base["OrgId"] = value; }
}
Clicking on OrgId, Resharper takes me to method of this signature :
public override object this[string propertyName] { get; set; }
What does base[""] do ? And what means the this[] part of the override ?
Couldn't find anything meaningful on Google.
jQuery function to only run on the element clicked
jQuery function to only run on the element clicked
I'm trying to implement an accordian style box on some content. However
there are 4-6 of these boxes on 1 template, all with different classes for
obvious reasons. However I want to try and make the code as easy to read
as possible and I don't want to duplicate the code for each class name.
I'm assumung jQuerys (this) method would work but i'm not 100% sure how to
use it.
Here is my JS code:
<script type="text/javascript">
$(document).ready(function(){
$(".block-50_hoverHeader").click(function (){
//alert("clicked");
$(".scrollText").slideToggle(1000);
});
});
</script>
So the .scrollText class is the div that holds all the content which needs
to be displayed after the onClick function. But currently when I click the
header all the .scollText divs appear on the page. So i want it to only
appear on the parent header div that is being clicked.
Here the HTML:
<div class="block-50 left textHoverWrapOne">
<img src="" alt="" /> (Image working as BG Image)
<div class="block-50_hoverHeader"><p>This is a header!</p></div>
<div class="block-50_textHoverOne trans_click scrollText">
This is the content that needs to be displayed after the
</div>
</div>
I'm trying to implement an accordian style box on some content. However
there are 4-6 of these boxes on 1 template, all with different classes for
obvious reasons. However I want to try and make the code as easy to read
as possible and I don't want to duplicate the code for each class name.
I'm assumung jQuerys (this) method would work but i'm not 100% sure how to
use it.
Here is my JS code:
<script type="text/javascript">
$(document).ready(function(){
$(".block-50_hoverHeader").click(function (){
//alert("clicked");
$(".scrollText").slideToggle(1000);
});
});
</script>
So the .scrollText class is the div that holds all the content which needs
to be displayed after the onClick function. But currently when I click the
header all the .scollText divs appear on the page. So i want it to only
appear on the parent header div that is being clicked.
Here the HTML:
<div class="block-50 left textHoverWrapOne">
<img src="" alt="" /> (Image working as BG Image)
<div class="block-50_hoverHeader"><p>This is a header!</p></div>
<div class="block-50_textHoverOne trans_click scrollText">
This is the content that needs to be displayed after the
</div>
</div>
Why does current_user session become nil when updating user in rails?
Why does current_user session become nil when updating user in rails?
I'm using Devise and CanCan for user authentication and administrating
roles restricting access to parts of my rails 4 app for certain users.
I've run into some problems with updating a user. The update works fine
and the user object in the db get updated as it should, but my user
session is lost on the following redirect_to my user show action.
current_user becomes nil which means that cancan restricts the access to
the user show action.
My question is: Why does current_user become nil after update, when this
does not happen on other actions (e.g create, destroy etc)
This is the devise settings in my user model:
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:authentication_keys => [:login]
This is my users_controller.rb's update method:
class UsersController < ApplicationController
load_and_authorize_resource
before_filter :authenticate_user!
def update
@user = User.find(params[:id])
if params[:user][:password].blank?
params[:user].delete(:password)
end
respond_to do |format|
if @user.update_attributes(user_params)
format.html { redirect_to user_path, :notice => 'User was
successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @user.errors, :status =>
:unprocessable_entity }
end
end
end
end
And This is my ability.rb file:
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if defined?(user.role_id)
if user.role? :admin, user.role_id
can :manage, :all
elsif user.role? :hauler, user.role_id
can :manage, [User,Trip,Invoice], user_id: user.id.to_s
else
can :create, :Trip
end
end
end
end
Thanks!!
I'm using Devise and CanCan for user authentication and administrating
roles restricting access to parts of my rails 4 app for certain users.
I've run into some problems with updating a user. The update works fine
and the user object in the db get updated as it should, but my user
session is lost on the following redirect_to my user show action.
current_user becomes nil which means that cancan restricts the access to
the user show action.
My question is: Why does current_user become nil after update, when this
does not happen on other actions (e.g create, destroy etc)
This is the devise settings in my user model:
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:authentication_keys => [:login]
This is my users_controller.rb's update method:
class UsersController < ApplicationController
load_and_authorize_resource
before_filter :authenticate_user!
def update
@user = User.find(params[:id])
if params[:user][:password].blank?
params[:user].delete(:password)
end
respond_to do |format|
if @user.update_attributes(user_params)
format.html { redirect_to user_path, :notice => 'User was
successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @user.errors, :status =>
:unprocessable_entity }
end
end
end
end
And This is my ability.rb file:
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if defined?(user.role_id)
if user.role? :admin, user.role_id
can :manage, :all
elsif user.role? :hauler, user.role_id
can :manage, [User,Trip,Invoice], user_id: user.id.to_s
else
can :create, :Trip
end
end
end
end
Thanks!!
Connection pooling and Appdomain
Connection pooling and Appdomain
This question is related to my old question question.
1) I have a vb.net application which requires connections to some
databases.So now if i open multiple instance of same application(exe
files) then it uses different connection or uses multiple connection. So
can i make it to use single connection?
2) I heard about Appdomain(An AppDomain provides a layer of isolation
within a process) . Does it help in making the connection to be drawn from
same pool and make optimal use of resources? This article has something
related to it.
This question is related to my old question question.
1) I have a vb.net application which requires connections to some
databases.So now if i open multiple instance of same application(exe
files) then it uses different connection or uses multiple connection. So
can i make it to use single connection?
2) I heard about Appdomain(An AppDomain provides a layer of isolation
within a process) . Does it help in making the connection to be drawn from
same pool and make optimal use of resources? This article has something
related to it.
EAActionSheetPicker - get row in delegate method
EAActionSheetPicker - get row in delegate method
Im new to iOS. I am using an EAActionSheetPicker
(https://github.com/EckyZero/EAActionSheetPickerDemo).
I initiate my picker like this:
- (void)initLocationPicker
{
NSMutableArray* names = [[NSMutableArray alloc]
initWithCapacity:_data.count];
for(Model *item in _data)
[names addObject:item.name];
self.locationPicker = [[EAActionSheetPicker alloc]initWithOptions:names];
self.locationPicker.delegate = self;
}
What i want to achieve is that when i press the done-button; I want to
know which index was selected in the picker. I get the actual label by
implementing the delegate method as this:
-(void)EAActionSheetPicker:(EAActionSheetPicker *)actionSheet
didDismissWithSelection:(id)selection
inTextField:(UITextField *)textField{
NSLog(@"selected: %@", selection);
}
How can I know which index that was?
Might perhaps be obvious.
Thanks
Im new to iOS. I am using an EAActionSheetPicker
(https://github.com/EckyZero/EAActionSheetPickerDemo).
I initiate my picker like this:
- (void)initLocationPicker
{
NSMutableArray* names = [[NSMutableArray alloc]
initWithCapacity:_data.count];
for(Model *item in _data)
[names addObject:item.name];
self.locationPicker = [[EAActionSheetPicker alloc]initWithOptions:names];
self.locationPicker.delegate = self;
}
What i want to achieve is that when i press the done-button; I want to
know which index was selected in the picker. I get the actual label by
implementing the delegate method as this:
-(void)EAActionSheetPicker:(EAActionSheetPicker *)actionSheet
didDismissWithSelection:(id)selection
inTextField:(UITextField *)textField{
NSLog(@"selected: %@", selection);
}
How can I know which index that was?
Might perhaps be obvious.
Thanks
Tuesday, 27 August 2013
Adobe Flash and JSON
Adobe Flash and JSON
I'm a newbie in adobe flash development.
I have form login, and I want to login with my api, which like this:
/api/login and with user & pass.
And I don't know how to.
Which I have?
IDE: Adobe Flash Professional CS6
The form with username & password field
What I need?
How to connect to API and get response
How to send request to server with POST & GET
Thanks so much!
I'm a newbie in adobe flash development.
I have form login, and I want to login with my api, which like this:
/api/login and with user & pass.
And I don't know how to.
Which I have?
IDE: Adobe Flash Professional CS6
The form with username & password field
What I need?
How to connect to API and get response
How to send request to server with POST & GET
Thanks so much!
User Selected Columns of 2D Array?
User Selected Columns of 2D Array?
I am trying to set up a program in C++ that will take the user selected
number of columns and create an array that will have:
Columns=user selected Rows=3^(#of columns)
How do you initialize a 2D array where the rows/columns are not initially
constants (determined by user)?
I am trying to set up a program in C++ that will take the user selected
number of columns and create an array that will have:
Columns=user selected Rows=3^(#of columns)
How do you initialize a 2D array where the rows/columns are not initially
constants (determined by user)?
Problem with Ubuntu Programs crashing
Problem with Ubuntu Programs crashing
Whenever I try to open my Ubuntu Software Center, it instantly crashes. I
can't get updates either, it says that my packages have unmet
dependencies. How do I find out what the dependencies were, and how do I
fix them?
Whenever I try to open my Ubuntu Software Center, it instantly crashes. I
can't get updates either, it says that my packages have unmet
dependencies. How do I find out what the dependencies were, and how do I
fix them?
Visual Studio and SQL Server
Visual Studio and SQL Server
I've been looking for users that have development tools installed within a
company and have identified many that have Visual Studio and believe they
need to keep it because they do SQL Queries. In my limited knowledge SQL
Management Studio shouldn't require Visual Studio, but I'm not sure.
Does anyone know of any use cases where users performing queries against a
database would require Visual Studio?
I've been looking for users that have development tools installed within a
company and have identified many that have Visual Studio and believe they
need to keep it because they do SQL Queries. In my limited knowledge SQL
Management Studio shouldn't require Visual Studio, but I'm not sure.
Does anyone know of any use cases where users performing queries against a
database would require Visual Studio?
cant able to save the excel file in c#
cant able to save the excel file in c#
here i am using excel sheet to save some data,and accessing that sheet by
using following code and perform some modification to the excel sheet,
after that try to save that file.but unable to save the file.Here is my
code
Application excel = new Application();
excel.Visible=true;
Workbook wb =
(Workbook)excel.Workbooks.Open(@"C:\Users\dnyanesh.wagh\Desktop\BookExcel1.xlsx");
Worksheet ws = (Worksheet)wb.Worksheets[1];
ws.Cells[1, 1] = "sagar";
ws.Cells[2, 1] = "sagar";
ws.Cells[3, 1] = "sagar";
wb.Save();
wb.close();
it is giving the error that "the file named 'BookExcel1.xlsx' already
exist in this location.you want to replace it." Then after that I change
the code to
Workbook wb =
(Workbook)excel.Workbooks.Open(@"C:\Users\dnyanesh.wagh\Desktop\BookExcel1.xlsx",0,
false, 5, "", "",
false, XlPlatform.xlWindows, "", true, false,
0, true, false, false););
it is giving again error saying "BookExcel1.xlsx is being modified by
user_name.open as read only".if click 'cancel' button then giving
exception at above line i.e."Exception from HRESULT: 0x800A03EC" also I
try as
wb.SaveAs(@"C:\Users\dnyanesh.wagh\Desktop\BookExcel1.xlsx");
wb.Close(true,null,null);
then also giving error.the above file showing the modifications. Can
anybody tell me how can I save the file with modifications.
here i am using excel sheet to save some data,and accessing that sheet by
using following code and perform some modification to the excel sheet,
after that try to save that file.but unable to save the file.Here is my
code
Application excel = new Application();
excel.Visible=true;
Workbook wb =
(Workbook)excel.Workbooks.Open(@"C:\Users\dnyanesh.wagh\Desktop\BookExcel1.xlsx");
Worksheet ws = (Worksheet)wb.Worksheets[1];
ws.Cells[1, 1] = "sagar";
ws.Cells[2, 1] = "sagar";
ws.Cells[3, 1] = "sagar";
wb.Save();
wb.close();
it is giving the error that "the file named 'BookExcel1.xlsx' already
exist in this location.you want to replace it." Then after that I change
the code to
Workbook wb =
(Workbook)excel.Workbooks.Open(@"C:\Users\dnyanesh.wagh\Desktop\BookExcel1.xlsx",0,
false, 5, "", "",
false, XlPlatform.xlWindows, "", true, false,
0, true, false, false););
it is giving again error saying "BookExcel1.xlsx is being modified by
user_name.open as read only".if click 'cancel' button then giving
exception at above line i.e."Exception from HRESULT: 0x800A03EC" also I
try as
wb.SaveAs(@"C:\Users\dnyanesh.wagh\Desktop\BookExcel1.xlsx");
wb.Close(true,null,null);
then also giving error.the above file showing the modifications. Can
anybody tell me how can I save the file with modifications.
Updating only ID's with the latest date SQL (2 of 6)
Updating only ID's with the latest date SQL (2 of 6)
I have the following tables:
and:
And I formulated this query:
Update Table 1
SET DY_H_ID = (
SELECT MAX(ID)
FROM Table 2
WHERE H_DateTime <= DY_Date
AND H_IDX = DY_IDX
AND H_HA_ID = 7
AND H_HSA_ID = 19
AND H_Description LIKE 'Diary item added for :%'
)
WHERE DY_H_ID IS NULL AND DY_IDX IS NOT NULL
which results in this:
However, this query updates all 6 rows. I need to update only the two rows
with the latest date, that would be '2013-08-29 15:00:00.000'. That would
mean only 2 of the 6 records would be updated and the other 4 would remain
NULL.
How can I do this by adding to the above query? I know this might not be
ideal but there is no option but to do something like this. What I don't
understand is how do you select only the latest dates without hardcoding
it. This data can change and it won't always be the same dates etc.
I have the following tables:
and:
And I formulated this query:
Update Table 1
SET DY_H_ID = (
SELECT MAX(ID)
FROM Table 2
WHERE H_DateTime <= DY_Date
AND H_IDX = DY_IDX
AND H_HA_ID = 7
AND H_HSA_ID = 19
AND H_Description LIKE 'Diary item added for :%'
)
WHERE DY_H_ID IS NULL AND DY_IDX IS NOT NULL
which results in this:
However, this query updates all 6 rows. I need to update only the two rows
with the latest date, that would be '2013-08-29 15:00:00.000'. That would
mean only 2 of the 6 records would be updated and the other 4 would remain
NULL.
How can I do this by adding to the above query? I know this might not be
ideal but there is no option but to do something like this. What I don't
understand is how do you select only the latest dates without hardcoding
it. This data can change and it won't always be the same dates etc.
How to write a jquery function for same-type controls in html?
How to write a jquery function for same-type controls in html?
i'm designing a form which gets user information and then go another page.
There's lots of "input text" controls to fill. User must fill all "input
text" controls in order to go home page. if a control is empty, an "x"
icon should be put inside "input text".
My main problem is, i'm new at jquery and i dont want to write this
function for every control:
$('#send').click(function () {
if ($('#kname').val().length == 0) {
$('#kname').css({ background: "url(image/error.png)
no-repeat right" });
}
});
i need a general function for all controls. here is my html lines:
//some code
<input type="text" id="knumber" />
<input type="text" id="kname" />
<input type="text" id="ksurname" />
//some other code
edit: i'm using an "input button" to send these info.
<input type="button" value="Send Them" id="send" />
i'm designing a form which gets user information and then go another page.
There's lots of "input text" controls to fill. User must fill all "input
text" controls in order to go home page. if a control is empty, an "x"
icon should be put inside "input text".
My main problem is, i'm new at jquery and i dont want to write this
function for every control:
$('#send').click(function () {
if ($('#kname').val().length == 0) {
$('#kname').css({ background: "url(image/error.png)
no-repeat right" });
}
});
i need a general function for all controls. here is my html lines:
//some code
<input type="text" id="knumber" />
<input type="text" id="kname" />
<input type="text" id="ksurname" />
//some other code
edit: i'm using an "input button" to send these info.
<input type="button" value="Send Them" id="send" />
Monday, 26 August 2013
access titlebar which is inside Ext.Panel
access titlebar which is inside Ext.Panel
How can i access or reference the TitleBar component which is inside a
Ext.Panel
code
Ext.define('appv.view.ContactInfoPanel',{
extend:'Ext.Panel',
xtype:'contactinfopanel',
requires: [ 'Ext.TitleBar','contactapp.view.ContactInfo'],
config:{
layout:'vbox',
items:[{
xtype: 'titlebar',
height:'65px',
center:true
},{
xtype:'contactinfo',
}]
},
initialize:function(){
// Here i want to access the TitleBar and set its title dynamically
}
});
How can i access or reference the TitleBar component which is inside a
Ext.Panel
code
Ext.define('appv.view.ContactInfoPanel',{
extend:'Ext.Panel',
xtype:'contactinfopanel',
requires: [ 'Ext.TitleBar','contactapp.view.ContactInfo'],
config:{
layout:'vbox',
items:[{
xtype: 'titlebar',
height:'65px',
center:true
},{
xtype:'contactinfo',
}]
},
initialize:function(){
// Here i want to access the TitleBar and set its title dynamically
}
});
Setting up a vm - server not found
Setting up a vm - server not found
I am trying to use devbox, however i have a problem with this step:
Point "devbox" and any other vhosts to 192.168.3.3 in your hosts file of
your OS. e.g. 192.168.3.3 devbox myproject.dev myotherproject.dev
[ANY-OTHER-HOST]
Then, i go to 000-default.conf and i have this vhost edited by me. (it is
supposed to be this one? right? i only have this vhost in sites-available)
<VirtualHost *:80>
192.168.3.3 devbox test.dev
ServerName www.test.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.dev
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
In windows i have E:\dev\devbox\www\test.dev\public
Basically when i try this url: http://test.dev i am getting Server not found
I am trying to use devbox, however i have a problem with this step:
Point "devbox" and any other vhosts to 192.168.3.3 in your hosts file of
your OS. e.g. 192.168.3.3 devbox myproject.dev myotherproject.dev
[ANY-OTHER-HOST]
Then, i go to 000-default.conf and i have this vhost edited by me. (it is
supposed to be this one? right? i only have this vhost in sites-available)
<VirtualHost *:80>
192.168.3.3 devbox test.dev
ServerName www.test.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.dev
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
In windows i have E:\dev\devbox\www\test.dev\public
Basically when i try this url: http://test.dev i am getting Server not found
Cross domain uploading for jQuery File Upload
Cross domain uploading for jQuery File Upload
I know this has been asked on SO before, but everything I've tried doesn't
seem to work...I'm using jQuery File Upload by BlueImp, and I need to do a
cross-domain upload (from sub.site.net to files.site.net)
I've looked at how to do it, and here's my headers for index.php (on the
receiving server)
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: *');
Looks right to me...
When I go to upload the file, I get this error:
XMLHttpRequest cannot load http://files.site.net/. Origin
http://sub.site.net is not allowed by Access-Control-Allow-Origin.
So apparently something's wrong with the headers. Can anyone help me with
this? Let me know if more info is needed...
BTW the upload folder does have write permissions. Thanks!
I know this has been asked on SO before, but everything I've tried doesn't
seem to work...I'm using jQuery File Upload by BlueImp, and I need to do a
cross-domain upload (from sub.site.net to files.site.net)
I've looked at how to do it, and here's my headers for index.php (on the
receiving server)
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: *');
Looks right to me...
When I go to upload the file, I get this error:
XMLHttpRequest cannot load http://files.site.net/. Origin
http://sub.site.net is not allowed by Access-Control-Allow-Origin.
So apparently something's wrong with the headers. Can anyone help me with
this? Let me know if more info is needed...
BTW the upload folder does have write permissions. Thanks!
my Alarm doen't start activity when phone lock is
my Alarm doen't start activity when phone lock is
I try to do alarm clock in my aplication, but when phone lock is there
activity doest't start as in standart alarm clock. What I can do for
decide this problem?
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 5);
Intent intent = new Intent(this, AlarmReceiverActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,
12345, intent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager am =
(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
pendingIntent);
I try to do alarm clock in my aplication, but when phone lock is there
activity doest't start as in standart alarm clock. What I can do for
decide this problem?
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 5);
Intent intent = new Intent(this, AlarmReceiverActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,
12345, intent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager am =
(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
pendingIntent);
how does DISTINCT work in SQL, i mean how does it internally works if i im using it for 2 column in same table!!!!please asap
how does DISTINCT work in SQL, i mean how does it internally works if i im
using it for 2 column in same table!!!!please asap
how does DISTINCT work in SQL, i mean how does it internally works if i im
using it for 2 column in same table!!! lets say im using the scott user,
and in that if im querying like SQL> SELECT DISTINCT Deptno, Job FROM EMP;
AND SQL> SELECT DISTINCT Job, Deptno FROM EMP; Then Ans Have The Same
Values But Their Order Is Not Same For The Two Queries...... I Want To
Know Why Is The Difference In The Output..... And How Is It Internally
Executing The 2 Queries... Im New To Sql Please Help Me Build My
Concepts.. Thanks....
using it for 2 column in same table!!!!please asap
how does DISTINCT work in SQL, i mean how does it internally works if i im
using it for 2 column in same table!!! lets say im using the scott user,
and in that if im querying like SQL> SELECT DISTINCT Deptno, Job FROM EMP;
AND SQL> SELECT DISTINCT Job, Deptno FROM EMP; Then Ans Have The Same
Values But Their Order Is Not Same For The Two Queries...... I Want To
Know Why Is The Difference In The Output..... And How Is It Internally
Executing The 2 Queries... Im New To Sql Please Help Me Build My
Concepts.. Thanks....
URL where user come from ASP.Net but have NULL
URL where user come from ASP.Net but have NULL
I want to know-from what url user come from. So, i use
Uri MyUrl = Request.UrlReferrer;
But when i get only null value from MyUrl:
I have two projects-first is my aspx page, second- redirects to this first
project-page with GET parameters. But when second project redirect to
first project- i have :
Object reference not set to an instance of an object.
My first project so simple:
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect("http://localhost:54287/go.aspx?id=DEFAULT");
}
Second project:
protected void Page_Load(object sender, EventArgs e)
{
//Request.ServerVariables('http_referer');
// Request.ServerVariables;
string id = Request.QueryString["id"];
if (id != null)
{
Uri MyUrl = Request.UrlReferrer;
Console.WriteLine(MyUrl);
Response.Write("Referrer URL : " + MyUrl.AbsolutePath);
}
}
I want to know-from what url user come from. So, i use
Uri MyUrl = Request.UrlReferrer;
But when i get only null value from MyUrl:
I have two projects-first is my aspx page, second- redirects to this first
project-page with GET parameters. But when second project redirect to
first project- i have :
Object reference not set to an instance of an object.
My first project so simple:
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect("http://localhost:54287/go.aspx?id=DEFAULT");
}
Second project:
protected void Page_Load(object sender, EventArgs e)
{
//Request.ServerVariables('http_referer');
// Request.ServerVariables;
string id = Request.QueryString["id"];
if (id != null)
{
Uri MyUrl = Request.UrlReferrer;
Console.WriteLine(MyUrl);
Response.Write("Referrer URL : " + MyUrl.AbsolutePath);
}
}
Changing background of a button in widget: Android
Changing background of a button in widget: Android
I need to change background of a button programmatically. That button is
placed in a widget.
I got an example of changing background color here, but this is only for
changing color, and I want to use an image instead of a color.
Is there any way to apply a background image to a button programmatically?
Thank you
I need to change background of a button programmatically. That button is
placed in a widget.
I got an example of changing background color here, but this is only for
changing color, and I want to use an image instead of a color.
Is there any way to apply a background image to a button programmatically?
Thank you
Sunday, 25 August 2013
[ Fashion & Accessories ] Open Question : is this top outdated...im 39?
[ Fashion & Accessories ] Open Question : is this top outdated...im 39?
http://i.imgur.com/xAQ4ynS.png
http://i.imgur.com/xAQ4ynS.png
invalid vs handicap vs disabled
invalid vs handicap vs disabled
When is it appropriate to describe a person as an invalid versus handicap
versus disabled? My friend broke his leg and could hardly do anything
physical. I guess invalid would be the most appropriate because he was not
born with, is temporary and is severely debilitating. For completeness
sake is it ever acceptable or preferable to call someone a cripple or
lame?
When is it appropriate to describe a person as an invalid versus handicap
versus disabled? My friend broke his leg and could hardly do anything
physical. I guess invalid would be the most appropriate because he was not
born with, is temporary and is severely debilitating. For completeness
sake is it ever acceptable or preferable to call someone a cripple or
lame?
How to enable adb after wiping system and installing new kernel?
How to enable adb after wiping system and installing new kernel?
I have a Nexus 4 I accedently wiped system and tried to restore it. I did
have adb before I wiped the system. Now I can only get into recovery mode.
No android. When I use Nexus root toolkit it recognizes the device only in
bootloader but it can't recognize it as adb device. I thought maybe now
that Android is not installed USB, debugging is disabled as default. Do i
have a way to enable it or do you have any other solution? I can't use the
device. Do I have any other way to install Android without adb? Thank you
I have a Nexus 4 I accedently wiped system and tried to restore it. I did
have adb before I wiped the system. Now I can only get into recovery mode.
No android. When I use Nexus root toolkit it recognizes the device only in
bootloader but it can't recognize it as adb device. I thought maybe now
that Android is not installed USB, debugging is disabled as default. Do i
have a way to enable it or do you have any other solution? I can't use the
device. Do I have any other way to install Android without adb? Thank you
Using Threads, Is this a good way?
Using Threads, Is this a good way?
So, i have 2 threads, one listen on TCP, other Render in a loop. So, to
Start and End, i have this code:
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
try
{
if (ReceiveCheck.Checked)
{
tcplisten.Start();
ListenThread = new Thread(new ThreadStart(Listen));
ListenThread.Start();
RenderThread = new Thread(new ThreadStart(Render));
RenderThread.Start();
}
else
{
tcplisten.Stop();
RenderThread.Abort();
ListenThread.Abort();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Checkbox");
}
}
Is this a good way to handle the Threads? To just start then, and kill
them when i want to?
So, i have 2 threads, one listen on TCP, other Render in a loop. So, to
Start and End, i have this code:
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
try
{
if (ReceiveCheck.Checked)
{
tcplisten.Start();
ListenThread = new Thread(new ThreadStart(Listen));
ListenThread.Start();
RenderThread = new Thread(new ThreadStart(Render));
RenderThread.Start();
}
else
{
tcplisten.Stop();
RenderThread.Abort();
ListenThread.Abort();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Checkbox");
}
}
Is this a good way to handle the Threads? To just start then, and kill
them when i want to?
Saturday, 24 August 2013
Black band with 100% width gets a gap when table gets min-width
Black band with 100% width gets a gap when table gets min-width
I have a band on top and a table on the bottom.
When the table is without min-width the band (with 100% width) works
perfectly covering 100% of the screen, however, when I add the
min-width:950px to the table I get a gap I can't get rid of on the right
side of the screen whenever the screen resizes to a smaller size.
I've looked around but I haven't been able to fix it with any of the
recommendations here. Any help appreciated
fiddle: http://jsfiddle.net/xxVUW/
#band{width:100%;height:100px;background: black;}
#port-content{min-width:950px;}
I have a band on top and a table on the bottom.
When the table is without min-width the band (with 100% width) works
perfectly covering 100% of the screen, however, when I add the
min-width:950px to the table I get a gap I can't get rid of on the right
side of the screen whenever the screen resizes to a smaller size.
I've looked around but I haven't been able to fix it with any of the
recommendations here. Any help appreciated
fiddle: http://jsfiddle.net/xxVUW/
#band{width:100%;height:100px;background: black;}
#port-content{min-width:950px;}
How to resize image on upload in rails app using paperclip?
How to resize image on upload in rails app using paperclip?
In my Rails app, I have the below:
has_attached_file :image
def picture_from_url(url)
self.image = URI.parse(url)
end
I would like to resize the image when it gets saved as well but am not
sure how to do this. I would like the width to be 300px and the height to
scale proportionally to this. Any advice on how to do this?
In my Rails app, I have the below:
has_attached_file :image
def picture_from_url(url)
self.image = URI.parse(url)
end
I would like to resize the image when it gets saved as well but am not
sure how to do this. I would like the width to be 300px and the height to
scale proportionally to this. Any advice on how to do this?
Simple if statement?
Simple if statement?
I've got a simple if statement that involves 4 UIImageViews I want to
detect when all 4 are nil to trigger something. It works just fine as it
is but I am getting a warning that says "expression result unused".
Let me know what ya think!
if (shapeImage1, shapeImage2, shapeImage3, shapeImage4 == nil){
NSLog(@"Hello, friend.");
}
I've got a simple if statement that involves 4 UIImageViews I want to
detect when all 4 are nil to trigger something. It works just fine as it
is but I am getting a warning that says "expression result unused".
Let me know what ya think!
if (shapeImage1, shapeImage2, shapeImage3, shapeImage4 == nil){
NSLog(@"Hello, friend.");
}
Players can't build in bPermissions
Players can't build in bPermissions
I have created my default group in bPermissions and the players that have
the default rank can't build, I can't figure out why. I have even added
the permission node "bpermissions.build". Here is the groups.yml:
default: default
groups:
default:
permissions:
- bpermissions.build
- essentials.afk
- essentials.afk.auto
- essentials.back
- essentials.home
- essentials.sethome
- essentials.spawn
- essentials.suicide
- mineconomy.balance.check
- mineconomy.bank.account.balance
- plotme.limit.1
- plotme.use.add
- plotme.use.auto
- plotme.use.buy
- plotme.use.protect
- plotme.use.remove
- warptastic.makesign
- warptastic.warp
groups: []
Please Help!
I have created my default group in bPermissions and the players that have
the default rank can't build, I can't figure out why. I have even added
the permission node "bpermissions.build". Here is the groups.yml:
default: default
groups:
default:
permissions:
- bpermissions.build
- essentials.afk
- essentials.afk.auto
- essentials.back
- essentials.home
- essentials.sethome
- essentials.spawn
- essentials.suicide
- mineconomy.balance.check
- mineconomy.bank.account.balance
- plotme.limit.1
- plotme.use.add
- plotme.use.auto
- plotme.use.buy
- plotme.use.protect
- plotme.use.remove
- warptastic.makesign
- warptastic.warp
groups: []
Please Help!
Pre requisites for web service callouts
Pre requisites for web service callouts
I want to establish web service callout using two way SSL in Salesforce.
What Information I should gather from other web server to establish this
connection?
I am new to this site. Please excuse any typo.
Thanks.
I want to establish web service callout using two way SSL in Salesforce.
What Information I should gather from other web server to establish this
connection?
I am new to this site. Please excuse any typo.
Thanks.
Unusual behavior of java program
Unusual behavior of java program
I am new to java and trying to learn it. I wrote two class as follows, and
I expect to print as 1, 2, 3 but it prints 3, 3, 3. I read a java book
about i couldn't figure out the above behavior and print 1,2,3.
public class Student{
private static int indexNumber = 0;
Student(){
indexNumber=indexNumber+1;
}
public void test() {
System.out.println(this.getIndexNumber());
}
public int getIndexNumber(){
return indexNumber;
}}
public class College {
public static void main(String args[]){
Student student1 = new Student();
Student student2 = new Student();
Student student3 = new Student();
student1.test();
student2.test();
student3.test();
}
}
Can anyone help?
I am new to java and trying to learn it. I wrote two class as follows, and
I expect to print as 1, 2, 3 but it prints 3, 3, 3. I read a java book
about i couldn't figure out the above behavior and print 1,2,3.
public class Student{
private static int indexNumber = 0;
Student(){
indexNumber=indexNumber+1;
}
public void test() {
System.out.println(this.getIndexNumber());
}
public int getIndexNumber(){
return indexNumber;
}}
public class College {
public static void main(String args[]){
Student student1 = new Student();
Student student2 = new Student();
Student student3 = new Student();
student1.test();
student2.test();
student3.test();
}
}
Can anyone help?
get last node given the full path of all ancestor's node attributes using cte
get last node given the full path of all ancestor's node attributes using cte
Given the following postgresql table:
items
integer id
integer parent_id
string name
unique key on [parent_id, name]
parent_id is null for all root nodes
Currently I build the sql query manually, doing a join for every path
element. But is seems quite ugly to me and of course it limits the
possible depth.
Example:
path: holiday,images,spain
SELECT i3.* FROM items AS i1, items AS i2, items AS i3 WHERE i1.parent_id
IS NULL AND i1.name = 'holiday' AND i2.parent_id=i1.id AND i2.name =
'images' AND i3.parent_id=i2.id AND i3.name = 'spain'
I wonder if there's a better way, probably using CTE?
Given the following postgresql table:
items
integer id
integer parent_id
string name
unique key on [parent_id, name]
parent_id is null for all root nodes
Currently I build the sql query manually, doing a join for every path
element. But is seems quite ugly to me and of course it limits the
possible depth.
Example:
path: holiday,images,spain
SELECT i3.* FROM items AS i1, items AS i2, items AS i3 WHERE i1.parent_id
IS NULL AND i1.name = 'holiday' AND i2.parent_id=i1.id AND i2.name =
'images' AND i3.parent_id=i2.id AND i3.name = 'spain'
I wonder if there's a better way, probably using CTE?
execCommand insertHtml, outer div not inserted why?
execCommand insertHtml, outer div not inserted why?
Why is the DIV not inserted but only the IMG ?
$(document).ready(function() {
$(document).on('click', '#insertImage', function(){
/*
Why is the DIV not inserted ?
*/
var item = "<div class='resizable'><img
src='http://www.rockiesventureclub.org/wp-content/uploads/2013/02/flower-icon.png'></div>";
document.execCommand('insertHTML', false,item)
})
});
see: http://jsfiddle.net/daslicht/gU2jP/#base
Why is the DIV not inserted but only the IMG ?
$(document).ready(function() {
$(document).on('click', '#insertImage', function(){
/*
Why is the DIV not inserted ?
*/
var item = "<div class='resizable'><img
src='http://www.rockiesventureclub.org/wp-content/uploads/2013/02/flower-icon.png'></div>";
document.execCommand('insertHTML', false,item)
})
});
see: http://jsfiddle.net/daslicht/gU2jP/#base
What should I start with when making a game?
What should I start with when making a game?
I am going to make a game in 2D or 3D. But I have a problem I can't decide
if I should do the AI, physics, graphics or level designs first and if I
should use 2D or 3D.
If I use 2D I will use eclipse to program in Java. It will be a smaller
job and won't require highly detailed graphics, but it could be that
people won't like it as much as 3D. With 3D it is a bigger job, but I am
using unity to make my job easier. Unity is good, but I don't know if you
can stretch the limits as long as in programming. It is no way I will
program the whole 3D game.
And to the second question: What should I start with? AI, physics,
graphics, level designs? That would be good to know that too.
If I am going to make a 2D game I think I will make a platform game with
basic physics like gravity, and basic graphics. I don't think people will
be very impressed over that.
If I am going to make a 3D game I think it will be more like a big project
with a first person shooter camera and a big environment with high
detailed graphics. People would like that a little more
I can just a little bit about making textures to 3D objects. I have maked
textures to 2D objects so I have a little more experience about that. And
I can do much with programming with my experience, but it is limited of
course. 3D games will be very hard to work with.
I am going to make a game in 2D or 3D. But I have a problem I can't decide
if I should do the AI, physics, graphics or level designs first and if I
should use 2D or 3D.
If I use 2D I will use eclipse to program in Java. It will be a smaller
job and won't require highly detailed graphics, but it could be that
people won't like it as much as 3D. With 3D it is a bigger job, but I am
using unity to make my job easier. Unity is good, but I don't know if you
can stretch the limits as long as in programming. It is no way I will
program the whole 3D game.
And to the second question: What should I start with? AI, physics,
graphics, level designs? That would be good to know that too.
If I am going to make a 2D game I think I will make a platform game with
basic physics like gravity, and basic graphics. I don't think people will
be very impressed over that.
If I am going to make a 3D game I think it will be more like a big project
with a first person shooter camera and a big environment with high
detailed graphics. People would like that a little more
I can just a little bit about making textures to 3D objects. I have maked
textures to 2D objects so I have a little more experience about that. And
I can do much with programming with my experience, but it is limited of
course. 3D games will be very hard to work with.
Friday, 23 August 2013
Email composer show in landscape mode when restrict application in portrait mode (android +phonegap )
Email composer show in landscape mode when restrict application in
portrait mode (android +phonegap )
I restricted my application on portrait mode in phonegap.But when I used
email composer plugin and open email composer the it show in landscape
mode ? why is there any way to show email composer in only portrait mode.?
<activity
android:name=".Activity.SplashScreenActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
portrait mode (android +phonegap )
I restricted my application on portrait mode in phonegap.But when I used
email composer plugin and open email composer the it show in landscape
mode ? why is there any way to show email composer in only portrait mode.?
<activity
android:name=".Activity.SplashScreenActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Update array based on other aray in php
Update array based on other aray in php
I have two array's
Array $groeperingen contains the short codes and the full names. Array
$groep cointains only shortcodes
What i want is that all short codes in $groep are replaced with the full name
array $groepering looks like this:
Array
(
[019] => Regio 019a
[013] => Regio 013
[011] => Regio alpha
[AR] => ArmUsers
[CU] => ComputerUsers
[GA] => Gamers
[OP] => Opensource
)
And $groep looks like this
Array
(
[0] => CU
[1] => GA
[2] => OP
)
How can i do this?
I have two array's
Array $groeperingen contains the short codes and the full names. Array
$groep cointains only shortcodes
What i want is that all short codes in $groep are replaced with the full name
array $groepering looks like this:
Array
(
[019] => Regio 019a
[013] => Regio 013
[011] => Regio alpha
[AR] => ArmUsers
[CU] => ComputerUsers
[GA] => Gamers
[OP] => Opensource
)
And $groep looks like this
Array
(
[0] => CU
[1] => GA
[2] => OP
)
How can i do this?
simulate onOptionsItemSelected inside method call
simulate onOptionsItemSelected inside method call
I have an ImageView inside a xml layout. The ImageView has an onClick method.
android:onClick="onHomeClicked"
When the user clicks my image, I want that to in turn call
onOptionsItemSelected inside the activity. How would I do that?
The following code gives null for homeMenuItem:
MenuItem homeMenuItem;
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
homeMenuItem = menu.findItem(android.R.id.home);
super.onPrepareOptionsMenu(menu);
return true;
}
public void onHomeClicked(View view) {
onOptionsItemSelected(homeMenuItem);
}
I have an ImageView inside a xml layout. The ImageView has an onClick method.
android:onClick="onHomeClicked"
When the user clicks my image, I want that to in turn call
onOptionsItemSelected inside the activity. How would I do that?
The following code gives null for homeMenuItem:
MenuItem homeMenuItem;
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
homeMenuItem = menu.findItem(android.R.id.home);
super.onPrepareOptionsMenu(menu);
return true;
}
public void onHomeClicked(View view) {
onOptionsItemSelected(homeMenuItem);
}
Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a...
Delving into the world of XML (Windows Phone) Error I dont understand (The
' ' character, hexadecimal value 0x20, cannot be included in a...
So I am starting to learn how to use XML data within a app and decided to
use some free data to do this however I cannot for the life of me get it
working this is my code so far. (I have done a few apps with static data
before but hey apps are designed to use the web right? :p)
public class XmlItem
{
public string Title { get; set; }
public string Description { get; set; }
}
public partial class MainPage : PhoneApplicationPage
{
List<XmlItem> xmlItems = new List<XmlItem>();
// Constructor
public MainPage()
{
InitializeComponent();
LoadXmlItems("http://hatrafficinfo.dft.gov.uk/feeds/datex/England/CurrentRoadworks/content.xml");
test();
}
public void test()
{
foreach (XmlItem item in xmlItems)
{
testing.Text = item.Title;
}
}
public void LoadXmlItems(string xmlUrl)
{
WebClient client = new WebClient();
client.OpenReadCompleted += (sender, e) =>
{
if (e.Error != null)
return;
Stream str = e.Result;
XDocument xdoc = XDocument.Load(str);
xmlItems = (from item in xdoc.Descendants("situation id")
select new XmlItem()
{
Title =
item.Element("impactOnTraffic").Value,
Description =
item.Element("trafficRestrictionType").Value
}).ToList();
// close
str.Close();
// add results to the list
xmlItems.Clear();
foreach (XmlItem item in xmlItems)
{
xmlItems.Add(item);
}
};
client.OpenReadAsync(new Uri(xmlUrl, UriKind.Absolute));
}
}
I am basically trying to learn how to do this at the moment as I am
intrigued how to actually do it (I know there are many ways but ATM this
way seems the easiest) I just don't get what the error is ATM.
I also know the display function ATM is not great (As it will only show
the last item) but for testing this will do for now.
To some this may seem easy, as a learner its not so easy for me just yet.
The error in picture form: (It seems I cant post images :/)
Thanks in advance for the help
' ' character, hexadecimal value 0x20, cannot be included in a...
So I am starting to learn how to use XML data within a app and decided to
use some free data to do this however I cannot for the life of me get it
working this is my code so far. (I have done a few apps with static data
before but hey apps are designed to use the web right? :p)
public class XmlItem
{
public string Title { get; set; }
public string Description { get; set; }
}
public partial class MainPage : PhoneApplicationPage
{
List<XmlItem> xmlItems = new List<XmlItem>();
// Constructor
public MainPage()
{
InitializeComponent();
LoadXmlItems("http://hatrafficinfo.dft.gov.uk/feeds/datex/England/CurrentRoadworks/content.xml");
test();
}
public void test()
{
foreach (XmlItem item in xmlItems)
{
testing.Text = item.Title;
}
}
public void LoadXmlItems(string xmlUrl)
{
WebClient client = new WebClient();
client.OpenReadCompleted += (sender, e) =>
{
if (e.Error != null)
return;
Stream str = e.Result;
XDocument xdoc = XDocument.Load(str);
xmlItems = (from item in xdoc.Descendants("situation id")
select new XmlItem()
{
Title =
item.Element("impactOnTraffic").Value,
Description =
item.Element("trafficRestrictionType").Value
}).ToList();
// close
str.Close();
// add results to the list
xmlItems.Clear();
foreach (XmlItem item in xmlItems)
{
xmlItems.Add(item);
}
};
client.OpenReadAsync(new Uri(xmlUrl, UriKind.Absolute));
}
}
I am basically trying to learn how to do this at the moment as I am
intrigued how to actually do it (I know there are many ways but ATM this
way seems the easiest) I just don't get what the error is ATM.
I also know the display function ATM is not great (As it will only show
the last item) but for testing this will do for now.
To some this may seem easy, as a learner its not so easy for me just yet.
The error in picture form: (It seems I cant post images :/)
Thanks in advance for the help
Ksoap2 returns anytype{} instead of null
Ksoap2 returns anytype{} instead of null
This is my asynchronous code
@Override
protected SoapObject doInBackground(String... params) {
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("ID", "0014");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.implicitTypes = false;
envelope.dotNet = true;
HttpTransportSE transport = new HttpTransportSE(URL);
try {
transport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
try {
SoapFault fault = (SoapFault) envelope.bodyIn;
System.out.println("fault in getdata : " + fault);
} catch (Exception e) {
e.printStackTrace();
}
try {
result = (SoapObject) envelope.bodyIn;
System.out.println("result in getdata : " + result);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
// System.out.println("Exception : " + e.toString());
}
return result;
}
And my response is
result in getdata :
Getesponse{GetResult=anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyType
{element=anyType{complexType=anyType{sequence=anyType{element=anyType{};
element=anyType{}; element=anyType{};
element=anyType{}; element=anyType{}; element=anyType{};
element=anyType{}; }; }; }; }; }; }; };
diffgram=anyType{DocumentElement=anyType{Table1=anyType{Name=Sathish1;
Subject=anyType{}; ID=0014; }; }; }; }; }
Here I want subject as null instead of anyType{}. Is there any better idea
other than checking using if statement friends?
This is my asynchronous code
@Override
protected SoapObject doInBackground(String... params) {
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("ID", "0014");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.implicitTypes = false;
envelope.dotNet = true;
HttpTransportSE transport = new HttpTransportSE(URL);
try {
transport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
try {
SoapFault fault = (SoapFault) envelope.bodyIn;
System.out.println("fault in getdata : " + fault);
} catch (Exception e) {
e.printStackTrace();
}
try {
result = (SoapObject) envelope.bodyIn;
System.out.println("result in getdata : " + result);
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
// System.out.println("Exception : " + e.toString());
}
return result;
}
And my response is
result in getdata :
Getesponse{GetResult=anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyType
{element=anyType{complexType=anyType{sequence=anyType{element=anyType{};
element=anyType{}; element=anyType{};
element=anyType{}; element=anyType{}; element=anyType{};
element=anyType{}; }; }; }; }; }; }; };
diffgram=anyType{DocumentElement=anyType{Table1=anyType{Name=Sathish1;
Subject=anyType{}; ID=0014; }; }; }; }; }
Here I want subject as null instead of anyType{}. Is there any better idea
other than checking using if statement friends?
Height/width definitions of tag was not implemented
Height/width definitions of tag was not implemented
First, see fiddle JSFIDDLE
I created a list
<div id="info_list">
<ul>
<li><a href="#">Milk</a></li>
<li><a href="#">Eggs</a></li>
<li><a href="#">Cheese</a></li>
<li><a href="#">Vegetables</a></li>
<li><a href="#">Fruit</a></li>
</ul>
</div>
The css of tag is
#info_list ul li a{
height: 30px;
width: 230px;
color: #AAA;
line-height: 30px;
text-decoration: none;
cursor: pointer;
}
However, even I regulated the height and the width, I still cannot reach
the url by clicking the space place of each list. It only works by
clicking the text.
Thanks!
First, see fiddle JSFIDDLE
I created a list
<div id="info_list">
<ul>
<li><a href="#">Milk</a></li>
<li><a href="#">Eggs</a></li>
<li><a href="#">Cheese</a></li>
<li><a href="#">Vegetables</a></li>
<li><a href="#">Fruit</a></li>
</ul>
</div>
The css of tag is
#info_list ul li a{
height: 30px;
width: 230px;
color: #AAA;
line-height: 30px;
text-decoration: none;
cursor: pointer;
}
However, even I regulated the height and the width, I still cannot reach
the url by clicking the space place of each list. It only works by
clicking the text.
Thanks!
Thursday, 22 August 2013
K-th order neighbors in graph - Python networkx
K-th order neighbors in graph - Python networkx
I have a directed graph in which I want to efficiently find a list of all
K-th order neighbors of a node. K-th order neighbors are defined as all
nodes which can be reached from the node in question in exactly K hops.
I looked at networkx and the only function relevant was neighbors.
However, this just returns the order 1 neighbors. For higher order, we
need to iterate to determine the full set. I believe there should be a
more efficient way of accessing K-th order neighbors in networkx.
Is there a function which efficiently returns the K-th order neighbors,
without incrementally building the set?
EDIT: In case there exist other graph libraries in Python which might be
useful here, please do mention those.
I have a directed graph in which I want to efficiently find a list of all
K-th order neighbors of a node. K-th order neighbors are defined as all
nodes which can be reached from the node in question in exactly K hops.
I looked at networkx and the only function relevant was neighbors.
However, this just returns the order 1 neighbors. For higher order, we
need to iterate to determine the full set. I believe there should be a
more efficient way of accessing K-th order neighbors in networkx.
Is there a function which efficiently returns the K-th order neighbors,
without incrementally building the set?
EDIT: In case there exist other graph libraries in Python which might be
useful here, please do mention those.
Delay with Android NavigationDrawer
Delay with Android NavigationDrawer
I've followed Google's recommended implementation of the Navigation Drawer
and now have an introductory Fragment and Map fragment that I transition
between. The drawer worked smoothly until I added ActionBarSherlock to my
project. Now, when the home (original fragment) is selected the menu is
delayed closing and I get an annoying flash before the home fragment
appears.
The fragment transaction is handled by:
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction .setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out) .replace(R.id.content_frame, fragment, null)
.commit();
Any suggestions are welcome.
I've followed Google's recommended implementation of the Navigation Drawer
and now have an introductory Fragment and Map fragment that I transition
between. The drawer worked smoothly until I added ActionBarSherlock to my
project. Now, when the home (original fragment) is selected the menu is
delayed closing and I get an annoying flash before the home fragment
appears.
The fragment transaction is handled by:
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction .setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out) .replace(R.id.content_frame, fragment, null)
.commit();
Any suggestions are welcome.
Why does Option+Left Arrow work in Vim, but not Right Arrow on Mac OS X?
Why does Option+Left Arrow work in Vim, but not Right Arrow on Mac OS X?
Using Vim in Terminal on Mac OS X, my Option+Left Arrow skips words as
expected, but my Option+Right Arrow does nothing. How can I fix this?
Using Vim in Terminal on Mac OS X, my Option+Left Arrow skips words as
expected, but my Option+Right Arrow does nothing. How can I fix this?
SQL SERVER 2008 QUERY
SQL SERVER 2008 QUERY
I have a table that consists of 12 columns as follows:
acct, addr1, addr2, addr3, addr4, addr5,
addr6, addr7, add8, zip, domicile, shares
What I need is to roll up the total shares into one row for duplicate
rows. The criteria is that addr1 through addr4 are identical which
determines that the row is a duplicate.
I tried this but it didnt work.
SELECT acct, na1, na2, na3,
na4, na5, na6, na7, na8,
zip, DOMICILE, sum(shares) as total_shares
FROM table_name
GROUP BY na1, na2, na3, na4 ORDER BY na1;
I have a table that consists of 12 columns as follows:
acct, addr1, addr2, addr3, addr4, addr5,
addr6, addr7, add8, zip, domicile, shares
What I need is to roll up the total shares into one row for duplicate
rows. The criteria is that addr1 through addr4 are identical which
determines that the row is a duplicate.
I tried this but it didnt work.
SELECT acct, na1, na2, na3,
na4, na5, na6, na7, na8,
zip, DOMICILE, sum(shares) as total_shares
FROM table_name
GROUP BY na1, na2, na3, na4 ORDER BY na1;
How to solve large sparse linear system from Scala
How to solve large sparse linear system from Scala
There have been a few questions inquiring about general math/stats
frameworks for Scala.
I am interested in only one specific problem, that of solving a large
sparse linear system. Essentially I am looking for an equivalent of
scipy.sparse.linalg.spsolve.
Currently I am looking into breeze-math of ScalaNLP Breeze, which looks
like it would do the job, except that the focus of this library collection
is natural language processing, so it feels a bit strange to use that.
Saddle also looks promising, but not very mature yet, and looking at its
dependencies, EJML doesn't seem to have sparse functionality, while Apache
commons math did, but it was flaky.
Has anyone got a reasonably simple end efficient solution that is
currently available?
There have been a few questions inquiring about general math/stats
frameworks for Scala.
I am interested in only one specific problem, that of solving a large
sparse linear system. Essentially I am looking for an equivalent of
scipy.sparse.linalg.spsolve.
Currently I am looking into breeze-math of ScalaNLP Breeze, which looks
like it would do the job, except that the focus of this library collection
is natural language processing, so it feels a bit strange to use that.
Saddle also looks promising, but not very mature yet, and looking at its
dependencies, EJML doesn't seem to have sparse functionality, while Apache
commons math did, but it was flaky.
Has anyone got a reasonably simple end efficient solution that is
currently available?
Making Chrome Extension Installer In NSIS
Making Chrome Extension Installer In NSIS
!define PRODUCT_VERSION "1.0.0"
!define CRXNAME "1.crx"
!define CRXID "qwertyuiopasdfghjklzxcvbnm"
SetOutPath "$INSTDIR"
File "${CRXNAME}"
WriteRegStr HKLM "Software\Google\Chrome\Extensions\${CRXID}" "path"
"$INSTDIR\${CRXNAME}"
WriteRegStr HKLM "Software\Google\Chrome\Extensions\${CRXID}" "version"
"${PRODUCT_VERSION}"
WriteRegStr HKLM "Software\Wow6432Node\Google\Chrome\Extensions\${CRXID}"
"path" "$INSTDIR\${CRXNAME}"
WriteRegStr HKLM "Software\Wow6432Node\Google\Chrome\Extensions\${CRXID}"
"version" "${PRODUCT_VERSION}"
getting This Error
!define: "MUI_INSERT_NSISCONF"=""
Changing directory to: "C:\Users\XX\Desktop"
Processing script file: "C:\Users\XX\Desktop\szdsds.nsi" (ACP)
!define: "PRODUCT_VERSION"="1.0.0"
!define: "CRXNAME"="1.crx"
!define: "CRXID"="qwertyuiopasdfghjklzxcvbnm"
Error: command SetOutPath not valid outside Section or Function
Error in script "C:\Users\Styli\Desktop\szdsds.nsi" on line 5 -- aborting
creation process
All Files Are In Same Directory. Tried Changing Directory still getting error
!define PRODUCT_VERSION "1.0.0"
!define CRXNAME "1.crx"
!define CRXID "qwertyuiopasdfghjklzxcvbnm"
SetOutPath "$INSTDIR"
File "${CRXNAME}"
WriteRegStr HKLM "Software\Google\Chrome\Extensions\${CRXID}" "path"
"$INSTDIR\${CRXNAME}"
WriteRegStr HKLM "Software\Google\Chrome\Extensions\${CRXID}" "version"
"${PRODUCT_VERSION}"
WriteRegStr HKLM "Software\Wow6432Node\Google\Chrome\Extensions\${CRXID}"
"path" "$INSTDIR\${CRXNAME}"
WriteRegStr HKLM "Software\Wow6432Node\Google\Chrome\Extensions\${CRXID}"
"version" "${PRODUCT_VERSION}"
getting This Error
!define: "MUI_INSERT_NSISCONF"=""
Changing directory to: "C:\Users\XX\Desktop"
Processing script file: "C:\Users\XX\Desktop\szdsds.nsi" (ACP)
!define: "PRODUCT_VERSION"="1.0.0"
!define: "CRXNAME"="1.crx"
!define: "CRXID"="qwertyuiopasdfghjklzxcvbnm"
Error: command SetOutPath not valid outside Section or Function
Error in script "C:\Users\Styli\Desktop\szdsds.nsi" on line 5 -- aborting
creation process
All Files Are In Same Directory. Tried Changing Directory still getting error
Wednesday, 21 August 2013
Extjs4.1 - Submit Valid form within hidden field has allowblank false
Extjs4.1 - Submit Valid form within hidden field has allowblank false
I have a form panel with dynamic items. Some items has hidden like example:
items: [{
xtype: 'textfield',
fieldLabel: 'Field 1',
name: 'theField'
},{
xtype: 'textfield',
fieldLabel: 'Field 2',
name: 'theField'
},{
xtype: 'textfield',
fieldLabel: 'Field 3',
name: 'theField',
hidden: true,
allowBlank : false
}]
But when i submit my form like
if (form.isValid()) {
alert('submit');
}else alert('fail');
that will check all field, and my form will not submit.
Has anyway to valid form (only field is shown) ? how to do that thanks
Here is my example to check http://jsfiddle.net/jZYcQ/
I have a form panel with dynamic items. Some items has hidden like example:
items: [{
xtype: 'textfield',
fieldLabel: 'Field 1',
name: 'theField'
},{
xtype: 'textfield',
fieldLabel: 'Field 2',
name: 'theField'
},{
xtype: 'textfield',
fieldLabel: 'Field 3',
name: 'theField',
hidden: true,
allowBlank : false
}]
But when i submit my form like
if (form.isValid()) {
alert('submit');
}else alert('fail');
that will check all field, and my form will not submit.
Has anyway to valid form (only field is shown) ? how to do that thanks
Here is my example to check http://jsfiddle.net/jZYcQ/
Maps V2 with viewPager
Maps V2 with viewPager
I'm currently developing for Android 4.3.
Background:
I'm using pageViewer to scroll between three different fragments. My
second fragment (tab 2) has XML with SupportMapFragment and other content.
as shown below :
My Attempt:
While searching the web I noticed that for SupportMapFragment I need
FragmentActivity which doesn't apply for FragmentPagerAdapter. I need the
user to have the ability to control the map as well as control the rest of
the content in the fragment.
My Question:
How can I use the SupportMapFragment with the viewPager while having more
content in the Fragment?
More about my code: in the getItem inside FragmentPagerAdapter I'm
returning Singleton Fragments (each Fragment has a class) therefore I
couldn't find any solution over the Internet since my class can't extend
SupportMapFragment because it has more data.
I'm currently developing for Android 4.3.
Background:
I'm using pageViewer to scroll between three different fragments. My
second fragment (tab 2) has XML with SupportMapFragment and other content.
as shown below :
My Attempt:
While searching the web I noticed that for SupportMapFragment I need
FragmentActivity which doesn't apply for FragmentPagerAdapter. I need the
user to have the ability to control the map as well as control the rest of
the content in the fragment.
My Question:
How can I use the SupportMapFragment with the viewPager while having more
content in the Fragment?
More about my code: in the getItem inside FragmentPagerAdapter I'm
returning Singleton Fragments (each Fragment has a class) therefore I
couldn't find any solution over the Internet since my class can't extend
SupportMapFragment because it has more data.
JSON Serialization song information
JSON Serialization song information
I've been able to serialize dictionary before but am not sure how to go
about serializing multiple pieces of data.
I want to serialize song information, how would I go about doing this for
multiple songs? The code I have to output the strings are:
NSArray *songs = [playlist items];
for (MPMediaItem *song in songs){
NSString *title =[song valueForProperty: MPMediaItemPropertyTitle];
NSString *artist =[song valueForProperty:
MPMediaItemPropertyAlbumArtist];
NSString *album =[song valueForProperty:
MPMediaItemPropertyAlbumTitle];
NSString *length =[song valueForProperty:
MPMediaItemPropertyPlaybackDuration];
NSLog(@"Title: %@\nArtist: %@\nAlbum: %@\nLength:
%@",title,artist,album,length);
}
I don't know how to separate this in the JSON for every song.
I've been able to serialize dictionary before but am not sure how to go
about serializing multiple pieces of data.
I want to serialize song information, how would I go about doing this for
multiple songs? The code I have to output the strings are:
NSArray *songs = [playlist items];
for (MPMediaItem *song in songs){
NSString *title =[song valueForProperty: MPMediaItemPropertyTitle];
NSString *artist =[song valueForProperty:
MPMediaItemPropertyAlbumArtist];
NSString *album =[song valueForProperty:
MPMediaItemPropertyAlbumTitle];
NSString *length =[song valueForProperty:
MPMediaItemPropertyPlaybackDuration];
NSLog(@"Title: %@\nArtist: %@\nAlbum: %@\nLength:
%@",title,artist,album,length);
}
I don't know how to separate this in the JSON for every song.
Python: Internal Information of Function calls and Automated Logging
Python: Internal Information of Function calls and Automated Logging
I want to write a class that will show me the tree of currently working
functions, that means:
Let's say I have function A call function B first and then function C, and
function C calls function D. At time t = 1, B is running, so I want the
stdout to be:
Root: function A -> running properly, called B
2-nd: function B -> running properly
At time t = 2, B has returned to A, so the stdout becomes:
Root: function A -> running properly, B returned
At time t = 3, A has called C. At time t = 4, C has called D. The stdout
should be:
Root: function A -> running properly, B returned, called C
2-nd: function C -> running properly, called D
3-rd: function D -> running properly
At time t = 5, D returned. At time t = 6, C returned. The stdout should be:
Root: function A -> running properly, B returned, C returned
At time t = 7, function A returned:
Root: function A -> Done
Besides creating a logger object and passing it around, is there a more
elegant way to automate this? What if A or B is a multithreaded process?
Any suggestions is much appreciated. Thank you!
I want to write a class that will show me the tree of currently working
functions, that means:
Let's say I have function A call function B first and then function C, and
function C calls function D. At time t = 1, B is running, so I want the
stdout to be:
Root: function A -> running properly, called B
2-nd: function B -> running properly
At time t = 2, B has returned to A, so the stdout becomes:
Root: function A -> running properly, B returned
At time t = 3, A has called C. At time t = 4, C has called D. The stdout
should be:
Root: function A -> running properly, B returned, called C
2-nd: function C -> running properly, called D
3-rd: function D -> running properly
At time t = 5, D returned. At time t = 6, C returned. The stdout should be:
Root: function A -> running properly, B returned, C returned
At time t = 7, function A returned:
Root: function A -> Done
Besides creating a logger object and passing it around, is there a more
elegant way to automate this? What if A or B is a multithreaded process?
Any suggestions is much appreciated. Thank you!
How to do a surface with pstricks using data from a surveying?
How to do a surface with pstricks using data from a surveying?
For each point of the grid a have the coordinates (X,Y) and height (Z),
like: X 1 2 3 1 2 3 1 2 3
Y 1 1 1 2 2 2 3 3 3
Z 2 1 0 4 5 1 8 4 3
For each point of the grid a have the coordinates (X,Y) and height (Z),
like: X 1 2 3 1 2 3 1 2 3
Y 1 1 1 2 2 2 3 3 3
Z 2 1 0 4 5 1 8 4 3
Assingning unique id and names?
Assingning unique id and names?
I have a html table with one prototype row. Prototype row has few tds and
each td has input element. I am trying to clone the row and assign unique
ids and names. But in Fire fox new ids and names are assigned properly.
But in IE unique ids and names are not assigned. This logic works fine in
FF. But in IE7 it does not work.
html Table:
<table class="myTable">
<tr class="prototype">
<td>
<label for="myValue1">MY Value ONE:</label><br>
<input class="required email" id="myValue1" type="text" value=""
name="myValue1">
</td>
<td>
<label for="myValue2">MY Value TWO:</label><br>
<input class="required email" id="myValue2" type="text" value=""
name="myValue2">
</td>
<td>
<label for="myValue3">MY Value THREE:</label><br>
<input class="required email" id="myValue3" type="text" value=""
name="myValue3">
</td>
<td>
<label for="myValue4">MY Value FOUR:</label><br>
<input class="required email" id="myValue4" type="text" value=""
name="myValue4">
</td>
</tr>
</table>
JQuery code:
$("#new").click(function(e) {
e.preventDefault();
var d = new Date();
var counter = d.getTime();
var master = $("table.myTable");
var prot = master.find("tr.prototype").clone();
prot.removeClass('prototype');
prot.addClass("contact");
prot.find("#myValue1").attr('id',"myValue1"+counter);
prot.find("#myValue2").attr('id',"myValue2"+counter);
prot.find("#myValue3").attr('id',"myValue3"+counter);
prot.find("#myValue4").attr('id',"myValue4"+counter);
prot.find("#myValue1"+counter).attr('name',"myValue1"+counter);
prot.find("#myValue2"+counter).attr('name',"myValue2"+counter);
prot.find("#myValue3"+counter).attr('name',"myValue3"+counter);
prot.find("#myValue4"+counter).attr('name',"myValue4"+counter);
jQuery('table.myTable tr:last').before(prot);
});
But with the above code unique ids and names are not assigned.am i doing
anything wrong here?
Thanks!
I have a html table with one prototype row. Prototype row has few tds and
each td has input element. I am trying to clone the row and assign unique
ids and names. But in Fire fox new ids and names are assigned properly.
But in IE unique ids and names are not assigned. This logic works fine in
FF. But in IE7 it does not work.
html Table:
<table class="myTable">
<tr class="prototype">
<td>
<label for="myValue1">MY Value ONE:</label><br>
<input class="required email" id="myValue1" type="text" value=""
name="myValue1">
</td>
<td>
<label for="myValue2">MY Value TWO:</label><br>
<input class="required email" id="myValue2" type="text" value=""
name="myValue2">
</td>
<td>
<label for="myValue3">MY Value THREE:</label><br>
<input class="required email" id="myValue3" type="text" value=""
name="myValue3">
</td>
<td>
<label for="myValue4">MY Value FOUR:</label><br>
<input class="required email" id="myValue4" type="text" value=""
name="myValue4">
</td>
</tr>
</table>
JQuery code:
$("#new").click(function(e) {
e.preventDefault();
var d = new Date();
var counter = d.getTime();
var master = $("table.myTable");
var prot = master.find("tr.prototype").clone();
prot.removeClass('prototype');
prot.addClass("contact");
prot.find("#myValue1").attr('id',"myValue1"+counter);
prot.find("#myValue2").attr('id',"myValue2"+counter);
prot.find("#myValue3").attr('id',"myValue3"+counter);
prot.find("#myValue4").attr('id',"myValue4"+counter);
prot.find("#myValue1"+counter).attr('name',"myValue1"+counter);
prot.find("#myValue2"+counter).attr('name',"myValue2"+counter);
prot.find("#myValue3"+counter).attr('name',"myValue3"+counter);
prot.find("#myValue4"+counter).attr('name',"myValue4"+counter);
jQuery('table.myTable tr:last').before(prot);
});
But with the above code unique ids and names are not assigned.am i doing
anything wrong here?
Thanks!
Tuesday, 20 August 2013
Get Multiple Files Path with Right Click
Get Multiple Files Path with Right Click
I have added my application to the right click menu of Windows with the
help of the registry
"C://myapp.exe "%1"
I am able to get the path of the selected file in a MessageBox using the
below code. It is okay if I want to open a single file, but if I select
multiple files, it runs multiple instances of my application. I need the
path of all selected file in the single instance only. Can anyone give me
an idea of how to do this?
static void Main(string[] args)
{
foreach (string path in args)
{
MessageBox.Show(path);
}
}
I have added my application to the right click menu of Windows with the
help of the registry
"C://myapp.exe "%1"
I am able to get the path of the selected file in a MessageBox using the
below code. It is okay if I want to open a single file, but if I select
multiple files, it runs multiple instances of my application. I need the
path of all selected file in the single instance only. Can anyone give me
an idea of how to do this?
static void Main(string[] args)
{
foreach (string path in args)
{
MessageBox.Show(path);
}
}
Using curly braces to separate code in C++
Using curly braces to separate code in C++
One thing I really like about IDEs is the ability to "minimize" sections
of code, so that:
while(conditions){
// Really long code...
}
Can become:
while(conditions){ // The rest is hidden
My question is whether or not something like this would be acceptable
formatting
// Code
{
// More code
}
// Code
I understand that anything done inside the brackets would have that
limited scope, but I can also edit variables in the outer scope as well.
So, for a short, unnecessary example
int x = 1;
{ // Create new variable, add and output
int y = 2;
cout << x + y;
}
Would become:
int x = 1;
{ // Create new variable, add and output (The rest of the code is hidden)
So would this be acceptable, or shunned?
Thanks.
One thing I really like about IDEs is the ability to "minimize" sections
of code, so that:
while(conditions){
// Really long code...
}
Can become:
while(conditions){ // The rest is hidden
My question is whether or not something like this would be acceptable
formatting
// Code
{
// More code
}
// Code
I understand that anything done inside the brackets would have that
limited scope, but I can also edit variables in the outer scope as well.
So, for a short, unnecessary example
int x = 1;
{ // Create new variable, add and output
int y = 2;
cout << x + y;
}
Would become:
int x = 1;
{ // Create new variable, add and output (The rest of the code is hidden)
So would this be acceptable, or shunned?
Thanks.
Convert.ToInt32(String) in C# not working?
Convert.ToInt32(String) in C# not working?
I have a text box named textBox1, and In a certain case, I want to convert
the string in the textbox to an integer for later use as an integer.
It's throwing an error that I can't even understand. Here is a screenshot:
(I need 10 rep. to post images directly) http://i.stack.imgur.com/lxZa0.png
I would really appreciate it if you could give me an answer or fix to my
code, and explain why it doesn't/does work.
I have a text box named textBox1, and In a certain case, I want to convert
the string in the textbox to an integer for later use as an integer.
It's throwing an error that I can't even understand. Here is a screenshot:
(I need 10 rep. to post images directly) http://i.stack.imgur.com/lxZa0.png
I would really appreciate it if you could give me an answer or fix to my
code, and explain why it doesn't/does work.
Create a program without semicolom [on hold]
Create a program without semicolom [on hold]
i want to create a program without semi colon in any language. Is this
possible because i have wondered many places but not getting any proper
response. So please help me.
i want to create a program without semi colon in any language. Is this
possible because i have wondered many places but not getting any proper
response. So please help me.
Best way to make favoruites/related content in tables?
Best way to make favoruites/related content in tables?
Sorry if my question is not properly formulated, i don't know exactly how
to ask it. I'm looking for a good way for example to save favourite images
for a specific user in the database. Or if i have a movie, i want to
display related movies, you get the idea. I don't know how to do it on a
database level (phpmyadmin). My idea so far is if i have a table named
Users, i add a column in it named Favourites, in which i enter every ID or
Name of the favourited item. The problem is that the content in this
column may grow a lot more than i expect, and i don't fee this is a good
way to do it. So how do i go about this?
Sorry if my question is not properly formulated, i don't know exactly how
to ask it. I'm looking for a good way for example to save favourite images
for a specific user in the database. Or if i have a movie, i want to
display related movies, you get the idea. I don't know how to do it on a
database level (phpmyadmin). My idea so far is if i have a table named
Users, i add a column in it named Favourites, in which i enter every ID or
Name of the favourited item. The problem is that the content in this
column may grow a lot more than i expect, and i don't fee this is a good
way to do it. So how do i go about this?
jdk 1.7.25 CORBA idl build warning: Anonymous sequences and array are deprecated
jdk 1.7.25 CORBA idl build warning: Anonymous sequences and array are
deprecated
My java project updated to jdk 1.7.25, over Solaris 10 environment, this
is the first time seen that there is a new warning message in build log:
Anonymous sequences and array are deprecated (build IDL)
problem: The main GUI(build by jdk 1.7.25) cannot been brought up
We think this maybe a problem(but not sure). The idl file is very simple:
$ cat UnsubscribeAttb.idl
//../../../proj/request/requestIfc/UnsubscribeAttb.idl
include ../../../proj/request/requestIfc/subscribeKey.idl
struct requestIfc {
bool aKey;
sequence<subscribeKey> UnsubscribeAttbList;
}
I put in "typedef" at the front of the last line, but build immediately
gives an error complained this line, but didnot give me a specific reason.
Looking for your help.
Thanks, Curtis
deprecated
My java project updated to jdk 1.7.25, over Solaris 10 environment, this
is the first time seen that there is a new warning message in build log:
Anonymous sequences and array are deprecated (build IDL)
problem: The main GUI(build by jdk 1.7.25) cannot been brought up
We think this maybe a problem(but not sure). The idl file is very simple:
$ cat UnsubscribeAttb.idl
//../../../proj/request/requestIfc/UnsubscribeAttb.idl
include ../../../proj/request/requestIfc/subscribeKey.idl
struct requestIfc {
bool aKey;
sequence<subscribeKey> UnsubscribeAttbList;
}
I put in "typedef" at the front of the last line, but build immediately
gives an error complained this line, but didnot give me a specific reason.
Looking for your help.
Thanks, Curtis
LTTng version not found in Eclipse
LTTng version not found in Eclipse
I'm following this guide to use LTTng in Eclipse. I add a new connection
to the remote server but when I try to connect I get the following error
message:
Error retrieving node configuration
Reason: Could not get version of LTTng Tracer Control
However, when I look at the installation details, it says version
2.0.0.201306111610 for "LTTng - Linux Tracing Toolkit".
Does anyone have a clue how to solve this?
I'm following this guide to use LTTng in Eclipse. I add a new connection
to the remote server but when I try to connect I get the following error
message:
Error retrieving node configuration
Reason: Could not get version of LTTng Tracer Control
However, when I look at the installation details, it says version
2.0.0.201306111610 for "LTTng - Linux Tracing Toolkit".
Does anyone have a clue how to solve this?
Monday, 19 August 2013
JQuery UI Draggable & Droppable "Revert" and "Out" conflict
JQuery UI Draggable & Droppable "Revert" and "Out" conflict
I am trying to make it so that multiple items that are draggable can only
be dragged to 1 droppable. If dropped outside of a droppable then revert.
Most of my code works except for one bug:
User drags the item into the droppable. Then drags out (executes out
function) then he fails to drop in a droppable (revert happens, drag goes
back to its previous droppable). What has effectively happened is the
droppable can now accept any drag (since the drag left, executing out)
while the drag never actually left due to revert.
I have been trying to resolve this for several of hours and have gone
through the API. I even tried to have a callback function for revert
however due to confusion on how to retrieve the draggable's droppable, I
am stuck.
//revert if not dragged to a draggable.
$( "[id|=drag]" ).draggable({ revert: 'invalid', revertDuration: 350 });
$( ".dropZone" ).droppable({
drop: function(ev,ui) {
$(this).droppable('option', 'accept', ui.draggable); //only accept
the current drag.
},
out: function(ev, ui) {
$(this).droppable('option', 'accept', '[id|=drag]');//now you can
accept any drag.
}
});
I am trying to make it so that multiple items that are draggable can only
be dragged to 1 droppable. If dropped outside of a droppable then revert.
Most of my code works except for one bug:
User drags the item into the droppable. Then drags out (executes out
function) then he fails to drop in a droppable (revert happens, drag goes
back to its previous droppable). What has effectively happened is the
droppable can now accept any drag (since the drag left, executing out)
while the drag never actually left due to revert.
I have been trying to resolve this for several of hours and have gone
through the API. I even tried to have a callback function for revert
however due to confusion on how to retrieve the draggable's droppable, I
am stuck.
//revert if not dragged to a draggable.
$( "[id|=drag]" ).draggable({ revert: 'invalid', revertDuration: 350 });
$( ".dropZone" ).droppable({
drop: function(ev,ui) {
$(this).droppable('option', 'accept', ui.draggable); //only accept
the current drag.
},
out: function(ev, ui) {
$(this).droppable('option', 'accept', '[id|=drag]');//now you can
accept any drag.
}
});
What is the user postgres wants a password for?
What is the user postgres wants a password for?
I'm at such a loss-- I did a fresh install of Postgres (Windows 7) and I
still can't do anything.
When I try to run any command, even psql -l, it asks me for a password,
then tells me password authentication failed for user Aerovistae.....WHERE
IS IT GETTING THESE CREDENTIALS FROM? What password does it want??
When the program was set up it only asked me to supply info for the
postgres superuser, which I did...where is it getting the user Aerovistae
from, which is my normal handle but not one I supplied to postgres! I'm so
confused.
I'm at such a loss-- I did a fresh install of Postgres (Windows 7) and I
still can't do anything.
When I try to run any command, even psql -l, it asks me for a password,
then tells me password authentication failed for user Aerovistae.....WHERE
IS IT GETTING THESE CREDENTIALS FROM? What password does it want??
When the program was set up it only asked me to supply info for the
postgres superuser, which I did...where is it getting the user Aerovistae
from, which is my normal handle but not one I supplied to postgres! I'm so
confused.
Show the window shadow when using VCL styles
Show the window shadow when using VCL styles
Is there a way to show the window shadow, as per normal Windows 7 forms,
when using a VCL style?
I understand the bitmap and settings in the style replaces the form
borders, but isn't the shadow some sort of alpha blend / aero thing that
is outside the area affected by the style?
Adding CS_DROPSHADOW to the WindowClass.Style seems to have no effect.
Is there a way to show the window shadow, as per normal Windows 7 forms,
when using a VCL style?
I understand the bitmap and settings in the style replaces the form
borders, but isn't the shadow some sort of alpha blend / aero thing that
is outside the area affected by the style?
Adding CS_DROPSHADOW to the WindowClass.Style seems to have no effect.
Problems accessing a COM class in C++
Problems accessing a COM class in C++
What I want to do is access a COM interface and then call the "Open"
method of that interface. I have a sample code in Visual Basic which works
fine, but I need to write it in C++ and I can't seem to get it to work.
First of all, this is the working VB code:
Dim CANapeApplication As CANAPELib.Application
CANapeApplication = CreateObject("CANape.Application")
Call
CANapeApplication.Open("C:\Users\Public\Documents\Vector\CANape\12\Project",
0)
CANape.Application is the ProgID which selects the interface I need.
After reading some docs at msdn.microsoft.com and this question, I wrote
this code:
void ErrorDescription(HRESULT hr); //Function to output a readable hr error
int InitCOM();
int OpenCANape();
// Declarations of variables used.
HRESULT hresult;
void **canApeAppPtr;
IDispatch *pdisp;
CLSID ClassID;
DISPID FAR dispid;
UINT nArgErr;
OLECHAR FAR* canApeWorkingDirectory =
L"C:\\Users\\Public\\Documents\\Vector\\CANape\\12\\Project";
int main(){
// Instantiate CANape COM interface
if (InitCOM() != 0) {
std::cout << "init error";
return 1;
}
// Open CANape
if (OpenCANape() != 0) {
std::cout << "Failed to open CANape Project" << std::endl;
return 1;
}
CoUninitialize();
return 0;
}
void ErrorDescription(HRESULT hr) {
if(FACILITY_WINDOWS == HRESULT_FACILITY(hr))
hr = HRESULT_CODE(hr);
TCHAR* szErrMsg;
if(FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&szErrMsg, 0, NULL) != 0)
{
_tprintf(TEXT("%s"), szErrMsg);
LocalFree(szErrMsg);
} else
_tprintf( TEXT("[Could not find a description for error #
%#x.]\n"), hr);
}
int InitCOM() {
// Initialize OLE DLLs.
hresult = OleInitialize(NULL);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
// Get CLSID from ProgID
//hresult = CLSIDFromProgID(OLESTR("CANape.Application"), &ClassID);
hresult = CLSIDFromProgID(OLESTR("CanapeCom.CanapeCom"), &ClassID);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
// OLE function CoCreateInstance starts application using GUID/CLSID
hresult = CoCreateInstance(ClassID, NULL, CLSCTX_LOCAL_SERVER,
IID_IDispatch, (void **)&pdisp);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
// Call QueryInterface to see if object supports IDispatch
hresult = pdisp->QueryInterface(IID_IDispatch, (void **)&pdisp);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
std::cout << "success" << std::endl;
return 0;
}
int OpenCANape() {
//Method name
OLECHAR *szMember = L"Open";
// Retrieve the dispatch identifier for the Open method
// Use defaults where possible
DISPID idFileExists;
hresult = pdisp->GetIDsOfNames(
IID_NULL,
&szMember,
1,
LOCALE_SYSTEM_DEFAULT,
&idFileExists);
if (!SUCCEEDED(hresult)) {
std::cout << "GetIDsOfNames: ";
ErrorDescription(hresult);
return 1;
}
unsigned int puArgErr = 0;
VARIANT VarResult;
VariantInit(&VarResult);
DISPPARAMS pParams;
memset(&pParams, 0, sizeof(DISPPARAMS));
pParams.cArgs = 2;
VARIANT Arguments[2];
VariantInit(&Arguments[0]);
pParams.rgvarg = Arguments;
pParams.cNamedArgs = 0;
pParams.rgvarg[0].vt = VT_BSTR;
pParams.rgvarg[0].bstrVal = SysAllocString(canApeWorkingDirectory);
pParams.rgvarg[1].vt = VT_INT;
pParams.rgvarg[1].intVal = 0; // debug mode
// Invoke the method. Use defaults where possible.
hresult = pdisp->Invoke(
dispid,
IID_NULL,
LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD,
&pParams,
&VarResult,
NULL,
&puArgErr
);
SysFreeString(pParams.rgvarg[0].bstrVal);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
return 0;
}
There are several problems with this.
Using the ClassID received from CLSIDFromProgID as the first parameter of
CoCreateInstance does not work, it returns the error: class not registered
If i use the ProgID CanapeCom.CanapeCom (I found it by looking in the
Registry), CoCreateInstance works. However, when I use
pdisp->GetIDsOfNames I get the error message: Unkown name. Which I think
means that the method was not found. That seems logic because I've used a
different ProgID, but I just can't figure out how to get to the interface
I'm looking for.
I have also tried to use the resulting CLSID from
CLSIDFromProgID(OLESTR("CANape.Application"), &ClassID); as the 4th
argument of CoCreateInstance but that resulted in a "No such interface
supported" error.
Do I need the dll file of the software? In the VB example the dll file is
used to get the interface and then create a new object using the ProgID.
I'm not sure if I need to do the same in C++ or how this should work.
I'm really stuck here and hope that someone can help me.
What I want to do is access a COM interface and then call the "Open"
method of that interface. I have a sample code in Visual Basic which works
fine, but I need to write it in C++ and I can't seem to get it to work.
First of all, this is the working VB code:
Dim CANapeApplication As CANAPELib.Application
CANapeApplication = CreateObject("CANape.Application")
Call
CANapeApplication.Open("C:\Users\Public\Documents\Vector\CANape\12\Project",
0)
CANape.Application is the ProgID which selects the interface I need.
After reading some docs at msdn.microsoft.com and this question, I wrote
this code:
void ErrorDescription(HRESULT hr); //Function to output a readable hr error
int InitCOM();
int OpenCANape();
// Declarations of variables used.
HRESULT hresult;
void **canApeAppPtr;
IDispatch *pdisp;
CLSID ClassID;
DISPID FAR dispid;
UINT nArgErr;
OLECHAR FAR* canApeWorkingDirectory =
L"C:\\Users\\Public\\Documents\\Vector\\CANape\\12\\Project";
int main(){
// Instantiate CANape COM interface
if (InitCOM() != 0) {
std::cout << "init error";
return 1;
}
// Open CANape
if (OpenCANape() != 0) {
std::cout << "Failed to open CANape Project" << std::endl;
return 1;
}
CoUninitialize();
return 0;
}
void ErrorDescription(HRESULT hr) {
if(FACILITY_WINDOWS == HRESULT_FACILITY(hr))
hr = HRESULT_CODE(hr);
TCHAR* szErrMsg;
if(FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&szErrMsg, 0, NULL) != 0)
{
_tprintf(TEXT("%s"), szErrMsg);
LocalFree(szErrMsg);
} else
_tprintf( TEXT("[Could not find a description for error #
%#x.]\n"), hr);
}
int InitCOM() {
// Initialize OLE DLLs.
hresult = OleInitialize(NULL);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
// Get CLSID from ProgID
//hresult = CLSIDFromProgID(OLESTR("CANape.Application"), &ClassID);
hresult = CLSIDFromProgID(OLESTR("CanapeCom.CanapeCom"), &ClassID);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
// OLE function CoCreateInstance starts application using GUID/CLSID
hresult = CoCreateInstance(ClassID, NULL, CLSCTX_LOCAL_SERVER,
IID_IDispatch, (void **)&pdisp);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
// Call QueryInterface to see if object supports IDispatch
hresult = pdisp->QueryInterface(IID_IDispatch, (void **)&pdisp);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
std::cout << "success" << std::endl;
return 0;
}
int OpenCANape() {
//Method name
OLECHAR *szMember = L"Open";
// Retrieve the dispatch identifier for the Open method
// Use defaults where possible
DISPID idFileExists;
hresult = pdisp->GetIDsOfNames(
IID_NULL,
&szMember,
1,
LOCALE_SYSTEM_DEFAULT,
&idFileExists);
if (!SUCCEEDED(hresult)) {
std::cout << "GetIDsOfNames: ";
ErrorDescription(hresult);
return 1;
}
unsigned int puArgErr = 0;
VARIANT VarResult;
VariantInit(&VarResult);
DISPPARAMS pParams;
memset(&pParams, 0, sizeof(DISPPARAMS));
pParams.cArgs = 2;
VARIANT Arguments[2];
VariantInit(&Arguments[0]);
pParams.rgvarg = Arguments;
pParams.cNamedArgs = 0;
pParams.rgvarg[0].vt = VT_BSTR;
pParams.rgvarg[0].bstrVal = SysAllocString(canApeWorkingDirectory);
pParams.rgvarg[1].vt = VT_INT;
pParams.rgvarg[1].intVal = 0; // debug mode
// Invoke the method. Use defaults where possible.
hresult = pdisp->Invoke(
dispid,
IID_NULL,
LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD,
&pParams,
&VarResult,
NULL,
&puArgErr
);
SysFreeString(pParams.rgvarg[0].bstrVal);
if (!SUCCEEDED(hresult)) {
ErrorDescription(hresult);
return 1;
}
return 0;
}
There are several problems with this.
Using the ClassID received from CLSIDFromProgID as the first parameter of
CoCreateInstance does not work, it returns the error: class not registered
If i use the ProgID CanapeCom.CanapeCom (I found it by looking in the
Registry), CoCreateInstance works. However, when I use
pdisp->GetIDsOfNames I get the error message: Unkown name. Which I think
means that the method was not found. That seems logic because I've used a
different ProgID, but I just can't figure out how to get to the interface
I'm looking for.
I have also tried to use the resulting CLSID from
CLSIDFromProgID(OLESTR("CANape.Application"), &ClassID); as the 4th
argument of CoCreateInstance but that resulted in a "No such interface
supported" error.
Do I need the dll file of the software? In the VB example the dll file is
used to get the interface and then create a new object using the ProgID.
I'm not sure if I need to do the same in C++ or how this should work.
I'm really stuck here and hope that someone can help me.
UITableView Delete button not coming and also Overlapping my Label
UITableView Delete button not coming and also Overlapping my Label
I have a navigation view and my second view will contains a table with
custom UITableViewCell in it .
I have 2 issues
when i am trying to open the application in Horizontal orientation
(navigate to 2nd view ) and then Rotate the device in Portrait mode then i
am getting a scroll in the Table View portion.
when i open the 2nd view (in navigation) in portrait orientation and then
rotate the device to horizontal and tries to swipe to get the delete
button ,its not working particularly in Horizontal orientation.
Delete buttons are covering my labels
I have used , custom UITableViewCell, AutoLayout and Storyboards
I have also uploaded my project for reference Link
Thanks in advance. !!
I have a navigation view and my second view will contains a table with
custom UITableViewCell in it .
I have 2 issues
when i am trying to open the application in Horizontal orientation
(navigate to 2nd view ) and then Rotate the device in Portrait mode then i
am getting a scroll in the Table View portion.
when i open the 2nd view (in navigation) in portrait orientation and then
rotate the device to horizontal and tries to swipe to get the delete
button ,its not working particularly in Horizontal orientation.
Delete buttons are covering my labels
I have used , custom UITableViewCell, AutoLayout and Storyboards
I have also uploaded my project for reference Link
Thanks in advance. !!
How to get database backup on running website on click of a button using asp.net
How to get database backup on running website on click of a button using
asp.net
Code which I m using for button
protected void btn_backup_Click(object sender, EventArgs e) { try {
Class_Backup objbackup = new Class_Backup(); objbackup.BackUpPath =
"SalvageManager" + DateTime.Now.ToString().Replace("/", "").Replace(":",
"").Replace("-","").Replace(" ",""); objbackup.BackupData(); if
(objbackup.OperationStatus != false) {
Response.ContentType = "application/bak";
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + objbackup.BackUpPath);
Response.TransmitFile(Server.MapPath("~/DataBaseBackUp/" +
objbackup.BackUpPath));
Response.End();
//Response.Redirect(Server.MapPath("~/DataBaseBackUp/" +
objbackup.BackUpPath),false);
}
else
{
lbl_message.Text = objbackup.ErrorMessage;
}
}
catch(Exception ex)
{
lbl_message.Text = ex.Message;
}
}
When I click on button following error occured
Error : Cannot open backup device
'D:\INETPUB\VHOSTS\salvagemanagers.com\httpdocs\DataBaseBackUp\SalvageManager8_19_2013_12_18_01_PM'.
Operating system error 3(The system cannot find the path specified.).
BACKUP DATABASE is terminating abnormally.
asp.net
Code which I m using for button
protected void btn_backup_Click(object sender, EventArgs e) { try {
Class_Backup objbackup = new Class_Backup(); objbackup.BackUpPath =
"SalvageManager" + DateTime.Now.ToString().Replace("/", "").Replace(":",
"").Replace("-","").Replace(" ",""); objbackup.BackupData(); if
(objbackup.OperationStatus != false) {
Response.ContentType = "application/bak";
Response.AppendHeader("Content-Disposition", "attachment;
filename=" + objbackup.BackUpPath);
Response.TransmitFile(Server.MapPath("~/DataBaseBackUp/" +
objbackup.BackUpPath));
Response.End();
//Response.Redirect(Server.MapPath("~/DataBaseBackUp/" +
objbackup.BackUpPath),false);
}
else
{
lbl_message.Text = objbackup.ErrorMessage;
}
}
catch(Exception ex)
{
lbl_message.Text = ex.Message;
}
}
When I click on button following error occured
Error : Cannot open backup device
'D:\INETPUB\VHOSTS\salvagemanagers.com\httpdocs\DataBaseBackUp\SalvageManager8_19_2013_12_18_01_PM'.
Operating system error 3(The system cannot find the path specified.).
BACKUP DATABASE is terminating abnormally.
Sunday, 18 August 2013
Excel - how to look up a table for two values and return another value if these two values match
Excel - how to look up a table for two values and return another value if
these two values match
I hope I am explaining this clearly.
I have sample data 1, but I need this to automatically populate required
sample data with the employee name
Sample data 1:
EmployeeName Type Result
A Annual Exceeds
B Biennial Warning
C Biennial DevelopmentNeeded
D Biennial PartiallyMeets
E Annual Meets
Required sample data: needed to provide an overall summary
PartiallyMeets Meets Exceeds DevelopmentNeeded
Warning
Annual A
Annual E
Annual
Biennial B
Biennial C
Biennial D
I've tried IFERROR, INDEX and MATCH combinations but I haven't had any
success.
Appreciate any help you can provide!! Thanks.
these two values match
I hope I am explaining this clearly.
I have sample data 1, but I need this to automatically populate required
sample data with the employee name
Sample data 1:
EmployeeName Type Result
A Annual Exceeds
B Biennial Warning
C Biennial DevelopmentNeeded
D Biennial PartiallyMeets
E Annual Meets
Required sample data: needed to provide an overall summary
PartiallyMeets Meets Exceeds DevelopmentNeeded
Warning
Annual A
Annual E
Annual
Biennial B
Biennial C
Biennial D
I've tried IFERROR, INDEX and MATCH combinations but I haven't had any
success.
Appreciate any help you can provide!! Thanks.
How do I use a png as a bullet point with LibreOffice Writer?
How do I use a png as a bullet point with LibreOffice Writer?
I'm trying to use LibreOffice Writer to create my resume, and I'd like to
turn a png into a bullet point graphic. Can I do that, and how?
I'm trying to use LibreOffice Writer to create my resume, and I'd like to
turn a png into a bullet point graphic. Can I do that, and how?
Div not echoing in wordpress php
Div not echoing in wordpress php
<?php
if ( is_user_logged_in() ) {
echo '<div id="signin-box"> '.wp_login_form().' </div>';
} else {
echo 'hi';
}
?>
Is what I've got. The login form is working, but it is not being wrapped
in the div. Without the else/if statement, it works.
<?php
if ( is_user_logged_in() ) {
echo '<div id="signin-box"> '.wp_login_form().' </div>';
} else {
echo 'hi';
}
?>
Is what I've got. The login form is working, but it is not being wrapped
in the div. Without the else/if statement, it works.
Alter the display property using jQuery
Alter the display property using jQuery
I am having two divs like:
<div class="toggle">Toggle</div><div class="data">Something</div>
Css should be:
.toggle {
padding: 10px;
border: 1px solid #999;
}
.data {
display: none;
padding: 5px;
}
I have been using jQuery to toggle the hide show property. But I want to
ask how to add the CSS property display: none; to this div and also remove
the CSS property from it when again the click is made. I know how to do
that: using if else. But I am not sure how to add or remove the css
attributes.
All much that I know about jQuery is something like:
$(".toggle").click(function() {
$(".data").show();
}) Any guide for the CSS jQuery?
I am having two divs like:
<div class="toggle">Toggle</div><div class="data">Something</div>
Css should be:
.toggle {
padding: 10px;
border: 1px solid #999;
}
.data {
display: none;
padding: 5px;
}
I have been using jQuery to toggle the hide show property. But I want to
ask how to add the CSS property display: none; to this div and also remove
the CSS property from it when again the click is made. I know how to do
that: using if else. But I am not sure how to add or remove the css
attributes.
All much that I know about jQuery is something like:
$(".toggle").click(function() {
$(".data").show();
}) Any guide for the CSS jQuery?
Allow unstable Android Gradle builds on Jenkins
Allow unstable Android Gradle builds on Jenkins
Hi I have set up my Android project on Jenkins to provide CI. Its working
well, running tests on a connected Android handset. The tests run on the
Android Test Framework which extends jUnit3.
Unfortunately, the build is marked as a failure if there are any test
failures. I'd like to be able to improve this in two ways:
Allowing unstable builds
Being able to mark builds as failures
For item 1 I tried adding this to the project build.gradle:
connectedCheck {
ignoreFailures = true
}
But it has no effect. Looking at the build log, I realised the actual test
task is called connectedInstrumentTest, but this task is not found:
connectedInstrumentTest {
ignoreFailures = true
}
causes:
Could not find method connectedInstrumentTest() for arguments
[build_4ldpah0qgf0ukktofecsq41r98$_run_closure3@9cd826] on project
':Playtime'.
That am I missing?
Thanks
Hi I have set up my Android project on Jenkins to provide CI. Its working
well, running tests on a connected Android handset. The tests run on the
Android Test Framework which extends jUnit3.
Unfortunately, the build is marked as a failure if there are any test
failures. I'd like to be able to improve this in two ways:
Allowing unstable builds
Being able to mark builds as failures
For item 1 I tried adding this to the project build.gradle:
connectedCheck {
ignoreFailures = true
}
But it has no effect. Looking at the build log, I realised the actual test
task is called connectedInstrumentTest, but this task is not found:
connectedInstrumentTest {
ignoreFailures = true
}
causes:
Could not find method connectedInstrumentTest() for arguments
[build_4ldpah0qgf0ukktofecsq41r98$_run_closure3@9cd826] on project
':Playtime'.
That am I missing?
Thanks
Is it possible to use custom allocation operator to create a STACK object?
Is it possible to use custom allocation operator to create a STACK object?
Ok, if I want to create a heap object with a custom new operator, I know
that I need to overload the new operator like this:
void* operator new(size_t size, int unused)
{
void* ptr = malloc(size);
//some custom code
return ptr;
}
And then, if I want to create a heap object using this overloaded operator
I would do this:
SomeClass* a = new(0) SomeClass;
The question is: can I do something like this to create a stack object?
Ok, if I want to create a heap object with a custom new operator, I know
that I need to overload the new operator like this:
void* operator new(size_t size, int unused)
{
void* ptr = malloc(size);
//some custom code
return ptr;
}
And then, if I want to create a heap object using this overloaded operator
I would do this:
SomeClass* a = new(0) SomeClass;
The question is: can I do something like this to create a stack object?
Saturday, 17 August 2013
How to avoid blackboxing function output in bash?
How to avoid blackboxing function output in bash?
If I have a bash script that is purely made of functions, how do I get
things like prompts to show up in the terminal? For example, consider the
following:
prompt() {
read -p "This is an example prompt. [Y/n]"
}
main() {
prompt
}
How do I get that prompt message to show up in the terminal? When I just
call prompt() from main(), it blackboxes the whole prompt() function. Do I
have to return something from prompt()? What if I want to echo a bunch of
messages after the read in prompt()? How do I get those to show up in the
terminal?
I think I'm missing a basic programming concept here.
If I have a bash script that is purely made of functions, how do I get
things like prompts to show up in the terminal? For example, consider the
following:
prompt() {
read -p "This is an example prompt. [Y/n]"
}
main() {
prompt
}
How do I get that prompt message to show up in the terminal? When I just
call prompt() from main(), it blackboxes the whole prompt() function. Do I
have to return something from prompt()? What if I want to echo a bunch of
messages after the read in prompt()? How do I get those to show up in the
terminal?
I think I'm missing a basic programming concept here.
Selecting second entry in rails console?
Selecting second entry in rails console?
I need to select the second entry in the User model.
User.second does not work, nor does User.2 or User.two.
I'm trying to set u to the second User entry (u = User.2)
I need to select the second entry in the User model.
User.second does not work, nor does User.2 or User.two.
I'm trying to set u to the second User entry (u = User.2)
Nsight eclipse: No CUDA devices detected
Nsight eclipse: No CUDA devices detected
I'll be honest, I am new with CUDA on Linux-based OS (well, newbie in
linux itself). I have to admit, that I had big problem with instalation
nvidia drivers on Fedora 18. Somehow it is installed now - but I am not
sure if correctly and I don't know how to find out. When I type nvcc -V,
I've got
satisfying answer, so I belive that should be fine.
Anyway, my problem is, that Nsight Eclipse during making new CUDA C/C++
project says: No CUDA-compatible devices detected. Now I have only GTX
260sp, but I am sure it supports CUDA. I bother with this stuff two days
and I have still nothing. Does anybody know what should I try to get rid
of this problem?
I'll be honest, I am new with CUDA on Linux-based OS (well, newbie in
linux itself). I have to admit, that I had big problem with instalation
nvidia drivers on Fedora 18. Somehow it is installed now - but I am not
sure if correctly and I don't know how to find out. When I type nvcc -V,
I've got
satisfying answer, so I belive that should be fine.
Anyway, my problem is, that Nsight Eclipse during making new CUDA C/C++
project says: No CUDA-compatible devices detected. Now I have only GTX
260sp, but I am sure it supports CUDA. I bother with this stuff two days
and I have still nothing. Does anybody know what should I try to get rid
of this problem?
Evercookie/cookie and Privacy Policy
Evercookie/cookie and Privacy Policy
I have site which is using cookies to remember user preferences and data.
Few months earlier, my country adjusted law to EU ones - user have to be
informed about every cookie created by my page.
I want to give my users better experience and I consider to implement
evercookie mechanism. Is it allowed in countries where you have to be
careful of placing cookies on users machine?
I have site which is using cookies to remember user preferences and data.
Few months earlier, my country adjusted law to EU ones - user have to be
informed about every cookie created by my page.
I want to give my users better experience and I consider to implement
evercookie mechanism. Is it allowed in countries where you have to be
careful of placing cookies on users machine?
Python module for HTTP: fill in forms, retrieve result
Python module for HTTP: fill in forms, retrieve result
I'd like to use Python to access an HTTP website, fill out a form, submit
the form, and retrieve the result.
What modules are suitable for the task?
I'd like to use Python to access an HTTP website, fill out a form, submit
the form, and retrieve the result.
What modules are suitable for the task?
File size limitations of ZipOutputStream?
File size limitations of ZipOutputStream?
I am using the ZipOutputStream to create ZIP files. It works fine, but the
Javadoc is quite sparse, so I'm left with questions about the
characteristics of ZipOutputStream:
Is there a limit for the maximum supported file sizes? Both for files
contained in the ZIP and for the resulting ZIP file itself? The size
argument is long, but who knows. (Let us assume that the filesystem
imposes no limits.)
What is the minimum input file size that justifies use of the DEFLATED
method?
I will always read the resulting ZIP file using ZipInputStream.
I am using the ZipOutputStream to create ZIP files. It works fine, but the
Javadoc is quite sparse, so I'm left with questions about the
characteristics of ZipOutputStream:
Is there a limit for the maximum supported file sizes? Both for files
contained in the ZIP and for the resulting ZIP file itself? The size
argument is long, but who knows. (Let us assume that the filesystem
imposes no limits.)
What is the minimum input file size that justifies use of the DEFLATED
method?
I will always read the resulting ZIP file using ZipInputStream.
PHP not working in javascript function
PHP not working in javascript function
Trying out PHP for the first time and I'm really stumped on this. It might
be something obvious, but why isn't my php inside the function checkinfo()
working? The alert works fine. Here's the code
<head>
<script type="text/javascript">
function checkinfo() {
alert("hi");
<?php
echo 'hi';
?>
};
</script>
</head>
<body>
<form id = "form" align = "center">
<div id = "index">
<div id = "unandpw">
Username:
<input type="text">
<br>
Password:
<input type ="password" >
</div>
<!-- end unandpw -->
<div id = "buttons">
<button type = "button" onclick = "checkinfo()">
Login
</button>
<button type = "button" onclick = "register();">
Register
</button>
</div>
<!-- end buttons -->
</div>
<!--index end -->
</form>
</body>
</html>
Trying out PHP for the first time and I'm really stumped on this. It might
be something obvious, but why isn't my php inside the function checkinfo()
working? The alert works fine. Here's the code
<head>
<script type="text/javascript">
function checkinfo() {
alert("hi");
<?php
echo 'hi';
?>
};
</script>
</head>
<body>
<form id = "form" align = "center">
<div id = "index">
<div id = "unandpw">
Username:
<input type="text">
<br>
Password:
<input type ="password" >
</div>
<!-- end unandpw -->
<div id = "buttons">
<button type = "button" onclick = "checkinfo()">
Login
</button>
<button type = "button" onclick = "register();">
Register
</button>
</div>
<!-- end buttons -->
</div>
<!--index end -->
</form>
</body>
</html>
Thursday, 8 August 2013
Assertion error from 'pip list' in virtualenv.
Assertion error from 'pip list' in virtualenv.
Pip list is throwing an Assertion error and I'm not sure how to resolve.
This has just happened after building 2 packages (PyUblas-2013.1 and
boost_1_54_0) from source. I am using virtualenv.
Error below;
(virtenv)[user@xyz ~]$ pip list
beautifulsoup4 (4.2.1)
biopython (1.61)
distribute (0.6.35)
methylpy (0.1.0)
MySQL-python (1.2.4)
numpy (1.7.1)
pip (1.4)
py (1.4.15)
pytest (2.3.5)
PyUblas (2013.1)
Exception:
Traceback (most recent call last):
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/basecommand.py",
line 134, in main
status = self.run(options, args)
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py",
line 80, in run
self.run_listing(options)
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py",
line 127, in run_listing
self.output_package_listing(installed_packages)
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py",
line 136, in output_package_listing
if dist_is_editable(dist):
File "/home/user/virtenv/lib/python2.7/site-packages/pip/util.py", line
347, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/home/user/virtenv/lib/python2.7/site-packages/pip/__init__.py",
line 194, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError
Can anyone help me troubleshoot???
Thanks,
Pip list is throwing an Assertion error and I'm not sure how to resolve.
This has just happened after building 2 packages (PyUblas-2013.1 and
boost_1_54_0) from source. I am using virtualenv.
Error below;
(virtenv)[user@xyz ~]$ pip list
beautifulsoup4 (4.2.1)
biopython (1.61)
distribute (0.6.35)
methylpy (0.1.0)
MySQL-python (1.2.4)
numpy (1.7.1)
pip (1.4)
py (1.4.15)
pytest (2.3.5)
PyUblas (2013.1)
Exception:
Traceback (most recent call last):
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/basecommand.py",
line 134, in main
status = self.run(options, args)
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py",
line 80, in run
self.run_listing(options)
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py",
line 127, in run_listing
self.output_package_listing(installed_packages)
File
"/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py",
line 136, in output_package_listing
if dist_is_editable(dist):
File "/home/user/virtenv/lib/python2.7/site-packages/pip/util.py", line
347, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/home/user/virtenv/lib/python2.7/site-packages/pip/__init__.py",
line 194, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError
Can anyone help me troubleshoot???
Thanks,
Override file input field with button
Override file input field with button
I have an input field generated by Cloudinary that looks like this. I
shortened it, but it generated a fairly generic looking drop zone and
"Browse" button inside. I don't need the dropzone - ideally I could just
abstract all of this away to an HTML button - where the button on click
does will prompt using the input field.
<input id="id_picture" class="cloudinary-fileupload " type="file"
name="file">
Is it possible to override the above input field with a button? Can I just
simply style the file input field to look like a button rather than a
dropzone + "Browse" button?
Sorry if this doesn't make any sense - I'm normally a back end coder.
Please let me know if you need any more information. Thanks!
I have an input field generated by Cloudinary that looks like this. I
shortened it, but it generated a fairly generic looking drop zone and
"Browse" button inside. I don't need the dropzone - ideally I could just
abstract all of this away to an HTML button - where the button on click
does will prompt using the input field.
<input id="id_picture" class="cloudinary-fileupload " type="file"
name="file">
Is it possible to override the above input field with a button? Can I just
simply style the file input field to look like a button rather than a
dropzone + "Browse" button?
Sorry if this doesn't make any sense - I'm normally a back end coder.
Please let me know if you need any more information. Thanks!
Unwanted black borders when trying to expand image to full size
Unwanted black borders when trying to expand image to full size
When taking a screenshot of my scene in JavaFx, I save the BufferedImage
to a file as a PNG/JPG. When I try to maximize the image size to its full
length, I get Black borders on the picture from the left of the image to
the bottom without the image increasing its size at all. The size of the
image only increases until I set my dimensions to 1300x700 as shown below.
BufferedImage image = new BufferedImage(1300, 700,
BufferedImage.TYPE_INT_RGB);
However once I increase the dimensions greater than 1300x700, the black
borders appear.
The following picture is set to
BufferedImage image = new BufferedImage(1500, 900,
BufferedImage.TYPE_INT_RGB);
As you can see, part of the image is still cut off and there is now a big
black border next to the image rather than the actual full sized image.
The following picture is set to
BufferedImage image = new BufferedImage(1300, 700,
BufferedImage.TYPE_INT_RGB);
As you can see, the image is still cut off at the same spot as before but
there is no black border along side with it.
How can I fit the whole snapshot of my current scene into one file without
these borders and without any of the content getting cut off?
Here is my code:
File fa = new File("test.jpg");
snapshot = quotes.getScene().snapshot(null);
RenderedImage renderedImage = SwingFXUtils.fromFXImage(snapshot, null);
BufferedImage image = new BufferedImage(1300, 700,
BufferedImage.TYPE_INT_RGB);
image.setData(renderedImage.getData());
ImageIO.write(image, "jpg", fa);
When taking a screenshot of my scene in JavaFx, I save the BufferedImage
to a file as a PNG/JPG. When I try to maximize the image size to its full
length, I get Black borders on the picture from the left of the image to
the bottom without the image increasing its size at all. The size of the
image only increases until I set my dimensions to 1300x700 as shown below.
BufferedImage image = new BufferedImage(1300, 700,
BufferedImage.TYPE_INT_RGB);
However once I increase the dimensions greater than 1300x700, the black
borders appear.
The following picture is set to
BufferedImage image = new BufferedImage(1500, 900,
BufferedImage.TYPE_INT_RGB);
As you can see, part of the image is still cut off and there is now a big
black border next to the image rather than the actual full sized image.
The following picture is set to
BufferedImage image = new BufferedImage(1300, 700,
BufferedImage.TYPE_INT_RGB);
As you can see, the image is still cut off at the same spot as before but
there is no black border along side with it.
How can I fit the whole snapshot of my current scene into one file without
these borders and without any of the content getting cut off?
Here is my code:
File fa = new File("test.jpg");
snapshot = quotes.getScene().snapshot(null);
RenderedImage renderedImage = SwingFXUtils.fromFXImage(snapshot, null);
BufferedImage image = new BufferedImage(1300, 700,
BufferedImage.TYPE_INT_RGB);
image.setData(renderedImage.getData());
ImageIO.write(image, "jpg", fa);
How to install my iOS app with cydia
How to install my iOS app with cydia
I made app for iOS. Made my certificate and signed with it. So now I have
to my .app file. How can I install that on my jailbroken ipad? Somehow
from cydia I guess
I made app for iOS. Made my certificate and signed with it. So now I have
to my .app file. How can I install that on my jailbroken ipad? Somehow
from cydia I guess
PHP form - if honeypot input field is filled - redirect to another page
PHP form - if honeypot input field is filled - redirect to another page
i have a simple contact form that i have included a honeypot input field.
i would like the form to redirect to a webpage if the field is filled out.
i tried the below code, but it is giving me an error: the AJAX request
failed!
so i know i have done something wrong. i'm sure it is simple.
thanks
the php code:
if(!empty($_POST["e-mail"])) header('Location: blankman.html');exit;
the form input:
<input type="text" name="e-mail" id="e-mail"/>
i have a simple contact form that i have included a honeypot input field.
i would like the form to redirect to a webpage if the field is filled out.
i tried the below code, but it is giving me an error: the AJAX request
failed!
so i know i have done something wrong. i'm sure it is simple.
thanks
the php code:
if(!empty($_POST["e-mail"])) header('Location: blankman.html');exit;
the form input:
<input type="text" name="e-mail" id="e-mail"/>
How to return only one column in Hibernate?
How to return only one column in Hibernate?
I want to return only one column from table. This is my DAO:
@SuppressWarnings("unchecked")
public String getUri() {
return sessionFactory.getCurrentSession()
.createQuery("uri from Templates WHERE state=1").toString();
}
Console says:
Request processing failed; nested exception is
java.lang.IllegalArgumentException: node to traverse cannot be null!
I want to return only one column from table. This is my DAO:
@SuppressWarnings("unchecked")
public String getUri() {
return sessionFactory.getCurrentSession()
.createQuery("uri from Templates WHERE state=1").toString();
}
Console says:
Request processing failed; nested exception is
java.lang.IllegalArgumentException: node to traverse cannot be null!
What does the notation mean ?
What does the notation mean ?
k:=0; b:=1;
{b=a^k}
while k <> n do begin
k:=k+1;
b:=b*a;
end;
Couldn't get help on it elsewhere .. hope to get it answered here.
k:=0; b:=1;
{b=a^k}
while k <> n do begin
k:=k+1;
b:=b*a;
end;
Couldn't get help on it elsewhere .. hope to get it answered here.
Hibernate updating primary key
Hibernate updating primary key
is it possibile to update a primary key that having more than one table
mapping? How can i update id in Master table?
CREATE TABLE Master (id INT, name VARCHAR(20),address VARCHAR(20),Primary
key(id));
CREATE TABLE Slave_1 (id INT,s1_id INT,area VARCHAR(20),project
VARCHAR(20),primary key(s1_id),Foreign Key (id) references Master(id));
CREATE TABLE Slave_2 (id INT,s2_id INT,area VARCHAR(20),project
VARCHAR(20),primary key(s2_id),Foreign Key (id) references Master(id));
is it possibile to update a primary key that having more than one table
mapping? How can i update id in Master table?
CREATE TABLE Master (id INT, name VARCHAR(20),address VARCHAR(20),Primary
key(id));
CREATE TABLE Slave_1 (id INT,s1_id INT,area VARCHAR(20),project
VARCHAR(20),primary key(s1_id),Foreign Key (id) references Master(id));
CREATE TABLE Slave_2 (id INT,s2_id INT,area VARCHAR(20),project
VARCHAR(20),primary key(s2_id),Foreign Key (id) references Master(id));
Wednesday, 7 August 2013
Required validation in combobox inside Kendo Grid
Required validation in combobox inside Kendo Grid
I Have a kendo grid which has combo boxes on inline editing. When I add
the required validation for the combo box it is not working. I have
created the sample in JS filder in the following ID.
/hES4G/7/
Is there anything to be added to validation to work properly.
Thanz
I Have a kendo grid which has combo boxes on inline editing. When I add
the required validation for the combo box it is not working. I have
created the sample in JS filder in the following ID.
/hES4G/7/
Is there anything to be added to validation to work properly.
Thanz
How to find Find $\left\lfloor\sum_1^{100}\frac{1}{x_n+1}\right\rfloor$ with $x_1 =\frac{1}{2}, x_{k+1} =x_k^2+x_k$.
How to find Find $\left\lfloor\sum_1^{100}\frac{1}{x_n+1}\right\rfloor$
with $x_1 =\frac{1}{2}, x_{k+1} =x_k^2+x_k$.
The sequence $\{x_n\}$ is defined by $x_1 =\frac{1}{2}, x_{k+1}
=x_k^2+x_k$. Find
$$\left\lfloor\frac{1}{x_1+1}+\frac{1}{x_2+1}+.........+\frac{1}{x_{100}+1}\right\rfloor$$
where $\left\lfloor\dots\right\rfloor$ is greatest integer function.
If we put the values of $k$ then we get the numerator part of the series
=2 and then taking 2 as common from the series how can we solve the rest
of the series..
How do we proceed in this case ... please suggest thanks..
with $x_1 =\frac{1}{2}, x_{k+1} =x_k^2+x_k$.
The sequence $\{x_n\}$ is defined by $x_1 =\frac{1}{2}, x_{k+1}
=x_k^2+x_k$. Find
$$\left\lfloor\frac{1}{x_1+1}+\frac{1}{x_2+1}+.........+\frac{1}{x_{100}+1}\right\rfloor$$
where $\left\lfloor\dots\right\rfloor$ is greatest integer function.
If we put the values of $k$ then we get the numerator part of the series
=2 and then taking 2 as common from the series how can we solve the rest
of the series..
How do we proceed in this case ... please suggest thanks..
Why gdb switched to home directory?
Why gdb switched to home directory?
Suppose the current directory is /home/xxx/test, there is a text file
named "test.txt" which contains a single word "hello", and a file named
"test.cpp" is as following,
#include <iostream>
#include <fstream>
#include <unistd.h>
using namespace std;
int main ()
{
char cwd[1024];
getcwd(cwd, 1024);
cout << cwd << endl;
string s;
ifstream i("test.txt");
if (!i.good())
cout << "Can't open test.txt" << endl;
i >> s;
i.close();
cout << s << endl;
return 0;
}
test> g++ test.cpp
test> ./a.out
/home/xxx/test
hello
test> gdb a.out
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/xxx/test/a.out...(no debugging symbols
found)...done.
(gdb) run
Starting program: /home/xxx/test/a.out
/home/xxx
Can't open test.txt
Program exited normally.
(gdb) pwd
Working directory /home/xxx/test.
(gdb) shell pwd
/home/xxx
My question is why gdb switched to home directory?
Thanks.
Suppose the current directory is /home/xxx/test, there is a text file
named "test.txt" which contains a single word "hello", and a file named
"test.cpp" is as following,
#include <iostream>
#include <fstream>
#include <unistd.h>
using namespace std;
int main ()
{
char cwd[1024];
getcwd(cwd, 1024);
cout << cwd << endl;
string s;
ifstream i("test.txt");
if (!i.good())
cout << "Can't open test.txt" << endl;
i >> s;
i.close();
cout << s << endl;
return 0;
}
test> g++ test.cpp
test> ./a.out
/home/xxx/test
hello
test> gdb a.out
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/xxx/test/a.out...(no debugging symbols
found)...done.
(gdb) run
Starting program: /home/xxx/test/a.out
/home/xxx
Can't open test.txt
Program exited normally.
(gdb) pwd
Working directory /home/xxx/test.
(gdb) shell pwd
/home/xxx
My question is why gdb switched to home directory?
Thanks.
How to create new VM using VMware VSphere API via PHP
How to create new VM using VMware VSphere API via PHP
I'm trying to create a new Virtual Machine in VSphere via specifications
entered into a web form POSTed to php. I found the method call
CreateVM_Task (scroll 70% of the way down) which seems to be the right API
call. My problem is how to connect the php to this API call. The
documentation for VSphere is plentiful, but I'm having trouble getting
what I need.
I'm trying to create a new Virtual Machine in VSphere via specifications
entered into a web form POSTed to php. I found the method call
CreateVM_Task (scroll 70% of the way down) which seems to be the right API
call. My problem is how to connect the php to this API call. The
documentation for VSphere is plentiful, but I'm having trouble getting
what I need.
TSQL in the Command object
TSQL in the Command object
Please see the sub routine below:
Private Sub UpdateGrade(ByVal studentID As Integer, ByVal grade As String)
Dim objCommand As SqlCommand
Dim objCon As SqlConnection
Dim id As Integer
Dim _ConString As String
Try
_ConString =
ConfigurationManager.ConnectionStrings("TestConnection").ToString
objCon = New SqlConnection(_ConString)
objCommand = New SqlCommand("DECLARE @StudentID INT " & _
"DECLARE @Grade char(1) " & _
"SET @Grade = '" & grade & "'" & _
"SET @StudentID = '" & studentID & "'" & _
"If @Grade=1 " & _
"begin " & _
"update Student SET Grade = 'A' WHERE StudentID = @StudentID "
& _
"end " & _
"Else If @Grade=2 " & _
"begin " & _
"update Student SET Grade = 'B' WHERE StudentID = @StudentID "
& _
"end " & _
"If @Grade=3 " & _
"begin " & _
"update Student SET Grade = 'C' WHERE StudentID = @StudentID "
& _
"end " & _
"Else If @Grade=4 " & _
"begin " & _
"update Student SET Grade = 'D' WHERE StudentID = @StudentID "
& _
"end")
objCommand.Connection = objCon
objCon.Open()
objCommand.ExecuteNonQuery()
Catch ex As Exception
Throw
Finally
End Try
Is there anything setting the Command.CommandText to a TSQL statement? The
TSQL looks like this (for readibility):
DECLARE @StudentID INT
DECLARE @Grade char(1)
SET @Grade =
SET @StudentID =
If @Grade=1
begin
update Student SET Grade = 'A' WHERE StudentID = @StudentID
end
Else If @Grade=2
begin
update Student SET Grade = 'B' WHERE StudentID = @StudentID
end
If @Grade=3
begin
update Student SET Grade = 'C' WHERE StudentID = @StudentID
end
Else If @Grade=4
begin
update Student SET Grade = 'D' WHERE StudentID = @StudentID
end
There is a call to UpdateGrade in a while loop. The while loop, loops
through five million students. Please note that the live system is more
complex for this,so I have provided the code above for illustrative
purposes.
Please see the sub routine below:
Private Sub UpdateGrade(ByVal studentID As Integer, ByVal grade As String)
Dim objCommand As SqlCommand
Dim objCon As SqlConnection
Dim id As Integer
Dim _ConString As String
Try
_ConString =
ConfigurationManager.ConnectionStrings("TestConnection").ToString
objCon = New SqlConnection(_ConString)
objCommand = New SqlCommand("DECLARE @StudentID INT " & _
"DECLARE @Grade char(1) " & _
"SET @Grade = '" & grade & "'" & _
"SET @StudentID = '" & studentID & "'" & _
"If @Grade=1 " & _
"begin " & _
"update Student SET Grade = 'A' WHERE StudentID = @StudentID "
& _
"end " & _
"Else If @Grade=2 " & _
"begin " & _
"update Student SET Grade = 'B' WHERE StudentID = @StudentID "
& _
"end " & _
"If @Grade=3 " & _
"begin " & _
"update Student SET Grade = 'C' WHERE StudentID = @StudentID "
& _
"end " & _
"Else If @Grade=4 " & _
"begin " & _
"update Student SET Grade = 'D' WHERE StudentID = @StudentID "
& _
"end")
objCommand.Connection = objCon
objCon.Open()
objCommand.ExecuteNonQuery()
Catch ex As Exception
Throw
Finally
End Try
Is there anything setting the Command.CommandText to a TSQL statement? The
TSQL looks like this (for readibility):
DECLARE @StudentID INT
DECLARE @Grade char(1)
SET @Grade =
SET @StudentID =
If @Grade=1
begin
update Student SET Grade = 'A' WHERE StudentID = @StudentID
end
Else If @Grade=2
begin
update Student SET Grade = 'B' WHERE StudentID = @StudentID
end
If @Grade=3
begin
update Student SET Grade = 'C' WHERE StudentID = @StudentID
end
Else If @Grade=4
begin
update Student SET Grade = 'D' WHERE StudentID = @StudentID
end
There is a call to UpdateGrade in a while loop. The while loop, loops
through five million students. Please note that the live system is more
complex for this,so I have provided the code above for illustrative
purposes.
Why does export not seems to affect child shells?
Why does export not seems to affect child shells?
if I have
$ x='This is a String'
$ export x
$ xterm &
[3] 14089
The child process doesn't seem to respond to
$echo x
$
if I have
$ x='This is a String'
$ export x
$ xterm &
[3] 14089
The child process doesn't seem to respond to
$echo x
$
Fitnesse Histroy page return XML code and how to Save that XML code in local directory
Fitnesse Histroy page return XML code and how to Save that XML code in
local directory
i am using Fitness e tool,when suite execution is completed and then i go
to history page and see the result of all pass and fail test cases. i want
that result in XML format i achieved that result in XML format. with help
of same URL "local-host:8080/Publisher?page History&result
Date=20130807182912&format=XML" but i have to save that result in XML file
in my local directory.any one please suggest me how to save XML file from
URL.through java. How i should stored that return XML result in Local
system please help me!!!!
local directory
i am using Fitness e tool,when suite execution is completed and then i go
to history page and see the result of all pass and fail test cases. i want
that result in XML format i achieved that result in XML format. with help
of same URL "local-host:8080/Publisher?page History&result
Date=20130807182912&format=XML" but i have to save that result in XML file
in my local directory.any one please suggest me how to save XML file from
URL.through java. How i should stored that return XML result in Local
system please help me!!!!
Override GCC compile flags
Override GCC compile flags
Is it possible to override the runtime-detect flags in
make/configure/cmake to detect the architecture optimization level and
override it?
For example ./configure & make will detect a modern CPU with SSE for
example, I would like to override that and set: when gcc compiles an .cpp
file, it will always use -march=i586
Is this possible? Thanks!
Is it possible to override the runtime-detect flags in
make/configure/cmake to detect the architecture optimization level and
override it?
For example ./configure & make will detect a modern CPU with SSE for
example, I would like to override that and set: when gcc compiles an .cpp
file, it will always use -march=i586
Is this possible? Thanks!
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27830 (ple.myfragexample) -- only on Android 4.1.2
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27830
(ple.myfragexample) -- only on Android 4.1.2
I am using FragmentActivity in my application with several Fragments. Each
of these fragments hold an image and some text with animation. When user
swipes on the screen, the fragment changes.
Now I have been working on this since 10 days and have tested the
FragmentActivity on different devices with different Android versions. The
reason that I am stuck on this from last 10 days is I am getting a crash
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27830
(ple.myfragexample)
Now, this error occurs only when I test the FragmentActivity on Android
4.1.2 particularly. It would run fine on Android 2.3.3, 4.0.3, 4.0.4, 4.2
and even 2.2. The error log is as below:
08-07 14:34:13.843: D/dalvikvm(27830): GC_FOR_ALLOC freed 3845K, 14% free
35407K/40903K, paused 4ms, total 14ms
08-07 14:34:13.848: I/dalvikvm-heap(27830): Grow heap (frag case) to
39.590MB for 3932176-byte allocation
08-07 14:34:13.878: D/dalvikvm(27830): GC_CONCURRENT freed 3K, 5% free
39244K/40903K, paused 11ms+4ms, total 30ms
08-07 14:34:13.928: D/dalvikvm(27830): GC_FOR_ALLOC freed 0K, 5% free
39244K/40903K, paused 16ms, total 16ms
08-07 14:34:13.928: I/dalvikvm-heap(27830): Forcing collection of
SoftReferences for 8847376-byte allocation
08-07 14:34:13.953: D/dalvikvm(27830): GC_BEFORE_OOM freed 9K, 5% free
39235K/40903K, paused 24ms, total 24ms
08-07 14:34:13.953: E/dalvikvm-heap(27830): Out of memory on a
8847376-byte allocation.
08-07 14:34:13.953: I/dalvikvm(27830): "main" prio=5 tid=1 RUNNABLE
08-07 14:34:13.953: I/dalvikvm(27830): | group="main" sCount=0 dsCount=0
obj=0x41ea8508 self=0x41e989c8
08-07 14:34:13.953: I/dalvikvm(27830): | sysTid=27830 nice=0 sched=0/0
cgrp=apps handle=1074937648
08-07 14:34:13.953: I/dalvikvm(27830): | schedstat=( 2591504030
1697770606 13588 ) utm=221 stm=38 core=0
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.content.res.Resources.loadDrawable(Resources.java:1963)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.View.<init>(View.java:3449)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.widget.ImageView.<init>(ImageView.java:114)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.widget.ImageView.<init>(ImageView.java:110)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Constructor.constructNative(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Constructor.newInstance(Constructor.java:417)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.createView(LayoutInflater.java:587)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.inflate(LayoutInflater.java:489)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.example.myfragexample.pages.Page6.onCreateView(Page6.java:52)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.os.Handler.handleCallback(Handler.java:615)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.os.Looper.loop(Looper.java:137)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.app.ActivityThread.main(ActivityThread.java:4921)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Method.invokeNative(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Method.invoke(Method.java:511)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
08-07 14:34:13.953: I/dalvikvm(27830): at
dalvik.system.NativeStart.main(Native Method)
08-07 14:34:13.953: A/libc(27830): Fatal signal 11 (SIGSEGV) at 0x00000000
(code=1), thread 27830 (ple.myfragexample)
I have searched a lot over the internet and tried many thing about this,
however, the working of my Fragments got smoother on devices with any
other version of Android, but just on Android 4.1.2. I also tried to use
Universal Image Loader, but it still crashes with Fatal signal 11. The
error log I get when I am using Universal Image Loader is as below:
08-07 14:20:03.678: D/dalvikvm(27268): GC_FOR_ALLOC freed 3857K, 32% free
33002K/48455K, paused 31ms, total 34ms
08-07 14:20:03.678: I/dalvikvm-heap(27268): Grow heap (frag case) to
37.241MB for 3932176-byte allocation
08-07 14:20:03.708: D/dalvikvm(27268): GC_FOR_ALLOC freed 5K, 24% free
36837K/48455K, paused 28ms, total 28ms
08-07 14:20:03.738: D/dalvikvm(27268): GC_CONCURRENT freed <1K, 24% free
36837K/48455K, paused 11ms+2ms, total 30ms
08-07 14:20:03.848: D/dalvikvm(27268): GC_FOR_ALLOC freed <1K, 24% free
36837K/48455K, paused 17ms, total 17ms
08-07 14:20:03.848: I/dalvikvm-heap(27268): Forcing collection of
SoftReferences for 8847376-byte allocation
08-07 14:20:03.883: D/dalvikvm(27268): GC_BEFORE_OOM freed 9K, 24% free
36828K/48455K, paused 32ms, total 35ms
08-07 14:20:03.883: E/dalvikvm-heap(27268): Out of memory on a
8847376-byte allocation.
08-07 14:20:03.888: I/dalvikvm(27268): "pool-1-thread-1" prio=4 tid=12
RUNNABLE
08-07 14:20:03.888: I/dalvikvm(27268): | group="main" sCount=0 dsCount=0
obj=0x4293af60 self=0x4f6c9470
08-07 14:20:03.888: I/dalvikvm(27268): | sysTid=27283 nice=10 sched=0/0
cgrp=apps/bg_non_interactive handle=1098606736
08-07 14:20:03.888: I/dalvikvm(27268): | schedstat=( 2735922613
2106917058 1146 ) utm=266 stm=7 core=0
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.content.res.Resources.loadDrawable(Resources.java:1963)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.content.res.Resources.getDrawable(Resources.java:672)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromDrawable(BaseImageDownloader.java:184)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:84)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.decode.BaseImageDecoder.getImageStream(BaseImageDecoder.java:82)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:68)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:284)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:243)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:125)
08-07 14:20:03.888: I/dalvikvm(27268): at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-07 14:20:03.888: I/dalvikvm(27268): at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-07 14:20:03.888: I/dalvikvm(27268): at
java.lang.Thread.run(Thread.java:856)
08-07 14:20:03.888: A/libc(27268): Fatal signal 11 (SIGSEGV) at 0x00000000
(code=1), thread 27283 (pool-1-thread-1)
Now, I know there are lots of questions with Fatal signal 11 on here too,
but I am concerned and confused as I am getting this crash only on Android
4.1.2 and not on any other Android versions.
(ple.myfragexample) -- only on Android 4.1.2
I am using FragmentActivity in my application with several Fragments. Each
of these fragments hold an image and some text with animation. When user
swipes on the screen, the fragment changes.
Now I have been working on this since 10 days and have tested the
FragmentActivity on different devices with different Android versions. The
reason that I am stuck on this from last 10 days is I am getting a crash
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27830
(ple.myfragexample)
Now, this error occurs only when I test the FragmentActivity on Android
4.1.2 particularly. It would run fine on Android 2.3.3, 4.0.3, 4.0.4, 4.2
and even 2.2. The error log is as below:
08-07 14:34:13.843: D/dalvikvm(27830): GC_FOR_ALLOC freed 3845K, 14% free
35407K/40903K, paused 4ms, total 14ms
08-07 14:34:13.848: I/dalvikvm-heap(27830): Grow heap (frag case) to
39.590MB for 3932176-byte allocation
08-07 14:34:13.878: D/dalvikvm(27830): GC_CONCURRENT freed 3K, 5% free
39244K/40903K, paused 11ms+4ms, total 30ms
08-07 14:34:13.928: D/dalvikvm(27830): GC_FOR_ALLOC freed 0K, 5% free
39244K/40903K, paused 16ms, total 16ms
08-07 14:34:13.928: I/dalvikvm-heap(27830): Forcing collection of
SoftReferences for 8847376-byte allocation
08-07 14:34:13.953: D/dalvikvm(27830): GC_BEFORE_OOM freed 9K, 5% free
39235K/40903K, paused 24ms, total 24ms
08-07 14:34:13.953: E/dalvikvm-heap(27830): Out of memory on a
8847376-byte allocation.
08-07 14:34:13.953: I/dalvikvm(27830): "main" prio=5 tid=1 RUNNABLE
08-07 14:34:13.953: I/dalvikvm(27830): | group="main" sCount=0 dsCount=0
obj=0x41ea8508 self=0x41e989c8
08-07 14:34:13.953: I/dalvikvm(27830): | sysTid=27830 nice=0 sched=0/0
cgrp=apps handle=1074937648
08-07 14:34:13.953: I/dalvikvm(27830): | schedstat=( 2591504030
1697770606 13588 ) utm=221 stm=38 core=0
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.content.res.Resources.loadDrawable(Resources.java:1963)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.View.<init>(View.java:3449)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.widget.ImageView.<init>(ImageView.java:114)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.widget.ImageView.<init>(ImageView.java:110)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Constructor.constructNative(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Constructor.newInstance(Constructor.java:417)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.createView(LayoutInflater.java:587)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.inflate(LayoutInflater.java:489)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.example.myfragexample.pages.Page6.onCreateView(Page6.java:52)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.os.Handler.handleCallback(Handler.java:615)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.os.Looper.loop(Looper.java:137)
08-07 14:34:13.953: I/dalvikvm(27830): at
android.app.ActivityThread.main(ActivityThread.java:4921)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Method.invokeNative(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at
java.lang.reflect.Method.invoke(Method.java:511)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
08-07 14:34:13.953: I/dalvikvm(27830): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
08-07 14:34:13.953: I/dalvikvm(27830): at
dalvik.system.NativeStart.main(Native Method)
08-07 14:34:13.953: A/libc(27830): Fatal signal 11 (SIGSEGV) at 0x00000000
(code=1), thread 27830 (ple.myfragexample)
I have searched a lot over the internet and tried many thing about this,
however, the working of my Fragments got smoother on devices with any
other version of Android, but just on Android 4.1.2. I also tried to use
Universal Image Loader, but it still crashes with Fatal signal 11. The
error log I get when I am using Universal Image Loader is as below:
08-07 14:20:03.678: D/dalvikvm(27268): GC_FOR_ALLOC freed 3857K, 32% free
33002K/48455K, paused 31ms, total 34ms
08-07 14:20:03.678: I/dalvikvm-heap(27268): Grow heap (frag case) to
37.241MB for 3932176-byte allocation
08-07 14:20:03.708: D/dalvikvm(27268): GC_FOR_ALLOC freed 5K, 24% free
36837K/48455K, paused 28ms, total 28ms
08-07 14:20:03.738: D/dalvikvm(27268): GC_CONCURRENT freed <1K, 24% free
36837K/48455K, paused 11ms+2ms, total 30ms
08-07 14:20:03.848: D/dalvikvm(27268): GC_FOR_ALLOC freed <1K, 24% free
36837K/48455K, paused 17ms, total 17ms
08-07 14:20:03.848: I/dalvikvm-heap(27268): Forcing collection of
SoftReferences for 8847376-byte allocation
08-07 14:20:03.883: D/dalvikvm(27268): GC_BEFORE_OOM freed 9K, 24% free
36828K/48455K, paused 32ms, total 35ms
08-07 14:20:03.883: E/dalvikvm-heap(27268): Out of memory on a
8847376-byte allocation.
08-07 14:20:03.888: I/dalvikvm(27268): "pool-1-thread-1" prio=4 tid=12
RUNNABLE
08-07 14:20:03.888: I/dalvikvm(27268): | group="main" sCount=0 dsCount=0
obj=0x4293af60 self=0x4f6c9470
08-07 14:20:03.888: I/dalvikvm(27268): | sysTid=27283 nice=10 sched=0/0
cgrp=apps/bg_non_interactive handle=1098606736
08-07 14:20:03.888: I/dalvikvm(27268): | schedstat=( 2735922613
2106917058 1146 ) utm=266 stm=7 core=0
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.content.res.Resources.loadDrawable(Resources.java:1963)
08-07 14:20:03.888: I/dalvikvm(27268): at
android.content.res.Resources.getDrawable(Resources.java:672)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromDrawable(BaseImageDownloader.java:184)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:84)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.decode.BaseImageDecoder.getImageStream(BaseImageDecoder.java:82)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:68)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:284)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:243)
08-07 14:20:03.888: I/dalvikvm(27268): at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:125)
08-07 14:20:03.888: I/dalvikvm(27268): at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-07 14:20:03.888: I/dalvikvm(27268): at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-07 14:20:03.888: I/dalvikvm(27268): at
java.lang.Thread.run(Thread.java:856)
08-07 14:20:03.888: A/libc(27268): Fatal signal 11 (SIGSEGV) at 0x00000000
(code=1), thread 27283 (pool-1-thread-1)
Now, I know there are lots of questions with Fatal signal 11 on here too,
but I am concerned and confused as I am getting this crash only on Android
4.1.2 and not on any other Android versions.
Subscribe to:
Posts (Atom)