Saturday, 31 August 2013

AngularJS - Why select drop down doesn't have $event on change

AngularJS - Why select drop down doesn't have $event on change

I am newbie to AngularJS. I have a question, why does select doesn't
passes the $event?
HTML
<div ng-controller="foo">
<select ng-model="item" ng-options="opts as opts.name for opts in
sels" ng-change="lstViewChange($event)"
ng-click="listViewClick($event)"></select>
</div>
Script
var myApp = angular.module('myApp', []);
angular.element(document).ready(function() {
angular.bootstrap(document, ['myApp']);
});
function foo($scope) {
$scope.sels = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
$scope.lstViewChange = function($event){
console.log('change', $event);
}
$scope.listViewClick = function($event){
console.log('click', $event);
}
}
Have a look at this fiddle http://jsfiddle.net/dkrotts/BtrZH/7/. Click
passes a event but change doesn't.

what python package is needed to create a virus or worm? no harm intended

what python package is needed to create a virus or worm? no harm intended

what python package is needed to create a virus or worm? I want to create
a simple virus to study ho viruses can be detected even if it is FUD and
eventually create a program for that.

How can I download a file from Google Drive?

How can I download a file from Google Drive?

I have been searching non-stop for this and have not found the answer. I
have a text file uploaded to Google Drive and want my VB application to
download it. I have tried the 'My.Computer.Network.DownloadFile' method
which downloads the html file of the file which says you are being
redirected (as google drive download link redirects you to a unique link
which expires after a period of time) and I have tried the WebClient
method which does not download the file at all. The url is along the basis
of: https://docs.google.com/uc?export=download&id=THEfileID. When I search
for the way to download from google drive on Google people say to look at
the Google drive api but I do not understand that at all. If you need any
additional information please ask. Thanks, zacy5000
Additional information: The link is not a direct download link but a link
that will redirect you to a temporary download link. I need it to download
WITHOUT being logged in to a account (the file is set to 'With url only'
in the sharing properties and it is a plain txt file.

Using exceptions for control flow

Using exceptions for control flow

I have read that using exceptions for control flow is not good, but how
can I achieve the following easily without throwing exceptions? So if user
enters username that is already in use, I want to show error message next
to the input field. Here is code from my sign up page:
public String signUp() {
User user = new User(username, password, email);
try {
if ( userService.save(user) != null ) {
// ok
}
else {
// not ok
}
}
catch ( UsernameInUseException e ) {
// notify user that username is already in use
}
catch ( EmailInUseException e ) {
// notify user that email is already in use
}
catch ( DataAccessException e ) {
// notify user about db error
}
return "index";
}
save method of my userService:
@Override
@Transactional
public User save(User user) {
if ( userRepository.findByUsername(user.getUsername()) != null ) {
LOGGER.debug("Username '{}' is already in use", user.getUsername());
throw new UsernameInUseException();
}
else if ( userRepository.findByEmail(user.getEmail()) != null ) {
LOGGER.debug("Email '{}' is already in use", user.getEmail());
throw new EmailInUseException();
}
user.setPassword(BCrypt.hashpw(user.getPassword(), BCrypt.gensalt()));
user.setRegisteredOn(DateTime.now(DateTimeZone.UTC));
return userRepository.save(user);
}

Script to detect and record network statistics?

Script to detect and record network statistics?

I am new to scripting, I have a requirement to write scripts to be used on
my MacBook pro to record data usage on my broadband connection.
My Requirements
The script should detect Internet connection is via dongle or wifi
If via dongle then record number of bytes sent and received upon every
connection
It should log to a file at regular interval
If possible summarise total number of bytes sent and received may be once
in a day from 6 am to 6am. (it can also summarise upon next start of the
system ..next start of the system could be at 10am...but once summarised
should not be considered for next run)....Or Once a month
Able to figure out total bandwidth usage ....for a month...
My question is... On Mac...which script language would be better?...Apple
script's, or shell script or using python...etc...
If possible please provide pointers for the same. Thanks in Advance

How to create Android Tabs without setContent

How to create Android Tabs without setContent

I want to have a tabbar with tabs. And I want just to catch tab pressing
to update single view. I attempt to set setContent of TabHost to null but
I've got error. How to implement this feature?

FFT returns large values which become NaN

FFT returns large values which become NaN

I'm using a FFT class to get the fundamental frequency. I'm passing an
array of some double values. Array is like queue. when add a new values
array will be updated. But my problem is output array will become large
numbers time to time. Its become E to the power value and finally returns
NaN. Im using below FFT class and I'm confused in where is the problem.
Its a big help if anyone can give a help by figuring out the cause.
here is my FFT class
public class FFT {
int n, m;
// Lookup tables. Only need to recompute when size of FFT changes.
double[] cos;
double[] sin;
double[] window;
public FFT(int n) {
this.n = n;
this.m = (int)(Math.log(n) / Math.log(2));
// Make sure n is a power of 2
if(n != (1<<m))
throw new RuntimeException("FFT length must be power of 2");
// precompute tables
cos = new double[n/2];
sin = new double[n/2];
// for(int i=0; i<n/4; i++) {
// cos[i] = Math.cos(-2*Math.PI*i/n);
// sin[n/4-i] = cos[i];
// cos[n/2-i] = -cos[i];
// sin[n/4+i] = cos[i];
// cos[n/2+i] = -cos[i];
// sin[n*3/4-i] = -cos[i];
// cos[n-i] = cos[i];
// sin[n*3/4+i] = -cos[i];
// }
for(int i=0; i<n/2; i++) {
cos[i] = Math.cos(-2*Math.PI*i/n);
sin[i] = Math.sin(-2*Math.PI*i/n);
}
makeWindow();
}
protected void makeWindow() {
// Make a blackman window:
// w(n)=0.42-0.5cos{(2*PI*n)/(N-1)}+0.08cos{(4*PI*n)/(N-1)};
window = new double[n];
for(int i = 0; i < window.length; i++)
window[i] = 0.42 - 0.5 * Math.cos(2*Math.PI*i/(n-1))
+ 0.08 * Math.cos(4*Math.PI*i/(n-1));
}
public double[] getWindow() {
return window;
}
/***************************************************************
* fft.c
* Douglas L. Jones
* University of Illinois at Urbana-Champaign
* January 19, 1992
* http://cnx.rice.edu/content/m12016/latest/
*
* fft: in-place radix-2 DIT DFT of a complex input
*
* input:
* n: length of FFT: must be a power of two
* m: n = 2**m
* input/output
* x: double array of length n with real part of data
* y: double array of length n with imag part of data
*
* Permission to copy and use this program is granted
* as long as this header is included.
****************************************************************/
public void fft(double[] x, double[] y)
{
int i,j,k,n1,n2,a;
double c,s,e,t1,t2;
// Bit-reverse
j = 0;
n2 = n/2;
for (i=1; i < n - 1; i++) {
n1 = n2;
while ( j >= n1 ) {
j = j - n1;
n1 = n1/2;
}
j = j + n1;
if (i < j) {
t1 = x[i];
x[i] = x[j];
x[j] = t1;
t1 = y[i];
y[i] = y[j];
y[j] = t1;
}
}
// FFT
n1 = 0;
n2 = 1;
for (i=0; i < m; i++) {
n1 = n2;
n2 = n2 + n2;
a = 0;
for (j=0; j < n1; j++) {
c = cos[a];
s = sin[a];
a += 1 << (m-i-1);
for (k=j; k < n; k=k+n2) {
t1 = c*x[k+n1] - s*y[k+n1];
t2 = s*x[k+n1] + c*y[k+n1];
x[k+n1] = x[k] - t1;
y[k+n1] = y[k] - t2;
x[k] = x[k] + t1;
y[k] = y[k] + t2;
}
}
}
}
// Test the FFT to make sure it's working
public static void main(String[] args) {
int N = 8;
FFT fft = new FFT(N);
double[] window = fft.getWindow();
double[] re = new double[N];
double[] im = new double[N];
// Impulse
re[0] = 1; im[0] = 0;
for(int i=1; i<N; i++)
re[i] = im[i] = 0;
beforeAfter(fft, re, im);
// Nyquist
for(int i=0; i<N; i++) {
re[i] = Math.pow(-1, i);
im[i] = 0;
}
beforeAfter(fft, re, im);
// Single sin
for(int i=0; i<N; i++) {
re[i] = Math.cos(2*Math.PI*i / N);
im[i] = 0;
}
beforeAfter(fft, re, im);
// Ramp
for(int i=0; i<N; i++) {
re[i] = i;
im[i] = 0;
}
beforeAfter(fft, re, im);
long time = System.currentTimeMillis();
double iter = 30000;
for(int i=0; i<iter; i++)
fft.fft(re,im);
time = System.currentTimeMillis() - time;
System.out.println("Averaged " + (time/iter) + "ms per iteration");
}
protected static void beforeAfter(FFT fft, double[] re, double[] im) {
System.out.println("Before: ");
printReIm(re, im);
fft.fft(re, im);
System.out.println("After: ");
printReIm(re, im);
}
protected static void printReIm(double[] re, double[] im) {
System.out.print("Re: [");
for(int i=0; i<re.length; i++)
System.out.print(((int)(re[i]*1000)/1000.0) + " ");
System.out.print("]\nIm: [");
for(int i=0; i<im.length; i++)
System.out.print(((int)(im[i]*1000)/1000.0) + " ");
System.out.println("]");
}
}
Below is my main activity class in android which uses the FFT instance
public class MainActivity extends Activity implements
SensorEventListener{
static final float ALPHA = 0.15f;
private int count=0;
private static GraphicalView view;
private LineGraph line = new LineGraph();
private static Thread thread;
private SensorManager mSensorManager;
private Sensor mAccelerometer;
TextView title,tv,tv1,tv2,tv3,tv4,tv5,tv6;
RelativeLayout layout;
private double a;
private double m = 0;
private float p,q,r;
public long[] myList;
public double[] myList2;
public double[] gettedList;
static String k1,k2,k3,k4;
int iniX=0;
public FFT fft;
public myArray myArrayQueue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fft=new FFT(128);
myList=new long[128];
myList2=new double[128];
gettedList=new double[128];
myArrayQueue=new myArray(128);
//get the sensor service
mSensorManager = (SensorManager)
getSystemService(Context.SENSOR_SERVICE);
//get the accelerometer sensor
mAccelerometer =
mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
//get layout
layout = (RelativeLayout)findViewById(R.id.relative);
LinearLayout layout = (LinearLayout) findViewById(R.id.layoutC);
view= line.getView(this);
layout.addView(view);
//get textviews
title=(TextView)findViewById(R.id.name);
//tv=(TextView)findViewById(R.id.xval);
//tv1=(TextView)findViewById(R.id.yval);
//tv2=(TextView)findViewById(R.id.zval);
tv3=(TextView)findViewById(R.id.TextView04);
tv4=(TextView)findViewById(R.id.TextView01);
tv5=(TextView)findViewById(R.id.TextView02);
tv6=(TextView)findViewById(R.id.TextView03);
for (int i = 0; i < myList2.length; i++){
myList2[i] =0;
}
}
public final void onAccuracyChanged(Sensor sensor, int accuracy)
{
// Do something here if sensor accuracy changes.
}
@Override
public final void onSensorChanged(SensorEvent event)
{
count=+1;
// Many sensors return 3 values, one for each axis.
float x = event.values[0];
float y = event.values[1];
float z = event.values[2];
//float[] first={x,y,z};
// float[] larst={p,q,r};
//larst= lowPass(first,larst);
//double FY= b.Filter(y);
//double FZ= b.Filter(z);
//get merged value
// m = (float)
Math.sqrt(larst[0]*larst[0]+larst[1]*larst[1]+larst[2]*larst[2]);
m=(double)Math.sqrt(x*x+y*y+z*z);
//display values using TextView
//title.setText(R.string.app_name);
//tv.setText("X axis" +"\t\t"+x);
//tv1.setText("Y axis" + "\t\t" +y);
//tv2.setText("Z axis" +"\t\t" +z);
//myList[iniX]=m*m;
//myList[iniX+1]=myList[iniX];
iniX=+1;
//myList[3]=myList[2];
//myList[2]=myList[1];
//myList[1]=myList[0];
myArrayQueue.insert(m*m);
gettedList=myArrayQueue.getMyList();
/* for(int a = myList.length-1;a>0;a--)
{
myList[a]=myList[a-1];
}
myList[0]=m*m;
*/
fft.fft(gettedList, myList2);
k1=Double.toString(myList2[0]);
k2=Double.toString(myList2[1]);
k3=Double.toString(myList2[2]);
k4=Double.toString(myList2[3]);
tv3.setText("[0]= "+k1);
tv4.setText("[1]= "+k2);
tv5.setText("[2]= "+k3);
tv6.setText("[3]= "+k4);
line.addNewPoint(iniX,(float) m);
view.repaint();
}
@Override
protected void onResume()
{
super.onResume();
mSensorManager.registerListener(this, mAccelerometer,
SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause()
{
super.onPause();
mSensorManager.unregisterListener(this);
}
public void LineGraphHandler(View view){
}
//Low pass filter
protected float[] lowPass( float[] input, float[] output ) {
if ( output == null ) return input;
for ( int i=0; i<input.length; i++ ) {
output[i] = output[i] + ALPHA * (input[i] - output[i]);
}
return output;
}
/*@Override
public void onStart(){
super.onStart();
view= line.getView(this);
setContentView(view);
}*/
}

Is there any plugin or customized version of jQuery date picker library that support Dari and Pashto Languages

Is there any plugin or customized version of jQuery date picker library
that support Dari and Pashto Languages

How to convert jQuery Datepicker from Georgian to Jalali Date with Dari
Months?

Friday, 30 August 2013

Parent and child divs both position: absolute. How to make child div take up 100% width and height of page?

Parent and child divs both position: absolute. How to make child div take
up 100% width and height of page?

I am trying to make a light box style Jquery function. Unfortunately, the
div that contains the image I want to make pop out and enlarge has
position:absolute and z-index: 10 so my pop up box and background fader
only take up the width and height of that parent (.container) div eg:
Would anyone know a way around this so that my .lightboxbackground and
.lightbox divs can cover the whole screen?
<div class='container'>
<div class='lightboxbackground'>
<div class='lightbox'>
<img src='image.jpg'/>
</div>
</div>
</div>
.container {
position: absolute;
z-index:10;
width: 200px;
height: 200px;
}
.lightboxbackground {
background-color:#000;
opacity: 0.9;
width: 100%;
height: 100%;
position:absolute;
z-index: 11;
}
.lightbox {
width: 500px;
height: 500px;
position:absolute;
z-index: 12;
}

WP8 Bind to Parent Page's Field

WP8 Bind to Parent Page's Field

I have a WP8 application I'm working on, and I'm having a databinding
problem. I am trying to bind a ListBox's ItemsSource property to the
Albums field of its parent page. In regular WPF, I would use this (ugly)
binding:
{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type
Page}}, Path=Albums}
But that apparently doesn't work in Windows Phone, and it's pretty ugly,
anyway. How can I do this?

