How to store html files on an XAMPP test server?
I'm trying to test out some basic AJAX programs but I can't figure out
where to put them or how to set up a file directory to run them on XAMPP
(MAC). Could anyone provide some clarity on this issue? Thanks.
Saturday, 31 August 2013
Linux: Makefile code that adds a daemon to startup scripts
Linux: Makefile code that adds a daemon to startup scripts
I'm currently designing a program that I want to run when my computer
boots up. I've written a daemon that runs the code, so what I want is a
way to run the daemon on startup. Here's my problem: I don't want to my
end user to have to manually add the daemon into their list of startup
scripts, I want the daemon to be added automatically when the program is
installed. At the moment I have a makefile that is installing the software
to my pc, so is there a way to get the makefile to insert the daemon into
the user's list startup scripts, so the daemon is run on startup?
Cheers
I'm currently designing a program that I want to run when my computer
boots up. I've written a daemon that runs the code, so what I want is a
way to run the daemon on startup. Here's my problem: I don't want to my
end user to have to manually add the daemon into their list of startup
scripts, I want the daemon to be added automatically when the program is
installed. At the moment I have a makefile that is installing the software
to my pc, so is there a way to get the makefile to insert the daemon into
the user's list startup scripts, so the daemon is run on startup?
Cheers
Java Graphics.drawRect being filled?
Java Graphics.drawRect being filled?
Im making a rectangle selector using the mouse, and i have a normal
drawRect rectangle surrounding it. When the width or height goes negative,
The Rectangle is filled. Is there any way to fix this? here is my code:
@SuppressWarnings("serial")
public class Pie extends JPanel{
public boolean running = true;
public Rectangle mouseRect;
public Rectangle rectBounds;
public int x1,y1,x2,y2;
public boolean showRect = false;
public Pie(){
setFocusable(true);
MAdapter mama = new MAdapter();
setDoubleBuffered(true);
this.addMouseListener(new MAdapter());
this.addMouseMotionListener(mama);
setBackground(Color.black);
Thread update = new Thread(){
public void run(){
while(running){
repaint();
try{Thread.sleep(2);}catch(InterruptedException e){}
}
}
};
update.start();
}
public void paintComponent(Graphics g){
super.paintComponent(g);
//if(y2 < y1) y2 = y1;
if(showRect){
g.setColor(new Color(0,250,0,50));
g.fillRect(x1,y1,x2 - x1,y2 - y1);
g.setColor(new Color(0,255,0));
g.drawRect(x1 - 1,y1 - 1,x2 - x1 + 1,y2 - y1 + 1);
}
}
class MAdapter extends MouseAdapter{
public void mousePressed(MouseEvent e){
showRect = true;
x1 = e.getX();
y1 = e.getY();
x2 = e.getX();
y2 = e.getY();
}
public void mouseDragged(MouseEvent e){
x2 = e.getX();
y2 = e.getY();
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
}
public void mouseReleased(MouseEvent e){
showRect = false;
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
}
}
public static void main(String[] args){
JFrame f = new JFrame("Aber");
f.setSize(500,500);
f.setResizable(true);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLocationRelativeTo(null);
f.add(new Pie());
}
}
Is there anything im doing wrong? thanks in advance.
Im making a rectangle selector using the mouse, and i have a normal
drawRect rectangle surrounding it. When the width or height goes negative,
The Rectangle is filled. Is there any way to fix this? here is my code:
@SuppressWarnings("serial")
public class Pie extends JPanel{
public boolean running = true;
public Rectangle mouseRect;
public Rectangle rectBounds;
public int x1,y1,x2,y2;
public boolean showRect = false;
public Pie(){
setFocusable(true);
MAdapter mama = new MAdapter();
setDoubleBuffered(true);
this.addMouseListener(new MAdapter());
this.addMouseMotionListener(mama);
setBackground(Color.black);
Thread update = new Thread(){
public void run(){
while(running){
repaint();
try{Thread.sleep(2);}catch(InterruptedException e){}
}
}
};
update.start();
}
public void paintComponent(Graphics g){
super.paintComponent(g);
//if(y2 < y1) y2 = y1;
if(showRect){
g.setColor(new Color(0,250,0,50));
g.fillRect(x1,y1,x2 - x1,y2 - y1);
g.setColor(new Color(0,255,0));
g.drawRect(x1 - 1,y1 - 1,x2 - x1 + 1,y2 - y1 + 1);
}
}
class MAdapter extends MouseAdapter{
public void mousePressed(MouseEvent e){
showRect = true;
x1 = e.getX();
y1 = e.getY();
x2 = e.getX();
y2 = e.getY();
}
public void mouseDragged(MouseEvent e){
x2 = e.getX();
y2 = e.getY();
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
}
public void mouseReleased(MouseEvent e){
showRect = false;
rectBounds = new Rectangle(x1,y1,x2 - x1, y2 - y1);
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
}
}
public static void main(String[] args){
JFrame f = new JFrame("Aber");
f.setSize(500,500);
f.setResizable(true);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLocationRelativeTo(null);
f.add(new Pie());
}
}
Is there anything im doing wrong? thanks in advance.
Initializing an array of strings dynamically in C
Initializing an array of strings dynamically in C
I know I can initialize an array of strings this way:
static const char *BIN_ELEMENTS[5] = {
"0000\0", // 0
"0001\0", // 1
"0010\0", // 2
"0011\0", // 3
"0100\0", // 4
};
But I need to accomplish that in a dynamic way. Reading the characters
from a File, and inserting them into an array. Then copy that array into
an array of strings (like above).
So let's say I captured the following chars from a File, and inserted them
into an array, like these:
>char number[5];
>char *listOfNumbers[10];
>number[0]='1';
>number[1]='2';
>number[2]='3';
>number[3]='4';
>number[4]='\0';
Now I would like to copy the whole content of number, into listOfNumers[0]
// meaning that I've stored "1234" in position 0 of listOfNumers. Leaving
9 more positions to store different numbers.
So I would do something like this:
>listOfNumers[0] = number; //this actually seems to work.
But since its a huge file of numbers, I need to reuse the array number, to
extract a new number. But when I do that, the content previously stored in
listOfNumers[0] gets overwritten, eventho I updated the new position for
the new number. How can I deal with that?
Here is what I have so far:
char number[5]; //array for storing number>
int j=0; // counter
int c; //used to read char from file.
int k=0; // 2nd counter
char*listOfNumbers[10]; //array with all the extracted numbers.
FILE *infile;
infile = fopen("prueba.txt", "r");
if (infile)
{
` while ((c = getc(infile)) != EOF)`
` {`
` if(c != ' ' && c != '\n' && c != EOF)`
{`
` number[k] = c;`
` ++k;`
` }`
` else`
` {`
` number[k] = '\0';`
` listOfNumbers[j]=number;`
` printf("Element %d is: %s\n",j,listOfNumbers[j]); `
` ++j;`
` k=0;`
` }`
` }`
` fclose(infile);`
}
printf("\nElement 0 is: %s\n", decimales[0]); //fails - incorrect value
printf("Element 1 is: %s\n", decimales[1]); //fails - incorrect value
printf("Element 2 is: %s\n", decimales[2]); //fails - incorrect value
I know I can initialize an array of strings this way:
static const char *BIN_ELEMENTS[5] = {
"0000\0", // 0
"0001\0", // 1
"0010\0", // 2
"0011\0", // 3
"0100\0", // 4
};
But I need to accomplish that in a dynamic way. Reading the characters
from a File, and inserting them into an array. Then copy that array into
an array of strings (like above).
So let's say I captured the following chars from a File, and inserted them
into an array, like these:
>char number[5];
>char *listOfNumbers[10];
>number[0]='1';
>number[1]='2';
>number[2]='3';
>number[3]='4';
>number[4]='\0';
Now I would like to copy the whole content of number, into listOfNumers[0]
// meaning that I've stored "1234" in position 0 of listOfNumers. Leaving
9 more positions to store different numbers.
So I would do something like this:
>listOfNumers[0] = number; //this actually seems to work.
But since its a huge file of numbers, I need to reuse the array number, to
extract a new number. But when I do that, the content previously stored in
listOfNumers[0] gets overwritten, eventho I updated the new position for
the new number. How can I deal with that?
Here is what I have so far:
char number[5]; //array for storing number>
int j=0; // counter
int c; //used to read char from file.
int k=0; // 2nd counter
char*listOfNumbers[10]; //array with all the extracted numbers.
FILE *infile;
infile = fopen("prueba.txt", "r");
if (infile)
{
` while ((c = getc(infile)) != EOF)`
` {`
` if(c != ' ' && c != '\n' && c != EOF)`
{`
` number[k] = c;`
` ++k;`
` }`
` else`
` {`
` number[k] = '\0';`
` listOfNumbers[j]=number;`
` printf("Element %d is: %s\n",j,listOfNumbers[j]); `
` ++j;`
` k=0;`
` }`
` }`
` fclose(infile);`
}
printf("\nElement 0 is: %s\n", decimales[0]); //fails - incorrect value
printf("Element 1 is: %s\n", decimales[1]); //fails - incorrect value
printf("Element 2 is: %s\n", decimales[2]); //fails - incorrect value
app crashes when switching to landscape on Nexus 4 but not on Nexus 7
app crashes when switching to landscape on Nexus 4 but not on Nexus 7
my app crashes when i'm switching to landscape on my Nexus 4 but not on my
Nexus 7! i don't have a logcat for the nexus 4 because i wasn't able to
set it up for debugging so i created an apk and installed it on the nexus
4. on the nexus 7 runs a debugged version of my app.
i use a layout with 3 fragment-tabs and 2 of them have an own landscape
layout.
tab1 landscape:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab1">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:layout_marginTop="25dp">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tableRow2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="07:45 - 08:30"
android:id="@+id/uhrzeit1"
android:layout_margin="5dp"
android:layout_column="0"
android:lines="2"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Deutsch \n in 404"
android:id="@+id/montag1"
android:layout_margin="5dp"
android:layout_column="1"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/dienstag1"
android:layout_margin="5dp"
android:layout_column="2"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/mittwoch1"
android:layout_margin="5dp"
android:layout_column="3"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/donnerstag1"
android:layout_margin="5dp"
android:layout_column="4"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/freitag1"
android:layout_margin="5dp"
android:layout_column="5"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
</TableRow>
and 10 excactly same table rows
tab1 portrait:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab1">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="07:45 -\n08:30"
android:id="@+id/uhrzeit1p"
android:layout_column="0"
android:textIsSelectable="false"
android:textSize="25sp"
android:layout_margin="5dp"
android:lines="2"
android:clickable="true"
android:onClick="onTextViewClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/actualLesson1"
android:layout_column="1"
android:textIsSelectable="false"
android:textSize="25sp"
android:layout_margin="5dp"
android:lines="2"
android:layout_weight="50"
android:clickable="true"
android:onClick="onTextViewClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/actualNote1"
android:layout_column="2"
android:textIsSelectable="false"
android:textSize="25sp"
android:layout_margin="5dp"
android:lines="2"
android:layout_weight="50"
android:clickable="true"
android:onClick="onTextViewClick"/>
</TableRow>
and 10 table rows too
tab2 portrait:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab2">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:layout_marginTop="25dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button8"
android:background="#FFFFFF"
android:layout_below="@+id/button7"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:onClick="onClickKaTest"/>
and 9 buttons
tab2 landscape:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab2">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:layout_marginTop="25dp">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#FFFFFF"
android:layout_margin="5dp"
android:layout_weight="50"
android:onClick="onClickKaTest"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:background="#FFFFFF"
android:layout_below="@+id/button"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:layout_weight="50"
android:onClick="onClickKaTest"/>
</TableRow>
and 4 table rows
tab3:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab3">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/radioGroupKAtest"
android:layout_margin="25dp">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Klassenarbeit"
android:id="@+id/KA"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"
android:id="@+id/test"
android:layout_gravity="left|center_vertical"/>
</RadioGroup>
<DatePicker
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/datePicker"
android:calendarViewShown="true"
android:spinnersShown="true"/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/radioGroupKAtest2"
android:layout_margin="25dp">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde1"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde2"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde3"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde4"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde5"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde6"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde7"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde8"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde9"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde10"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde11"
android:layout_gravity="left|center_vertical"/>
</RadioGroup>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/themenEditText"
android:layout_marginLeft="25dp"/>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Ok"
android:id="@+id/okButton"
android:onClick="OkOnClick"
android:layout_marginLeft="25dp"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
EDIT: on both devices runs android 4.3 JellyBean
my app crashes when i'm switching to landscape on my Nexus 4 but not on my
Nexus 7! i don't have a logcat for the nexus 4 because i wasn't able to
set it up for debugging so i created an apk and installed it on the nexus
4. on the nexus 7 runs a debugged version of my app.
i use a layout with 3 fragment-tabs and 2 of them have an own landscape
layout.
tab1 landscape:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab1">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:layout_marginTop="25dp">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tableRow2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="07:45 - 08:30"
android:id="@+id/uhrzeit1"
android:layout_margin="5dp"
android:layout_column="0"
android:lines="2"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Deutsch \n in 404"
android:id="@+id/montag1"
android:layout_margin="5dp"
android:layout_column="1"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/dienstag1"
android:layout_margin="5dp"
android:layout_column="2"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/mittwoch1"
android:layout_margin="5dp"
android:layout_column="3"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/donnerstag1"
android:layout_margin="5dp"
android:layout_column="4"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/freitag1"
android:layout_margin="5dp"
android:layout_column="5"
android:lines="2"
android:layout_weight="20"
android:textSize="25sp"
android:clickable="true"
android:onClick="onTextViewClick"
android:tag="stunde"/>
</TableRow>
and 10 excactly same table rows
tab1 portrait:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab1">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="07:45 -\n08:30"
android:id="@+id/uhrzeit1p"
android:layout_column="0"
android:textIsSelectable="false"
android:textSize="25sp"
android:layout_margin="5dp"
android:lines="2"
android:clickable="true"
android:onClick="onTextViewClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/actualLesson1"
android:layout_column="1"
android:textIsSelectable="false"
android:textSize="25sp"
android:layout_margin="5dp"
android:lines="2"
android:layout_weight="50"
android:clickable="true"
android:onClick="onTextViewClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/actualNote1"
android:layout_column="2"
android:textIsSelectable="false"
android:textSize="25sp"
android:layout_margin="5dp"
android:lines="2"
android:layout_weight="50"
android:clickable="true"
android:onClick="onTextViewClick"/>
</TableRow>
and 10 table rows too
tab2 portrait:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab2">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:layout_marginTop="25dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button8"
android:background="#FFFFFF"
android:layout_below="@+id/button7"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:onClick="onClickKaTest"/>
and 9 buttons
tab2 landscape:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab2">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:layout_marginTop="25dp">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#FFFFFF"
android:layout_margin="5dp"
android:layout_weight="50"
android:onClick="onClickKaTest"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:background="#FFFFFF"
android:layout_below="@+id/button"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:layout_weight="50"
android:onClick="onClickKaTest"/>
</TableRow>
and 4 table rows
tab3:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$fragmentTab3">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/radioGroupKAtest"
android:layout_margin="25dp">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Klassenarbeit"
android:id="@+id/KA"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"
android:id="@+id/test"
android:layout_gravity="left|center_vertical"/>
</RadioGroup>
<DatePicker
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/datePicker"
android:calendarViewShown="true"
android:spinnersShown="true"/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/radioGroupKAtest2"
android:layout_margin="25dp">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde1"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde2"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde3"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde4"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde5"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde6"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde7"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde8"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde9"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde10"
android:layout_gravity="left|center_vertical"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/stunde11"
android:layout_gravity="left|center_vertical"/>
</RadioGroup>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/themenEditText"
android:layout_marginLeft="25dp"/>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Ok"
android:id="@+id/okButton"
android:onClick="OkOnClick"
android:layout_marginLeft="25dp"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
EDIT: on both devices runs android 4.3 JellyBean
Do I need this whole class to find out if the fraction is reduced or not?
Do I need this whole class to find out if the fraction is reduced or not?
What I have to do is take 2 random variables for a fraction, 1 to 1000,
and check to see if they are in reduced terms already or not. I do this
1,000 times and keep track of whether it was or wasn't in reduced terms.
Here is the main class
import java.util.*;
public class ratio1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int nonReducedCount = 0; //counts how many non reduced ratios
there are
for(int i =1; i<=1000; i++){
Random rand = new Random();
int n = rand.nextInt(1000)+1; //random int creation
int m = rand.nextInt(1000)+1;
Ratio ratio = new Ratio(n,m);
if (ratio.getReduceCount() != 0 ){ // if the ratio was not
already fully reduced
nonReducedCount++; // increase the count of non reduced
ratios
}
}
int reducedCount = 1000 - nonReducedCount; //number of times the
ratio was reduced already
double reducedRatio = reducedCount / nonReducedCount; //the ratio
for reduced and not reduced
reducedRatio *= 6;
reducedRatio = Math.sqrt(reducedRatio);
System.out.println("pi is " + reducedRatio);
}
}
And here is the class I am not sure about. All I want from it is to
determine whether or not the fraction is already in simplest form. When I
currently try to run it, it is giving me an error; "Exception in thread
"main" java.lang.StackOverflowError at Ratio.gcd(Ratio.java:67) at
Ratio.gcd(Ratio.java:66)"
public class Ratio{
protected int numerator; // numerator of ratio
protected int denominator; //denominator of ratio
public int reduceCount = 0; //counts how many times the reducer goes
public Ratio(int top, int bottom)
//pre: bottom !=0
//post: constructs a ratio equivalent to top::bottom
{
numerator = top;
denominator = bottom;
reduce();
}
public int getNumerator()
//post: return the numerator of the fraction
{
return numerator;
}
public int getDenominator()
//post: return the denominator of the fraction
{
return denominator;
}
public double getValue()
//post: return the double equivalent of the ratio
{
return (double)numerator/(double)denominator;
}
public int getReduceCount()
//post: returns the reduceCount
{
return reduceCount;
}
public Ratio add(Ratio other)
//pre: other is nonnull
//post: return new fraction--the sum of this and other
{
return new
Ratio(this.numerator*other.denominator+this.denominator*other.numerator,this.denominator*other.denominator);
}
protected void reduce()
//post: numerator and denominator are set so that the greatest common
divisor of the numerator and demoninator is 1
{
int divisor = gcd(numerator, denominator);
if(denominator < 0) divisor = -divisor;
numerator /= divisor;
denominator /= divisor;
reduceCount++;
}
protected static int gcd(int a, int b)
//post: computes the greatest integer value that divides a and b
{
if (a<0) return gcd(-a,b);
if (a==0){
if(b==0) return 1;
else return b;
}
if (b>a) return gcd(b,a);
return gcd(b%a,a);
}
public String toString()
//post:returns a string that represents this fraction.
{
return getNumerator()+"/"+getDenominator();
}
}
Here are the lines of the error in the Ratio class;
if (b>a) return gcd(b,a);
return gcd(b%a,a);
thank you.
What I have to do is take 2 random variables for a fraction, 1 to 1000,
and check to see if they are in reduced terms already or not. I do this
1,000 times and keep track of whether it was or wasn't in reduced terms.
Here is the main class
import java.util.*;
public class ratio1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int nonReducedCount = 0; //counts how many non reduced ratios
there are
for(int i =1; i<=1000; i++){
Random rand = new Random();
int n = rand.nextInt(1000)+1; //random int creation
int m = rand.nextInt(1000)+1;
Ratio ratio = new Ratio(n,m);
if (ratio.getReduceCount() != 0 ){ // if the ratio was not
already fully reduced
nonReducedCount++; // increase the count of non reduced
ratios
}
}
int reducedCount = 1000 - nonReducedCount; //number of times the
ratio was reduced already
double reducedRatio = reducedCount / nonReducedCount; //the ratio
for reduced and not reduced
reducedRatio *= 6;
reducedRatio = Math.sqrt(reducedRatio);
System.out.println("pi is " + reducedRatio);
}
}
And here is the class I am not sure about. All I want from it is to
determine whether or not the fraction is already in simplest form. When I
currently try to run it, it is giving me an error; "Exception in thread
"main" java.lang.StackOverflowError at Ratio.gcd(Ratio.java:67) at
Ratio.gcd(Ratio.java:66)"
public class Ratio{
protected int numerator; // numerator of ratio
protected int denominator; //denominator of ratio
public int reduceCount = 0; //counts how many times the reducer goes
public Ratio(int top, int bottom)
//pre: bottom !=0
//post: constructs a ratio equivalent to top::bottom
{
numerator = top;
denominator = bottom;
reduce();
}
public int getNumerator()
//post: return the numerator of the fraction
{
return numerator;
}
public int getDenominator()
//post: return the denominator of the fraction
{
return denominator;
}
public double getValue()
//post: return the double equivalent of the ratio
{
return (double)numerator/(double)denominator;
}
public int getReduceCount()
//post: returns the reduceCount
{
return reduceCount;
}
public Ratio add(Ratio other)
//pre: other is nonnull
//post: return new fraction--the sum of this and other
{
return new
Ratio(this.numerator*other.denominator+this.denominator*other.numerator,this.denominator*other.denominator);
}
protected void reduce()
//post: numerator and denominator are set so that the greatest common
divisor of the numerator and demoninator is 1
{
int divisor = gcd(numerator, denominator);
if(denominator < 0) divisor = -divisor;
numerator /= divisor;
denominator /= divisor;
reduceCount++;
}
protected static int gcd(int a, int b)
//post: computes the greatest integer value that divides a and b
{
if (a<0) return gcd(-a,b);
if (a==0){
if(b==0) return 1;
else return b;
}
if (b>a) return gcd(b,a);
return gcd(b%a,a);
}
public String toString()
//post:returns a string that represents this fraction.
{
return getNumerator()+"/"+getDenominator();
}
}
Here are the lines of the error in the Ratio class;
if (b>a) return gcd(b,a);
return gcd(b%a,a);
thank you.
Static headers in scrollable list
Static headers in scrollable list
I've already have a scrollable list with multiple buttons. Is it possible
to have static headers that separate the buttons as it scrolls?
Header
Btn1
Btn2
Btn3
Btn10
Header
Btn11
Btn12
Btn13
Btn20
I've already have a scrollable list with multiple buttons. Is it possible
to have static headers that separate the buttons as it scrolls?
Header
Btn1
Btn2
Btn3
Btn10
Header
Btn11
Btn12
Btn13
Btn20
Android : How to get product details from barcode?
Android : How to get product details from barcode?
Like if there is car barcode is scanned i want year and make..... like
details for that car.
I am getting contents contains whatever was encoded and format type like
upc....
Like if there is car barcode is scanned i want year and make..... like
details for that car.
I am getting contents contains whatever was encoded and format type like
upc....
How can I deselect all other buttons when one button in array is selected?
How can I deselect all other buttons when one button in array is selected?
I've got an array of subclassed UIButton's in a UIScrollView. How can I
deselect all other buttons in the array when I select one of the buttons,
so that only one is ever selected?
I've got an array of subclassed UIButton's in a UIScrollView. How can I
deselect all other buttons in the array when I select one of the buttons,
so that only one is ever selected?
Friday, 30 August 2013
query/shred large xml document into sql server
query/shred large xml document into sql server
I'm looking to query an xml file that's in excess of 80GB (and insert the
results into a pre-existing db). This prevents me from simply declaring it
as an xml variable and using openrowset. I am NOT looking to use a CLR and
would prefer an entirely TSQL approach if possible (looking to do this on
SQL Server 2012/Windows Server 2008)
With the 2Gb limit on the XML datatype, I realize the obvious approach is
to split the file into say 1GB pieces. However, it would simply be too
messy to be worthwhile (Elements in the document are of varying sizes and
not all elements have the same sub-elements. Only looking to keep some
common elements though).
Anyone have a suggestion?
I'm looking to query an xml file that's in excess of 80GB (and insert the
results into a pre-existing db). This prevents me from simply declaring it
as an xml variable and using openrowset. I am NOT looking to use a CLR and
would prefer an entirely TSQL approach if possible (looking to do this on
SQL Server 2012/Windows Server 2008)
With the 2Gb limit on the XML datatype, I realize the obvious approach is
to split the file into say 1GB pieces. However, it would simply be too
messy to be worthwhile (Elements in the document are of varying sizes and
not all elements have the same sub-elements. Only looking to keep some
common elements though).
Anyone have a suggestion?
Thursday, 29 August 2013
Alignment in DOJO table
Alignment in DOJO table
I am a beginner in DOJO. I have the following DOJO table.
{ name: "I/P Voltage (V)", classes: "title",field: "mainsVoltage",
width: "80px" },
{ name: "I/P Charging Current (A)", classes: "title",field:
"gridchargingcurrent", width: "150px" },
{ name: "I/P Frequency (Hz)", classes: "title",field: "mainsFreq",
width: "120px" }
How do I make the units{(v),(A),(Hz)} appear in the center of next line?
I am a beginner in DOJO. I have the following DOJO table.
{ name: "I/P Voltage (V)", classes: "title",field: "mainsVoltage",
width: "80px" },
{ name: "I/P Charging Current (A)", classes: "title",field:
"gridchargingcurrent", width: "150px" },
{ name: "I/P Frequency (Hz)", classes: "title",field: "mainsFreq",
width: "120px" }
How do I make the units{(v),(A),(Hz)} appear in the center of next line?
SplFileObject Extended class issue
SplFileObject Extended class issue
I came across this class somewhere on Stack and have seem to come up with
a bit of an error. I'm attempting to read a csv to an associated array
where the first row is a header row and the rest are data. Oddly this was
working fine until this morning and I have no idea what has went wrong.
PHP:
class CSVFile extends SplFileObject{
private $keys;
public function __construct($file){
parent::__construct($file);
$this->setFlags(SplFileObject::READ_CSV);
}
public function rewind(){
parent::rewind();
$this->keys = parent::current();
parent::next();
}
public function current(){
return array_combine($this->keys, parent::current());
}
public function getKeys(){
return $this->keys;
}
}
$csv = new CSVFile($csvfile);
foreach ($csv as $linek => $linev){
// Do stuff
}
Expected Output:
Array(2){
[0] => Array(3){
['header1'] => 'value1',
['header2'] => 'value2',
['header3'] => 'value3'
}
[1] => Array(3){
['header1'] => 'value4',
['header2'] => 'value5',
['header3'] => 'value6'
}
[2] => Array(3){
['header1'] => 'value7',
['header2'] => 'value8',
['header3'] => 'value9'
}
}
Actual Output:
object(CSVFile)#1 (6) {
["keys":"CSVFile":private]=> NULL
["pathName":"SplFileInfo":private]=> string(7) "abc.csv"
["fileName":"SplFileInfo":private]=> string(7) "abc.csv"
["openMode":"SplFileObject":private]=> string(1) "r"
["delimiter":"SplFileObject":private]=> string(1) ","
["enclosure":"SplFileObject":private]=> string(1) """
}
I came across this class somewhere on Stack and have seem to come up with
a bit of an error. I'm attempting to read a csv to an associated array
where the first row is a header row and the rest are data. Oddly this was
working fine until this morning and I have no idea what has went wrong.
PHP:
class CSVFile extends SplFileObject{
private $keys;
public function __construct($file){
parent::__construct($file);
$this->setFlags(SplFileObject::READ_CSV);
}
public function rewind(){
parent::rewind();
$this->keys = parent::current();
parent::next();
}
public function current(){
return array_combine($this->keys, parent::current());
}
public function getKeys(){
return $this->keys;
}
}
$csv = new CSVFile($csvfile);
foreach ($csv as $linek => $linev){
// Do stuff
}
Expected Output:
Array(2){
[0] => Array(3){
['header1'] => 'value1',
['header2'] => 'value2',
['header3'] => 'value3'
}
[1] => Array(3){
['header1'] => 'value4',
['header2'] => 'value5',
['header3'] => 'value6'
}
[2] => Array(3){
['header1'] => 'value7',
['header2'] => 'value8',
['header3'] => 'value9'
}
}
Actual Output:
object(CSVFile)#1 (6) {
["keys":"CSVFile":private]=> NULL
["pathName":"SplFileInfo":private]=> string(7) "abc.csv"
["fileName":"SplFileInfo":private]=> string(7) "abc.csv"
["openMode":"SplFileObject":private]=> string(1) "r"
["delimiter":"SplFileObject":private]=> string(1) ","
["enclosure":"SplFileObject":private]=> string(1) """
}
Wednesday, 28 August 2013
Watermark for Textbox
Watermark for Textbox
My Program: Has one textbox only. I am writing code using C# Language.
My Aim: To display text/watermark in textbox: 'Please enter your name'.
So, when user clicks on the textbox, the default text/watermark gets
clear/deleted so that user can enter his name in the textbox.
My problem: I tried various codes that are available online but none of
them seem to work for me. So, I thought I should ask here for a simple
code. I have found a code online but that doesn't seem to work:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
SetWatermark("Enter a text here...");
}
private void SetWatermark(string watermark)
{
textBox1.Watermark = watermark;
}
}
}
Error:
Error 1 'System.Windows.Forms.TextBox' does not contain a definition for
'Watermark' and no extension method 'Watermark' accepting a first argument
of type 'System.Windows.Forms.TextBox' could be found (are you missing a
using directive or an assembly reference?)
Please, if you have any other suggestions for what I am aiming for, I
would really appreciate it. I tired many examples online but all are
confusing/don't work. Thanks for your help in advance. :)
My Program: Has one textbox only. I am writing code using C# Language.
My Aim: To display text/watermark in textbox: 'Please enter your name'.
So, when user clicks on the textbox, the default text/watermark gets
clear/deleted so that user can enter his name in the textbox.
My problem: I tried various codes that are available online but none of
them seem to work for me. So, I thought I should ask here for a simple
code. I have found a code online but that doesn't seem to work:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
SetWatermark("Enter a text here...");
}
private void SetWatermark(string watermark)
{
textBox1.Watermark = watermark;
}
}
}
Error:
Error 1 'System.Windows.Forms.TextBox' does not contain a definition for
'Watermark' and no extension method 'Watermark' accepting a first argument
of type 'System.Windows.Forms.TextBox' could be found (are you missing a
using directive or an assembly reference?)
Please, if you have any other suggestions for what I am aiming for, I
would really appreciate it. I tired many examples online but all are
confusing/don't work. Thanks for your help in advance. :)
Multi-line Matching in Python
Multi-line Matching in Python
I've read all of the articles I could find, even understood a few of them
but as a Python newb I'm still a little lost and hoping for help :)
I'm working on a script to parse items of interest out of an application
specific log file, each line begins with a time stamp which I can match
and I can define two things to identify what I want to capture, some
partial content and a string that will be the termination of what I want
to extract.
My issue is multi-line, in most cases every log line is terminated with a
newline but some entries contain SQL that may have new lines within it and
therefore creates new lines in the log.
So, in a simple case I may have this:
[8/21/13 11:30:33:557 PDT] 00000488 SystemOut O 21 Aug 2013
11:30:33:557 [WARN] [MXServerUI01] [CID-UIASYNC-17464] BMXAA6720W - USER =
(ABCDEF) SPID = (2526) app (ITEM) object (ITEM) : select * from item
where ((status != 'OBSOLETE' and itemsetid = 'ITEMSET1') and (exists
(select 1 from maximo.invvendor where (exists (select 1 from
maximo.companies where (( contains(name,' $AAAA ') > 0 )) and
(company=invvendor.manufacturer and orgid=invvendor.orgid))) and (itemnum
= item.itemnum and itemsetid = item.itemsetid)))) and (itemtype in (select
value from synonymdomain where domainid='ITEMTYPE' and maxvalue = 'ITEM'))
order by itemnum asc (execution took 2083 milliseconds)
This all appears as one line which I can match with this:
re.compile('\[(0?[1-9]|[12][0-9]|3[01])(\/)(0?[1-9]|[12][0-9]|3[01])(\/)([0-9]{2}).*(milliseconds)')
However in some cases there may be line breaks in the SQL, as such I want
to still capture it (and potentially replace the line breaks with spaces).
I am currently reading the file a line at a time which obviously isn't
going to work so...
Do I need to process the whole file in one go? They are typically 20mb in
size. How do I read the entire file and iterate through it looking for
single or multi-line blocks?
How would I write a multi-line RegEx that would match either the whole
thing on one line or of it is spread across multiple lines?
My overall goal is to parameterize this so I can use it for extracting log
entries that match different patterns of the starting string (always the
start of a line), the ending string (where I want to capture to) and a
value that is between them as an identifier.
Thanks in advance for any help!
Chris.
I've read all of the articles I could find, even understood a few of them
but as a Python newb I'm still a little lost and hoping for help :)
I'm working on a script to parse items of interest out of an application
specific log file, each line begins with a time stamp which I can match
and I can define two things to identify what I want to capture, some
partial content and a string that will be the termination of what I want
to extract.
My issue is multi-line, in most cases every log line is terminated with a
newline but some entries contain SQL that may have new lines within it and
therefore creates new lines in the log.
So, in a simple case I may have this:
[8/21/13 11:30:33:557 PDT] 00000488 SystemOut O 21 Aug 2013
11:30:33:557 [WARN] [MXServerUI01] [CID-UIASYNC-17464] BMXAA6720W - USER =
(ABCDEF) SPID = (2526) app (ITEM) object (ITEM) : select * from item
where ((status != 'OBSOLETE' and itemsetid = 'ITEMSET1') and (exists
(select 1 from maximo.invvendor where (exists (select 1 from
maximo.companies where (( contains(name,' $AAAA ') > 0 )) and
(company=invvendor.manufacturer and orgid=invvendor.orgid))) and (itemnum
= item.itemnum and itemsetid = item.itemsetid)))) and (itemtype in (select
value from synonymdomain where domainid='ITEMTYPE' and maxvalue = 'ITEM'))
order by itemnum asc (execution took 2083 milliseconds)
This all appears as one line which I can match with this:
re.compile('\[(0?[1-9]|[12][0-9]|3[01])(\/)(0?[1-9]|[12][0-9]|3[01])(\/)([0-9]{2}).*(milliseconds)')
However in some cases there may be line breaks in the SQL, as such I want
to still capture it (and potentially replace the line breaks with spaces).
I am currently reading the file a line at a time which obviously isn't
going to work so...
Do I need to process the whole file in one go? They are typically 20mb in
size. How do I read the entire file and iterate through it looking for
single or multi-line blocks?
How would I write a multi-line RegEx that would match either the whole
thing on one line or of it is spread across multiple lines?
My overall goal is to parameterize this so I can use it for extracting log
entries that match different patterns of the starting string (always the
start of a line), the ending string (where I want to capture to) and a
value that is between them as an identifier.
Thanks in advance for any help!
Chris.
Cutting rectangle not using Rectangle :)
Cutting rectangle not using Rectangle :)
If I have 4 points at bitmap (left top corner, right top corner, left
bottom corner, right bottom corner) how to cut bitmap not using Rectangle
method to cut rectangle of that points? And save it as .png?
If I have 4 points at bitmap (left top corner, right top corner, left
bottom corner, right bottom corner) how to cut bitmap not using Rectangle
method to cut rectangle of that points? And save it as .png?
Live Vehicle tracking using J2ee
Live Vehicle tracking using J2ee
I want to build a project on "Live Vehicle tracking system" using
J2ee.following are my basic ideas-
1)a website from which end user can track the vehicle(tracking can be done
on Google maps).
2)a GPS system embedded in the vehicle so that it can send location to the
server.
3)i think of using J2ee.please suggest me whether to use this or any other
language.
This is basic idea.please make correction if necessary.
Thank you
I want to build a project on "Live Vehicle tracking system" using
J2ee.following are my basic ideas-
1)a website from which end user can track the vehicle(tracking can be done
on Google maps).
2)a GPS system embedded in the vehicle so that it can send location to the
server.
3)i think of using J2ee.please suggest me whether to use this or any other
language.
This is basic idea.please make correction if necessary.
Thank you
Tuesday, 27 August 2013
Why do functions take an int as an argument when its value logically can not be < 0
Why do functions take an int as an argument when its value logically can
not be < 0
When I am writing functions that takes an arguments that determine a
certain length, I always use uint. As it makes no sense for the value to
be a negative number.
But I see the opposite (very often) in the .Net framework. For example:
http://msdn.microsoft.com/en-us/library/xsa4321w.aspx
Initializes a new instance of the String class to the value indicated by a
specified Unicode character repeated a specified number of times.
public String(
char c,
int count
)
It also states that an ArgumentOutOfRangeException is thrown when `count
is less than zero."
Why not make the count argument an uint then!?
not be < 0
When I am writing functions that takes an arguments that determine a
certain length, I always use uint. As it makes no sense for the value to
be a negative number.
But I see the opposite (very often) in the .Net framework. For example:
http://msdn.microsoft.com/en-us/library/xsa4321w.aspx
Initializes a new instance of the String class to the value indicated by a
specified Unicode character repeated a specified number of times.
public String(
char c,
int count
)
It also states that an ArgumentOutOfRangeException is thrown when `count
is less than zero."
Why not make the count argument an uint then!?
GUI Disappearing when I add JComboBox
GUI Disappearing when I add JComboBox
Alright I'm relatively new to programming and it may be just something
simple that I'm missing but the other threads related to this topic the
poster didn't give adequate information relative to their issue for others
to provide quality answers so I will give it a shot.
public BenchUI(JFrame j){
jf = j;
init();
add(mainPanel);
topPanelButtons();
selectedCustomer();
rentalOptions();
clientListBox();
}
At this point i can point out that everything works perfectly until I add
the clientListBox() method. (below)
public void clientListBox(){
clientList = new JComboBox(moo);
clientList.setPreferredSize(new Dimension(460,30));
gbc.gridx = 0;
gbc.gridy = 0;
leftSide.add(clientList,gbc);
}
i can comment it out and get my whole GUI back working perfectly but
without a JComboBox.
moo is String [] moo = {"Fish","Goat", "Monkey"}; a dummy string just for
testing purposes and initialized at the start.
So any idea why my GUI completely disappears when I place in the clientList?
If anything else is necessary I'll be watching this thread and can provide
additional information.
As a side note I keep getting warnings for "Raw Types" but it works
without specifiying, could I potentially run into trouble by not
specifying my JComboBox?
Alright I'm relatively new to programming and it may be just something
simple that I'm missing but the other threads related to this topic the
poster didn't give adequate information relative to their issue for others
to provide quality answers so I will give it a shot.
public BenchUI(JFrame j){
jf = j;
init();
add(mainPanel);
topPanelButtons();
selectedCustomer();
rentalOptions();
clientListBox();
}
At this point i can point out that everything works perfectly until I add
the clientListBox() method. (below)
public void clientListBox(){
clientList = new JComboBox(moo);
clientList.setPreferredSize(new Dimension(460,30));
gbc.gridx = 0;
gbc.gridy = 0;
leftSide.add(clientList,gbc);
}
i can comment it out and get my whole GUI back working perfectly but
without a JComboBox.
moo is String [] moo = {"Fish","Goat", "Monkey"}; a dummy string just for
testing purposes and initialized at the start.
So any idea why my GUI completely disappears when I place in the clientList?
If anything else is necessary I'll be watching this thread and can provide
additional information.
As a side note I keep getting warnings for "Raw Types" but it works
without specifiying, could I potentially run into trouble by not
specifying my JComboBox?
NullPointerException Android Development Error
NullPointerException Android Development Error
EDIT: ADDED areacircle.xml CODE
I am getting a NullPointerException on this line, if you could help me
figure it out, that would be great!
double radius = Double.parseDouble(radiusEditText.getText().toString());
Here is the entire code:
public class areacircle extends Activity {
TextView radiusTextView;
TextView areaTextView;
EditText radiusEditText;
Button areaButton;
EditText answerEditText;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.areacircle);
areaButton = (Button) findViewById(R.id.areaButton);
answerEditText = (EditText) findViewById(R.id.answerEditText);
radiusEditText = (EditText) findViewById(R.id.radiusEditText);
}
double pi = 3.14;
double radius = Double.parseDouble(radiusEditText.getText().toString());
double finalRadius = radius * radius *pi;
double area = Double.parseDouble(answerEditText.getText().toString());
public void findarea(){
answerEditText.setText(String.valueOf(finalRadius));
}
}
areacircle.xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/radiusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/acirclefirstnumbtn"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="30sp" />
<EditText
android:id="@+id/radiusEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/radius"
android:inputType="numberDecimal"
android:textSize="30sp" >
<requestFocus />
</EditText>
<Button
android:id="@+id/areaButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="findarea"
android:text="@string/findarea"
android:textSize="50sp" />
<TextView
android:id="@+id/areaTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="@string/area"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="40sp" />
<EditText
android:id="@+id/answerEditText"
android:layout_width="83dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ems="10"
android:hint="@string/areatextview"
android:inputType="numberDecimal"
android:text="@string/areaanswer" />
EDIT: ADDED areacircle.xml CODE
I am getting a NullPointerException on this line, if you could help me
figure it out, that would be great!
double radius = Double.parseDouble(radiusEditText.getText().toString());
Here is the entire code:
public class areacircle extends Activity {
TextView radiusTextView;
TextView areaTextView;
EditText radiusEditText;
Button areaButton;
EditText answerEditText;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.areacircle);
areaButton = (Button) findViewById(R.id.areaButton);
answerEditText = (EditText) findViewById(R.id.answerEditText);
radiusEditText = (EditText) findViewById(R.id.radiusEditText);
}
double pi = 3.14;
double radius = Double.parseDouble(radiusEditText.getText().toString());
double finalRadius = radius * radius *pi;
double area = Double.parseDouble(answerEditText.getText().toString());
public void findarea(){
answerEditText.setText(String.valueOf(finalRadius));
}
}
areacircle.xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/radiusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/acirclefirstnumbtn"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="30sp" />
<EditText
android:id="@+id/radiusEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/radius"
android:inputType="numberDecimal"
android:textSize="30sp" >
<requestFocus />
</EditText>
<Button
android:id="@+id/areaButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="findarea"
android:text="@string/findarea"
android:textSize="50sp" />
<TextView
android:id="@+id/areaTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="@string/area"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="40sp" />
<EditText
android:id="@+id/answerEditText"
android:layout_width="83dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ems="10"
android:hint="@string/areatextview"
android:inputType="numberDecimal"
android:text="@string/areaanswer" />
Automatically access google calendar
Automatically access google calendar
I need help dealing with google calendar. My code is below:
<?php
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_CalendarService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName("Google Calendar PHP Starter Application");
// Visit https://code.google.com/apis/console?api=calendar to generate your
// client id, client secret, and to register your redirect uri.
$client->setClientId('client id');
$client->setClientSecret('client secret');
$client->setRedirectUri('redirect uri');
$client->setDeveloperKey('developer key');
$cal = new Google_CalendarService($client);
if (isset($_GET['logout'])) {
unset($_SESSION['token']);
}
if (isset($_GET['code'])) {
$client->authenticate($_GET['code']);
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
exit();
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
if ($client->getAccessToken()) {
$calList = $cal->calendarList->listCalendarList();
print "<h1>Calendar List</h1><pre>" . print_r($calList, true) . "</pre>";
$_SESSION['token'] = $client->getAccessToken();
// Create a new event and display it.
// Caution: every time you run this script a new event is created. Oh well.
$event = new Google_Event();
$event->setSummary('Appointment');
$event->setLocation('Somewhere');
$start = new Google_EventDateTime();
$start->setDateTime('2013-08-24T10:00:00.000-07:00');
$event->setStart($start);
$end = new Google_EventDateTime();
$end->setDateTime('2013-08-25T10:25:00.000-07:00');
$event->setEnd($end);
$createdEvent = $cal->events->insert('primary', $event);
$events = $cal->events->listEvents('primary');
echo "<pre>" . print_r($events, true) . "</pre>";
}
else {
$authUrl = $client->createAuthUrl();
print "<a class='login' href='$authUrl'>Connect Me!</a>";
exit();
}
?>
Basically this code has a connect me link and when clicked, asks the user
to input their gmail account. However, I want to skip this entire process
of allowing the person to enter their username and password information
and just add the event when I run this code. Does the idea of using
service account for google api access solve this or does it involve
storing a token in a database and constantly changing it work (which I am
struggling to do)? Any help would be appreciated.
I need help dealing with google calendar. My code is below:
<?php
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_CalendarService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName("Google Calendar PHP Starter Application");
// Visit https://code.google.com/apis/console?api=calendar to generate your
// client id, client secret, and to register your redirect uri.
$client->setClientId('client id');
$client->setClientSecret('client secret');
$client->setRedirectUri('redirect uri');
$client->setDeveloperKey('developer key');
$cal = new Google_CalendarService($client);
if (isset($_GET['logout'])) {
unset($_SESSION['token']);
}
if (isset($_GET['code'])) {
$client->authenticate($_GET['code']);
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
exit();
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
if ($client->getAccessToken()) {
$calList = $cal->calendarList->listCalendarList();
print "<h1>Calendar List</h1><pre>" . print_r($calList, true) . "</pre>";
$_SESSION['token'] = $client->getAccessToken();
// Create a new event and display it.
// Caution: every time you run this script a new event is created. Oh well.
$event = new Google_Event();
$event->setSummary('Appointment');
$event->setLocation('Somewhere');
$start = new Google_EventDateTime();
$start->setDateTime('2013-08-24T10:00:00.000-07:00');
$event->setStart($start);
$end = new Google_EventDateTime();
$end->setDateTime('2013-08-25T10:25:00.000-07:00');
$event->setEnd($end);
$createdEvent = $cal->events->insert('primary', $event);
$events = $cal->events->listEvents('primary');
echo "<pre>" . print_r($events, true) . "</pre>";
}
else {
$authUrl = $client->createAuthUrl();
print "<a class='login' href='$authUrl'>Connect Me!</a>";
exit();
}
?>
Basically this code has a connect me link and when clicked, asks the user
to input their gmail account. However, I want to skip this entire process
of allowing the person to enter their username and password information
and just add the event when I run this code. Does the idea of using
service account for google api access solve this or does it involve
storing a token in a database and constantly changing it work (which I am
struggling to do)? Any help would be appreciated.
swap stylesheet for jquerymobile with a link
swap stylesheet for jquerymobile with a link
I have a variable called $cat(which stands for 'category') in the URL.
Depending on whether it is "a" or "b" I swap the stylesheet using a link:
<?php
if($cat == "a") { ?>
<link rel="stylesheet" href="/css/styleA.css">
<?php }
elseif($cat == "b") { ?>
<link rel="stylesheet" href="/css/styleB.css">
<?php } ?>
styleA.css makes the background-color of the header blue, and styleB.css
makes it red
<div id="header" data-role="header" data-position='fixed'>...</div>
if I click on a link that looks like this:
<a href="index.php?cat=a">Click for red</a>
<a href="index.php?cat=b">Click for blue</a>
the URL actually works (content is incuded depending on $cat) and I do get
the value of $cat but the stylesheet does not seem to have swapped, since
the color doesn't change. But if I reload the page (with the URL given by
the link before) the stylesheets swap and everything works perfectly.
I used the same method for the desktop version of the website I'm working
on and everything works perfectly fine. This issue seems to only appear if
I use jquery mobile.
Does anyone see why this isn't working as it should?
I have a variable called $cat(which stands for 'category') in the URL.
Depending on whether it is "a" or "b" I swap the stylesheet using a link:
<?php
if($cat == "a") { ?>
<link rel="stylesheet" href="/css/styleA.css">
<?php }
elseif($cat == "b") { ?>
<link rel="stylesheet" href="/css/styleB.css">
<?php } ?>
styleA.css makes the background-color of the header blue, and styleB.css
makes it red
<div id="header" data-role="header" data-position='fixed'>...</div>
if I click on a link that looks like this:
<a href="index.php?cat=a">Click for red</a>
<a href="index.php?cat=b">Click for blue</a>
the URL actually works (content is incuded depending on $cat) and I do get
the value of $cat but the stylesheet does not seem to have swapped, since
the color doesn't change. But if I reload the page (with the URL given by
the link before) the stylesheets swap and everything works perfectly.
I used the same method for the desktop version of the website I'm working
on and everything works perfectly fine. This issue seems to only appear if
I use jquery mobile.
Does anyone see why this isn't working as it should?
JNI - java.lang.UnsatisfiedLinkError
JNI - java.lang.UnsatisfiedLinkError
Okay this question may sound rather odd but I really don't see the
difference between this:
File wrapperDll = new
File("C:\\A-PATH\\SibKernel.Server.JavaWrapper.j4n.dll");
and this
File wrapperDll = new
File("C:\\ANOTHER-PATH\\SibKernel.Server.JavaWrapper.j4n.dll");
I use jni4net to access C# written .dll files which use .NET Framework.
Therefore it uses some JNI stuff I sadly don't relly understand since I
don't have any knowledge about JNI.
The .dll file that's been accessed will be loaded by the jni4net framework
like this:
Bridge.setVerbose(true);
Bridge.setClrVersion("v20");
try {
Bridge.init();
Bridge.LoadAndRegisterAssemblyFrom(wrapperDll);
} catch (IOException e) {
e.printStackTrace();
}
Later when I create an object that I want access
sp40 = new SP40Device();
this here either works:
@net.sf.jni4net.attributes.ClrType
public class SP40Device extends system.Object {
//<generated-proxy>
private static system.Type staticType;
protected SP40Device(net.sf.jni4net.inj.INJEnv __env, long __handle) {
super(__env, __handle);
}
@net.sf.jni4net.attributes.ClrConstructor("()V")
public SP40Device() {
super(((net.sf.jni4net.inj.INJEnv)(null)), 0);
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(this);
}
// ...
}
or if I use the other .dll results in this java.lang.UnsatisfiedLinkError:
java.lang.UnsatisfiedLinkError:
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Lnet/sf/jni4net/inj/IClrProxy;)V
at
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Native
Method)
at sibkernel.server.sp40javawrapper.SP40Device.<init>(SP40Device.java:25)
at sibeclipseplugin.debug.model.SP40Program.<init>(SP40Program.java:46)
at
sibeclipseplugin.debug.model.SibDebugTarget.<init>(SibDebugTarget.java:67)
at
sibeclipseplugin.ui.launch.LaunchConfigurationDelegate.launch(LaunchConfigurationDelegate.java:26)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Even though it is the same .dll file that's been opened the one works and
the other doesn't.
Any guess why this problem occurs?
Okay this question may sound rather odd but I really don't see the
difference between this:
File wrapperDll = new
File("C:\\A-PATH\\SibKernel.Server.JavaWrapper.j4n.dll");
and this
File wrapperDll = new
File("C:\\ANOTHER-PATH\\SibKernel.Server.JavaWrapper.j4n.dll");
I use jni4net to access C# written .dll files which use .NET Framework.
Therefore it uses some JNI stuff I sadly don't relly understand since I
don't have any knowledge about JNI.
The .dll file that's been accessed will be loaded by the jni4net framework
like this:
Bridge.setVerbose(true);
Bridge.setClrVersion("v20");
try {
Bridge.init();
Bridge.LoadAndRegisterAssemblyFrom(wrapperDll);
} catch (IOException e) {
e.printStackTrace();
}
Later when I create an object that I want access
sp40 = new SP40Device();
this here either works:
@net.sf.jni4net.attributes.ClrType
public class SP40Device extends system.Object {
//<generated-proxy>
private static system.Type staticType;
protected SP40Device(net.sf.jni4net.inj.INJEnv __env, long __handle) {
super(__env, __handle);
}
@net.sf.jni4net.attributes.ClrConstructor("()V")
public SP40Device() {
super(((net.sf.jni4net.inj.INJEnv)(null)), 0);
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(this);
}
// ...
}
or if I use the other .dll results in this java.lang.UnsatisfiedLinkError:
java.lang.UnsatisfiedLinkError:
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Lnet/sf/jni4net/inj/IClrProxy;)V
at
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Native
Method)
at sibkernel.server.sp40javawrapper.SP40Device.<init>(SP40Device.java:25)
at sibeclipseplugin.debug.model.SP40Program.<init>(SP40Program.java:46)
at
sibeclipseplugin.debug.model.SibDebugTarget.<init>(SibDebugTarget.java:67)
at
sibeclipseplugin.ui.launch.LaunchConfigurationDelegate.launch(LaunchConfigurationDelegate.java:26)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Even though it is the same .dll file that's been opened the one works and
the other doesn't.
Any guess why this problem occurs?
Special alignment using itext
Special alignment using itext
how can i get this alignment on itext :
From this lines :
itext
I use java, itext to write pdf docs
java
Can i get this :
itext
I use java, itext to write pdf docs
java
The second line is centered.
how can i get this alignment on itext :
From this lines :
itext
I use java, itext to write pdf docs
java
Can i get this :
itext
I use java, itext to write pdf docs
java
The second line is centered.
Monday, 26 August 2013
Which file format should I use to save an array to a file?
Which file format should I use to save an array to a file?
I am using the solution found here: save NSArray to file and I am just
wondering what type of file format I should save my array as. Can I just
use .txt?
Okay, I'll add my code, Hope people don't get mad that I am changing my
question... I am getting 0x00000000 for my retrieved boundaries array when
I do the following:
to save:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory
stringByAppendingPathComponent:@"boundaries"];
[array writeToFile:filePath atomically:YES];
to retrieve:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory
stringByAppendingPathComponent:@"boundaries"];
NSArray *boundaries = [NSArray arrayWithContentsOfFile:filePath];
Is something wrong with this? The array is full of correct data when I
save it.
I am using the solution found here: save NSArray to file and I am just
wondering what type of file format I should save my array as. Can I just
use .txt?
Okay, I'll add my code, Hope people don't get mad that I am changing my
question... I am getting 0x00000000 for my retrieved boundaries array when
I do the following:
to save:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory
stringByAppendingPathComponent:@"boundaries"];
[array writeToFile:filePath atomically:YES];
to retrieve:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory
stringByAppendingPathComponent:@"boundaries"];
NSArray *boundaries = [NSArray arrayWithContentsOfFile:filePath];
Is something wrong with this? The array is full of correct data when I
save it.
java regex to match word of varying length - java.util.regex.PatternSyntaxException: Unclosed character class near index
java regex to match word of varying length -
java.util.regex.PatternSyntaxException: Unclosed character class near
index
Was having trouble compiling the following regular expression, escaped for
java.lang.String
\\w{1,4}
Throws the following excepton
java.util.regex.PatternSyntaxException: Unclosed counted closure near index 4
\w{1
^
Obviously, the comma is breaking the expression and the following compiles
just fine
\\w{1\,4}
Notice the only difference in the second one, that works, the comma is
escaped with backslash - BUT- best I know, commas do NOT need to be
escaped in either java.lang.String or java regular expressions.
Reference:
http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
What gives?
java.util.regex.PatternSyntaxException: Unclosed character class near
index
Was having trouble compiling the following regular expression, escaped for
java.lang.String
\\w{1,4}
Throws the following excepton
java.util.regex.PatternSyntaxException: Unclosed counted closure near index 4
\w{1
^
Obviously, the comma is breaking the expression and the following compiles
just fine
\\w{1\,4}
Notice the only difference in the second one, that works, the comma is
escaped with backslash - BUT- best I know, commas do NOT need to be
escaped in either java.lang.String or java regular expressions.
Reference:
http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
What gives?
How to configure submit button in php forms such that only one data is posted at a time?
How to configure submit button in php forms such that only one data is
posted at a time?
I am trying to create a php form where data in each row can be submitted
independently. I am able to create a form which looks similar to the image
below.
How to configure the submit buttons such that when pressed, the entry in
that particular row alone gets posted to the server. I am very new to PHP
Relevant php code:
while ($driverEntries = mysqli_fetch_row($driverList)) {
printf ("%s \n", $driverEntries[1]);
echo "<input name=\"subject\" type=\"text\" id=\"subject\"
size=\"50\">";
echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\">";
echo "<br>";
}
posted at a time?
I am trying to create a php form where data in each row can be submitted
independently. I am able to create a form which looks similar to the image
below.
How to configure the submit buttons such that when pressed, the entry in
that particular row alone gets posted to the server. I am very new to PHP
Relevant php code:
while ($driverEntries = mysqli_fetch_row($driverList)) {
printf ("%s \n", $driverEntries[1]);
echo "<input name=\"subject\" type=\"text\" id=\"subject\"
size=\"50\">";
echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\">";
echo "<br>";
}
Creating table derive from the fields
Creating table derive from the fields
can I ask if its possible to create table that derived from the data you
have input.
example you have column FullName then it has 'Juan dela Cruz'. Next, I
want the 'Juan dela Cruz' become a table and this table have columns like
Attendance, Time In, time Out, Violations.
This is i want to state:
technicianTBL
+----+----------------------+
| ID | Fullname |
+----+----------------------+
| 1 | Juan dela Cruz |
+----+----------------------+
will become:
JuandelacruzTBL
+------------+----------+------------+
| Date | Time In | Time Out |
+------------+----------+------------+
| 01/01/2013 | 7:00am | 5:00pm |
+------------+----------+------------+
can I ask if its possible to create table that derived from the data you
have input.
example you have column FullName then it has 'Juan dela Cruz'. Next, I
want the 'Juan dela Cruz' become a table and this table have columns like
Attendance, Time In, time Out, Violations.
This is i want to state:
technicianTBL
+----+----------------------+
| ID | Fullname |
+----+----------------------+
| 1 | Juan dela Cruz |
+----+----------------------+
will become:
JuandelacruzTBL
+------------+----------+------------+
| Date | Time In | Time Out |
+------------+----------+------------+
| 01/01/2013 | 7:00am | 5:00pm |
+------------+----------+------------+
android: unfortunately app has stopped error
android: unfortunately app has stopped error
i was implementing a simple webview app in android (I'm new to android and
java). App works fine but when i click the button i get this error.
unfortunately app has stopped error
error log.
08-26 11:49:06.374: W/dalvikvm(754): threadid=1: thread exiting with
uncaught exception (group=0x414c4700)
08-26 11:49:06.444: E/AndroidRuntime(754): FATAL EXCEPTION: main
08-26 11:49:06.444: E/AndroidRuntime(754):
android.content.ActivityNotFoundException: Unable to find explicit
activity class
{com.example.androidwebviewexample/com.example.androidwebviewexample.WebActivity};
have you declared this activity in your AndroidManifest.xml?
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivityForResult(Activity.java:3390)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivityForResult(Activity.java:3351)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivity(Activity.java:3587)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivity(Activity.java:3555)
08-26 11:49:06.444: E/AndroidRuntime(754): at
com.example.androidwebviewexample.MainActivity$1.onClick(MainActivity.java:28)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.view.View.performClick(View.java:4240)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.view.View$PerformClick.run(View.java:17721)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.os.Handler.handleCallback(Handler.java:730)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.os.Looper.loop(Looper.java:137)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.ActivityThread.main(ActivityThread.java:5103)
08-26 11:49:06.444: E/AndroidRuntime(754): at
java.lang.reflect.Method.invokeNative(Native Method)
08-26 11:49:06.444: E/AndroidRuntime(754): at
java.lang.reflect.Method.invoke(Method.java:525)
08-26 11:49:06.444: E/AndroidRuntime(754): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-26 11:49:06.444: E/AndroidRuntime(754): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-26 11:49:06.444: E/AndroidRuntime(754): at
dalvik.system.NativeStart.main(Native Method)
i am following this tutorial.
here is my code:
MainActivity.java
package com.example.androidwebviewexample;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
private Button button;
public void onCreate(Bundle savedInstanceState) {
final Context context = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button)findViewById(R.id.buttonUrl);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(context, WebActivity.class);
startActivity(intent);
}
});
}
}
WebActivity.java package com.example.androidwebviewexample;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class WebActivity extends Activity {
private WebView webView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webcontent);
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.random.com/");
}
}
androidmanifesto.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidwebviewexample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.androidwebviewexample.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
i was implementing a simple webview app in android (I'm new to android and
java). App works fine but when i click the button i get this error.
unfortunately app has stopped error
error log.
08-26 11:49:06.374: W/dalvikvm(754): threadid=1: thread exiting with
uncaught exception (group=0x414c4700)
08-26 11:49:06.444: E/AndroidRuntime(754): FATAL EXCEPTION: main
08-26 11:49:06.444: E/AndroidRuntime(754):
android.content.ActivityNotFoundException: Unable to find explicit
activity class
{com.example.androidwebviewexample/com.example.androidwebviewexample.WebActivity};
have you declared this activity in your AndroidManifest.xml?
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivityForResult(Activity.java:3390)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivityForResult(Activity.java:3351)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivity(Activity.java:3587)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.Activity.startActivity(Activity.java:3555)
08-26 11:49:06.444: E/AndroidRuntime(754): at
com.example.androidwebviewexample.MainActivity$1.onClick(MainActivity.java:28)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.view.View.performClick(View.java:4240)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.view.View$PerformClick.run(View.java:17721)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.os.Handler.handleCallback(Handler.java:730)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.os.Looper.loop(Looper.java:137)
08-26 11:49:06.444: E/AndroidRuntime(754): at
android.app.ActivityThread.main(ActivityThread.java:5103)
08-26 11:49:06.444: E/AndroidRuntime(754): at
java.lang.reflect.Method.invokeNative(Native Method)
08-26 11:49:06.444: E/AndroidRuntime(754): at
java.lang.reflect.Method.invoke(Method.java:525)
08-26 11:49:06.444: E/AndroidRuntime(754): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-26 11:49:06.444: E/AndroidRuntime(754): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-26 11:49:06.444: E/AndroidRuntime(754): at
dalvik.system.NativeStart.main(Native Method)
i am following this tutorial.
here is my code:
MainActivity.java
package com.example.androidwebviewexample;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
private Button button;
public void onCreate(Bundle savedInstanceState) {
final Context context = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button)findViewById(R.id.buttonUrl);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(context, WebActivity.class);
startActivity(intent);
}
});
}
}
WebActivity.java package com.example.androidwebviewexample;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class WebActivity extends Activity {
private WebView webView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webcontent);
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.random.com/");
}
}
androidmanifesto.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidwebviewexample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.androidwebviewexample.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Publishing again acknowledging the original publication of oneself academia.stackexchange.com
Publishing again acknowledging the original publication of oneself –
academia.stackexchange.com
I have come across the International Journal of Advanced Computer Science
and Applications(IJACSA). The copyright section says that "Authors retain
the right to publish their material elsewhere, ...
academia.stackexchange.com
I have come across the International Journal of Advanced Computer Science
and Applications(IJACSA). The copyright section says that "Authors retain
the right to publish their material elsewhere, ...
How to convert html to doc in Objective-c
How to convert html to doc in Objective-c
I have a problem to discuss with you that i want to convert html to doc in
objective-c and i have already convert html to rtf but don't know how to
convert from html to doc. This is my small code for converting from html
to rtf
var comStr="";
var result="";
for (var i in color_array) {
var txt_new =rtf_colorarray[i];
comStr+=txt_new +';';
var colortbl_text='{\\colortbl ;';
}
rtf_format_text1= colortbl_text+comStr+'}';
//alert(""+);
////////////////font faimly
var font_array = [ 'font-family: Arial',
'font-family: Courier',
'font-family: Georgia',
'font-family: Helvetica',
'font-family: Verdana',
'font-family: Times New Roman',
'font-family: BaskerVille',
];
var rtf_fontarray = [ 'fcharset0 Arial;',
'fcharset0 Courier;',
'fcharset0 Georgia;',
'fcharset0 Helvetica;',
'fcharset0 Verdana;',
'fcharset0 Times New Roman;',
'fcharset0 BaskerVille;'
];
any help would be most appreciable.....
I have a problem to discuss with you that i want to convert html to doc in
objective-c and i have already convert html to rtf but don't know how to
convert from html to doc. This is my small code for converting from html
to rtf
var comStr="";
var result="";
for (var i in color_array) {
var txt_new =rtf_colorarray[i];
comStr+=txt_new +';';
var colortbl_text='{\\colortbl ;';
}
rtf_format_text1= colortbl_text+comStr+'}';
//alert(""+);
////////////////font faimly
var font_array = [ 'font-family: Arial',
'font-family: Courier',
'font-family: Georgia',
'font-family: Helvetica',
'font-family: Verdana',
'font-family: Times New Roman',
'font-family: BaskerVille',
];
var rtf_fontarray = [ 'fcharset0 Arial;',
'fcharset0 Courier;',
'fcharset0 Georgia;',
'fcharset0 Helvetica;',
'fcharset0 Verdana;',
'fcharset0 Times New Roman;',
'fcharset0 BaskerVille;'
];
any help would be most appreciable.....
Sunday, 25 August 2013
Forwarding subdomain to main domain
Forwarding subdomain to main domain
So I'm not sure my title makes sense, but here is what I'm trying to
accomplish: My programmer created my WordPress based site at
xx.mydomain.com Everything on this subdomain works perfectly.
A) is there anyway to just have mydomain.com automatically forward to
xx.mydomain.com? Should this be done with a simple php script in the index
file on root or through some code in .htaccess?
B) is it ok to leave it at xx.mydomain.com? Will it create problems with
search engines? At some point I will have yy.mydomain.com. At that point I
will create an index file where users can select xx or yy.
So I'm not sure my title makes sense, but here is what I'm trying to
accomplish: My programmer created my WordPress based site at
xx.mydomain.com Everything on this subdomain works perfectly.
A) is there anyway to just have mydomain.com automatically forward to
xx.mydomain.com? Should this be done with a simple php script in the index
file on root or through some code in .htaccess?
B) is it ok to leave it at xx.mydomain.com? Will it create problems with
search engines? At some point I will have yy.mydomain.com. At that point I
will create an index file where users can select xx or yy.
[ Other - Electronics ] Open Question : Is it ok if we charge iPad 2 with a Samsung galaxy 3 charger?
[ Other - Electronics ] Open Question : Is it ok if we charge iPad 2 with
a Samsung galaxy 3 charger?
That chord that I am using is my iPad's
a Samsung galaxy 3 charger?
That chord that I am using is my iPad's
jQuery mobile open popup from popup
jQuery mobile open popup from popup
I'm using jQuery mobile 1.9.1 min on PhoneGap.
I have a list where each iten on click opens an actions popup:
function showActions(index){
selectedIndex = index;
$("#actionPopup").popup("open", {positionTo: '#list li:nth-child('+
index +')'});
}
<div data-role="popup" id="actionPopup" data-overlay-theme="a">
<a href="#" data-rel="back" data-role="button" data-theme="a"
data-icon="delete" data-iconpos="notext"
class="ui-btn-right">Close</a>
<ul data-role="listview">
<li data-role="divider">Actions</li>
<li data-icon="false" onclick="showDetails();">action1</li>
<li data-icon="false">action2</li>
<li data-icon="false">action3</li>
<li data-icon="false">action4</li>
</ul>
</div>
When I press on action1 with showDetails() them method is called but the
second popup isn't shown.
function showDetails(){
console.log("showDetails");
$("#infoPopup").popup("open");
}
<div data-role="popup" id="infoPopup">
<a href="#" data-rel="back" data-role="button" data-theme="a"
data-icon="delete" data-iconpos="notext"
class="ui-btn-right">Close</a>
<div id="infoContent">
<table>
<tr id="eventcode">
<td>test1:</td>
<td> </td>
</tr>
<tr id="eventtype">
<td>test2:</td>
<td> </td>
</tr>
</table>
</div>
</div>
What can I do?
I'm using jQuery mobile 1.9.1 min on PhoneGap.
I have a list where each iten on click opens an actions popup:
function showActions(index){
selectedIndex = index;
$("#actionPopup").popup("open", {positionTo: '#list li:nth-child('+
index +')'});
}
<div data-role="popup" id="actionPopup" data-overlay-theme="a">
<a href="#" data-rel="back" data-role="button" data-theme="a"
data-icon="delete" data-iconpos="notext"
class="ui-btn-right">Close</a>
<ul data-role="listview">
<li data-role="divider">Actions</li>
<li data-icon="false" onclick="showDetails();">action1</li>
<li data-icon="false">action2</li>
<li data-icon="false">action3</li>
<li data-icon="false">action4</li>
</ul>
</div>
When I press on action1 with showDetails() them method is called but the
second popup isn't shown.
function showDetails(){
console.log("showDetails");
$("#infoPopup").popup("open");
}
<div data-role="popup" id="infoPopup">
<a href="#" data-rel="back" data-role="button" data-theme="a"
data-icon="delete" data-iconpos="notext"
class="ui-btn-right">Close</a>
<div id="infoContent">
<table>
<tr id="eventcode">
<td>test1:</td>
<td> </td>
</tr>
<tr id="eventtype">
<td>test2:</td>
<td> </td>
</tr>
</table>
</div>
</div>
What can I do?
how to add an argument to a method stored in an array that is called later
how to add an argument to a method stored in an array that is called later
This is a follow-up to this question (although this is self-contained)
trying to `call` three methods but not working correctly with jQuery map.
I am trying to store a set of methods in an array but there is a set that
might have arguments like below (the initial methods are in before_methods
and the proposed methods are in lm_methods). I'm sure it's pretty self
explanatory what I want but I'd like to be able to merge in the arguments
into a reasonable call to f (specifically the arc.pLikedByTerm). I
currently have the following:
// signature
pLikedByTerm:function(term, ne, sw, m){
....
}
// code before_methods just to show
this.before_methods=[arc.pLocations,arc.pLikedLocations,arc.pLikedItems];
this.lm_methods=[arc.pLocations,arc.pLikedLocations,arc.pLikedItems,
arc.pLikedByTerm('surfing'),arc.pLikedByTerm('sailing')];
$.each(this.lm_methods, function(i,f){
f(ne,sw,m);
});
How would I do this or is this bad design? What would be the idiomatic
way? My brain is fried.
thx in advance
This is a follow-up to this question (although this is self-contained)
trying to `call` three methods but not working correctly with jQuery map.
I am trying to store a set of methods in an array but there is a set that
might have arguments like below (the initial methods are in before_methods
and the proposed methods are in lm_methods). I'm sure it's pretty self
explanatory what I want but I'd like to be able to merge in the arguments
into a reasonable call to f (specifically the arc.pLikedByTerm). I
currently have the following:
// signature
pLikedByTerm:function(term, ne, sw, m){
....
}
// code before_methods just to show
this.before_methods=[arc.pLocations,arc.pLikedLocations,arc.pLikedItems];
this.lm_methods=[arc.pLocations,arc.pLikedLocations,arc.pLikedItems,
arc.pLikedByTerm('surfing'),arc.pLikedByTerm('sailing')];
$.each(this.lm_methods, function(i,f){
f(ne,sw,m);
});
How would I do this or is this bad design? What would be the idiomatic
way? My brain is fried.
thx in advance
Saturday, 24 August 2013
how can I generate a youtube url given a keyword
how can I generate a youtube url given a keyword
On the youtube, after I input a keyword and click search button, youtube
website will generate a URL, e.g.
http://www.youtube.com/results?search_query=music&oq=music&gs_l=youtube.3..0l10.171609.172253.0.172424.5.5.0.0.0.0.154.483.4j1.5.0...0.0...1ac.1.11.youtube.4W9jG6LQXQA
From this URL we can see that the keyword is 'music' which is behind
'search_query=' and '&oq='. If I change the keyword but keep the left part
of this URL, e.g. I get
http://www.youtube.com/results?search_query=taylor&oq=taylor&gs_l=youtube.3..0l10.171609.172253.0.172424.5.5.0.0.0.0.154.483.4j1.5.0...0.0...1ac.1.11.youtube.4W9jG6LQXQA
, then the URL still can be used. My question is: what does the left part
of the youtube's URL mean:
&gs_l=youtube.3..0l10.171609.172253.0.172424.5.5.0.0.0.0.154.483.4j1.5.0...0.0...1ac.1.11.youtube.4W9jG6LQXQA
?
Could you give me an explanation ? This should not be the youtube API.
Thanks !
On the youtube, after I input a keyword and click search button, youtube
website will generate a URL, e.g.
http://www.youtube.com/results?search_query=music&oq=music&gs_l=youtube.3..0l10.171609.172253.0.172424.5.5.0.0.0.0.154.483.4j1.5.0...0.0...1ac.1.11.youtube.4W9jG6LQXQA
From this URL we can see that the keyword is 'music' which is behind
'search_query=' and '&oq='. If I change the keyword but keep the left part
of this URL, e.g. I get
http://www.youtube.com/results?search_query=taylor&oq=taylor&gs_l=youtube.3..0l10.171609.172253.0.172424.5.5.0.0.0.0.154.483.4j1.5.0...0.0...1ac.1.11.youtube.4W9jG6LQXQA
, then the URL still can be used. My question is: what does the left part
of the youtube's URL mean:
&gs_l=youtube.3..0l10.171609.172253.0.172424.5.5.0.0.0.0.154.483.4j1.5.0...0.0...1ac.1.11.youtube.4W9jG6LQXQA
?
Could you give me an explanation ? This should not be the youtube API.
Thanks !
Cannot install wireless driver for Broadcom 12.04
Cannot install wireless driver for Broadcom 12.04
I just installed Wubi on a Dell Inspiron, and am trying to install the
drivers for a Broadcom BCM4312 driver. I know this is a common question on
the site, but I think I have tried every solution posed, and I still
cannot get it to work. When I go into the jockey file, I get:
2013-08-24 17:10:10,049 DEBUG: BroadcomWLHandler enabled(): kmod disabled,
bcm43xx: blacklisted, b43: blacklisted, b43legacy: blacklisted
I went into the blacklist.conf file and commented out
# blacklist bcm43xx
And I have restarted, even done a fresh install of Wubi. Nothing works.
Any suggestions? Let me know know what further info I need to provide.
I just installed Wubi on a Dell Inspiron, and am trying to install the
drivers for a Broadcom BCM4312 driver. I know this is a common question on
the site, but I think I have tried every solution posed, and I still
cannot get it to work. When I go into the jockey file, I get:
2013-08-24 17:10:10,049 DEBUG: BroadcomWLHandler enabled(): kmod disabled,
bcm43xx: blacklisted, b43: blacklisted, b43legacy: blacklisted
I went into the blacklist.conf file and commented out
# blacklist bcm43xx
And I have restarted, even done a fresh install of Wubi. Nothing works.
Any suggestions? Let me know know what further info I need to provide.
Is turning input and label into block level items okey?
Is turning input and label into block level items okey?
I know that you can't (semantically) do something like:
<p>
<div> Lorem... </div>
</p>
I am working on the comment_form() for WordPress:
<form...>
<div<
<label>Label<label><input...>
</div>
...
</form>
I am using Foundation's mixin's (sass) to set a grid to label and input.
This mixin will make the label and input a block (those are normally a
inline). Is this, okey? Should I put the label and input in 2 different
div's again and set the grid mixins on those instead?
What I also found in the default comment_form() function is:
<p class="form-submit">
<input name="submit" type="submit" id="<?php echo esc_attr(
$args['id_submit'] ); ?>" value="<?php echo esc_attr(
$args['label_submit'] ); ?>" />
<?php comment_id_fields( $post_id ); ?>
</p>
Because I can't change that p to a div I probably have to recreate the
hole function. I think I need to do this because Foundation will set the
display to block for the input submit. Should I leave it as is or if I
want semantic markup, should I recreate the function?
I know that you can't (semantically) do something like:
<p>
<div> Lorem... </div>
</p>
I am working on the comment_form() for WordPress:
<form...>
<div<
<label>Label<label><input...>
</div>
...
</form>
I am using Foundation's mixin's (sass) to set a grid to label and input.
This mixin will make the label and input a block (those are normally a
inline). Is this, okey? Should I put the label and input in 2 different
div's again and set the grid mixins on those instead?
What I also found in the default comment_form() function is:
<p class="form-submit">
<input name="submit" type="submit" id="<?php echo esc_attr(
$args['id_submit'] ); ?>" value="<?php echo esc_attr(
$args['label_submit'] ); ?>" />
<?php comment_id_fields( $post_id ); ?>
</p>
Because I can't change that p to a div I probably have to recreate the
hole function. I think I need to do this because Foundation will set the
display to block for the input submit. Should I leave it as is or if I
want semantic markup, should I recreate the function?
Compiling App for older OS X versions
Compiling App for older OS X versions
I recently submitted (my first) app to the AppStore. It works on OS X 10.8
and uses some of the 10.8 features like ShareKit. I wanted to support OS X
10.7 also, to make it available for 10.7 users. Of course, this would mean
that the 10.7 version will not have the ShareKit features. But I'm not
sure what compile settings to use to make it available for both, so that
10.8 users will be able to make use of the features and 10.7 users will
not see them.
I tried changing the Base SDK to 10.7, but it won't compile on that.
I tried changing the deployment target to 10.7 keeping the Base SDK 10.8.
It compiled, but I'm not sure if that is the right thing to do. Don't have
a 10.7 machine to test it, either.
If case 2 is correct, how do I check the in the code and make the menu
items disabled?
I recently submitted (my first) app to the AppStore. It works on OS X 10.8
and uses some of the 10.8 features like ShareKit. I wanted to support OS X
10.7 also, to make it available for 10.7 users. Of course, this would mean
that the 10.7 version will not have the ShareKit features. But I'm not
sure what compile settings to use to make it available for both, so that
10.8 users will be able to make use of the features and 10.7 users will
not see them.
I tried changing the Base SDK to 10.7, but it won't compile on that.
I tried changing the deployment target to 10.7 keeping the Base SDK 10.8.
It compiled, but I'm not sure if that is the right thing to do. Don't have
a 10.7 machine to test it, either.
If case 2 is correct, how do I check the in the code and make the menu
items disabled?
MK Dons vs Bristol City Live Stream
MK Dons vs Bristol City Live Stream
Watch Live Streaming Link
MK Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream
Watch Live Streaming Link
Watch Live Streaming Link
MK Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream MK Dons vs Bristol City Live Stream MK
Dons vs Bristol City Live Stream
Watch Live Streaming Link
Print Matching line and nth line from the matched line
Print Matching line and nth line from the matched line
I am trying to print the matched line and the 4th line from the matched
line (line containing the expression I am searching for).
I have been using the following code: sed -n 's/^[ \t]*//; /img
class=\"devil_icon/,4p' input.txt
But this only prints the matched line.
This prints only the 4th line. awk 'c&&!--c;/img class=\"devil_icon/{c=4}'
input.txt
I need to print both the matched line and the 4th line only.
I am trying to print the matched line and the 4th line from the matched
line (line containing the expression I am searching for).
I have been using the following code: sed -n 's/^[ \t]*//; /img
class=\"devil_icon/,4p' input.txt
But this only prints the matched line.
This prints only the 4th line. awk 'c&&!--c;/img class=\"devil_icon/{c=4}'
input.txt
I need to print both the matched line and the 4th line only.
How to update an Android app by only sending the code that changed instead of the whole bundle for each update?
How to update an Android app by only sending the code that changed instead
of the whole bundle for each update?
I have an android app which incorporates a jar file which is 6mb in size.
I want to be able to provide updates to my app without bundling the 6mb
jar for each update, instead only send the application code that changed
for each update. Someone please let me know if this is possible?
of the whole bundle for each update?
I have an android app which incorporates a jar file which is 6mb in size.
I want to be able to provide updates to my app without bundling the 6mb
jar for each update, instead only send the application code that changed
for each update. Someone please let me know if this is possible?
Friday, 23 August 2013
Deleting files using FOR loop in makefile
Deleting files using FOR loop in makefile
I got struck in writing FOR loop to delete object files in clean target. I
tried the below code however I'm getting error message. Could any one
please help me on this?
TES_FILE := D:/Technique/Testmake/1.obj
TES_FILE += D:/Technique/Testmake/2.obj
clean:
$(foreach objFile,$(TES_FILE),if exist $(objFile) DEL /F "$(subst
/,\,$(objFile))")
Error Message: if exist D:/Technique/Testmake/1.txt DEL /F
"D:\Technique\Testmake\1.txt" if exi st D:/Technique/Testmake/2.txt DEL /F
"D:\Technique\Testmake\2.txt" Invalid switch - "Technique". gmake: *
[clean] Error 1
Thanks, Anand
I got struck in writing FOR loop to delete object files in clean target. I
tried the below code however I'm getting error message. Could any one
please help me on this?
TES_FILE := D:/Technique/Testmake/1.obj
TES_FILE += D:/Technique/Testmake/2.obj
clean:
$(foreach objFile,$(TES_FILE),if exist $(objFile) DEL /F "$(subst
/,\,$(objFile))")
Error Message: if exist D:/Technique/Testmake/1.txt DEL /F
"D:\Technique\Testmake\1.txt" if exi st D:/Technique/Testmake/2.txt DEL /F
"D:\Technique\Testmake\2.txt" Invalid switch - "Technique". gmake: *
[clean] Error 1
Thanks, Anand
How can a Debian process change the mod date of a file and not have it show up in the auditd log?
How can a Debian process change the mod date of a file and not have it
show up in the auditd log?
The other day I set up a little shell script on a Debian server to send me
an email when files change; it looks like this:
#!/bin/sh
items=`find /var/www/vhosts -regex ".*/httpdocs/.*" -newer files_start -ls`
if [ ! -z "$items" ]
then
touch files_start
echo "$items" | mail -s "new file(s)" "security@example.com"
fi
I kept getting notified of one mysterious 0-length text file
(web-accessible, writable by PHP and the vhost user, but not Apache)
getting modified 2-3 times a day, so I set up auditd with the following
rule.
auditctl -l
LIST_RULES: exit,always watch=/var/www/vhosts/path/to/file.txt perm=rwa
key=wh1
I tested it with ausearch and got, as expected:
...comm="touch" exe="/bin/touch"
I waited for the next email with the new mod date and ran ausearch: no new
matches!
How can this happen?
show up in the auditd log?
The other day I set up a little shell script on a Debian server to send me
an email when files change; it looks like this:
#!/bin/sh
items=`find /var/www/vhosts -regex ".*/httpdocs/.*" -newer files_start -ls`
if [ ! -z "$items" ]
then
touch files_start
echo "$items" | mail -s "new file(s)" "security@example.com"
fi
I kept getting notified of one mysterious 0-length text file
(web-accessible, writable by PHP and the vhost user, but not Apache)
getting modified 2-3 times a day, so I set up auditd with the following
rule.
auditctl -l
LIST_RULES: exit,always watch=/var/www/vhosts/path/to/file.txt perm=rwa
key=wh1
I tested it with ausearch and got, as expected:
...comm="touch" exe="/bin/touch"
I waited for the next email with the new mod date and ran ausearch: no new
matches!
How can this happen?
Error when trying to add two integers in C
Error when trying to add two integers in C
I'm trying to learn C and my very simple program is simply trying to add
two numbers by calling a function.
I get the following number when trying to compile and run it:
Undefined symbols for architecture x86_64:
"_print", referenced from:
_main in ccepYqVz.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Here is what my code looks like:
#include <stdio.h>
int addNumbers( int x, int y);
int main() {
int total = addNumbers(10,5);
print("Total %d", total);
return 0;
}
int addNumbers( int x, int y) {
return x+y;
}
I'm trying to learn C and my very simple program is simply trying to add
two numbers by calling a function.
I get the following number when trying to compile and run it:
Undefined symbols for architecture x86_64:
"_print", referenced from:
_main in ccepYqVz.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Here is what my code looks like:
#include <stdio.h>
int addNumbers( int x, int y);
int main() {
int total = addNumbers(10,5);
print("Total %d", total);
return 0;
}
int addNumbers( int x, int y) {
return x+y;
}
Hashing Algorithm: Deleting an element in linear probing
Hashing Algorithm: Deleting an element in linear probing
While using Linear probing method to implement hashing, when we delete and
element, the position of the deleted element is declared as a tombstone/
mark it as deleted. Why can't we just shift all the elements from the
current position until the next empty element is encountered? Won't this
save the time when too many tombstones are encountered later and a
rehashing might be required? Am I missing something? Please tell me if I
need to clarify my question.
Thanks a lot!
While using Linear probing method to implement hashing, when we delete and
element, the position of the deleted element is declared as a tombstone/
mark it as deleted. Why can't we just shift all the elements from the
current position until the next empty element is encountered? Won't this
save the time when too many tombstones are encountered later and a
rehashing might be required? Am I missing something? Please tell me if I
need to clarify my question.
Thanks a lot!
Simple IF statement excel vba
Simple IF statement excel vba
I have the following code below and what it does it create another excel
document from the information gathered from the initial document (source).
So what i want to do now is create a statement that will do some checking
for me:
If column E and F has values, then i want to take F value If E is blank i
want to take F value If F is blank i want to take E value
I want the final value to only display in column K in the new document
workbook
Keep in mind that column E and F is in the source document
Please help, thank you
Sub test()
Dim ws As Worksheet
Dim rngData As Range
Dim DataCell As Range
Dim arrResults() As Variant
Dim ResultIndex As Long
Dim strFolderPath As String
Set ws = Sheets("Sheet1")
Set rngData = ws.Range("A2", ws.Cells(Rows.Count, "A").End(xlUp))
If rngData.Row < 2 Then Exit Sub 'No data
ReDim arrResults(1 To rngData.Rows.Count, 1 To 11)
strFolderPath = ActiveWorkbook.Path & Application.PathSeparator
For Each DataCell In rngData.Cells
ResultIndex = ResultIndex + 1
Select Case (Len(ws.Cells(DataCell.Row, "B").Text) > 0)
Case True: arrResults(ResultIndex, 1) = "" &
ws.Cells(DataCell.Row, "B").Text & ""
Case Else: arrResults(ResultIndex, 1) = "" &
ws.Cells(DataCell.Row, "A").Text & ""
End Select
arrResults(ResultIndex, 2) = "" & ws.Cells(DataCell.Row, "B").Text & ""
arrResults(ResultIndex, 3) = "animals/type/" & DataCell.Text &
"/option/an_" & DataCell.Text & "_co.png"
arrResults(ResultIndex, 4) = "animals/" & DataCell.Text &
"/option/an_" & DataCell.Text & "_co2.png"
arrResults(ResultIndex, 5) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade.png"
arrResults(ResultIndex, 6) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade2.png"
arrResults(ResultIndex, 7) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade.png"
arrResults(ResultIndex, 8) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade2.png"
arrResults(ResultIndex, 9) = "" & ws.Cells(DataCell.Row, "C").Text & ""
arrResults(ResultIndex, 10) = "" & ws.Cells(DataCell.Row, "D").Text & ""
arrResults(ResultIndex, 11) = "" & ws.Cells(DataCell.Row, "E").Text & ""
Next DataCell
'Add a new sheet
With Sheets.Add
Sheets("Sheet2").Rows(1).Copy .Range("A1")
.Range("A2").Resize(ResultIndex, UBound(arrResults, 2)).Value =
arrResults
'.UsedRange.EntireRow.AutoFit 'Uncomment this line if desired
'The .Move will move this sheet to its own workook
.Move
'Save the workbook, turning off DisplayAlerts will suppress prompt to
override existing file
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs strFolderPath & "destin.xls", xlExcel8
Application.DisplayAlerts = True
End With
Set ws = Nothing
Set rngData = Nothing
Set DataCell = Nothing
Erase arrResults
End Sub
I have the following code below and what it does it create another excel
document from the information gathered from the initial document (source).
So what i want to do now is create a statement that will do some checking
for me:
If column E and F has values, then i want to take F value If E is blank i
want to take F value If F is blank i want to take E value
I want the final value to only display in column K in the new document
workbook
Keep in mind that column E and F is in the source document
Please help, thank you
Sub test()
Dim ws As Worksheet
Dim rngData As Range
Dim DataCell As Range
Dim arrResults() As Variant
Dim ResultIndex As Long
Dim strFolderPath As String
Set ws = Sheets("Sheet1")
Set rngData = ws.Range("A2", ws.Cells(Rows.Count, "A").End(xlUp))
If rngData.Row < 2 Then Exit Sub 'No data
ReDim arrResults(1 To rngData.Rows.Count, 1 To 11)
strFolderPath = ActiveWorkbook.Path & Application.PathSeparator
For Each DataCell In rngData.Cells
ResultIndex = ResultIndex + 1
Select Case (Len(ws.Cells(DataCell.Row, "B").Text) > 0)
Case True: arrResults(ResultIndex, 1) = "" &
ws.Cells(DataCell.Row, "B").Text & ""
Case Else: arrResults(ResultIndex, 1) = "" &
ws.Cells(DataCell.Row, "A").Text & ""
End Select
arrResults(ResultIndex, 2) = "" & ws.Cells(DataCell.Row, "B").Text & ""
arrResults(ResultIndex, 3) = "animals/type/" & DataCell.Text &
"/option/an_" & DataCell.Text & "_co.png"
arrResults(ResultIndex, 4) = "animals/" & DataCell.Text &
"/option/an_" & DataCell.Text & "_co2.png"
arrResults(ResultIndex, 5) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade.png"
arrResults(ResultIndex, 6) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade2.png"
arrResults(ResultIndex, 7) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade.png"
arrResults(ResultIndex, 8) = "animals/" & DataCell.Text & "/shade/an_"
& DataCell.Text & "_shade2.png"
arrResults(ResultIndex, 9) = "" & ws.Cells(DataCell.Row, "C").Text & ""
arrResults(ResultIndex, 10) = "" & ws.Cells(DataCell.Row, "D").Text & ""
arrResults(ResultIndex, 11) = "" & ws.Cells(DataCell.Row, "E").Text & ""
Next DataCell
'Add a new sheet
With Sheets.Add
Sheets("Sheet2").Rows(1).Copy .Range("A1")
.Range("A2").Resize(ResultIndex, UBound(arrResults, 2)).Value =
arrResults
'.UsedRange.EntireRow.AutoFit 'Uncomment this line if desired
'The .Move will move this sheet to its own workook
.Move
'Save the workbook, turning off DisplayAlerts will suppress prompt to
override existing file
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs strFolderPath & "destin.xls", xlExcel8
Application.DisplayAlerts = True
End With
Set ws = Nothing
Set rngData = Nothing
Set DataCell = Nothing
Erase arrResults
End Sub
I have got a nullpointer exception
I have got a nullpointer exception
hi i have created an application in android but on running I am getting a
null pointer exception
I am giving my log cat and java class below I need a better solution to
overcome this error
08-23 10:09:57.426: E/AndroidRuntime(3373): FATAL EXCEPTION: main
08-23 10:09:57.426: E/AndroidRuntime(3373): java.lang.RuntimeException:
Unable to start
activity ComponentInfo{com.neochat/com.neochat.Friends_list}:
java.lang.NullPointerException
08-23 10:09:57.426: E/AndroidRuntime(3373): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-23 10:09:57.426: E/AndroidRuntime(3373): at
android.app.ActivityThread.startActivityNow(ActivityThread.java:2023)
08-23 10:09:57.426: E/AndroidRuntime(3373): at
android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
Here is my java class
public class Friends_list extends Activity implements
OnItemClickListener{
private ArrayList<String> results = new ArrayList<String>();
private SQLiteDatabase newDB;
LoginDataBaseAdapter loginDataBaseAdapter ;
ListView listview;
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friends);
listview=(ListView)findViewById(R.id.listview);
context=this;
loginDataBaseAdapter.getfriends();
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3)
{
Intent in2=new
Intent(Friends_list.this,InboxActivity.class);
startActivity(in2);
}
}
I am giving my getFriends() function below
public List<String>getfriends(){
List<String> FriendList=new ArrayList<String>();
String selectQuery="select * from UserDetails";
db=dbHelper.getWritableDatabase();
Cursor cursor=db.rawQuery(selectQuery, null);
while(cursor.moveToNext()){
FriendList.add(cursor.getString(1));
}
return FriendList;
}
I want to display the contents of the table in the database to a listview
in my activity can anybody help me
hi i have created an application in android but on running I am getting a
null pointer exception
I am giving my log cat and java class below I need a better solution to
overcome this error
08-23 10:09:57.426: E/AndroidRuntime(3373): FATAL EXCEPTION: main
08-23 10:09:57.426: E/AndroidRuntime(3373): java.lang.RuntimeException:
Unable to start
activity ComponentInfo{com.neochat/com.neochat.Friends_list}:
java.lang.NullPointerException
08-23 10:09:57.426: E/AndroidRuntime(3373): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-23 10:09:57.426: E/AndroidRuntime(3373): at
android.app.ActivityThread.startActivityNow(ActivityThread.java:2023)
08-23 10:09:57.426: E/AndroidRuntime(3373): at
android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
Here is my java class
public class Friends_list extends Activity implements
OnItemClickListener{
private ArrayList<String> results = new ArrayList<String>();
private SQLiteDatabase newDB;
LoginDataBaseAdapter loginDataBaseAdapter ;
ListView listview;
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friends);
listview=(ListView)findViewById(R.id.listview);
context=this;
loginDataBaseAdapter.getfriends();
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3)
{
Intent in2=new
Intent(Friends_list.this,InboxActivity.class);
startActivity(in2);
}
}
I am giving my getFriends() function below
public List<String>getfriends(){
List<String> FriendList=new ArrayList<String>();
String selectQuery="select * from UserDetails";
db=dbHelper.getWritableDatabase();
Cursor cursor=db.rawQuery(selectQuery, null);
while(cursor.moveToNext()){
FriendList.add(cursor.getString(1));
}
return FriendList;
}
I want to display the contents of the table in the database to a listview
in my activity can anybody help me
Export to excel file taking long time when trying to open
Export to excel file taking long time when trying to open
I am exporting grid(jqgrid 3.8.3) in spring mvc application to excel using
XSSFWorkbook Apache POI, the export method works well when I select the
'Save As' option, but instead if I select the 'Open' option, the method is
executed many times, strucking up the application! plz let me know if
there is wrong in my below code?
@RequestMapping(value = "/ExportAdminUserInfo.htm", method =
{RequestMethod.GET, RequestMethod.HEAD})
public @ResponseBody ProjectResponse
exportToExcel(HttpServletRequest request,HttpServletResponse
response) throws SpringException {
List<ManageMasterUserDTO> exportUserListOfEPRT = null;
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "inline; filename="
+ "excel1.xlsx");
System.out.println("Excel written successfully..");
try{
XSSFWorkbook workbook = new XSSFWorkbook ();
XSSFSheet sheet = workbook.createSheet("Sample sheet");
exportUserListOfEPRT =
masteruserservice.fetchTableDetailsForExport();
int rownum = 0;
XSSFRow row = null;
XSSFCell cell = null;
row = sheet.createRow(rownum);
I am exporting grid(jqgrid 3.8.3) in spring mvc application to excel using
XSSFWorkbook Apache POI, the export method works well when I select the
'Save As' option, but instead if I select the 'Open' option, the method is
executed many times, strucking up the application! plz let me know if
there is wrong in my below code?
@RequestMapping(value = "/ExportAdminUserInfo.htm", method =
{RequestMethod.GET, RequestMethod.HEAD})
public @ResponseBody ProjectResponse
exportToExcel(HttpServletRequest request,HttpServletResponse
response) throws SpringException {
List<ManageMasterUserDTO> exportUserListOfEPRT = null;
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "inline; filename="
+ "excel1.xlsx");
System.out.println("Excel written successfully..");
try{
XSSFWorkbook workbook = new XSSFWorkbook ();
XSSFSheet sheet = workbook.createSheet("Sample sheet");
exportUserListOfEPRT =
masteruserservice.fetchTableDetailsForExport();
int rownum = 0;
XSSFRow row = null;
XSSFCell cell = null;
row = sheet.createRow(rownum);
Thursday, 22 August 2013
Could not determine the dependencies for all tasks with robolectric gradle plugin
Could not determine the dependencies for all tasks with robolectric gradle
plugin
after modifying my gradle build file like written in the docu I get the
following error for all of my tasks:
Could not determine the dependencies of task ':android:testDebug'.
anybody knows what could be the problem?
plugin
after modifying my gradle build file like written in the docu I get the
following error for all of my tasks:
Could not determine the dependencies of task ':android:testDebug'.
anybody knows what could be the problem?
How to have infinite width for right scrolling game
How to have infinite width for right scrolling game
I am a newbie to game development and currently using AndEngine for an
android game. It is a right scrolling game where the player can
continuously move to right of the screen like mario.
How can we have infinite right scrolling?
Currently, I am setting my boundCamera Limits like this:
camera.setBounds(0, 0, CAMERA_WIDTH*100, CAMERA_HEIGHT);
and I create a frame like this:
public void createFrame(){
// 205-175-149 cdaf95
final IAreaShape/*Shape*/ ground = new Rectangle(0, mCameraHeight - 2,
mCameraWidth*100, 2, gameLogicController.getVertexBufferObjectManager());
ground.setColor(0.7f, 0.5f, 0.3f);
final IAreaShape/*Shape*/ roof = new Rectangle(0, 0, mCameraWidth*100, 2,
gameLogicController.getVertexBufferObjectManager());
roof.setColor(0.7f, 0.5f, 0.3f);
final IAreaShape/*Shape*/ left = new Rectangle(0, 0, 2, mCameraHeight,
gameLogicController.getVertexBufferObjectManager());
left.setColor(0.7f, 0.5f, 0.3f);
final IAreaShape/*Shape*/ right = new Rectangle(mCameraWidth*100 - 2, 0,
2, mCameraHeight, gameLogicController.getVertexBufferObjectManager());
right.setColor(0.7f, 0.5f, 0.3f);
final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f,
0.5f);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground,
BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof,
BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, left,
BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, right,
BodyType.StaticBody, wallFixtureDef);
scene.attachChild(ground);
scene.attachChild(roof);
scene.attachChild(left);
scene.attachChild(right);
}
But it ends up being fixed width only (100 times camera width). How can I
have infinite width? If I give very large value, app crashes.
Thank you for any help..
I am a newbie to game development and currently using AndEngine for an
android game. It is a right scrolling game where the player can
continuously move to right of the screen like mario.
How can we have infinite right scrolling?
Currently, I am setting my boundCamera Limits like this:
camera.setBounds(0, 0, CAMERA_WIDTH*100, CAMERA_HEIGHT);
and I create a frame like this:
public void createFrame(){
// 205-175-149 cdaf95
final IAreaShape/*Shape*/ ground = new Rectangle(0, mCameraHeight - 2,
mCameraWidth*100, 2, gameLogicController.getVertexBufferObjectManager());
ground.setColor(0.7f, 0.5f, 0.3f);
final IAreaShape/*Shape*/ roof = new Rectangle(0, 0, mCameraWidth*100, 2,
gameLogicController.getVertexBufferObjectManager());
roof.setColor(0.7f, 0.5f, 0.3f);
final IAreaShape/*Shape*/ left = new Rectangle(0, 0, 2, mCameraHeight,
gameLogicController.getVertexBufferObjectManager());
left.setColor(0.7f, 0.5f, 0.3f);
final IAreaShape/*Shape*/ right = new Rectangle(mCameraWidth*100 - 2, 0,
2, mCameraHeight, gameLogicController.getVertexBufferObjectManager());
right.setColor(0.7f, 0.5f, 0.3f);
final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f,
0.5f);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground,
BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof,
BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, left,
BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, right,
BodyType.StaticBody, wallFixtureDef);
scene.attachChild(ground);
scene.attachChild(roof);
scene.attachChild(left);
scene.attachChild(right);
}
But it ends up being fixed width only (100 times camera width). How can I
have infinite width? If I give very large value, app crashes.
Thank you for any help..
GitHub: make fork an "own project"
GitHub: make fork an "own project"
I have found a nice GitHub project which I extended a lot. I believe my
changes are good, because they are working. But it seems the original
author hasn't got the time to review these changes and include them. In
fact, it is even possible that the features I need and implemented are not
in the vision of the original author and we simply aim at different goals.
I don't know as I never got responses from him.
That said I saw my contributions are not counted in my commit-map. This is
the case as long as the original repository doesn't accept my
contributions. Furthermore my work is only recognized as work and doesn't
attract any other people with the same vision as I have. This is the
bigger problem for me, because I see a lot of people asking for these
features.
I am still offering my contributions to the original project, but I see it
is unlikely they are ever accepted. Now I would like to make my fork a
"real project". While I plan to sync with the original project at some
points of time, I want to rename it and motivate people to contribute to
my project as well. In addition, I would love if GitHub would show that
this project is actively maintained (speaking of the commit map). And
finally, I would love to make proper releases of it.
How can I get this done and well, make my fork a full-fledged project?
I have found a nice GitHub project which I extended a lot. I believe my
changes are good, because they are working. But it seems the original
author hasn't got the time to review these changes and include them. In
fact, it is even possible that the features I need and implemented are not
in the vision of the original author and we simply aim at different goals.
I don't know as I never got responses from him.
That said I saw my contributions are not counted in my commit-map. This is
the case as long as the original repository doesn't accept my
contributions. Furthermore my work is only recognized as work and doesn't
attract any other people with the same vision as I have. This is the
bigger problem for me, because I see a lot of people asking for these
features.
I am still offering my contributions to the original project, but I see it
is unlikely they are ever accepted. Now I would like to make my fork a
"real project". While I plan to sync with the original project at some
points of time, I want to rename it and motivate people to contribute to
my project as well. In addition, I would love if GitHub would show that
this project is actively maintained (speaking of the commit map). And
finally, I would love to make proper releases of it.
How can I get this done and well, make my fork a full-fledged project?
difference between , =!, ==! in php
difference between , =!, ==! in php
Hi I am doing a conditional
if ($row['ConsignadaCaja'] === 'si' && $row['Estado'] ==! 'I') {
$pago = 0;
}
It does not work as I want
So I try using
if ($row['ConsignadaCaja'] === 'si' && $row['Estado'] =! 'I') {
$pago = 0;
}
But it does not work either
Finally I try this:
if ($row['ConsignadaCaja'] === 'si' && $row['Estado'] <> 'I') {
$pago = 0;
}
It is works but do not why?
Hi I am doing a conditional
if ($row['ConsignadaCaja'] === 'si' && $row['Estado'] ==! 'I') {
$pago = 0;
}
It does not work as I want
So I try using
if ($row['ConsignadaCaja'] === 'si' && $row['Estado'] =! 'I') {
$pago = 0;
}
But it does not work either
Finally I try this:
if ($row['ConsignadaCaja'] === 'si' && $row['Estado'] <> 'I') {
$pago = 0;
}
It is works but do not why?
Setting Lagrangian
Setting Lagrangian
A pendulum consists of a light inextensible rod $OA$, length $b$, freely
pivoted at $O$, attached at $A$ to the rim of a uniform disc of radius $a$
and mass $m$. The disc is free to rotate about $A$. The system moves in a
vertical plane containing $O$.
Can you help me to set Lagrangian?
I found that
$$\vec r_A=b\sin\theta\vec i+b\cos\theta\vec j$$
$$\dot{\vec r_A}=b\dot\theta\cos\theta\vec i-b\dot\theta\sin\theta\vec j$$
I am not sure if this is correct for point $G$ ($G$ is center of mass of a
dics): $$\vec r_G=(b\sin\theta+a\sin\phi)\vec
i+(b\cos\theta+a\cos\phi)\vec j$$
This is all I've done for now. I would appreciate some help and hints for
position vector of the point $G$ and forces acting here.
A pendulum consists of a light inextensible rod $OA$, length $b$, freely
pivoted at $O$, attached at $A$ to the rim of a uniform disc of radius $a$
and mass $m$. The disc is free to rotate about $A$. The system moves in a
vertical plane containing $O$.
Can you help me to set Lagrangian?
I found that
$$\vec r_A=b\sin\theta\vec i+b\cos\theta\vec j$$
$$\dot{\vec r_A}=b\dot\theta\cos\theta\vec i-b\dot\theta\sin\theta\vec j$$
I am not sure if this is correct for point $G$ ($G$ is center of mass of a
dics): $$\vec r_G=(b\sin\theta+a\sin\phi)\vec
i+(b\cos\theta+a\cos\phi)\vec j$$
This is all I've done for now. I would appreciate some help and hints for
position vector of the point $G$ and forces acting here.
MySQL Legacy Code using CURRENT_DATE with inaccuracies
MySQL Legacy Code using CURRENT_DATE with inaccuracies
Just inherited a bug-filled site with some issues with dates and when
things appear/disappear.
There is a lot of SQL statements using CURRENT_DATE and I believe this
could be a possible issue.
Is anyone else aware of any inaccuracies in performance using CURRENT_DATE
over, say a PHP-derived date string eg date('Y-m-d H:j',time())
Just inherited a bug-filled site with some issues with dates and when
things appear/disappear.
There is a lot of SQL statements using CURRENT_DATE and I believe this
could be a possible issue.
Is anyone else aware of any inaccuracies in performance using CURRENT_DATE
over, say a PHP-derived date string eg date('Y-m-d H:j',time())
Wednesday, 21 August 2013
Increase primary-key column size having numerous dependencies
Increase primary-key column size having numerous dependencies
Scenario: I have a table (Customer). It has composite key out of which one
is "Relationship_num" which has a size varchar(30).There is ample data in
it. And 21 dependent tables.
Problem: Inserting a record which has relationship_num greater than the
size of the column. So now i want to increase its size.
Unsuccessful Work around: When I made an attempt to alter the size, it
displays error: The object 'PK_CUSTOMER' is dependent on column
'RELATIONSHIP_NUM'.And 21 other errors of those tables which has the
dependency on Customer table.
Then I tried to drop 'PK_CUSTOMER':
ALTER TABLE [dbo].[CUSTOMER] DROP CONSTRAINT [PK_CUSTOMER]
which resulted in following error:
The constraint 'PK_CUSTOMER' is being referenced by table 'some-table',
foreign key constraint 'RefCUSTOMER447'.Could not drop constraint. See
previous errors.
Now making scripts(create and drop) of all these constraints could me
cumbersome.
Plz help me out with this!
Scenario: I have a table (Customer). It has composite key out of which one
is "Relationship_num" which has a size varchar(30).There is ample data in
it. And 21 dependent tables.
Problem: Inserting a record which has relationship_num greater than the
size of the column. So now i want to increase its size.
Unsuccessful Work around: When I made an attempt to alter the size, it
displays error: The object 'PK_CUSTOMER' is dependent on column
'RELATIONSHIP_NUM'.And 21 other errors of those tables which has the
dependency on Customer table.
Then I tried to drop 'PK_CUSTOMER':
ALTER TABLE [dbo].[CUSTOMER] DROP CONSTRAINT [PK_CUSTOMER]
which resulted in following error:
The constraint 'PK_CUSTOMER' is being referenced by table 'some-table',
foreign key constraint 'RefCUSTOMER447'.Could not drop constraint. See
previous errors.
Now making scripts(create and drop) of all these constraints could me
cumbersome.
Plz help me out with this!
Empty an ArrayList or just create a new one and let the old one be garbage collected?
Empty an ArrayList or just create a new one and let the old one be garbage
collected?
What are the advantages and disadvantages of emptying a collection (in my
case its an ArrayList) vs creating a new one (and letting the garbage
collector clear the old one).
Specifically, I have an ArrayList<Rectangle> called list. When a certain
condition occurs, I need to empty list and refill it with other contents.
Should I call list.clear() or just make a new ArrayList<Rectangle> and let
the old one be garbage collected? What are the pros and cons of each
approach?
collected?
What are the advantages and disadvantages of emptying a collection (in my
case its an ArrayList) vs creating a new one (and letting the garbage
collector clear the old one).
Specifically, I have an ArrayList<Rectangle> called list. When a certain
condition occurs, I need to empty list and refill it with other contents.
Should I call list.clear() or just make a new ArrayList<Rectangle> and let
the old one be garbage collected? What are the pros and cons of each
approach?
How can I share `c:\program files`?
How can I share `c:\program files`?
actually, it is c:\Program Files (x86)\Vim. I want to store my vim configs
into this folder and broadcast it on lan. I've given Everyone read access
and Administrator read/write/delete(or whatever that 3 permissions were)
access. currently it is on share list and I can see this from thunar file
manager but I can't mount this folder. It says I have no permission - even
though I'm logging in with Administrator credentials. How can I share this
folder?
actually, it is c:\Program Files (x86)\Vim. I want to store my vim configs
into this folder and broadcast it on lan. I've given Everyone read access
and Administrator read/write/delete(or whatever that 3 permissions were)
access. currently it is on share list and I can see this from thunar file
manager but I can't mount this folder. It says I have no permission - even
though I'm logging in with Administrator credentials. How can I share this
folder?
CreateProcess STATUS_DLL_NOT_FOUND - which dll?
CreateProcess STATUS_DLL_NOT_FOUND - which dll?
I have a process which calls CreateProcess. It appears that CreateProcess
returns 0 indicating success. However, the HANDLE to the process then gets
immediately set, indicating the process has exited. When I call
GetExitCodeProcess, STATUS_DLL_NOT_FOUND is then returned.
I understand that a DLL is missing. I even know exactly which one.
However, what I don't understand is how to figure that out
programmatically.
I noticed that Windows will present a dialog saying that the process
failed to start because it couldn't find the specified DLL (screenshot:
http://www.mediafire.com/view/?kd9ddq0e2dlvlb9 ). In the dialog, Windows
specifies which DLL is missing. However, I find no way to get that
information myself programmatically.
If a process fails to start and would return STATUS_DLL_NOT_FOUND, how do
I programmatically retrieve the library name to which the target process
was linked which couldn't be found? That way I can automatically record in
an error report what DLL appears to be missing or corrupt in a given
installation.
I have a process which calls CreateProcess. It appears that CreateProcess
returns 0 indicating success. However, the HANDLE to the process then gets
immediately set, indicating the process has exited. When I call
GetExitCodeProcess, STATUS_DLL_NOT_FOUND is then returned.
I understand that a DLL is missing. I even know exactly which one.
However, what I don't understand is how to figure that out
programmatically.
I noticed that Windows will present a dialog saying that the process
failed to start because it couldn't find the specified DLL (screenshot:
http://www.mediafire.com/view/?kd9ddq0e2dlvlb9 ). In the dialog, Windows
specifies which DLL is missing. However, I find no way to get that
information myself programmatically.
If a process fails to start and would return STATUS_DLL_NOT_FOUND, how do
I programmatically retrieve the library name to which the target process
was linked which couldn't be found? That way I can automatically record in
an error report what DLL appears to be missing or corrupt in a given
installation.
Subscribe to:
Comments (Atom)