Tuesday, May 8, 2012

How To Create A Voice Chat application ( SIP Protocol )

I need to create a voice chat application .
My preference is to use QT to develop client program as well as the server.
The Clients are identified by a particular no.
So when each client try to communicate with other client's , they should first get the connection details for the client to which it needs to be connected from the server.
Server has a database , which stores the client's connection details ..



When i searched in Google i found that SIP Protocol can be used for this purpose.
Can anyone give me some idea , how to use this sip protocol in this scenario , as well as what all tools i can use along with QT to code this easily ..



I don't have much idea about sip..





Is format String[] whereArgs correct in SQLiteDatabase.delete?

Why this code:



String[] ids = {"5", "1", "3"};
db.delete(ACCOUNTS_TABLE, KEY_ROWID, ids);


return this exception?



android.database.sqlite.SQLiteBindOrColumnIndexOutOfRangeException: bind or column index out of range: handle 0x2069a88




Spring + CXF + Jetty

I am currently developing a standalone spring application (not in a container). This application needs to serve Servlets and a WebService. So I have chosen apache cxf and jetty.



I managed to get it working but I had two separate instances of Jetty running, one for servlets and another for cxf. So my question is, how do i specify which instance of a Jetty Server to be used by CXF?



Below are extracts of my config.



Setup for http server



<bean id="http-server" class="org.eclipse.jetty.server.Server"
init-method="start" destroy-method="stop">

<property name="connectors">
<list>
<bean class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8080" />
</bean>
</list>
</property>
<property name="handler">
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerList">
<property name="handlers">
<list>
<ref bean="ServletContainer" />
<bean class="org.eclipse.jetty.server.handler.DefaultHandler" />
</list>
</property>
</bean>
</property>
</bean>


The above works well for servlets...



Setup for CXF



<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<jaxws:endpoint id="WebService" implementor="com.MyWebServiceImp"
address="/ws">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
<jaxws:properties>
<entry key="faultStackTraceEnabled" value="false" />
<entry key="exceptionMessageCauseEnabled" value="false" />
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>


With the above config the system starts up but the web service is not "published" to the jetty Server and there is nothing "abnormal" in the logs.



I have pretty much tried everything I can thing of or find on Google. Any info or suggestion will be greatly appreciated as I have spent the past couple of days on this.



Thanks





How to enable/disable a Button depending on the selection's type in WPF?

I want to trigger a button's enabled state, according to the type of the current selection.



E.g. I have a treeview that displayes parents and their children. If the selection is on a 'parent' item, the button 'btnShowParentData' is enabled.
I've done this via ValueConvertion:



<Button name="btnShowParentData" IsEnabled="{Binding ElementName=tree, Path=SelectedValue, Converter={StaticResource ParentSelectedConv}}" />


I look for a more elegant way. I don't want to create a ConverterClass for each selection type.





How can I tail a remote file?

I am trying to find a good way to tail a file on a remote host. This is on an internal network of Linux machines. The requirements are:




  1. Must be well behaved (no extra process laying around, or continuing output)


  2. Cannot require someone's pet Perl module.


  3. Can be invoked through Perl.


  4. If possible, doesn't require a custom built script or utility on the remote machine (regular linux utilities are fine)




The solutions I have tried are generally of this sort



ssh remotemachine -f <some command>


"some command" has been:



tail -f logfile


Basic tail doesn't work because the remote process continues to write output to the terminal after the local ssh process dies.



$socket = IO:Socket::INET->new(...);
$pid = fork();
if(!$pid)
{
exec("ssh $host -f '<script which connects to socket and writes>'");
exit;
}

$client = $socket->accept;
while(<$client>)
{
print $_;
}


This works better because there is no output to the screen after the local process exits but the remote process doesn't figure out that its socket is down and it lives on indefinitely.





Window OS Validation

I want to know Window OS Validation(Window 7 , Window XP) in javascript.
I want to resize window page size.
Please help me.



This is my code



function OpenWindow(url, targetName, width, height) {
var features = 'location=no,menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=no,directories=yes';
var openWin = window.open(url, targetName, features);
if (openWin == null) {
return openWin;
}
openWin.moveTo(0, 0);
**openWin.resizeTo(1020, 738);**
openWin.focus();
return openWin;

}