Thursday, 29 August 2013

Are all joins in JPQL equijoins?

Are all joins in JPQL equijoins?

I am referring to joins using the keywords [LEFT [OUTER] | INNER] JOIN
only. Not to theta joins. Since there is no ON keyword in JPQL, is it safe
to assume that the equality comparison is always implied and used?

DOMDocument - set valid id for getElementById

DOMDocument - set valid id for getElementById

I am trying to get an element by id. But I am not successful. Why is the
following not able to find the element with my given id?
I have set up a test case:
<?php
$m_oDom = new DOMDocument( '1.0', 'UTF-8' );
$m_oDom->formatOutput = true;
$m_oDom->preserveWhiteSpace = false;
$m_oDom->validateOnParse = true;
$strId = "abc";
$oElement = $m_oDom->createElement( 'div' );
$oAttribute = $oElement->setAttribute( 'id', $strId );
$oElement->setIdAttribute( 'id', false ); // tried also without this
$oElement->appendChild( $oAttribute );
// $oAttribute = $oElement->getAttributeNode( 'id' );
$b = $oAttribute->isId();
if( $b ) {
echo "true";
} else {
echo "false"; // says false
}
$oElement = $m_oDom->getElementById( $strId );
if( $oElement ) {
echo "element";
} else {
echo "false"; // says false
}
?>

Wednesday, 28 August 2013

Differences between three different ways using module.exports

Differences between three different ways using module.exports

