Journals that publish papers quickly
I have written two papers in Mathematics and want to get them published.
Can you suggest some journals that publish quickly? Besides, how can I
know if a journal is well-regarded or not? I know there's something called
an impact factor but what else? For example how is this journal? IJMRS -
http://www.ijmrs.org/
Monday, 30 September 2013
A puzzle related to three cars which leave a town and reach another.
A puzzle related to three cars which leave a town and reach another.
I'm trying to solve the following puzzle:
$C_1, C_2$ and $C_3$ are three cars that leave town $T_1$ and reach town
$T_2$.
For a car, say $C_k, k$ is considered to be the car number. The car number
and the order in which they depart or arrive is not the same. The first
car to leave $T_1$ is the third car to reach $T_2$.
And the questions are:
$1.$ Which car is the first to leave from $T_1$?
$2.$ Which car is the second to reach $T_2$?
I simply can't think of a way to solve this , The only important given is
that "The first car to leave $T_1$ is the third car to reach $T_2$" but
how can I possible find the order in which the cars left the town from
this ?
I'm trying to solve the following puzzle:
$C_1, C_2$ and $C_3$ are three cars that leave town $T_1$ and reach town
$T_2$.
For a car, say $C_k, k$ is considered to be the car number. The car number
and the order in which they depart or arrive is not the same. The first
car to leave $T_1$ is the third car to reach $T_2$.
And the questions are:
$1.$ Which car is the first to leave from $T_1$?
$2.$ Which car is the second to reach $T_2$?
I simply can't think of a way to solve this , The only important given is
that "The first car to leave $T_1$ is the third car to reach $T_2$" but
how can I possible find the order in which the cars left the town from
this ?
jQuery unbind events declared in scope
jQuery unbind events declared in scope
I've got some object that creates some event attached to document. They
are common events like mousemove, mousedown etc.
Then I want to make $(document).unbind('mousemove') and its ok but it may
crash some events created by end user of plugin or cause conflicts with
some external code.
Is it possible to remove all events declared inside some scope only?
Like:
$.fn.somePlugin = function() {
//here begins our scope
//declaring a lot of events
//some stuff
//remove events of this scope leaving other of same type untouched
}
Or is there any other way of managing groups of events?
I've got some object that creates some event attached to document. They
are common events like mousemove, mousedown etc.
Then I want to make $(document).unbind('mousemove') and its ok but it may
crash some events created by end user of plugin or cause conflicts with
some external code.
Is it possible to remove all events declared inside some scope only?
Like:
$.fn.somePlugin = function() {
//here begins our scope
//declaring a lot of events
//some stuff
//remove events of this scope leaving other of same type untouched
}
Or is there any other way of managing groups of events?
Vertex Texture Fetch always return 0
Vertex Texture Fetch always return 0
I'm developing a shader based terrain. Use VTF to fetch the height data in
vertex shader. My problem is when I sample heightmap in vertex shader the
returned value always is zero.
Texture2D texture;
SamplerState sampleType;
float height = texture.SampleLevel(sampleType, float4(input.tex, 0, 0), 0);
The texture loaded from BMP file (256x256x24bit) with
D3DX11CreateShaderResourceViewFromFile(device, heightmap, NULL, NULL,
&texture) function and passed to vertex shader with
deviceContext->PSSetShaderResources(0, 1, &texture). Feature level is
D3D_FEATURE_LEVEL_10_0 and shader profile is vs_4_0.
I'm developing a shader based terrain. Use VTF to fetch the height data in
vertex shader. My problem is when I sample heightmap in vertex shader the
returned value always is zero.
Texture2D texture;
SamplerState sampleType;
float height = texture.SampleLevel(sampleType, float4(input.tex, 0, 0), 0);
The texture loaded from BMP file (256x256x24bit) with
D3DX11CreateShaderResourceViewFromFile(device, heightmap, NULL, NULL,
&texture) function and passed to vertex shader with
deviceContext->PSSetShaderResources(0, 1, &texture). Feature level is
D3D_FEATURE_LEVEL_10_0 and shader profile is vs_4_0.
Sunday, 29 September 2013
Where can I put an included ExtendScript so it doesnt show on the menu?
Where can I put an included ExtendScript so it doesnt show on the menu?
I have a script for Photoshop (jsx) that includes a utility script (jsx).
I don't want the utility script to be directly invokable from the Scripts
menu.
Where can i put it (on OSX and Windows both) so that it can be included by
my visible script but not be visible itself on the menu?
I have a script for Photoshop (jsx) that includes a utility script (jsx).
I don't want the utility script to be directly invokable from the Scripts
menu.
Where can i put it (on OSX and Windows both) so that it can be included by
my visible script but not be visible itself on the menu?
C++ MFC Application CEdit::ShowBalloonTip problems
C++ MFC Application CEdit::ShowBalloonTip problems
I'm coding a dialog based application and I keep hitting roadblocks from
all directions.
The latest one is this:
I'm trying to use the CEdit's ShowBalloonTip() when the user types
something wrong in the the field. The problem is that the ShowBalloonTip()
method always returns false (not showing at all) except if I add
#ifdef UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='*' publicKeyToken='6595b64144ccf1df'
language='*'\"")
I'm coding a dialog based application and I keep hitting roadblocks from
all directions.
The latest one is this:
I'm trying to use the CEdit's ShowBalloonTip() when the user types
something wrong in the the field. The problem is that the ShowBalloonTip()
method always returns false (not showing at all) except if I add
#ifdef UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='*' publicKeyToken='6595b64144ccf1df'
language='*'\"")
What are the advantages of assigning a function to a variable in javascript?
What are the advantages of assigning a function to a variable in javascript?
In javascript recently I learned how to assign a function to a variable,
such as
Variable = function(){};
But how is that any better than calling the below
function Variable() {};
What are the advantages of the variable way of calling a function?
In javascript recently I learned how to assign a function to a variable,
such as
Variable = function(){};
But how is that any better than calling the below
function Variable() {};
What are the advantages of the variable way of calling a function?
Null pointer and the address that is null in c++ visual studio and gcc compiler
Null pointer and the address that is null in c++ visual studio and gcc
compiler
I have tried many tutorials and got more confused. So please teach this
noob with simplest answers. If possible then just stick to the
question......i am having information overload :)
first the main function
main(){
int y=0;
display(&y);
}
Now the function
int display(int* x){
//do something depending on different values of x
}
One of the case is following: "if no variable is pointed to, that is, if
the address of the variable is NULL, your function sets the value of the
variable pointed to zero."
Now my understanding in display function i need to do
if (x==NULL)
*x=0;
Now here is where I am getting stuck with...... - if i call the function
with display(NULL); I get following error in Visual "Unhandled exception
at 0x00C84036 in BTP 300 A1.exe: 0xC0000005: Access violation writing
location 0x00000000."
How do i store some value in y from a function if its address is null?
or the question is just wrong and it should have said value stored at the
address, to which pointer variable points, is null i.e y=Null ???
If int* z is a null pointer than what is the value of the address to which
z points to and what is the value that is stored in address that is
pointed???
thanks a lot guys in advance?
compiler
I have tried many tutorials and got more confused. So please teach this
noob with simplest answers. If possible then just stick to the
question......i am having information overload :)
first the main function
main(){
int y=0;
display(&y);
}
Now the function
int display(int* x){
//do something depending on different values of x
}
One of the case is following: "if no variable is pointed to, that is, if
the address of the variable is NULL, your function sets the value of the
variable pointed to zero."
Now my understanding in display function i need to do
if (x==NULL)
*x=0;
Now here is where I am getting stuck with...... - if i call the function
with display(NULL); I get following error in Visual "Unhandled exception
at 0x00C84036 in BTP 300 A1.exe: 0xC0000005: Access violation writing
location 0x00000000."
How do i store some value in y from a function if its address is null?
or the question is just wrong and it should have said value stored at the
address, to which pointer variable points, is null i.e y=Null ???
If int* z is a null pointer than what is the value of the address to which
z points to and what is the value that is stored in address that is
pointed???
thanks a lot guys in advance?
Saturday, 28 September 2013
Getting a please try again later in Paypal Embedded Payments
Getting a please try again later in Paypal Embedded Payments
Paypal embedded payments were working just fine on Instimage until they
were not.
Getting no error code and nothing in the console to help with debugging
the problem.
What could be the problem?
Paypal embedded payments were working just fine on Instimage until they
were not.
Getting no error code and nothing in the console to help with debugging
the problem.
What could be the problem?
Foreign Key in Django model
Foreign Key in Django model
Here is my situation. SubCategory has foreign key to topic and Topic has
foreign key to SubCategory.
class SubCategory(models.Model):
name = models.CharField(max_length=100)
slug = models.SlugField(max_length=110)
description = models.TextField(default='')
ordering = models.PositiveIntegerField(default=1)
category = models.ForeignKey(Category)
created_on = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User)
updated_on = models.DateTimeField(blank=True, null=True)
updated_by = models.ForeignKey(User, related_name='+')
num_topics = models.IntegerField(default=0)
num_posts = models.IntegerField(default=0)
last_topic = models.ForeignKey(Topic, related_name='+')
class Topic(models.Model):
name = models.CharField(max_length=300)
slug = models.SlugField(max_length=300)
description = models.TextField(default='')
subcategory = models.ForeignKey(SubCategory)
created_on = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User)
updated_on = models.DateTimeField(blank=True, null=True)
updated_by = models.ForeignKey(User, related_name='+')
When I run this code, it gives the following error
NameError: name 'Topic' is not defined.
Can anybody tell me how to fix it ?
Here is my situation. SubCategory has foreign key to topic and Topic has
foreign key to SubCategory.
class SubCategory(models.Model):
name = models.CharField(max_length=100)
slug = models.SlugField(max_length=110)
description = models.TextField(default='')
ordering = models.PositiveIntegerField(default=1)
category = models.ForeignKey(Category)
created_on = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User)
updated_on = models.DateTimeField(blank=True, null=True)
updated_by = models.ForeignKey(User, related_name='+')
num_topics = models.IntegerField(default=0)
num_posts = models.IntegerField(default=0)
last_topic = models.ForeignKey(Topic, related_name='+')
class Topic(models.Model):
name = models.CharField(max_length=300)
slug = models.SlugField(max_length=300)
description = models.TextField(default='')
subcategory = models.ForeignKey(SubCategory)
created_on = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User)
updated_on = models.DateTimeField(blank=True, null=True)
updated_by = models.ForeignKey(User, related_name='+')
When I run this code, it gives the following error
NameError: name 'Topic' is not defined.
Can anybody tell me how to fix it ?
How to match the colors in an image with colors in another image?
How to match the colors in an image with colors in another image?
I want to write a program that needs to swap two human faces in C#. But
the skin colors are not consistent. In Photoshop, I can use the command
"Match color" to match colors in the source image with colors in target
image. And the issue will be solved. How to do it in my source code? Or
what is algorithm Photoshop used?
I want to write a program that needs to swap two human faces in C#. But
the skin colors are not consistent. In Photoshop, I can use the command
"Match color" to match colors in the source image with colors in target
image. And the issue will be solved. How to do it in my source code? Or
what is algorithm Photoshop used?
IsNan() function considers certain kind of strings as number - node js
IsNan() function considers certain kind of strings as number - node js
I'm checking for integer values in node.js using IsNaN function.
Unexpectedly, this function validates the strings like 1E267146, 1E656716
, 914E6583 to be numbers, as these strings are exponential values. Any way
to work around this? Is there any other function to check for exact
integers?
I'm checking for integer values in node.js using IsNaN function.
Unexpectedly, this function validates the strings like 1E267146, 1E656716
, 914E6583 to be numbers, as these strings are exponential values. Any way
to work around this? Is there any other function to check for exact
integers?
Friday, 27 September 2013
MATLAB Wavelet Transform wavdec Returns Matrix of Wrong Size
MATLAB Wavelet Transform wavdec Returns Matrix of Wrong Size
Hello guys I need help with a question I have regarding the wavdec
anddwtfunctions in MATLAB. I am using wavdec(y,3,db4) on a size 1024
signal, which means I am trying to compute the third level db4 transform
of the size 1024 signal y. If I am thinking about this correctly,
theoretically the returned matrix after the transform should also be of
size 1024. However, when I perform the transform the matrix I get returned
is size 1044, which is 20 samples bigger than my original matrix. Would
anyone please be able to explain to me why this is happening? Thank you!
Hello guys I need help with a question I have regarding the wavdec
anddwtfunctions in MATLAB. I am using wavdec(y,3,db4) on a size 1024
signal, which means I am trying to compute the third level db4 transform
of the size 1024 signal y. If I am thinking about this correctly,
theoretically the returned matrix after the transform should also be of
size 1024. However, when I perform the transform the matrix I get returned
is size 1044, which is 20 samples bigger than my original matrix. Would
anyone please be able to explain to me why this is happening? Thank you!
Java classpath issues
Java classpath issues
I'm having trouble getting my program to run from the command line. I'm
executing it from the src folder and the files are stored in the package
proj2.
So when I run java -cp "proj2/*;proj2/antlr-3.5.jar" proj2.myClass
I receive an "Error: Could not find or load main class"
If I remove the classpath and just write java proj2.myClass
I get the java.lang.NoClassDefFoundError
How can I run the program using the classpaths correctly?
I'm having trouble getting my program to run from the command line. I'm
executing it from the src folder and the files are stored in the package
proj2.
So when I run java -cp "proj2/*;proj2/antlr-3.5.jar" proj2.myClass
I receive an "Error: Could not find or load main class"
If I remove the classpath and just write java proj2.myClass
I get the java.lang.NoClassDefFoundError
How can I run the program using the classpaths correctly?
Teradata SQL pivot multiple results and eliminate duplicate values
Teradata SQL pivot multiple results and eliminate duplicate values
I have something like this:
ID Result
1 value1
2 value1
2 value2
3 value1
3 value1
4 value1
4 value2
4 value3
Notice that ID 3 has the same result appearing in two rows.
Thanks to bluefeet (teradata sql pivot multiple occurrences into
additional columns), I was able to produce something like this:
ID Result1 Result2 Result3
1 value1
2 value1 value2
3 value1
4 value1 value2 value3
I'm getting what I want, but because ID 3 has multiple results, they are
counted as 2 and then included in the second column, which is for those
results that return 2 occurrences for one ID.
What I would like it do is simply return the first occurrence of the
duplicate ID 3 result in the Result1 column, like this:
ID Result1 Result2 Result3
1 value1
2 value1 value2
3 value1
4 value1 value2 value3
How can I eliminate that duplicate result and prevent it from counting?
I have something like this:
ID Result
1 value1
2 value1
2 value2
3 value1
3 value1
4 value1
4 value2
4 value3
Notice that ID 3 has the same result appearing in two rows.
Thanks to bluefeet (teradata sql pivot multiple occurrences into
additional columns), I was able to produce something like this:
ID Result1 Result2 Result3
1 value1
2 value1 value2
3 value1
4 value1 value2 value3
I'm getting what I want, but because ID 3 has multiple results, they are
counted as 2 and then included in the second column, which is for those
results that return 2 occurrences for one ID.
What I would like it do is simply return the first occurrence of the
duplicate ID 3 result in the Result1 column, like this:
ID Result1 Result2 Result3
1 value1
2 value1 value2
3 value1
4 value1 value2 value3
How can I eliminate that duplicate result and prevent it from counting?
python: can't open file 'setup.py'
python: can't open file 'setup.py'
when i try to install any software on backtrack 5 r3 it appers like this
python: can't open file 'setup.py': [Errno 2] No such file or directory
svn: Repository moved permanently to
'https://svn.code.sf.net/p/w3af/code/trunk'; please relocate
dpkg: error processing w3af (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
w3af
E: Sub-process /usr/bin/dpkg returned an error code (1)
please help
when i try to install any software on backtrack 5 r3 it appers like this
python: can't open file 'setup.py': [Errno 2] No such file or directory
svn: Repository moved permanently to
'https://svn.code.sf.net/p/w3af/code/trunk'; please relocate
dpkg: error processing w3af (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
w3af
E: Sub-process /usr/bin/dpkg returned an error code (1)
please help
PySide Phonon app runs differently after being compiled with py2exe
PySide Phonon app runs differently after being compiled with py2exe
I have a simple PySide application which plays a video with Phonon.
Everything runs OK in IDLE, but when I make an executable (with py2exe),
and run it, I get the following errors:
QObject: Cannot create children for a parent that is in a different thread.
(Parent is MediaObject(0x3c614b8), parent's thread is QThread(0x44e2ed0),
current
thread is QThread(0x3c6fad0)
One of the things I tried in solving the problem was to manually move the
MediaObject to the QApplication thread with
QObject::moveToThread(QApplication.instance().thread()). This had no
effect, and it turns out that the Media Object thread is already the same
as QApplication's thread. Some app output:
App thread:<PySide.QtCore.QThread object at 0x03C1DF58>
Creating media object...
Media obj thread:<PySide.QtCore.QThread object at 0x03C1DF58>
So my questions are:
Is there a way to let my app behave exactly the same when compiled with
py2exe?
Why does the error say MediaObject's thread is at 0x44e2ed0, when it is at
0x03C1DF58?
I have a simple PySide application which plays a video with Phonon.
Everything runs OK in IDLE, but when I make an executable (with py2exe),
and run it, I get the following errors:
QObject: Cannot create children for a parent that is in a different thread.
(Parent is MediaObject(0x3c614b8), parent's thread is QThread(0x44e2ed0),
current
thread is QThread(0x3c6fad0)
One of the things I tried in solving the problem was to manually move the
MediaObject to the QApplication thread with
QObject::moveToThread(QApplication.instance().thread()). This had no
effect, and it turns out that the Media Object thread is already the same
as QApplication's thread. Some app output:
App thread:<PySide.QtCore.QThread object at 0x03C1DF58>
Creating media object...
Media obj thread:<PySide.QtCore.QThread object at 0x03C1DF58>
So my questions are:
Is there a way to let my app behave exactly the same when compiled with
py2exe?
Why does the error say MediaObject's thread is at 0x44e2ed0, when it is at
0x03C1DF58?
Thursday, 19 September 2013
Java: Initializing error for temperature Celsius to Fahrenheit
Java: Initializing error for temperature Celsius to Fahrenheit
I keep getting an initializing error for fdeg. Im trying just to show a
table that converts Celsius to Fahrenheit.
my code:
public class TempTable
{
public static void main(String[] args)
{
double cdeg;
double fdeg;
System.out.println("Fahrenheit" +"\t" + "Celsius");
System.out.println("-------------------------");
for ( cdeg = 0; fdeg <= 20; cdeg++)
{
fdeg = 1.8 * cdeg + 32;
System.out.printf( " %3d C = %5.1f F\n", cdeg, fdeg );
}
}
}
I keep getting an initializing error for fdeg. Im trying just to show a
table that converts Celsius to Fahrenheit.
my code:
public class TempTable
{
public static void main(String[] args)
{
double cdeg;
double fdeg;
System.out.println("Fahrenheit" +"\t" + "Celsius");
System.out.println("-------------------------");
for ( cdeg = 0; fdeg <= 20; cdeg++)
{
fdeg = 1.8 * cdeg + 32;
System.out.printf( " %3d C = %5.1f F\n", cdeg, fdeg );
}
}
}
Java i.o FilterInputStream
Java i.o FilterInputStream
Can FilterInputStream class be classed as an instantiated class or not?
I am struggling to understand this, this is not an abstract class but it
has a protected constructor which means only subclasses can instantiate
this.
Now do I say FilterInputStream class can be instantiated or not? Because
If I try something like this:
FilterInputStream fis = new FilterInputStream(null);
It will complain, but of course if say
FilterInputStream fis = new DataInputStream(null);
than this works fine.
Sorry for such a novice question, I tend to think this probably has
nothing to do with java i.o. but its a question of more to do with access
control and possibly wider OOP concepts.
Anyway i'd be happy to get an opinion on this. Thanks.
Can FilterInputStream class be classed as an instantiated class or not?
I am struggling to understand this, this is not an abstract class but it
has a protected constructor which means only subclasses can instantiate
this.
Now do I say FilterInputStream class can be instantiated or not? Because
If I try something like this:
FilterInputStream fis = new FilterInputStream(null);
It will complain, but of course if say
FilterInputStream fis = new DataInputStream(null);
than this works fine.
Sorry for such a novice question, I tend to think this probably has
nothing to do with java i.o. but its a question of more to do with access
control and possibly wider OOP concepts.
Anyway i'd be happy to get an opinion on this. Thanks.
How to CheckBoxList in DataTable show in GridView?
How to CheckBoxList in DataTable show in GridView?
I have a DataTable with tow column like following:
DataTable dTable = new DataTable();
dTable.Columns.Add("col1", typeof(string));
dTable.Columns.Add("col2", typeof(CheckBoxList));
DataRow dRow = dTable.NewRow();
dRow[0] = "A";
CheckBoxList chk = new CheckBoxList();
chk.Items.Add("x");
chk.Items.Add("y");
dRow[1] = chk;
dTable.Rows.Add(dRow);
GridView1.DataSource = dTable;
GridView1.DataBind();
In output GridView only show col1 and col2 not show. how to show
CheckBoxList in col2 ?
I have a DataTable with tow column like following:
DataTable dTable = new DataTable();
dTable.Columns.Add("col1", typeof(string));
dTable.Columns.Add("col2", typeof(CheckBoxList));
DataRow dRow = dTable.NewRow();
dRow[0] = "A";
CheckBoxList chk = new CheckBoxList();
chk.Items.Add("x");
chk.Items.Add("y");
dRow[1] = chk;
dTable.Rows.Add(dRow);
GridView1.DataSource = dTable;
GridView1.DataBind();
In output GridView only show col1 and col2 not show. how to show
CheckBoxList in col2 ?
How can my Android app communicate with a native daemon?
How can my Android app communicate with a native daemon?
So, I have a custom Android application running as System (built as a
system app in my ROM). And Ive written a native daemon that works fine too
and runs as root. However, I was wondering how the two can communicate? I
know I can have the native daemon create a network socket and have the App
connect to it, but using a local socket for IPC seems even better, but I
am struggling to find example code for it.
I figured I could create the socket like as described here but I have no
idea how to communicate with it in Java.
Any help would be much appreciated.
Also, at first I wrote a native library and used JNI to communicate with
it from Java, but quickly realized that it obviously runs in the context
of the app, so it cant be run as root, which is a requirement I have, and
something the native daemon can do fine. Is using sockets the best
alternative here?
Thanks a ton!
So, I have a custom Android application running as System (built as a
system app in my ROM). And Ive written a native daemon that works fine too
and runs as root. However, I was wondering how the two can communicate? I
know I can have the native daemon create a network socket and have the App
connect to it, but using a local socket for IPC seems even better, but I
am struggling to find example code for it.
I figured I could create the socket like as described here but I have no
idea how to communicate with it in Java.
Any help would be much appreciated.
Also, at first I wrote a native library and used JNI to communicate with
it from Java, but quickly realized that it obviously runs in the context
of the app, so it cant be run as root, which is a requirement I have, and
something the native daemon can do fine. Is using sockets the best
alternative here?
Thanks a ton!
Finding specific attributes in AutoCAD drawing
Finding specific attributes in AutoCAD drawing
So basically I will be given a spreadsheet with AutoCAD drawing attributes
and I need to find each attribute in the AutoCAD drawing and replace its
value with the one from the spreadsheet.
Is there a way to find an Attribute with a specific tag name in an AutoCAD
drawing without searching every single block? Also, I am writing this in
C#.
So basically I will be given a spreadsheet with AutoCAD drawing attributes
and I need to find each attribute in the AutoCAD drawing and replace its
value with the one from the spreadsheet.
Is there a way to find an Attribute with a specific tag name in an AutoCAD
drawing without searching every single block? Also, I am writing this in
C#.
Mysql hourly report query
Mysql hourly report query
I want to get an hourly report of conversions for all 24 hours. I have
this query but it returns only 19rows instead of 24 can anyone plz tell me
wats wrong in this? Thanks in advance.
SELECT HOUR( `date_time` ) AS Hours, COUNT(conversion_id) AS
`conversion` FROM conversions
RIGHT JOIN (SELECT 0 AS Hour UNION ALL SELECT 1 UNION ALL SELECT 2
UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT
5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION
ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11
UNION ALL SELECT 12 UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL
SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17 UNION ALL
SELECT 18 UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21
UNION ALL SELECT 22 UNION ALL SELECT 23) AS AllHours
ON HOUR(date_time) = Hour
WHERE DATE(date_time) = CURDATE() OR date_time IS NULL
GROUP BY Hour
ORDER BY Hour
I want to get an hourly report of conversions for all 24 hours. I have
this query but it returns only 19rows instead of 24 can anyone plz tell me
wats wrong in this? Thanks in advance.
SELECT HOUR( `date_time` ) AS Hours, COUNT(conversion_id) AS
`conversion` FROM conversions
RIGHT JOIN (SELECT 0 AS Hour UNION ALL SELECT 1 UNION ALL SELECT 2
UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT
5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION
ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11
UNION ALL SELECT 12 UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL
SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17 UNION ALL
SELECT 18 UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21
UNION ALL SELECT 22 UNION ALL SELECT 23) AS AllHours
ON HOUR(date_time) = Hour
WHERE DATE(date_time) = CURDATE() OR date_time IS NULL
GROUP BY Hour
ORDER BY Hour
Twitter Bootstrap Tabs Using foreach PHP
Twitter Bootstrap Tabs Using foreach PHP
I want make tabs with twitter bootstrap and data from database, I have php
code following :
<ul id="languages" class="nav nav-tabs">
<?php $i = 0; ?>
<?php foreach ($languages as $language) { ?>
<li class="<?php if ($i == 0) { echo 'active'; } ?>">
<a href="#language<?php echo $language['language_id']; ?>"
data-toggle="tab"><img src="view/image/flags/<?php echo
$language['image']; ?>" title="<?php echo $language['name'];
?>" /> <?php echo $language['name']; ?></a>
</li>
<?php $i++; } ?>
</ul>
<div id="languages" class="tab-content">
<?php $a = 0; ?>
<?php foreach ($languages as $language) { ?>
<div id="language<?php echo $language['language_id']; ?>"
class="tab-pane fade <?php if ($a == 0) { echo 'active'; } ?> in">
<?php echo $language['language_content']; ?>
</div>
<?php $a++; } ?>
</div>
First reload, language 1 is active tab
When click language 2's tab
link #language2 tag have selected class
div tag with id language2 have display block but not have active class
language 1 li still have active class but language 2 li have not active
class.
When I try copy html (via inspect element) and make on jsfiddle it's works
perfectly. Jsfiddle
I want make tabs with twitter bootstrap and data from database, I have php
code following :
<ul id="languages" class="nav nav-tabs">
<?php $i = 0; ?>
<?php foreach ($languages as $language) { ?>
<li class="<?php if ($i == 0) { echo 'active'; } ?>">
<a href="#language<?php echo $language['language_id']; ?>"
data-toggle="tab"><img src="view/image/flags/<?php echo
$language['image']; ?>" title="<?php echo $language['name'];
?>" /> <?php echo $language['name']; ?></a>
</li>
<?php $i++; } ?>
</ul>
<div id="languages" class="tab-content">
<?php $a = 0; ?>
<?php foreach ($languages as $language) { ?>
<div id="language<?php echo $language['language_id']; ?>"
class="tab-pane fade <?php if ($a == 0) { echo 'active'; } ?> in">
<?php echo $language['language_content']; ?>
</div>
<?php $a++; } ?>
</div>
First reload, language 1 is active tab
When click language 2's tab
link #language2 tag have selected class
div tag with id language2 have display block but not have active class
language 1 li still have active class but language 2 li have not active
class.
When I try copy html (via inspect element) and make on jsfiddle it's works
perfectly. Jsfiddle
Wednesday, 18 September 2013
How to pick up repeat image pairs among lots of images ? How to std::hash OpenCV Mat in memory?
How to pick up repeat image pairs among lots of images ? How to std::hash
OpenCV Mat in memory?
My application problem is that, I can get around 500 images, but there
might be 1 or 2 of a pair of 2 images are completely the same, this means
the file's checksum are the same.
However now I have to apply a compression algorithm on these 500 images,
because the uncompressed images occupy too much disk space. Well, the
compression breaks the checksum, so that I cannot use the checksum of the
compressed images file to find out which are the repeated image pairs.
Fortunately, my compression algorithm is lossless, this means the restored
uncompressed images can still be hashed somehow. But I just want to do
this in memory without much disk write access. So my problem is how to
efficiently pick up repeated image among large number of images files in
memory?
I use opencv often, but the answer will be good as long as it is efficient
without saving any file on disk. Python/Bash code will be also acceptable,
C/C++ and OpenCV is preferred.
I can think of use OpenCV 's Mat, with std::hash, but std::hash won't work
directly, I have to code the std::hash<cv::Mat> specifically, and I don't
know how to do it properly yet.
OpenCV Mat in memory?
My application problem is that, I can get around 500 images, but there
might be 1 or 2 of a pair of 2 images are completely the same, this means
the file's checksum are the same.
However now I have to apply a compression algorithm on these 500 images,
because the uncompressed images occupy too much disk space. Well, the
compression breaks the checksum, so that I cannot use the checksum of the
compressed images file to find out which are the repeated image pairs.
Fortunately, my compression algorithm is lossless, this means the restored
uncompressed images can still be hashed somehow. But I just want to do
this in memory without much disk write access. So my problem is how to
efficiently pick up repeated image among large number of images files in
memory?
I use opencv often, but the answer will be good as long as it is efficient
without saving any file on disk. Python/Bash code will be also acceptable,
C/C++ and OpenCV is preferred.
I can think of use OpenCV 's Mat, with std::hash, but std::hash won't work
directly, I have to code the std::hash<cv::Mat> specifically, and I don't
know how to do it properly yet.
I am having trouble reading from standard input and/or command line
I am having trouble reading from standard input and/or command line
So I have been stuck on this forever. I need my code to accept multiple
files in through the command line and read through the lines for specific
info in the strings. If there are no files in the command line it must
read through the standard in through a Scanner. Here is where I'm at.
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
public class P1 {
static String readLine;
static int lineCount;
static int httpCount;
static int httpsCount;
static int ftpCount;
static int otherSchemesCount;
static int eduCount;
static int orgCount;
static int comCount;
static int otherDomainsCount;
static String protocol;
String schemeString;
static String testedLine;
P1() {
lineCount = 0;
httpCount = 0;
httpsCount = 0;
ftpCount = 0;
otherSchemesCount = 0;
eduCount = 0;
orgCount = 0;
comCount = 0;
otherDomainsCount = 0;
}
boolean testLine(String testedLine) {
if (testedLine.equals("end")) {
return true;
} else {
lineCount++;
String[] schemePart = readLine.split(":");
String part1 = schemePart[0];
if (part1.equals("http")) {
httpCount++;
} else if (part1.equals("https")) {
httpsCount++;
} else if (part1.equals("ftp")) {
ftpCount++;
} else {
otherSchemesCount++;
}
if (readLine.contains("edu")) {
eduCount++;
} else if (readLine.contains("org")) {
orgCount++;
} else if (readLine.contains("com")) {
comCount++;
} else {
otherDomainsCount++;
}
}
return false;
}
public static void main(String[] args) throws FileNotFoundException,
IOException {
int i = 0;
File testFile = new File(args[i]);
if (args[0] == null) {
Scanner scan = new Scanner(System.in);
readLine = scan.nextLine();
} else {
Scanner scanFile = new Scanner(testFile);
readLine = scanFile.nextLine();
}
P1 countLines = new P1();
boolean isEnded = false;
System.out.println("Enter a line of text. "
+ "\nType 'end' to stop and count previous lines.");
while (!isEnded) {
//String testLine = countLines.getLine();
isEnded = countLines.testLine(testedLine);
}
if (lineCount == 1) {
System.out.println(">> Got " + lineCount + " line");
} else {
System.out.println(">> Got " + lineCount + " lines");
}
if (httpCount == 1) {
System.out.println(">> Found " + httpCount + " instance of http");
} else {
System.out.println(">> Found " + httpCount + " instances of http");
}
if (httpsCount == 1) {
System.out.println(">> Found " + httpsCount + " instance of https");
} else {
System.out.println(">> Found " + httpsCount + " instances of https");
}
if (ftpCount == 1) {
System.out.println(">> Found " + ftpCount + " instance of ftp");
} else {
System.out.println(">> Found " + ftpCount + " instances of ftp");
}
if (otherSchemesCount == 1) {
System.out.println(">> Found " + otherSchemesCount + " instance of
other schemes");
} else {
System.out.println(">> Found " + otherSchemesCount + " instances
of other schemes");
}
if (eduCount == 1) {
System.out.println(">> Found " + eduCount + " instance of edu");
} else {
System.out.println(">> Found " + eduCount + " instances of edu");
}
if (orgCount == 1) {
System.out.println(">> Found " + orgCount + " instance of org");
} else {
System.out.println(">> Found " + orgCount + " instances of org");
}
if (comCount == 1) {
System.out.println(">> Found " + comCount + " instance of com");
} else {
System.out.println(">> Found " + comCount + " instances of com");
}
if (otherDomainsCount == 1) {
System.out.println(">> Found " + otherDomainsCount + " instance of
other domains");
} else {
System.out.println(">> Found " + otherDomainsCount + " instances
of other domains ");
}
}
}
So I have been stuck on this forever. I need my code to accept multiple
files in through the command line and read through the lines for specific
info in the strings. If there are no files in the command line it must
read through the standard in through a Scanner. Here is where I'm at.
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
public class P1 {
static String readLine;
static int lineCount;
static int httpCount;
static int httpsCount;
static int ftpCount;
static int otherSchemesCount;
static int eduCount;
static int orgCount;
static int comCount;
static int otherDomainsCount;
static String protocol;
String schemeString;
static String testedLine;
P1() {
lineCount = 0;
httpCount = 0;
httpsCount = 0;
ftpCount = 0;
otherSchemesCount = 0;
eduCount = 0;
orgCount = 0;
comCount = 0;
otherDomainsCount = 0;
}
boolean testLine(String testedLine) {
if (testedLine.equals("end")) {
return true;
} else {
lineCount++;
String[] schemePart = readLine.split(":");
String part1 = schemePart[0];
if (part1.equals("http")) {
httpCount++;
} else if (part1.equals("https")) {
httpsCount++;
} else if (part1.equals("ftp")) {
ftpCount++;
} else {
otherSchemesCount++;
}
if (readLine.contains("edu")) {
eduCount++;
} else if (readLine.contains("org")) {
orgCount++;
} else if (readLine.contains("com")) {
comCount++;
} else {
otherDomainsCount++;
}
}
return false;
}
public static void main(String[] args) throws FileNotFoundException,
IOException {
int i = 0;
File testFile = new File(args[i]);
if (args[0] == null) {
Scanner scan = new Scanner(System.in);
readLine = scan.nextLine();
} else {
Scanner scanFile = new Scanner(testFile);
readLine = scanFile.nextLine();
}
P1 countLines = new P1();
boolean isEnded = false;
System.out.println("Enter a line of text. "
+ "\nType 'end' to stop and count previous lines.");
while (!isEnded) {
//String testLine = countLines.getLine();
isEnded = countLines.testLine(testedLine);
}
if (lineCount == 1) {
System.out.println(">> Got " + lineCount + " line");
} else {
System.out.println(">> Got " + lineCount + " lines");
}
if (httpCount == 1) {
System.out.println(">> Found " + httpCount + " instance of http");
} else {
System.out.println(">> Found " + httpCount + " instances of http");
}
if (httpsCount == 1) {
System.out.println(">> Found " + httpsCount + " instance of https");
} else {
System.out.println(">> Found " + httpsCount + " instances of https");
}
if (ftpCount == 1) {
System.out.println(">> Found " + ftpCount + " instance of ftp");
} else {
System.out.println(">> Found " + ftpCount + " instances of ftp");
}
if (otherSchemesCount == 1) {
System.out.println(">> Found " + otherSchemesCount + " instance of
other schemes");
} else {
System.out.println(">> Found " + otherSchemesCount + " instances
of other schemes");
}
if (eduCount == 1) {
System.out.println(">> Found " + eduCount + " instance of edu");
} else {
System.out.println(">> Found " + eduCount + " instances of edu");
}
if (orgCount == 1) {
System.out.println(">> Found " + orgCount + " instance of org");
} else {
System.out.println(">> Found " + orgCount + " instances of org");
}
if (comCount == 1) {
System.out.println(">> Found " + comCount + " instance of com");
} else {
System.out.println(">> Found " + comCount + " instances of com");
}
if (otherDomainsCount == 1) {
System.out.println(">> Found " + otherDomainsCount + " instance of
other domains");
} else {
System.out.println(">> Found " + otherDomainsCount + " instances
of other domains ");
}
}
}
Should POST data have a re-try on timeout condition or not?
Should POST data have a re-try on timeout condition or not?
When POSTing data - either using AJAX or from a mobile device or what have
you - there is often a "retry" condition, so that should something like a
timeout occue, the data is POSTed again.
Is this actually a good idea?
POST data is meant to be idempotent, so if you
A. make a POST to the server, B. the server receives the request, C. takes
time to execute and D. then sends the data back
if the timeout is hit sometime after C. then the next retry will send data
that was meant to be idempotent.
The question then is that should a retry (when calling from the client
side) be set for POST data, or should the server be designed to always
handle POST data appropriately (with tokens and so on), or am i missing
something?
When POSTing data - either using AJAX or from a mobile device or what have
you - there is often a "retry" condition, so that should something like a
timeout occue, the data is POSTed again.
Is this actually a good idea?
POST data is meant to be idempotent, so if you
A. make a POST to the server, B. the server receives the request, C. takes
time to execute and D. then sends the data back
if the timeout is hit sometime after C. then the next retry will send data
that was meant to be idempotent.
The question then is that should a retry (when calling from the client
side) be set for POST data, or should the server be designed to always
handle POST data appropriately (with tokens and so on), or am i missing
something?
datalabels not showing for high y-values on highcharts
datalabels not showing for high y-values on highcharts
I have a few dataLabels that are not showing (they're probably being
clipped) when they seem to exceed a certain height. Is there a way so that
I can have them shown?
For instance, the following labels are not showing as the bars are near
the tip of the graph:
{x:743.4234, y: 5954.4, color: '#cccccc', name: 'ABCDEFG'},
{x:1014.669, y: 4756.6, color: '#000000', name: 'ZXY'},
I'm thinking there's something wrong with my formatter code:
formatter: function () {
var chart = $('#container').highcharts(),
extremes = chart.yAxis[0].getExtremes();
for (var i=0;i < data.length;i++) {
if (this.y >extremes.dataMax/10){
if (this.y == data[i].y){
return data[i].name;
}
}
}
}
Here's what I have now: http://jsfiddle.net/6mMZS/27/
I would like it to show as:
An alternate approach would also be ok, although it sort of breaks the
100% thought, it would still work:
Thanks for the help!
I have a few dataLabels that are not showing (they're probably being
clipped) when they seem to exceed a certain height. Is there a way so that
I can have them shown?
For instance, the following labels are not showing as the bars are near
the tip of the graph:
{x:743.4234, y: 5954.4, color: '#cccccc', name: 'ABCDEFG'},
{x:1014.669, y: 4756.6, color: '#000000', name: 'ZXY'},
I'm thinking there's something wrong with my formatter code:
formatter: function () {
var chart = $('#container').highcharts(),
extremes = chart.yAxis[0].getExtremes();
for (var i=0;i < data.length;i++) {
if (this.y >extremes.dataMax/10){
if (this.y == data[i].y){
return data[i].name;
}
}
}
}
Here's what I have now: http://jsfiddle.net/6mMZS/27/
I would like it to show as:
An alternate approach would also be ok, although it sort of breaks the
100% thought, it would still work:
Thanks for the help!
json encode return as objects instead array
json encode return as objects instead array
I have already read this question and doesn't answer my issue.
I have an Array like this:
Array
(
[0] => Array
(
[COM] => 10659.68
)
[1] => Array
(
[MCD] => 1219.09
)
[2] => Array
(
[MCR] => 77047.65
)
)
And when I make a json_encode() it return this;
[{"COM":10659.68},{"MCD":1219.09},{"MCR":77047.65}]
What I need is get the data in this way:
[["COM":10659.68],["MCD":1219.09],["MCR":77047.65]]
Any idea how can I achieve this
I have already read this question and doesn't answer my issue.
I have an Array like this:
Array
(
[0] => Array
(
[COM] => 10659.68
)
[1] => Array
(
[MCD] => 1219.09
)
[2] => Array
(
[MCR] => 77047.65
)
)
And when I make a json_encode() it return this;
[{"COM":10659.68},{"MCD":1219.09},{"MCR":77047.65}]
What I need is get the data in this way:
[["COM":10659.68],["MCD":1219.09],["MCR":77047.65]]
Any idea how can I achieve this
Screen Sharing over multiple devices via WiFi or WifiDirect
Screen Sharing over multiple devices via WiFi or WifiDirect
I want to develop an app where i can share my screen (presenter) to others
(viewers) over a wifi connection either by using wifi network with AP or
WiFi Direct technology (like Miracast ).
Better if there's no requirement of creating a host AP i.e. via WiFi
Direct. but if its not possible we can go for the hotspot option as well.
what will be the limit of participants?(i need it to be atleast 10)
The app is required for presenting ppts without using projector so i
thought this way if there's other way please mention.
I want to develop an app where i can share my screen (presenter) to others
(viewers) over a wifi connection either by using wifi network with AP or
WiFi Direct technology (like Miracast ).
Better if there's no requirement of creating a host AP i.e. via WiFi
Direct. but if its not possible we can go for the hotspot option as well.
what will be the limit of participants?(i need it to be atleast 10)
The app is required for presenting ppts without using projector so i
thought this way if there's other way please mention.
Why does an object still work properly without the class
Why does an object still work properly without the class
I'm a newbie in Python. After reading some chapters of Python Tutorial
Release 2.7.5, I'm confused about Python scopes and namespaces. This
question may be duplicated because I don't know what to search.
I created a class and an instance. Then I deleted the class using del. But
the instance still works properly. Why?
>>>class MyClass: # define a class
... def greet(self):
... print 'hello'
...
>>>Instan = MyClass() # create an instantiation
>>>Instan
<__main__.MyClass instance at 0x00BBCDC8>
>>>Instan.greet()
hello
>>>dir()
['Instan', 'MyClass', '__builtins__', '__doc__', '__name__', '__package__']
>>>
>>>
>>>del MyClass
>>>dir()
['Instan', '__builtins__', '__doc__', '__name__', '__package__']
>>>Instan
<__main__.MyClass instance at 0x00BBCDC8> # Myclass doesn't exist!
>>>Instan.greet()
hello
I know little about OOP so this question may seem simple. Thanks in advance.
I'm a newbie in Python. After reading some chapters of Python Tutorial
Release 2.7.5, I'm confused about Python scopes and namespaces. This
question may be duplicated because I don't know what to search.
I created a class and an instance. Then I deleted the class using del. But
the instance still works properly. Why?
>>>class MyClass: # define a class
... def greet(self):
... print 'hello'
...
>>>Instan = MyClass() # create an instantiation
>>>Instan
<__main__.MyClass instance at 0x00BBCDC8>
>>>Instan.greet()
hello
>>>dir()
['Instan', 'MyClass', '__builtins__', '__doc__', '__name__', '__package__']
>>>
>>>
>>>del MyClass
>>>dir()
['Instan', '__builtins__', '__doc__', '__name__', '__package__']
>>>Instan
<__main__.MyClass instance at 0x00BBCDC8> # Myclass doesn't exist!
>>>Instan.greet()
hello
I know little about OOP so this question may seem simple. Thanks in advance.
Stage rotation according to origin of stage kineticJS
Stage rotation according to origin of stage kineticJS
I 'm working on a navigation project.I have a map like this.
http://i.stack.imgur.com/Squ72.jpg
I need to rotate this map according to the green point which is on
[400,300] px on the stage.I tried a lot of things but it did not work.Here
is my rotate function.
function rotateMap(layer, t_angle) {
layer.setOffset(400, 300);
layer.rotateDeg(t_angle);
layer.draw();
layer.move(400, 300);
};
This rotates map only one time.When i tried to use it in a timer event,the
map doesn't appears after first rotation.Is there any efficial way to do
this rotation?
I 'm working on a navigation project.I have a map like this.
http://i.stack.imgur.com/Squ72.jpg
I need to rotate this map according to the green point which is on
[400,300] px on the stage.I tried a lot of things but it did not work.Here
is my rotate function.
function rotateMap(layer, t_angle) {
layer.setOffset(400, 300);
layer.rotateDeg(t_angle);
layer.draw();
layer.move(400, 300);
};
This rotates map only one time.When i tried to use it in a timer event,the
map doesn't appears after first rotation.Is there any efficial way to do
this rotation?
Tuesday, 17 September 2013
What is a point to use retain method on singleton object in Objective c?
What is a point to use retain method on singleton object in Objective c?
I was just wondering if any point to use retain over singleton object. I
believe the whole point of using singleton pattern is to keep one global
object to access from various classes. What would be a case to use retain
on singleton object? Generally implementation of retain on singleton class
return self (not singleton instance) like below:
-(id)retain
{
return self;
}
What would happen if anyone retain it and attempt to access on it? Thanks
I was just wondering if any point to use retain over singleton object. I
believe the whole point of using singleton pattern is to keep one global
object to access from various classes. What would be a case to use retain
on singleton object? Generally implementation of retain on singleton class
return self (not singleton instance) like below:
-(id)retain
{
return self;
}
What would happen if anyone retain it and attempt to access on it? Thanks
KendoUI Grid custom filter menu breaks after first filtering or clear
KendoUI Grid custom filter menu breaks after first filtering or clear
I'm using KendoUI Grid (web framework). The is being filled from local
json data which is being loaded from ASP.NET MVC ViewBag at page load. I'm
declaring datasource in seperate variable before the grid is initialized
and filled with data from datasoruce. I'm experiencing a problem where
filter menu breaks after first filtering or clearing (look at the image).
Every next time I click the filter or clear button, it hides more controls
until there are just the two buttons left. The odd thing is that there are
no errors reported in console. I've been working on this problem for more
than one week but I can't seem to find any information about it, nor am I
getting any closer to possible solution.
I know that non-english code can be hard to understand but I'll be happy
to translate and explain what it means!
Unfortunately I can't provide a link to server where this page is running
as it requires login and the page is already release-deployed which means
it wouldn't be a good idea to put credentials in public. Although I've
been struggling to put together a working fiddle, I haven't been able to
make it work.
I'm using this code:
root.seznamDataSource = new kendo.data.DataSource({
data: zahteveData,
pageSize: 15,
schema: {
model: {
fields: {
IdZahteve: {
type: "number"
},
Naslov: {
type: "string"
},
Datum: {
type: "date"
},
Status: {
type: "string"
},
Narocnik: {
type: "string"
},
PoslovniPartner: {
type: "string"
}
}
}
},
change: function(e) {
var urejeniItemi;
if ((e.sender._sort != null)
&& (e.sender._sort[0] != null)
&& e.sender._sort[0].field === "Status") {
e.preventDefault();
urejeniItemi = [];
return $.getJSON("/Zahteve/StatusiData", function(data) {
var item, status, _i, _j, _len, _len1, _ref;
for (_i = 0, _len = data.length; _i < _len; _i++) {
status = data[_i];
_ref = e.items;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
item = _ref[_j];
if (item.Status.trim().toLowerCase() ===
status.Opis.trim().toLowerCase()) {
urejeniItemi.push(item);
}
}
}
if (urejeniItemi.length !== e.items.length) {
console.log("napaka, niso urejeni vsi itemi");
return;
}
if (e.sender._sort[0].dir === "desc") {
urejeniItemi.reverse();
return e.items = urejeniItemi;
}
});
}
}
});
I've registered change event listener so I can apply specific sorting.
After the datasource is initialized, I start the initialization of KendoUI
Grid:
$("#odprte-zahteve").kendoGrid({
dataSource: root.seznamDataSource,
columns: [
{
template: '<span data-idZahteve="#=IdZahteve#"></span>#=Naslov#',
field: "Naslov",
title: "Naslov zahteve",
attributes: {
style: "min-width: 110px!importnat; text-indent: 10px;"
},
filterable: {
ui: naslovFilter
}
}, {
field: "Datum",
title: "Datum zahteve",
format: "{0: dddd, dd. MMMM 'yy}",
attributes: {
style: "min-width: 105px!importnat;"
},
filterable: {
extra: true,
ui: function(element) {
element.kendoDatePicker({
depth: "month",
max: new Date(),
format: "dddd,d. MMMM yyyy",
ARIATemplate: "#=datumZImenom(data.current)#",
footer: "Danes - #=datumZImenom(data)#"
});
}
}
}, {
field: "Status",
title: "Status",
attributes: {
style: "min-width: 60px!importnat;"
},
filterable: {
ui: statusFilter
}
}, {
field: "Narocnik",
title: "Naroènik",
attributes: {
style: "min-width: 80px!importnat;"
},
filterable: {
ui: narocnikFilter
}
}, {
field: "PoslovniPartner",
title: "Poslovni partner",
attributes: {
style: "min-width: 100px!importnat;"
},
filterable: false,
sortable: false
}
],
change: function(e) {
return urediZahtevo(getIzbranaZahteva(this));
},
dataBound: prilagodiSirino,
selectable: true,
sortable: true,
pageable: {
buttonCount: 5,
pageSizes: [15, 30, 45],
messages: {
display: "Prikazujem {0} - {1} od {2} odprtih zahtev",
empty: "Ni podatkov",
itemsPerPage: "zahtev na stran",
next: "Pojdi na naslednjo stran",
first: "Pojdi na prvo stran",
previous: "Pojdi na prejšnjo stran",
last: "Pojdi na zadnjo stran",
refresh: "Osveite tabelo"
}
},
filterable: {
extra: false,
operators: {
string: {
eq: "Je enak",
startswith: "Se zaène z",
contains: "Vsebuje"
},
date: {
lt: "Pred datumom",
gt: "Po datumu",
eq: "Je enak datumu"
}
},
messages: {
and: "in",
or: "ali",
filter: "Filtriraj",
clear: "Poèisti",
info: "Filtriraj po: ",
selectValue: "Izberite kategorijo"
}
}
});
The filter ui functions are just creating basic filter menus
naslovFilter = function(element) {
element.kendoAutoComplete({
dataSource: zahteveData,
dataTextField: "Naslov"
});
};
datumFilter = function(element) {
element.kendoDatePicker({
depth: "month",
max: new Date(),
format: "dddd,d. MMMM yyyy",
ARIATemplate: "#=datumZImenom(data.current)#",
footer: "Danes - #=datumZImenom(data)#"
});
};
statusFilter = function(element) {
var item, status, statusi, _i, _len;
statusi = [];
for (_i = 0, _len = zahteveData.length; _i < _len; _i++) {
item = zahteveData[_i];
status = item.Status.trim();
if (!statusi.contains(status)) {
statusi.push(status);
}
}
element.kendoDropDownList({
dataSource: statusi,
optionLabel: "Izberite status"
});
};
narocnikFilter = function(element) {
element.kendoDropDownList({
dataSource: narocniki,
optionLabel: "Izberite naroènika"
});
};
I'm using KendoUI Grid (web framework). The is being filled from local
json data which is being loaded from ASP.NET MVC ViewBag at page load. I'm
declaring datasource in seperate variable before the grid is initialized
and filled with data from datasoruce. I'm experiencing a problem where
filter menu breaks after first filtering or clearing (look at the image).
Every next time I click the filter or clear button, it hides more controls
until there are just the two buttons left. The odd thing is that there are
no errors reported in console. I've been working on this problem for more
than one week but I can't seem to find any information about it, nor am I
getting any closer to possible solution.
I know that non-english code can be hard to understand but I'll be happy
to translate and explain what it means!
Unfortunately I can't provide a link to server where this page is running
as it requires login and the page is already release-deployed which means
it wouldn't be a good idea to put credentials in public. Although I've
been struggling to put together a working fiddle, I haven't been able to
make it work.
I'm using this code:
root.seznamDataSource = new kendo.data.DataSource({
data: zahteveData,
pageSize: 15,
schema: {
model: {
fields: {
IdZahteve: {
type: "number"
},
Naslov: {
type: "string"
},
Datum: {
type: "date"
},
Status: {
type: "string"
},
Narocnik: {
type: "string"
},
PoslovniPartner: {
type: "string"
}
}
}
},
change: function(e) {
var urejeniItemi;
if ((e.sender._sort != null)
&& (e.sender._sort[0] != null)
&& e.sender._sort[0].field === "Status") {
e.preventDefault();
urejeniItemi = [];
return $.getJSON("/Zahteve/StatusiData", function(data) {
var item, status, _i, _j, _len, _len1, _ref;
for (_i = 0, _len = data.length; _i < _len; _i++) {
status = data[_i];
_ref = e.items;
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
item = _ref[_j];
if (item.Status.trim().toLowerCase() ===
status.Opis.trim().toLowerCase()) {
urejeniItemi.push(item);
}
}
}
if (urejeniItemi.length !== e.items.length) {
console.log("napaka, niso urejeni vsi itemi");
return;
}
if (e.sender._sort[0].dir === "desc") {
urejeniItemi.reverse();
return e.items = urejeniItemi;
}
});
}
}
});
I've registered change event listener so I can apply specific sorting.
After the datasource is initialized, I start the initialization of KendoUI
Grid:
$("#odprte-zahteve").kendoGrid({
dataSource: root.seznamDataSource,
columns: [
{
template: '<span data-idZahteve="#=IdZahteve#"></span>#=Naslov#',
field: "Naslov",
title: "Naslov zahteve",
attributes: {
style: "min-width: 110px!importnat; text-indent: 10px;"
},
filterable: {
ui: naslovFilter
}
}, {
field: "Datum",
title: "Datum zahteve",
format: "{0: dddd, dd. MMMM 'yy}",
attributes: {
style: "min-width: 105px!importnat;"
},
filterable: {
extra: true,
ui: function(element) {
element.kendoDatePicker({
depth: "month",
max: new Date(),
format: "dddd,d. MMMM yyyy",
ARIATemplate: "#=datumZImenom(data.current)#",
footer: "Danes - #=datumZImenom(data)#"
});
}
}
}, {
field: "Status",
title: "Status",
attributes: {
style: "min-width: 60px!importnat;"
},
filterable: {
ui: statusFilter
}
}, {
field: "Narocnik",
title: "Naroènik",
attributes: {
style: "min-width: 80px!importnat;"
},
filterable: {
ui: narocnikFilter
}
}, {
field: "PoslovniPartner",
title: "Poslovni partner",
attributes: {
style: "min-width: 100px!importnat;"
},
filterable: false,
sortable: false
}
],
change: function(e) {
return urediZahtevo(getIzbranaZahteva(this));
},
dataBound: prilagodiSirino,
selectable: true,
sortable: true,
pageable: {
buttonCount: 5,
pageSizes: [15, 30, 45],
messages: {
display: "Prikazujem {0} - {1} od {2} odprtih zahtev",
empty: "Ni podatkov",
itemsPerPage: "zahtev na stran",
next: "Pojdi na naslednjo stran",
first: "Pojdi na prvo stran",
previous: "Pojdi na prejšnjo stran",
last: "Pojdi na zadnjo stran",
refresh: "Osveite tabelo"
}
},
filterable: {
extra: false,
operators: {
string: {
eq: "Je enak",
startswith: "Se zaène z",
contains: "Vsebuje"
},
date: {
lt: "Pred datumom",
gt: "Po datumu",
eq: "Je enak datumu"
}
},
messages: {
and: "in",
or: "ali",
filter: "Filtriraj",
clear: "Poèisti",
info: "Filtriraj po: ",
selectValue: "Izberite kategorijo"
}
}
});
The filter ui functions are just creating basic filter menus
naslovFilter = function(element) {
element.kendoAutoComplete({
dataSource: zahteveData,
dataTextField: "Naslov"
});
};
datumFilter = function(element) {
element.kendoDatePicker({
depth: "month",
max: new Date(),
format: "dddd,d. MMMM yyyy",
ARIATemplate: "#=datumZImenom(data.current)#",
footer: "Danes - #=datumZImenom(data)#"
});
};
statusFilter = function(element) {
var item, status, statusi, _i, _len;
statusi = [];
for (_i = 0, _len = zahteveData.length; _i < _len; _i++) {
item = zahteveData[_i];
status = item.Status.trim();
if (!statusi.contains(status)) {
statusi.push(status);
}
}
element.kendoDropDownList({
dataSource: statusi,
optionLabel: "Izberite status"
});
};
narocnikFilter = function(element) {
element.kendoDropDownList({
dataSource: narocniki,
optionLabel: "Izberite naroènika"
});
};
Error building g++ 4.8.1 on CentOS
Error building g++ 4.8.1 on CentOS
Can anybody suggest what's going wrong with my attempted g++ 4.8.1 install
on CentOS 6?
The installed compiler is g++ 4.4.7.
The make step ends shortly after this:
checking for suffix of object files... configure: error: in
`/mxhome/charrison/gcc-4.8.1/gcc-4.8.1/build-gcc/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
The config.log contains this seemingly-innocent remark concerning object
file suffixes:
configure:4390: checking for suffix of object files
configure:4412: gcc -c conftest.c >&5
configure:4416: $? = 0
configure:4437: result: o
The word 'error' occurs in the config.log file here (and my g++4.4 would
certainly fail the test):
configure:4936: checking whether g++ accepts -static-libstdc++ -static-libgcc
configure:4953: g++ -o conftest -g -O2 -static-libstdc++ -static-libgcc
conftest.cpp >&5
g++: unrecognized option '-static-libstdc++'
conftest.cpp:11:2: error: #error -static-libstdc++ not implemented
configure:4953: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
| #error -static-libstdc++ not implemented
|
Can anybody suggest what's going wrong with my attempted g++ 4.8.1 install
on CentOS 6?
The installed compiler is g++ 4.4.7.
The make step ends shortly after this:
checking for suffix of object files... configure: error: in
`/mxhome/charrison/gcc-4.8.1/gcc-4.8.1/build-gcc/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
The config.log contains this seemingly-innocent remark concerning object
file suffixes:
configure:4390: checking for suffix of object files
configure:4412: gcc -c conftest.c >&5
configure:4416: $? = 0
configure:4437: result: o
The word 'error' occurs in the config.log file here (and my g++4.4 would
certainly fail the test):
configure:4936: checking whether g++ accepts -static-libstdc++ -static-libgcc
configure:4953: g++ -o conftest -g -O2 -static-libstdc++ -static-libgcc
conftest.cpp >&5
g++: unrecognized option '-static-libstdc++'
conftest.cpp:11:2: error: #error -static-libstdc++ not implemented
configure:4953: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
| #error -static-libstdc++ not implemented
|
Activate TinyMCE Popup only with Media_Buttons True?
Activate TinyMCE Popup only with Media_Buttons True?
I'm running Wordpress and TinyMCE in Front-End.
I have one button that opens popup window but it only words with
media_buttons TRUE. But i want to hide media_buttons. Thanks in advance.
Here is my code:
<?php
// quick tags/buttons :
link,em,strong,block,del,ins,img,ul,li,ol,code,more,spell,close,fullscreen
// editor styles
$qt = '';
if( $this->options[ 'wpcc_edit_in_html' ] ) $qt = array( 'buttons' =>
'strong,em,block,del,ul,ol,li,spell,close' );
else {
$qt = FALSE;
add_filter( 'wp_default_editor', create_function( '', 'return
"tinymce";' ) ); // force visual editor
}
$editor_settings = array(
'theme_advanced_blockformats' => array( 'h2','h3','p' ),
'wpautop' => true,
'media_buttons' => false,
'tinymce' => array(
'theme_advanced_buttons1' =>
'bold,italic,blockquote,strikethrough,bullist,numlist,spellchecker,|,undo,redo,|,mygallery_button',
'theme_advanced_buttons2' => '',
'theme_advanced_buttons3' => '',
'theme_advanced_buttons4' => ''
),
'quicktags' => $qt
);
I'm running Wordpress and TinyMCE in Front-End.
I have one button that opens popup window but it only words with
media_buttons TRUE. But i want to hide media_buttons. Thanks in advance.
Here is my code:
<?php
// quick tags/buttons :
link,em,strong,block,del,ins,img,ul,li,ol,code,more,spell,close,fullscreen
// editor styles
$qt = '';
if( $this->options[ 'wpcc_edit_in_html' ] ) $qt = array( 'buttons' =>
'strong,em,block,del,ul,ol,li,spell,close' );
else {
$qt = FALSE;
add_filter( 'wp_default_editor', create_function( '', 'return
"tinymce";' ) ); // force visual editor
}
$editor_settings = array(
'theme_advanced_blockformats' => array( 'h2','h3','p' ),
'wpautop' => true,
'media_buttons' => false,
'tinymce' => array(
'theme_advanced_buttons1' =>
'bold,italic,blockquote,strikethrough,bullist,numlist,spellchecker,|,undo,redo,|,mygallery_button',
'theme_advanced_buttons2' => '',
'theme_advanced_buttons3' => '',
'theme_advanced_buttons4' => ''
),
'quicktags' => $qt
);
Django urls.py gives a 404 error while trying to access a URL
Django urls.py gives a 404 error while trying to access a URL
I'm trying to create a Django app that uses these two urls, browse and
account but I am getting an error when I try to access either of these
two.
Using the URLconf defined in mediasite.urls, Django tried these URL
patterns, in this order:
^browse/
^admin/
The current URL, browse, didn't match any of these.
After looking over my code, I'm not sure where the error lies. The strange
thing is the admin site still works.
urls.py:
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^browse/', include('media.urls')),
url(r'^admin/', include(admin.site.urls)),
)
media/urls.py:
from django.conf.urls.defaults import patterns, include, url
from django.views.generic import ListView, DetailView
from media.models import Video
urlpatterns = patterns('',
url(r'^videos', ListView.as_view(
queryset=Video.objects.all().order_by("-created")[:2],
template_name="media.html")),
url(r'^videos/(?P<pk>\d+)$', DetailView.as_view(
model=Video,
template_name="video.html")),
)
settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'media',
)
I'm trying to create a Django app that uses these two urls, browse and
account but I am getting an error when I try to access either of these
two.
Using the URLconf defined in mediasite.urls, Django tried these URL
patterns, in this order:
^browse/
^admin/
The current URL, browse, didn't match any of these.
After looking over my code, I'm not sure where the error lies. The strange
thing is the admin site still works.
urls.py:
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^browse/', include('media.urls')),
url(r'^admin/', include(admin.site.urls)),
)
media/urls.py:
from django.conf.urls.defaults import patterns, include, url
from django.views.generic import ListView, DetailView
from media.models import Video
urlpatterns = patterns('',
url(r'^videos', ListView.as_view(
queryset=Video.objects.all().order_by("-created")[:2],
template_name="media.html")),
url(r'^videos/(?P<pk>\d+)$', DetailView.as_view(
model=Video,
template_name="video.html")),
)
settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'media',
)
Redirect to a different page after LDAP Authentication
Redirect to a different page after LDAP Authentication
I am using Tomcat, JSP and LDAP Active Directory.
Right now I directly access the login.jsp page and pass in the credentials
to the LDAP Server. ( I should not do this I beleive)
The LDAP configurations for this is under tomcat/conf/server.xml
If I pass on the credentials in the login.jsp page it displays "HTTP
Status 400 - Invalid direct reference to form login page"
I believe the authentication by LDAP is working since if I supply wrong
credentials then I am directed to the error.jsp page.
I would like to know how I can redirect from the login page to someother
page after successful LDAP authentication.
I have done redirects through Servlets, but LDAP authentication looks
different and I dont have lots of experience working with web
applications. Please guide me through the changes I need to make in
web.xml file and I dont show different views/pages for different users,
everyone has same privileges. I also don't use Spring in my application.
My Login Page
<html>
<head>
<title>Login Page for Examples</title>
<body bgcolor="white">
<form method="POST" action='<%= response.encodeURL("j_security_check") %>' >
<table border="0" cellspacing="5">
<tr>
<th align="right">Username:</th>
<td align="left"><input type="text" name="j_username"></td>
</tr>
<tr>
<th align="right">Password:</th>
<td align="left"><input type="password" name="j_password"></td>
</tr>
<tr>
<td align="right"><input type="submit" value="Log In"></td>
<td align="left"><input type="reset"></td>
</tr>
</table>
</form>
</body>
</html>
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>TomAuth</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>*jsp</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
</security-constraint>
<!-- Default login configuration uses form-based authentication -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/jsp/security/protected/login.jsp</form-login-page>
<form-error-page>/jsp/security/protected/error.jsp</form-error-page>
</form-login-config>
</login-config>
</web-app>
I am using Tomcat, JSP and LDAP Active Directory.
Right now I directly access the login.jsp page and pass in the credentials
to the LDAP Server. ( I should not do this I beleive)
The LDAP configurations for this is under tomcat/conf/server.xml
If I pass on the credentials in the login.jsp page it displays "HTTP
Status 400 - Invalid direct reference to form login page"
I believe the authentication by LDAP is working since if I supply wrong
credentials then I am directed to the error.jsp page.
I would like to know how I can redirect from the login page to someother
page after successful LDAP authentication.
I have done redirects through Servlets, but LDAP authentication looks
different and I dont have lots of experience working with web
applications. Please guide me through the changes I need to make in
web.xml file and I dont show different views/pages for different users,
everyone has same privileges. I also don't use Spring in my application.
My Login Page
<html>
<head>
<title>Login Page for Examples</title>
<body bgcolor="white">
<form method="POST" action='<%= response.encodeURL("j_security_check") %>' >
<table border="0" cellspacing="5">
<tr>
<th align="right">Username:</th>
<td align="left"><input type="text" name="j_username"></td>
</tr>
<tr>
<th align="right">Password:</th>
<td align="left"><input type="password" name="j_password"></td>
</tr>
<tr>
<td align="right"><input type="submit" value="Log In"></td>
<td align="left"><input type="reset"></td>
</tr>
</table>
</form>
</body>
</html>
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>TomAuth</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>*jsp</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
</security-constraint>
<!-- Default login configuration uses form-based authentication -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/jsp/security/protected/login.jsp</form-login-page>
<form-error-page>/jsp/security/protected/error.jsp</form-error-page>
</form-login-config>
</login-config>
</web-app>
Sunday, 15 September 2013
Ruby on Rails: Form routes to a different URL
Ruby on Rails: Form routes to a different URL
I have a form that saves data, but it gets routed to the wrong URL.
If my form is in
localhost:3000/users/1/styles/1
And when I submit the form, I get redirected to this:
localhost:3000/styles/1
and then I get an error:
Couldn't find User without an ID
views/comments/_form.html.erb
<%= form_for [@commentable, @comment] do |f| %>
<%= f.text_area :content, rows: 3 %>
<%= f.submit %>
<% end %>
styles_controller.rb
def show
@user = User.find(params[:user_id])
@style = @user.styles.find(params[:id])
@commentable = @style
@comments = @commentable.comments
@comment = Comment.new
end
comments_controller.rb
before_filter :get_commentable
def new
@comment = @commentable.comments.new
end
def create
@comment = @commentable.comments.new(params[:comment])
@comment.user = current_user
if @comment.save
redirect_to @commentable, notice: "Comment created."
else
render :new
end
end
private
def get_commentable
@commentable =
params[:commentable].classify.constantize.find(commentable_id)
end
def commentable_id
params[(params[:commentable].singularize + "_id").to_sym]
end
routes.rb
resources :styles do
resources :comments, :defaults => { :commentable => 'style' }
end
Please let me know if there's other information that is needed. Why am I
getting rerouted to a different url? My comment does save into my
database.
Thank you
I have a form that saves data, but it gets routed to the wrong URL.
If my form is in
localhost:3000/users/1/styles/1
And when I submit the form, I get redirected to this:
localhost:3000/styles/1
and then I get an error:
Couldn't find User without an ID
views/comments/_form.html.erb
<%= form_for [@commentable, @comment] do |f| %>
<%= f.text_area :content, rows: 3 %>
<%= f.submit %>
<% end %>
styles_controller.rb
def show
@user = User.find(params[:user_id])
@style = @user.styles.find(params[:id])
@commentable = @style
@comments = @commentable.comments
@comment = Comment.new
end
comments_controller.rb
before_filter :get_commentable
def new
@comment = @commentable.comments.new
end
def create
@comment = @commentable.comments.new(params[:comment])
@comment.user = current_user
if @comment.save
redirect_to @commentable, notice: "Comment created."
else
render :new
end
end
private
def get_commentable
@commentable =
params[:commentable].classify.constantize.find(commentable_id)
end
def commentable_id
params[(params[:commentable].singularize + "_id").to_sym]
end
routes.rb
resources :styles do
resources :comments, :defaults => { :commentable => 'style' }
end
Please let me know if there's other information that is needed. Why am I
getting rerouted to a different url? My comment does save into my
database.
Thank you
Heroku trying to install sqlite with every deployment
Heroku trying to install sqlite with every deployment
I know this question has been asked many times any I have tried all the
suggested solutions and still can not get this to work:
I try to push an App to heroku and it is rejected because it tries to
install the sqlite gem. I had sqlite as production db in the beginning but
I changed and also tried to find all gems that have sqlite as a
dependency, still heroku tries to install it.
I even tried taking/commenting it out everywhere. Help is MUCH appreciated!
Gemfile:
https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.13'
gem 'sqlite3', :group => [:development, :test]
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'bootstrap-sass'
gem 'cancan'
gem 'devise'
gem 'figaro'
gem 'simple_form'
gem 'bootstrap-datepicker-rails'
gem 'paymill'
gem 'heroku'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
gem 'hub', :require=>nil
gem 'quiet_assets'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
end
group :production do
gem 'thin'
gem 'pg'
end
group :test do
gem 'capybara'
gem 'cucumber-rails', :require=>false
gem 'database_cleaner', '1.0.1'
gem 'email_spec'
gem 'launchy'
end
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
addressable (2.3.5)
arel (3.0.2)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
better_errors (1.0.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-datepicker-rails (1.1.1.7)
railties (>= 3.0)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
builder (3.0.4)
cancan (1.6.10)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
coderay (1.1.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
cucumber (1.3.8)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12.1)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.0.2)
cucumber-rails (1.4.0)
capybara (>= 1.1.2)
cucumber (>= 1.2.0)
nokogiri (>= 1.5.0)
rails (>= 3.0.0)
daemons (1.1.9)
database_cleaner (1.0.1)
debug_inspector (0.0.2)
devise (3.1.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.4)
email_spec (1.5.0)
launchy (~> 2.1)
mail (~> 2.2)
erubis (2.7.0)
eventmachine (1.0.3)
excon (0.25.3)
execjs (2.0.1)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
figaro (0.7.0)
bundler (~> 1.0)
rails (>= 3, < 5)
gherkin (2.12.1)
multi_json (~> 1.3)
heroku (2.40.1)
heroku-api (~> 0.3.7)
launchy (>= 0.3.2)
netrc (~> 0.7.7)
rest-client (~> 1.6.1)
rubyzip
heroku-api (0.3.15)
excon (~> 0.25.1)
hike (1.2.3)
hub (1.10.6)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.0)
launchy (2.3.0)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25)
mini_portile (0.5.1)
multi_json (1.8.0)
multi_test (0.0.2)
netrc (0.7.7)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
orm_adapter (0.4.0)
paymill (0.4.0)
json
pg (0.16.0)
polyglot (0.3.3)
quiet_assets (1.0.2)
railties (>= 3.1, < 5.0)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.13)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.1.0)
rdoc (3.12.2)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec-core (2.14.5)
rspec-expectations (2.14.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.3)
rspec-rails (2.14.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rubyzip (1.0.0)
sass (3.2.10)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
simple_form (2.1.0)
actionpack (~> 3.0)
activemodel (~> 3.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.8)
thin (1.5.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
warden (1.2.3)
rack (>= 1.0)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
better_errors
binding_of_caller
bootstrap-datepicker-rails
bootstrap-sass
cancan
capybara
coffee-rails (~> 3.2.1)
cucumber-rails
database_cleaner (= 1.0.1)
devise
email_spec
factory_girl_rails
figaro
heroku
hub
jquery-rails
launchy
paymill
pg
quiet_assets
rails (= 3.2.13)
rspec-rails
sass-rails (~> 3.2.3)
simple_form
sqlite3
thin
uglifier (>= 1.0.3)
I know this question has been asked many times any I have tried all the
suggested solutions and still can not get this to work:
I try to push an App to heroku and it is rejected because it tries to
install the sqlite gem. I had sqlite as production db in the beginning but
I changed and also tried to find all gems that have sqlite as a
dependency, still heroku tries to install it.
I even tried taking/commenting it out everywhere. Help is MUCH appreciated!
Gemfile:
https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.13'
gem 'sqlite3', :group => [:development, :test]
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'bootstrap-sass'
gem 'cancan'
gem 'devise'
gem 'figaro'
gem 'simple_form'
gem 'bootstrap-datepicker-rails'
gem 'paymill'
gem 'heroku'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
gem 'hub', :require=>nil
gem 'quiet_assets'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
end
group :production do
gem 'thin'
gem 'pg'
end
group :test do
gem 'capybara'
gem 'cucumber-rails', :require=>false
gem 'database_cleaner', '1.0.1'
gem 'email_spec'
gem 'launchy'
end
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
addressable (2.3.5)
arel (3.0.2)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
better_errors (1.0.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-datepicker-rails (1.1.1.7)
railties (>= 3.0)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
builder (3.0.4)
cancan (1.6.10)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
coderay (1.1.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
cucumber (1.3.8)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12.1)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.0.2)
cucumber-rails (1.4.0)
capybara (>= 1.1.2)
cucumber (>= 1.2.0)
nokogiri (>= 1.5.0)
rails (>= 3.0.0)
daemons (1.1.9)
database_cleaner (1.0.1)
debug_inspector (0.0.2)
devise (3.1.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.4)
email_spec (1.5.0)
launchy (~> 2.1)
mail (~> 2.2)
erubis (2.7.0)
eventmachine (1.0.3)
excon (0.25.3)
execjs (2.0.1)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
figaro (0.7.0)
bundler (~> 1.0)
rails (>= 3, < 5)
gherkin (2.12.1)
multi_json (~> 1.3)
heroku (2.40.1)
heroku-api (~> 0.3.7)
launchy (>= 0.3.2)
netrc (~> 0.7.7)
rest-client (~> 1.6.1)
rubyzip
heroku-api (0.3.15)
excon (~> 0.25.1)
hike (1.2.3)
hub (1.10.6)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.0)
launchy (2.3.0)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25)
mini_portile (0.5.1)
multi_json (1.8.0)
multi_test (0.0.2)
netrc (0.7.7)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
orm_adapter (0.4.0)
paymill (0.4.0)
json
pg (0.16.0)
polyglot (0.3.3)
quiet_assets (1.0.2)
railties (>= 3.1, < 5.0)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.13)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.1.0)
rdoc (3.12.2)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec-core (2.14.5)
rspec-expectations (2.14.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.3)
rspec-rails (2.14.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rubyzip (1.0.0)
sass (3.2.10)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
simple_form (2.1.0)
actionpack (~> 3.0)
activemodel (~> 3.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.8)
thin (1.5.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
warden (1.2.3)
rack (>= 1.0)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
better_errors
binding_of_caller
bootstrap-datepicker-rails
bootstrap-sass
cancan
capybara
coffee-rails (~> 3.2.1)
cucumber-rails
database_cleaner (= 1.0.1)
devise
email_spec
factory_girl_rails
figaro
heroku
hub
jquery-rails
launchy
paymill
pg
quiet_assets
rails (= 3.2.13)
rspec-rails
sass-rails (~> 3.2.3)
simple_form
sqlite3
thin
uglifier (>= 1.0.3)
List all connections to a server
List all connections to a server
How can I list all the connections to a server, in the movie Mark use a
shell to do that.
How can I list all the connections to a server, in the movie Mark use a
shell to do that.
New Project Wizard error in AndroidStudio
New Project Wizard error in AndroidStudio
This is what I get when I try to create a new Android Studio project:
com.android.builder.model.AndroidLibrary.getProject()Ljava/lang/String;
Consult IDE log for more details (Help | Show Log)
Using the latest androidStudio, 0.2.8.
I can't even open any project to see my logs.
This is what I get when I try to create a new Android Studio project:
com.android.builder.model.AndroidLibrary.getProject()Ljava/lang/String;
Consult IDE log for more details (Help | Show Log)
Using the latest androidStudio, 0.2.8.
I can't even open any project to see my logs.
Android WebView : Pause Embedded video( SurfaceView) on screen lock.
Android WebView : Pause Embedded video( SurfaceView) on screen lock.
In webview, I'm loading html with a video embedded in it. The webview is
using SuraceView to play video. But when the screen is locked, the video
is still playing. I cross verified the same url in browser, video is
pausing on screen lock.
I'm having the surfaceview object. So, is there any possibility to pause
and resume the mediaplayer upon screen lock?
Please help me out in finding the solution.
Regards,
Sha
In webview, I'm loading html with a video embedded in it. The webview is
using SuraceView to play video. But when the screen is locked, the video
is still playing. I cross verified the same url in browser, video is
pausing on screen lock.
I'm having the surfaceview object. So, is there any possibility to pause
and resume the mediaplayer upon screen lock?
Please help me out in finding the solution.
Regards,
Sha
Refresh materialized views: Concurrency, transactional behaviour
Refresh materialized views: Concurrency, transactional behaviour
The official PostgreSQL 9.3 documentation on REFRESH MATERIALIZED VIEW
does not yet describe it in detail.
A quote from this blog:
materialized views in Postgres 9.3 have a severe limitation consisting in
using an exclusive lock when refreshing it. This basically blocks any
attempts to read a materialized view while it is being refreshed with new
data from its parent relations
Another quote from a posting in the mailing list:
if I understand things correctly REFRESH MATERIALIZED VIEW locks the
materialized view with an AccessExclusiveLock even if the view already
contains data.
My question: Is the following sequence correct:
A query is accessing a materialized view
A job executes REFRESH MATERIALIZED VIEW. It puts a lock on the view, and
waits until all running queries using the matview have been completed
The matview is starting the refresh; if there is an index on the matview,
it is updated at the same time (so the complete refresh is taking place in
one transaction)
Queries using the matview are waiting until the refresh has been
completed. If this takes too long, there is something like a "waiting for
lock timeout error".
Refresh completes, the lock is removed
Queries which have been waiting for the matview continue
The official PostgreSQL 9.3 documentation on REFRESH MATERIALIZED VIEW
does not yet describe it in detail.
A quote from this blog:
materialized views in Postgres 9.3 have a severe limitation consisting in
using an exclusive lock when refreshing it. This basically blocks any
attempts to read a materialized view while it is being refreshed with new
data from its parent relations
Another quote from a posting in the mailing list:
if I understand things correctly REFRESH MATERIALIZED VIEW locks the
materialized view with an AccessExclusiveLock even if the view already
contains data.
My question: Is the following sequence correct:
A query is accessing a materialized view
A job executes REFRESH MATERIALIZED VIEW. It puts a lock on the view, and
waits until all running queries using the matview have been completed
The matview is starting the refresh; if there is an index on the matview,
it is updated at the same time (so the complete refresh is taking place in
one transaction)
Queries using the matview are waiting until the refresh has been
completed. If this takes too long, there is something like a "waiting for
lock timeout error".
Refresh completes, the lock is removed
Queries which have been waiting for the matview continue
Encoding JSON as an object, even when it has a zero-index
Encoding JSON as an object, even when it has a zero-index
I have an array that might look something like this:
array(
1 => "foo",
4 => "bar"
)
When I json_encode it, it turns out something like this:
{
"1": "foo",
"4": "bar"
}
That's exactly how I need it.
However, there is the possibility that the array would look like this:
array(
0 => "baz"
)
In which case I would want the JSON to end up like this:
{
"0": "baz"
}
But instead, it ends up like this:
[
"baz"
]
Is there any way I can force the JSON encoder to assume that this is an
object instead of an array?
EDIT: Sorry, I simplified it for this post, but I realise now it's quite
important: This array is nested in another array, which must be an array,
not an object.
EDIT 2: Example of this:
array(
0 => array(
0: "baz"
),
1 => array(
4: "bar"
)
)
needs to become:
[
{
0: "baz"
},
{
4: "bar"
}
]
I have an array that might look something like this:
array(
1 => "foo",
4 => "bar"
)
When I json_encode it, it turns out something like this:
{
"1": "foo",
"4": "bar"
}
That's exactly how I need it.
However, there is the possibility that the array would look like this:
array(
0 => "baz"
)
In which case I would want the JSON to end up like this:
{
"0": "baz"
}
But instead, it ends up like this:
[
"baz"
]
Is there any way I can force the JSON encoder to assume that this is an
object instead of an array?
EDIT: Sorry, I simplified it for this post, but I realise now it's quite
important: This array is nested in another array, which must be an array,
not an object.
EDIT 2: Example of this:
array(
0 => array(
0: "baz"
),
1 => array(
4: "bar"
)
)
needs to become:
[
{
0: "baz"
},
{
4: "bar"
}
]
Saturday, 14 September 2013
Unsigned Char Values in String
Unsigned Char Values in String
char takes values in the range of -128 to 127. By simply putting unsigned
before char the range changes to 0-255. How to achieve the same effect in
a string? So that all chars in that string take values from 0-255?
char takes values in the range of -128 to 127. By simply putting unsigned
before char the range changes to 0-255. How to achieve the same effect in
a string? So that all chars in that string take values from 0-255?
How to find x to make sure sum(row[i])-sum(clo[i])=bi in python?
How to find x to make sure sum(row[i])-sum(clo[i])=bi in python?
Suppose I have a matix
x = [[x00,x01,x02,x03],
[x10,x11,x12,x13],
[x20,x21,x22,x23],
[x30,x31,x32,x33]]
x[i][j]>=0
b = [5,-4,5,-6]
I am looking for an easy way to find out each value for x to make sure that
x[i][0]+x[i][1]+x[i][2]+x[i][3]-x[0][i]-x[1][i]-x[2][i]-x[3][i] == b[i]
I have tried many methods, but all failed. Thank you.
Suppose I have a matix
x = [[x00,x01,x02,x03],
[x10,x11,x12,x13],
[x20,x21,x22,x23],
[x30,x31,x32,x33]]
x[i][j]>=0
b = [5,-4,5,-6]
I am looking for an easy way to find out each value for x to make sure that
x[i][0]+x[i][1]+x[i][2]+x[i][3]-x[0][i]-x[1][i]-x[2][i]-x[3][i] == b[i]
I have tried many methods, but all failed. Thank you.
Storing secret data inside session
Storing secret data inside session
I have backend app in which I am using passport.js like this:
passport.use(new LocalStrategy({
usernameField: 'login',
passwordField: 'passwd'
},function(username, password, done){
// call to external api to check if login & passwd are correct
var user = { user: username, passwd: password };
return done(null,user);
}));
passport.serializeUser(function(user, done) {
done(null,user);
});
passport.deserializeUser(function(id, done) {
done(null,id);
});
The problem is that I use username and password fields for basicAuth to
communicate with main REST API. So I have to keep both fields (username
and password) inside session (u can see this in my localstrategy callback)
to use them for basicAuth for external server. How I can make it safe? I
guess that storing it inside session is not a good idea because session is
saved in cookie right? How I can store session data on server and just
session/user id on server?
I have backend app in which I am using passport.js like this:
passport.use(new LocalStrategy({
usernameField: 'login',
passwordField: 'passwd'
},function(username, password, done){
// call to external api to check if login & passwd are correct
var user = { user: username, passwd: password };
return done(null,user);
}));
passport.serializeUser(function(user, done) {
done(null,user);
});
passport.deserializeUser(function(id, done) {
done(null,id);
});
The problem is that I use username and password fields for basicAuth to
communicate with main REST API. So I have to keep both fields (username
and password) inside session (u can see this in my localstrategy callback)
to use them for basicAuth for external server. How I can make it safe? I
guess that storing it inside session is not a good idea because session is
saved in cookie right? How I can store session data on server and just
session/user id on server?
iOS managing compressed tracks playing at the same time
iOS managing compressed tracks playing at the same time
I am the Sound Designer for an iOS game and I am facing the problem of
optimizing space in MB for the sound I am creating. I do not have a lot of
space compared to the amount of sound I want to create for the game. A
typical sound scene will be composed of various layers, generally like
this:
Music
Background Ambiences
Cyclic Sound 1
Cyclic Sound 2
Sound Triggered by the User 1
Sound Triggered by the User 2
The obvious approach would be to compress everything in MP3 or AAC but as
far as I know only one track is processed by a dedicated hardware at the
same moment, the rest of the sound playing in compressed format are going
to eat CPU resources that the game engine is using. The game is not heavy
on CPU, it is not animated but mainly with static images, I know that I
should discuss this with the developer but he does not know a lot about
audio codec and quality, so I would like to meet him with something that
will not ruin the CPU and at the same time allow me to put a lot of
quality in the sound.
I would go like this:
Music -- mp3
Background Ambiences -- mp3
Cyclic Sound 1 -- mp3
Cyclic Sound 2 -- mp3
Sound Triggered by the User 1 -- Wav
Sound Triggered by the User 2 -- Wav
Do you think this solution is suitable from a developer perspective?
I am the Sound Designer for an iOS game and I am facing the problem of
optimizing space in MB for the sound I am creating. I do not have a lot of
space compared to the amount of sound I want to create for the game. A
typical sound scene will be composed of various layers, generally like
this:
Music
Background Ambiences
Cyclic Sound 1
Cyclic Sound 2
Sound Triggered by the User 1
Sound Triggered by the User 2
The obvious approach would be to compress everything in MP3 or AAC but as
far as I know only one track is processed by a dedicated hardware at the
same moment, the rest of the sound playing in compressed format are going
to eat CPU resources that the game engine is using. The game is not heavy
on CPU, it is not animated but mainly with static images, I know that I
should discuss this with the developer but he does not know a lot about
audio codec and quality, so I would like to meet him with something that
will not ruin the CPU and at the same time allow me to put a lot of
quality in the sound.
I would go like this:
Music -- mp3
Background Ambiences -- mp3
Cyclic Sound 1 -- mp3
Cyclic Sound 2 -- mp3
Sound Triggered by the User 1 -- Wav
Sound Triggered by the User 2 -- Wav
Do you think this solution is suitable from a developer perspective?
declares encoding of own file?
declares encoding of own file?
I read that an HTML file has to contain the <meta charset="utf-8">element
in the head-element to be standard-conforming.
Concerning this, I have the following questions:
Why does it make sense to specifiy the encoding of a file in the file
itself? In order to read the meta-element one has to know the encoding
already; so it seems redundant/useless to specify the encoding again.
I read that an HTML file has to contain the <meta charset="utf-8">element
in the head-element to be standard-conforming.
Concerning this, I have the following questions:
Why does it make sense to specifiy the encoding of a file in the file
itself? In order to read the meta-element one has to know the encoding
already; so it seems redundant/useless to specify the encoding again.
Making same android activity class as a service ondestroy
Making same android activity class as a service ondestroy
This is an application that measures the sound intensity and in accordance
with that measured value it sets the seek bar and in turn it adjusts the
ringer volume in accordance with the seek bar automatically.
I want to run this application in foreground as well as in background when
user destroys it. Because the user will definately be needing the app even
after he quits it. I have read the documentation of creating a service but
the problem is i want full code same as activity to be run in the
background after the app destroyal..So any help would be greatly
appreciated.
package com.example.soundmeter;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.TextView;
import android.content.Context;
import android.media.AudioManager;
import android.view.KeyEvent;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import com.example.soundmeter.R;
public class MainActivity extends Activity {
//public static boolean isService = false;
TextView mStatusView;
MediaRecorder mRecorder;
Thread runner;
private static double mEMA = 0.0;
static final private double EMA_FILTER = 0.6;
//a variable to store the seek bar from the XML file
public SeekBar volumeBar;
//an AudioManager object, to change the volume settings
private AudioManager amanager;
final Runnable updater = new Runnable(){
public void run(){
updateTv();
};
};
final Handler mHandler = new Handler();
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.main);
super.onCreate(savedInstanceState);
mStatusView = (TextView) findViewById(R.id.status);
//startService(new Intent(MainActivity.this,BackGroundService.class));
if (runner == null)
{
runner = new Thread(){
public void run()
{
while (runner != null)
{
volumeChanger();
try
{
Thread.sleep(5000);
Log.i("Noise", "Tock");
} catch (InterruptedException e) { };
mHandler.post(updater);
}
}
};
runner.start();
Log.d("Noise", "start runner()");
}
}
public void onResume()
{
super.onResume();
startRecorder();
}
public void onPause()
{
super.onResume();
startRecorder();
//super.onPause();
//super.stopRecorder();
}
/*@Override
public void onBackPressed()
{
super.onResume();
startRecorder();
}*/
public void startRecorder(){
if (mRecorder == null)
{
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile("/dev/null");
try
{
mRecorder.prepare();
}catch (java.io.IOException ioe) {
android.util.Log.e("[Monkey]", "IOException: " +
android.util.Log.getStackTraceString(ioe));
}catch (java.lang.SecurityException e) {
android.util.Log.e("[Monkey]", "SecurityException: " +
android.util.Log.getStackTraceString(e));
}
try
{
mRecorder.start();
}catch (java.lang.SecurityException e) {
android.util.Log.e("[Monkey]", "SecurityException: " +
android.util.Log.getStackTraceString(e));
}
//mEMA = 0.0;
}
}
/*public void stopRecorder() {
if (mRecorder != null) {
mRecorder.stop();
mRecorder.release();
mRecorder = null;
}
}*/
public void updateTv(){
double amp=getAmplitudeEMA();
mStatusView.setText(Double.toString((amp)) + " dB");
}
public double soundDb(double ampl){
double intensity=20 * Math.log10(getAmplitudeEMA() / ampl);
return intensity;
}
public double getAmplitude() {
if (mRecorder != null)
return (mRecorder.getMaxAmplitude());
else
return 0;
}
public double getAmplitudeEMA() {
double amp = getAmplitude();
mEMA = EMA_FILTER * amp + (1.0 - EMA_FILTER) * mEMA;
return mEMA;
}
public void volumeChanger()
{
volumeBar = (SeekBar) findViewById(R.id.sb_volumebar);
//get the audio manager
amanager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
//seek bar settings//
//sets the range between 0 and the max volume
volumeBar.setMax(amanager.getStreamMaxVolume(AudioManager.STREAM_RING));
//set the seek bar progress to 1
//volumeBar.setKeyProgressIncrement(1);
//sets the progress of the seek bar based on the system's volume
// volumeBar.setProgress(500);
if(mEMA<(double)800.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)/5);
}
else if(mEMA<(double)15000.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)*2/5);
}
else if(mEMA<25000.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)*3/5);
}
else if(mEMA<50000.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)*4/5);
}
else
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING));
}
//register OnSeekBarChangeListener, so that the seek bar can change
the volume
volumeBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
{
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
int index=volumeBar.getProgress();
//change the volume, displaying a toast message containing
the current volume and playing a feedback sound
amanager.setStreamVolume(AudioManager.STREAM_RING, index,
AudioManager.FLAG_SHOW_UI);
}
});
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
//if one of the volume keys were pressed
if(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode ==
KeyEvent.KEYCODE_VOLUME_UP)
{
//change the seek bar progress indicator position
volumeBar.setProgress(amanager.getStreamVolume(AudioManager.STREAM_RING));
}
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
return true;
}
//propagate the key event
return super.onKeyDown(keyCode, event);
}
}
This is an application that measures the sound intensity and in accordance
with that measured value it sets the seek bar and in turn it adjusts the
ringer volume in accordance with the seek bar automatically.
I want to run this application in foreground as well as in background when
user destroys it. Because the user will definately be needing the app even
after he quits it. I have read the documentation of creating a service but
the problem is i want full code same as activity to be run in the
background after the app destroyal..So any help would be greatly
appreciated.
package com.example.soundmeter;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.TextView;
import android.content.Context;
import android.media.AudioManager;
import android.view.KeyEvent;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import com.example.soundmeter.R;
public class MainActivity extends Activity {
//public static boolean isService = false;
TextView mStatusView;
MediaRecorder mRecorder;
Thread runner;
private static double mEMA = 0.0;
static final private double EMA_FILTER = 0.6;
//a variable to store the seek bar from the XML file
public SeekBar volumeBar;
//an AudioManager object, to change the volume settings
private AudioManager amanager;
final Runnable updater = new Runnable(){
public void run(){
updateTv();
};
};
final Handler mHandler = new Handler();
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.main);
super.onCreate(savedInstanceState);
mStatusView = (TextView) findViewById(R.id.status);
//startService(new Intent(MainActivity.this,BackGroundService.class));
if (runner == null)
{
runner = new Thread(){
public void run()
{
while (runner != null)
{
volumeChanger();
try
{
Thread.sleep(5000);
Log.i("Noise", "Tock");
} catch (InterruptedException e) { };
mHandler.post(updater);
}
}
};
runner.start();
Log.d("Noise", "start runner()");
}
}
public void onResume()
{
super.onResume();
startRecorder();
}
public void onPause()
{
super.onResume();
startRecorder();
//super.onPause();
//super.stopRecorder();
}
/*@Override
public void onBackPressed()
{
super.onResume();
startRecorder();
}*/
public void startRecorder(){
if (mRecorder == null)
{
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile("/dev/null");
try
{
mRecorder.prepare();
}catch (java.io.IOException ioe) {
android.util.Log.e("[Monkey]", "IOException: " +
android.util.Log.getStackTraceString(ioe));
}catch (java.lang.SecurityException e) {
android.util.Log.e("[Monkey]", "SecurityException: " +
android.util.Log.getStackTraceString(e));
}
try
{
mRecorder.start();
}catch (java.lang.SecurityException e) {
android.util.Log.e("[Monkey]", "SecurityException: " +
android.util.Log.getStackTraceString(e));
}
//mEMA = 0.0;
}
}
/*public void stopRecorder() {
if (mRecorder != null) {
mRecorder.stop();
mRecorder.release();
mRecorder = null;
}
}*/
public void updateTv(){
double amp=getAmplitudeEMA();
mStatusView.setText(Double.toString((amp)) + " dB");
}
public double soundDb(double ampl){
double intensity=20 * Math.log10(getAmplitudeEMA() / ampl);
return intensity;
}
public double getAmplitude() {
if (mRecorder != null)
return (mRecorder.getMaxAmplitude());
else
return 0;
}
public double getAmplitudeEMA() {
double amp = getAmplitude();
mEMA = EMA_FILTER * amp + (1.0 - EMA_FILTER) * mEMA;
return mEMA;
}
public void volumeChanger()
{
volumeBar = (SeekBar) findViewById(R.id.sb_volumebar);
//get the audio manager
amanager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
//seek bar settings//
//sets the range between 0 and the max volume
volumeBar.setMax(amanager.getStreamMaxVolume(AudioManager.STREAM_RING));
//set the seek bar progress to 1
//volumeBar.setKeyProgressIncrement(1);
//sets the progress of the seek bar based on the system's volume
// volumeBar.setProgress(500);
if(mEMA<(double)800.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)/5);
}
else if(mEMA<(double)15000.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)*2/5);
}
else if(mEMA<25000.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)*3/5);
}
else if(mEMA<50000.00)
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING)*4/5);
}
else
{
volumeBar.setProgress((int)amanager.getStreamMaxVolume(AudioManager.STREAM_RING));
}
//register OnSeekBarChangeListener, so that the seek bar can change
the volume
volumeBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
{
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
int index=volumeBar.getProgress();
//change the volume, displaying a toast message containing
the current volume and playing a feedback sound
amanager.setStreamVolume(AudioManager.STREAM_RING, index,
AudioManager.FLAG_SHOW_UI);
}
});
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
//if one of the volume keys were pressed
if(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode ==
KeyEvent.KEYCODE_VOLUME_UP)
{
//change the seek bar progress indicator position
volumeBar.setProgress(amanager.getStreamVolume(AudioManager.STREAM_RING));
}
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
return true;
}
//propagate the key event
return super.onKeyDown(keyCode, event);
}
}
Friday, 13 September 2013
How to Edit CMSampleBufferRef
How to Edit CMSampleBufferRef
What Is CMSampleBufferRef I am getting CMSampleBufferRef as output in
avcamera.Actually I want to edit that and save how to do that can any one
please help me.Edit means add another image on that image.
What Is CMSampleBufferRef I am getting CMSampleBufferRef as output in
avcamera.Actually I want to edit that and save how to do that can any one
please help me.Edit means add another image on that image.
c() function in javscript, meaning?
c() function in javscript, meaning?
I was looking through the source code of a web page, and I came across
this JavaScript:
function fsb329142055() {
var b=new
Array(57,50,102,50,52,99,50,53,52,56,102,98,102,98,101,102,101,49,53,61,101,99,110,57,111,78,109,54,114,111,56,48,102,38,100,53,100,53,48,50,55,52,49,55,57,50,52,51,98,53,56,61,100,99,100,55,73,116,97,53,53,115,105,108,100,55,116,105,104,38,53,116,104,38,103,104,105,102,61,61,98,110,111,105,116,99,97,38,112,50,51,104,112,46,116,50,104,99,103,105,56,102,51,61,98,50,53,51,49,56,97,101,57,116,54,49,63,100,52,97,100,112,104,97,112,46,116,115,102,56,51,105,108,98,52,116,52,53,105,104,100,97,47,101,98,98,52,100,97,57,99,99,54);
var p=new
Array(0,0,1,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,1,1,0,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0);
window.location = c(b,p);
return false;
}
This function is called here:
<a
href="/hitlist.php?tab=fight.php&action=fight&hitlistId=329142055&formNonce=1eb542f92c248ffbfe59680dd774b58dc7a55d75&h=284e4fe4946e6fb8af3a662f4583454eebc8bd23"
onclick="return fsb329142055();">
<div class="fightActionInner"><div
class="fightActionInnerInner">Attack</div> </div>
</a>
Specifically, I'm wondering what the window.location = c(b,p); is.
People are saying it is a function, but I dont see it anywhere in the
source code: `
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=UTF-8"/>
<meta name="viewport"
content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no"/>
<link rel="stylesheet" type="text/css"
href="http://static.storm8.com/im/css/global.css?v=330"/>
<script type="text/javascript"
src="http://static.storm8.com/im/js/global.js?v=330"></script> <script
type="text/javascript"
src="http://static.storm8.com/im/js/equipment.js?v=330"></script>
<title>Add the Hit List</title>
<script>
function s8Ajax(url) {
window.location.href = url;
}
</script>
</head>
<body style="; width: 100%;" class="portrait" data-promo-button="">
<div id="fb-root"></div>
<div id="contentParent">
<div id="contentChild" style="">
<div id="SCROLL_CONTENT"><div id="scrollContentChild"><div>
<div id="overlay" class="dialogOverlay"></div>
<script type="text/javascript">
window.isAndroid = false;
window.isFacebook = false;
</script>
<div id="topBar" class="topBar"><div class="topBarBg"></div><div
id="inner-topbar"><a
href="/bank.php?formNonce=81668c46988c486ed2d1d0b1f7e31f16d41c093c&setTab1Badge=&h=da793b290e598f2e0823e93dbab769b0736a7557"><div
class="cashTopArea">
<span class="topBarCash">$<span id="cashCurrent"
style="white-space:nowrap">138,136,907</span></span>
</div>
<div id="cashTimerDiv" class="cashBottomArea"><span
style="font-size: 11px; font-weight: normal;"><span>+<span
style="white-space: nowrap;">255,350</span></span> in </span><span
id="cashType"
style="font-size:11px;font-weight:normal;">59:05</span></div></a><div
class="levelTopArea">
<div class="levelBgTopArea"></div>
<div class="levelFrontTopArea"><a style="text-decoration:none"
href="/profile.php?formNonce=81668c46988c486ed2d1d0b1f7e31f16d41c093c&setTab1Badge=&h=dc3aa8ea9e33fff4ea763e4556ad5e0ca2718a3b">31</a></div>
</div>
<div class="levelBottomArea">
Level
</div><div class="levelBarTopArea">
<div class="levelBar" style="width:90px">
<div class="bgLevelBar" style="width:90px"><div id="expBar"
class="frontLevelBar" style="width:36px"> </div>
</div>
</div>
</div>
<div class="levelBarBottomArea">
Exp: <span id="expText">5793/5993</span>
</div>
<a href="/favor.php?"><div class="energyAreaContainer"><table
class="statTable"><tr><td class="statTableIcon"><div></div></td>
<td class="statTableInBetween"></td>
<td class="statTableInfo">
<div class="statTopArea">
<span id="energyCurrent" class="statEmphasis">75</span> /
<span id="energyMax">75</span></div>
<div id="energyTimerDiv" class="statBottomArea"><span
id="energyType"
style="font-size:11px;font-weight:normal;">Energy</span></div></td></tr></table></div></a>
<a href="/hospital.php?"><div class="healthAreaContainer"><table
class="statTable"><tr><td class="statTableIcon"><div></div></td>
<td class="statTableInBetween"></td>
<td class="statTableInfo">
<div class="statTopArea">
<span id="healthCurrent" class="statEmphasis">100</span> /
<span id="healthMax">100</span></div>
<div id="healthTimerDiv" class="statBottomArea"><span
id="healthType"
style="font-size:11px;font-weight:normal;">Health</span></div></td></tr></table></div></a>
<a href="/favor.php?"><div class="staminaAreaContainer"><table
class="statTable"><tr><td class="statTableIcon"><div></div></td>
<td class="statTableInBetween"></td>
<td class="statTableInfo">
<div class="statTopArea">
<span id="staminaCurrent" class="statEmphasis">5</span> /
<span id="staminaMax">5</span></div>
<div id="staminaTimerDiv" class="statBottomArea"><span
id="staminaType"
style="font-size:11px;font-weight:normal;">Stamina</span></div></td></tr></table></div></a></div><script>
setTopBarTimerData({"cash":{"page":"\/bank.php?","text":"Cash","timeLeft":3545,"value":138136907,"maxValue":999999999999,"rate":3600,"update":255350},"energy":{"page":"\/favor.php?","text":"Energy","timeLeft":-1,"value":75,"maxValue":"75","rate":240,"update":1},"health":{"page":"\/hospital.php?","text":"Health","timeLeft":-1,"value":100,"maxValue":"100","rate":180,"update":1},"stamina":{"page":"\/favor.php?","text":"Stamina","timeLeft":-1,"value":5,"maxValue":"5","rate":120,"update":1},"experience":{"width":90,"value":"5793","previousLevelValue":5658,"nextLevelValue":5993}});
createTopBarTimer();
</script></div></div><link rel="stylesheet" type="text/css"
href="http://static.storm8.com/im/css/bounty.css?v=330"/>
<div class="section">
<div class="sectionHeader">
Add "Raͭgͪnͤa͠rok" to the Hit List</div>
<div class="sectionBar"></div><div class="sectionContent">
<script>
function fsb10213841(x) {
var b=new
Array(49,100,50,100,100,48,98,101,54,49,102,56,55,101,52,99,56,56,57,51,54,52,49,99,56,102,49,54,100,54,54,52,49,49,56,99,61,101,99,110,48,111,78,57,51,99,38,109,104,61,114,50,50,51,111,102,38,57,52,49,52,51,57,102,56,51,49,98,51,50,50,51,57,48,49,61,51,48,48,54,100,105,95,53,57,116,51,97,57,99,97,115,56,57,54,105,54,108,51,116,105,51,49,49,101,48,99,104,54,100,63,112,104,112,46,121,116,110,117,111,98);
var p=new
Array(1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,1,0,1,0,1,1,1,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1);
var bountyForm = document.getElementById('bountyForm');
bountyForm.action = c(b,p) + x;
return true;
}
</script>
<form id="bountyForm" method="post" onsubmit="return
fsb10213841('373');"
action="/bounty.php?hitlist_id=10213841&formNonce=81668c46988c486ed2d1d0b1f7e31f16d41c093c&h=284e4fe4946e6fb8af3a662f4583454eebc8bd23">
<ul>
<li>The minimum bounty amount is <span style="white-space:
nowrap;">$10,000</span>.</li>
<li>A 15% fee will be charged to safeguard the bounty.</li>
</ul>
<br/>
<table>
<tr>
<td class="bountyLabel">Bounty Amount:</td>
<td>
<input type="text" name="bountyValue" size=25 class="medTextField">
<br/>
<div style="height:6px"> </div>
<input type="submit" value="Place Bounty" name="action" class="btnMed
btnBroadcast">
</td>
</tr>
</table>
</form>
</div>
</div>
</div></div><br/><br/><script> window.onload = function() {
window.location.href =
"#&setTab0Badge=&changeApplicationBadge=0&setTab4Badge=1";}</script></div></body></html>
I was looking through the source code of a web page, and I came across
this JavaScript:
function fsb329142055() {
var b=new
Array(57,50,102,50,52,99,50,53,52,56,102,98,102,98,101,102,101,49,53,61,101,99,110,57,111,78,109,54,114,111,56,48,102,38,100,53,100,53,48,50,55,52,49,55,57,50,52,51,98,53,56,61,100,99,100,55,73,116,97,53,53,115,105,108,100,55,116,105,104,38,53,116,104,38,103,104,105,102,61,61,98,110,111,105,116,99,97,38,112,50,51,104,112,46,116,50,104,99,103,105,56,102,51,61,98,50,53,51,49,56,97,101,57,116,54,49,63,100,52,97,100,112,104,97,112,46,116,115,102,56,51,105,108,98,52,116,52,53,105,104,100,97,47,101,98,98,52,100,97,57,99,99,54);
var p=new
Array(0,0,1,1,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,1,1,0,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0);
window.location = c(b,p);
return false;
}
This function is called here:
<a
href="/hitlist.php?tab=fight.php&action=fight&hitlistId=329142055&formNonce=1eb542f92c248ffbfe59680dd774b58dc7a55d75&h=284e4fe4946e6fb8af3a662f4583454eebc8bd23"
onclick="return fsb329142055();">
<div class="fightActionInner"><div
class="fightActionInnerInner">Attack</div> </div>
</a>
Specifically, I'm wondering what the window.location = c(b,p); is.
People are saying it is a function, but I dont see it anywhere in the
source code: `
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=UTF-8"/>
<meta name="viewport"
content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no"/>
<link rel="stylesheet" type="text/css"
href="http://static.storm8.com/im/css/global.css?v=330"/>
<script type="text/javascript"
src="http://static.storm8.com/im/js/global.js?v=330"></script> <script
type="text/javascript"
src="http://static.storm8.com/im/js/equipment.js?v=330"></script>
<title>Add the Hit List</title>
<script>
function s8Ajax(url) {
window.location.href = url;
}
</script>
</head>
<body style="; width: 100%;" class="portrait" data-promo-button="">
<div id="fb-root"></div>
<div id="contentParent">
<div id="contentChild" style="">
<div id="SCROLL_CONTENT"><div id="scrollContentChild"><div>
<div id="overlay" class="dialogOverlay"></div>
<script type="text/javascript">
window.isAndroid = false;
window.isFacebook = false;
</script>
<div id="topBar" class="topBar"><div class="topBarBg"></div><div
id="inner-topbar"><a
href="/bank.php?formNonce=81668c46988c486ed2d1d0b1f7e31f16d41c093c&setTab1Badge=&h=da793b290e598f2e0823e93dbab769b0736a7557"><div
class="cashTopArea">
<span class="topBarCash">$<span id="cashCurrent"
style="white-space:nowrap">138,136,907</span></span>
</div>
<div id="cashTimerDiv" class="cashBottomArea"><span
style="font-size: 11px; font-weight: normal;"><span>+<span
style="white-space: nowrap;">255,350</span></span> in </span><span
id="cashType"
style="font-size:11px;font-weight:normal;">59:05</span></div></a><div
class="levelTopArea">
<div class="levelBgTopArea"></div>
<div class="levelFrontTopArea"><a style="text-decoration:none"
href="/profile.php?formNonce=81668c46988c486ed2d1d0b1f7e31f16d41c093c&setTab1Badge=&h=dc3aa8ea9e33fff4ea763e4556ad5e0ca2718a3b">31</a></div>
</div>
<div class="levelBottomArea">
Level
</div><div class="levelBarTopArea">
<div class="levelBar" style="width:90px">
<div class="bgLevelBar" style="width:90px"><div id="expBar"
class="frontLevelBar" style="width:36px"> </div>
</div>
</div>
</div>
<div class="levelBarBottomArea">
Exp: <span id="expText">5793/5993</span>
</div>
<a href="/favor.php?"><div class="energyAreaContainer"><table
class="statTable"><tr><td class="statTableIcon"><div></div></td>
<td class="statTableInBetween"></td>
<td class="statTableInfo">
<div class="statTopArea">
<span id="energyCurrent" class="statEmphasis">75</span> /
<span id="energyMax">75</span></div>
<div id="energyTimerDiv" class="statBottomArea"><span
id="energyType"
style="font-size:11px;font-weight:normal;">Energy</span></div></td></tr></table></div></a>
<a href="/hospital.php?"><div class="healthAreaContainer"><table
class="statTable"><tr><td class="statTableIcon"><div></div></td>
<td class="statTableInBetween"></td>
<td class="statTableInfo">
<div class="statTopArea">
<span id="healthCurrent" class="statEmphasis">100</span> /
<span id="healthMax">100</span></div>
<div id="healthTimerDiv" class="statBottomArea"><span
id="healthType"
style="font-size:11px;font-weight:normal;">Health</span></div></td></tr></table></div></a>
<a href="/favor.php?"><div class="staminaAreaContainer"><table
class="statTable"><tr><td class="statTableIcon"><div></div></td>
<td class="statTableInBetween"></td>
<td class="statTableInfo">
<div class="statTopArea">
<span id="staminaCurrent" class="statEmphasis">5</span> /
<span id="staminaMax">5</span></div>
<div id="staminaTimerDiv" class="statBottomArea"><span
id="staminaType"
style="font-size:11px;font-weight:normal;">Stamina</span></div></td></tr></table></div></a></div><script>
setTopBarTimerData({"cash":{"page":"\/bank.php?","text":"Cash","timeLeft":3545,"value":138136907,"maxValue":999999999999,"rate":3600,"update":255350},"energy":{"page":"\/favor.php?","text":"Energy","timeLeft":-1,"value":75,"maxValue":"75","rate":240,"update":1},"health":{"page":"\/hospital.php?","text":"Health","timeLeft":-1,"value":100,"maxValue":"100","rate":180,"update":1},"stamina":{"page":"\/favor.php?","text":"Stamina","timeLeft":-1,"value":5,"maxValue":"5","rate":120,"update":1},"experience":{"width":90,"value":"5793","previousLevelValue":5658,"nextLevelValue":5993}});
createTopBarTimer();
</script></div></div><link rel="stylesheet" type="text/css"
href="http://static.storm8.com/im/css/bounty.css?v=330"/>
<div class="section">
<div class="sectionHeader">
Add "Raͭgͪnͤa͠rok" to the Hit List</div>
<div class="sectionBar"></div><div class="sectionContent">
<script>
function fsb10213841(x) {
var b=new
Array(49,100,50,100,100,48,98,101,54,49,102,56,55,101,52,99,56,56,57,51,54,52,49,99,56,102,49,54,100,54,54,52,49,49,56,99,61,101,99,110,48,111,78,57,51,99,38,109,104,61,114,50,50,51,111,102,38,57,52,49,52,51,57,102,56,51,49,98,51,50,50,51,57,48,49,61,51,48,48,54,100,105,95,53,57,116,51,97,57,99,97,115,56,57,54,105,54,108,51,116,105,51,49,49,101,48,99,104,54,100,63,112,104,112,46,121,116,110,117,111,98);
var p=new
Array(1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,1,0,1,0,1,1,1,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1);
var bountyForm = document.getElementById('bountyForm');
bountyForm.action = c(b,p) + x;
return true;
}
</script>
<form id="bountyForm" method="post" onsubmit="return
fsb10213841('373');"
action="/bounty.php?hitlist_id=10213841&formNonce=81668c46988c486ed2d1d0b1f7e31f16d41c093c&h=284e4fe4946e6fb8af3a662f4583454eebc8bd23">
<ul>
<li>The minimum bounty amount is <span style="white-space:
nowrap;">$10,000</span>.</li>
<li>A 15% fee will be charged to safeguard the bounty.</li>
</ul>
<br/>
<table>
<tr>
<td class="bountyLabel">Bounty Amount:</td>
<td>
<input type="text" name="bountyValue" size=25 class="medTextField">
<br/>
<div style="height:6px"> </div>
<input type="submit" value="Place Bounty" name="action" class="btnMed
btnBroadcast">
</td>
</tr>
</table>
</form>
</div>
</div>
</div></div><br/><br/><script> window.onload = function() {
window.location.href =
"#&setTab0Badge=&changeApplicationBadge=0&setTab4Badge=1";}</script></div></body></html>
css styling for jcarouselLite
css styling for jcarouselLite
I've got a problem styling jCarouselLite and I cannot figure out how to
fix it. There is a jfiddle here:
jsfiddle
Basically I have a bunch of images that are 290w x 390h and I want 2 to
show at a time. When I do that, and use the css I have now, the next and
prev button get shoved up top. Simply increasing the width of #slider1
does not solve that.
Here is the relevant html:
<div id="slider1">
<a class="buttons prev" href="#">left</a>
<div class="viewport">
<ul class="overview">
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
</ul>
</div>
<a class="buttons next" href="#">right</a>
</div>
and my css: (i used red and blue backgrounds so things would show up better)
#slider1 { height: 480px; overflow:hidden; width: 720px; background: red;
margin:auto; }
#slider1 .viewport { width: 680px; height: 480px; overflow: hidden;
position: relative; background: blue;}
#slider1 .buttons { background:url("../images/buttons.png") no-repeat
scroll 0 0 transparent; display: block; margin: 30px 10px 0 0; }
#slider1 .next { margin: 30px 0 0 10px; }
#slider1 .disable { visibility: hidden; }
#slider1 .overview { list-style: none; position: absolute; padding: 0;
margin: 0; left: 0; top: 0; width: 600px; }
#slider1 .overview li{ float: left; margin: 0 20px 0 0; padding: 1px;
height: 390px; border: 1px solid #dcdcdc; width: 290px;}
Can anyone offer help? This is a great small plugin, but not very much
documentation! Tx.
I've got a problem styling jCarouselLite and I cannot figure out how to
fix it. There is a jfiddle here:
jsfiddle
Basically I have a bunch of images that are 290w x 390h and I want 2 to
show at a time. When I do that, and use the css I have now, the next and
prev button get shoved up top. Simply increasing the width of #slider1
does not solve that.
Here is the relevant html:
<div id="slider1">
<a class="buttons prev" href="#">left</a>
<div class="viewport">
<ul class="overview">
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
<li><img src="http://tinyurl.com/pewde8e" /></li>
</ul>
</div>
<a class="buttons next" href="#">right</a>
</div>
and my css: (i used red and blue backgrounds so things would show up better)
#slider1 { height: 480px; overflow:hidden; width: 720px; background: red;
margin:auto; }
#slider1 .viewport { width: 680px; height: 480px; overflow: hidden;
position: relative; background: blue;}
#slider1 .buttons { background:url("../images/buttons.png") no-repeat
scroll 0 0 transparent; display: block; margin: 30px 10px 0 0; }
#slider1 .next { margin: 30px 0 0 10px; }
#slider1 .disable { visibility: hidden; }
#slider1 .overview { list-style: none; position: absolute; padding: 0;
margin: 0; left: 0; top: 0; width: 600px; }
#slider1 .overview li{ float: left; margin: 0 20px 0 0; padding: 1px;
height: 390px; border: 1px solid #dcdcdc; width: 290px;}
Can anyone offer help? This is a great small plugin, but not very much
documentation! Tx.
(Limited) Java extension function support in XSLT
(Limited) Java extension function support in XSLT
I've long made do with the default XML libraries provided by Java
(Xerces2-J and Xalan-J) - occasionally and directly using the latest
versions of those libraries directly when needed. It appears I'm running
up against some of the limits of these libraries - especially with Xalan-J
that is really no longer being maintained and without a release for almost
6 years...
I need to provide some custom functions to pull information from external
services when called, so they must be implemented in Java. (I.E., I can't
implement them within the XSLT itself, as either XSLT or JavaScript
functions, etc.) I've done this before using Xalan-Java Extensions.
However, providing this seems to be either allow-all or nothing:
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200911/msg00198.html
http://marc.info/?l=xalan-j-users&m=123750821029013
https://issues.apache.org/jira/browse/XALANJ-1850
I need to be able to provide access to a Java extension - but without
allowing any arbitrary calls out to Java (think of an embedded call to
System.exit(), for example), and ideally, without the XSLT authors even
needing to know that it is a Java function (by use of
xmlns:java="http://xml.apache.org/xalan/java", for example). Ideally, I'd
also be able to keep
TransformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
true);.
I can do (almost) exactly what I'm looking for using
XPath.setXPathFunctionResolver, but this only works for direct XPath calls
- and I've not found a way to set a custom XPath for use in XSLT by Xalan.
(It also requires the FEATURE_SECURE_PROCESSING to not be set on the
XPathFactory, though I might be able to get away with having it set only
on the TransformerFactory - ignoring that if set on the
TransformerFactory, the TransformerFactory also automatically sets the
same flag on the XPathFactory that is uses.)
So I decided to give Saxon (Saxon-HE 9.5.1-1) a try - and am immediately
noticing 2 issues:
When just using XPath directly, XPath.setXPathFunctionResolver does not
seem to have any affect under Saxon. The set call completes without issue,
but resolveFunction on the passed-in XPathFunction is never even called
under Saxon. (It simply "just works" under Xalan.) Is there some
additional configuration necessary for Saxon - or is this maybe a
limitation of the HE version?
I've looked at
http://www.saxonica.com/documentation/#!extensibility/integratedfunctions/ext-simple-J
- which per the author, is provided for even under the HE version.
However, I can't see how to wire this into XSLT processing.
I've long made do with the default XML libraries provided by Java
(Xerces2-J and Xalan-J) - occasionally and directly using the latest
versions of those libraries directly when needed. It appears I'm running
up against some of the limits of these libraries - especially with Xalan-J
that is really no longer being maintained and without a release for almost
6 years...
I need to provide some custom functions to pull information from external
services when called, so they must be implemented in Java. (I.E., I can't
implement them within the XSLT itself, as either XSLT or JavaScript
functions, etc.) I've done this before using Xalan-Java Extensions.
However, providing this seems to be either allow-all or nothing:
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200911/msg00198.html
http://marc.info/?l=xalan-j-users&m=123750821029013
https://issues.apache.org/jira/browse/XALANJ-1850
I need to be able to provide access to a Java extension - but without
allowing any arbitrary calls out to Java (think of an embedded call to
System.exit(), for example), and ideally, without the XSLT authors even
needing to know that it is a Java function (by use of
xmlns:java="http://xml.apache.org/xalan/java", for example). Ideally, I'd
also be able to keep
TransformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
true);.
I can do (almost) exactly what I'm looking for using
XPath.setXPathFunctionResolver, but this only works for direct XPath calls
- and I've not found a way to set a custom XPath for use in XSLT by Xalan.
(It also requires the FEATURE_SECURE_PROCESSING to not be set on the
XPathFactory, though I might be able to get away with having it set only
on the TransformerFactory - ignoring that if set on the
TransformerFactory, the TransformerFactory also automatically sets the
same flag on the XPathFactory that is uses.)
So I decided to give Saxon (Saxon-HE 9.5.1-1) a try - and am immediately
noticing 2 issues:
When just using XPath directly, XPath.setXPathFunctionResolver does not
seem to have any affect under Saxon. The set call completes without issue,
but resolveFunction on the passed-in XPathFunction is never even called
under Saxon. (It simply "just works" under Xalan.) Is there some
additional configuration necessary for Saxon - or is this maybe a
limitation of the HE version?
I've looked at
http://www.saxonica.com/documentation/#!extensibility/integratedfunctions/ext-simple-J
- which per the author, is provided for even under the HE version.
However, I can't see how to wire this into XSLT processing.
How do we simulate switch case in Alloy?
How do we simulate switch case in Alloy?
I have an Alloy Model which needs to have some rules like
abstract sig country {}
one sig US extends country {}
one sig UK extends country {}
one sig DE extends country {}
one sig CA extends country {}
abstract sig currencyCode {}
one sig USD extends currencyCode {}
one sig GBP extends currencyCode {}
one sig CAD extends currencyCode {}
one sig EUR extends currencyCode {}
abstract sig location {}
one sig NewYork extends location {}
one sig Vancouver extends location {}
one sig London extends location {}
one sig Munich extends location {}
So I want to set up a rule, such that whenever the instance pick US, it
will also pick USD and NewYork. If it picks USD, then it will pick US and
NewYork, which means the country, location and currency will be grouped
together. I tried to use the following fact to do this, but it's not
working. What's the flaws in the fact and is there anyway to do this?
fact UKRL {
all a: itemType.site, b: item.country, c: item.currency, d:
startPrice.currencyId, e: item.locationLink |
(a in UK) <=> (b in UK) <=> (c in GBP) <=> (d in GBP) <=> (e in
London)
}
fact DERL {
all a: itemType.site, b: item.country, c: item.currency, d:
startPrice.currencyId, e: item.locationLink |
(a in DE) <=> (b in DE) <=> (c in EUR) <=> (d in EUR) <=> (e in
Munich)
}
I have an Alloy Model which needs to have some rules like
abstract sig country {}
one sig US extends country {}
one sig UK extends country {}
one sig DE extends country {}
one sig CA extends country {}
abstract sig currencyCode {}
one sig USD extends currencyCode {}
one sig GBP extends currencyCode {}
one sig CAD extends currencyCode {}
one sig EUR extends currencyCode {}
abstract sig location {}
one sig NewYork extends location {}
one sig Vancouver extends location {}
one sig London extends location {}
one sig Munich extends location {}
So I want to set up a rule, such that whenever the instance pick US, it
will also pick USD and NewYork. If it picks USD, then it will pick US and
NewYork, which means the country, location and currency will be grouped
together. I tried to use the following fact to do this, but it's not
working. What's the flaws in the fact and is there anyway to do this?
fact UKRL {
all a: itemType.site, b: item.country, c: item.currency, d:
startPrice.currencyId, e: item.locationLink |
(a in UK) <=> (b in UK) <=> (c in GBP) <=> (d in GBP) <=> (e in
London)
}
fact DERL {
all a: itemType.site, b: item.country, c: item.currency, d:
startPrice.currencyId, e: item.locationLink |
(a in DE) <=> (b in DE) <=> (c in EUR) <=> (d in EUR) <=> (e in
Munich)
}
Thursday, 12 September 2013
android-maven-: Disable debug build for apk
android-maven-: Disable debug build for apk
I am trying to upload an application to the Google Play store. I am
building the .apk and signing it using Maven. I have used
maven-jarsigner-plugin to sign the .apk file. I am using the key that I
created using Eclipse wizard for signing another Android app. I zipalign
the .apk file using the following command: zipalign [-f] [-v] infile.apk
outfile.apk
When I try to upload the application to the Play store, I get the error:
You uploaded an APK that was signed in debug mode. You need to sign your
APK in release mode.
Can anyone please tell me how to sign the apk in release mode?
I am trying to upload an application to the Google Play store. I am
building the .apk and signing it using Maven. I have used
maven-jarsigner-plugin to sign the .apk file. I am using the key that I
created using Eclipse wizard for signing another Android app. I zipalign
the .apk file using the following command: zipalign [-f] [-v] infile.apk
outfile.apk
When I try to upload the application to the Play store, I get the error:
You uploaded an APK that was signed in debug mode. You need to sign your
APK in release mode.
Can anyone please tell me how to sign the apk in release mode?
Can I hide the element if it doesn't fit the available width using css only?
Can I hide the element if it doesn't fit the available width using css only?
I have a header and an image that should be horizontally laid out on the
absolutely positioned div. I'm showing the text in the subdiv with the
fixed width. I'm trying to hide the image if it doesn't fit into the
absolutely positioned container by the means of CSS3, but I can't. I know
it's possible to do with JS, but maybe there is a CSS3 way?
<div style="position: relative; width: 500px; height:500px;">
<div class="container">
<div class="part-one">
<h1 class="header">This is some header</h1>
</div>
<div class="utilizationContainer" class="part-two">
<img src=""></h1>
</div>
</div>
</div>
.container {
display: -ms-flexbox;
-ms-flex-direction: row;
-ms-flex-pack: justify;
overflow-x: hidden;
position: absolute;
left: 60px;
right: 60px;
bottom: 0px;
height: 400px;
}
.part-one {
left: 0px;
bottom: 100px;
width: 300px;
font-size: 22pt;
color: white;
min-width: 300px;
}
.part-two {
max-width: 400px;
width: 400px;
min-width: 50%;
}
.header {
font-size: 50pt;
color: blue;
margin-bottom: 10px;
}
here is the fiddle: http://jsfiddle.net/8r72g/5/
It's ok if it works only in IE10.
I have a header and an image that should be horizontally laid out on the
absolutely positioned div. I'm showing the text in the subdiv with the
fixed width. I'm trying to hide the image if it doesn't fit into the
absolutely positioned container by the means of CSS3, but I can't. I know
it's possible to do with JS, but maybe there is a CSS3 way?
<div style="position: relative; width: 500px; height:500px;">
<div class="container">
<div class="part-one">
<h1 class="header">This is some header</h1>
</div>
<div class="utilizationContainer" class="part-two">
<img src=""></h1>
</div>
</div>
</div>
.container {
display: -ms-flexbox;
-ms-flex-direction: row;
-ms-flex-pack: justify;
overflow-x: hidden;
position: absolute;
left: 60px;
right: 60px;
bottom: 0px;
height: 400px;
}
.part-one {
left: 0px;
bottom: 100px;
width: 300px;
font-size: 22pt;
color: white;
min-width: 300px;
}
.part-two {
max-width: 400px;
width: 400px;
min-width: 50%;
}
.header {
font-size: 50pt;
color: blue;
margin-bottom: 10px;
}
here is the fiddle: http://jsfiddle.net/8r72g/5/
It's ok if it works only in IE10.
Issuing cmd-like commands in Node.js
Issuing cmd-like commands in Node.js
I was wondering if its possible to open files in their default viewer
using node.js
For instance, I can open a jpg on the command line by simply navigating to
the directory and then typing the filename:
C:\Users\Fermion>sample.jpg
will open the sample.jpg file in Windows Photo Viewer.
Is it possible to write a JavaScript script that will issue the same
command and run it using Node? If so, how?
I was wondering if its possible to open files in their default viewer
using node.js
For instance, I can open a jpg on the command line by simply navigating to
the directory and then typing the filename:
C:\Users\Fermion>sample.jpg
will open the sample.jpg file in Windows Photo Viewer.
Is it possible to write a JavaScript script that will issue the same
command and run it using Node? If so, how?
Catch COM events?
Catch COM events?
Trying to wire up a COM library that we use to talk to things in .NET. In
VB6, the same thing could of been done by just doing
private withevents _monitor as new Application
and then I could just do
monitor_onPrintText(byval msg as string, byval draw as boolean)
and it would work, whenever something was printed on the monitor side, it
would fire the event and send us stuff back. However, in C#, I'm able to
execute the commands, but I don't get the normal things back like I do in
VB6. I'm just curious as to what I'm doing wrong, as everything I've read
says
_monitor.onPrintText += onPrintText;
should work, but I'm not able to get the event to fire.
I've tried this codeproject project, and MSDN, and a bunch of other
resources out there, but I can't get this damn thing to work! Here is the
basics of the code, I've added all three "interfaces" created by importing
the com object, and I've tried all kinds of different combinations. My
"startup" script should return a true, and fire the onPrintText event a
few times with some messages along the way (or at least thats what it's
doing in VB6...)
using System;
using monitorLib;
public class MyClass
{
private Application _monitor;
public MyClass()
{
_monitor = new Application;
_monitor.onPrintText += onPrintText;
_monitor.evaluate("run(\"startup\");");
}
public dynamic Evaluate(string pScript)
{
return _monitor.evaluate(pScript);
}
public void PrintText(string p_text, bool p_drawNow)
{
debug.print(p_text);
}
}
Trying to wire up a COM library that we use to talk to things in .NET. In
VB6, the same thing could of been done by just doing
private withevents _monitor as new Application
and then I could just do
monitor_onPrintText(byval msg as string, byval draw as boolean)
and it would work, whenever something was printed on the monitor side, it
would fire the event and send us stuff back. However, in C#, I'm able to
execute the commands, but I don't get the normal things back like I do in
VB6. I'm just curious as to what I'm doing wrong, as everything I've read
says
_monitor.onPrintText += onPrintText;
should work, but I'm not able to get the event to fire.
I've tried this codeproject project, and MSDN, and a bunch of other
resources out there, but I can't get this damn thing to work! Here is the
basics of the code, I've added all three "interfaces" created by importing
the com object, and I've tried all kinds of different combinations. My
"startup" script should return a true, and fire the onPrintText event a
few times with some messages along the way (or at least thats what it's
doing in VB6...)
using System;
using monitorLib;
public class MyClass
{
private Application _monitor;
public MyClass()
{
_monitor = new Application;
_monitor.onPrintText += onPrintText;
_monitor.evaluate("run(\"startup\");");
}
public dynamic Evaluate(string pScript)
{
return _monitor.evaluate(pScript);
}
public void PrintText(string p_text, bool p_drawNow)
{
debug.print(p_text);
}
}
Subscribe to:
Comments (Atom)