Spring + CXF + Jetty

I am currently developing a standalone spring application (not in a container). This application needs to serve Servlets and a WebService. So I have chosen apache cxf and jetty.



I managed to get it working but I had two separate instances of Jetty running, one for servlets and another for cxf. So my question is, how do i specify which instance of a Jetty Server to be used by CXF?



Below are extracts of my config.



Setup for http server



<bean id="http-server" class="org.eclipse.jetty.server.Server"
init-method="start" destroy-method="stop">

<property name="connectors">
<list>
<bean class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8080" />
</bean>
</list>
</property>
<property name="handler">
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerList">
<property name="handlers">
<list>
<ref bean="ServletContainer" />
<bean class="org.eclipse.jetty.server.handler.DefaultHandler" />
</list>
</property>
</bean>
</property>
</bean>


The above works well for servlets...



Setup for CXF



<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<jaxws:endpoint id="WebService" implementor="com.MyWebServiceImp"
address="/ws">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
<jaxws:properties>
<entry key="faultStackTraceEnabled" value="false" />
<entry key="exceptionMessageCauseEnabled" value="false" />
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>


With the above config the system starts up but the web service is not "published" to the jetty Server and there is nothing "abnormal" in the logs.



I have pretty much tried everything I can thing of or find on Google. Any info or suggestion will be greatly appreciated as I have spent the past couple of days on this.



Thanks





Hook function in single process

Can anybody tell me how can i hook from kernel driver function only for single process. For example ZwQueryInformationProcess.



Thanks!





Set up HTTPPOST android?

I want to set up httppost to my server.
For now I have address for emulator, but now I want to test app online.
Here is the code:



HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://10.0.2.2/posloviPodaci/index.php");


How to set up address for my server, which I have online?
Thanks.





Flexible sliding window (in Python)

Problem description: I'm interested in looking at terms in the text window of, say, 3 words to the left and 3 to the right. The base case has the form of w-3 w-2 w-1 term w+1 w+2 w+3. I want to implement a sliding window over my text with which I will be able to record the context words of each term. So, every word is once treated as a term, but when the window moves, it becomes a context word, etc. However, when the term is the 1st word in line, there are no context words on the left (t w+1 w+2 w+3), when it's the 2nd word in line, there's only one context word on the left, and so on. So, I am interested in any hints for implementing this flexible sliding window (in Python) without writing and specifying separately each possible situation.



To recap:



Example of input:



["w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10"]



Output:



t1 w2 w3 w4



w1 t2 w3 w4 w5



w1 w2 t3 w4 w5 w6



w1 w2 w3 t4 w5 w6 w7



__ w2 w3 w4 t5 w6 w7 w8



__ __ etc.



My current plan is to implement this with a separate condition for each line in the output.





Dynamic float layout with CSS

Let me try and explain what I want to achieve. I want X boxes with a specific width (250 px) set but dynamic height to be placed in the body. But I want them to be as compact as possible, no unnecessary empty space between them.



Now If all boxes had same width and height, this would be easy. I could for example just put float:left; on them. But the when the boxes height is dynamic, and all boxes have random height I end up with spaces between the boxes.



Let me show two examples:



This is what I want:



This is what I want



This is what I end up with:



This is what I end up with



This is my CSS:



<style type="text/css">
<!--
body {
background:#CCCCCC;
}
.flowBox {
background:#FFFFFF;
margin:10px;
float:left;
padding:10px;
width:250px;
border:#999999 1px solid;
}
.clear {
clear:both;
}
-->
</style>


HTML example for a box:



<div class="flowBox">
<h1>Header 0</h1>
Erat volutpat. Sed rutr...
</div>


Full source code: http://pastebin.com/UL1Nqyvm



Is there a way to achieve this with CSS? Thanks for any help or directions!





Is format String[] whereArgs correct in SQLiteDatabase.delete?

Why this code:



String[] ids = {"5", "1", "3"};
db.delete(ACCOUNTS_TABLE, KEY_ROWID, ids);


return this exception?