I saw some people use different ways to create a class but I really don't
know the differences or advantage using inline, use name or without
function name. For example:
// Style 1. Use module.exports on a var
var myClass = function MyClass() {
return something;
}
module.exports = myClass;
// Style 2. inline module.exports
module.exports = function MyClass() {
return something;
}
// Style 3. inline module.export without function name
module.exports = function () {
return something;
}
can anyone please explain or tell me the differences? I guess that using
with function name will give much more info on stack trace?
Thanks

execption notifier gem issue

execption notifier gem issue

I installed exception_notifier gem following this
http://railscasts.com/episodes/104-exception-notifications-revised. But
when running rails s, I got this
/home/ruby-2.0.0-p195/gems/actionpack-3.2.13/lib/action_dispatch/middleware/stack.rb:43:in
`build': undefined method `new' for ExceptionNotifier:Module
(NoMethodError)
So I tried to Google this problem, and I found that I could use in my
production.rb file this config.middleware.use ExceptionNotifier::Rack...
insted of this config.middleware.use ExceptionNotifier...
But then I got this message:
uninitialized constant ExceptionNotifier::Rack (NameError)
How should I handle this gem installation ?

Array of pointers vs. array of elements

Array of pointers vs. array of elements

This morning I've had a discussion with a colleague about this topic. He
says that it's always better to allocate arrays as arrays of pointers,
since allocating every single element separately has better chances to get
a free memory chunk. Somethink like this:
// Consider n_elements as a dynamic value
int n_elements = 10, i;
int **ary = (int **) malloc(sizeof(int *) * n_elements);
for(i = 0; i < n_elements; i++)
{
ary[i] = (int *) malloc(sizeof(int));
}
As opposed to his approach, I think that is better to allocate arrays of
elements, just because you'll get a compact memory chunk and not a bunch
of references spread around the heap. Something like this:
int n_elements = 10, i;
int *ary = (int *) malloc(sizeof(int) * n_elements);
ary[0] = 100;
After this conversation I've been thinking about it, and my final
conclusion is that it depends. I find the second solution a better
approach when dealing with small datatypes for the reason I mentioned
above, but when allocating arrays of large structs is probably better the
first one.
Apart of my conclusion, what do you think about it?

Expose routing to javascript in Laravel 4?

Expose routing to javascript in Laravel 4?

There is a bundle for Symfony 2 which allows application routes to be used
in your javascript files.
Does anyone know of an equivalent package for Laravel 4?
Any advice appreciated.
Thanks

SQL Looping temp table and reading data

SQL Looping temp table and reading data

I have following script to create temp data
DECLARE @Name NVARCHAR(100), @Marks INT
DECLARE @MYTABLE TABLE
(
[Name][nvarchar](100) NULL,
[Marks][INT] NULL
)
INSERT INTO @MYTABLE ([Name],[Marks]) VALUES ('Mark',50);
INSERT INTO @MYTABLE ([Name],[Marks]) VALUES ('Steve',50);
INSERT INTO @MYTABLE ([Name],[Marks]) VALUES ('Don',50);
Now I want loop it, as shown in below script
SELECT @MaxPK = MAX(PK) from @MYTABLE
WHILE @PK <= @MaxPK
BEGIN
SET @Name = SELECT Name from @MYTABLE
SET @Marks = SELECT Marks from @MYTABLE
print @Name
print @Marks
SET @PK = @PK + 1
END
But I get error near SELECT statement.
"Incorrect syntax near the keyword SELECT"!

exception when running decoding program

exception when running decoding program

i have a code to decode a string as follows:
public static void main(String[] args) throws IOException {
String base64="anybase64value"
byte[] bytes = Base64.decodeBase64(base64);
String tempDir = System.getProperty("java.io.tmpdir");
System.out.println(System.getProperty("java.io.tmpdir"));
String testFileName = "/tmp/" + "base64.xlsx";
FileOutputStream fos = new FileOutputStream(new File(testFileName));
IOUtils.write(bytes, fos);
System.out.println("Wrote " + bytes.length + " bytes to: " +
testFileName);
}
but when i run it throws me an error : The method write(byte[],
OutputStream) in the type IOUtils is not applicable for the arguments
(byte[], File) The method close() is undefined for the type File

Tuesday, 27 August 2013

how to return data to ajax from java Servlet

how to return data to ajax from java Servlet

i have my ajax function as follows:
$.ajax({
type: 'GET',
url: "/myservlet",
data: {
objects: '2',
dimension: '2',
},
success: function( data ) {
console.log(data);
alert(data);
},
error:function(data,status,er) {
alert("error: "+data+" status: "+status+"
er:"+er);
}
});
and i have my servlet to process the data sent to /myservlet. I read from
the ajax tutorial which said the data in the success function is the data
that ajax got from the server side. But i don't know how to set this data
or return this data from doGet method in a Java servlet to the frontend.
It seems doGet is a void method and cannot return any values, isn't it? I
am a freshman in web development, thanks in advance!

ios how to display image from webservice(SOAP)

ios how to display image from webservice(SOAP)

I send a request to the webservice and the webservice send back a response
to me. But the response seems to use MTOM/XOP so when i parse the received
nsdata into nsstring , it seems like this : {
uuid:6ed13bbd-dd6e-49e1-bd99-3006b0f8b4d6 Content-Type:
application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary Content-ID: >
">">" href="cid:05e576ce-09e6-4cd3-9a2e-607560749c8b-64@cxf.apache.org>"/>
--uuid:6ed13bbd-dd6e-49e1-bd99-3006b0f8b4d6 Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <05e576ce-09e6-4cd3-9a2e-607560749c8b-64@cxf.apache.org>>
image binary data here (it seems like messy word) } so how could I display
the image from this response? Thanks

DMD doesn't force restrictions on foreach

DMD doesn't force restrictions on foreach

According to the section "Foreach Restrictions" at
http://dlang.org/statement.html the following code
int[] a;
int[] b;
foreach (int i; a) {
a = null; // error
a.length += 10; // error
a = b; // error
}
a = null; // ok
should error.
But it doesn't for me when using 2.063.2 nor master.
Is this a regression bug?

Join Table one only one record but calculate field based on other rows inthe join

Join Table one only one record but calculate field based on other rows
inthe join

I am trying to write a query to Identify my subscribers who have abandoned
a shopping cart in the last day but also I need a calculated field that
represents weather or not they have received and incentive in the last 7
days.
I have the following tables
AbandonCart_Subscribers Sendlog
The first part of the query is easy, get abandoners in the last day
select a.* from AbandonCart_Subscribers
where DATEDIFF(day,a.DateAbandoned,GETDATE()) <= 1
Here is my attempt to calculate the incentive but I am fairly certain it
is not correct as IncentiveRecieved is always 0 even when I know it should
not be...
select a.*,
CASE
WHEN DATEDIFF(D,s.SENDDATE,GETDATE()) >= 7
THEN 1
ELSE 0
END As IncentiveRecieved
from AbandonCart_Subscribers a
left join SendLog s on a.EmailAddress = s.EmailAddress and s.CampaignID IS
NULL
where
DATEDIFF(day,a.DateAbandoned,GETDATE()) <= 1
Here is a SQL fiddle with the objects and some data. I would really
appreciate some help.
Thanks
http://sqlfiddle.com/#!3/f481f/1

Delphi: Devexpress TCxDbTreeList - Get index of Column

Delphi: Devexpress TCxDbTreeList - Get index of Column

I'm doing a helper for TcxTreeListNode becouse I have a huge program with
a lot of treelists and everytime I have to use the OndrawCustomCell, I'm
asking for a column value to make a confitional formating. The problem is
that the only way I have to do that is asking for the Column index and
that is very confusing. So, I'm trying to make a helper to TcxtreelistNode
so I can have this:
if (AViewInfo.Node.ValuesByName[cxDBTreeList1COLUMN_NAME] = 'bla') then
SOMETHING...
but I can't get to make my helper to get the correct index of the desired
column. I tried copying the method "treelist.ColumnByName(Name)" and
making it returning "I" (suposedly the index) instead of the hole colum,
but that Index is not the same one... Why? Where can i find the correct
Index of the column so I can use it as Value Parameter?
Any Ideas?
I'm working with:
DevExpress 12.1 Delphi XE4

Oracle 11g persisting arabic characters

Oracle 11g persisting arabic characters



I am trying to persist Arabic characters into Oracle 11g Database. When I
persist Arabic strings they persist successfully but, in the database they
appear as question marks ???????.

I searched and found that problem might be with database encoding, but I
think that might not be true as I am able to write Arabic strings from
SQLDeveloper and commit DB, it displays correctly within DB table. Also
when I retrieve that field and display it on screen, it displays
correctly.

So from this I concluded that DB recognizes Arabic and there is no problem
there. I tried setting Client/Server region language settings still did
not fix the problem. After reading this post and trying its suggestions, I
found that problem might be with persistence layer, that it does not
handle Arabic characters properly. What is the solution to this?

I am not sure if this is a redundant question but I am desperate. Any
help/advice is appreciated.
Systems I am using:
Server: Oracle Thin 11g
IDE: IBM WebSphere Integration Developer with JSF 1.2
Note: Still a beginner.

Emulate jQuery Mobile code inside a div tag on static HTML page

Emulate jQuery Mobile code inside a div tag on static HTML page

I use jquery mobile to design mobile only pages, It's awesome & simple.
But i have a requirement to show in a static HTML page how the mobile
design will be.
For Ex
<div id = "Mobile-View">
If i load the jQuery Mobile code here, the code should render in the same
way inside this div tag like it was rendering in mobile.
</div>
In simple words, i can say i am looking for simple jQuery Mobile emulator
that works on HTML page.
The one way i can think of doing this is, Render the jQuery mobile code in
browser & save the HTML, CSS and use the generated HTML,CSS to display the
same view inside the div tag.
But this way the code become clumsy.
There should be some easier ways to do this..
Any IDEAS?

Monday, 26 August 2013

CSS animation repeating when I don't want it to

CSS animation repeating when I don't want it to

I have a snippet of CSS here,
@keyframes slidein {
0% {
transform: translateY(30px);
opacity: 0;
}
70% {
transform: translateY(-5px);
opacity: 0.25;
}
100% {
transform: translateY(0px);
opacity: 0.25;
}
}
@-webkit-keyframes slidein {
0% {
-webkit-transform: translateY(30px);
opacity: 0;
}
70% {
-webkit-transform: translateY(-5px);
opacity: 0.25;
}
100% {
-webkit-transform: translateY(0px);
opacity: 0.25;
}
}
@keyframes bounce {
0% {
transform: translateY(0px);
}
100% {
transform: translateY(-5px);
opacity: 1;
}
}
@-webkit-keyframes bounce {
0% {
-webkit-transform: translateY(0px);
}
100% {
-webkit-transform: translateY(-5px);
opacity: 1;
}
}
.icons img {
display: inline-block;
width: 32px;
height: 32px;
padding: 10 10 10 10;
margin: 10 10 10 10;
opacity: 0.5;
transition-duration: 0.5s;
animation: slidein .2s linear 0s 1 normal forwards;
-webkit-animation: slidein .2s linear 0s 1 normal forwards;
}
.icons img:hover {
animation: bounce .2s linear 0s 1 normal forwards;
-webkit-animation: bounce .2s linear 0s 1 normal forwards;
}
Whenever I hover over the img, the bounce animation plays like it should,
but when I remove my mouse from the img, the slidein animation plays
again. I only want slidein to play on page load. How would I go about
doing that? Thanks in advance!

Android - adding Twitter handle to phonebook

Android - adding Twitter handle to phonebook

I am trying to add a Twitter handle to a contact using the
ContactsContrtact API, but I can't seem to figure out how to add a custom
protocol to my Intent. Has anyone done something like this?
Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT,
Uri.parse("mailto: user@example.com"));
Intent.putExtra(ContactsContract.Intents.Insert.IM_HANDLE, "username");
Intent.putExtra(ContractsContact.Intents.Insert.IM_PROTOCOL, "twitter");
startActivity(intent);
This does not work probably because the Intent extras are not associated
with one another? I was looking into something along the line of using the
ContentProviderOperation like this code snippet.

