Why is my format validation failing for permalinks?
I have written an rspec test for checking invalid characters in my permalink:
describe "formatting permalinks when creating a page" do
it "does not allow crazy characters" do
page = create(:page, permalink: '#$%^&*first-title')
expect(page).to have(1).errors_on(:permalink)
end
end
In my page.rb model, I have this validation implemented to make it pass:
class Page < ActiveRecord::Base
validates :permalink, format: {:with => /\A[a-zA-Z-]+\Z/, :on => :save!}
before_create :create_slug
def create_slug
self.permalink = self.permalink.parameterize
end
end
But I get his error:
expected 1 errors on :permalink, got 0
What am I doing wrong? How do I fix this?
Saturday, 31 August 2013
Import Excel data to Sql in Asp.Net
Import Excel data to Sql in Asp.Net
I Have imported excel data to the sql server in ASP.NET. what i got the
Problem is it upload data upto 100 row withn a minute bt after 100 of row
of excel data(even the 101) it will not upload... it gives error like
Timeout experied. The timeout Period piror to obtaning a connection from
the pool. this may occured because all the pooled connections were in use
and max pool size was reached
I Have imported excel data to the sql server in ASP.NET. what i got the
Problem is it upload data upto 100 row withn a minute bt after 100 of row
of excel data(even the 101) it will not upload... it gives error like
Timeout experied. The timeout Period piror to obtaning a connection from
the pool. this may occured because all the pooled connections were in use
and max pool size was reached
Is 600kpbs upload speed too slow for VOIP app?
Is 600kpbs upload speed too slow for VOIP app?
I've built a voip app for iphone and android phone (audio only). I've been
testing the call quality. I noticed that if a person has an upload speed
of less than 600kbps, then his partner will have trouble hearing him
clearly. His partner might hear lots of crackling, dropped sentences in
speech, or nothing at all.
I am currently using GSM codec on my android, iphone and on my asterisk
server.
So my question is whether upload speeds of less than 600kpbs is generally
considered too slow for VOIP calls?
If so, is there anything I can do to reduce necessary bandwidth for call?
I could consider the G722 codec, but from what I remember, it doesn't
offer significant bandwidth improvement compared to GSM
I've built a voip app for iphone and android phone (audio only). I've been
testing the call quality. I noticed that if a person has an upload speed
of less than 600kbps, then his partner will have trouble hearing him
clearly. His partner might hear lots of crackling, dropped sentences in
speech, or nothing at all.
I am currently using GSM codec on my android, iphone and on my asterisk
server.
So my question is whether upload speeds of less than 600kpbs is generally
considered too slow for VOIP calls?
If so, is there anything I can do to reduce necessary bandwidth for call?
I could consider the G722 codec, but from what I remember, it doesn't
offer significant bandwidth improvement compared to GSM
NumPy : array methods and functions not working
NumPy : array methods and functions not working
I have a problem regarding NumPy arrays.
I cannot get array methods like .T or functions like numpy.concatenate to
work with arrays I create:
>>> a=np.array([1,2,3])
>>> a
array([1, 2, 3])
>>> a.T
array([1, 2, 3])
>>> np.concatenate((a,a),axis=0)
array([1, 2, 3, 1, 2, 3])
>>> np.concatenate((a,a),axis=1)
array([1, 2, 3, 1, 2, 3])
>>>
However when I create an array using bult-in functions like rand
everything is fine
>>> a=np.random.rand(1,4)
>>> a.T
array([[ 0.75973189],
[ 0.23873578],
[ 0.6422108 ],
[ 0.47079987]])
>>> np.concatenate((a,a),axis=0)
array([[ 0.92191111, 0.50662157, 0.75663621, 0.65802565],
[ 0.92191111, 0.50662157, 0.75663621, 0.65802565]])
Do you think it has to do with element types (int32 vs float64) ?
I anm running python 2.7 on windows 7
Any help would be greatly appreciated.
Thanks !
I have a problem regarding NumPy arrays.
I cannot get array methods like .T or functions like numpy.concatenate to
work with arrays I create:
>>> a=np.array([1,2,3])
>>> a
array([1, 2, 3])
>>> a.T
array([1, 2, 3])
>>> np.concatenate((a,a),axis=0)
array([1, 2, 3, 1, 2, 3])
>>> np.concatenate((a,a),axis=1)
array([1, 2, 3, 1, 2, 3])
>>>
However when I create an array using bult-in functions like rand
everything is fine
>>> a=np.random.rand(1,4)
>>> a.T
array([[ 0.75973189],
[ 0.23873578],
[ 0.6422108 ],
[ 0.47079987]])
>>> np.concatenate((a,a),axis=0)
array([[ 0.92191111, 0.50662157, 0.75663621, 0.65802565],
[ 0.92191111, 0.50662157, 0.75663621, 0.65802565]])
Do you think it has to do with element types (int32 vs float64) ?
I anm running python 2.7 on windows 7
Any help would be greatly appreciated.
Thanks !
Display matrix in two dimension array
Display matrix in two dimension array
I am newbie in c and trying to display an array in matrix form. I have
seen tutorials, but most of them deal with for loop to apply matrix
concept in a 2-D array. i m using while loop and examining it in my way.
It is although displaying in matrix form but it is not displaying the
accurate output. If i insert numbers 1,2..,9, it must show in the form as
below:
1 2 3
4 5 6
7 8 9
but it is displaying as :
1 2 4
4 5 7
7 8 9
I am unable to understand why it is happening.
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,j=0;
int arr[2][2];
clrscr();
while(i<=2)
{
j=0;
while(j<=2)
{
scanf("%d",&arr[i][j]);
j++;
}
i++;
}
i=0;
while(i<=2)
{
j=0;
while(j<=2)
{
printf("%d ",arr[i][j]);
//printf("%c",k);
j++;
//k++;
}
printf("\n");
i++;
}
printf("%d",arr[0][2]);
getch();
I am newbie in c and trying to display an array in matrix form. I have
seen tutorials, but most of them deal with for loop to apply matrix
concept in a 2-D array. i m using while loop and examining it in my way.
It is although displaying in matrix form but it is not displaying the
accurate output. If i insert numbers 1,2..,9, it must show in the form as
below:
1 2 3
4 5 6
7 8 9
but it is displaying as :
1 2 4
4 5 7
7 8 9
I am unable to understand why it is happening.
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,j=0;
int arr[2][2];
clrscr();
while(i<=2)
{
j=0;
while(j<=2)
{
scanf("%d",&arr[i][j]);
j++;
}
i++;
}
i=0;
while(i<=2)
{
j=0;
while(j<=2)
{
printf("%d ",arr[i][j]);
//printf("%c",k);
j++;
//k++;
}
printf("\n");
i++;
}
printf("%d",arr[0][2]);
getch();
Using callIFrameFunction to send multiple args Flex
Using callIFrameFunction to send multiple args Flex
I'm using IFrame to load an gmaps page in my Flex application. I need to
pass latitude and longitude to my javascript function in the html loaded
by the Frame. These are my functions.
Flex:
private function createMarker(event:MouseEvent):void{
var position : Array = [-25, 130];
IFrame.callIFrameFunction('putMarker', position);
}
JS:
document.putMarker= function(latitude,longitude){
var myLatlng = new google.maps.LatLng(longitude, longitude);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
When i send just one of argument the function works fine, but when i try
to send two or more arguments i fail.
Can anyone help me?
I'm using IFrame to load an gmaps page in my Flex application. I need to
pass latitude and longitude to my javascript function in the html loaded
by the Frame. These are my functions.
Flex:
private function createMarker(event:MouseEvent):void{
var position : Array = [-25, 130];
IFrame.callIFrameFunction('putMarker', position);
}
JS:
document.putMarker= function(latitude,longitude){
var myLatlng = new google.maps.LatLng(longitude, longitude);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
When i send just one of argument the function works fine, but when i try
to send two or more arguments i fail.
Can anyone help me?
Using a subset of a QVector in a function
Using a subset of a QVector in a function
How to send a portion of a QVector to a function?
QVector<int> a;
a.append(1);
a.append(2);
a.append(3);
a.append(4);
a.append(5);
Some printing function should print "2 3 4" taking the subset of the
vector as an argument.
In R this would be possible using a[2:4].
Is this at all possible?
Note: In the std::vector, it is advised to use the insert function to
create a new variable. This is a different insert though than QVector has,
and thus I cannot find a recommended method.
How to send a portion of a QVector to a function?
QVector<int> a;
a.append(1);
a.append(2);
a.append(3);
a.append(4);
a.append(5);
Some printing function should print "2 3 4" taking the subset of the
vector as an argument.
In R this would be possible using a[2:4].
Is this at all possible?
Note: In the std::vector, it is advised to use the insert function to
create a new variable. This is a different insert though than QVector has,
and thus I cannot find a recommended method.
LongListSelector's performance is very bad. How to improve?
LongListSelector's performance is very bad. How to improve?
here is my code
<phone:LongListSelector ItemsSource="{Binding
MovieTimeInDetailItems}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="24,0,0,12">
<TextBlock Text="{Binding Theater}"
FontSize="34"/>
<ListBox ItemsSource="{Binding TimeItems}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="115"
Margin="0,0,0,0">
<TextBlock Text="{Binding
Time}"
TextWrapping="Wrap"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="26"
Foreground="{StaticResource
PhoneSubtleBrush}"/>
<Border Margin="92,0,0,0"
HorizontalAlignment="Left"
Width="{Binding Width}"
Height="25"
BorderThickness="1.5,0,0,0"
BorderBrush="{StaticResource
PhoneSubtleBrush}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
In each LLS item contains a Listbox which display time list. my question
is ... Can I display a time list without Listbox ? It seems Listbox cause
the low performance.
here is my code
<phone:LongListSelector ItemsSource="{Binding
MovieTimeInDetailItems}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Margin="24,0,0,12">
<TextBlock Text="{Binding Theater}"
FontSize="34"/>
<ListBox ItemsSource="{Binding TimeItems}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="115"
Margin="0,0,0,0">
<TextBlock Text="{Binding
Time}"
TextWrapping="Wrap"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="26"
Foreground="{StaticResource
PhoneSubtleBrush}"/>
<Border Margin="92,0,0,0"
HorizontalAlignment="Left"
Width="{Binding Width}"
Height="25"
BorderThickness="1.5,0,0,0"
BorderBrush="{StaticResource
PhoneSubtleBrush}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
In each LLS item contains a Listbox which display time list. my question
is ... Can I display a time list without Listbox ? It seems Listbox cause
the low performance.
Friday, 30 August 2013
How to expand region of a plot saved through hgexport?
How to expand region of a plot saved through hgexport?
So I used the command
hgexport(gcf, 'figure1.jpg', hgexport('factorystyle'), 'Format', 'jpeg');
on my graph, and I get this weird graph below. Is there a way to auto-save
images I generate with Matlab - with all the axes expanded out to full
screen, so that all these plots won't be squished together?
So I used the command
hgexport(gcf, 'figure1.jpg', hgexport('factorystyle'), 'Format', 'jpeg');
on my graph, and I get this weird graph below. Is there a way to auto-save
images I generate with Matlab - with all the axes expanded out to full
screen, so that all these plots won't be squished together?
Thursday, 29 August 2013
Rotating around completely in 90 degree intervals
Rotating around completely in 90 degree intervals
I have a circular menu that rotates 90 degrees every time leftArrow_mc is
clicked but at 270 degrees the button stops working. Also will the
reseting the degrees back to 0 do anything for me?
import com.greensock.*;
import com.greensock.easing.*;
leftArrow_mc.addEventListener(MouseEvent.CLICK, rotateLeft1);
function rotateLeft1(event: MouseEvent):void {
if (bottomWheel_menu_mc.rotation==0) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 90,
ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 90) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 180,
ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 180) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 270,
ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 270) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 360,
ease:Bounce.easeOut});
}
else if (bottomWheel_menu_mc.rotation == 360) {
bottomWheel_menu_mc.rotation == 0
}
}
I have a circular menu that rotates 90 degrees every time leftArrow_mc is
clicked but at 270 degrees the button stops working. Also will the
reseting the degrees back to 0 do anything for me?
import com.greensock.*;
import com.greensock.easing.*;
leftArrow_mc.addEventListener(MouseEvent.CLICK, rotateLeft1);
function rotateLeft1(event: MouseEvent):void {
if (bottomWheel_menu_mc.rotation==0) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 90,
ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 90) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 180,
ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 180) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 270,
ease:Bounce.easeOut});
} else if (bottomWheel_menu_mc.rotation == 270) {
TweenLite.to(bottomWheel_menu_mc, 1, {rotation: 360,
ease:Bounce.easeOut});
}
else if (bottomWheel_menu_mc.rotation == 360) {
bottomWheel_menu_mc.rotation == 0
}
}
MySQLSyntaxErrorException: unknown column
MySQLSyntaxErrorException: unknown column
I have some hard time with my program. All I want is to get some objects
from table that have this simple structure:
mysql> describe tb_rasa;
+--------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| nazwa | varchar(50) | YES | | NULL | |
| symbol | varchar(4) | NO | UNI | NULL | |
+--------+-------------+------+-----+---------+----------------+
in my bean class I have:
@PostConstruct
public void init() {
rasa = rasaEJB.wyswietlRase(1);
}
in RasaEJB:
public RasaSl wyswietlRase(Integer id) {
System.out.println("RasaEJB.wyswietlRase(id)");
RasaSl rasa = rasaDao.find(id);
return rasa;
}
RasaSl entity looks like:
@Entity
@Table(name="tb_rasa")
public class RasaSl implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4682401385263402475L;
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Column(name="nazwa",columnDefinition="varchar(50)")
private String nazwa;
@Column(name="symbol", columnDefinition="varchar(4)")
private String symbol;
@OneToMany(mappedBy="rasaSl", cascade=CascadeType.PERSIST)
private List<RasaStatystyka> modyfikatory = new ArrayList<RasaStatystyka>();
public String getNazwa() {
return nazwa;
}
public void setNazwa(String nazwa) {
this.nazwa = nazwa;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public List<RasaStatystyka> getModyfikatory() {
return modyfikatory;
}
public void setModyfikatory(List<RasaStatystyka> modyfikatory) {
this.modyfikatory = modyfikatory;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
I have completely know idea what could create this error:
RasaEJB.wyswietlRase(id)
[EL Info]: 2013-08-29
16:45:18.207--ServerSession(1816969462)--EclipseLink, version: Eclipse
Persistence Services - 2.5.0.v20130507-3faac2b
[EL Info]: 2013-08-29
16:45:18.588--ServerSession(1816969462)--file:/D:/usr/java/moje/system/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/wtpwebapps/EclipseJPA2-war/WEB-INF/lib/EclipseJPA2-jpa-0.01.jar_persistenceUnit
login successful
[EL Warning]: 2013-08-29 16:45:18.688--UnitOfWork(1358566974)--Exception
[EclipseLink-4002] (Eclipse Persistence Services -
2.5.0.v20130507-3faac2b):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column
'id' in 'field list'
Error Code: 1054
Call: SELECT id, nazwa, symbol FROM tb_rasa WHERE (id = ?)
bind => [1 parameter bound]
Query: ReadObjectQuery(name="readRasaSl" referenceClass=RasaSl sql="SELECT
id, nazwa, symbol FROM tb_rasa WHERE (id = ?)")
Please help.
I have some hard time with my program. All I want is to get some objects
from table that have this simple structure:
mysql> describe tb_rasa;
+--------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| nazwa | varchar(50) | YES | | NULL | |
| symbol | varchar(4) | NO | UNI | NULL | |
+--------+-------------+------+-----+---------+----------------+
in my bean class I have:
@PostConstruct
public void init() {
rasa = rasaEJB.wyswietlRase(1);
}
in RasaEJB:
public RasaSl wyswietlRase(Integer id) {
System.out.println("RasaEJB.wyswietlRase(id)");
RasaSl rasa = rasaDao.find(id);
return rasa;
}
RasaSl entity looks like:
@Entity
@Table(name="tb_rasa")
public class RasaSl implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4682401385263402475L;
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Column(name="nazwa",columnDefinition="varchar(50)")
private String nazwa;
@Column(name="symbol", columnDefinition="varchar(4)")
private String symbol;
@OneToMany(mappedBy="rasaSl", cascade=CascadeType.PERSIST)
private List<RasaStatystyka> modyfikatory = new ArrayList<RasaStatystyka>();
public String getNazwa() {
return nazwa;
}
public void setNazwa(String nazwa) {
this.nazwa = nazwa;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public List<RasaStatystyka> getModyfikatory() {
return modyfikatory;
}
public void setModyfikatory(List<RasaStatystyka> modyfikatory) {
this.modyfikatory = modyfikatory;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
I have completely know idea what could create this error:
RasaEJB.wyswietlRase(id)
[EL Info]: 2013-08-29
16:45:18.207--ServerSession(1816969462)--EclipseLink, version: Eclipse
Persistence Services - 2.5.0.v20130507-3faac2b
[EL Info]: 2013-08-29
16:45:18.588--ServerSession(1816969462)--file:/D:/usr/java/moje/system/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/wtpwebapps/EclipseJPA2-war/WEB-INF/lib/EclipseJPA2-jpa-0.01.jar_persistenceUnit
login successful
[EL Warning]: 2013-08-29 16:45:18.688--UnitOfWork(1358566974)--Exception
[EclipseLink-4002] (Eclipse Persistence Services -
2.5.0.v20130507-3faac2b):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column
'id' in 'field list'
Error Code: 1054
Call: SELECT id, nazwa, symbol FROM tb_rasa WHERE (id = ?)
bind => [1 parameter bound]
Query: ReadObjectQuery(name="readRasaSl" referenceClass=RasaSl sql="SELECT
id, nazwa, symbol FROM tb_rasa WHERE (id = ?)")
Please help.
How do I silence mysqlcheck?
How do I silence mysqlcheck?
If I use for example:
mysqlcheck syscp --silent --auto-repair
I still get the note:
syscp.panel_sessions
note : The storage engine for the table doesn't support check
this is strange, cause in the manpage it sais:
--silent, -s
Silent mode. Print only error messages.
how can I suppress notes?
If I use for example:
mysqlcheck syscp --silent --auto-repair
I still get the note:
syscp.panel_sessions
note : The storage engine for the table doesn't support check
this is strange, cause in the manpage it sais:
--silent, -s
Silent mode. Print only error messages.
how can I suppress notes?
How to post dynamic fields in IE9
How to post dynamic fields in IE9
I have a form in which users can fill static fields. Below them a button
allows to add dynamically new fields :
<form action="url" method="POST">
<table class="table" id="mytable">
<thead>
<tr>
<th>Foo</th>
<th>Bar</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="new-field">Add new fields</button>
</form>
Here is my JS code :
$('#new-field').click(function(e) {
e.preventDefault();
var i = $('#mytable tbody tr').length + 1;
$('<tr><td><input type="text" name="newfield['+ i
+']['foo']"></td><td><input type="text" name="newfield['+ i
+'][bar]]"></tr>').appendTo($('#mytable tbody'));
});
New fields are displayed correctly, but when I post the form (via a submit
button), new fields are not considered on IE9... It works on Firefox and
Chrome.
Apparently here is a solution : Dynamically added form elements are not
POSTED in IE 9 But I can't use the compatibility mode for my project.
Have you got any solution please ?
I have a form in which users can fill static fields. Below them a button
allows to add dynamically new fields :
<form action="url" method="POST">
<table class="table" id="mytable">
<thead>
<tr>
<th>Foo</th>
<th>Bar</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<button id="new-field">Add new fields</button>
</form>
Here is my JS code :
$('#new-field').click(function(e) {
e.preventDefault();
var i = $('#mytable tbody tr').length + 1;
$('<tr><td><input type="text" name="newfield['+ i
+']['foo']"></td><td><input type="text" name="newfield['+ i
+'][bar]]"></tr>').appendTo($('#mytable tbody'));
});
New fields are displayed correctly, but when I post the form (via a submit
button), new fields are not considered on IE9... It works on Firefox and
Chrome.
Apparently here is a solution : Dynamically added form elements are not
POSTED in IE 9 But I can't use the compatibility mode for my project.
Have you got any solution please ?
Wednesday, 28 August 2013
Chrome 29 Facebook double login issue
Chrome 29 Facebook double login issue
Ever since Chrome updated to 29.0.1547.57 I have been having a problem
with logging into Facebook. After going to www.facebook.com, writing in
the login/pass click Log In, login and pass information dissapear and I
have to write them in again. After doing so, and clicking Log In it takes
me to Sorry, your request could not be processed. Please try again. page
although I can go to my homepage or wherever (am logged in).
Is anyone else having similar problems?
Ever since Chrome updated to 29.0.1547.57 I have been having a problem
with logging into Facebook. After going to www.facebook.com, writing in
the login/pass click Log In, login and pass information dissapear and I
have to write them in again. After doing so, and clicking Log In it takes
me to Sorry, your request could not be processed. Please try again. page
although I can go to my homepage or wherever (am logged in).
Is anyone else having similar problems?
itext, pdf size A4, and image scalling
itext, pdf size A4, and image scalling
My paper its B4 - 17,60cm x 24,50cm
its scanned have the size in pixels -> 2048 x 2929
im creating a PDF as A4 size (2480px x 3508px) using itext.. but im unable
to scale it with margins, and not even without margins, i need to insert
the B4 image into the PDF A4 size, using LEFT margin of 2,5cm and the RIGH
margin 2cm, but how can i make it fit calculating the sizes, since a paper
A4 has 2480x3508, the B4 image has 2048x2929, if i insert, it cut? the b4
is bigger :| how?? considering size of A4, and the b4 should fit perfectly
inside the A4
if i do this:
doc = new Document(PageSize.A4, 0, 0, 0, 0);
os = new FileOutputStream(arquivonomecompleto);
PdfWriter.getInstance(doc, os);
doc.open();
Image img = Image.getInstance(arraypath[i]); // the array store the
path to the image
// img.scaleToFit(2090, 1208); // i tried a lot of modifications, i
can set i to 500x500 or something like this in have all showed in
the pdf, but how can i calculate margins
doc.add(img);
doc.add(new Paragraph("TEST: text under the b4 image");
doc.newPage();
still cutting
if i convert the 17cm and 29,70cm to pixels, and set it in the
img.setScaleToFit, still cutting, how? or my computer is crazy or the PDF
A4 Size of ITEXT is wrong :|
look what i want:
My paper its B4 - 17,60cm x 24,50cm
its scanned have the size in pixels -> 2048 x 2929
im creating a PDF as A4 size (2480px x 3508px) using itext.. but im unable
to scale it with margins, and not even without margins, i need to insert
the B4 image into the PDF A4 size, using LEFT margin of 2,5cm and the RIGH
margin 2cm, but how can i make it fit calculating the sizes, since a paper
A4 has 2480x3508, the B4 image has 2048x2929, if i insert, it cut? the b4
is bigger :| how?? considering size of A4, and the b4 should fit perfectly
inside the A4
if i do this:
doc = new Document(PageSize.A4, 0, 0, 0, 0);
os = new FileOutputStream(arquivonomecompleto);
PdfWriter.getInstance(doc, os);
doc.open();
Image img = Image.getInstance(arraypath[i]); // the array store the
path to the image
// img.scaleToFit(2090, 1208); // i tried a lot of modifications, i
can set i to 500x500 or something like this in have all showed in
the pdf, but how can i calculate margins
doc.add(img);
doc.add(new Paragraph("TEST: text under the b4 image");
doc.newPage();
still cutting
if i convert the 17cm and 29,70cm to pixels, and set it in the
img.setScaleToFit, still cutting, how? or my computer is crazy or the PDF
A4 Size of ITEXT is wrong :|
look what i want:
Template class to close HANDLES and other WINAPI's?
Template class to close HANDLES and other WINAPI's?
I'm new to C++ and need some help.
I want to make a template class/struct that handles HANDLE and other
WINAPIs so far is this code:
template <typename type_to_open, typename returntype, returntype (WINAPI *
GlobalFn)(
type_to_open )> class Handle_Wrap {
public:
type_to_open data;
Handle_Wrap (type_to_open in_data) { data = in_data; }
~Handle_Wrap() { returntype (WINAPI * GlobalFn)( type_to_open );}
};
Handle_Wrap <HANDLE, BOOL, ::FindClose> hFind ( FindFirstFileA
(pattern.c_str(), &ffd) );
I honestly don't think that its working and the compiler gives me a warning:
warning C4101: 'GlobalFn' : unreferenced local variable
I saw this code from the web and did some changes to it, and i don't know
if this is the right way to do it?
I'm new to C++ and need some help.
I want to make a template class/struct that handles HANDLE and other
WINAPIs so far is this code:
template <typename type_to_open, typename returntype, returntype (WINAPI *
GlobalFn)(
type_to_open )> class Handle_Wrap {
public:
type_to_open data;
Handle_Wrap (type_to_open in_data) { data = in_data; }
~Handle_Wrap() { returntype (WINAPI * GlobalFn)( type_to_open );}
};
Handle_Wrap <HANDLE, BOOL, ::FindClose> hFind ( FindFirstFileA
(pattern.c_str(), &ffd) );
I honestly don't think that its working and the compiler gives me a warning:
warning C4101: 'GlobalFn' : unreferenced local variable
I saw this code from the web and did some changes to it, and i don't know
if this is the right way to do it?
A function with an int or void return type can be called before declaring and defining?
A function with an int or void return type can be called before declaring
and defining?
I read in "The C Programming Language ANSI edition by Kernighan and
Ritchie" that if I call a function with a return type either int or void
inside another function before actually declaring/defining it, it should
work perfectly. But when I run it on codeblocks I still get a warning.
#include<stdio.h>
#include<conio.h>
int main()
{
display();
}
void display()
{
printf("Hello World\n");
}
The warning being: "Conflicting types for display".
But if i change the program to:
#include<stdio.h>
#include<conio.h>
void display()
{
printf("Hello World\n");
}
int main()
{
display();
}
It works without any warnings. Why is that? Please help.
and defining?
I read in "The C Programming Language ANSI edition by Kernighan and
Ritchie" that if I call a function with a return type either int or void
inside another function before actually declaring/defining it, it should
work perfectly. But when I run it on codeblocks I still get a warning.
#include<stdio.h>
#include<conio.h>
int main()
{
display();
}
void display()
{
printf("Hello World\n");
}
The warning being: "Conflicting types for display".
But if i change the program to:
#include<stdio.h>
#include<conio.h>
void display()
{
printf("Hello World\n");
}
int main()
{
display();
}
It works without any warnings. Why is that? Please help.
Tuesday, 27 August 2013
How to save an image from canvas
How to save an image from canvas
Recently I've been attempting to create a photo booth by relying on Webrtc
and have nearly completed all of the code except I've not been able to
figure out a way to save the image after it has been captured.
This is the closest I've come so far to achieving my goal: enter code here
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>fotogoof</title>
<link rel="Stylesheet" href="css/bootstrap.css"/>
<link rel="Stylesheet" href="css/style.css"/>
<script type="text/javascript">
window.onload = function () {
var img = document.getElementById('screenshot');
var button = document.getElementById('saveImage');
img.src = '';
img.onload = function () {
button.removeAttribute('disabled');
};
button.onclick = function () {
window.location.href = img.src.replace('image/png',
'image/octet-stream');
};
};
</script>
</head>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<h2 class="brand">Html5 Photobooth</h1>
</div>
</div>
</div>
<div class="container" id="body-wrap">
<div class="container" id="main">
<div class="span10">
<div id="video-container">
<canvas width="400" height="320" class="mask"></canvas>
<div id="counter">
</div>
</div>
<br><div id="pic-holder" class="pull-left"><img
id="screenshot"></div></br>
<input id="saveImage" type="button" value="save image"
disabled="disabled"/>
</div>
</div>
</div>
</div>
The code is essentially taking the webcam stream and feeding it into a
canvas element. Pressing the space button triggers a screenshot to be
taken, which then appears as an image. Because I'm unable to provide the
exact source of the file that is being downloaded the button only opens
the image in another tab in the browser instead of functioning properly. I
would really appreciate some input as to how I can resolve this. Thanks in
advance.
Recently I've been attempting to create a photo booth by relying on Webrtc
and have nearly completed all of the code except I've not been able to
figure out a way to save the image after it has been captured.
This is the closest I've come so far to achieving my goal: enter code here
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>fotogoof</title>
<link rel="Stylesheet" href="css/bootstrap.css"/>
<link rel="Stylesheet" href="css/style.css"/>
<script type="text/javascript">
window.onload = function () {
var img = document.getElementById('screenshot');
var button = document.getElementById('saveImage');
img.src = '';
img.onload = function () {
button.removeAttribute('disabled');
};
button.onclick = function () {
window.location.href = img.src.replace('image/png',
'image/octet-stream');
};
};
</script>
</head>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<h2 class="brand">Html5 Photobooth</h1>
</div>
</div>
</div>
<div class="container" id="body-wrap">
<div class="container" id="main">
<div class="span10">
<div id="video-container">
<canvas width="400" height="320" class="mask"></canvas>
<div id="counter">
</div>
</div>
<br><div id="pic-holder" class="pull-left"><img
id="screenshot"></div></br>
<input id="saveImage" type="button" value="save image"
disabled="disabled"/>
</div>
</div>
</div>
</div>
The code is essentially taking the webcam stream and feeding it into a
canvas element. Pressing the space button triggers a screenshot to be
taken, which then appears as an image. Because I'm unable to provide the
exact source of the file that is being downloaded the button only opens
the image in another tab in the browser instead of functioning properly. I
would really appreciate some input as to how I can resolve this. Thanks in
advance.
Interactive animated characters running on this website. How to do this?
Interactive animated characters running on this website. How to do this?
I am looking for ideas and inspiration on how to ca
http://hellpizza.com/nz/
trick as in the website below.
At the bottom of the page, there are a number of characters running around
that can be interacted with.
What is the correct technology for achieving this? It appears to use
JQuery, but i am unsure what modules it is using or where it's source
variables are coming from.
Any advice would be appreciated.
I am looking for ideas and inspiration on how to ca
http://hellpizza.com/nz/
trick as in the website below.
At the bottom of the page, there are a number of characters running around
that can be interacted with.
What is the correct technology for achieving this? It appears to use
JQuery, but i am unsure what modules it is using or where it's source
variables are coming from.
Any advice would be appreciated.
Concatenate / Join MP4 files using ffmpeg and windows command line batch NOT LINUX
Concatenate / Join MP4 files using ffmpeg and windows command line batch
NOT LINUX
I've written a batch script that attempts to take a generic introductory
title video (MP4) that runs for 12 seconds and attaches it to the
beginning of 4 other MP4 videos (same video but each has a different
language audio track)
According to ffmpeg syntax here:
http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files
the concat demuxer needs to be run from a text file that looks like this:
# this is a comment
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
I believe everything in my script up until the point of joining the files
appears to be working correctly. But I get this error:
[concat @ 04177d00] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\frenchfile.mp4'
filelistFrench.txt: Invalid data found when processing input
[concat @ 03b70a80] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\spanishfile.mp4'
filelistSpanish.txt: Invalid data found when processing input
[concat @ 0211b960] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\basquefile.mp4'
filelistBasque.txt: Invalid data found when processing input
[concat @ 03a20a80] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4'
filelistEnglish.txt: Invalid data found when processing input
I believe the issue lies in the text file I'm creating. Please excuse my
n00b ignorance, but sometimes new script makers like myself get confused
about developer jargon and may take things literally.
So when I look at that example text file they gave, am I correct in
thinking THIS is what my text file should look like?
# this is a comment
Titlefile.mp4
'C:\Users\Joe\1May\session3\readyforfinalconversion\Titlefile.mp4'
Englishfile.mp4
'C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4'
Again, am I being too literal? are the quotations correct? Are the slashes
correct? In the example they provide the slashes in the path are / instead
of normal windows \ . I'll provide the entire script in case it helps.
@echo off
setlocal EnableDelayedExpansion
rem Create an array of languages
set i=0
for %%a in (French Spanish Basque English) do (
set /A i+=1
set term[!i!]=%%a
)
rem Get the title video file name from user
set /p titlevideofilename=What is the title video file
name?
rem create a path variable for the title video file
set pathtotitlevideo=%~dp0%titlevideofilename%
rem Get the names of the different language video files to append to the
title video
rem create a path variable for each different language video files
for /L %%i in (1,1,4) do (
set /p language[%%i]=what is the name of the !term
[%%i]! file you want to append after the title video?
set pathtofile[%%i]=%~dp0!language[%%i]!
)
rem create data file for ffmpeg based on variable data
for /L %%i in (1,1,4) do (
echo # this is a comment>>filelist!term[%
%i]!.txt
echo %titlevideofilename% '%pathtotitlevideo%'>>filelist!term[%
%i]!.txt
echo !language[%%i]! '!pathtofile[%%i]!'>>filelist!term[%
%i]!.txt
)
cls
rem join files using ffmpeg concat option
for /L %%i in (1,1,4) do (
c:\ffmpeg\ffmpeg\bin\ffmpeg.exe -loglevel error -f
concat -i filelist!term[%%i]!.txt -c copy !language[%
%i]!.!term[%%i]!.withtitle.mp4
)
endlocal
:eof
exit
NOT LINUX
I've written a batch script that attempts to take a generic introductory
title video (MP4) that runs for 12 seconds and attaches it to the
beginning of 4 other MP4 videos (same video but each has a different
language audio track)
According to ffmpeg syntax here:
http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files
the concat demuxer needs to be run from a text file that looks like this:
# this is a comment
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
I believe everything in my script up until the point of joining the files
appears to be working correctly. But I get this error:
[concat @ 04177d00] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\frenchfile.mp4'
filelistFrench.txt: Invalid data found when processing input
[concat @ 03b70a80] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\spanishfile.mp4'
filelistSpanish.txt: Invalid data found when processing input
[concat @ 0211b960] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\basquefile.mp4'
filelistBasque.txt: Invalid data found when processing input
[concat @ 03a20a80] Line 2: unknown keyword
''C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4'
filelistEnglish.txt: Invalid data found when processing input
I believe the issue lies in the text file I'm creating. Please excuse my
n00b ignorance, but sometimes new script makers like myself get confused
about developer jargon and may take things literally.
So when I look at that example text file they gave, am I correct in
thinking THIS is what my text file should look like?
# this is a comment
Titlefile.mp4
'C:\Users\Joe\1May\session3\readyforfinalconversion\Titlefile.mp4'
Englishfile.mp4
'C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4'
Again, am I being too literal? are the quotations correct? Are the slashes
correct? In the example they provide the slashes in the path are / instead
of normal windows \ . I'll provide the entire script in case it helps.
@echo off
setlocal EnableDelayedExpansion
rem Create an array of languages
set i=0
for %%a in (French Spanish Basque English) do (
set /A i+=1
set term[!i!]=%%a
)
rem Get the title video file name from user
set /p titlevideofilename=What is the title video file
name?
rem create a path variable for the title video file
set pathtotitlevideo=%~dp0%titlevideofilename%
rem Get the names of the different language video files to append to the
title video
rem create a path variable for each different language video files
for /L %%i in (1,1,4) do (
set /p language[%%i]=what is the name of the !term
[%%i]! file you want to append after the title video?
set pathtofile[%%i]=%~dp0!language[%%i]!
)
rem create data file for ffmpeg based on variable data
for /L %%i in (1,1,4) do (
echo # this is a comment>>filelist!term[%
%i]!.txt
echo %titlevideofilename% '%pathtotitlevideo%'>>filelist!term[%
%i]!.txt
echo !language[%%i]! '!pathtofile[%%i]!'>>filelist!term[%
%i]!.txt
)
cls
rem join files using ffmpeg concat option
for /L %%i in (1,1,4) do (
c:\ffmpeg\ffmpeg\bin\ffmpeg.exe -loglevel error -f
concat -i filelist!term[%%i]!.txt -c copy !language[%
%i]!.!term[%%i]!.withtitle.mp4
)
endlocal
:eof
exit
EF Repository not loading data from database
EF Repository not loading data from database
I have two databases that I need to call data from. IntranetApps and
LawOfficerServer (LORS).
The IntranetApps portion was written and is working. I'm adding the
LawOfficerServer portion.
I created and EDMX (LORSDataEntities.edmx) and two .tt files,
LORSDataEntities.Context.tt and LORSDataEntities.tt patterned after what
was working for IntranetApps. I created a separate Repository class,
LORSRepository.cs patterned after what was working.
All the Repository, EDMX, and .tt files are in a project called DataAccess.
I call for the data in the ServicesLayer project, which has my
LORSDataService.cs (patterned after what is working in the other side)
where I have a basic call to FindAll().
Here's the code:
public static List<Incident> GetAllIncidents()
{
using (IUnitOfWork unitOfWork = new LORSDataEntities())
{
LORSRepository<DataAccess.Models.LORS.Incident> incidentRepos
= new
LORSRepository<DataAccess.Models.LORS.Incident>(unitOfWork);
try
{
var incidents = incidentRepos.FindAll()
.Include(i => i.Officer);
.OrderBy(i => i.IncidentYear)
.ThenBy(i => i.Officer.BadgeNumber)
.ThenBy(i => i.IncidentNumber);
return incidents.ToList();
}
catch (InvalidOperationException exc)
{
ExceptionPolicy.HandleException(exc, "DataAccess");
throw exc;
}
}
}
Incident is a table in the EDMX. However I get this message:
The entity type Incident is not part of the model for the current context.
Using SQL Server Profiler, I can see the IntranetApps calls, but not the
LORS calls. It's as if the repository is never trying to talk to the
database.
In the web.config for the Web application I have this connectionString:
<add name="LORSDataEntities"
connectionString="metadata=res://*/Models.IntranetAppsEntities.csdl|res://*/Models.IntranetAppsEntities.ssdl|res://*/Models.IntranetAppsEntities.msl;provider=System.Data.SqlClient;provider
connection string="data source=FBHBGSQLDEV01;initial
catalog=LawOfficerServer;integrated security=False;User
Id=redacted;Password=xxxxxxx;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
Any thoughts where I went wrong, or to troubleshoot what I missed?
I have two databases that I need to call data from. IntranetApps and
LawOfficerServer (LORS).
The IntranetApps portion was written and is working. I'm adding the
LawOfficerServer portion.
I created and EDMX (LORSDataEntities.edmx) and two .tt files,
LORSDataEntities.Context.tt and LORSDataEntities.tt patterned after what
was working for IntranetApps. I created a separate Repository class,
LORSRepository.cs patterned after what was working.
All the Repository, EDMX, and .tt files are in a project called DataAccess.
I call for the data in the ServicesLayer project, which has my
LORSDataService.cs (patterned after what is working in the other side)
where I have a basic call to FindAll().
Here's the code:
public static List<Incident> GetAllIncidents()
{
using (IUnitOfWork unitOfWork = new LORSDataEntities())
{
LORSRepository<DataAccess.Models.LORS.Incident> incidentRepos
= new
LORSRepository<DataAccess.Models.LORS.Incident>(unitOfWork);
try
{
var incidents = incidentRepos.FindAll()
.Include(i => i.Officer);
.OrderBy(i => i.IncidentYear)
.ThenBy(i => i.Officer.BadgeNumber)
.ThenBy(i => i.IncidentNumber);
return incidents.ToList();
}
catch (InvalidOperationException exc)
{
ExceptionPolicy.HandleException(exc, "DataAccess");
throw exc;
}
}
}
Incident is a table in the EDMX. However I get this message:
The entity type Incident is not part of the model for the current context.
Using SQL Server Profiler, I can see the IntranetApps calls, but not the
LORS calls. It's as if the repository is never trying to talk to the
database.
In the web.config for the Web application I have this connectionString:
<add name="LORSDataEntities"
connectionString="metadata=res://*/Models.IntranetAppsEntities.csdl|res://*/Models.IntranetAppsEntities.ssdl|res://*/Models.IntranetAppsEntities.msl;provider=System.Data.SqlClient;provider
connection string="data source=FBHBGSQLDEV01;initial
catalog=LawOfficerServer;integrated security=False;User
Id=redacted;Password=xxxxxxx;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
Any thoughts where I went wrong, or to troubleshoot what I missed?
Best Hosting for ASP MVC .NET 4.5 App w/SQL Server 2012
Best Hosting for ASP MVC .NET 4.5 App w/SQL Server 2012
I am looking for a good hosting company to host my ASP MVC .NET 4.5
application, with an underlying SQL Server 2012 database. Initially I
don't mind hosting both on the same server for development, but would
eventually like a seperate app and db server, obviously with internal
connectivity.
The DB will only take about 10Gb total, and bandwidth will be maximum
300Gb per month.
I have been using Azure up to now, but productionising that will cost way
more than it's worth. Ideally I would like a moderately powered VPS for
this.
What companies are recommended, and what experiences have you had with
deploying these setups (in terms of hosting)?
I am looking for a good hosting company to host my ASP MVC .NET 4.5
application, with an underlying SQL Server 2012 database. Initially I
don't mind hosting both on the same server for development, but would
eventually like a seperate app and db server, obviously with internal
connectivity.
The DB will only take about 10Gb total, and bandwidth will be maximum
300Gb per month.
I have been using Azure up to now, but productionising that will cost way
more than it's worth. Ideally I would like a moderately powered VPS for
this.
What companies are recommended, and what experiences have you had with
deploying these setups (in terms of hosting)?
Program do count blanks, tabs and newlines. its not correct tell me where i'm wrong
Program do count blanks, tabs and newlines. its not correct tell me where
i'm wrong
#include <stdio.h>
int main(void)
{
int c, blank, tab, lines;
int till = 0;
blank = tab = lines = 0;
while(till == 0)
{
c = getchar();
switch(c)
{
case ' ' :
blank++;
case '\t' :
tab++;
case '\n' :
lines++;
case 'EOF' : /* warning: multi-character character constant
[-Wmultichar] */
till = 1;
}
}
printf("Blanks :%d Tab :%d Lines :%d\n", blank, tab, lines);
return 0;
}
While i compile this code it persist this error : warning: multi-character
character constant [-Wmultichar] and how can we use EOF in SWITCH.
i'm wrong
#include <stdio.h>
int main(void)
{
int c, blank, tab, lines;
int till = 0;
blank = tab = lines = 0;
while(till == 0)
{
c = getchar();
switch(c)
{
case ' ' :
blank++;
case '\t' :
tab++;
case '\n' :
lines++;
case 'EOF' : /* warning: multi-character character constant
[-Wmultichar] */
till = 1;
}
}
printf("Blanks :%d Tab :%d Lines :%d\n", blank, tab, lines);
return 0;
}
While i compile this code it persist this error : warning: multi-character
character constant [-Wmultichar] and how can we use EOF in SWITCH.
Monday, 26 August 2013
How to load XML data in jQueryEasyUI treegrid
How to load XML data in jQueryEasyUI treegrid
I have recently started using easyUI tree grid,which by default easyui
consume json .Could any one please provide me with a sample to load an XML
data through a link to xml file or URL.
I have recently started using easyUI tree grid,which by default easyui
consume json .Could any one please provide me with a sample to load an XML
data through a link to xml file or URL.
Zend_ACL guest roles overide Adminstrator roles?
Zend_ACL guest roles overide Adminstrator roles?
I have created Zend_ACL with three roles :'administrator, guest, editor'.
I want guest cannot access /album/index after login. Administrator, editor
can access /album/index. All other pages are accessible by all.
I created the access list below with Acl.php in helper.
/library/My/Helper/Acl.php:
public function __construct() {
$this->acl = new Zend_Acl();
}
public function setRoles() {
$this->acl->addRole(new Zend_Acl_Role('guest'));
$this->acl->addRole(new Zend_Acl_Role('editor'));
$this->acl->addRole(new Zend_Acl_Role('administrator'));
}
public function setResource () {
$this->acl->add(new Zend_Acl_Resource('album::index'));
$this->acl->add(new Zend_Acl_Resource('album::add'));
$this->acl->add(new Zend_Acl_Resource('album::edit'));
$this->acl->add(new Zend_Acl_Resource('album::delete'));
$this->acl->add(new Zend_Acl_Resource('auth::index'));
$this->acl->add(new Zend_Acl_Resource('auth::logout'));
$this->acl->add(new Zend_Acl_Resource('error::error'));
}
public function setPrivilages() {
$allowEditorAdmin=array('administrator','editor');
$allowAll=array('administrator','guest','editor');
$this->acl->allow($allowEditorAdmin,'album::index');
$this->acl->allow($allowAll,'album::add');
$this->acl->allow($allowAll,'album::edit');
$this->acl->allow($allowAll,'album::delete');
$this->acl->allow($allowAll,'auth::index');
$this->acl->allow($allowAll,'auth::logout');
$this->acl->allow($allowAll,'error::error');
Then, I create a plugin Acl.php
public function preDispatch(Zend_Controller_Request_Abstract $request) {
$acl1 = new My_Controller_Helper_Acl();
$acl = Zend_Registry::get('acl');
$userNs = new Zend_Session_Namespace('members');
if($userNs->userType=='')
{
$roleName='guest';
}
else
$roleName=$userNs->userType;
if(!$acl->isAllowed($roleName,$request->getControllerName()."::".$request->getActionname()))
{
echo $request->getControllerName()."::".$request->getActionName();
$request->setControllerName('auth');
$request->setActionName('index');
}
else
echo "got authenticated";
}
The problem is my code "isallowed" not work correctly. The
'guest,editor,administrator' cannot access to /album/index after
authenticate successfully. They redirect to /auth/index
if(!$acl->isAllowed($roleName,$request->getControllerName()."::".$request->getActionname()))
{
echo $request->getControllerName()."::".$request->getActionName();
$request->setControllerName('auth');
$request->setActionName('index');
}
else
echo "got authenticated";
}
I have created Zend_ACL with three roles :'administrator, guest, editor'.
I want guest cannot access /album/index after login. Administrator, editor
can access /album/index. All other pages are accessible by all.
I created the access list below with Acl.php in helper.
/library/My/Helper/Acl.php:
public function __construct() {
$this->acl = new Zend_Acl();
}
public function setRoles() {
$this->acl->addRole(new Zend_Acl_Role('guest'));
$this->acl->addRole(new Zend_Acl_Role('editor'));
$this->acl->addRole(new Zend_Acl_Role('administrator'));
}
public function setResource () {
$this->acl->add(new Zend_Acl_Resource('album::index'));
$this->acl->add(new Zend_Acl_Resource('album::add'));
$this->acl->add(new Zend_Acl_Resource('album::edit'));
$this->acl->add(new Zend_Acl_Resource('album::delete'));
$this->acl->add(new Zend_Acl_Resource('auth::index'));
$this->acl->add(new Zend_Acl_Resource('auth::logout'));
$this->acl->add(new Zend_Acl_Resource('error::error'));
}
public function setPrivilages() {
$allowEditorAdmin=array('administrator','editor');
$allowAll=array('administrator','guest','editor');
$this->acl->allow($allowEditorAdmin,'album::index');
$this->acl->allow($allowAll,'album::add');
$this->acl->allow($allowAll,'album::edit');
$this->acl->allow($allowAll,'album::delete');
$this->acl->allow($allowAll,'auth::index');
$this->acl->allow($allowAll,'auth::logout');
$this->acl->allow($allowAll,'error::error');
Then, I create a plugin Acl.php
public function preDispatch(Zend_Controller_Request_Abstract $request) {
$acl1 = new My_Controller_Helper_Acl();
$acl = Zend_Registry::get('acl');
$userNs = new Zend_Session_Namespace('members');
if($userNs->userType=='')
{
$roleName='guest';
}
else
$roleName=$userNs->userType;
if(!$acl->isAllowed($roleName,$request->getControllerName()."::".$request->getActionname()))
{
echo $request->getControllerName()."::".$request->getActionName();
$request->setControllerName('auth');
$request->setActionName('index');
}
else
echo "got authenticated";
}
The problem is my code "isallowed" not work correctly. The
'guest,editor,administrator' cannot access to /album/index after
authenticate successfully. They redirect to /auth/index
if(!$acl->isAllowed($roleName,$request->getControllerName()."::".$request->getActionname()))
{
echo $request->getControllerName()."::".$request->getActionName();
$request->setControllerName('auth');
$request->setActionName('index');
}
else
echo "got authenticated";
}
MongoDB and MongoJS - can't get runCommand to work for text queries
MongoDB and MongoJS - can't get runCommand to work for text queries
My goal is to use MongoDB's (2.4.4) text command from Node. It works fine
from the command line. Based on this previous SO issue: Equivalent to
mongo shell db.collection.runCommand() in Node.js, I tried using MongoJS
(0.7.17) but can't make it go. Here is the code:
mongojs = require('mongojs');
var products = mongojs('localhost:27017/mydb').collection('products');
products.runCommand('text', {search: 'a'}, function (err, docs) {
...
});
docs returns undefined and err is null. I can execute a normal function
such as products.find() fine... and I can execute the search on the
MongoDB command line. Anyone know how to make this go?
My goal is to use MongoDB's (2.4.4) text command from Node. It works fine
from the command line. Based on this previous SO issue: Equivalent to
mongo shell db.collection.runCommand() in Node.js, I tried using MongoJS
(0.7.17) but can't make it go. Here is the code:
mongojs = require('mongojs');
var products = mongojs('localhost:27017/mydb').collection('products');
products.runCommand('text', {search: 'a'}, function (err, docs) {
...
});
docs returns undefined and err is null. I can execute a normal function
such as products.find() fine... and I can execute the search on the
MongoDB command line. Anyone know how to make this go?
Class Names in Xamarin to Objective C binding
Class Names in Xamarin to Objective C binding
We are binding a library from Objective C to C#. We want to use different
names in our classes in C#.
Do the class in C# and the objective C class must have the same name?
I know that using the MonoTouch.Foundation.ExportAttribute in the methods
in C# we can specify different names for the methods and properties...
however, I haven't found how to do the same for classes.
Thanks.
We are binding a library from Objective C to C#. We want to use different
names in our classes in C#.
Do the class in C# and the objective C class must have the same name?
I know that using the MonoTouch.Foundation.ExportAttribute in the methods
in C# we can specify different names for the methods and properties...
however, I haven't found how to do the same for classes.
Thanks.
I understand the comma in the beginning. And from then I am not sure
I understand the comma in the beginning. And from then I am not sure
During college, I worked the summers as a landscaper, which cultivated a
fascination in wild plants and folk medicine.
During college, I worked the summers as a landscaper, which cultivated a
fascination in wild plants and folk medicine.
Can Path Loss be a routing metric?
Can Path Loss be a routing metric?
I have researched about routing metrics for Wireless Networks. However, I
have not come across "Path loss" as a routing metric. Since, Path loss is
a very important performance factor for networks like Wireless Body Area
Networks, is it feasible to use it as a routing metric?
I have researched about routing metrics for Wireless Networks. However, I
have not come across "Path loss" as a routing metric. Since, Path loss is
a very important performance factor for networks like Wireless Body Area
Networks, is it feasible to use it as a routing metric?
Stuck on include() in a wordpress theme
Stuck on include() in a wordpress theme
I'm going to include() a php file in a wordpress theme file. The file is
header.php, and the function is like:
<?php
error_reporting(E_ALL);
$filename = ...; // file exists but is empty
if (file_exists(filename)){
echo 'Ok';
include($filename);
} ?>
"Ok" is printed in resulting html, but output stops immediately after. Am
I missing something about home themes work?
File permissions are ok.
I'm going to include() a php file in a wordpress theme file. The file is
header.php, and the function is like:
<?php
error_reporting(E_ALL);
$filename = ...; // file exists but is empty
if (file_exists(filename)){
echo 'Ok';
include($filename);
} ?>
"Ok" is printed in resulting html, but output stops immediately after. Am
I missing something about home themes work?
File permissions are ok.
Deserializing a boolean value with nullable attribute?
Deserializing a boolean value with nullable attribute?
I am deserializing a string back to an object using C#. The xml string
looks like
"<Authentication xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">
<Status>Success</Status>
<Available i:nil=\"true\"/>
</Authentication>"
While I'm managed to handle the Available by making the bool property
nullable, I'm just wondering what is the correct way to handle
i:nil=\"true\"?
Should I being doing something else other than just making a property
Available property nullable?
Thanks.
I am deserializing a string back to an object using C#. The xml string
looks like
"<Authentication xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">
<Status>Success</Status>
<Available i:nil=\"true\"/>
</Authentication>"
While I'm managed to handle the Available by making the bool property
nullable, I'm just wondering what is the correct way to handle
i:nil=\"true\"?
Should I being doing something else other than just making a property
Available property nullable?
Thanks.
Wordpress Menu Wrap
Wordpress Menu Wrap
The following website's theme, http://174.132.194.251/~taninew/ is driving
me crazy. I've always been able to use the css code for word wrapping and
line wrapping in the past, but now it seems that my menu items wrap in two
or even three lines.
How to fix that?
The following website's theme, http://174.132.194.251/~taninew/ is driving
me crazy. I've always been able to use the css code for word wrapping and
line wrapping in the past, but now it seems that my menu items wrap in two
or even three lines.
How to fix that?
Change date format in java script
Change date format in java script
I have a date in different format. And i wanted to show it in a different
format. And i wanted to do it on client side. Is there any way to convert
the format.
Date : 2013-07-30 16:12:13.0
Expected Format :Jul 30, 2013 4:12 PM
I have a date in different format. And i wanted to show it in a different
format. And i wanted to do it on client side. Is there any way to convert
the format.
Date : 2013-07-30 16:12:13.0
Expected Format :Jul 30, 2013 4:12 PM
Sunday, 25 August 2013
Following Ray Wenderlich's In App Purchase Tutorial, how do i implement logic to check if a product was purchased
Following Ray Wenderlich's In App Purchase Tutorial, how do i implement
logic to check if a product was purchased
his tutorial Introduction to In App Purchases
http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial
how can I check if something is purchased? I want to check this with an
if-statement. So, when "this" is bought, then do this and so on. I can't
figure out what to write for the if-statement for the life of me.
can someone please answer this question explicitly? i have seen it posted
in a few different places but none of the answers are straightforward
enough for a complete novice like myself to comprehend. I found the exact
same question here but the answer made no sense to me Check which product
the user bought on an In-App Purchase
specifically, what is the code to do this part
"The resources zip for this tutorial contain images for all of the the
comics, so if you're so inclined you can wrap it up by showing the comic
in a new view controller when a purchased row is tapped! If you want to do
this, you can just check if the productIdentifier is in the
purchasedProducts array of the InAppRageIAPHelper before allowing the user
access to the content."
I have everything working perfect from the tutorial, i just dont know how
to use it.
i have a main menu view controller that has 3 buttons. i want to disable 2
of the buttons by default, but if the user has purchased the respective
products, then i want to enable the buttons. i know it has something to do
with NSUSerDefaults but I am very dense and am not able to understand a
lot of the implicit answers people give for this question. If someone
could spell it out for me I would be very grateful.
Thank you
logic to check if a product was purchased
his tutorial Introduction to In App Purchases
http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial
how can I check if something is purchased? I want to check this with an
if-statement. So, when "this" is bought, then do this and so on. I can't
figure out what to write for the if-statement for the life of me.
can someone please answer this question explicitly? i have seen it posted
in a few different places but none of the answers are straightforward
enough for a complete novice like myself to comprehend. I found the exact
same question here but the answer made no sense to me Check which product
the user bought on an In-App Purchase
specifically, what is the code to do this part
"The resources zip for this tutorial contain images for all of the the
comics, so if you're so inclined you can wrap it up by showing the comic
in a new view controller when a purchased row is tapped! If you want to do
this, you can just check if the productIdentifier is in the
purchasedProducts array of the InAppRageIAPHelper before allowing the user
access to the content."
I have everything working perfect from the tutorial, i just dont know how
to use it.
i have a main menu view controller that has 3 buttons. i want to disable 2
of the buttons by default, but if the user has purchased the respective
products, then i want to enable the buttons. i know it has something to do
with NSUSerDefaults but I am very dense and am not able to understand a
lot of the implicit answers people give for this question. If someone
could spell it out for me I would be very grateful.
Thank you
javascript split array depends on names
javascript split array depends on names
I have a mybooks array, I'd like to separate it by the book's category.
var mybooks = [
['novel','BookName1','$20.00'],
['novel','BookName2','$24.00'],
['novel','BookName3','$34.00'],
['novel','BookName4','$31.00'],
['novel','BookName4','$38.00'],
['Biograph','BookName5','$28.00'],
['Biograph','BookName6','$48.00'],
['Biograph','BookName7','$50.00']
];
I made it this way.
for(i=0; i<mybooks.length; i++){
if ((mybooks[i][0]) == 'novel'){
var books = mybooks[i];
console.log(books);
}
};
console.log(books) prints
["novel", "BookName1", "$20.00"]
["novel", "BookName2", "$24.00"]
["novel", "BookName3", "$34.00"]
["novel", "BookName4", "$31.00"]
["novel", "BookName4", "$38.00"]
How can I make a global variable called 'splited' equals books
I have a mybooks array, I'd like to separate it by the book's category.
var mybooks = [
['novel','BookName1','$20.00'],
['novel','BookName2','$24.00'],
['novel','BookName3','$34.00'],
['novel','BookName4','$31.00'],
['novel','BookName4','$38.00'],
['Biograph','BookName5','$28.00'],
['Biograph','BookName6','$48.00'],
['Biograph','BookName7','$50.00']
];
I made it this way.
for(i=0; i<mybooks.length; i++){
if ((mybooks[i][0]) == 'novel'){
var books = mybooks[i];
console.log(books);
}
};
console.log(books) prints
["novel", "BookName1", "$20.00"]
["novel", "BookName2", "$24.00"]
["novel", "BookName3", "$34.00"]
["novel", "BookName4", "$31.00"]
["novel", "BookName4", "$38.00"]
How can I make a global variable called 'splited' equals books
Create thumbnails for images inside specific folders
Create thumbnails for images inside specific folders
I would like to create image thumbnails (250x250px) using Wand
(imagemagick) for python.
I want results to be similar to PHP's imagecopyresampled()** function with
no quality loss if possible.
My directory structure is the following:
> main folder (level 1) -> only one
>> company folder (level 2 - inside main folder) -> 286 company folders
>>> product folder (level 2 - inside each company folder)
>>> property folders (level 2 - inside each company folder) -> number
depending on number of properties that each company owns
>>>> imagename.jpg (level 3 - inside each property folder) -> number
depending on number of images.
>>>> imagename_thumb.jpg (level 3 - inside each property folder) -> old,
smaller thumbs, one for every original image in folder. These should
be deleted/replaced with new ones.
Now what i would like to achieve is to create thumbnail (as described
before) for every imagename.jpg image, replacing old imagename_thumb.jpg
images with new ones.
PLEASE NOTE: There are also some images inside product folder, but i dont
want to create thumbs for these, so is it possible to avoid this folder
when looping through files?
REASON: We recently decided to redesign the online app which uses bigger
thumbnail images. It is almost impossible to replace all the existing
smaller thumbnails by hand.
** Explanation of imagecopyresampled() function (crop, resample) for
better understanding what kind of thumbs i want to achieve:
imagecopyresampled() copies a rectangular portion of one image to another
image, smoothly interpolating pixel values so that, in particular,
reducing the size of an image still retains a great deal of clarity.
In other words, imagecopyresampled() will take a rectangular area from
src_image of width src_w and height src_h at position (src_x,src_y) and
place it in a rectangular area of dst_image of width dst_w and height
dst_h at position (dst_x,dst_y).
If the source and destination coordinates and width and heights differ,
appropriate stretching or shrinking of the image fragment will be
performed. The coordinates refer to the upper left corner. This function
can be used to copy regions within the same image (if dst_image is the
same as src_image) but if the regions overlap the results will be
unpredictable.
I would like to create image thumbnails (250x250px) using Wand
(imagemagick) for python.
I want results to be similar to PHP's imagecopyresampled()** function with
no quality loss if possible.
My directory structure is the following:
> main folder (level 1) -> only one
>> company folder (level 2 - inside main folder) -> 286 company folders
>>> product folder (level 2 - inside each company folder)
>>> property folders (level 2 - inside each company folder) -> number
depending on number of properties that each company owns
>>>> imagename.jpg (level 3 - inside each property folder) -> number
depending on number of images.
>>>> imagename_thumb.jpg (level 3 - inside each property folder) -> old,
smaller thumbs, one for every original image in folder. These should
be deleted/replaced with new ones.
Now what i would like to achieve is to create thumbnail (as described
before) for every imagename.jpg image, replacing old imagename_thumb.jpg
images with new ones.
PLEASE NOTE: There are also some images inside product folder, but i dont
want to create thumbs for these, so is it possible to avoid this folder
when looping through files?
REASON: We recently decided to redesign the online app which uses bigger
thumbnail images. It is almost impossible to replace all the existing
smaller thumbnails by hand.
** Explanation of imagecopyresampled() function (crop, resample) for
better understanding what kind of thumbs i want to achieve:
imagecopyresampled() copies a rectangular portion of one image to another
image, smoothly interpolating pixel values so that, in particular,
reducing the size of an image still retains a great deal of clarity.
In other words, imagecopyresampled() will take a rectangular area from
src_image of width src_w and height src_h at position (src_x,src_y) and
place it in a rectangular area of dst_image of width dst_w and height
dst_h at position (dst_x,dst_y).
If the source and destination coordinates and width and heights differ,
appropriate stretching or shrinking of the image fragment will be
performed. The coordinates refer to the upper left corner. This function
can be used to copy regions within the same image (if dst_image is the
same as src_image) but if the regions overlap the results will be
unpredictable.
[ Polls & Surveys ] Open Question : Do you write Diary? why or why not? :)?
[ Polls & Surveys ] Open Question : Do you write Diary? why or why not? :)?
If you write: Do you keep it secret? If you don't : Will you consider to
start writing someday? Thank you :)
If you write: Do you keep it secret? If you don't : Will you consider to
start writing someday? Thank you :)
Saturday, 24 August 2013
Heroku Rails ClearDB Resque Connections
Heroku Rails ClearDB Resque Connections
If I have 20 different jobs in Resque, does that mean that my ClearDB
database would potential have 20+ connections? How can I monitor how many
connections my ClearDB is using?
If I have 20 different jobs in Resque, does that mean that my ClearDB
database would potential have 20+ connections? How can I monitor how many
connections my ClearDB is using?
Change height-top of item when hover
Change height-top of item when hover
I want to create a menu. When I hover, height-top of item will change like
But real my menu like
here is my jsfid http://jsfiddle.net/8vyUg/
<div id="menu">
<ul>
<li><a href="#">Who</a></li>
<li><a href="#">What</a></li>
<li><a href="#">Where</a></li>
</ul>
</div>
How to do that thank!
I want to create a menu. When I hover, height-top of item will change like
But real my menu like
here is my jsfid http://jsfiddle.net/8vyUg/
<div id="menu">
<ul>
<li><a href="#">Who</a></li>
<li><a href="#">What</a></li>
<li><a href="#">Where</a></li>
</ul>
</div>
How to do that thank!
newbie questions about plesk and iis7
newbie questions about plesk and iis7
i'm just trying to understand how plesk works on a win 2008 server, you
can eg. create domains, subdomains via the plesk webpanel. i got several
questions about it:
does plesk have an own dns server for hosting the dns entries when
creating subdomains? is it possible to access those settings directly from
the server (not the webpanel)?
what happens when i'm enabling the IIS dns server - will plesk stop working?
i want to run php on the IIS, so i installed it via the platform installer
which said that mysql is already installed (i assume its from plesk) - how
can i use my own mysql server for php?
does plesk make much sense at all? i mean all i need from it is for
creating subdomains/dns entries, wouldn't it also be possible/easier by
using IIS only?
thanks
i'm just trying to understand how plesk works on a win 2008 server, you
can eg. create domains, subdomains via the plesk webpanel. i got several
questions about it:
does plesk have an own dns server for hosting the dns entries when
creating subdomains? is it possible to access those settings directly from
the server (not the webpanel)?
what happens when i'm enabling the IIS dns server - will plesk stop working?
i want to run php on the IIS, so i installed it via the platform installer
which said that mysql is already installed (i assume its from plesk) - how
can i use my own mysql server for php?
does plesk make much sense at all? i mean all i need from it is for
creating subdomains/dns entries, wouldn't it also be possible/easier by
using IIS only?
thanks
Libav and xaudio2 - audio not playing
Libav and xaudio2 - audio not playing
I am trying to get audio playing with libav using xaudio2. The xaudio2
code I am using works with an older ffmpeg using avcodec_decode_audio2,
but that has been deprecated for avcodec_decode_audio4. I have tried
following various libav examples, but can't seem to get the audio to play.
Video plays fine (or rather it just plays right fast now, as I haven't
coded any sync code yet).
Firstly audio gets init, no errors, video gets init, then packet:
while (1) {
//is this packet from the video or audio stream?
if (packet.stream_index == player.v_id) {
add_video_to_queue(&packet);
} else if (packet.stream_index == player.a_id) {
add_sound_to_queue(&packet);
} else {
av_free_packet(&packet);
}
}
Then in add_sound_to_queue:
int add_sound_to_queue(AVPacket * packet) {
AVFrame *decoded_frame = NULL;
int done = AVCODEC_MAX_AUDIO_FRAME_SIZE;
int got_frame = 0;
if (!decoded_frame) {
if (!(decoded_frame = avcodec_alloc_frame())) {
printf("[ADD_SOUND_TO_QUEUE] Out of memory\n");
return -1;
}
} else {
avcodec_get_frame_defaults(decoded_frame);
}
if (avcodec_decode_audio4(player.av_acodecctx, decoded_frame, &got_frame,
packet) < 0) {
printf("[ADD_SOUND_TO_QUEUE] Error in decoding audio\n");
av_free_packet(packet);
//continue;
return -1;
}
if (got_frame) {
int data_size;
if (packet->size > done) {
data_size = done;
} else {
data_size = packet->size;
}
BYTE * snd = (BYTE *)malloc( data_size * sizeof(BYTE));
XMemCpy(snd,
AudioBytes,
data_size * sizeof(BYTE)
);
XMemSet(&g_SoundBuffer,0,sizeof(XAUDIO2_BUFFER));
g_SoundBuffer.AudioBytes = data_size;
g_SoundBuffer.pAudioData = snd;
g_SoundBuffer.pContext = (VOID*)snd;
XAUDIO2_VOICE_STATE state;
while( g_pSourceVoice->GetState( &state ), state.BuffersQueued > 60 ) {
WaitForSingleObject( XAudio2_Notifier.hBufferEndEvent, INFINITE );
}
g_pSourceVoice->SubmitSourceBuffer( &g_SoundBuffer );
}
return 0;
}
I can't seem to figure out the problem, I have added error messages in
init, opening video, codec handling etc. As mentioned before the xaudio2
code is working with an older ffmpeg, so maybe I have missed something
with the avcodec_decode_audio4?
If this snappet of code isn't enough, I can post the whole code, these are
just the places in the code I think the problem would be :(
I am trying to get audio playing with libav using xaudio2. The xaudio2
code I am using works with an older ffmpeg using avcodec_decode_audio2,
but that has been deprecated for avcodec_decode_audio4. I have tried
following various libav examples, but can't seem to get the audio to play.
Video plays fine (or rather it just plays right fast now, as I haven't
coded any sync code yet).
Firstly audio gets init, no errors, video gets init, then packet:
while (1) {
//is this packet from the video or audio stream?
if (packet.stream_index == player.v_id) {
add_video_to_queue(&packet);
} else if (packet.stream_index == player.a_id) {
add_sound_to_queue(&packet);
} else {
av_free_packet(&packet);
}
}
Then in add_sound_to_queue:
int add_sound_to_queue(AVPacket * packet) {
AVFrame *decoded_frame = NULL;
int done = AVCODEC_MAX_AUDIO_FRAME_SIZE;
int got_frame = 0;
if (!decoded_frame) {
if (!(decoded_frame = avcodec_alloc_frame())) {
printf("[ADD_SOUND_TO_QUEUE] Out of memory\n");
return -1;
}
} else {
avcodec_get_frame_defaults(decoded_frame);
}
if (avcodec_decode_audio4(player.av_acodecctx, decoded_frame, &got_frame,
packet) < 0) {
printf("[ADD_SOUND_TO_QUEUE] Error in decoding audio\n");
av_free_packet(packet);
//continue;
return -1;
}
if (got_frame) {
int data_size;
if (packet->size > done) {
data_size = done;
} else {
data_size = packet->size;
}
BYTE * snd = (BYTE *)malloc( data_size * sizeof(BYTE));
XMemCpy(snd,
AudioBytes,
data_size * sizeof(BYTE)
);
XMemSet(&g_SoundBuffer,0,sizeof(XAUDIO2_BUFFER));
g_SoundBuffer.AudioBytes = data_size;
g_SoundBuffer.pAudioData = snd;
g_SoundBuffer.pContext = (VOID*)snd;
XAUDIO2_VOICE_STATE state;
while( g_pSourceVoice->GetState( &state ), state.BuffersQueued > 60 ) {
WaitForSingleObject( XAudio2_Notifier.hBufferEndEvent, INFINITE );
}
g_pSourceVoice->SubmitSourceBuffer( &g_SoundBuffer );
}
return 0;
}
I can't seem to figure out the problem, I have added error messages in
init, opening video, codec handling etc. As mentioned before the xaudio2
code is working with an older ffmpeg, so maybe I have missed something
with the avcodec_decode_audio4?
If this snappet of code isn't enough, I can post the whole code, these are
just the places in the code I think the problem would be :(
System.Web.Handlers.TransferRequestHandler and robots.txt
System.Web.Handlers.TransferRequestHandler and robots.txt
I have urls in my asp.net mvc 4 application such as:
http://site.com/retailer.com
http://site.com/other-retailer
http://site.com/retailer.com-from-uk
These map to a controller and action. In web.config I have the following
setup so I do not have to use runallmanagedmodulesforallrequests
<add name="ApiURIs-ISAPI-Integrated-4.0"
path="/*.*"
verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
This however means requests to robots.txt go through the managed pipeline,
when the file is on the filesystem.
Any ideas how to remove just robots.txt from the HttpHandler, even with
having the path as /*.* ?
I have urls in my asp.net mvc 4 application such as:
http://site.com/retailer.com
http://site.com/other-retailer
http://site.com/retailer.com-from-uk
These map to a controller and action. In web.config I have the following
setup so I do not have to use runallmanagedmodulesforallrequests
<add name="ApiURIs-ISAPI-Integrated-4.0"
path="/*.*"
verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
This however means requests to robots.txt go through the managed pipeline,
when the file is on the filesystem.
Any ideas how to remove just robots.txt from the HttpHandler, even with
having the path as /*.* ?
jQuery draggable plugin i want to update px to mm on drag event
jQuery draggable plugin i want to update px to mm on drag event
i want to know if there is any trick or hack to j-query Drag-able plugin,
so that on-drag event i want to update left and top position with unit mm
not PX for example
<div id="text" style="position:relative;top:22px;left:100px;">sample
text</div>
should change to
<div id="text" style="position:relative;top:22mm;left:100mm;">sample
text</div>
or how can i make a custom j-query plugin??to get this work
i want to know if there is any trick or hack to j-query Drag-able plugin,
so that on-drag event i want to update left and top position with unit mm
not PX for example
<div id="text" style="position:relative;top:22px;left:100px;">sample
text</div>
should change to
<div id="text" style="position:relative;top:22mm;left:100mm;">sample
text</div>
or how can i make a custom j-query plugin??to get this work
How can I reorganize the way the thumbnails display of this page?
How can I reorganize the way the thumbnails display of this page?
Here is the link of the page: http://www.web-design-talk.co.uk/examples/5/
What I want is similar to the page from the link above. But instead of the
thumb nails display on the bottom of the bigger image, I want them to be
display on the right side (where the whole paragraph of
writing/description is located) and switch the whole paragraph of writing
to the bottom of the bigger image where the thumbnails are located.
Could someone show me how I can reorganize this page please. Thank you
very much!
Here is the link of the page: http://www.web-design-talk.co.uk/examples/5/
What I want is similar to the page from the link above. But instead of the
thumb nails display on the bottom of the bigger image, I want them to be
display on the right side (where the whole paragraph of
writing/description is located) and switch the whole paragraph of writing
to the bottom of the bigger image where the thumbnails are located.
Could someone show me how I can reorganize this page please. Thank you
very much!
Friday, 23 August 2013
How to retrive date and time from database and create notification on that particular date
How to retrive date and time from database and create notification on that
particular date
I want to create Reminder.I am using below code to generate notification
at a particular time and date set by the user.
public class MainActivity extends Activity {
TimePicker timePicker;
DatePicker datePicker;
Button button1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
timePicker = (TimePicker) findViewById(R.id.timePicker1);
datePicker = (DatePicker) findViewById(R.id.datePicker1);
AlarmManager alarmManager = (AlarmManager)
getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, datePicker.getYear());
calendar.set(Calendar.MONTH, datePicker.getMonth());
calendar.set(Calendar.DAY_OF_MONTH,
datePicker.getDayOfMonth());
calendar.set(Calendar.HOUR_OF_DAY,
timePicker.getCurrentHour());
calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute());
calendar.set(Calendar.SECOND, 0);
Intent inn = new
Intent(MainActivity.this,AlaramDetail.class);
PendingIntent displayIntent = PendingIntent.getActivity(
getBaseContext(), 0,inn, 0);
alarmManager.set(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(), displayIntent);
}
});
}
}
Below is AlaramDetail class that have code for genrating notification.
public class AlaramDetail extends Activity {
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.detail);
NotificationManager nm =
(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new
Notification(android.R.drawable.stat_notify_more, "This is important
notification",System.currentTimeMillis());
String title = "pay attention";
String detail = "this is implortant";
Intent intent = new Intent(AlaramDetail.this,AlaramDetail.class);
finish();
PendingIntent pintent = PendingIntent.getActivity(AlaramDetail.this,
0,intent ,0 );
notification.setLatestEventInfo(AlaramDetail.this, title, detail,
pintent);
notification.flags=Notification.FLAG_AUTO_CANCEL;
notification.defaults|=Notification.DEFAULT_SOUND;
notification.defaults|=Notification.DEFAULT_LIGHTS;
notification.defaults|=Notification.DEFAULT_VIBRATE;
nm.notify(1, notification);
}
}
above code is working correctly. After doing this I have created a
database that store multiple date and time inputted by the user.database
store date and time as string.now i want to generate notification at
particular date and time stored in database.I dont know how to pass date
and time from database to calendar.set(int field,int value) commands.I
think i can use cursor for retrieving date and time but i dont know what
value to pass in where and where args.My database has three columns
name,date,time.
particular date
I want to create Reminder.I am using below code to generate notification
at a particular time and date set by the user.
public class MainActivity extends Activity {
TimePicker timePicker;
DatePicker datePicker;
Button button1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
timePicker = (TimePicker) findViewById(R.id.timePicker1);
datePicker = (DatePicker) findViewById(R.id.datePicker1);
AlarmManager alarmManager = (AlarmManager)
getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, datePicker.getYear());
calendar.set(Calendar.MONTH, datePicker.getMonth());
calendar.set(Calendar.DAY_OF_MONTH,
datePicker.getDayOfMonth());
calendar.set(Calendar.HOUR_OF_DAY,
timePicker.getCurrentHour());
calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute());
calendar.set(Calendar.SECOND, 0);
Intent inn = new
Intent(MainActivity.this,AlaramDetail.class);
PendingIntent displayIntent = PendingIntent.getActivity(
getBaseContext(), 0,inn, 0);
alarmManager.set(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(), displayIntent);
}
});
}
}
Below is AlaramDetail class that have code for genrating notification.
public class AlaramDetail extends Activity {
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.detail);
NotificationManager nm =
(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new
Notification(android.R.drawable.stat_notify_more, "This is important
notification",System.currentTimeMillis());
String title = "pay attention";
String detail = "this is implortant";
Intent intent = new Intent(AlaramDetail.this,AlaramDetail.class);
finish();
PendingIntent pintent = PendingIntent.getActivity(AlaramDetail.this,
0,intent ,0 );
notification.setLatestEventInfo(AlaramDetail.this, title, detail,
pintent);
notification.flags=Notification.FLAG_AUTO_CANCEL;
notification.defaults|=Notification.DEFAULT_SOUND;
notification.defaults|=Notification.DEFAULT_LIGHTS;
notification.defaults|=Notification.DEFAULT_VIBRATE;
nm.notify(1, notification);
}
}
above code is working correctly. After doing this I have created a
database that store multiple date and time inputted by the user.database
store date and time as string.now i want to generate notification at
particular date and time stored in database.I dont know how to pass date
and time from database to calendar.set(int field,int value) commands.I
think i can use cursor for retrieving date and time but i dont know what
value to pass in where and where args.My database has three columns
name,date,time.
FOSRestBundle force one route in format html
FOSRestBundle force one route in format html
It is possible to make sure that only a single route is made available
only in html format?
In the configuration I set html and json, but for only one route I would
like the json was not used.
Can you do?
It is possible to make sure that only a single route is made available
only in html format?
In the configuration I set html and json, but for only one route I would
like the json was not used.
Can you do?
Using Excel 2007, Marking a cell if another cell contains data from a list
Using Excel 2007, Marking a cell if another cell contains data from a list
I am working on a spreadsheet and I need to have a way to mark items that
have been recently ordered. Each row is an item in inventory. I have a
separate list of item numbers that have been recently ordered and need a
function that will look to see if the item number for each row (column A)
is also present in my list (Column A on another sheet, "Recent POs") and
flag those rows accordingly, perhaps by returning a message such as
(recently ordered). I've tried a handful of things and am struggling. This
seems like it should be easy. Any thoughts? Thanks.
I am working on a spreadsheet and I need to have a way to mark items that
have been recently ordered. Each row is an item in inventory. I have a
separate list of item numbers that have been recently ordered and need a
function that will look to see if the item number for each row (column A)
is also present in my list (Column A on another sheet, "Recent POs") and
flag those rows accordingly, perhaps by returning a message such as
(recently ordered). I've tried a handful of things and am struggling. This
seems like it should be easy. Any thoughts? Thanks.
concat group a SELECT in another SELECT
concat group a SELECT in another SELECT
Simple question:
There are 2 tables:
Genre [name,song.id]
Songs [id,title,userID,status]
What is the query to get a result from
+----+-------------+----------------------+--------+--------+
| id | genre.name | song.title | userID | status |
+----+-------------+----------------------+--------+--------+
| 1 | tech | Feel it all | 1 | 1 |
| 2 | tech | Tester | 1 | 1 |
| 3 | music | Sejujurnya | 1 | 1 |
| 4 | music | Not Done | 1 | 1 |
| 5 | life | Cinta | 1 | 1 |
| 6 | life | Feel it all | 1 | 1 |
| 7 | life | Not Done | 1 | 1 |
| 8 | truth | Tester | 1 | 1 |
| 9 | tree | Tester | 1 | 1 |
| 10 | climb | Tester | 1 | 1 |
+----+-------------+----------------------+--------+--------+
to
+----+-------------+---------------------------------+--------+--------+
| id | genre.name | song.title | userID | status |
+----+-------------+---------------------------------+--------+--------+
| 1 | tech | Feel it all,Tester | 1 | 1 |
| 2 | music | Sejujurnya, Not Done | 1 | 1 |
| 3 | life | Cinta, Feel it all, Note Done | 1 | 1 |
| 4 | gloom | Feel it aallll | 1 | 1 |
| 5 | buka | Feel it aallll | 1 | 1 |
| 11 | truth | Tester | 1 | 1 |
| 12 | tree | Tester | 1 | 1 |
| 13 | climb | Tester | 1 | 1 |
+----+-------------+---------------------------------+--------+--------+
Thanks
Simple question:
There are 2 tables:
Genre [name,song.id]
Songs [id,title,userID,status]
What is the query to get a result from
+----+-------------+----------------------+--------+--------+
| id | genre.name | song.title | userID | status |
+----+-------------+----------------------+--------+--------+
| 1 | tech | Feel it all | 1 | 1 |
| 2 | tech | Tester | 1 | 1 |
| 3 | music | Sejujurnya | 1 | 1 |
| 4 | music | Not Done | 1 | 1 |
| 5 | life | Cinta | 1 | 1 |
| 6 | life | Feel it all | 1 | 1 |
| 7 | life | Not Done | 1 | 1 |
| 8 | truth | Tester | 1 | 1 |
| 9 | tree | Tester | 1 | 1 |
| 10 | climb | Tester | 1 | 1 |
+----+-------------+----------------------+--------+--------+
to
+----+-------------+---------------------------------+--------+--------+
| id | genre.name | song.title | userID | status |
+----+-------------+---------------------------------+--------+--------+
| 1 | tech | Feel it all,Tester | 1 | 1 |
| 2 | music | Sejujurnya, Not Done | 1 | 1 |
| 3 | life | Cinta, Feel it all, Note Done | 1 | 1 |
| 4 | gloom | Feel it aallll | 1 | 1 |
| 5 | buka | Feel it aallll | 1 | 1 |
| 11 | truth | Tester | 1 | 1 |
| 12 | tree | Tester | 1 | 1 |
| 13 | climb | Tester | 1 | 1 |
+----+-------------+---------------------------------+--------+--------+
Thanks
Why does CORS apply on localhost when using 'lvh.me'?
Why does CORS apply on localhost when using 'lvh.me'?
I was having an issue with CORS in my Rails App and my JS front-end app,
before I used rack-cors (https://github.com/cyu/rack-cors).
The JS front-end app will be a subdomain of my Rails app. So I should not
be having this issue in production. However on local, I am running my
front-end app on a server with:
python -m SimpleHTTPServer
I then access it via http://dashboard.lvh.me:8000. All calls are made to
the backend rails app to api.lvh.me:3000.
When doing requests without handling CORS, I get a CORS error. Why am I
getting a CORS error when both are on the same subdomain (lvh.me)? This
happened in all browsers.
Why do I need to use rack-cors? Will this also happen in production? Right
now, I am just running rails s. When using nginx, will this go away when
both are on the same domain, but different subdomains?
I was having an issue with CORS in my Rails App and my JS front-end app,
before I used rack-cors (https://github.com/cyu/rack-cors).
The JS front-end app will be a subdomain of my Rails app. So I should not
be having this issue in production. However on local, I am running my
front-end app on a server with:
python -m SimpleHTTPServer
I then access it via http://dashboard.lvh.me:8000. All calls are made to
the backend rails app to api.lvh.me:3000.
When doing requests without handling CORS, I get a CORS error. Why am I
getting a CORS error when both are on the same subdomain (lvh.me)? This
happened in all browsers.
Why do I need to use rack-cors? Will this also happen in production? Right
now, I am just running rails s. When using nginx, will this go away when
both are on the same domain, but different subdomains?
video data serialization/desetialization
video data serialization/desetialization
To create a WriteableBitmap from a stream I can use the
PictureDecoder.DecodeJpeg helper method like shown below.
protected override BitmapSource CreateBitmapSource()
{
BitmapSource source = null;
if (ImageBytes != null)
{
using (var stream = new MemoryStream(ImageBytes))
{
source = PictureDecoder.DecodeJpeg(stream);
}
}
return source;
}
my question is how can i create WriteableBitmap from a video data stream.
for windows phone 8 app in C#
To create a WriteableBitmap from a stream I can use the
PictureDecoder.DecodeJpeg helper method like shown below.
protected override BitmapSource CreateBitmapSource()
{
BitmapSource source = null;
if (ImageBytes != null)
{
using (var stream = new MemoryStream(ImageBytes))
{
source = PictureDecoder.DecodeJpeg(stream);
}
}
return source;
}
my question is how can i create WriteableBitmap from a video data stream.
for windows phone 8 app in C#
Thursday, 22 August 2013
How to setup default application to run fules with some extension (zsh to fish)
How to setup default application to run fules with some extension (zsh to
fish)
In zsh there is:
alias -s exe=mono
How to make it in fish?
fish)
In zsh there is:
alias -s exe=mono
How to make it in fish?
Watch Free Big Brother (US) Season 15, Episode 25 Online Episode #25 - Live Eviction #9 & 4 Jury members play for a chance to return to the...
Watch Free Big Brother (US) Season 15, Episode 25 Online Episode #25 -
Live Eviction #9 & 4 Jury members play for a chance to return to the...
Big Brother is a reality game show franchise created by John de
Mol....Contestants must compete against each other for a chance to win
$500,000 in a house wired with cameras and microphones, capturing their
every move for a TV and Internet audience.Big Brother 15 is the fifteenth
season of the American reality television series Big Brother.
download Big Brother (US) Season 15, Episode 25 zshare streaming Big
Brother (US) Video Youtube dailymotion Episode #25 - Live Eviction #9 & 4
Jury members play for a chance to return to the House, Online watch Video
Big Brother (US) Season 15, Episode 16,Big Brother (US) Season 15, Episode
25 Youtube Free live stream Online VIDEO, watch on 22nd August 2013New
Episode "Episode #25 - Live Eviction #9 & 4 Jury members play for a chance
to return to the House" For Free, Big Brother (US) Trailer and Preview,
Big Brother (US) Cast Crew Pictures and Wallpapers,Online watch Big
Brother (US) Video Free,Big Brother (US) Season 15, Episode 25 on Preview
for 22nd August 2013, watch Big Brother (US) CBS Network Video online
Free, Big Brother (US) Series Download Free Online Tv Live Streaming.Big
Brother (US) Season 15, Episode 25 free online full stream video hd
quality,watch Big Brother (US)s s15e25 megashare.
Watch Live here->http://goo.gl/D5nwi8
Main Cast And Crew Stars: Spencer, Elissa, David, Helen, Jeremy and
Amanda, Andy, Howard, Kaitlin, Judd, McCrae and GinaMarie, Candice, Aaryn,
Nick and Jessie Created by: John de Mol Episode Air Date: Thursday 22nd
August 2013 8:00 PM on CBS Network Release date: 5 July 2000 (USA) Genre:
Game-Show, Reality-TV Runtime: 44 min Production Co: Evolution Film &
Tape, Arnold Shapiro Productions, Columbia Broadcasting System (CBS)
Country: USA Language: English Release Date: 5 July 2000 (USA) Also Known
As: Big Brother 10 Filming Locations: CBS Studio Center - 4024 Radford
Avenue, Studio City, Los Angeles, California, USA Episode Summary:
The Power of Veto competition is held.
Watch Live here->http://goo.gl/D5nwi8
Season Genl Info: The season premiered on CBS on June 26, 2013 and will
conclude in September 18, 2013 the same year.It has been billed as the
longest season to date, and is going to last for a total of 90 days. This
season is also set to feature sixteen House Guests, tying it for the most
HouseGuests to compete in a single season. Unlike the previous two
seasons, all of the competing HouseGuests are new to the series.The
premise of the series remained largely unchanged from previous editions of
the series, in which a group of contestants, known as "HouseGuests,"
compete to win the series by voting each other off and being the last
HouseGuest remaining. One HouseGuest, known as the Head of Household, must
nominate two of their fellow HouseGuests for eviction. The winner of the
Power of Veto can remove one of the nominees from the block, forcing the
HoH to nominate another HouseGuest. The HouseGuests then vote to evict one
of the nominees, and the HouseGuest with the most votes is evicted. When
only two HouseGuests remained, the last seven evicted HouseGuests, known
as the Jury of Seven, would decide which of them would win the $500,000
prize. A HouseGuest can be expelled from the show for breaking rules, such
as engaging in violent and disruptive behavior.....The idea for Big
Brother is said to have come during a brainstorming session at the
Dutch-based international television production firm Endemol on March 10,
1997. The first version of Big Brother was broadcast in 1999 on Veronica
in the Netherlands. Since then the format has become a worldwide TV
franchise, airing in many countries in a number of versions....Big Brother
(US) Season 15, Episode 25 "Episode #25 - Live Eviction #9 & 4 Jury
members play for a chance to return to the House" and Enjoy The Big
Show....
Live Eviction #9 & 4 Jury members play for a chance to return to the...
Big Brother is a reality game show franchise created by John de
Mol....Contestants must compete against each other for a chance to win
$500,000 in a house wired with cameras and microphones, capturing their
every move for a TV and Internet audience.Big Brother 15 is the fifteenth
season of the American reality television series Big Brother.
download Big Brother (US) Season 15, Episode 25 zshare streaming Big
Brother (US) Video Youtube dailymotion Episode #25 - Live Eviction #9 & 4
Jury members play for a chance to return to the House, Online watch Video
Big Brother (US) Season 15, Episode 16,Big Brother (US) Season 15, Episode
25 Youtube Free live stream Online VIDEO, watch on 22nd August 2013New
Episode "Episode #25 - Live Eviction #9 & 4 Jury members play for a chance
to return to the House" For Free, Big Brother (US) Trailer and Preview,
Big Brother (US) Cast Crew Pictures and Wallpapers,Online watch Big
Brother (US) Video Free,Big Brother (US) Season 15, Episode 25 on Preview
for 22nd August 2013, watch Big Brother (US) CBS Network Video online
Free, Big Brother (US) Series Download Free Online Tv Live Streaming.Big
Brother (US) Season 15, Episode 25 free online full stream video hd
quality,watch Big Brother (US)s s15e25 megashare.
Watch Live here->http://goo.gl/D5nwi8
Main Cast And Crew Stars: Spencer, Elissa, David, Helen, Jeremy and
Amanda, Andy, Howard, Kaitlin, Judd, McCrae and GinaMarie, Candice, Aaryn,
Nick and Jessie Created by: John de Mol Episode Air Date: Thursday 22nd
August 2013 8:00 PM on CBS Network Release date: 5 July 2000 (USA) Genre:
Game-Show, Reality-TV Runtime: 44 min Production Co: Evolution Film &
Tape, Arnold Shapiro Productions, Columbia Broadcasting System (CBS)
Country: USA Language: English Release Date: 5 July 2000 (USA) Also Known
As: Big Brother 10 Filming Locations: CBS Studio Center - 4024 Radford
Avenue, Studio City, Los Angeles, California, USA Episode Summary:
The Power of Veto competition is held.
Watch Live here->http://goo.gl/D5nwi8
Season Genl Info: The season premiered on CBS on June 26, 2013 and will
conclude in September 18, 2013 the same year.It has been billed as the
longest season to date, and is going to last for a total of 90 days. This
season is also set to feature sixteen House Guests, tying it for the most
HouseGuests to compete in a single season. Unlike the previous two
seasons, all of the competing HouseGuests are new to the series.The
premise of the series remained largely unchanged from previous editions of
the series, in which a group of contestants, known as "HouseGuests,"
compete to win the series by voting each other off and being the last
HouseGuest remaining. One HouseGuest, known as the Head of Household, must
nominate two of their fellow HouseGuests for eviction. The winner of the
Power of Veto can remove one of the nominees from the block, forcing the
HoH to nominate another HouseGuest. The HouseGuests then vote to evict one
of the nominees, and the HouseGuest with the most votes is evicted. When
only two HouseGuests remained, the last seven evicted HouseGuests, known
as the Jury of Seven, would decide which of them would win the $500,000
prize. A HouseGuest can be expelled from the show for breaking rules, such
as engaging in violent and disruptive behavior.....The idea for Big
Brother is said to have come during a brainstorming session at the
Dutch-based international television production firm Endemol on March 10,
1997. The first version of Big Brother was broadcast in 1999 on Veronica
in the Netherlands. Since then the format has become a worldwide TV
franchise, airing in many countries in a number of versions....Big Brother
(US) Season 15, Episode 25 "Episode #25 - Live Eviction #9 & 4 Jury
members play for a chance to return to the House" and Enjoy The Big
Show....
Windows Phone 8 timezone localization
Windows Phone 8 timezone localization
Example (Windows Phone 8 - changing languages)
Sending a time zone of "Pacific Standard Time" back to my web service and
calling the method below works fine.
var TimeZone TimeZoneInfo.FindSystemTimeZoneById(timeZone);
Changing the phone language to Spanish and sending back "Hora estandar,
Pacifico" which is the same time zone in Spanish fails.
TimeZoneInfo for Windows Phone does not seem to provide access to the
English version of the time zone when the language is set to Spanish.
Example (Windows Phone 8 - changing languages)
Sending a time zone of "Pacific Standard Time" back to my web service and
calling the method below works fine.
var TimeZone TimeZoneInfo.FindSystemTimeZoneById(timeZone);
Changing the phone language to Spanish and sending back "Hora estandar,
Pacifico" which is the same time zone in Spanish fails.
TimeZoneInfo for Windows Phone does not seem to provide access to the
English version of the time zone when the language is set to Spanish.
show specific file from the directory in php
show specific file from the directory in php
How can I show a specific file from the directory which name is known to
me? I have this code to show all files present in that directory:
$result = mysql_query("SELECT * FROM photos");
while($row = mysql_fetch_array($result))
{
echo '<div id="imagelist">';
echo '<p><img src="'.$row['location'].'"></p>';
echo '<p id="name">'.$row['caption'].' </p>';
echo '</div>';
}
Photos table has 3 columns id, location, caption.
How can I show a specific file from the directory which name is known to
me? I have this code to show all files present in that directory:
$result = mysql_query("SELECT * FROM photos");
while($row = mysql_fetch_array($result))
{
echo '<div id="imagelist">';
echo '<p><img src="'.$row['location'].'"></p>';
echo '<p id="name">'.$row['caption'].' </p>';
echo '</div>';
}
Photos table has 3 columns id, location, caption.
Is it a good practice not to use Qt Designer and write all the code?
Is it a good practice not to use Qt Designer and write all the code?
I am new to Qt. I am still learning the basics. I found that I can do a
lot of stuff in the designer instead of writing the code. So is it a
better practice to use the designer or write all the code from A to Z ?
I am new to Qt. I am still learning the basics. I found that I can do a
lot of stuff in the designer instead of writing the code. So is it a
better practice to use the designer or write all the code from A to Z ?
How does the keyboard-event trigger a sibling button's click event? (jsfiddle inside)
How does the keyboard-event trigger a sibling button's click event?
(jsfiddle inside)
The setup in question can be tested and altered here:
http://jsfiddle.net/5hAQ8/9/
I have a small form (basically just an input field with a clear-button).
The JavaScript is trivial and just illustrates the problem. Basically it's
three listeners on input(keyup), button(click/tap) and form(submit). The
HTML is very simple:
<form>
<input>
<button>X</button>
</form>
The X is intended to clear the field, but that's not the point. When
someone presses [enter], even while the input is in focus, the button will
get triggered. You may test this yourself in the linked jsfiddle above.
Once you press [enter] inside the form, you will see three alerts: one for
the input, one for the button, one for the form. I can't understand why
the button and the form would be involved at all?
My understanding of DOM events would have been a keyboard-event
originating from the input, bubbling up to document. But i took every
measure to cancel that event. So my question is threefold:
why does the event get to the <button> at all?
why does the button trigger its listener (which is on click and tap) even
though the event is a keyup?
why don't the preventDefaults / stopPropagations kick in.
(jsfiddle inside)
The setup in question can be tested and altered here:
http://jsfiddle.net/5hAQ8/9/
I have a small form (basically just an input field with a clear-button).
The JavaScript is trivial and just illustrates the problem. Basically it's
three listeners on input(keyup), button(click/tap) and form(submit). The
HTML is very simple:
<form>
<input>
<button>X</button>
</form>
The X is intended to clear the field, but that's not the point. When
someone presses [enter], even while the input is in focus, the button will
get triggered. You may test this yourself in the linked jsfiddle above.
Once you press [enter] inside the form, you will see three alerts: one for
the input, one for the button, one for the form. I can't understand why
the button and the form would be involved at all?
My understanding of DOM events would have been a keyboard-event
originating from the input, bubbling up to document. But i took every
measure to cancel that event. So my question is threefold:
why does the event get to the <button> at all?
why does the button trigger its listener (which is on click and tap) even
though the event is a keyup?
why don't the preventDefaults / stopPropagations kick in.
How to validate if an entry exists, and if not, add it?
How to validate if an entry exists, and if not, add it?
Please see my code below. I'd like to validate if an entry exists and if
not, add it. How can I do that?
private void btnAdd_Click(object sender, EventArgs e)
{
string conString =
"SERVER=localhost;DATABASE=restosystem;UID=root;PASSWORD=qwerty;";
MySqlConnection conn = new MySqlConnection(conString);
MySqlConnection con = new MySqlConnection(conString);
try
{
MySqlCommand command1 = new MySqlCommand("Select * from
tblcategories where CategName = '" + txtCategName.Text + "'",
conn);
conn.Open();
MySqlDataReader DR1 = command1.ExecuteReader();
if (DR1.Read())
{
MessageBox.Show("Category Already Exist!", "Add Category",
MessageBoxButtons.OK, MessageBoxIcon.Information);
txtCategName.Text = "";
}
else
{
MySqlCommand command = new MySqlCommand("Insert into
tblcategories(CategID,CategName) VALUES ('"+ txtCatID.Text
+"','" + txtCategName.Text + "')", conn);
conn.Open();
command.ExecuteNonQuery();
MessageBox.Show(" Successfully Added", "Add Category",
MessageBoxButtons.OK, MessageBoxIcon.Information);
lvCateg.Items.Clear();
CreateID();
categlist();
txtCategName.Text = "";
}
conn.Close();
}
catch (Exception error)
{
MessageBox.Show(error.Message);
}
}
Please see my code below. I'd like to validate if an entry exists and if
not, add it. How can I do that?
private void btnAdd_Click(object sender, EventArgs e)
{
string conString =
"SERVER=localhost;DATABASE=restosystem;UID=root;PASSWORD=qwerty;";
MySqlConnection conn = new MySqlConnection(conString);
MySqlConnection con = new MySqlConnection(conString);
try
{
MySqlCommand command1 = new MySqlCommand("Select * from
tblcategories where CategName = '" + txtCategName.Text + "'",
conn);
conn.Open();
MySqlDataReader DR1 = command1.ExecuteReader();
if (DR1.Read())
{
MessageBox.Show("Category Already Exist!", "Add Category",
MessageBoxButtons.OK, MessageBoxIcon.Information);
txtCategName.Text = "";
}
else
{
MySqlCommand command = new MySqlCommand("Insert into
tblcategories(CategID,CategName) VALUES ('"+ txtCatID.Text
+"','" + txtCategName.Text + "')", conn);
conn.Open();
command.ExecuteNonQuery();
MessageBox.Show(" Successfully Added", "Add Category",
MessageBoxButtons.OK, MessageBoxIcon.Information);
lvCateg.Items.Clear();
CreateID();
categlist();
txtCategName.Text = "";
}
conn.Close();
}
catch (Exception error)
{
MessageBox.Show(error.Message);
}
}
Wednesday, 21 August 2013
Fatal error: Uncaught Aws\Glacier\Exception\GlacierException: AWS Error Code: , Status Code: 400, AWS Request
Fatal error: Uncaught Aws\Glacier\Exception\GlacierException: AWS Error
Code: , Status Code: 400, AWS Request
I've been trying to upload image through the SDK but i get this error:
Fatal error: Uncaught Aws\Glacier\Exception\GlacierException: AWS Error
Code: , Status Code: 400, AWS Request ID: , AWS Error Type: client, AWS
Error Message: , User-Agent: aws-sdk-php2/2.4.3 Guzzle/3.7.2 curl/7.15.5
PHP/5.3.8 thrown in
/www/site/test/Aws/Common/Exception/NamespaceExceptionFactory.php on line
91
And this is my test code:
Code: , Status Code: 400, AWS Request
I've been trying to upload image through the SDK but i get this error:
Fatal error: Uncaught Aws\Glacier\Exception\GlacierException: AWS Error
Code: , Status Code: 400, AWS Request ID: , AWS Error Type: client, AWS
Error Message: , User-Agent: aws-sdk-php2/2.4.3 Guzzle/3.7.2 curl/7.15.5
PHP/5.3.8 thrown in
/www/site/test/Aws/Common/Exception/NamespaceExceptionFactory.php on line
91
And this is my test code:
API's or ways to build screen sharing in side web app
API's or ways to build screen sharing in side web app
I tried researching out there and found some API's that provide screen
sharing such as
Screen Leap
Screen Hero
I found opentok does video/chatting pretty well.
However, I am trying to see if there are any tools that does the following
as one SDK or API or anything.
Video
Chatting
Screen Sharing
Programming Language is not a barrier.
Thank you
I tried researching out there and found some API's that provide screen
sharing such as
Screen Leap
Screen Hero
I found opentok does video/chatting pretty well.
However, I am trying to see if there are any tools that does the following
as one SDK or API or anything.
Video
Chatting
Screen Sharing
Programming Language is not a barrier.
Thank you
get data from database table to other database table php mysql
get data from database table to other database table php mysql
I want to get user name from a database table from his id and put it in
other data table
function upload_image($image_temp, $image_ext, $album_id, $image_n,
$image_description) {
$album_id = (int)$album_id;
$image_n = mysql_real_escape_string(htmlentities($image_n));
$image_description =
mysql_real_escape_string(htmlentities($image_description));
//$download_link = 'uploads/'. $album_id. '/'. $image['id']. '.'. $image_ext;
$mysql_date_now = date("Y-m-d (H:i:s)");
$user_name = mysql_query("SELECT `name` FROM `users` WHERE `user_id` =
".$_SESSION['user_id']);
mysql_query("INSERT INTO `images` VALUES ('',
'".$_SESSION['user_id']."','$user_name', '$album_id', UNIX_TIMESTAMP(),
'$image_ext', '$image_n', '$image_description', '','$mysql_date_now')");
$image_id = mysql_insert_id();
$download_link = 'uploads/'. $album_id. '/'. $image_id. '.'. $image_ext;
mysql_query("UPDATE `images` SET `download_link`='$download_link' WHERE
`image_id`=$image_id ");
$selection = mysql_query("SELECT `user_two` FROM `follow` WHERE
`user_one`='".$_SESSION['user_id']."'");
while ($row = mysql_fetch_array($selection)) {
mysql_query("INSERT INTO `notification` VALUES ('',
'".$_SESSION['user_id']."', '".$row['user_two']."', '', UNIX_TIMESTAMP(),
'$image_n', '$image_description', '$download_link')");
}
$image_file = $image_id.'.'.$image_ext;
move_uploaded_file($image_temp, 'uploads/'.$album_id.'/'.$image_file);
Thumbnail('uploads/'.$album_id.'/', $image_file,
'uploads/thumbs/'.$album_id.'/');
}
the problem is here
$user_name = mysql_query("SELECT `name` FROM `users` WHERE `user_id` =
".$_SESSION['user_id']);
mysql_query("INSERT INTO `images` VALUES ('',
'".$_SESSION['user_id']."','$user_name', '$album_id', UNIX_TIMESTAMP(),
'$image_ext', '$image_n', '$image_description', '','$mysql_date_now')");
i get this in database (Resource id #14)
I want to get user name from a database table from his id and put it in
other data table
function upload_image($image_temp, $image_ext, $album_id, $image_n,
$image_description) {
$album_id = (int)$album_id;
$image_n = mysql_real_escape_string(htmlentities($image_n));
$image_description =
mysql_real_escape_string(htmlentities($image_description));
//$download_link = 'uploads/'. $album_id. '/'. $image['id']. '.'. $image_ext;
$mysql_date_now = date("Y-m-d (H:i:s)");
$user_name = mysql_query("SELECT `name` FROM `users` WHERE `user_id` =
".$_SESSION['user_id']);
mysql_query("INSERT INTO `images` VALUES ('',
'".$_SESSION['user_id']."','$user_name', '$album_id', UNIX_TIMESTAMP(),
'$image_ext', '$image_n', '$image_description', '','$mysql_date_now')");
$image_id = mysql_insert_id();
$download_link = 'uploads/'. $album_id. '/'. $image_id. '.'. $image_ext;
mysql_query("UPDATE `images` SET `download_link`='$download_link' WHERE
`image_id`=$image_id ");
$selection = mysql_query("SELECT `user_two` FROM `follow` WHERE
`user_one`='".$_SESSION['user_id']."'");
while ($row = mysql_fetch_array($selection)) {
mysql_query("INSERT INTO `notification` VALUES ('',
'".$_SESSION['user_id']."', '".$row['user_two']."', '', UNIX_TIMESTAMP(),
'$image_n', '$image_description', '$download_link')");
}
$image_file = $image_id.'.'.$image_ext;
move_uploaded_file($image_temp, 'uploads/'.$album_id.'/'.$image_file);
Thumbnail('uploads/'.$album_id.'/', $image_file,
'uploads/thumbs/'.$album_id.'/');
}
the problem is here
$user_name = mysql_query("SELECT `name` FROM `users` WHERE `user_id` =
".$_SESSION['user_id']);
mysql_query("INSERT INTO `images` VALUES ('',
'".$_SESSION['user_id']."','$user_name', '$album_id', UNIX_TIMESTAMP(),
'$image_ext', '$image_n', '$image_description', '','$mysql_date_now')");
i get this in database (Resource id #14)
excel macro to combine B column cells based on A Column
excel macro to combine B column cells based on A Column
I am trying to use a macro from another related question (Excel Macro -
Rows to Comma Separated Cells (Preserve/Aggregate Column)) and am getting
a Runtime Error 1004.
When trying to debug, it says that this line is the problem:
oCell.Offset(-1, 1).Value = sResult
Here is the macro:
Sub GroupMyValues()
Dim oCell As Excel.Range
Dim sKey As String
Dim sResult As String
Set oCell = Worksheets(2).Range("A1")
While Len(oCell.Value) > 0
If oCell.Value <> sKey Then
'If first entry, no rows to be deleted
If sKey <> "" Then
oCell.Offset(-1, 1).Value = sResult
End If
sKey = oCell.Value
sResult = oCell.Offset(0, 1).Value
Set oCell = oCell.Offset(1, 0)
Else
sResult = sResult & ", " & oCell.Offset(0, 1).Value
Set oCell = oCell.Offset(1, 0)
oCell.Offset(-1, 0).EntireRow.Delete
End If
Wend
'Last iteration
**oCell.Offset(-1, 1).Value = sResult**
End Sub
I am trying to use a macro from another related question (Excel Macro -
Rows to Comma Separated Cells (Preserve/Aggregate Column)) and am getting
a Runtime Error 1004.
When trying to debug, it says that this line is the problem:
oCell.Offset(-1, 1).Value = sResult
Here is the macro:
Sub GroupMyValues()
Dim oCell As Excel.Range
Dim sKey As String
Dim sResult As String
Set oCell = Worksheets(2).Range("A1")
While Len(oCell.Value) > 0
If oCell.Value <> sKey Then
'If first entry, no rows to be deleted
If sKey <> "" Then
oCell.Offset(-1, 1).Value = sResult
End If
sKey = oCell.Value
sResult = oCell.Offset(0, 1).Value
Set oCell = oCell.Offset(1, 0)
Else
sResult = sResult & ", " & oCell.Offset(0, 1).Value
Set oCell = oCell.Offset(1, 0)
oCell.Offset(-1, 0).EntireRow.Delete
End If
Wend
'Last iteration
**oCell.Offset(-1, 1).Value = sResult**
End Sub
Weak classical Deontic Logics
Weak classical Deontic Logics
I am writing a paper at the moment and an area of Deontic Logic has
cropped up in it. I know very little about the area and I was wondering if
people could give me opinions on the axiomatic system that I want to use
to for my paper.
I want to keep the system as weak as possible so as to avoid things like
the Good Samaritan paradox or Chisholm's Paradox, so I want to keep my
logic strictly classical, ie. no stronger than the base system $K$. After
doing some searching on the internet, I got the impression that anything
weaker than $K$ isn't really worth stuying because you no longer use
Kripke Semantics but instead use something more along the line of Rudolf
Carnap's definition for necessitation "$\Box P$ is true iff $P$ is true in
all possible worlds". I also got the impression that Carnap's definition
was somewhat flawed but I couldn't find out why. Is this true? I'd be
greatly appreciative if someone could shed light on this and if/why
Carnap's definition is indeed flawed.
The system of axioms that I want to use is:
$\Diamond = \neg \Box \neg$
$\Box A \rightarrow A$
$A \rightarrow \Diamond A$
If anybody knows of any existing material on this system that would be
great. Also, if people have any other comments on the selection of the
above axioms that'd be great too. The axioms are for designing rule
systems so I need the logic to contain rules for "must do then do" and "if
do then it is allowed". Thanks!
I am writing a paper at the moment and an area of Deontic Logic has
cropped up in it. I know very little about the area and I was wondering if
people could give me opinions on the axiomatic system that I want to use
to for my paper.
I want to keep the system as weak as possible so as to avoid things like
the Good Samaritan paradox or Chisholm's Paradox, so I want to keep my
logic strictly classical, ie. no stronger than the base system $K$. After
doing some searching on the internet, I got the impression that anything
weaker than $K$ isn't really worth stuying because you no longer use
Kripke Semantics but instead use something more along the line of Rudolf
Carnap's definition for necessitation "$\Box P$ is true iff $P$ is true in
all possible worlds". I also got the impression that Carnap's definition
was somewhat flawed but I couldn't find out why. Is this true? I'd be
greatly appreciative if someone could shed light on this and if/why
Carnap's definition is indeed flawed.
The system of axioms that I want to use is:
$\Diamond = \neg \Box \neg$
$\Box A \rightarrow A$
$A \rightarrow \Diamond A$
If anybody knows of any existing material on this system that would be
great. Also, if people have any other comments on the selection of the
above axioms that'd be great too. The axioms are for designing rule
systems so I need the logic to contain rules for "must do then do" and "if
do then it is allowed". Thanks!
Simple batchscript breaks when drag&drop a file with an underscore in its filename
Simple batchscript breaks when drag&drop a file with an underscore in its
filename
I have this simple batchscript...
@ECHO OFF
:batch
IF "%~1"=="" GOTO end
ECHO video=FFVideoSource("%~f1")>"%~f1.avs"
ECHO audio=BassAudioSource("%~f1")>>"%~f1.avs"
ECHO AudioDub(video,audio.TimeStretch(pitch=432.0/4.4))>>"%~f1.avs"
SHIFT
GOTO batch
:end
which when executed from command prompt works fine in all cases, but
breaks when I drag&drop a file with an underscore in its filename. Several
avs-files are created. I've found them in %~1 its parent directory and
even in "C:\Documents and Settings\Admin".
Does anyone know why an underscore would be an issue for drag&drop?
I'm on WinXP, that doesn't have anything to do with it, does it?
filename
I have this simple batchscript...
@ECHO OFF
:batch
IF "%~1"=="" GOTO end
ECHO video=FFVideoSource("%~f1")>"%~f1.avs"
ECHO audio=BassAudioSource("%~f1")>>"%~f1.avs"
ECHO AudioDub(video,audio.TimeStretch(pitch=432.0/4.4))>>"%~f1.avs"
SHIFT
GOTO batch
:end
which when executed from command prompt works fine in all cases, but
breaks when I drag&drop a file with an underscore in its filename. Several
avs-files are created. I've found them in %~1 its parent directory and
even in "C:\Documents and Settings\Admin".
Does anyone know why an underscore would be an issue for drag&drop?
I'm on WinXP, that doesn't have anything to do with it, does it?
SSl for a Ruby Website
SSl for a Ruby Website
How to install a SSl certificate for a Ruby website where in the same
Linux web server PHP blog is running?
Both the primary website(Ruby) "www.example.com" and Blog(php)
blog.example.com are running on port 80. We use two network cards and two
IPs for both the application to run on port 80.
Please Suggest.
How to install a SSl certificate for a Ruby website where in the same
Linux web server PHP blog is running?
Both the primary website(Ruby) "www.example.com" and Blog(php)
blog.example.com are running on port 80. We use two network cards and two
IPs for both the application to run on port 80.
Please Suggest.
Tuesday, 20 August 2013
Warning C4090: different '__unaligned' qualifiers when using std::unique_ptr
Warning C4090: different '__unaligned' qualifiers when using std::unique_ptr
This code:
bool CShell::moveItemsToTrash(std::vector<std::wstring> items)
{
auto ILFreeDeallocator = [](ITEMIDLIST * p) { ILFree(p); };
typedef std::unique_ptr<ITEMIDLIST, decltype(ILFreeDeallocator)>
CItemIdLIstPtr;
std::vector<CItemIdLIstPtr> idLists;
for (auto& path: items)
{
idLists.emplace_back(CItemIdLIstPtr(ILCreateFromPath(path.c_str()),
ILFreeDeallocator));
}
return true;
}
results in C4090: different '__unaligned' qualifiers on the line where
pointer is created and added to a vector. Why is that and what does this
mean? Should I be concerned?
This code:
bool CShell::moveItemsToTrash(std::vector<std::wstring> items)
{
auto ILFreeDeallocator = [](ITEMIDLIST * p) { ILFree(p); };
typedef std::unique_ptr<ITEMIDLIST, decltype(ILFreeDeallocator)>
CItemIdLIstPtr;
std::vector<CItemIdLIstPtr> idLists;
for (auto& path: items)
{
idLists.emplace_back(CItemIdLIstPtr(ILCreateFromPath(path.c_str()),
ILFreeDeallocator));
}
return true;
}
results in C4090: different '__unaligned' qualifiers on the line where
pointer is created and added to a vector. Why is that and what does this
mean? Should I be concerned?
ASP.Net 2.0 Web App localized resource loading issue
ASP.Net 2.0 Web App localized resource loading issue
We have ASP.Net 2.0 web application which uses localized resources using
App_LocalResources and App_GlobalResources. The web application is built
using MSBuild and after deployment to server seems to only have
projectname.resources.dll files created under appropriate culture folder
and doesn't copy above mentioned folders to the deployed location.
With that all the pages work fine and displays the text per current
culture, but few of the user controls fail to load. Based on some search I
found that "<%$ Resources: ..." syntax on the .ascx or .aspx files will
only read the content from the .resx file physically placed in
App_LocalResources and App_GlobalResources folders and won't work with
satellite assembly. I am using the same syntax on all the controls which
are not getting loaded. Other pages work fine. Also I am getting
"System.HttpParseException" for resources not being found which are
referenced using above syntax only. After copying the .resx files all the
pages are working fine.
Is there any documentation which explains this well?
We have ASP.Net 2.0 web application which uses localized resources using
App_LocalResources and App_GlobalResources. The web application is built
using MSBuild and after deployment to server seems to only have
projectname.resources.dll files created under appropriate culture folder
and doesn't copy above mentioned folders to the deployed location.
With that all the pages work fine and displays the text per current
culture, but few of the user controls fail to load. Based on some search I
found that "<%$ Resources: ..." syntax on the .ascx or .aspx files will
only read the content from the .resx file physically placed in
App_LocalResources and App_GlobalResources folders and won't work with
satellite assembly. I am using the same syntax on all the controls which
are not getting loaded. Other pages work fine. Also I am getting
"System.HttpParseException" for resources not being found which are
referenced using above syntax only. After copying the .resx files all the
pages are working fine.
Is there any documentation which explains this well?
spring mvc news portal with content management
spring mvc news portal with content management
I am looking for a kickstarter java based solution to host a website
having news and career info for our company(with CMS capabilities to
create new NEWS items in an admin section). Is there read made solution
application available in Java webframework. I'd love to stick with open
source solutions like Spring MVC/Web with MySQL. But the programming
language has to be Java.
Thanks, CP
I am looking for a kickstarter java based solution to host a website
having news and career info for our company(with CMS capabilities to
create new NEWS items in an admin section). Is there read made solution
application available in Java webframework. I'd love to stick with open
source solutions like Spring MVC/Web with MySQL. But the programming
language has to be Java.
Thanks, CP
Link to no framed HTML in jsBin or jsFiddle
Link to no framed HTML in jsBin or jsFiddle
Is there a way in jsBin or jsFiddle to get a link to the page you created
as is, without being embed inside a frame? If not, is there such service
(something that would let me quickly create an HTML page and see it live
with one click)?
Is there a way in jsBin or jsFiddle to get a link to the page you created
as is, without being embed inside a frame? If not, is there such service
(something that would let me quickly create an HTML page and see it live
with one click)?
Help Dual Booting Windows 8 and Ubuntu 12.04
Help Dual Booting Windows 8 and Ubuntu 12.04
I am experiencing difficulties to dual boot y HP laptop. I have installed
Windows 8 and Ubuntu 12.04 by allocating free memory to Ubuntu. Now I
cannot boot to Ubuntu. Upon startup, Ubuntu is unable to boot and i am
straight away booted into Windows 8. I tried EasyBCD, but it did not work.
I have also tried Boot Repair and got the following result:
http://paste.ubuntu.com/6006294/ Please help as i am unable to boot to
ubuntu. I have a genuine windows 8, so want to enjoy Ubuntu alongside
Windows.
I am experiencing difficulties to dual boot y HP laptop. I have installed
Windows 8 and Ubuntu 12.04 by allocating free memory to Ubuntu. Now I
cannot boot to Ubuntu. Upon startup, Ubuntu is unable to boot and i am
straight away booted into Windows 8. I tried EasyBCD, but it did not work.
I have also tried Boot Repair and got the following result:
http://paste.ubuntu.com/6006294/ Please help as i am unable to boot to
ubuntu. I have a genuine windows 8, so want to enjoy Ubuntu alongside
Windows.
Can foreach loop contain value as an object?
Can foreach loop contain value as an object?
foreach ($result as $key => $value) {
}
In this can the $value be an object like the following given below , where
10 is the key and other is value
[10] => stdClass Object
(
[nid] => 80
[type] => create_an_account
)
Is this valid ??
foreach ($result as $key => $value) {
}
In this can the $value be an object like the following given below , where
10 is the key and other is value
[10] => stdClass Object
(
[nid] => 80
[type] => create_an_account
)
Is this valid ??
Does Windows modify a non-primary HDD without explicit user command
Does Windows modify a non-primary HDD without explicit user command
My Western Digital MyBook Essential external HDD crashed recently and I'm
trying to recover my data from it.
Thinking that the HDD enclosure is simply a USB/SATA converter, I tried
connecting the internal HDD directly to my PC through a SATA port.
However, this didn't work and the Windows Disk Management tool only
recognized the drive as "unallocated space".
I'm concerned that my action could have allowed Windows to modify my HDD
in an unrecoverable way, e.g. low-level operation to MBR, etc.
My Western Digital MyBook Essential external HDD crashed recently and I'm
trying to recover my data from it.
Thinking that the HDD enclosure is simply a USB/SATA converter, I tried
connecting the internal HDD directly to my PC through a SATA port.
However, this didn't work and the Windows Disk Management tool only
recognized the drive as "unallocated space".
I'm concerned that my action could have allowed Windows to modify my HDD
in an unrecoverable way, e.g. low-level operation to MBR, etc.
Monday, 19 August 2013
Split Java String
Split Java String
Title seems to be simple. But I don't get a good Idea. This is the situation
I have String like this in my Java program
String scz="3282E81WHT-22/24";
I want to split the above string into 3 Strings, such that first string
value should be 3282e81, next string should be WHT(ie, the String part of
above string), next String value should be 22/24
In short
String first= /* do some expression on scz / And value should be
"3282e81"; String second= / do some expression on scz / And value should
be "WHT"; String third= / do some expression on scz */ And value should be
"22/24";
How to solve this?
Title seems to be simple. But I don't get a good Idea. This is the situation
I have String like this in my Java program
String scz="3282E81WHT-22/24";
I want to split the above string into 3 Strings, such that first string
value should be 3282e81, next string should be WHT(ie, the String part of
above string), next String value should be 22/24
In short
String first= /* do some expression on scz / And value should be
"3282e81"; String second= / do some expression on scz / And value should
be "WHT"; String third= / do some expression on scz */ And value should be
"22/24";
How to solve this?
HTML Shrinking and expanding table cells
HTML Shrinking and expanding table cells
is it possible to tell a table cell it should shrink so it uses as less
space as possible and on the other hand tell specific other cells to
automatically expand to fill the remaining space?
is it possible to tell a table cell it should shrink so it uses as less
space as possible and on the other hand tell specific other cells to
automatically expand to fill the remaining space?
CSS left text, centered image in table
CSS left text, centered image in table
I'm pretty new to CSS and cannot figure out how to accomplish the
following. I have tabular data. Some of the data elements have images
associated with them. I want text in the cell left justified and I want
the images in the same cell centered.
In other words, I want the same result as the following except inside a
table cell.
<p>Some text.</p>
<img style="display:block;margin-left:auto;margin-right:auto;"
src="myimage.jpg"/>
How can I accomplish this? I haven't found this specific question so far
on StackOverflow.
I'm pretty new to CSS and cannot figure out how to accomplish the
following. I have tabular data. Some of the data elements have images
associated with them. I want text in the cell left justified and I want
the images in the same cell centered.
In other words, I want the same result as the following except inside a
table cell.
<p>Some text.</p>
<img style="display:block;margin-left:auto;margin-right:auto;"
src="myimage.jpg"/>
How can I accomplish this? I haven't found this specific question so far
on StackOverflow.
Copy failing drive in order to retrieve files?
Copy failing drive in order to retrieve files?
I have an NTFS hard drive with a dynamic partition, which I believe is on
the verge of failure (multiple spin-up retries, drive disappears from "My
Computer" in Windows). I have ordered a 1TB drive to replace it, but don't
dare connect the failing drive in case it goes kaput. All the really
important data is backed up, obviously, however it would be convenient if
I could retrieve the medium-importance data on it (which is not backed
up), and copy it to the new drive once it arrives.
I was first considering using rsync to do this, but then I realised that
the NTFS drive is not mountable in Linux due to it being dynamic.
So what are my options? Is it possible to run
dd if=/dev/sda of=/mnt/newdrive/disk.img
Then somehow (how?) mount disk.img and copy the files back?
Or is there a better method? Note that I do not want to make a simple
clone from one drive to the other (for multiple reasons, one being that
the new drive is twice the size of the old).
Thanks very much,
Fela
I have an NTFS hard drive with a dynamic partition, which I believe is on
the verge of failure (multiple spin-up retries, drive disappears from "My
Computer" in Windows). I have ordered a 1TB drive to replace it, but don't
dare connect the failing drive in case it goes kaput. All the really
important data is backed up, obviously, however it would be convenient if
I could retrieve the medium-importance data on it (which is not backed
up), and copy it to the new drive once it arrives.
I was first considering using rsync to do this, but then I realised that
the NTFS drive is not mountable in Linux due to it being dynamic.
So what are my options? Is it possible to run
dd if=/dev/sda of=/mnt/newdrive/disk.img
Then somehow (how?) mount disk.img and copy the files back?
Or is there a better method? Note that I do not want to make a simple
clone from one drive to the other (for multiple reasons, one being that
the new drive is twice the size of the old).
Thanks very much,
Fela
Signing onto Shoprite Wifi causes Google to lock my account
Signing onto Shoprite Wifi causes Google to lock my account
Shoprite is a chain of grocery stores in the Northeast. They now have a
special iOS app where you can scan your own groceries as you shop. When
you leave, you simply pay for what was already scanned and skip the
checkout line.
In order to use the app, you must be logged into the Shoprite WiFi
network. However, every time I do that, I get an immediate notification
from Google that says
Google Account xxxxxx Suspicious login detected. See google.com/blocked
The link goes to a webpage that says:
We blocked an application from signing in to your account
We recently denied a sign-in attempt from an application (like an email or
chat client) or a mobile device because we weren't sure it was really you.
To prevent unauthorized access to your account, Google notifies you via
email and/or SMS when we notice this type of suspicious sign-in attempt.
After that, my Gmail account is locked, and I have to request a text
message to unlock it.
This is really strange since my Shoprite account doesn't have anything to
do with my Google account. I have seen absolutely nothing on the Internet
about this, and neither Google or Shoprite seem able to tell me exactly
what is going on.
I have no idea why this is happening, and I thought maybe someone here can
explain it to me. There are two explanations I can think of:
Shoprite is attempting to access my Google account. They're a pretty big
public company, and I can't imagine them surreptitiously doing something
like this.
My iPhone is attempting to access my Gmail while on Shoprite's WiFi, but
why would that matter to Google? I've connected to other WiFi networks
around (Amtrak, Starbucks, Cablevision, etc.) and Google doesn't care
about those. Besides, the app that's accessing my Gmail account would be
my iPhone's Mail.app which has been setup to do just that.
Any ideas what is going on?
Shoprite is a chain of grocery stores in the Northeast. They now have a
special iOS app where you can scan your own groceries as you shop. When
you leave, you simply pay for what was already scanned and skip the
checkout line.
In order to use the app, you must be logged into the Shoprite WiFi
network. However, every time I do that, I get an immediate notification
from Google that says
Google Account xxxxxx Suspicious login detected. See google.com/blocked
The link goes to a webpage that says:
We blocked an application from signing in to your account
We recently denied a sign-in attempt from an application (like an email or
chat client) or a mobile device because we weren't sure it was really you.
To prevent unauthorized access to your account, Google notifies you via
email and/or SMS when we notice this type of suspicious sign-in attempt.
After that, my Gmail account is locked, and I have to request a text
message to unlock it.
This is really strange since my Shoprite account doesn't have anything to
do with my Google account. I have seen absolutely nothing on the Internet
about this, and neither Google or Shoprite seem able to tell me exactly
what is going on.
I have no idea why this is happening, and I thought maybe someone here can
explain it to me. There are two explanations I can think of:
Shoprite is attempting to access my Google account. They're a pretty big
public company, and I can't imagine them surreptitiously doing something
like this.
My iPhone is attempting to access my Gmail while on Shoprite's WiFi, but
why would that matter to Google? I've connected to other WiFi networks
around (Amtrak, Starbucks, Cablevision, etc.) and Google doesn't care
about those. Besides, the app that's accessing my Gmail account would be
my iPhone's Mail.app which has been setup to do just that.
Any ideas what is going on?
Sunday, 18 August 2013
Report Delivery Smsmanger in android
Report Delivery Smsmanger in android
I am new in android,I try to write sms manager and i want to receive
delivery report. I use following code to receive that:
context.registerReceiver(broadcast,new IntentFilter(DELIVERED +" "+
id+" "+milis+" "+date));
i use this code that unique every report to me and in broadcast receiver i
write following code:
switch (getResultCode()) {
case Activity.RESULT_OK:
// deliver
// / update table where contactid == id && date == d &&
// milis ==
// m values delivery = 1
break;
case Activity.RESULT_CANCELED:
// failed
break;
}
but didnt working. whats the problem in my code and how can solve that?thanks
I am new in android,I try to write sms manager and i want to receive
delivery report. I use following code to receive that:
context.registerReceiver(broadcast,new IntentFilter(DELIVERED +" "+
id+" "+milis+" "+date));
i use this code that unique every report to me and in broadcast receiver i
write following code:
switch (getResultCode()) {
case Activity.RESULT_OK:
// deliver
// / update table where contactid == id && date == d &&
// milis ==
// m values delivery = 1
break;
case Activity.RESULT_CANCELED:
// failed
break;
}
but didnt working. whats the problem in my code and how can solve that?thanks
OpenSSL Libraries with Quagga
OpenSSL Libraries with Quagga
pWe are looking to work with openSSL libraries within Quagga Open Source
routing engine. However looking at the installation of openSSL I have, I
can't see any .c files at all. Just a whole lot of .h files in
/usr/include/openssl./p pAlso - I can't seem to find any information about
what functions are required to 'build up' an TLS/SSL connection. I'm
unsure on what functions to use. We are looking to implement Self-Signed
certificates as it's out of scope to implement a CA for proper
ceritificate authentication. This is just a proof of concept at this
stage./p pAny advice about this would be appreciated./p pRegards,/p pSarah
/p
pWe are looking to work with openSSL libraries within Quagga Open Source
routing engine. However looking at the installation of openSSL I have, I
can't see any .c files at all. Just a whole lot of .h files in
/usr/include/openssl./p pAlso - I can't seem to find any information about
what functions are required to 'build up' an TLS/SSL connection. I'm
unsure on what functions to use. We are looking to implement Self-Signed
certificates as it's out of scope to implement a CA for proper
ceritificate authentication. This is just a proof of concept at this
stage./p pAny advice about this would be appreciated./p pRegards,/p pSarah
/p
Would like to create a variable in ASP to change a value
Would like to create a variable in ASP to change a value
So I have a piece of code within the header of my ASP
<% divrec = request.QueryString("div")%>
Which pulls sting info
In the body of my ASP code I have the following tag
<% =divrec %>
Which outputs as "Division 1" The problem is I would like to query against
the variable <% =divrec > using SQL in my ASP code but the column name in
my SQL table is "DIV1". Is there a way that I can change <% =divrec %> to
equal "DIV1" instead of "Division 1"
So I have a piece of code within the header of my ASP
<% divrec = request.QueryString("div")%>
Which pulls sting info
In the body of my ASP code I have the following tag
<% =divrec %>
Which outputs as "Division 1" The problem is I would like to query against
the variable <% =divrec > using SQL in my ASP code but the column name in
my SQL table is "DIV1". Is there a way that I can change <% =divrec %> to
equal "DIV1" instead of "Division 1"
How get file path from property file and pass into the method as arguments
How get file path from property file and pass into the method as arguments
In Property file :
**FolderPath**=C:\\pre-configured/Import.csv
In Main class im passing this path as argument for a method load
Properties pro = new Properties();
new CSV().load(con,"**pro.FolderPath**", "VALIDATION");
but it is giving error as "pro.getProperty(FolderPath) (The system cannot
find the file specified.)" . Please help in passing this path into the
method as argument ?
In Property file :
**FolderPath**=C:\\pre-configured/Import.csv
In Main class im passing this path as argument for a method load
Properties pro = new Properties();
new CSV().load(con,"**pro.FolderPath**", "VALIDATION");
but it is giving error as "pro.getProperty(FolderPath) (The system cannot
find the file specified.)" . Please help in passing this path into the
method as argument ?
laravel 4 - double routes on same controller funcioton
laravel 4 - double routes on same controller funcioton
I want to do something I don't know if it is feasible.
here's my routes.php
Route::get('mockups/user/skills/{skill}', 'MockupsController@user');
Route::get('mockups/user/tours/{tour}', 'MockupsController@user');
Route::get('mockups/user', 'MockupsController@user');
and my MockupsController@user function
public function user($skill=null,$tour=null){
if($tour ==null && $skill != null)
return View::make('demo/mockups/user/public',array('skill'=>$skill));
if($tour!=null && $skill ==null)
return View::make('demo/mockups/user/public',array('tour'=>$tour));
return View::make('demo/mockups/user/public');
}
if I get the /mockups/user/tours/tour1 url, the controller calls the
demo/mockups/user/public view without sending the $tour variable. how to
make it works?
I want to do something I don't know if it is feasible.
here's my routes.php
Route::get('mockups/user/skills/{skill}', 'MockupsController@user');
Route::get('mockups/user/tours/{tour}', 'MockupsController@user');
Route::get('mockups/user', 'MockupsController@user');
and my MockupsController@user function
public function user($skill=null,$tour=null){
if($tour ==null && $skill != null)
return View::make('demo/mockups/user/public',array('skill'=>$skill));
if($tour!=null && $skill ==null)
return View::make('demo/mockups/user/public',array('tour'=>$tour));
return View::make('demo/mockups/user/public');
}
if I get the /mockups/user/tours/tour1 url, the controller calls the
demo/mockups/user/public view without sending the $tour variable. how to
make it works?
How to Prevent EF5 LocalDB Connection From Closing
How to Prevent EF5 LocalDB Connection From Closing
I've built an applciation using EF5 and CodeFirst. At runtime my
application creates a LocalDB databse file and a class-level instance of a
DataContext. Everything works fine however inserts are slow after about
50,000 records (approx 20MB MDF file). In debug I can see the internal
Connection's state is set to 'Closed'. I assume EF5 is closing the
connection after each insert and then re-opening it when needed.
How can I prevent Entity Framework from closing the connection? This is a
local that will potentially need to import up to 500k records in the
shortest period of time.
I've built an applciation using EF5 and CodeFirst. At runtime my
application creates a LocalDB databse file and a class-level instance of a
DataContext. Everything works fine however inserts are slow after about
50,000 records (approx 20MB MDF file). In debug I can see the internal
Connection's state is set to 'Closed'. I assume EF5 is closing the
connection after each insert and then re-opening it when needed.
How can I prevent Entity Framework from closing the connection? This is a
local that will potentially need to import up to 500k records in the
shortest period of time.
CSS: Chrome adding unnecessary margin in HTML form input
CSS: Chrome adding unnecessary margin in HTML form input
Google Chrome adds an extra top-margin in HTML form input field..
I think an example is better than description, so I'll add a JSFiddle link:
http://jsfiddle.net/jakeaustin5574/7VeGH/
You can see that the Text Input field has an extra top-margin, while the
submit button doesn't
(I added yellow div background to simply to illustrate this).
However, this does not happen in FireFox. (I haven't checked other browsers)
As you can see, I added the following CSS style, yet the margin still
appears.
* {
margin: 0px;
padding: 0px;
}
I guess this has something to do with Chrome's default styling.
How do I remove this margin?
Thanks
Google Chrome adds an extra top-margin in HTML form input field..
I think an example is better than description, so I'll add a JSFiddle link:
http://jsfiddle.net/jakeaustin5574/7VeGH/
You can see that the Text Input field has an extra top-margin, while the
submit button doesn't
(I added yellow div background to simply to illustrate this).
However, this does not happen in FireFox. (I haven't checked other browsers)
As you can see, I added the following CSS style, yet the margin still
appears.
* {
margin: 0px;
padding: 0px;
}
I guess this has something to do with Chrome's default styling.
How do I remove this margin?
Thanks
Saturday, 17 August 2013
Xcode Parse Issue Expected ']'
Xcode Parse Issue Expected ']'
I don know Why i keep receiving this error, any help would be appreciated.
locationManager didUpdateToLocation FromLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
NSLog(@"%@", newLocation);
self.speedView.text = [[NSString stringWithFormat:@"%d", (speedCount)
I Receive the error on this line [newLocation speed]];
}
I don know Why i keep receiving this error, any help would be appreciated.
locationManager didUpdateToLocation FromLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
NSLog(@"%@", newLocation);
self.speedView.text = [[NSString stringWithFormat:@"%d", (speedCount)
I Receive the error on this line [newLocation speed]];
}
How to make extendible ArrayList?
How to make extendible ArrayList?
At the moment I'm working on a game and things are going pretty good. What
keeps me busy at the moment, is making a mob spawner which spawns mobs in
a certain area.
The big problem is right now, I'm not really sure how to keep track of all
the mobs being spawned by the spawner, as there are different inheritances
of mobs.
This is my MobSpawner class:
public class MobSpawner {
protected List<Mob> mobs;
protected Level level;
protected int timer = 0;
protected int spawnTime = 0;
protected int maxMobs = 0;
public MobSpawner(Level level) {
this.level = level;
}
}
And this is my RoachSpawner class:
public class RoachSpawner extends MobSpawner {
public RoachSpawner(Level level) {
super(level);
mobs = new ArrayList<Roach>();
}
}
This is not gonna work because the List and ArrayList must be of the same
type.
So the question is, does anyone have any other ideas how to do this?
Thanks in advance!
At the moment I'm working on a game and things are going pretty good. What
keeps me busy at the moment, is making a mob spawner which spawns mobs in
a certain area.
The big problem is right now, I'm not really sure how to keep track of all
the mobs being spawned by the spawner, as there are different inheritances
of mobs.
This is my MobSpawner class:
public class MobSpawner {
protected List<Mob> mobs;
protected Level level;
protected int timer = 0;
protected int spawnTime = 0;
protected int maxMobs = 0;
public MobSpawner(Level level) {
this.level = level;
}
}
And this is my RoachSpawner class:
public class RoachSpawner extends MobSpawner {
public RoachSpawner(Level level) {
super(level);
mobs = new ArrayList<Roach>();
}
}
This is not gonna work because the List and ArrayList must be of the same
type.
So the question is, does anyone have any other ideas how to do this?
Thanks in advance!
Python: running process in the background with ability to kill them
Python: running process in the background with ability to kill them
I need to constantly load a number of data feeds. The data feeds can take
20-30 seconds to load. I know what feeds to load by checking a MySQL
database every hour.
I could have up to 20 feeds to load at the same time. It's important that
non of the feeds block each other as I need to refresh them constantly.
When I no longer need to load the feeds the database that I'm reading gets
updated and I thus need to stop loading the feed which I would like to do
from my main program so I don't need multiple connections to the db.
I'm aware that I could probably do this using this using threading,
subprocess or gevents. I wanted to ask if any of these would be best.
Thanks
I need to constantly load a number of data feeds. The data feeds can take
20-30 seconds to load. I know what feeds to load by checking a MySQL
database every hour.
I could have up to 20 feeds to load at the same time. It's important that
non of the feeds block each other as I need to refresh them constantly.
When I no longer need to load the feeds the database that I'm reading gets
updated and I thus need to stop loading the feed which I would like to do
from my main program so I don't need multiple connections to the db.
I'm aware that I could probably do this using this using threading,
subprocess or gevents. I wanted to ask if any of these would be best.
Thanks
JSF - Getting NullPointerException in constructor when accessing getFacade()
JSF - Getting NullPointerException in constructor when accessing getFacade()
this code produces NullPointerException. I don't know why. When I put the
code from constructor to some other void with @PostConstruct - it works. I
tried to initiate klientFacade - but it's not working, either.
package view;
import entity.Klient;
import facade.KlientFacade;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import static util.Messages.addFlashMessage;
@ManagedBean
@ViewScoped
public class ManageClient implements Serializable {
@EJB
private KlientFacade klientFacade;
private List<Klient> clientList;
public List<Klient> returnClientList(){
return getKlientFacade().findAll();
}
public ManageClient() {
clientList = new ArrayList<>();
clientList = returnClientList();
}
public String removeClient(Klient klient){
addFlashMessage("Klient ["+klient.getLogin()+"] zosta³ usuniêty.");
getKlientFacade().remove(klient);
return "manage";
}
public List<Klient> getClientList() {
return clientList;
}
public void setClientList(List<Klient> clientList) {
this.clientList = clientList;
}
public KlientFacade getKlientFacade() {
return klientFacade;
}
public void setKlientFacade(KlientFacade klientFacade) {
this.klientFacade = klientFacade;
}
}
this code produces NullPointerException. I don't know why. When I put the
code from constructor to some other void with @PostConstruct - it works. I
tried to initiate klientFacade - but it's not working, either.
package view;
import entity.Klient;
import facade.KlientFacade;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import static util.Messages.addFlashMessage;
@ManagedBean
@ViewScoped
public class ManageClient implements Serializable {
@EJB
private KlientFacade klientFacade;
private List<Klient> clientList;
public List<Klient> returnClientList(){
return getKlientFacade().findAll();
}
public ManageClient() {
clientList = new ArrayList<>();
clientList = returnClientList();
}
public String removeClient(Klient klient){
addFlashMessage("Klient ["+klient.getLogin()+"] zosta³ usuniêty.");
getKlientFacade().remove(klient);
return "manage";
}
public List<Klient> getClientList() {
return clientList;
}
public void setClientList(List<Klient> clientList) {
this.clientList = clientList;
}
public KlientFacade getKlientFacade() {
return klientFacade;
}
public void setKlientFacade(KlientFacade klientFacade) {
this.klientFacade = klientFacade;
}
}
How do I unskew background image in skewed layer (CSS)?
How do I unskew background image in skewed layer (CSS)?
I'm trying to display a profile photo like this / - / (the slashes
represent slants using skewX, the hyphen represents a horizontally-aligned
background image).
The problem is that this code also skews the background image:
.photo {
transform: skewX(35deg);
-ms-transform: skewX(35deg); /* IE 9 */
-webkit-transform: skewX(35deg); /* Safari and Chrome */
width: 100px;
height: 92px;
border-right: 1px solid black;
border-left: 1px solid black;
background-image: url('silhouette.png');
background-repeat: no-repeat;
background-position: top left;
}
...
<div class="photo"></div>
I've tried to reverse the background skew like this:
.photo {
transform: skewX(35deg);
-ms-transform: skewX(35deg); /* IE 9 */
-webkit-transform: skewX(35deg); /* Safari and Chrome */
width: 100px;
height: 92px;
border-right: 1px solid black;
border-left: 1px solid black;
}
.photo div {
transform: skewX(-35deg);
-ms-transform: skewX(-35deg); /* IE 9 */
-webkit-transform: skewX(-35deg); /* Safari and Chrome */
width: 100%;
height: 100%;
background-image: url('silhouette.png');
background-repeat: no-repeat;
background-position: top left;
}
...
<div class="photo"><div></div></div>
...but I get / [-] / (the background doesn't fit flush to the slants).
I've been at this all day, please can you help me? I've got coder's bock!
I'm trying to display a profile photo like this / - / (the slashes
represent slants using skewX, the hyphen represents a horizontally-aligned
background image).
The problem is that this code also skews the background image:
.photo {
transform: skewX(35deg);
-ms-transform: skewX(35deg); /* IE 9 */
-webkit-transform: skewX(35deg); /* Safari and Chrome */
width: 100px;
height: 92px;
border-right: 1px solid black;
border-left: 1px solid black;
background-image: url('silhouette.png');
background-repeat: no-repeat;
background-position: top left;
}
...
<div class="photo"></div>
I've tried to reverse the background skew like this:
.photo {
transform: skewX(35deg);
-ms-transform: skewX(35deg); /* IE 9 */
-webkit-transform: skewX(35deg); /* Safari and Chrome */
width: 100px;
height: 92px;
border-right: 1px solid black;
border-left: 1px solid black;
}
.photo div {
transform: skewX(-35deg);
-ms-transform: skewX(-35deg); /* IE 9 */
-webkit-transform: skewX(-35deg); /* Safari and Chrome */
width: 100%;
height: 100%;
background-image: url('silhouette.png');
background-repeat: no-repeat;
background-position: top left;
}
...
<div class="photo"><div></div></div>
...but I get / [-] / (the background doesn't fit flush to the slants).
I've been at this all day, please can you help me? I've got coder's bock!
Removing apps from 'Mobile Applications' that aren't in iTunes?
Removing apps from 'Mobile Applications' that aren't in iTunes?
I'm running iTunes on Windows 7, and at some point (or rather, at multiple
points) I must have accidentally pressed the 'Cancel' button when it asks
if I want to remove the app from my hard drive when deleting it in iTunes
The net result is that I have 503 apps in iTunes, and 598 apps in my
'Mobile Applications' folder.
Is there anyway I can tidy these up? ie some way within iTunes that will
clear the Mobile Applications folder of any apps that aren't in my iTunes
liberary?
Thanks
I'm running iTunes on Windows 7, and at some point (or rather, at multiple
points) I must have accidentally pressed the 'Cancel' button when it asks
if I want to remove the app from my hard drive when deleting it in iTunes
The net result is that I have 503 apps in iTunes, and 598 apps in my
'Mobile Applications' folder.
Is there anyway I can tidy these up? ie some way within iTunes that will
clear the Mobile Applications folder of any apps that aren't in my iTunes
liberary?
Thanks
How do i get the context of a sentence?
How do i get the context of a sentence?
There is a questionnaire that we use to evaluate the student knowledge
level ( We do this manualy, as in a test paper ). It consist of the
following parts:
Multiple choice
Comprehension Questions ( i.e: Is a spider an insect? )
Now i have given a task to make an Expert System that will automate this.
So basically we have a proper answer for this. But my problem is the
Comprehension Questions. I need to compare the context of their answer to
the context of the correct answer.
I already initially search for the answer but it seems like it's really a
big task to do. What i have search so far is i can do this through NLP
which is really new to me. Also it seems like that i have to find a
dictionary of all words that is possible for the examiner to answer. This
is if i'm not mistaken.
Q: am i on the right track? If no please suggest of what should i do (
study what? ) or give me some links to the materials that i need. And also
should i make my own dictionary because the word that i will be using is
Filipino Language
If my question is not clear please say so, so i can provide more
information and sorry for my bad english.
There is a questionnaire that we use to evaluate the student knowledge
level ( We do this manualy, as in a test paper ). It consist of the
following parts:
Multiple choice
Comprehension Questions ( i.e: Is a spider an insect? )
Now i have given a task to make an Expert System that will automate this.
So basically we have a proper answer for this. But my problem is the
Comprehension Questions. I need to compare the context of their answer to
the context of the correct answer.
I already initially search for the answer but it seems like it's really a
big task to do. What i have search so far is i can do this through NLP
which is really new to me. Also it seems like that i have to find a
dictionary of all words that is possible for the examiner to answer. This
is if i'm not mistaken.
Q: am i on the right track? If no please suggest of what should i do (
study what? ) or give me some links to the materials that i need. And also
should i make my own dictionary because the word that i will be using is
Filipino Language
If my question is not clear please say so, so i can provide more
information and sorry for my bad english.
Subscribe to:
Comments (Atom)