android.database.sqlite.SQLiteBindOrColumnIndexOutOfRangeException: bind or column index out of range: handle 0x2069a88




A bothersome search function on Java multi tree

there is a multi-tree like this?



abc--xx       abc(have 3 children)
xv--yg xv(have 2 children)
ld
xu--ph
ld xu(have 2 children)


design a search function like: search(String key)



search("ld")
the result will be?(need the path from root to the result node)



abc--xv--ld
xu--ld


There is a TreeNode object (you can add your fields if you need)



    TreeNode{
string key;
List<TreeNode> children;
}




How To Create A Voice Chat application ( SIP Protocol )

I need to create a voice chat application .
My preference is to use QT to develop client program as well as the server.
The Clients are identified by a particular no.
So when each client try to communicate with other client's , they should first get the connection details for the client to which it needs to be connected from the server.
Server has a database , which stores the client's connection details ..



When i searched in Google i found that SIP Protocol can be used for this purpose.
Can anyone give me some idea , how to use this sip protocol in this scenario , as well as what all tools i can use along with QT to code this easily ..



I don't have much idea about sip..





How to remove the decimal part from float number contains .0 in java

i just want to remove the fraction part of float number that contains .0 all other number are acceptable..
For example :



  I/P: 1.0, 2.2, 88.0, 3.56666, 4.1, 45.00
O/P: 1 , 2.2, 88, 3.567, 4.1, 45


Is there any method available to do that other than "comparing number with ".0" and taking substring" ?





Should I use OData or develop my own WCF service?

I have a project to expose Entity Framework data via a web service. I am wondering should I use OData or write my own WCF services? It seems that OData is dead. Am I right?





iPhone application development training using PC's

We would like to conduct iPhone application development training for students. However, it is very expensive to have a mac machine for all. We would like to setup a virtual environment on the PC to install and run mac OS so that development tools like XCode can run and basics of iPhone application development can be taught. We will we will invest in a couple of macs, iPhones and iPads so that students who want to try out their exercises on the real machine and deploy to real devices.



I have heard that this kind of a development setup is possible, but am not sure how and so would like to know if anyone has setup such an environment, how to do about doing it.



thanks





How to use Dynamic Parameters value in ccnet file

I amusing dynamic parameter to get value from user when he force build.User provides me publish directory path where i have to publish the solution if build is successful, so can any one please tell me how can i get this value in publishDir section.



Thanks in Advance.





ways to add programs to startup in ubuntu by commandline

i've seen several ways to add programs or daemons to startup in Ubuntu 12.04 but I am kind of perturbed with the meaning of each method.
The point of that I am needing is
- A way to run a daemon before login with root as owner
- A way to run a program after the login of one user
- A way to run a program after the login of any user
- A way to run a program when all gnome environment is setted up



Thanks;)





Flexible sliding window (in Python)

Problem description: I'm interested in looking at terms in the text window of, say, 3 words to the left and 3 to the right. The base case has the form of w-3 w-2 w-1 term w+1 w+2 w+3. I want to implement a sliding window over my text with which I will be able to record the context words of each term. So, every word is once treated as a term, but when the window moves, it becomes a context word, etc. However, when the term is the 1st word in line, there are no context words on the left (t w+1 w+2 w+3), when it's the 2nd word in line, there's only one context word on the left, and so on. So, I am interested in any hints for implementing this flexible sliding window (in Python) without writing and specifying separately each possible situation.



To recap:



Example of input:



["w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10"]



Output:



t1 w2 w3 w4



w1 t2 w3 w4 w5



w1 w2 t3 w4 w5 w6



w1 w2 w3 t4 w5 w6 w7



__ w2 w3 w4 t5 w6 w7 w8



__ __ etc.



My current plan is to implement this with a separate condition for each line in the output.





iOS, which database to choose?

i need some advice.



I am developing an iPhone application (later for Android also) using some social network users. I need to store some data in a database online.



Better to use MySQL with XML or directly use SQLite?
I want performance and stability, and if all goes as I think I might have to handle 500,000 users or more.



I studied a lot about databases, but I would not even take care of his administration, because I'm alone.
Most web services do not support SQLite, but MySQL only.