Mirroring certain files/directories of a git repository

Mirroring certain files/directories of a git repository

I'd like to maintain a mirror version of Twitter's Bootsrap for my
development environment. Now I'm not interested in polluting my work
directory with all the contents of Bootstrap. I rather only want to mirror
certain directories in their appropriate places. Consider this example:
./myComputer github.com/twbs/bootstrap
+ assets |
+ js |
| + lib |
| + bootstrap <--- + js/*
+ css |
| + lib |
| + bootstrap <--- + less/*
+ fonts <--- + fonts/*
This should be a basic downstream mirror. I don't expect git to keep track
of my changes I make locally. I just want it to apply patches on a regular
base. I've read Mirror a git repository by pulling?, but this method
doesn't allow me to only pick certain direcotries to sync.

Hide or temporarily remove a child ViewController from a parentViewController?

Hide or temporarily remove a child ViewController from a
parentViewController?

(asking and self-answering, since I found no hits on Google, but managed
to find a solution in the end by trial and error)
With iOS 5 and 6, Apple added some ugly hacks to make InterfaceBuilder
support "embedded" viewcontrollers. They didn't document how those work,
they only give code-level examples, and they only cover a limited subset
of cases.
In particular, I want to have an embedded viewcontroller that is sometimes
hidden - but if you try the obvious approach it doesn't work (you get a
white rectangle left behind):
childViewController.view.hidden = TRUE;

Man Utd vs Chelsea Live Online Streaming tv

Man Utd vs Chelsea Live Online Streaming tv

Watch Manchester United vs Chelsea Live Streaming Link
So the first high profile game of the season is between defending
Champions Manchester United and Jose Mourinho's men Chelsea at old
trafford on 26th August 2013 in a night game which kicks off at around
20:00 BST at SkySports 1 and we will have the live streaming of the game 1
hour before the match with pre match build up show of Skysports with Gary
Neville and Jaimi Carragher. Chelsea are coming into this match on the
back of a 2-1 win over aston villa and now sit on top of the table with 6
points and have wonderfull oppertunity to already put the stamp on title
challenge with a win at Old Trafford which will get them 6 points lead
from United the real title challengers.
Watch Manchester United vs Chelsea Live Streaming Link

If state of checkbox was changed can it be permanently saved on page?

If state of checkbox was changed can it be permanently saved on page?

If checkbox was checked/unchacked I want to save its state permanently on
page. I try smth like this:
function saveState() {
document.getElementById($(this).parent().attr('id')).innerHTML =
'<input type="checkbox" checked onclick="saveState.call(this)">'
}
and
<td id="test"> <input type="checkbox" onclick="saveState.call(this)"> </td>
But after page refresh this changes is missed.

release db connections in standalone application

release db connections in standalone application

I am working on a standalone application using Spring/JPA and I am trying
to release properly the database resources used.
In a Web application using tomcat for example, we shutdown the server, and
this way, we let Tomcat manage the resources.
But as I am in a standalone app, I have to take care about this, I use
Runtime.getRuntime().addShutdownHook to "catch" the shutdown event and
call ((ClassPathXmlApplicationContext) context).close();, something like
this:
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
((ClassPathXmlApplicationContext) context).close();
}
It works but with an exception in the stacktrace if a thread was using a
connection. I am wondering if there is another option? Maybe getting a
list of open transactions and force them to rollback?

openID login (on localhost) at google app engine

openID login (on localhost) at google app engine

I've written openID login for google App engine.
static {
openIdProviders = new HashMap<String, String>();
openIdProviders.put("Google",
"https://www.google.com/accounts/o8/id");
openIdProviders.put("Yahoo", "yahoo.com");
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser(); // or
req.getUserPrincipal()
Set<String> attributes = new HashSet();
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
if (user != null) {
out.println("Hello <i>" + user.getNickname() + "</i>!");
out.println("[<a href=\"" +
userService.createLogoutURL(req.getRequestURI())+ "\">sign
out</a>]");
} else {
out.println("Sign in at: ");
for (String providerName : openIdProviders.keySet()) {
String providerUrl = openIdProviders.get(providerName);
String loginUrl =
userService.createLoginURL(req.getRequestURI(), null,
providerUrl, attributes);
out.println("[<a href=\"" + loginUrl + "\">" +
providerName+ "</a>] ");
}
}
}
everything works very well when I deploy my app. No problems. after
choosing openID provider, I'm redirected to that page:
sample.appspot.com/_ah/login_redir?claimid=[OPen ID provider]=[my sample
page]/_ah/login_required
that's my servlet.
<servlet>
<servlet-name>Authorization</servlet-name>
<servlet-class>ge.eid.test.Authorization</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Authorization</servlet-name>
<url-pattern>/_ah/login_required</url-pattern>
</servlet-mapping>
ok. everything is fine! but, when I run the sampe app at localhost, I have
another redirection URL:
http://localhost:8888/_ah/login?continue=/F_ah/Flogin_required
so I do not have OpenID login. I have something like that:
question 1) How to create openID login at localhost too.

Sunday, 25 August 2013

checkboxes and contextual action bars

checkboxes and contextual action bars

How do I implement an OnCheckedChanged listener to invoke a contextual
action bar on item checked in a listView. Plus lets assume that the number
of checkboxes are unknown(being called through an api and already has a
custom adapter)

What class does getFirstName() belong to when authenticating using Play Services

What class does getFirstName() belong to when authenticating using Play
Services

Ok I'm refering the Android-Google docs here:
http://developer.android.com/google/play-services/auth.html
It has this part of code where it calls getFirstName() without using any
object. I'm not able to guess what class's object to make or
implement/extend.
here's that part of the code, rest everything is on that link:
URL url = new
URL("https://www.googleapis.com/oauth2/v1/userinfo?access_token=" +
token);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
int serverCode = con.getResponseCode();
//successful query
if (serverCode == 200) {
InputStream is = con.getInputStream();
String name = getFirstName(readResponse(is)); //THIS LINE!!
mActivity.show("Hello " + name + "!");
is.close();
return;
//bad token, invalidate and get a new one
} else if (serverCode == 401) {
GoogleAuthUtil.invalidateToken(mActivity, token);
onError("Server auth error, please try again.", null);
Log.e(TAG, "Server auth error: " + readResponse(con.getErrorStream()));
return;
//unknown error, do something else
} else {
Log.e("Server returned the following error code: " + serverCode, null);
return;
}

Rails 4 Ckeditor error, setting toolbar

Rails 4 Ckeditor error, setting toolbar

I get a "wrong number of arguments (4 for 0)" error when using the code
below which is how it is described in the current docs for the ckeditor
gem
= f.cktext_area :content, :class => "ckeditor", :ckeditor => {:toolbar =>
"mini"}
using the code below works but I'm unable to set the toolbar to 'mini' (
ckeditor appears on the page but with the full toolbar )
= f.text_area :content, :class => 'ckeditor',:ckeditor => {:toolbar =>
"mini"}
how do I correctly add any settings?

Saturday, 24 August 2013

Spoof Google Maps Location

Spoof Google Maps Location

I've been working on a Location Spoofer to get more familiar with Android
programming and I've noticed that my app doesn't seem to spoof Google
Maps. It works well for Facebook and a few other apps that I've tested,
but even with Wifi and GPS turned off, Google Maps knows my exact position
rather than my spoofed one. I downloaded another spoofing app from the
Play Store (FakeLocation) and it also doesn't seem to trick Google.
This person seemed to have the same issue (Android Mock location don't
work with google maps), but they apparently were able to fix it by setting
the location accuracy. I tried that, and I also tried implementing the
other answer. Neither of them works correctly with Google Maps.
How can I trick Google Maps into using my fake LatLng values?

USB headsets in a Virtual Machine (using Oracle's Virtual Box, or VMware)

USB headsets in a Virtual Machine (using Oracle's Virtual Box, or VMware)

I have a Windows 8 computer and am currently using Oracle's Virtual Box to
run Debian 7.1 in a VM. I am doing this mostly with the goal of
programming voice control projects with Pocketsphinx that I could easily
put onto a Raspberry Pi, but for that to work, I need to be able to use a
USB mic. The mic I am using runs well on my Windows 8 host, but when I set
it up in virtual box, at first it records, but absolutely terrible, It
will only record pieces of what I am saying, and will be hard to
understand. Then, about 5 minutes in, I get a Blue Screen of Death on my
host, and it says something about an error in an executable called
something like vbox_usbhub.exe. All I am doing to set it up is going to
devices, clicking the mic, and then going to Debian's sound preferences
and under output I can find the mic. I am using Virtualbox 4.2.16, and I
have the expansion pack, and I think I have guest additions, but I may be
wrong (if someone can tell me how to know for sure I can update that.) If
anyone knows how to make this work in virtualbox, that would be great, but
even if I need to install something like VMware I am willing to do that.
Thank you so much for your help.

Does iOS have the capability to execute multiple apps in memory, and enable you to switch between them, restoring the previous state?

Does iOS have the capability to execute multiple apps in memory, and
enable you to switch between them, restoring the previous state?

This is for buying purposes; i.e. does the kernel schedule the processes
and threads belonging to every process, and do the apps save states that
can be resumed at the user's discretion?
Can you run two separate apps without one having to pause; i.e. a download
from Safari going in a background process while watching a Netflix movie?
Please fill me in on the multitasking capabilities, and
scheduling/structure of iOS's kernel. Thanks.

Why is the app crashing?

Why is the app crashing?

I am a new programmer to android. I have checked my code over and over
again but just cant make out to get it running!!
public class Playlist extends Activity
{
Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState)
{
ListView myListView = (ListView)findViewById(R.string.playlistHolder);
final ArrayList<String> songslist= new ArrayList<String>();
final ArrayAdapter<String> aa= new
ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,songslist);
myListView.setAdapter(aa);
/*requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);*/;
setContentView(R.layout.activity_playlist);
// Show the Up button in the action bar.
setupActionBar();
String[] STAR = { "*" };
Uri allsongsuri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
cursor = managedQuery(allsongsuri, STAR, selection, null, null);
if (cursor != null)
{
if (cursor.moveToFirst())
{
do
{
//SongName
String song_name = cursor
.getString(cursor
.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
//SongID
int song_id = cursor.getInt(cursor
.getColumnIndex(MediaStore.Audio.Media._ID));
//SongPath
String fullpath = cursor.getString(cursor
.getColumnIndex(MediaStore.Audio.Media.DATA));
//Song's album name
String album_name = cursor.getString(cursor
.getColumnIndex(MediaStore.Audio.Media.ALBUM));
//Song's album ID
int album_id = cursor.getInt(cursor
.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
//Song's artist name
String artist_name = cursor.getString(cursor
.getColumnIndex(MediaStore.Audio.Media.ARTIST));
//Song's artist ID
int artist_id = cursor.getInt(cursor
.getColumnIndex(MediaStore.Audio.Media.ARTIST_ID));
songslist.add(song_id,song_name);//Adding Song to Arraylist
aa.notifyDataSetChanged();//Notifying Listview about
addition of song.
} while (cursor.moveToNext());
}
cursor.close();
}
super.onCreate(savedInstanceState);
}
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
{
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.playlist, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case android.R.id.home:
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
//
http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
The application crashes as soon as I click on the Playlist button! I have
initiated a new Intent from my home activity ->Playlist It is as follows
playlist.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
// TODO Auto-generated method stub
Intent plist = new Intent(arg0.getContext(), Playlist.class);
startActivityForResult(plist, 0);
}
});