Can anyone give me some advice with justified?



Thank you to entire community.
Bye, Eros.





PDF in XPages without using iText?

I am trying to make a PDF file. And also the notes documents are the contents. I have a clear idea with iText.



But is there any other solution for making PDFs without using iText?





Dynamic float layout with CSS

Let me try and explain what I want to achieve. I want X boxes with a specific width (250 px) set but dynamic height to be placed in the body. But I want them to be as compact as possible, no unnecessary empty space between them.



Now If all boxes had same width and height, this would be easy. I could for example just put float:left; on them. But the when the boxes height is dynamic, and all boxes have random height I end up with spaces between the boxes.



Let me show two examples:



This is what I want:



This is what I want



This is what I end up with:



This is what I end up with



This is my CSS:



<style type="text/css">
<!--
body {
background:#CCCCCC;
}
.flowBox {
background:#FFFFFF;
margin:10px;
float:left;
padding:10px;
width:250px;
border:#999999 1px solid;
}
.clear {
clear:both;
}
-->
</style>


HTML example for a box:



<div class="flowBox">
<h1>Header 0</h1>
Erat volutpat. Sed rutr...
</div>


Full source code: http://pastebin.com/UL1Nqyvm



Is there a way to achieve this with CSS? Thanks for any help or directions!





A bothersome search function on Java multi tree

there is a multi-tree like this?



abc--xx       abc(have 3 children)
xv--yg xv(have 2 children)
ld
xu--ph
ld xu(have 2 children)


design a search function like: search(String key)



search("ld")
the result will be?(need the path from root to the result node)



abc--xv--ld
xu--ld


There is a TreeNode object (you can add your fields if you need)



    TreeNode{
string key;
List<TreeNode> children;
}




Can't edit FileZilla Server.xml file programatically in Windows 7 using C#?

I have using filezilla[version 0.9.39 beta] with my C# windows Form Application.So, I have added users and corresponding shared directory programatically in C:\Program Files\FileZilla Server\FileZilla Server.xml file.But when i open the Filezilla Server Interface and see the users list on the right hand side box, it never displays the users list that are added on the above mentioned file.[see attached image]



enter image description here



How do i add users programatically in filezilla server.xml file.



Please guide me to get out of this issue?



Thanks & Regards,
P.SARAVANAN





How to remove the decimal part from float number contains .0 in java

i just want to remove the fraction part of float number that contains .0 all other number are acceptable..
For example :



  I/P: 1.0, 2.2, 88.0, 3.56666, 4.1, 45.00
O/P: 1 , 2.2, 88, 3.567, 4.1, 45


Is there any method available to do that other than "comparing number with ".0" and taking substring" ?





Converting site to AJAX transitions between pages (aka full page AJAX)

We have pretty standard web-site and I got a task to convert links between pages to AJAX calls, but maintain direct links (from search engines, for example) working too.



My goals:




  • Leave direct links working as before (and hash fallback for old IE), smooth transition from arriving by direct link and futher browsing using AJAX

  • Implement some "garbage collection" (DOM of previously viewed pages, script handlers etc)



I've seen something similar in jQuery Mobile, but I'm looking for more general solution to get inspiration (or borrow code) from :)





iPhone application development training using PC's

We would like to conduct iPhone application development training for students. However, it is very expensive to have a mac machine for all. We would like to setup a virtual environment on the PC to install and run mac OS so that development tools like XCode can run and basics of iPhone application development can be taught. We will we will invest in a couple of macs, iPhones and iPads so that students who want to try out their exercises on the real machine and deploy to real devices.



I have heard that this kind of a development setup is possible, but am not sure how and so would like to know if anyone has setup such an environment, how to do about doing it.



thanks





ImageView doesn't dispatch TouchEvent

I want to change the image (that I get from a web url) in my ImageView when I touch the left or right of the screen. I tried using a TouchListener but I get an error about dispatchTouchEvent.



Using a gallery view is not the solution because I want the images displayed in full screen.



This is the code I use.



 public class Prova4Activity extends Activity implements OnTouchListener {
/** Called when the activity is first created. */
ImageView image;
Bitmap trash = loadImageFromUrl("http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.6.png");
ImageView imgpag;
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.EDGE_RIGHT){
trash.recycle();
trash = null;
trash = loadImageFromUrl("http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.6.png");
image.setImageBitmap(trash);

}else if(event.getAction() == MotionEvent.EDGE_LEFT){
trash.recycle();
trash = null;
trash = loadImageFromUrl("http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.5.png");
imgpag.setImageBitmap(trash);

}
imgpag.setScaleType(ScaleType.FIT_XY);

return false;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

imgpag = (ImageView)findViewById (R.id.imgpag);
imgpag.setImageBitmap(trash);
imgpag.setOnTouchListener(this);

}
}


In logcat I see the following message many times:



Key dispatching timed out sending to com.namemyapp Current state {{null Window{439f0e10 com.namemyapp Continuing to wait for key to be dispatched




ways to add programs to startup in ubuntu by commandline

i've seen several ways to add programs or daemons to startup in Ubuntu 12.04 but I am kind of perturbed with the meaning of each method.
The point of that I am needing is
- A way to run a daemon before login with root as owner
- A way to run a program after the login of one user
- A way to run a program after the login of any user
- A way to run a program when all gnome environment is setted up



Thanks;)





Supported formats for Android's VideoView

Does anyone know where the documentation is for Android's VideoView? I'm trying to play some .mov files and they aren't working, and I believe it is because that is an unsupported format, but I can't find anywhere in the docs that lists what formats are supported for video playback on android.



I figure if .mov files won't work, then I'll need to convert them on the server using something like ffmpeg, but I want to make sure I do it correctly, so I need to see what the supported types are.



Any ideas?





iOS, which database to choose?

i need some advice.



I am developing an iPhone application (later for Android also) using some social network users. I need to store some data in a database online.



Better to use MySQL with XML or directly use SQLite?
I want performance and stability, and if all goes as I think I might have to handle 500,000 users or more.



I studied a lot about databases, but I would not even take care of his administration, because I'm alone.
Most web services do not support SQLite, but MySQL only.



Can anyone give me some advice with justified?



Thank you to entire community.
Bye, Eros.





How to Disable back button using Struts2

I am using struts.serve.static=true and struts.serve.static.browserCache=false, but the back button is working even after logout. When i click on the back button it is going to the previous screen. How do i solve this issue?





PDF in XPages without using iText?

I am trying to make a PDF file. And also the notes documents are the contents. I have a clear idea with iText.



But is there any other solution for making PDFs without using iText?





convert date from json format to other formats in sencha

Can anyone tell me how to convert date from Json data to normal date format in sencha.



var df = this.dateFormat;

if (!v) {
return v;
}
if (Ext.isDate(v)) {
return v;
}
if (df) {
if (df == 'timestamp') {
return new Date(v * 1000);
}
if (df == 'time') {
return new Date(parseInt(v, 10));
}
return Date.parseDate(v, df);
}
var parsed = Date.parse(v);
return parsed ? new Date(parsed) : null;


Thanks in advance





Can't edit FileZilla Server.xml file programatically in Windows 7 using C#?

I have using filezilla[version 0.9.39 beta] with my C# windows Form Application.So, I have added users and corresponding shared directory programatically in C:\Program Files\FileZilla Server\FileZilla Server.xml file.But when i open the Filezilla Server Interface and see the users list on the right hand side box, it never displays the users list that are added on the above mentioned file.[see attached image]



enter image description here



How do i add users programatically in filezilla server.xml file.



Please guide me to get out of this issue?



Thanks & Regards,
P.SARAVANAN





Generate random char in bash

I need to generate a huge text.



I'm using bash and I want to convert an integer number like 65 to a char like A.
So I use random value between 0 and 255 (I need all the ASCII table), convert to a char and redirect to a file using >>.
But I cannot make bash interpret the integer as a char.
Like printf("%c", 65) in C++.
But if I try this in bash, it returns 6.





Converting site to AJAX transitions between pages (aka full page AJAX)

We have pretty standard web-site and I got a task to convert links between pages to AJAX calls, but maintain direct links (from search engines, for example) working too.



My goals:




  • Leave direct links working as before (and hash fallback for old IE), smooth transition from arriving by direct link and futher browsing using AJAX

  • Implement some "garbage collection" (DOM of previously viewed pages, script handlers etc)



I've seen something similar in jQuery Mobile, but I'm looking for more general solution to get inspiration (or borrow code) from :)





Check if date is before or after a certain date in the same month

I am developing a web app using PHP (Codeigniter).
When a user makes a request for a certain resource in the app I need to check if todays date is before or after the 25th of this month. How can I do this? I do not know how to do it.





ImageView doesn't dispatch TouchEvent

I want to change the image (that I get from a web url) in my ImageView when I touch the left or right of the screen. I tried using a TouchListener but I get an error about dispatchTouchEvent.



Using a gallery view is not the solution because I want the images displayed in full screen.



This is the code I use.



 public class Prova4Activity extends Activity implements OnTouchListener {
/** Called when the activity is first created. */
ImageView image;
Bitmap trash = loadImageFromUrl("http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.6.png");
ImageView imgpag;
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.EDGE_RIGHT){
trash.recycle();
trash = null;
trash = loadImageFromUrl("http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.6.png");
image.setImageBitmap(trash);

}else if(event.getAction() == MotionEvent.EDGE_LEFT){
trash.recycle();
trash = null;
trash = loadImageFromUrl("http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.5.png");
imgpag.setImageBitmap(trash);

}
imgpag.setScaleType(ScaleType.FIT_XY);

return false;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

imgpag = (ImageView)findViewById (R.id.imgpag);
imgpag.setImageBitmap(trash);
imgpag.setOnTouchListener(this);

}
}