Is their any way to find plugins installed in a WordPress site

Is their any way to find plugins installed in a WordPress site

I been searching long of any way to find the list of the plugins installed
in a WordPress site. Though i got a way, the "http-wp-plugins.nse" brute
force script but i don't know how to use this script. If any body know any
way please share, Thanks.

Snow Leopard installer ISO on USB flash drive

Snow Leopard installer ISO on USB flash drive

I have the setup ISO file for my Mac OS X Snow Leopard. I need to be able
to boot this and install it to a USB drive (from a windows pc by booting
the USB drive).
I can't run it in a virtual environment and I can't burn it to a DVD (it
doesn't work for some reason. It only makes a ~120KB of data on the DVD).
So, I need to make a bootable USB installer from the Snow Leopard ISO so I
can boot that and install it to another USB/hard drive (this has to be
done from a windows machine). I have tried Multiboot ISO but it requires
the USB to be formatted as FAT32 and as the ISO is over 4GB, this won't
work.
How can I create the bootable installer?

Core dump with PyQt4

Core dump with PyQt4

I am starting with PyQt4 and am facing a coredump when using
QGraphicsScene/View in the easiest of the examples:
#!/usr/bin/python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
app = QApplication(sys.argv)
grview = QGraphicsView()
scene = QGraphicsScene()
grview.setScene(scene)
grview.show()
sys.exit(app.exec_()
The program runs, but when closing it it gives tons of GTK errors (using
Ubuntu) and finally the core dump (segmentation fault):
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(python:2732): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion
`GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
Violación de segmento (`core' generado)
I assume this has something to do with my linux setup. Anyone faced this
before?
Thanks!

Friday, 23 August 2013

I've installed the Admob plugin into my Phonegap project... now what?

I've installed the Admob plugin into my Phonegap project... now what?

Following the installation instructions on the Admob Phonegap plugin page
on GitHub, it seems like it's all gone well without errors.
However, even though the functionality is theoretically available, I don't
see how to implement it. Where in my Javascript or HTML files do I place
code to actually display an Admob ad?
Where do I get that code for the Admob ad?

PHP and the eBay API - Find out who purchased items

PHP and the eBay API - Find out who purchased items

I've used a site before which automatically sends product codes to users
after purchasing a product. Now, because my brain isn't very creative when
it comes to search terms, I've had a bit of trouble finding out which part
of their API I should be looking at.
I am interested to know how to check an eBay item ID and list it's
buyer(s), their email address and so forth. The site I used required no
additional information from me, just an eBay item ID.
If anyone knows what I need to look at, I'll be extremely grateful.

PhoneGap App rejected 10.6

PhoneGap App rejected 10.6

Our PhoneGap App just got rejected.
Binary Rejected:
10.6: Apple and our customers place a high value on simple, refined,
creative, well thought through interfaces. They take more work but are
worth it. Apple sets a high bar. If your user interface is complex or less
than very good it may be rejected
Text:
"We found the following issues with the user interface of your app:
Did not include iOS features. For example, it would be appropriate to use
native iOS buttons and iOS features other than just web views, Push
Notifications, or sharing.
Specifically, we noticed the app provides a consumption of information
with limited ways users can interact with that information. It would be
appropriate to add iOS specific UI and functionality rather than
displaying just text and table views."
On above they are first referring to the interface and the look and next
they are reffering to just the content/function and that the app just
provides informations.
The Interface is clean and simple. It is an application that provides
(premium) informations. There are several apps in app store who work like
this.
I heard about including some plugin or API so that I can justify the App.
But there would be no sense in this app for the use of an plugin. Or has
someone an Idea to provide fake functions?
Would be sad if we couldn't release this app, we put a lot of time and
afford in this app.
Has anyone tips on how to submit an information-based application?
Thank you very much.
Erdnuss.

Making sure DOM element has positive width

Making sure DOM element has positive width

Will checking the width attribute be sufficient to make sure my DOM
element has a positive width or should I also check for css rules (I am
only looking for element that have a fixed number of pixels as a CSS rule,
not %).
if (element.width && element.width > 0) // do stuff
/** ---- or ---- */
if ((element.width && element.width > 0)
|| (element.css && element.css.width
&& int(element.css.width.replace("px", ""), 10)>0 ) // do stuff
I would rather go for the first one but I want to make sure that setting
the CSS rule will also set the width attribute.

wordpress: remove duplicate phrases in a foreach loop

wordpress: remove duplicate phrases in a foreach loop

I have the following problem:
In my wordpres 3.6 I have for posts a custom field called: "topics". The
field is automaticlly filled with phrases from another website by RSS, and
it adds multiple criteria. It is filled in like this:
"Cars,Bikes,Stuff,Gadget"
When I query wordpress with get_posts I get in my foreach loop this:
Cars,Bikes,Stuff,Gadget
Cars,Bikes
Bikes,Stuff
Gadget
I put this into a string and replace some stuff:
$topic_filter = get_posts(
array(
'numberposts' => -1,
'post_status' => 'private',
)
);
$search_topic = array(' ', '-&-', '-|-', '-/-', '---');
$replace_topic = array("-", "-", "-", "-", "-", "");
foreach ($topic_filter as $post_topic) {
$str = str_replace($search_topic, $replace_topic,
get_post_meta($post_topic->ID, 'topic', true));
echo $str;
}
final echo putput is then:
Cars,Bikes,Stuff,Gadget,Cars,Bikes,Bikes,Stuff,Gadget
So far so good. But how to remove the duplicates now?
I tried implode / explode, but it doesn't do anything, because the items
are in a foreach loop I think, and it only apply inside for each post.
But I need the foreach loop, because in the end the goal is to get this
cleaned string as a list in an html output something like this:
<input
type="button"
value="Cars"
class="filter-button"
data-control-type="button-filter"
data-control-action="filter"
data-control-name="Cars-btn"
data-path=".Cars"
/>
<input
type="button"
value="Bikes"
class="filter-button"
data-control-type="button-filter"
data-control-action="filter"
data-control-name="Bikes-btn"
data-path=".Bikes"
/>
<input
type="button"
value="Gadget"
class="filter-button"
data-control-type="button-filter"
data-control-action="filter"
data-control-name="Gadget-btn"
data-path=".Gadget"
/>
seems pretty complicated to me :-(
any ideas? I would be really happy for your help!
Thanks!

Working with for loop in Jquery

Working with for loop in Jquery

I want to use for loop in JQuery.Recently am using this
var os= $tr.find("td:eq(1)").html();
But putting inside for loop it alerts undefined value
var i;
for(i=0; i<3; i++) {
var os= $tr.find("td:eq('+i+')").html();
alert("os----------------------"+os)
}

Thursday, 22 August 2013

jquery html() vs empty().append() performance

jquery html() vs empty().append() performance

I have created a test case at
http://jsperf.com/jquery-html-vs-empty-append-test to compare the
performance of $.html() with $.empty().append(). I wondered that
.empty().append() is faster.
Can anyone explain this performance gap?
Thanks.

updating / maintaining bootstrap web design with LESS mixins

updating / maintaining bootstrap web design with LESS mixins

Is it possible to maintain/update bootstrap with LESS like so:
Imagine earlier version, for this example 2.3.2, it includes classes like
span4, span12, etc. I would have custom-bootstrap.less like so:
.myown4columnclass {
.span4;
}
Then, the new version comes along, 3.0.0 I'd like to change
custom-bootstrap.less to:
.myown4columnclass {
.col-md-4;
}

Returning values from Javascript modules after ajax call

Returning values from Javascript modules after ajax call

So I would like to say up front that I think this is not the standard "how
do I return a value from an ajax call" issue where people aren't waiting
for the async call to finish. I think this is a variable scope
misunderstanding with Javascript module patterns, so any guidance would be
appreciated.
I am following this SO post on constructing my ajax call, so I am using
deferred objects to crunch my data after the call finishes. And also
several tutorials on the Javascript module pattern, like this and this. It
seems fairly straightforward to return values from within a private module
inside my outer module--however, I always get myObj.roots() as undefined.
Even though it is defined as an array of X values when I check with
breakpoints. What simple thing am I missing--any hints? Thanks! Sorry for
a simple question, I'm entirely new to JS module patterns and trying to
build my own library...
My JS code:
var myObj = (function(window,document,$,undefined){
var _baseUri = 'http://example.com/',
_serviceUri = 'services/',
_bankId = '1234',
_myUri = _baseUri + _serviceUri + 'objectivebanks/' + _bankId,
_roots = [];
function myAjax(requestURL) {
return $.ajax({
type: 'GET',
url: requestURL,
dataType: 'json',
async: true
});
}
var getRoots = function() {
var _url = _myUri + '/objectives/roots';
_roots = [];
myAjax(_url).done(function(data) {
$.each(data, function(index, nugget) {
_roots.push(nugget);
});
return _roots;
}).fail(function(xhr, textStatus, thrownError) {
console.log(thrownError.message);
});
}
return {
roots: getRoots
};
})(this,document,jQuery);
My error (from Chrome's developer tools' console):
MC3.roots()
undefined

Send current state of Kendo Grid to SSRS

Send current state of Kendo Grid to SSRS

I am setting up a couple grids with sorting, grouping and filtering
options. Once the grid is in the state the user wants, I want to use a
'Print Grid' button to send the state to ssrs 2008, to basically make a
printable version of the grid. I have found how to get the state
(http://jsbin.com/erefug/1/edit) but I can not find how to send it to
ssrs.
I have done just a standard url to a report plenty of times, and I am
thinking I somehow need to get the state info into the url, but I am at a
loss on how to do that, or if it is event he way to go. Let me know what
you think.

submitting html form using php not working

submitting html form using php not working

This is the continuation of my previous issue. I made the code simple and
suspecting issue is with second form submission.
This is the code structure:
A form (form1) with two input field for name and place
After form submission,(and ONLY if in two fields, user entered data)
creating an another form (form2) with a text area to display the php echo
from previous form and another two submit buttons
In actual I am using the second form's submit buttons for text save and
email (here I just replaced it with a simple textarea echo to make it
simple)
CODE:
<html>
<body>
<div class="emcsaninfo-symcli-main">
<form id="form1" name="form1" action=" " method="post" >
<div class="input">Your Name</div>
<div class="response"><span><input class="textbox" id="myname"
name="myname" type="text" value="" /></span> </div>
<div class="input">Your Place</div>
<div class="response"><span><input class="textbox" id="myplace"
name="myplace" type="text" value="" /></span> </div>
<div class="submit">
<input id="first_submit" type="submit" name="first_submit"
value="first_submit" />
</div>
</form>
<?php
if(!empty($_POST['myname']) && !empty($_POST['myplace']) )
{
$myname = $_POST['myname'];
$myplace = $_POST['myplace'];
?>
<form id="form2" name="form2" action=" " method="post" >
<textarea onclick="this.select()" name="output_textarea"
id="output_textarea" cols="100" rows="25" readonly>
<?php
echo "My name is $myname and I am from $myplace";
?>
</textarea>
<input id="submit1" type="submit" name="name_field" value="submit1" />
<input id="submit2" type="submit" name="place_field" value="submit2" />
</form>
<?php
function name()
{
echo $_POST["output_textarea"];
}
if(isset($_POST['name_field']))
{
name();
}
function place()
{
echo $_POST["output_textarea"];
}
if(isset($_POST['place_field']))
{
place();
}
}
?>
</div>
</html>
</body>
Issue: The first form form1 submit works fine.It will create the output
textarea with two other submit button submit1 and submit2. But when I
submitting the second form form2 using these two buttons, the form is not
submitting properly, it just refreshing the html with initial code.
My requirement is when I press the second form submit button, it has to
echo the output from textarea again, after keeping the first form textarea
in its position.
PHP FIDDLE:
I have setup a php fiddle to understand the issue PHP FIDDLE MAIN PHP
FIDDLE execution results -

Error in Sandboxed App, When loading Helper (LoginItems), code signing issue

Error in Sandboxed App, When loading Helper (LoginItems), code signing issue

I'm trying to get out of this problem (I hope it's the last!)
Briefly, I have one status bar app, which needs to start at login. I
followed this tutorial
http://blog.timschroeder.net/2012/07/03/the-launch-at-login-sandbox-project/
Everything it's working, but when it's time for testing the app in a real
contest, outside xcode, I end up with this message in the console
system.log:
appleeventsd[52]: <rdar://problem/11489077> A sandboxed application with
pid 1258, "xxxxx" checked in with appleeventsd, but its code signature
could not be validated ( either because it was corrupt, or could not be
read by appleeventsd ) and so it cannot receive AppleEvents targeted by
name, bundle id, or signature. Error=ERROR: #-67061 {
"NSDescription"="SecCodeCheckValidity() returned -67061, <SecCode
0x7fb0ea714300 [0x7fff71381e10]>." } (handleMessage()/appleEventsD.cp
#2072) client-reqs-q
What i did was checking the code signature with this command: spctl
--assess --type execute AppName
The result was code signature ok for both the Main app, and the Helper app.
As you can see in the tutorial the helper app project is kept inside the
main app project. Maybe this is the cause?
I've tried different Signing profiles, now i'm using "Mac Distribuition"
I'm using OsX Mavericks DP6 And Xcode 5 beta ..
Any ideas?

Android radio group selection weird behaviour

Android radio group selection weird behaviour

I have a radio group with a strange behavior: At first no item is
selected, then I select the one on the left and I can change my selection
to the right one. However this is where the problem appears when switching
from right to left it just wont work. It stays in place. I have a few more
radio groups and they work just fine.
Here is the code:
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:button="@drawable/radio_selector"
android:paddingLeft="5dp"
android:text="Persoana fizica"
android:textSize="12dp" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:button="@drawable/radio_selector"
android:paddingLeft="5dp"
android:text="Persoana juridica"
android:textSize="12dp" />
</RadioGroup>

Wednesday, 21 August 2013

Does YouTube's upload page prevents Windows from entering sleep mode while uploading?

Does YouTube's upload page prevents Windows from entering sleep mode while
uploading?

If I set Windows to suspend the computer after 30 min of inactivity in the
Control Panel and leave a video uploading in Google Chrome, will the
computer suspend or will the upload page prevent the windows from
suspending? (like Windows Media Player does when playing a movie)

Converting HANDLE to Vertex/matrix

Converting HANDLE to Vertex/matrix

I want to load an image via
LoadImageW(...)
but I need to get the specific R/G/B of each individual pixel, and I
thought the best way would be to convert it into a Vertex but I can't find
any good way to do this.

Change Notification Layout

Change Notification Layout

I decompiled my system music app (from Sony Ericsson for Android GB 2.3.7)
because I want to change the notification layout. I found the method which
creates the notification with this code:
private void sendStatusBarNotification(Track paramTrack)
{
if (paramTrack != null)
{
NotificationManager localNotificationManager =
(NotificationManager)this.mContext.getSystemService("notification");
String str = paramTrack.getArtist();
if ((str == null) ||
(str.equals(this.mContext.getString(2131361954))))
str = this.mContext.getString(2131361798);
Notification localNotification = new Notification(2130837696,
paramTrack.getTitle() + " - " + str, System.currentTimeMillis());
localNotification.flags = (0x2 | localNotification.flags);
localNotification.flags = (0x20 | localNotification.flags);
PendingIntent localPendingIntent =
PendingIntent.getActivity(this.mContext, 0, new
Intent(this.mContext, MusicActivity.class), 268435456);
localNotification.setLatestEventInfo(this.mContext,
paramTrack.getTitle(), str, localPendingIntent);
localNotificationManager.notify(0, localNotification);
}
}
My question now is: How can I change the notification layout? I want to
build a layout which looks like the original android notification layout
but with an extra image on the right of the notification. How can I do
this?

display progress bar on webbrowser in windows phone

display progress bar on webbrowser in windows phone

I am developing a windows phone app with a browser in it.How to show
dynamic progress bar until the page loads in the brower,everytime the user
clicks on a link

Possible to refactor this if/else statement with lots of string scans?

Possible to refactor this if/else statement with lots of string scans?

I'm trying to reduce the following if/else statement...
event_description = "We have a record of item FJ750701138GB as being
delivered from Northampton North DO on 2013-08-10."
time = Time.now.strftime("%H:%M")
if date = event_description.scan(/We have a record of item [^>]* as being
delivered from [^>]* on ([^<]*)./i).join
datetime = Date.strptime("#{date} #{time}","%Y-%m-%d %H:%M").to_time
elsif date = event_description.scan(/Your item with reference [^>]* was
delivered from our [^>]* Delivery Office on ([^<]*) ./i).join
datetime = Date.strptime("#{date} #{time}","%d/%m/%y %H:%M").to_time
elsif date = event_description.scan(/Item [^>]* was collected and signed
for by the addressee on the ([^<]*) from [^>]*/i).join
datetime = Date.strptime("#{date} #{time}","%Y-%m-%d %H:%M").to_time
elsif date = event_description.scan(/Your item, posted on [^>]* with
reference [^>]* was delivered in [^>]* on ([^<]*)./i).join
datetime = Date.strptime("#{date} #{time}","%d/%m/%y %H:%M").to_time
end
event.occurred_at = datetime
The primary function of this is to scan various strings, pull the date out
of it, and create a Date object.
The dates can be in different formats (as you can see in the striptime
instances)
Over time, we'll be adding more elsif statements as we expand the strings
we're scanning, so hoping to condense this a bit so it's not so bulky.
There's a relatively decent amount of code repetition, so trying to figure
out how to refactor it a bit.

C# - Keep track of auto incrementing variable between serialization and deserialization

C# - Keep track of auto incrementing variable between serialization and
deserialization

I am working on a project and need help with regards to auto incrementing
ID fields.
In terms of serialization, what is the best way to get the ID from when it
was last serialized when it comes to deserialization of a static variable
that you have been auto incrementing upon each instantiation of a class.
For instance...
[Serializable]
class Category
{
private static int iCatID = 0;
private int iCategoryID;
private string sCategory;
public Category(string _sCategory)
{
iCatID++;
sCategory = _sCategory;
}
}
I learnt the hard way that after creating 5 or so instances of this class,
I serialized it, then deserialized and expected iCatID to pick up where it
left off when I started creating more instances of the class, but it had
of course reset back to 0.
What I want to know is how do I keep track of an auto incrementing
variable in between serialization and deserialization and what would be
best practice?
I've thought of two ways to possibly do it:
When serializing the class, save the value of the static variable to a
global setting and get that value again and set the static variable from
the global setting on deserialization.
When deserializing the class, use linq to query all instances of the class
and get the highest number and then set the static variable accordingly.
I'm sure that there's a more elegant way of dealing with this.
Any help would be great, thanks.

Android: font size bigger (wider?) on HTC One than on Galaxy S4

Android: font size bigger (wider?) on HTC One than on Galaxy S4

I'm using custom fonts for all components in my application. All font
sizes are defined in dimens.xml file in sp format.
However fonts are bigger (wider?) on HTC ONE and smaller on Galaxy S4
which messes up my layouts. Any idea how can I correct this?

Tuesday, 20 August 2013

PHP: undefined index error but variable has correct value when printed

PHP: undefined index error but variable has correct value when printed

I'm passing some values from an android app to a PHP script. I get an
undefined index error in my PHP script but the variables have the correct
values when I print them out from within the script. I want these errors
gone but I can't figure out why they are there in the first place. Here is
how they are passed to the PHP script.
//build url data to be sent to server
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username",username));
nameValuePairs.add(new BasicNameValuePair("password",password));
String result = "";
InputStream is = null;
//http post
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new
HttpPost("http://10.0.2.2/PasswordCheck.php");
httppost.setEntity(new
UrlEncodedFormEntity(nameValuePairs,"utf-8"));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}catch(Exception e){
Log.e("Connection", "Error in http connection "+e.toString());
}

What is the plural possessive of hyphenated words like son-in-law?

What is the plural possessive of hyphenated words like son-in-law?

I'm aware that the plural of son-in-law is sons-in-law and the singular
possessive is (I assume) son-in-law's, but I'm uncertain as to the general
convention for the possessive plural.
The first two things that come to mind are: 1) sons'-in-law 2) sons-in-law's

google map not displaying in android emulator

google map not displaying in android emulator

Please tell me some updated tutorials for displaying map on emulator. I
tried many, but it fails. Some are outdated and some are not easily
understandable. if anyone has created any blog or tutorial about google
map activity please share. Thanks in advance...

PHP - How do you hide specific content if $page = name

PHP - How do you hide specific content if $page = name

How do you hide specific content if $page = name
For example:
<?php
if ($page=='special'){
echo "<div>hello</div>";
}
?>
The above example will show the div if the $page = special. How do I do
the opposite of this, hide a specific div if the $page = something?

AngularJs filter "Error while interpolating"

AngularJs filter "Error while interpolating"

Inside my AngularJs filter I have the following:
return function(list){
return list;
}
That works fine
However, the following throws an error of "Error while interpolating {{
list | filterName}}...TypeError: list is undefined"
return function(list){
return list.length;
}
What is happening that is causing list to be undefined for a brief moment
when this function runs, or what can I do to fix this issue. The value
still gets returned, I just have a nasty error in console.