In logcat I see the following message many times:



Key dispatching timed out sending to com.namemyapp Current state {{null Window{439f0e10 com.namemyapp Continuing to wait for key to be dispatched




calling ffmpeg from java on android

Currently I have a java application that calls ffmpeg process with parameters.
This works fine under Windows because I just run another process.
I want to call the same method in ffmpeg api under android os.



What should I do in order to have minimal change in code and transform the same thing to android?



How can I call, using java, a specific method in ffmpeg api under the android os.



thank you!





ruby sinatra dm-sqlite-adapter (LoadError)

rubygems/custom_require.rb:36:in `require': cannot load such file -- dm-sqlite-adapter (LoadError)
require 'rubygems'
require 'sinatra'
require 'data_mapper' # metagem, requires common plugins too.
# need install dm-sqlite-adapter
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/blog.db")



    class Post
include DataMapper::Resource
property :id, Serial
property :title, String
property :body, Text
property :created_at, DateTime
end

# Perform basic sanity checks and initialize all relationships
# Call this when you've defined all your models
DataMapper.finalize

# automatically create the post table
Post.auto_upgrade!




Supported formats for Android's VideoView

Does anyone know where the documentation is for Android's VideoView? I'm trying to play some .mov files and they aren't working, and I believe it is because that is an unsupported format, but I can't find anywhere in the docs that lists what formats are supported for video playback on android.



I figure if .mov files won't work, then I'll need to convert them on the server using something like ffmpeg, but I want to make sure I do it correctly, so I need to see what the supported types are.



Any ideas?





convert date from json format to other formats in sencha

Can anyone tell me how to convert date from Json data to normal date format in sencha.



var df = this.dateFormat;

if (!v) {
return v;
}
if (Ext.isDate(v)) {
return v;
}
if (df) {
if (df == 'timestamp') {
return new Date(v * 1000);
}
if (df == 'time') {
return new Date(parseInt(v, 10));
}
return Date.parseDate(v, df);
}
var parsed = Date.parse(v);
return parsed ? new Date(parsed) : null;


Thanks in advance





facebook request reading and user_id geting issue

Hi im sending my request like this



 <?php 
$app_id = "127736900693315";

$canvas_page = "http://apps.facebook.com/greetingz";

$message = "Dynamic_msg";
$data_s="Dynamic_data";


$requests_url = "https://www.facebook.com/dialog/apprequests?app_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page)
. "&message=" . $message."&data=".$data_s;

if (empty($_REQUEST["request_ids"])) {
echo("<script> top.location.href='" . $requests_url . "'</script>");


} else {

}
?>


this request is going ok but when receiver click on notification im fetching through request_ids code is below



    if(!empty($_REQUEST['request_ids'])) {

$config = array(
'appId' => '343704039016593',
'secret' => '56e711bf93d4e46426aa662c8be8d5ef',
'cookie' => true,

);
$facebook = new Facebook($config);
echo $user_id= $facebook->getUser(); //** 0 printing**
$app_token = $facebook->getAccessToken();

$requests = explode(',',$_REQUEST['request_ids']);
foreach($requests as $request_id) {

$request_content = json_decode(file_get_contents("https://graph.facebook.com/'".$request_id."_".$user_id."'?access_token=$app_token"), TRUE);
print_r($request_content); //**nothing is printing**


$deleted = file_get_contents("https://graph.facebook.com/$request_id?access_token=$app_token&method=delete");





}


I dono whats wrong on my coding im trying almost 7 days and I checked tutorial online most of those are old now the API have updated. I cant get the user_id even ... do I need to send my request OAuth Dialog??
}





Check if date is before or after a certain date in the same month

I am developing a web app using PHP (Codeigniter).
When a user makes a request for a certain resource in the app I need to check if todays date is before or after the 25th of this month. How can I do this? I do not know how to do it.





Generate random char in bash

I need to generate a huge text.



I'm using bash and I want to convert an integer number like 65 to a char like A.
So I use random value between 0 and 255 (I need all the ASCII table), convert to a char and redirect to a file using >>.
But I cannot make bash interpret the integer as a char.
Like printf("%c", 65) in C++.
But if I try this in bash, it returns 6.





calling ffmpeg from java on android

Currently I have a java application that calls ffmpeg process with parameters.
This works fine under Windows because I just run another process.
I want to call the same method in ffmpeg api under android os.



What should I do in order to have minimal change in code and transform the same thing to android?



How can I call, using java, a specific method in ffmpeg api under the android os.



thank you!





ruby sinatra dm-sqlite-adapter (LoadError)

rubygems/custom_require.rb:36:in `require': cannot load such file -- dm-sqlite-adapter (LoadError)
require 'rubygems'
require 'sinatra'
require 'data_mapper' # metagem, requires common plugins too.
# need install dm-sqlite-adapter
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/blog.db")



    class Post
include DataMapper::Resource
property :id, Serial
property :title, String
property :body, Text
property :created_at, DateTime
end

# Perform basic sanity checks and initialize all relationships
# Call this when you've defined all your models
DataMapper.finalize

# automatically create the post table
Post.auto_upgrade!




facebook request reading and user_id geting issue

Hi im sending my request like this



 <?php 
$app_id = "127736900693315";

$canvas_page = "http://apps.facebook.com/greetingz";

$message = "Dynamic_msg";
$data_s="Dynamic_data";


$requests_url = "https://www.facebook.com/dialog/apprequests?app_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page)
. "&message=" . $message."&data=".$data_s;

if (empty($_REQUEST["request_ids"])) {
echo("<script> top.location.href='" . $requests_url . "'</script>");


} else {

}
?>


this request is going ok but when receiver click on notification im fetching through request_ids code is below



    if(!empty($_REQUEST['request_ids'])) {

$config = array(
'appId' => '343704039016593',
'secret' => '56e711bf93d4e46426aa662c8be8d5ef',
'cookie' => true,

);
$facebook = new Facebook($config);
echo $user_id= $facebook->getUser(); //** 0 printing**
$app_token = $facebook->getAccessToken();

$requests = explode(',',$_REQUEST['request_ids']);
foreach($requests as $request_id) {

$request_content = json_decode(file_get_contents("https://graph.facebook.com/'".$request_id."_".$user_id."'?access_token=$app_token"), TRUE);
print_r($request_content); //**nothing is printing**


$deleted = file_get_contents("https://graph.facebook.com/$request_id?access_token=$app_token&method=delete");





}


I dono whats wrong on my coding im trying almost 7 days and I checked tutorial online most of those are old now the API have updated. I cant get the user_id even ... do I need to send my request OAuth Dialog??
}