adding control at prevCon.Bottom but the gap keeps doubling

adding control at prevCon.Bottom but the gap keeps doubling

I am adding controls to a form like this
Dim sharpUserX As New SharpUser()
Dim y As Integer = 0
For Each con As Control In PnlSharpUsers.Controls
If TypeOf(con) is SharpUser then ' as i have the pnaddbtn, which i
move to the bottom below
If y < con.Bottom Then y = con.Bottom
End If
Next
sharpUserX.Location = New Point(2, y)
'sharpUserX.Location = pnlAddBtn.location 'this does that exact same
sharpUserX.Size = sharpUserSize
PnlSharpUsers.Controls.Add(sharpUserX)
'put add button back on
pnlAddBtn.Location = New Point(pnlAddBtn.Left, sharpUserX.Bottom)
'strangely this is always correct
This is called on a button press, which adds a ShrpUser control to my
panel, and then moves the addbtn panel to the bottom.
The add btn panel moves correctly, but the new control added gets added,
but the location seems to double the difference of the gap from it to the
previous control.
Heres the locations if i output them after each add
1 added
loc={X=2,Y=0} size={Width=849, Height=117}
2nd added
loc={X=2,Y=0} size={Width=849, Height=117}
loc={X=2,Y=135} size={Width=849, Height=117}
3rd added
loc={X=2,Y=0} size={Width=849, Height=117}
loc={X=2,Y=135} size={Width=849, Height=117}
loc={X=2,Y=291} size={Width=849, Height=117}
y on 2 should be 117 and y on 3 should be 234 the form does scale by font.
Im thinking this is whats causing it, but i cant figure out what to do,
and cant understand why the pnladdBtn works.

Monday, 19 August 2013

Reading Classdef type classes Using MatIO

Reading Classdef type classes Using MatIO

Hopefully you all will be reading this message in best of your health.
These days I am working on a project which contains one class def and I
want to read this file using MatIO library. I can easily read this file
using MatIO library but when I am trying to read the variable it is
showing that there is no variable inside the file but as I can see on
MATLAB that there is one class which contains several structs variable. I
am not getting any idea how to read class using MatIO library. If anyone
can point me in right direction then it will be very helpful for me.
classdef Mono_Data
properties
resolution
shutter_speed
filter_data
filter_device
saturation
zero
filter_data_wavelength
dark_noise
slit_size
comments
location
version
id
monochromator_gain
end
methods
......... ......... ........ end
This is the class def of my class and i want to read the respective
variables.
Waiting for a favorable response.
Thanks Regards

Dynamic Data Connection to Access Database files C#

Dynamic Data Connection to Access Database files C#

For the past three days, I've been struggling to get dynamic access to
.accdb files for a little program I am tinkering with. I'm at wits end on
how to do it, I've scoured StackOverflow, MSDN, Youtube spent well over
$100.00 on C# books and I still can't find it.
I know it's in bad taste to ask a question here without code, but I am
just so tired after two and half days with little to no sleep of trying to
figure it out.
My goal, is to have a file in the root directory of my program called
userData, within it are three other files, customData, openData and
propData. Each one will contain anywhere between 0 and 10 .accdb files in
the same format when manually added by the user outside the application.
(openData is an exception, it will always at least contain one .accdb
file)
I have no idea how to get this type of dynamic access set up. I've been
fighting with the OleDB library trying to manually generate connection
strings with zero success. I do know how to work with the access database
once it's loaded, I'm not asking for it to be done for me; but if anyone
knows a tutorial or can link me to an example I can take it from there.
Sorry to break decorum, but it's kind of disheartening when you spend a
week learning a language with no hiccups and one concept is seemingly
beyond your reach...

DHCP Reservation vs Mac address filtering. Are they the same security?

DHCP Reservation vs Mac address filtering. Are they the same security?

I am able to give an ip address to a wired/wireless device based on the
mac address. Other automatic DHCP is turned off.
Is this as effective as a security measure as MAC filtering?
It just seems to be an extra step on MAC filtering. I dont know why the
interfaces are not merged as one. Hence the question to make sure I do not
make a security mistake.

Python programming function sucked in computing the bill at codecademy

Python programming function sucked in computing the bill at codecademy

Write a function compute_bill that takes a parameter food as input and
computes your bill by looping through the food list and summing the costs
of each item in the list.
For now, go ahead and ignore whether or not the item you're billing for is
in stock.
Note that your function should work for any food list.
The Given code is
groceries = ["banana", "orange", "apple"]
stock = { "banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}
prices = { "banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
Write your code below! I've written this
def compute_bill(food):
total = 0;
for f in food:
if stock[f] > 0:
total+=prices[f]
stock[f] -=1
return total
compute_bill(groceries)
Error message is
Oops, try again! You code does not seem to work when ['apple'] is used as
input--it returns 0 instead of 2.