fabric.js color of lines of SVG
I use fabric.js to draw a path on a map, and I wanna to change color of
the path when cursor is not hovering over it. But it seems to ignore
"stroke" parameter of the GroupPath element that's created using SVG file.
I can change fill color, though it's just filling space in between lines
and looks horrible. How can i change color of lines themselves?
fabric.loadSVGFromURL('somesvg.svg', function(objects, options) {
options.fill = 'red'; // this works
options.stroke = 'green'; // this does not
var group = new fabric.PathGroup(objects, options);
canvas.add(group);
canvas.renderAll();
});
Thursday, 3 October 2013
Wednesday, 2 October 2013
AHK utilman script gives file not found error
AHK utilman script gives file not found error
I'm trying to create a simple backdoor for myself through utilman on my
computer using autohotkey. Basically I want to have the ease of access
button function normally in all cases on login screen Except when I hold
down the M key, where in this case it opens cmd instead. No batch or cmd
window should pop up, and one doesn't. The issue I'm having is that I get
a file not found error from the script, I compiled the script into
Utilman.exe and tested with a copy of the real utilman (renamed to lol.exe
which is specified in the script to run normally) and this works fine in
its own directory. However when I do this in the system32 folder it gives
an error that lol.exe is not found, also executing lol.exe on it's own
gives the exact same error, as if it reroutes to the script named Utilman
yet again. Here is the script, should be short and simple:
SetWorkingDir %A_ScriptDir%
Sleep 400
GetKeyState, state, m
if state = D
Run cmd.exe
else
Run lol.exe
Sleep 200
ExitApp
Thanks for any pointers, alternative suggestions or ideas. This would be
great to get working.
EDIT: Changing Run lol.exe to Run, "C:\Windows\System32\lol.exe" now gives
instead an exe corrupted error. This also happens if I run lol.exe on it's
own, I'm really not sure what's happening.
I'm trying to create a simple backdoor for myself through utilman on my
computer using autohotkey. Basically I want to have the ease of access
button function normally in all cases on login screen Except when I hold
down the M key, where in this case it opens cmd instead. No batch or cmd
window should pop up, and one doesn't. The issue I'm having is that I get
a file not found error from the script, I compiled the script into
Utilman.exe and tested with a copy of the real utilman (renamed to lol.exe
which is specified in the script to run normally) and this works fine in
its own directory. However when I do this in the system32 folder it gives
an error that lol.exe is not found, also executing lol.exe on it's own
gives the exact same error, as if it reroutes to the script named Utilman
yet again. Here is the script, should be short and simple:
SetWorkingDir %A_ScriptDir%
Sleep 400
GetKeyState, state, m
if state = D
Run cmd.exe
else
Run lol.exe
Sleep 200
ExitApp
Thanks for any pointers, alternative suggestions or ideas. This would be
great to get working.
EDIT: Changing Run lol.exe to Run, "C:\Windows\System32\lol.exe" now gives
instead an exe corrupted error. This also happens if I run lol.exe on it's
own, I'm really not sure what's happening.
Webservice(asmx) returns array, not list
Webservice(asmx) returns array, not list
I have a deserialization webmethod which returns a list of data in
webservice(asmx), and I am calling the method from client-side. However,
the method is giving me an array, not a list. I understand that it is
because of SOAP response which returns xml format (or something like
that..)
Is it possible to return a list? If then, please tell me an idea.
If not, please teach me an alternative way. (I should not use array...)
service.asmx.cs
[WebMethod]
public IList<Person> DeserializeJson(string value)
{
JavaScriptSerializer js = new JavaScriptSerializer();
IList<Person> tableData = js.Deserialize<IList<Person>>(value);
return tableData;
}
Client.aspx.cs (WebService is my service reference)
WebService.Service1SoapClient client = new WebService.Service1SoapClient();
string stream = client.CreateJsonFromDatabase();
List<WebService.Person> tableData = client.DeserializeJson(stream);
I have a deserialization webmethod which returns a list of data in
webservice(asmx), and I am calling the method from client-side. However,
the method is giving me an array, not a list. I understand that it is
because of SOAP response which returns xml format (or something like
that..)
Is it possible to return a list? If then, please tell me an idea.
If not, please teach me an alternative way. (I should not use array...)
service.asmx.cs
[WebMethod]
public IList<Person> DeserializeJson(string value)
{
JavaScriptSerializer js = new JavaScriptSerializer();
IList<Person> tableData = js.Deserialize<IList<Person>>(value);
return tableData;
}
Client.aspx.cs (WebService is my service reference)
WebService.Service1SoapClient client = new WebService.Service1SoapClient();
string stream = client.CreateJsonFromDatabase();
List<WebService.Person> tableData = client.DeserializeJson(stream);
Disable home_url rewrite with WPML plugin
Disable home_url rewrite with WPML plugin
I'm using the WPML Wordpress plugin to translate my website. My default
language is French. When I'm in a translated page, the home_url() is
rewrite with the current language. How can I disable this rewrite so my
home_url() always redirect to the french homepage?
Translate page url : http://www.mydomain.com/en/test/
Actual home_url() : http://www.mydomain.com/en/
Desired home_url() : http://www.mydomain.com/
I've already tried these solutions :
http://wpml.org/forums/topic/wpml-overwrites-home_url-to-append-language-suffix/
http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/home-page-link/
http://wpml.org/forums/topic/wpml-changed-my-default-home-url/
Sorry for my poor english and thanks for the help! Let me know if I need
to provide any other information.
I'm using the WPML Wordpress plugin to translate my website. My default
language is French. When I'm in a translated page, the home_url() is
rewrite with the current language. How can I disable this rewrite so my
home_url() always redirect to the french homepage?
Translate page url : http://www.mydomain.com/en/test/
Actual home_url() : http://www.mydomain.com/en/
Desired home_url() : http://www.mydomain.com/
I've already tried these solutions :
http://wpml.org/forums/topic/wpml-overwrites-home_url-to-append-language-suffix/
http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/home-page-link/
http://wpml.org/forums/topic/wpml-changed-my-default-home-url/
Sorry for my poor english and thanks for the help! Let me know if I need
to provide any other information.
How to make a concept and idea for a website without coding, with animations
How to make a concept and idea for a website without coding, with animations
I have one client he want to make his company's website for which he has
approached us, but the problem is he only want the concept and the
skeleton(innovative idea) from us depending upon which he will then pass
that idea to his developers. Me and my team has tried our best and
presented our innovative idea via power point presentation. But the client
is not at all impressed. He want something which seems live, (like
Shapellhomes.com). My question is how to make a skeleton and idea for a
website(without coding) which include little animation and various
effects. Is there any ready-made tool available to create a skeleton of a
website. please guys help me, because i dnt want to loose this client.
I have one client he want to make his company's website for which he has
approached us, but the problem is he only want the concept and the
skeleton(innovative idea) from us depending upon which he will then pass
that idea to his developers. Me and my team has tried our best and
presented our innovative idea via power point presentation. But the client
is not at all impressed. He want something which seems live, (like
Shapellhomes.com). My question is how to make a skeleton and idea for a
website(without coding) which include little animation and various
effects. Is there any ready-made tool available to create a skeleton of a
website. please guys help me, because i dnt want to loose this client.
Tuesday, 1 October 2013
basic integer swap with pointers
basic integer swap with pointers
Im trying to swap a few integers using pointers and for some reason im not
fully understanding whats happening.
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
temp = *p2;
*p2 = *p1;
*p1 = temp;
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
The output im getting is: x: 0 y: 99 x: 0 y: 0
Thanks
Edit: Thats what i believe is the problematic area. The code in its
entirety is a series of pointer tasks.
#include <iostream>
using namespace std;
void swap(int *x, int *y);
void noNegatives(int *x);
int main ()
{
int x,y,temp;
int *p1, *p2;
p1 = &x;
*p1 = 99;
cout << "x: " << x << endl;
cout << "p1: " << *p1 << endl;
p1 = &y;
*p1 = -300;
p2 = &x;
temp = *p1;
*p1 = *p2;
*p2 = temp;
noNegatives(&x);
noNegatives(&y);
p2=&x;
cout<< "x: "<<*p2<<endl;
p2=&y;
cout<< "y: "<<*p2<<endl;
int a[1];
p2 = &a[0];
*p2 = x;
cout << "First Element: " << p2<< endl;
p2 = &a[1];
*p2 = y;
cout << "Second Element: " << p2<< endl;
p1 = &a[0];
p2 = &a[1];
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
temp = *p2;
*p2 = *p1;
*p1 = temp;
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
cout << "First Element: " << a[0]<< endl;
cout << "Second Element: " << a[1]<< endl;
swap(&x,&y);
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
swap(&a[0], &a[1]);
cout<< "a[0]: " << a[0] <<endl;
cout<< "a[1]: " << a[1] <<endl;
}
void noNegatives(int *x)
{
if(*x<0)
*x=0;
}
void swap(int *p1, int *p2)
{
int temp;
temp = *p1;
*p1 = *p2;
*p2 = temp;
}
my goal is for the last x and y to be x: 99 and y: 0. Everything else
works as it should.
oh my god nevermind it was the array. Thank you so much for catching that
bonehead error.
Im trying to swap a few integers using pointers and for some reason im not
fully understanding whats happening.
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
temp = *p2;
*p2 = *p1;
*p1 = temp;
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
The output im getting is: x: 0 y: 99 x: 0 y: 0
Thanks
Edit: Thats what i believe is the problematic area. The code in its
entirety is a series of pointer tasks.
#include <iostream>
using namespace std;
void swap(int *x, int *y);
void noNegatives(int *x);
int main ()
{
int x,y,temp;
int *p1, *p2;
p1 = &x;
*p1 = 99;
cout << "x: " << x << endl;
cout << "p1: " << *p1 << endl;
p1 = &y;
*p1 = -300;
p2 = &x;
temp = *p1;
*p1 = *p2;
*p2 = temp;
noNegatives(&x);
noNegatives(&y);
p2=&x;
cout<< "x: "<<*p2<<endl;
p2=&y;
cout<< "y: "<<*p2<<endl;
int a[1];
p2 = &a[0];
*p2 = x;
cout << "First Element: " << p2<< endl;
p2 = &a[1];
*p2 = y;
cout << "Second Element: " << p2<< endl;
p1 = &a[0];
p2 = &a[1];
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
temp = *p2;
*p2 = *p1;
*p1 = temp;
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
cout << "First Element: " << a[0]<< endl;
cout << "Second Element: " << a[1]<< endl;
swap(&x,&y);
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
swap(&a[0], &a[1]);
cout<< "a[0]: " << a[0] <<endl;
cout<< "a[1]: " << a[1] <<endl;
}
void noNegatives(int *x)
{
if(*x<0)
*x=0;
}
void swap(int *p1, int *p2)
{
int temp;
temp = *p1;
*p1 = *p2;
*p2 = temp;
}
my goal is for the last x and y to be x: 99 and y: 0. Everything else
works as it should.
oh my god nevermind it was the array. Thank you so much for catching that
bonehead error.
How to return the value of a key: function() in javascript
How to return the value of a key: function() in javascript
Here is what I have inside a backbone model:
defaults: {
prayer_string: function (){
var label_val = $("#prayer_type_label").val();
console.log("Prayer_string returning: ", label_val);
return label_val;
}
}
But when I access the model like so:
var prayerString = model.prayer_string;
prayerString is the function and not the return label_val.
What do I need to do to get the return value of the function instead of
the function itself?
Thanks,
Andrew
Here is what I have inside a backbone model:
defaults: {
prayer_string: function (){
var label_val = $("#prayer_type_label").val();
console.log("Prayer_string returning: ", label_val);
return label_val;
}
}
But when I access the model like so:
var prayerString = model.prayer_string;
prayerString is the function and not the return label_val.
What do I need to do to get the return value of the function instead of
the function itself?
Thanks,
Andrew
How to properly downgrade PHP 5.5 to 5.3 on Centos 6.4
How to properly downgrade PHP 5.5 to 5.3 on Centos 6.4
I installed Centos_6.4 and have about 2 weeks work into setting up my
environment and servers on it. So I get to my Kayako support suite and it
wont install and they say I have to use PHP 5.3
I have searched for hours and tried every suggestion could find and at the
end of all attempts PHpstill shows 5.5 and Im stumped. How do I downgrade
PHP 5.5 to 5.3 on CentOS 6.4 64bit server
I installed Centos_6.4 and have about 2 weeks work into setting up my
environment and servers on it. So I get to my Kayako support suite and it
wont install and they say I have to use PHP 5.3
I have searched for hours and tried every suggestion could find and at the
end of all attempts PHpstill shows 5.5 and Im stumped. How do I downgrade
PHP 5.5 to 5.3 on CentOS 6.4 64bit server
Does Êý¶À{¤¹¤¦¤É¤¯} really mean "single number=?iso-8859-1?Q?=22=3F_=A8C_japanese.stackexchange.com?=
Does Êý¶À{¤¹¤¦¤É¤¯} really mean "single number"? ¨C
japanese.stackexchange.com
I've never actually played a sudoku puzzle (I know, I live in a cave!). I
just saw the word written in kanji somewhere, which rekindled my interest.
Wikipedia states: The puzzle was popularized ¡
japanese.stackexchange.com
I've never actually played a sudoku puzzle (I know, I live in a cave!). I
just saw the word written in kanji somewhere, which rekindled my interest.
Wikipedia states: The puzzle was popularized ¡
Monday, 30 September 2013
Can we find a subset of $Spec(R)$ not quasi-compact?
Can we find a subset of $Spec(R)$ not quasi-compact?
If $R$ is a commutative ring with unit, we can easy prove that $Spec(R)$
is quasi-compact. However can you give me an example of $R$ such that a
subset $A \subset Spec(R)$ isn't quasi-compact?
If $R$ is a commutative ring with unit, we can easy prove that $Spec(R)$
is quasi-compact. However can you give me an example of $R$ such that a
subset $A \subset Spec(R)$ isn't quasi-compact?
How to type left/right quotes in mathmode=?iso-8859-1?Q?=3F_=96_tex.stackexchange.com?=
How to type left/right quotes in mathmode? – tex.stackexchange.com
I want to type "left-quotes" and "right-quotes" in an equation. I tried
$P(x):`` \forall x \in \mathbb{R}, \, x^2 > 4 \Rightarrow x > 2. ``$ I get
The end sign is not correct. How to ...
I want to type "left-quotes" and "right-quotes" in an equation. I tried
$P(x):`` \forall x \in \mathbb{R}, \, x^2 > 4 \Rightarrow x > 2. ``$ I get
The end sign is not correct. How to ...
Centering items using CSS
Centering items using CSS
I'm having trouble centering things, I've tried table cell and the line
height trick but can't get things to work.
Here's my HTML
<li class="image-item gallery-image-item">
<i class="icon-remove"></i>
<i class="btn-comment icon-comment"></i>
<i class="btn-youtube icon-youtube-play"></i>
</li>
I'm trying to get icon-remove to sit top right in the li.
btn-comment and btn-youtube should be centered in the li, vertically and
horizontally.
The problem I am having is that the icon-remove icon is causing the
centering of the other two items to shift.
I'm having trouble centering things, I've tried table cell and the line
height trick but can't get things to work.
Here's my HTML
<li class="image-item gallery-image-item">
<i class="icon-remove"></i>
<i class="btn-comment icon-comment"></i>
<i class="btn-youtube icon-youtube-play"></i>
</li>
I'm trying to get icon-remove to sit top right in the li.
btn-comment and btn-youtube should be centered in the li, vertically and
horizontally.
The problem I am having is that the icon-remove icon is causing the
centering of the other two items to shift.
How to remove items from the CheckListBox (windows application) from another thread?
How to remove items from the CheckListBox (windows application) from
another thread?
I am developing a windows app in which i need to add items in the
checklist-box at run-time from the separate thread, for that i used :
if (chkLBClientsList.InvokeRequired)
chkLBClientsList.Invoke(new
MethodInvoker(delegate{chkLBClientsList.Items.Add(GetHostNameByIpAddress(ipAddress));}));
later in the application i need to remove the items from the checklist-box
and for that i am using same logic :
if (chkLBClientsList.InvokeRequired)
chkLBClientsList.Invoke(new MethodInvoker(delegate {
chkLBClientsList.Items.Remove(GetHostNameByIpAddress(GetIpAddress(client)));
}));
but it's not working....because this statement
chkLBClientsList.InvokeRequired returns FALSE value.
Please tell me how to solve this problem ? Thanks in advance.
another thread?
I am developing a windows app in which i need to add items in the
checklist-box at run-time from the separate thread, for that i used :
if (chkLBClientsList.InvokeRequired)
chkLBClientsList.Invoke(new
MethodInvoker(delegate{chkLBClientsList.Items.Add(GetHostNameByIpAddress(ipAddress));}));
later in the application i need to remove the items from the checklist-box
and for that i am using same logic :
if (chkLBClientsList.InvokeRequired)
chkLBClientsList.Invoke(new MethodInvoker(delegate {
chkLBClientsList.Items.Remove(GetHostNameByIpAddress(GetIpAddress(client)));
}));
but it's not working....because this statement
chkLBClientsList.InvokeRequired returns FALSE value.
Please tell me how to solve this problem ? Thanks in advance.
Sunday, 29 September 2013
im trying to change the date format when im display the result
im trying to change the date format when im display the result
In the database, date format is Y-m-d, im trying to display my result with
this format d-m-Y .. this is my code
<input name="personal_ic_from" type="text" class="tcal"
id="personal_ic_from" value="<?php echo $personal_ic_from?>"
readonly="readonly"/> ... help me please...
In the database, date format is Y-m-d, im trying to display my result with
this format d-m-Y .. this is my code
<input name="personal_ic_from" type="text" class="tcal"
id="personal_ic_from" value="<?php echo $personal_ic_from?>"
readonly="readonly"/> ... help me please...
Need to join two tables, in sql server
Need to join two tables, in sql server
I need to join two tables, table1 has 1000 rows which has the identity
number set to ID column, similarly I have another table with 1000 rows and
it also has a ID column with identity number set to it, so now when I join
this two tables after 1000 rows of 1st table the number should start from
1001 and so on from table 2. How can I do tat, can you please help me out
in this.
I need to join two tables, table1 has 1000 rows which has the identity
number set to ID column, similarly I have another table with 1000 rows and
it also has a ID column with identity number set to it, so now when I join
this two tables after 1000 rows of 1st table the number should start from
1001 and so on from table 2. How can I do tat, can you please help me out
in this.
Shadow in Navigation Drawer
Shadow in Navigation Drawer
I'm trying to make a sidebar in Google Music. I have everything worked
out, but I can not figure out how to make the blackout. My program:
Google Music: My code:
public class StartActivity extends Activity {
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private ActionBarDrawerToggle mDrawerToggle;
private CharSequence mDrawerTitle;
private CharSequence mTitle;
private String[] mPlanetTitles;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.drawer_main);
mTitle = mDrawerTitle = getTitle();
mPlanetTitles = getResources().getStringArray(R.array.drawer_names);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
GravityCompat.START);
mDrawerList.setAdapter(new ArrayAdapter<String>(this,
R.layout.test_drawer_item, mPlanetTitles));
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
R.drawable.ic_drawer_white,
R.string.drawer_open,
R.string.drawer_close
) {
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
invalidateOptionsMenu(); // creates call to
onPrepareOptionsMenu()
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu(); // creates call to
onPrepareOptionsMenu()
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
private class DrawerItemClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView parent, View view, int
position,long id) {
switch(position) {
case 0:
Intent a = new Intent(StartActivity.this,
AlgebraTheoryActivity.class);
startActivity(a);
break;
case 1:
Intent b = new Intent(StartActivity.this, Calculator.class);
startActivity(b);
break;
case 2:
Intent c = new Intent(StartActivity.this,
SettingsActivity.class);
startActivity(c);
break;
case 3:
Intent d = new Intent(StartActivity.this,
AboutActivity.class);
startActivity(d);
break;
default:
}
}
}
@Override
public void setTitle(CharSequence title) {
mTitle = title;
getActionBar().setTitle(mTitle);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
I need some help with this.
I'm trying to make a sidebar in Google Music. I have everything worked
out, but I can not figure out how to make the blackout. My program:
Google Music: My code:
public class StartActivity extends Activity {
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private ActionBarDrawerToggle mDrawerToggle;
private CharSequence mDrawerTitle;
private CharSequence mTitle;
private String[] mPlanetTitles;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.drawer_main);
mTitle = mDrawerTitle = getTitle();
mPlanetTitles = getResources().getStringArray(R.array.drawer_names);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
GravityCompat.START);
mDrawerList.setAdapter(new ArrayAdapter<String>(this,
R.layout.test_drawer_item, mPlanetTitles));
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
R.drawable.ic_drawer_white,
R.string.drawer_open,
R.string.drawer_close
) {
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
invalidateOptionsMenu(); // creates call to
onPrepareOptionsMenu()
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu(); // creates call to
onPrepareOptionsMenu()
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
private class DrawerItemClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView parent, View view, int
position,long id) {
switch(position) {
case 0:
Intent a = new Intent(StartActivity.this,
AlgebraTheoryActivity.class);
startActivity(a);
break;
case 1:
Intent b = new Intent(StartActivity.this, Calculator.class);
startActivity(b);
break;
case 2:
Intent c = new Intent(StartActivity.this,
SettingsActivity.class);
startActivity(c);
break;
case 3:
Intent d = new Intent(StartActivity.this,
AboutActivity.class);
startActivity(d);
break;
default:
}
}
}
@Override
public void setTitle(CharSequence title) {
mTitle = title;
getActionBar().setTitle(mTitle);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
I need some help with this.
how to detect if imported webfont has http error?
how to detect if imported webfont has http error?
I am importing webfonts in css files using @font-face
looking for a way to track http errors that may block fonts from loading,
such as 500 errors due to firewalls.
How can I detect such an event using Javascript?
I am importing webfonts in css files using @font-face
looking for a way to track http errors that may block fonts from loading,
such as 500 errors due to firewalls.
How can I detect such an event using Javascript?
Saturday, 28 September 2013
why shear argument in cvinitfont() function does not work?
why shear argument in cvinitfont() function does not work?
IplImage *Image=cvLoadImage("ABC.jpg");
CvFont Font1;
cvInitFont(&Font1,CV_FONT_HERSHEY_COMPLEX,1,1,0.0f,2);
// when i set shear argument to 0.0f , i did not get any effect
CvFont Font2;
cvInitFont(&Font2,CV_FONT_HERSHEY_COMPLEX,1,1,1.0f,2);
// also whean shear arrgument equal 1.0f , i did not get any effect
cvPutText(Image,"Hello World",cvPoint(50,50),&Font1,cvScalar(255));
cvPutText(Image,"Hello World",cvPoint(200,50),&Font2,cvScalar(255));
cvNamedWindow("0",0);
cvShowImage("0",Image);
cvWaitKey(0);
IplImage *Image=cvLoadImage("ABC.jpg");
CvFont Font1;
cvInitFont(&Font1,CV_FONT_HERSHEY_COMPLEX,1,1,0.0f,2);
// when i set shear argument to 0.0f , i did not get any effect
CvFont Font2;
cvInitFont(&Font2,CV_FONT_HERSHEY_COMPLEX,1,1,1.0f,2);
// also whean shear arrgument equal 1.0f , i did not get any effect
cvPutText(Image,"Hello World",cvPoint(50,50),&Font1,cvScalar(255));
cvPutText(Image,"Hello World",cvPoint(200,50),&Font2,cvScalar(255));
cvNamedWindow("0",0);
cvShowImage("0",Image);
cvWaitKey(0);
Google Wallet user initiated cancellation failing without calling postback
Google Wallet user initiated cancellation failing without calling postback
I've gotten a subscription product working fine with Google's Wallet for
Digital Goods, but I can't make user's cancelling their orders work
correctly. If I cancel for them via the merchant center, it works just
fine (I get the postback with the orderId as expected). If the user tries
to cancel (and this is the same in the sandbox and in production), they
see the "Are you sure you want to cancel" dialog, and when they say "yes"
it immediately fails. There is simply no delay there.
From everything I've looked at I'm not getting a postback at all in this
case (and I'm handling the postback fine when we cancel from the merchant
center). I've looked through the logs on our web server, as well as
instrumented the postback handler, and it seems to be failing before it
ever gets to my code.
Help?
Erik
I've gotten a subscription product working fine with Google's Wallet for
Digital Goods, but I can't make user's cancelling their orders work
correctly. If I cancel for them via the merchant center, it works just
fine (I get the postback with the orderId as expected). If the user tries
to cancel (and this is the same in the sandbox and in production), they
see the "Are you sure you want to cancel" dialog, and when they say "yes"
it immediately fails. There is simply no delay there.
From everything I've looked at I'm not getting a postback at all in this
case (and I'm handling the postback fine when we cancel from the merchant
center). I've looked through the logs on our web server, as well as
instrumented the postback handler, and it seems to be failing before it
ever gets to my code.
Help?
Erik
Codeigniter User Session Error
Codeigniter User Session Error
I'm face a new Problem in Codeigniter Framework. Her is my Out put
Array
(
[id] => 2
[firstname] => Maruf
[lastname] => Ifftekhar
[slug] =>
[email] => support@russelhost.com
[email_subscribe] => 1
[self] =>
[phone] => 01767820010
[company] => Russel Host
[default_billing_address] =>
[default_shipping_address] =>
[ship_to_bill_address] => true
[password] => 0689d59aa30bdca7207db3d449255650
[active] => 1
[group_id] => 1
[confirmed] => 0
[group_discount_formula] => - 0
[expire] => 1380390903
)
Here is Controller
`$`email = `$`this->input->post('email');
`$`password = `$`this->input->post('password');
`$`remember = `$`this->input->post('remember');
`$`redirect = `$`this->input->post('redirect');
`$`login = `$`this->Customer_model->login(`$`email, `$`password,
`$`remember);
echo '/pre>-----';
print_r(`$`login);
echo 'abida Sultana'.`$`login->last_name;
exit();
and Model is
function login(`$`email, `$`password, `$`remember = false) {
`$`this->db->select('*');
`$`this->db->where('email', `$`email);
`$`this->db->where('active', 1);
`$`this->db->where('password', md5(`$`password));
`$`this->db->limit(1);
`$`result = `$`this->db->get('customers');
`$`customer = `$`result->row_array();
if (`$`customer) {
// Retrieve customer addresses
`$`this->db->where(array('customer_id' => `$`customer['id'], 'id'
=> `$`customer['default_billing_address']));
`$`address = `$`this->db->get('customers_address_bank')->row_array();
if (`$`address) {
$fields = unserialize($address['field_data']);
$customer['bill_address'] = $fields;
$customer['bill_address']['id'] = $address['id']; // save the
addres id for future reference
}
$this->db->where(array('customer_id' => $customer['id'], 'id' =>
$customer['default_shipping_address']));
$address = $this->db->get('customers_address_bank')->row_array();
if ($address) {
$fields = unserialize($address['field_data']);
$customer['ship_address'] = $fields;
$customer['ship_address']['id'] = $address['id'];
} else {
$customer['ship_to_bill_address'] = 'true';
}
// Set up any group discount
if ($customer['group_id'] != 0) {
$group = $this->get_group($customer['group_id']);
if ($group) { // group might not exist
if ($group->discount_type == "fixed") {
$customer['group_discount_formula'] = "- " .
$group->discount;
} else {
$percent = (100 - (float) $group->discount) / 100;
$customer['group_discount_formula'] = '* (' . $percent
. ')';
}
}
}
if (!$remember) {
$customer['expire'] = time() + $this->session_expire;
} else {
$customer['expire'] = false;
}
// put our customer in the cart
$this->go_cart->save_customer($customer);
return $customer;
} else {
return false;
}
}
I'm face a new Problem in Codeigniter Framework. Her is my Out put
Array
(
[id] => 2
[firstname] => Maruf
[lastname] => Ifftekhar
[slug] =>
[email] => support@russelhost.com
[email_subscribe] => 1
[self] =>
[phone] => 01767820010
[company] => Russel Host
[default_billing_address] =>
[default_shipping_address] =>
[ship_to_bill_address] => true
[password] => 0689d59aa30bdca7207db3d449255650
[active] => 1
[group_id] => 1
[confirmed] => 0
[group_discount_formula] => - 0
[expire] => 1380390903
)
Here is Controller
`$`email = `$`this->input->post('email');
`$`password = `$`this->input->post('password');
`$`remember = `$`this->input->post('remember');
`$`redirect = `$`this->input->post('redirect');
`$`login = `$`this->Customer_model->login(`$`email, `$`password,
`$`remember);
echo '/pre>-----';
print_r(`$`login);
echo 'abida Sultana'.`$`login->last_name;
exit();
and Model is
function login(`$`email, `$`password, `$`remember = false) {
`$`this->db->select('*');
`$`this->db->where('email', `$`email);
`$`this->db->where('active', 1);
`$`this->db->where('password', md5(`$`password));
`$`this->db->limit(1);
`$`result = `$`this->db->get('customers');
`$`customer = `$`result->row_array();
if (`$`customer) {
// Retrieve customer addresses
`$`this->db->where(array('customer_id' => `$`customer['id'], 'id'
=> `$`customer['default_billing_address']));
`$`address = `$`this->db->get('customers_address_bank')->row_array();
if (`$`address) {
$fields = unserialize($address['field_data']);
$customer['bill_address'] = $fields;
$customer['bill_address']['id'] = $address['id']; // save the
addres id for future reference
}
$this->db->where(array('customer_id' => $customer['id'], 'id' =>
$customer['default_shipping_address']));
$address = $this->db->get('customers_address_bank')->row_array();
if ($address) {
$fields = unserialize($address['field_data']);
$customer['ship_address'] = $fields;
$customer['ship_address']['id'] = $address['id'];
} else {
$customer['ship_to_bill_address'] = 'true';
}
// Set up any group discount
if ($customer['group_id'] != 0) {
$group = $this->get_group($customer['group_id']);
if ($group) { // group might not exist
if ($group->discount_type == "fixed") {
$customer['group_discount_formula'] = "- " .
$group->discount;
} else {
$percent = (100 - (float) $group->discount) / 100;
$customer['group_discount_formula'] = '* (' . $percent
. ')';
}
}
}
if (!$remember) {
$customer['expire'] = time() + $this->session_expire;
} else {
$customer['expire'] = false;
}
// put our customer in the cart
$this->go_cart->save_customer($customer);
return $customer;
} else {
return false;
}
}
How to extract the perticular column data from as
How to extract the perticular column data from as
I have a .csv file in the following format:
ID1 ID2 city Country AR xyz Tokyo Japan AR New York USA AR abc Vienna Austria
I want to extract the third column data from the file using regular
expression in python: output:
Tokyo New York Vienna
I have a .csv file in the following format:
ID1 ID2 city Country AR xyz Tokyo Japan AR New York USA AR abc Vienna Austria
I want to extract the third column data from the file using regular
expression in python: output:
Tokyo New York Vienna
Friday, 27 September 2013
How to remove rows from csv based on matching data
How to remove rows from csv based on matching data
I have a large list of data in csv format which I need to remove rows
from, based on matching two parameters.
my list of data to be removed would appear as follows:
London,James Smith
London,John Oliver
London,John-Smith-Harrison
Paris,Hermione
Paris,Trevor Wilson
New York City,Charlie Chaplin
New York City,Ned Stark
New York City,Thoma' Becket
New York City,Ryan-Dover
Then the main csv would remove a row based on matching the city name with
the second column as well as matching the name with a name in the 9th
column.
If both matched were achieved, delete the row in the main csv (note this
csv hasn't been provided an example here).
Many thanks in advance, AEA
I have a large list of data in csv format which I need to remove rows
from, based on matching two parameters.
my list of data to be removed would appear as follows:
London,James Smith
London,John Oliver
London,John-Smith-Harrison
Paris,Hermione
Paris,Trevor Wilson
New York City,Charlie Chaplin
New York City,Ned Stark
New York City,Thoma' Becket
New York City,Ryan-Dover
Then the main csv would remove a row based on matching the city name with
the second column as well as matching the name with a name in the 9th
column.
If both matched were achieved, delete the row in the main csv (note this
csv hasn't been provided an example here).
Many thanks in advance, AEA
Python CSV parsing not returning proper rows
Python CSV parsing not returning proper rows
I'm new to python and having issues with the CSV parser. Here is the code:
import urllib2
import csv
u =
urllib2.urlopen(r'http://finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&f=nab')
data = u.read()
reader = csv.reader(data)
for row in reader:
print row
Yahoo returns this raw csv:
"Apple Inc.",482.09,482.00
"Google Inc.",877.20,876.94
"Microsoft Corpora",33.34,33.33
I want to parse this and create a simple JSON object with 3 fields:
Ticker, Bid, Offer
But the data comes in from that csv.reader() like so:
['Apple Inc.'] ['', ''] ['4'] ['8'] ['2'] ['.'] ['5'] ['5'] ['', ''] ['4']
['8'] ['2'] ['.'] ['4'] ['8'] [] [] ['Google Inc.'] ['', ''] ['8'] ['7']
['6'] ['.'] ['2'] ['4'] ['', ''] ['8'] ['7'] ['6'] ['.'] ['1'] ['0'] [] []
['Microsoft Corpora'] ['', ''] ['3'] ['3'] ['.'] ['2'] ['9'] ['', '']
['3'] ['3'] ['.'] ['2'] ['8'] [] []
It seems to be breaking the rows on each number. Any ideas as to what I'm
doing wrong here?
I'm new to python and having issues with the CSV parser. Here is the code:
import urllib2
import csv
u =
urllib2.urlopen(r'http://finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&f=nab')
data = u.read()
reader = csv.reader(data)
for row in reader:
print row
Yahoo returns this raw csv:
"Apple Inc.",482.09,482.00
"Google Inc.",877.20,876.94
"Microsoft Corpora",33.34,33.33
I want to parse this and create a simple JSON object with 3 fields:
Ticker, Bid, Offer
But the data comes in from that csv.reader() like so:
['Apple Inc.'] ['', ''] ['4'] ['8'] ['2'] ['.'] ['5'] ['5'] ['', ''] ['4']
['8'] ['2'] ['.'] ['4'] ['8'] [] [] ['Google Inc.'] ['', ''] ['8'] ['7']
['6'] ['.'] ['2'] ['4'] ['', ''] ['8'] ['7'] ['6'] ['.'] ['1'] ['0'] [] []
['Microsoft Corpora'] ['', ''] ['3'] ['3'] ['.'] ['2'] ['9'] ['', '']
['3'] ['3'] ['.'] ['2'] ['8'] [] []
It seems to be breaking the rows on each number. Any ideas as to what I'm
doing wrong here?
updating image in upload folder and image path in mysql
updating image in upload folder and image path in mysql
I am trying to update images in my upload folder and mysql database the
file uploads giving the file name 0.jpg instead of the normal persons id
13.jpg and does not update in mysql database, here is my snippet below
what am i doing wrong?
$pic = mysql_real_escape_string(htmlspecialchars($_FILES['photo']['name']));
//This gets all the other information from the form
$pic=($_FILES['photo']['name']);
$file = $_FILES['photo']['name']; // Get the name of the file (including
file extension). $ext = substr($file, strpos($file,'.'), strlen($file)-1);
if(!in_array($ext,$allowed_filetypes))//check if file type is allowed
die('The file extension you attempted to upload is not allowed.'); //not
allowed if(filesize($_FILES['photo']['tmp_name']) > $max_filesize) //check
that filesize is less than 50MB die ('The file you attempted to upload is
too large, compress it below 50MB.');
// Connects to your Database mysql_connect("localhost", "root", "") or
die(mysql_error()) ; mysql_select_db("office") or die(mysql_error()) ;
//Writes the information to the
$target = "images/" .mysql_insert_id() . $ext;
$staff_id = mysql_insert_id(); $new_file_name = mysql_insert_id() . $ext;
//I removed ,photo='$target' to display only id as picture name
mysql_query("UPDATE development SET photo='$new_file_name' WHERE
staff_id=$staff_id");
//Writes the file to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) {
//Tells you if its all ok echo "The file ". basename(
$_FILES['photo']['name']). " has been uploaded, and your information has
been added to the directory"; `} else {
//Gives and error if its not echo "Sorry, there was a problem uploading
your file."; } ?>
I am trying to update images in my upload folder and mysql database the
file uploads giving the file name 0.jpg instead of the normal persons id
13.jpg and does not update in mysql database, here is my snippet below
what am i doing wrong?
$pic = mysql_real_escape_string(htmlspecialchars($_FILES['photo']['name']));
//This gets all the other information from the form
$pic=($_FILES['photo']['name']);
$file = $_FILES['photo']['name']; // Get the name of the file (including
file extension). $ext = substr($file, strpos($file,'.'), strlen($file)-1);
if(!in_array($ext,$allowed_filetypes))//check if file type is allowed
die('The file extension you attempted to upload is not allowed.'); //not
allowed if(filesize($_FILES['photo']['tmp_name']) > $max_filesize) //check
that filesize is less than 50MB die ('The file you attempted to upload is
too large, compress it below 50MB.');
// Connects to your Database mysql_connect("localhost", "root", "") or
die(mysql_error()) ; mysql_select_db("office") or die(mysql_error()) ;
//Writes the information to the
$target = "images/" .mysql_insert_id() . $ext;
$staff_id = mysql_insert_id(); $new_file_name = mysql_insert_id() . $ext;
//I removed ,photo='$target' to display only id as picture name
mysql_query("UPDATE development SET photo='$new_file_name' WHERE
staff_id=$staff_id");
//Writes the file to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) {
//Tells you if its all ok echo "The file ". basename(
$_FILES['photo']['name']). " has been uploaded, and your information has
been added to the directory"; `} else {
//Gives and error if its not echo "Sorry, there was a problem uploading
your file."; } ?>
Making the ios app in app store so that one apple id can install the app once
Making the ios app in app store so that one apple id can install the app once
Although it does not look like a technical question however it is, cause I
want to make my app in the way that one apple id can download the app once
and if he/she wants to re-download or re-install it, it will be prohibited
from the app store or from the app itself in the device(Programatically).
The reason behind the same is to make one registration per apple id in the
app so that I can choose the identical one from many.
Is it possible?
Thanks in advance.
Although it does not look like a technical question however it is, cause I
want to make my app in the way that one apple id can download the app once
and if he/she wants to re-download or re-install it, it will be prohibited
from the app store or from the app itself in the device(Programatically).
The reason behind the same is to make one registration per apple id in the
app so that I can choose the identical one from many.
Is it possible?
Thanks in advance.
has_many and belongs_to how to reference the relationship both ways
has_many and belongs_to how to reference the relationship both ways
I have a model invoice and a model invoice_layout.
invoice
belongs_to invoice_layout
end
(the invoice table has a invoice_layout_id)
invoice_layout
has_many invoices
end
Can I just reference invoice_layout.invoice or does it work in both
directions so that i can call invoice.invoice_layout ? If that is not
possible, how can i achieve that?
best regards denym_
I have a model invoice and a model invoice_layout.
invoice
belongs_to invoice_layout
end
(the invoice table has a invoice_layout_id)
invoice_layout
has_many invoices
end
Can I just reference invoice_layout.invoice or does it work in both
directions so that i can call invoice.invoice_layout ? If that is not
possible, how can i achieve that?
best regards denym_
Wednesday, 25 September 2013
removing dinamicaly added row from table having struts2
removing dinamicaly added row from table having struts2
i am quite new at this and i what to know how can i get a index row from a
dynamical table created whit struts2. Here is what i have tried so far:
test file Name
<tbody>
<s:if test="listanume.size>0">
<s:iterator value="listanume" status="statusVar">
<tr>
<td class="center">
<button class="btn"
onclick="javascript:setval(0)">
delete
</button>
</td>
<td><s:property value="nume"/></td>
</tr>
</s:iterator>
</s:if>
</tbody>
</table>
<h4>Numarul randului este: <s:property value="mysample"/> </h4>
<script>
var mysample= '';
function= setval(varval){
mysample=varval;
alert(mysample);
}
</script>
pop java
public class Pop {
private int nrrow;
private List<UserModel> listanume = new ArrayList<UserModel>();
UserModel user = new UserModel(),
user1 = new UserModel(),
user2 = new UserModel();
private String[] sample;
{
sample = new String[]{"list1", "list2", "list3"};
}
public String execute() {
user.setEmail("eret@esre");
user.setPass1("1234");
user.setNume("gigel");
user1.setEmail("yuii@ihj");
user1.setPass1("6789");
user1.setNume("marius");
user2.setEmail("nmnn@cvx");
user2.setPass1("7676");
user2.setNume("sorin");
sample1.add(user);
sample1.add(user1);
sample1.add(user2);
return "succes";
}
public String afisnrow(){
execute();
listanume=sample1;
return "succes";
}
public String[] getSample() {
return sample;
}
public void setSample(String[] sample) {
this.sample = sample;
}
public List<UserModel> getSample1() {
return sample1;
}
public void setSample1(List<UserModel> sample1) {
this.sample1 = sample1;
}
public void setNrrow(int nrrow){
this.nrrow=nrrow;
}
public int getNrrow(){
return nrrow;
}
public List<UserModel> getListanume(){
return listanume;
}
public void setListanume(List<UserModel> listanume){
this.listanume=listanume;
}
}
every row has a button on it and when i click that button i need to get
the row index, i kind of stuck and run out of ideas, any suggestions?
i am quite new at this and i what to know how can i get a index row from a
dynamical table created whit struts2. Here is what i have tried so far:
test file Name
<tbody>
<s:if test="listanume.size>0">
<s:iterator value="listanume" status="statusVar">
<tr>
<td class="center">
<button class="btn"
onclick="javascript:setval(0)">
delete
</button>
</td>
<td><s:property value="nume"/></td>
</tr>
</s:iterator>
</s:if>
</tbody>
</table>
<h4>Numarul randului este: <s:property value="mysample"/> </h4>
<script>
var mysample= '';
function= setval(varval){
mysample=varval;
alert(mysample);
}
</script>
pop java
public class Pop {
private int nrrow;
private List<UserModel> listanume = new ArrayList<UserModel>();
UserModel user = new UserModel(),
user1 = new UserModel(),
user2 = new UserModel();
private String[] sample;
{
sample = new String[]{"list1", "list2", "list3"};
}
public String execute() {
user.setEmail("eret@esre");
user.setPass1("1234");
user.setNume("gigel");
user1.setEmail("yuii@ihj");
user1.setPass1("6789");
user1.setNume("marius");
user2.setEmail("nmnn@cvx");
user2.setPass1("7676");
user2.setNume("sorin");
sample1.add(user);
sample1.add(user1);
sample1.add(user2);
return "succes";
}
public String afisnrow(){
execute();
listanume=sample1;
return "succes";
}
public String[] getSample() {
return sample;
}
public void setSample(String[] sample) {
this.sample = sample;
}
public List<UserModel> getSample1() {
return sample1;
}
public void setSample1(List<UserModel> sample1) {
this.sample1 = sample1;
}
public void setNrrow(int nrrow){
this.nrrow=nrrow;
}
public int getNrrow(){
return nrrow;
}
public List<UserModel> getListanume(){
return listanume;
}
public void setListanume(List<UserModel> listanume){
this.listanume=listanume;
}
}
every row has a button on it and when i click that button i need to get
the row index, i kind of stuck and run out of ideas, any suggestions?
Thursday, 19 September 2013
Gap in between image and div tag
Gap in between image and div tag
so I'm making a website in dreamworks cc and theres a big gap in between
my image and a div tag. See picture:
http://i.imm.io/1gzKW.png
Okay now heres my index code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>
<link href="style/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container" style="">
<div class="logo"><img src="images/header.png" width="990" height="256"
alt=""/></div>
<div class="menu">
<div class="menubutt1" style="cursor:pointer;"
onclick="location.href='./index.html'">Home</div>
<div class="menubutt2" style="cursor:pointer;"
onclick="location.href='./aboutus.html'">About Us</div>
<div class="menubutt3" style="cursor:pointer;"
onclick="location.href='./games.html'">Game Info</div>
<div class="menubutt4" style="cursor:pointer;"
onclick="location.href='./forms.html'">Forms</div>
<div class="menubutt5" style="cursor:pointer;"
onclick="location.href='./gallery.html'">Gallery</div>
<div class="menubutt6" style="cursor:pointer;"
onclick="location.href='./contactus.html'">Contact Us</div>
</div>
<div class="content">stuff</div>
<div class="footer"><br><strong>©</strong>2013 Trey Zanone</div>
</div>
</body>
</html>
and heres my css style sheet:
@charset "utf-8";.container {
background-image: none;
width: 990px;
margin-right: auto;
-webkit-transition: all;
-moz-transition: all;
-ms-transition: all;
-o-transition: all;
transition: all;
margin-left: auto;
padding: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
.content {
width: 990px;
margin-right: auto;
margin-left: auto;
padding: 30px;
background-image: url(../images/body.png);
background-repeat: repeat-y;
margin-top: 0px;
margin-bottom: 0px;
}
.footer {
background-image: url(../images/footer.png);
width: 990px;
height: 100px;
text-align: center;
margin: 0px;
padding: 0px;
}
body {
background-image: url(../images/background.png);
background-repeat: repeat-x;
margin-top: 0px;
}
img {
border:0;
margin:0
}
.logo {
background-image: none;
padding: 0px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
.menu {
height: 48px;
width: 934px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
I took out the menu button rules, as it is long and irrelevant.
so I'm making a website in dreamworks cc and theres a big gap in between
my image and a div tag. See picture:
http://i.imm.io/1gzKW.png
Okay now heres my index code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>
<link href="style/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container" style="">
<div class="logo"><img src="images/header.png" width="990" height="256"
alt=""/></div>
<div class="menu">
<div class="menubutt1" style="cursor:pointer;"
onclick="location.href='./index.html'">Home</div>
<div class="menubutt2" style="cursor:pointer;"
onclick="location.href='./aboutus.html'">About Us</div>
<div class="menubutt3" style="cursor:pointer;"
onclick="location.href='./games.html'">Game Info</div>
<div class="menubutt4" style="cursor:pointer;"
onclick="location.href='./forms.html'">Forms</div>
<div class="menubutt5" style="cursor:pointer;"
onclick="location.href='./gallery.html'">Gallery</div>
<div class="menubutt6" style="cursor:pointer;"
onclick="location.href='./contactus.html'">Contact Us</div>
</div>
<div class="content">stuff</div>
<div class="footer"><br><strong>©</strong>2013 Trey Zanone</div>
</div>
</body>
</html>
and heres my css style sheet:
@charset "utf-8";.container {
background-image: none;
width: 990px;
margin-right: auto;
-webkit-transition: all;
-moz-transition: all;
-ms-transition: all;
-o-transition: all;
transition: all;
margin-left: auto;
padding: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
.content {
width: 990px;
margin-right: auto;
margin-left: auto;
padding: 30px;
background-image: url(../images/body.png);
background-repeat: repeat-y;
margin-top: 0px;
margin-bottom: 0px;
}
.footer {
background-image: url(../images/footer.png);
width: 990px;
height: 100px;
text-align: center;
margin: 0px;
padding: 0px;
}
body {
background-image: url(../images/background.png);
background-repeat: repeat-x;
margin-top: 0px;
}
img {
border:0;
margin:0
}
.logo {
background-image: none;
padding: 0px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
.menu {
height: 48px;
width: 934px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
I took out the menu button rules, as it is long and irrelevant.
Microsoft HTTP Client Libraries NuGet Package on Visual Studio 2010
Microsoft HTTP Client Libraries NuGet Package on Visual Studio 2010
As of this writing, The Microsoft HTTP Client Libraries NuGet package
(Microsoft.Net.Http) is at version 2.2.13. However, this version comes
with a disclaimer that it is not supported in Visual Studio 2010, despite
being required by System.Web.Http.SelfHost. (And indeed, it does cause
issues with Visual Studio 2010, as does the dependent library
Microsoft.Bcl.Build.
My question is, which version should I be using? Available previous
versions are 2.1.10, 2.0.20710.0, and 2.0.20505.0.
I'll give 2.1.10 a try and report back, but if anyone already has the
answer, please let me know.
As of this writing, The Microsoft HTTP Client Libraries NuGet package
(Microsoft.Net.Http) is at version 2.2.13. However, this version comes
with a disclaimer that it is not supported in Visual Studio 2010, despite
being required by System.Web.Http.SelfHost. (And indeed, it does cause
issues with Visual Studio 2010, as does the dependent library
Microsoft.Bcl.Build.
My question is, which version should I be using? Available previous
versions are 2.1.10, 2.0.20710.0, and 2.0.20505.0.
I'll give 2.1.10 a try and report back, but if anyone already has the
answer, please let me know.
How do save a value in a multi-dimensional array
How do save a value in a multi-dimensional array
I need to salve the result of the variable $res into a mufti-dimensional
array to then save in the json_encode.
<?php
include("config.inc");
$query = "SELECT * FROM accounts ";
$res = mysql_query($query);
$arr = array(array($res));
echo json_encode($arr);
mysql_close($con);
?>
What am I doing wrong? How do I save the "$res" into a array? Thx
I need to salve the result of the variable $res into a mufti-dimensional
array to then save in the json_encode.
<?php
include("config.inc");
$query = "SELECT * FROM accounts ";
$res = mysql_query($query);
$arr = array(array($res));
echo json_encode($arr);
mysql_close($con);
?>
What am I doing wrong? How do I save the "$res" into a array? Thx
PHP - sleep function is IIS
PHP - sleep function is IIS
I write the php code in iis to serve file for download with speed limit,
so i need to use sleep function for speed limit.
here a few line of my code
while(!feof($file))
{
echo fread($file, 1024*10);
ob_flush();
flush();
sleep(1);
if (connection_status()!=0)
{
@fclose($file);
exit;
}
}
But the browser say 'Waiting For mysite'.
if i remove sleep(1) every thing is right.
I also test it in apache and everything is right too.
so I have problem in IIS with sleep function
sry for bad english
I write the php code in iis to serve file for download with speed limit,
so i need to use sleep function for speed limit.
here a few line of my code
while(!feof($file))
{
echo fread($file, 1024*10);
ob_flush();
flush();
sleep(1);
if (connection_status()!=0)
{
@fclose($file);
exit;
}
}
But the browser say 'Waiting For mysite'.
if i remove sleep(1) every thing is right.
I also test it in apache and everything is right too.
so I have problem in IIS with sleep function
sry for bad english
301 redirect for entire site except for subdomains
301 redirect for entire site except for subdomains
I have setup a sitewide 301 redirect in my .htaccess as follows
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
But I wanted to exclude subdomains (support, blog) from being included in
this redirect. So I add the following RewriteConditions
RewriteEngine On
RewriteCond %{HTTP_HOST} !=support.example.com
RewriteCond %{HTTP_HOST} !=blog.example.com
RewriteCond %{HTTPS} !=on
RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
This works totally fine. However I wonder if there is a better way to
specify the exclusion for all subdomains (not WWW) in just 1 RewriteCond
statement (instead of a separate RewriteCond for each subdomain)
I have a few more subdomains and plan to add some more. Would appreciate
the help.
I have setup a sitewide 301 redirect in my .htaccess as follows
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
But I wanted to exclude subdomains (support, blog) from being included in
this redirect. So I add the following RewriteConditions
RewriteEngine On
RewriteCond %{HTTP_HOST} !=support.example.com
RewriteCond %{HTTP_HOST} !=blog.example.com
RewriteCond %{HTTPS} !=on
RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
This works totally fine. However I wonder if there is a better way to
specify the exclusion for all subdomains (not WWW) in just 1 RewriteCond
statement (instead of a separate RewriteCond for each subdomain)
I have a few more subdomains and plan to add some more. Would appreciate
the help.
Showing Category Count on Html Links
Showing Category Count on Html Links
I have html links on my wordpress website sidebar and I would like to show
the number of posts related to that link.
The posts are placed under custom listing category defined by the
following function:
Php:
function va_cat_menu_drop_down( $location = 'menu', $taxonomy ) {
global $va_options;
$key = 'categories_' . $location;
$options = $va_options->$key;
$args['menu_cols'] = ( $location == 'menu' ? 3 : 2 );
$args['menu_depth'] = $options['depth'];
$args['menu_sub_num'] = $options['sub_num'];
$args['cat_parent_count'] = $options['count'];
$args['cat_child_count'] = $options['count'];
$args['cat_hide_empty'] = $options['hide_empty'];
$args['cat_nocatstext'] = true;
$args['cat_order'] = 'ASC';
$args['taxonomy'] = $taxonomy;
$terms_args['pad_counts'] = false;
$terms_args['app_pad_counts'] = true;
return va_categories_list($args, $terms_args);
}
How can I show that number of posts in a particular category next to my
Html link as the following does not work (I guess as the listing category
is probably custom taxonomy?)
I have html links on my wordpress website sidebar and I would like to show
the number of posts related to that link.
The posts are placed under custom listing category defined by the
following function:
Php:
function va_cat_menu_drop_down( $location = 'menu', $taxonomy ) {
global $va_options;
$key = 'categories_' . $location;
$options = $va_options->$key;
$args['menu_cols'] = ( $location == 'menu' ? 3 : 2 );
$args['menu_depth'] = $options['depth'];
$args['menu_sub_num'] = $options['sub_num'];
$args['cat_parent_count'] = $options['count'];
$args['cat_child_count'] = $options['count'];
$args['cat_hide_empty'] = $options['hide_empty'];
$args['cat_nocatstext'] = true;
$args['cat_order'] = 'ASC';
$args['taxonomy'] = $taxonomy;
$terms_args['pad_counts'] = false;
$terms_args['app_pad_counts'] = true;
return va_categories_list($args, $terms_args);
}
How can I show that number of posts in a particular category next to my
Html link as the following does not work (I guess as the listing category
is probably custom taxonomy?)
error in parsing json data in javascript
error in parsing json data in javascript
[
[
{
"Id": 1234,
"PersonId": 1,
"Message": "hiii",
"Image": "5_201309091104109.jpg",
"Likes": 7,
"Status": 1,
"OtherId": 3,
"Friends": 0
}
],
[
{
"Id": 201309091100159,
"PersonId": 1,
"Message": "heyyyyyyyy",
"Image": "",
"Likes": 2,
"Status": 1,
"OtherId": 3,
"Friends": 3
}
]
]
I am trying to parse this JSON data in javascript,but its giving an error
"SyntaxError: JSON.parse: unexpected character" Tell me how to parse or
access this json data and how to get numbers of records saved in JSON
data.
I am running this on firefox ..Please help me to resolve this
problem.Thanks in advance
[
[
{
"Id": 1234,
"PersonId": 1,
"Message": "hiii",
"Image": "5_201309091104109.jpg",
"Likes": 7,
"Status": 1,
"OtherId": 3,
"Friends": 0
}
],
[
{
"Id": 201309091100159,
"PersonId": 1,
"Message": "heyyyyyyyy",
"Image": "",
"Likes": 2,
"Status": 1,
"OtherId": 3,
"Friends": 3
}
]
]
I am trying to parse this JSON data in javascript,but its giving an error
"SyntaxError: JSON.parse: unexpected character" Tell me how to parse or
access this json data and how to get numbers of records saved in JSON
data.
I am running this on firefox ..Please help me to resolve this
problem.Thanks in advance
Wednesday, 18 September 2013
Display text report on aspx page with out using repeater control
Display text report on aspx page with out using repeater control
How to write text report on aspx page from the table by using c#.The
report should like below and i don't want to sue repeater for this because
i have multiple value with same name that way i don't want display them
again and again on the page.
parent: something
categoey: something
value: something
parent: something
categoey: something
value: something
parent: something
categoey: something
value: something
Any Help please?
How to write text report on aspx page from the table by using c#.The
report should like below and i don't want to sue repeater for this because
i have multiple value with same name that way i don't want display them
again and again on the page.
parent: something
categoey: something
value: something
parent: something
categoey: something
value: something
parent: something
categoey: something
value: something
Any Help please?
How to create firefox addon tutorial to manipulate DOM structure?
How to create firefox addon tutorial to manipulate DOM structure?
The question may be silly, but I'm really new to this. Basically - I want
to create FF extention which will allow me to override some DOM elements -
let's say IMG ALT prop. Nothing illegal, malware or anything similar
whatsoever! I think it should work similar to skype "Click to call"
extention - which search for phone numbers and change them into anchors, I
guess?
Any help appreciated!
The question may be silly, but I'm really new to this. Basically - I want
to create FF extention which will allow me to override some DOM elements -
let's say IMG ALT prop. Nothing illegal, malware or anything similar
whatsoever! I think it should work similar to skype "Click to call"
extention - which search for phone numbers and change them into anchors, I
guess?
Any help appreciated!
Operator overloading troubles
Operator overloading troubles
I am trying to compare a list of objects called Persons for a Quicksort.
The object contains strings for first name, last name, SSN, and phone
number, as well as some useful members.
class Person
{
protected:
string firstname, lastname, social, birthday;
public:
Person(string, string, string, string); //store all values in strings for
easy comparison and because no manipulation is necessary
~Person();
string Get(int type); //allows retrieval of protected members of object
void Print();
bool operator > (const Person& pivot) const;
//bool operator < (const Person &pivot);
};
I am trying to use operator overloading to determined which of two Person
objects is larger.
bool Person::operator > (const Person& pivot) const
{
if(this->firstname > pivot.firstname)
return true;
if(this->firstname < pivot.firstname)
return false;
if(this->lastname > pivot.lastname)
return true;
if(this->lastname < pivot.lastname)
return false;
if(this->birthday > pivot.birthday)
return true;
if(this->birthday < pivot.birthday)
return false;
if(this->social > pivot.social)
return true;
if(this->social < pivot.social)
return false;
}
However, this doesn't seem to be working at all because when I run
Person * B = new Person("1234", "Donny", "Smith", "123456780");
Person * pivot = new Person("9345", "John", "Phillip", "234598765");
if (B > pivot);
cout << "hooray\n";
if(pivot > B)
cout << "Not hooray\n";
the contents of both if statements are executed. I'm thoroughly confused,
but it's probably some very stupid mistake.
I am trying to compare a list of objects called Persons for a Quicksort.
The object contains strings for first name, last name, SSN, and phone
number, as well as some useful members.
class Person
{
protected:
string firstname, lastname, social, birthday;
public:
Person(string, string, string, string); //store all values in strings for
easy comparison and because no manipulation is necessary
~Person();
string Get(int type); //allows retrieval of protected members of object
void Print();
bool operator > (const Person& pivot) const;
//bool operator < (const Person &pivot);
};
I am trying to use operator overloading to determined which of two Person
objects is larger.
bool Person::operator > (const Person& pivot) const
{
if(this->firstname > pivot.firstname)
return true;
if(this->firstname < pivot.firstname)
return false;
if(this->lastname > pivot.lastname)
return true;
if(this->lastname < pivot.lastname)
return false;
if(this->birthday > pivot.birthday)
return true;
if(this->birthday < pivot.birthday)
return false;
if(this->social > pivot.social)
return true;
if(this->social < pivot.social)
return false;
}
However, this doesn't seem to be working at all because when I run
Person * B = new Person("1234", "Donny", "Smith", "123456780");
Person * pivot = new Person("9345", "John", "Phillip", "234598765");
if (B > pivot);
cout << "hooray\n";
if(pivot > B)
cout << "Not hooray\n";
the contents of both if statements are executed. I'm thoroughly confused,
but it's probably some very stupid mistake.
Setting up Acts_as_follower on RoR4
Setting up Acts_as_follower on RoR4
I'm on Rails 4 and recently needed the Gem Acts_as_follower.
I Set up my Models and run the Generator. In my View file I tried
user.follow_count
and it worked, so i guess the initial Set up went Fine.
But from this point on, i'm in the dark as far as setting up my view files.
What i'm trying to do is to set up the basic functions of
Acts_as_follower, the 2 Buttons for user.follow and user.stop_following.
Although i read through the Github Documentation, i could not understand
how to do this.
If anybody could enlighten me :)
I'm on Rails 4 and recently needed the Gem Acts_as_follower.
I Set up my Models and run the Generator. In my View file I tried
user.follow_count
and it worked, so i guess the initial Set up went Fine.
But from this point on, i'm in the dark as far as setting up my view files.
What i'm trying to do is to set up the basic functions of
Acts_as_follower, the 2 Buttons for user.follow and user.stop_following.
Although i read through the Github Documentation, i could not understand
how to do this.
If anybody could enlighten me :)
jquery supersized with sliding captions
jquery supersized with sliding captions
We are using 'Supersized' to create a full size background slideshow.
Supersized natively supports captions which can be filled with HTML and
are updated on each slide change.
However, we need the captions to slide on and off screen with the slides
and we haven't been able to find a solution so far.
Is there a way to animate the captions as we need or perhaps there are
suggestions for alternative full background slideshows which support
sliding captions?
Thanks for any help!
We are using 'Supersized' to create a full size background slideshow.
Supersized natively supports captions which can be filled with HTML and
are updated on each slide change.
However, we need the captions to slide on and off screen with the slides
and we haven't been able to find a solution so far.
Is there a way to animate the captions as we need or perhaps there are
suggestions for alternative full background slideshows which support
sliding captions?
Thanks for any help!
Estimating planar homography from an occluded rectangle?
Estimating planar homography from an occluded rectangle?
Computer vision newbie here. For a project I am working on, I have to
estimate a planar homography from the image plane to a given rectangle's
(paper sheet) plane. The rectangle is occluded, so two of the corners are
not visible on the image. If it weren't for the occlusion, the homography
could've been easily calculated from the four corner points.
Sample image is available here: http://i.stack.imgur.com/IhSfT.jpg
There should be enough constraints (two lines are parallel, third is
orthogonal to both, and lengths of all sides of rectangle are known, ...)
to fix the 8 degrees of freedom needed, however I am not sure how to apply
them in this problem. Any help is much appreciated.
Computer vision newbie here. For a project I am working on, I have to
estimate a planar homography from the image plane to a given rectangle's
(paper sheet) plane. The rectangle is occluded, so two of the corners are
not visible on the image. If it weren't for the occlusion, the homography
could've been easily calculated from the four corner points.
Sample image is available here: http://i.stack.imgur.com/IhSfT.jpg
There should be enough constraints (two lines are parallel, third is
orthogonal to both, and lengths of all sides of rectangle are known, ...)
to fix the 8 degrees of freedom needed, however I am not sure how to apply
them in this problem. Any help is much appreciated.
How to get various device information with WinJS
How to get various device information with WinJS
Concretely, I'd like to get the following information about the users device:
A unique ID that identifies the users device, such as a Device-GUID or a
Hardware-ID
The device manufacturer and model name
OS Buildstring or other information about the users OS patch level
What's possible and how can I get this data with WinJS?
Concretely, I'd like to get the following information about the users device:
A unique ID that identifies the users device, such as a Device-GUID or a
Hardware-ID
The device manufacturer and model name
OS Buildstring or other information about the users OS patch level
What's possible and how can I get this data with WinJS?
How to use `OCaml` to implement `Find the k-th child of a node in a tree`?
How to use `OCaml` to implement `Find the k-th child of a node in a tree`?
How to use OCaml to implement Find the k-th child of a node in a tree?
Suppose the tree is defined as follows:
type 'a tree = Leaf of 'a | Node of 'a * 'a tree * 'a tree ;;
How to use OCaml to implement Find the k-th child of a node in a tree?
Suppose the tree is defined as follows:
type 'a tree = Leaf of 'a | Node of 'a * 'a tree * 'a tree ;;
Tuesday, 17 September 2013
java replaceAll not working for \n characters
java replaceAll not working for \n characters
I have a string like this: John \n Barber now I want to replace \n with
actual new line character so it will become
John
Barber
this is my code for this
replaceAll("\\n", "\n");
but it is not working and giving me same string John \n Barber
with regards,
Asif
Associate Software engineer
I have a string like this: John \n Barber now I want to replace \n with
actual new line character so it will become
John
Barber
this is my code for this
replaceAll("\\n", "\n");
but it is not working and giving me same string John \n Barber
with regards,
Asif
Associate Software engineer
PHP Rewriting Url Not working
PHP Rewriting Url Not working
Here i'm facing problem with rewriting url. I'm using php(ver. above 5.0)
with xampp.
My current url is
Original url : /localhost/test/signup.php
redirect Url : /localhost/test/signup/
I wrote rewrite rules in htdocs
RewriteEngine On
RewriteBase /test/
RewriteRule ^signup/$ signup.php
it's not working. I was changed httpd.conf setting also. but no use.
any one can help me, please....
Thank you.
Here i'm facing problem with rewriting url. I'm using php(ver. above 5.0)
with xampp.
My current url is
Original url : /localhost/test/signup.php
redirect Url : /localhost/test/signup/
I wrote rewrite rules in htdocs
RewriteEngine On
RewriteBase /test/
RewriteRule ^signup/$ signup.php
it's not working. I was changed httpd.conf setting also. but no use.
any one can help me, please....
Thank you.
PHP Code seems to not work
PHP Code seems to not work
I just asked a question and got a quick and useful response but this code
doesn't seem to be functioning correctly after a few edits.
$firstDate = '2013-09-17 21:20:24';
echo $firstDate;
echo '<br>';
$datetime1 = new DateTime($firstDate);
$datetime2 = new DateTime($secondDate);
$interval = $datetime1->diff($datetime2);
if ($interval->a <= 7)
{
if($interval->y !== 0)
{
$elapsed = $interval->format('%y years ago');
}
else
if($interval->m !== 0)
{
$elapsed = $interval->format('%m months ago');
}
else
if($interval->a !== 0)
{
$elapsed = $interval->format('%a days ago');
}
else
if($interval->h !== 0)
{
$elapsed = $interval->format('%h hours ago');
}
else
if($interval->i !== 0)
{
$elapsed = $interval->format('%i minutes ago');
}
else
if($interval->S !== 0)
{
$elapsed = $interval->format('%S seconds ago');
}
$elapsed = str_replace(array('0 years ago', ' 0 months ago', ' 0
days ago', ' 0 hours ago', ' 0 minutes ago'), '', $elapsed);
$elapsed = str_replace(array('1 years ago', ' 1 months ago', ' 1 days
ago', ' 1 hours ago', ' 1 minutes ago'), array('1 year ago', '1 month
ago', ' 1 day ago', ' 1 hour ago', ' 1 minute ago'), $elapsed);
echo $elapsed;
}
else
{
echo $firstDate;
}
The code is supposed to give the format X days ago or X seconds ago
but it stops working after days so I don't get minutes or seconds. Why is
this not working?
I just asked a question and got a quick and useful response but this code
doesn't seem to be functioning correctly after a few edits.
$firstDate = '2013-09-17 21:20:24';
echo $firstDate;
echo '<br>';
$datetime1 = new DateTime($firstDate);
$datetime2 = new DateTime($secondDate);
$interval = $datetime1->diff($datetime2);
if ($interval->a <= 7)
{
if($interval->y !== 0)
{
$elapsed = $interval->format('%y years ago');
}
else
if($interval->m !== 0)
{
$elapsed = $interval->format('%m months ago');
}
else
if($interval->a !== 0)
{
$elapsed = $interval->format('%a days ago');
}
else
if($interval->h !== 0)
{
$elapsed = $interval->format('%h hours ago');
}
else
if($interval->i !== 0)
{
$elapsed = $interval->format('%i minutes ago');
}
else
if($interval->S !== 0)
{
$elapsed = $interval->format('%S seconds ago');
}
$elapsed = str_replace(array('0 years ago', ' 0 months ago', ' 0
days ago', ' 0 hours ago', ' 0 minutes ago'), '', $elapsed);
$elapsed = str_replace(array('1 years ago', ' 1 months ago', ' 1 days
ago', ' 1 hours ago', ' 1 minutes ago'), array('1 year ago', '1 month
ago', ' 1 day ago', ' 1 hour ago', ' 1 minute ago'), $elapsed);
echo $elapsed;
}
else
{
echo $firstDate;
}
The code is supposed to give the format X days ago or X seconds ago
but it stops working after days so I don't get minutes or seconds. Why is
this not working?
INSERT ... ON DUPLICATE KEY UPDATE in Doctrine
INSERT ... ON DUPLICATE KEY UPDATE in Doctrine
I am coming to StackOverflow, since I can't find anybody with the same
problem (not even here!)
I am using Doctrine and I have a @ManyToMany entity relation that I would
like to persist to the database. To get you an idea of what I am doing, I
have two Entities: Article and Tags.
Of course, an article can have many tags, and a tag can point to many
articles.
I could do this in many ways (in fact, I had it without entity relations)
but I want to add extra information to those tags: times_clicked and
times_tagged.
Now, inserting them in an easy way (with an extra id column that acts as
PRIMARY KEY) is fairly easy, but I would like tag to be a PRIMARY KEY.
This is for the only (and reasonable) reason that I don't want a table
that contains 1000 entries with the tag column "vacations", so in each new
article I can do some sort of ++times_tagged if the tag did exist.
I have tried with a RAW SQL INSERT (using
$em->getConnection()->prepare($sql)...) but it doesn't work because it
throws an error:
Can't instantiate custom generator :
and there it should say the class name, which is "" because raw statements
don't relate to classes (I guess... but I could not find a single piece of
information anywhere about this)
This happens, now I know, because I am not persisting the $article
variable from the Tag entity. This is again a supposition based on my
limited knowledge.
In any case, my best approach has been using a try and catch, thanks to
some info found here, and the idea would be to run an UPDATE if an error
is thrown, but it keeps throwing the error... (which makes me wonder how
little I know about this)
try {
// ...
$tag = new Tag('vacation');
$article->addTag($tag);
$em->persist($tag);
// ...
$em->persist($article);
$em->flush();
}catch (\PDOException $e) {
if ($e->getCode() === '23000') {
//echo $e->getMessage();
// this is fine! It means "DUPLICATE ENTRY"
// Perform an update for the tag 'vacation'.
// SET times_tagged = times_tagged+1
}
else throw "Well, NOW we have a problem!";
}
I hope I didn't bore you with too much introduction! So, the question is
fairly simple:
HOW can I achieve this? (i.e. How can I persist both Article and Tag, but
using the tag name as a PRIMARY KEY?
Thank you deeply in advance!
I am coming to StackOverflow, since I can't find anybody with the same
problem (not even here!)
I am using Doctrine and I have a @ManyToMany entity relation that I would
like to persist to the database. To get you an idea of what I am doing, I
have two Entities: Article and Tags.
Of course, an article can have many tags, and a tag can point to many
articles.
I could do this in many ways (in fact, I had it without entity relations)
but I want to add extra information to those tags: times_clicked and
times_tagged.
Now, inserting them in an easy way (with an extra id column that acts as
PRIMARY KEY) is fairly easy, but I would like tag to be a PRIMARY KEY.
This is for the only (and reasonable) reason that I don't want a table
that contains 1000 entries with the tag column "vacations", so in each new
article I can do some sort of ++times_tagged if the tag did exist.
I have tried with a RAW SQL INSERT (using
$em->getConnection()->prepare($sql)...) but it doesn't work because it
throws an error:
Can't instantiate custom generator :
and there it should say the class name, which is "" because raw statements
don't relate to classes (I guess... but I could not find a single piece of
information anywhere about this)
This happens, now I know, because I am not persisting the $article
variable from the Tag entity. This is again a supposition based on my
limited knowledge.
In any case, my best approach has been using a try and catch, thanks to
some info found here, and the idea would be to run an UPDATE if an error
is thrown, but it keeps throwing the error... (which makes me wonder how
little I know about this)
try {
// ...
$tag = new Tag('vacation');
$article->addTag($tag);
$em->persist($tag);
// ...
$em->persist($article);
$em->flush();
}catch (\PDOException $e) {
if ($e->getCode() === '23000') {
//echo $e->getMessage();
// this is fine! It means "DUPLICATE ENTRY"
// Perform an update for the tag 'vacation'.
// SET times_tagged = times_tagged+1
}
else throw "Well, NOW we have a problem!";
}
I hope I didn't bore you with too much introduction! So, the question is
fairly simple:
HOW can I achieve this? (i.e. How can I persist both Article and Tag, but
using the tag name as a PRIMARY KEY?
Thank you deeply in advance!
Ocotopress with github repo branch
Ocotopress with github repo branch
I'm new to both Github and Ocotopress. I've made a blog, and i have been
following a tutorial from:
http://schuyler.info/blog/how-to-setup-a-new-octopress-blog-on-github-pages.html
I've used rake generate and then rake deploy - which works a treat. I can
see in my repo the files from _deploy. However, it says this is the master
branch. And i am under the impression it shouldn't be? As the rest of the
folders i added to my source folder don't show up in this site.
I can visit the website via gitpages fine. I can see my two test posts.
But i updated the navigation file within the source folder and tried to
push this but it doesn't seem to appear.
In the tutorial there is a bit:
$ git add .
$ git commit -m "I made a post." -a
$ git push
This doesn't do anything for me. It says:
Everything up-to-date
Even when i am sure it's not.. Can anyone save a damsel in distress?
Note - I don't see any of the commit comments on my repo, so i am figuring
something has gone wrong and my master is not correct.
I'm new to both Github and Ocotopress. I've made a blog, and i have been
following a tutorial from:
http://schuyler.info/blog/how-to-setup-a-new-octopress-blog-on-github-pages.html
I've used rake generate and then rake deploy - which works a treat. I can
see in my repo the files from _deploy. However, it says this is the master
branch. And i am under the impression it shouldn't be? As the rest of the
folders i added to my source folder don't show up in this site.
I can visit the website via gitpages fine. I can see my two test posts.
But i updated the navigation file within the source folder and tried to
push this but it doesn't seem to appear.
In the tutorial there is a bit:
$ git add .
$ git commit -m "I made a post." -a
$ git push
This doesn't do anything for me. It says:
Everything up-to-date
Even when i am sure it's not.. Can anyone save a damsel in distress?
Note - I don't see any of the commit comments on my repo, so i am figuring
something has gone wrong and my master is not correct.
Creating if + & statement
Creating if + & statement
I'm using R and need to create code that checks if a matrix dimensions has
3x3. I am stuck on the proper code using if() to check the nrow and ncol.
Any help or suggestion greatly appreciated.
localSmoother <- function(myMatrix = matrix(), smoothingMatrix = matrix(1,
nrow = 3, ncol = 3))
{
if(class(smoothingMatrix) != "matrix") stop ("smoothingMatrix must be a
matrix.")
if(ncol(smoothingMatrix) != "3" & if(nrow(smoothingMatrix) != "3")
stop ("smoothingMatrix must have dimensions of 3x3")
print(myMatrix) # see what myMatrix is.
print(smoothingMatrix) # see what smoothingMatrix is.
return(matrix(, nrow = 3, ncol = 3))
}
# # TEST the CODE:
localSmoother(myMatrix = diag(x = 2, nrow = 5, ncol = 5), smoothingMatrix
= matrix(2, nrow = 5, ncol = 3))
# # Error in localSmoother(myMatrix = diag(x = 2, nrow = 5, ncol = 5),
smoothingMatrix = matrix(2, :
# # smoothingMatrix must by 3x3
I'm using R and need to create code that checks if a matrix dimensions has
3x3. I am stuck on the proper code using if() to check the nrow and ncol.
Any help or suggestion greatly appreciated.
localSmoother <- function(myMatrix = matrix(), smoothingMatrix = matrix(1,
nrow = 3, ncol = 3))
{
if(class(smoothingMatrix) != "matrix") stop ("smoothingMatrix must be a
matrix.")
if(ncol(smoothingMatrix) != "3" & if(nrow(smoothingMatrix) != "3")
stop ("smoothingMatrix must have dimensions of 3x3")
print(myMatrix) # see what myMatrix is.
print(smoothingMatrix) # see what smoothingMatrix is.
return(matrix(, nrow = 3, ncol = 3))
}
# # TEST the CODE:
localSmoother(myMatrix = diag(x = 2, nrow = 5, ncol = 5), smoothingMatrix
= matrix(2, nrow = 5, ncol = 3))
# # Error in localSmoother(myMatrix = diag(x = 2, nrow = 5, ncol = 5),
smoothingMatrix = matrix(2, :
# # smoothingMatrix must by 3x3
Sunday, 15 September 2013
WebImage class missing on MVC 4
WebImage class missing on MVC 4
I've been developing a MVC 4 web app but I couldn't find where is the
reference to WebImage. I also added a reference to "System.Web.Helpers".
I'm inside a Controller and there is no shortcut or even helps/tips to
find this class.
public ActionResult Images()
{
WebImage w
}
What am I missing?
I've been developing a MVC 4 web app but I couldn't find where is the
reference to WebImage. I also added a reference to "System.Web.Helpers".
I'm inside a Controller and there is no shortcut or even helps/tips to
find this class.
public ActionResult Images()
{
WebImage w
}
What am I missing?
How to convert the first letter (with a diacritic) of the first word of a sentence in PHP?
How to convert the first letter (with a diacritic) of the first word of a
sentence in PHP?
I need to convert to lowercase some strings/sentences, like this:
"șef de cabinet", then to convert to uppercase the first letter of
the first word (with a diacritic) of these strings. I found a function,
but it converts the first letter of every word from the string. How to
adapt it to my needs?
This is the code:
function sentence_case( $s ) {
$s = mb_convert_case( $s, MB_CASE_LOWER, 'UTF-8' );
$arr = preg_split("//u", $s, -1, PREG_SPLIT_NO_EMPTY);
$result = "";
$mode = false;
foreach ($arr as $char) {
$res = preg_match(
'/\\p{Mn}|\\p{Me}|\\p{Cf}|\\p{Lm}|\\p{Sk}|\\p{Lu}|\\p{Ll}|'.
'\\p{Lt}|\\p{Sk}|\\p{Cs}/u', $char) == 1;
if ($mode) {
if (!$res)
$mode = false;
}
elseif ($res) {
$mode = true;
$char = mb_convert_case($char, MB_CASE_TITLE, "UTF-8");
}
$result .= $char;
}
return $result;
}
sentence in PHP?
I need to convert to lowercase some strings/sentences, like this:
"șef de cabinet", then to convert to uppercase the first letter of
the first word (with a diacritic) of these strings. I found a function,
but it converts the first letter of every word from the string. How to
adapt it to my needs?
This is the code:
function sentence_case( $s ) {
$s = mb_convert_case( $s, MB_CASE_LOWER, 'UTF-8' );
$arr = preg_split("//u", $s, -1, PREG_SPLIT_NO_EMPTY);
$result = "";
$mode = false;
foreach ($arr as $char) {
$res = preg_match(
'/\\p{Mn}|\\p{Me}|\\p{Cf}|\\p{Lm}|\\p{Sk}|\\p{Lu}|\\p{Ll}|'.
'\\p{Lt}|\\p{Sk}|\\p{Cs}/u', $char) == 1;
if ($mode) {
if (!$res)
$mode = false;
}
elseif ($res) {
$mode = true;
$char = mb_convert_case($char, MB_CASE_TITLE, "UTF-8");
}
$result .= $char;
}
return $result;
}
Python 3.3.2 and 2.7.5 first line code
Python 3.3.2 and 2.7.5 first line code
I am new to python. I have installed both version python 3.3.2 and 2.7.5
(Windows 7)
python 3.3 directory : c:\python33 python 2.7 directory : c:\python27
python33 was installed first.
What will be first line of code for both version of python? like as #!
/user/bin/python ??? more importantly why this line is important ?
I am new to python. I have installed both version python 3.3.2 and 2.7.5
(Windows 7)
python 3.3 directory : c:\python33 python 2.7 directory : c:\python27
python33 was installed first.
What will be first line of code for both version of python? like as #!
/user/bin/python ??? more importantly why this line is important ?
How to clear texbox after submission
How to clear texbox after submission
Hi i wanted to know if there is any way that i can reset my form after the
data has been added successfully into the database? Like after showing
some message to the client the textbox should automatically clear out.
Hi i wanted to know if there is any way that i can reset my form after the
data has been added successfully into the database? Like after showing
some message to the client the textbox should automatically clear out.
Complete User Name and Password on a Site
Complete User Name and Password on a Site
Me Again
This is off topic and I was wondering if anyone could give some direction
in this
I have a website we use for our tracking company the website doesn't
belong to us but we have access to the site via a Username and Password. I
was wondering is there away that I can write a code that it automatically
inserts our username and password into the fields of our supplier's
website on clicking a button on our website diverting to that site.
The site in I want to link to is www.gpsyeah.com
Basically I want to see if it is possible to auto complete the user name
and password
Logic says I will not be able to as I cannot Echo on another site but
maybe there is a clever one here who knows how to do this
Me Again
This is off topic and I was wondering if anyone could give some direction
in this
I have a website we use for our tracking company the website doesn't
belong to us but we have access to the site via a Username and Password. I
was wondering is there away that I can write a code that it automatically
inserts our username and password into the fields of our supplier's
website on clicking a button on our website diverting to that site.
The site in I want to link to is www.gpsyeah.com
Basically I want to see if it is possible to auto complete the user name
and password
Logic says I will not be able to as I cannot Echo on another site but
maybe there is a clever one here who knows how to do this
GridBagLayout not anchoring button to PAGE_END
GridBagLayout not anchoring button to PAGE_END
I followed a different answer from this site where the guy had the same
problem, but my button is still not anchoring down to the bottom. Any
ideas ?
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
public class InstructionsPanel {
JComponent InstructionsPanel() throws IOException {
JComponent iPanel = new JLabel(new ImageIcon(ImageIO.read(new
File("res/FinalBG.png"))));
iPanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
BufferedImage button1icon = ImageIO.read(new
File("res/MainMenu.png"));
JButton button1 = new JButton("",new ImageIcon(button1icon));
gbc = new GridBagConstraints();
iPanel.add(button1);
gbc.weighty = 1.0;
gbc.gridx = 0;
gbc.anchor = GridBagConstraints.PAGE_END;
button1.setBorder(BorderFactory.createEmptyBorder());
//button1.setContentAreaFilled(false);
return iPanel;
}
}
Any help would be greatly appreciated, thanks !
I followed a different answer from this site where the guy had the same
problem, but my button is still not anchoring down to the bottom. Any
ideas ?
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
public class InstructionsPanel {
JComponent InstructionsPanel() throws IOException {
JComponent iPanel = new JLabel(new ImageIcon(ImageIO.read(new
File("res/FinalBG.png"))));
iPanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
BufferedImage button1icon = ImageIO.read(new
File("res/MainMenu.png"));
JButton button1 = new JButton("",new ImageIcon(button1icon));
gbc = new GridBagConstraints();
iPanel.add(button1);
gbc.weighty = 1.0;
gbc.gridx = 0;
gbc.anchor = GridBagConstraints.PAGE_END;
button1.setBorder(BorderFactory.createEmptyBorder());
//button1.setContentAreaFilled(false);
return iPanel;
}
}
Any help would be greatly appreciated, thanks !
Saturday, 14 September 2013
How to return a vector from a function
How to return a vector from a function
I'm trying to return a vector from a function, but I seem to be having
some issues ....
Currently, this is the best I've got:
int* OptimizedSkillLevels(int skillLevel, const int numSkills, int
duration, FragmentOptimizationParameters FOP){
//some code to work with some things was here
vector<int> skills(numSkills);
int skillIncrement = 0;
while (skillLevel > FOP.levelDifference){
skills[skillIncrement%numSkills] += FOP.levelDifference;
skillLevel-= FOP.levelDifference;
skillIncrement++;
}
skills[skills.size()-1] += skillLevel;
//at this point, the vector skills is full of the correct values,
which is what really matters.
}
int* skillsArr = &skills[0];
return skillsArr;
}
Though this seems to be giving me garbage values when I access it from
this function call:
cout << OptimizedSkillLevels(skillLevels[i], userMaxNumSkills,
durations[i], FOPs[FOPindex])[j] << ", ";
specifically, I'm getting -17891602 from that every time, regardless of
what [j] is.
So then I tried to convert to a vector as follows:
vector<int> OptimizedSkillLevels(int skillLevel, const int numSkills, int
duration, FragmentOptimizationParameters FOP){
//some code to work with some things was here
vector<int> skills(numSkills);
int skillIncrement = 0;
while (skillLevel > FOP.levelDifference){
skills[skillIncrement%numSkills] += FOP.levelDifference;
skillLevel-= FOP.levelDifference;
skillIncrement++;
}
skills[skills.size()-1] += skillLevel;
//at this point, the vector skills is full of the correct values,
which is what really matters.
}
return skills;
}
with the function prototype:
vector<int> OptimizedSkillLevels(int skillLevel, int numSkills, int
duration, FragmentOptimizationParameters FOP);
But I'm getting a multitude of errors, including this (at the line of the
prototype):
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C2143: syntax error :
missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
and these, none of which appeared before changing the return type of my
function to vector ... so I really don't know what going on.
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C2143: syntax error
: missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C2143: syntax error :
missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C2086: 'int vector' :
redefinition
1> c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59) : see declaration of 'vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C2143: syntax error :
missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C2086: 'int vector' :
redefinition
1> c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59) : see declaration of 'vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(84): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(84): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(85): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(85): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(86): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(86): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(87): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(87): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(88): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(88): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(89): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(89): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(91): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(91): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(92): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(92): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(93): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(93): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(94): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(94): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(95): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(95): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(96): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(96): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(169): warning C4244: 'return' :
conversion from 'const double' to '__int64', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(192): warning C4244: 'argument' :
conversion from 'double' to '__int64', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(195): warning C4244: '=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(196): warning C4244: '=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(197): warning C4244: 'argument' :
conversion from 'double' to '__int64', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(202): warning C4244: '+=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(203): warning C4244: '+=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(215): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(215): error C2062: type '__int64'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(216): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(216): error C2062: type '__int64'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(217): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(217): error C2062: type '__int64'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(229): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(229): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(231): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(231): error C2228: left of
'.resize' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(232): error C2065: 'skillLevels' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(232): error C2228: left of
'.resize' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(233): error C2065: 'durations' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(233): error C2228: left of
'.resize' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(236): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(239): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(239): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(242): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(243): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(244): error C2065: 'skillLevels' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(245): error C2065: 'durations' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(251): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(251): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(252): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(252): error C2065: 'skillLevels' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(252): error C2065: 'durations' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(265): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(265): error C2062: type 'int'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(266): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(266): error C2062: type 'int'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(269): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(269): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(269): fatal error C1903: unable to
recover from previous error(s); stopping compilation
1>
Any help anyone could offer on either the proper method of returning a
vector or some sort of workaround would be much appreciated.
I'm trying to return a vector from a function, but I seem to be having
some issues ....
Currently, this is the best I've got:
int* OptimizedSkillLevels(int skillLevel, const int numSkills, int
duration, FragmentOptimizationParameters FOP){
//some code to work with some things was here
vector<int> skills(numSkills);
int skillIncrement = 0;
while (skillLevel > FOP.levelDifference){
skills[skillIncrement%numSkills] += FOP.levelDifference;
skillLevel-= FOP.levelDifference;
skillIncrement++;
}
skills[skills.size()-1] += skillLevel;
//at this point, the vector skills is full of the correct values,
which is what really matters.
}
int* skillsArr = &skills[0];
return skillsArr;
}
Though this seems to be giving me garbage values when I access it from
this function call:
cout << OptimizedSkillLevels(skillLevels[i], userMaxNumSkills,
durations[i], FOPs[FOPindex])[j] << ", ";
specifically, I'm getting -17891602 from that every time, regardless of
what [j] is.
So then I tried to convert to a vector as follows:
vector<int> OptimizedSkillLevels(int skillLevel, const int numSkills, int
duration, FragmentOptimizationParameters FOP){
//some code to work with some things was here
vector<int> skills(numSkills);
int skillIncrement = 0;
while (skillLevel > FOP.levelDifference){
skills[skillIncrement%numSkills] += FOP.levelDifference;
skillLevel-= FOP.levelDifference;
skillIncrement++;
}
skills[skills.size()-1] += skillLevel;
//at this point, the vector skills is full of the correct values,
which is what really matters.
}
return skills;
}
with the function prototype:
vector<int> OptimizedSkillLevels(int skillLevel, int numSkills, int
duration, FragmentOptimizationParameters FOP);
But I'm getting a multitude of errors, including this (at the line of the
prototype):
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C2143: syntax error :
missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
and these, none of which appeared before changing the return type of my
function to vector ... so I really don't know what going on.
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C2143: syntax error
: missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C2143: syntax error :
missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(73): error C2086: 'int vector' :
redefinition
1> c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59) : see declaration of 'vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C2143: syntax error :
missing ';' before '<'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(74): error C2086: 'int vector' :
redefinition
1> c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(59) : see declaration of 'vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(84): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(84): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(85): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(85): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(86): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(86): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(87): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(87): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(88): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(88): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(89): error C2065: 'FOPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(89): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(91): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(91): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(92): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(92): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(93): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(93): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(94): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(94): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(95): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(95): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(96): error C2065: 'FCPs' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(96): error C2228: left of
'.push_back' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(169): warning C4244: 'return' :
conversion from 'const double' to '__int64', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(192): warning C4244: 'argument' :
conversion from 'double' to '__int64', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(195): warning C4244: '=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(196): warning C4244: '=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(197): warning C4244: 'argument' :
conversion from 'double' to '__int64', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(202): warning C4244: '+=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(203): warning C4244: '+=' :
conversion from 'double' to 'int', possible loss of data
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(215): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(215): error C2062: type '__int64'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(216): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(216): error C2062: type '__int64'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(217): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(217): error C2062: type '__int64'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(229): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(229): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(231): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(231): error C2228: left of
'.resize' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(232): error C2065: 'skillLevels' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(232): error C2228: left of
'.resize' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(233): error C2065: 'durations' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(233): error C2228: left of
'.resize' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(236): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(239): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(239): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(242): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(243): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(244): error C2065: 'skillLevels' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(245): error C2065: 'durations' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(251): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(251): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(252): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(252): error C2065: 'skillLevels' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(252): error C2065: 'durations' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(265): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(265): error C2062: type 'int'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(266): error C2872: 'vector' :
ambiguous symbol
1> could be 'c:\users\vasu\documents\visual studio
11\projects\composing calc\composing calc\composing calc.cpp(59) : int
vector'
1> or 'c:\program files (x86)\microsoft visual studio
11.0\vc\include\vector(655) : std::vector'
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(266): error C2062: type 'int'
unexpected
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(269): error C2065: 'optimalCosts' :
undeclared identifier
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(269): error C2228: left of '.size'
must have class/struct/union
1> type is ''unknown-type''
1>c:\users\vasu\documents\visual studio 11\projects\composing
calc\composing calc\composing calc.cpp(269): fatal error C1903: unable to
recover from previous error(s); stopping compilation
1>
Any help anyone could offer on either the proper method of returning a
vector or some sort of workaround would be much appreciated.
"Navbar" not showing up - Bootstrap by Twitter
"Navbar" not showing up - Bootstrap by Twitter
I am following a Youtube tutorial on putting together a website with
Bootstrap and everything has been simple so far but for some reason by
navigation bar will not appear. Here is the code in "index.htm". Also, I
created that in the default root directory (index.htm) and I created
"style.css" which went in the CSS folder.
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href = "css/boostrap.min.css" rel = "stylesheet">
<link href = "css/styles.css" rel = "stylesheet">
</head>
<body>
<div class = "navbar navbar-inverse navbar-stat-top">
<div class = "container"
<a href = "#" class = "navbar-brand">Tech Site</a>
</div>
</div>
<script src =
"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src = "js/boostrap.js"></script>
</body>
This is what I get when I open up "index.html" with Chrome: (I can't paste
an image) http://picpaste.com/index-GQbn9OJ8.jpg
I really have no idea what could be wrong but I am really new at this. It
looks like maybe CSS isn't working at all but I'm not sure. The tutorial
did not have me add anything to "styles.css" but I referred to it multiple
times in my code so would that be a problem?
Thanks!
I am following a Youtube tutorial on putting together a website with
Bootstrap and everything has been simple so far but for some reason by
navigation bar will not appear. Here is the code in "index.htm". Also, I
created that in the default root directory (index.htm) and I created
"style.css" which went in the CSS folder.
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href = "css/boostrap.min.css" rel = "stylesheet">
<link href = "css/styles.css" rel = "stylesheet">
</head>
<body>
<div class = "navbar navbar-inverse navbar-stat-top">
<div class = "container"
<a href = "#" class = "navbar-brand">Tech Site</a>
</div>
</div>
<script src =
"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src = "js/boostrap.js"></script>
</body>
This is what I get when I open up "index.html" with Chrome: (I can't paste
an image) http://picpaste.com/index-GQbn9OJ8.jpg
I really have no idea what could be wrong but I am really new at this. It
looks like maybe CSS isn't working at all but I'm not sure. The tutorial
did not have me add anything to "styles.css" but I referred to it multiple
times in my code so would that be a problem?
Thanks!
Java Exception Manager - Enterprise Level
Java Exception Manager - Enterprise Level
I am looking for an industrial strength FOSS logger for an Enterprise Java
application, before I embark on re-inventing the wheel...
We have all seen large apps that log exceptions (think SAPesque), but
beyond log4J type stuff. These features are some of what I am looking for:
Provide end-users with a reference number they can track or report on
log exceptions centrally (no, not like syslog, rather into a database)
create logs in a ticketing help-desk (Jira et al)
automatic statistics (these sections / name spaces are troublesome)
automatic characterization (these exceptions are like those exceptions)
automatic guidance - This exception has occurred 10x, it is being tracked
on this Jira and will be fixed on this release...
Operator console or API (REST is good..) see details users cannot see
Developer console or API - see even more details (like data hidden from
operators)
And anything else you can think of :)
I am looking for an industrial strength FOSS logger for an Enterprise Java
application, before I embark on re-inventing the wheel...
We have all seen large apps that log exceptions (think SAPesque), but
beyond log4J type stuff. These features are some of what I am looking for:
Provide end-users with a reference number they can track or report on
log exceptions centrally (no, not like syslog, rather into a database)
create logs in a ticketing help-desk (Jira et al)
automatic statistics (these sections / name spaces are troublesome)
automatic characterization (these exceptions are like those exceptions)
automatic guidance - This exception has occurred 10x, it is being tracked
on this Jira and will be fixed on this release...
Operator console or API (REST is good..) see details users cannot see
Developer console or API - see even more details (like data hidden from
operators)
And anything else you can think of :)
How to create a button toggle with two states, that behaves like a checkbox for form input
How to create a button toggle with two states, that behaves like a
checkbox for form input
I want to use bootstrap buttons
(http://getbootstrap.com/javascript/#buttons) to create a checkbox-like
input, with two states:
One that displays a button with "Option A selected"; and
The other that displays "Option B selected".
When the button is clicked, I want it to toggle between these two
messages, but also be able to pass the selection to the form.
What's the best way to do this? My first thought was to try and mark-up
data-toggle="button", but I'm not convinced this is the easiest way. Any
ideas?
checkbox for form input
I want to use bootstrap buttons
(http://getbootstrap.com/javascript/#buttons) to create a checkbox-like
input, with two states:
One that displays a button with "Option A selected"; and
The other that displays "Option B selected".
When the button is clicked, I want it to toggle between these two
messages, but also be able to pass the selection to the form.
What's the best way to do this? My first thought was to try and mark-up
data-toggle="button", but I'm not convinced this is the easiest way. Any
ideas?
EXCEL from static to dinamic
EXCEL from static to dinamic
I have the following piece of code. What it does is opening two excel
files, takes from each one the sum of a column and then put them in two
cells in the original file. My code opens the files as they are already
defined, but i want the script to ask me what files i want to choose.
Workbooks.Open Filename:="G:\Users\K.os\Desktop\roxana\m.xls"
Windows("roxana.xlsm").Activate
Workbooks.Open Filename:="G:\Users\K.os\Desktop\roxana\p.xls"
Windows("roxana.xlsm").Activate
Range("A4").Select
ActiveCell.FormulaR1C1 = "=SUM([m.xls]All!C25)"
Range("A5").Select
ActiveCell.FormulaR1C1 = "=SUM([m.xls]All!C28)"
Range("B4").Select
ActiveCell.FormulaR1C1 = "=SUM([p.xls]Treiro!C21)"
Range("B5").Select
ActiveCell.FormulaR1C1 = "=SUM([p.xls]Treiro!C23)"
Windows("p.xls").Activate
ActiveWindow.Close
Windows("m.xls").Activate
ActiveWindow.Close
Range("C4").Select
ActiveCell.FormulaR1C1 =
"=IF(EXACT(RC[-2],RC[-1]),""identice"",""greseala"")"
Range("C5").Select
ActiveCell.FormulaR1C1 =
"=IF(EXACT(RC[-2],RC[-1]),""identice"",""greseala"")"
I have the following piece of code. What it does is opening two excel
files, takes from each one the sum of a column and then put them in two
cells in the original file. My code opens the files as they are already
defined, but i want the script to ask me what files i want to choose.
Workbooks.Open Filename:="G:\Users\K.os\Desktop\roxana\m.xls"
Windows("roxana.xlsm").Activate
Workbooks.Open Filename:="G:\Users\K.os\Desktop\roxana\p.xls"
Windows("roxana.xlsm").Activate
Range("A4").Select
ActiveCell.FormulaR1C1 = "=SUM([m.xls]All!C25)"
Range("A5").Select
ActiveCell.FormulaR1C1 = "=SUM([m.xls]All!C28)"
Range("B4").Select
ActiveCell.FormulaR1C1 = "=SUM([p.xls]Treiro!C21)"
Range("B5").Select
ActiveCell.FormulaR1C1 = "=SUM([p.xls]Treiro!C23)"
Windows("p.xls").Activate
ActiveWindow.Close
Windows("m.xls").Activate
ActiveWindow.Close
Range("C4").Select
ActiveCell.FormulaR1C1 =
"=IF(EXACT(RC[-2],RC[-1]),""identice"",""greseala"")"
Range("C5").Select
ActiveCell.FormulaR1C1 =
"=IF(EXACT(RC[-2],RC[-1]),""identice"",""greseala"")"
Changing Span Class not working
Changing Span Class not working
I have the following code in a webpage and for some reason unbeknown to me
it is not working, I have 2 methods to try to change the spans class
attribute but it is not working, can someone please point be towards where
I have gone wrong? :)
<script language="javascript">
function ChangeClass()
{
alert("Clicked!");
document.getElementById("Search").className = "SC-non-activeTab";
alert("Changed class!");
//does not work
}
window.onload = function()
{
document.getElementById("Search").addEventListener('click' ,
ChangeClass );
var elm = document.getElementById("Search").className;
alert("LOADED PAGE " + elm);
//this works
}
function someFunction(abc,elm) {
alert(abc + "/" + elm);
//does not work
}
</script>
<div class="tabs" id="tabs">
<div class="tabOutline" id="outline" >
<span class="activeTab" id="Search"
onclick="someFunction('two',this.className)">
Search
</span>
</div>
</div>
I have the following code in a webpage and for some reason unbeknown to me
it is not working, I have 2 methods to try to change the spans class
attribute but it is not working, can someone please point be towards where
I have gone wrong? :)
<script language="javascript">
function ChangeClass()
{
alert("Clicked!");
document.getElementById("Search").className = "SC-non-activeTab";
alert("Changed class!");
//does not work
}
window.onload = function()
{
document.getElementById("Search").addEventListener('click' ,
ChangeClass );
var elm = document.getElementById("Search").className;
alert("LOADED PAGE " + elm);
//this works
}
function someFunction(abc,elm) {
alert(abc + "/" + elm);
//does not work
}
</script>
<div class="tabs" id="tabs">
<div class="tabOutline" id="outline" >
<span class="activeTab" id="Search"
onclick="someFunction('two',this.className)">
Search
</span>
</div>
</div>
PHP filter validate, returning on first occurrence of an error
PHP filter validate, returning on first occurrence of an error
I currently using the basic PHP functions like isset & is_numeric to
validate user input. I am looking to update my code to the new PHP filter
functions introduced with PHP 5.2. I have forms with multiple inputs and I
am looking for a way to use the filter_input_array function so that it if
an error is found before going through all the validations false is
returned. For example.
If I validate a number & a email. If the number is in-valid, false should
be returned without validating the email. Is there a way to achieve this
using filter_input_array.
I currently using the basic PHP functions like isset & is_numeric to
validate user input. I am looking to update my code to the new PHP filter
functions introduced with PHP 5.2. I have forms with multiple inputs and I
am looking for a way to use the filter_input_array function so that it if
an error is found before going through all the validations false is
returned. For example.
If I validate a number & a email. If the number is in-valid, false should
be returned without validating the email. Is there a way to achieve this
using filter_input_array.
Friday, 13 September 2013
In Common-Lisp, how can I get a slice of a `grid:vector`?
In Common-Lisp, how can I get a slice of a `grid:vector`?
In the manual of Antik, there're grid:subgrid and grid:slice for matrices,
but I found nothing for vectors. And grid:subgrid grid:slice cannot be
applied to vectors, there are errors.
In the manual of Antik, there're grid:subgrid and grid:slice for matrices,
but I found nothing for vectors. And grid:subgrid grid:slice cannot be
applied to vectors, there are errors.
View csv data file after import it via email attachment using xcode
View csv data file after import it via email attachment using xcode
I find this tutorial very helpful To import csv file via attachment
http://blog.spritebandits.com/2011/12/14/importing-csv-data-file-into-an-ios-app-via-email-attachment/
But still I don't know how to call specefic tableview in my app to view
the content.
I find this tutorial very helpful To import csv file via attachment
http://blog.spritebandits.com/2011/12/14/importing-csv-data-file-into-an-ios-app-via-email-attachment/
But still I don't know how to call specefic tableview in my app to view
the content.
which is faster moving image on canvas or moving whole canvas
which is faster moving image on canvas or moving whole canvas
Lets say i am making a game in which there is background that is dynamic.
Now in a setup where i am using multiple canvas, so one canvas dedicated
for background as it doesn't need to update as often, Also Map is not
infinite it's big but not that big.
So in should i move redraw the map at every move. Or move the whole canvas
which then would act like a layer.
Any ideas?
Will use css to clip map to size of game.
While it's true i have not tried anything but that is because i dont know
what to try. I'd make both but wont know which one is working. Basically i
am clueless in bench marking sector.
Lets say i am making a game in which there is background that is dynamic.
Now in a setup where i am using multiple canvas, so one canvas dedicated
for background as it doesn't need to update as often, Also Map is not
infinite it's big but not that big.
So in should i move redraw the map at every move. Or move the whole canvas
which then would act like a layer.
Any ideas?
Will use css to clip map to size of game.
While it's true i have not tried anything but that is because i dont know
what to try. I'd make both but wont know which one is working. Basically i
am clueless in bench marking sector.
UILocalNotification with various alert body
UILocalNotification with various alert body
How Can I repeat UILocalNotification with various alert body?
For example:
UILocalNotification *notif = [[UILocalNotification alloc] init];
notif.alertBody = @"Hello";
notif.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
By using this code the notification will be repeated daily, how can I
repeat the notification daily with different alert body each day?
Thanks.
How Can I repeat UILocalNotification with various alert body?
For example:
UILocalNotification *notif = [[UILocalNotification alloc] init];
notif.alertBody = @"Hello";
notif.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
By using this code the notification will be repeated daily, how can I
repeat the notification daily with different alert body each day?
Thanks.
Why does overriding doubleclicked() method of ITextDoubleClickStrategy in eclipse remove syntax highlighting?
Why does overriding doubleclicked() method of ITextDoubleClickStrategy in
eclipse remove syntax highlighting?
I am implementing custom sql editor using eclipse rcp. My requirement is
to highlight keywords when user double clicks on a word.
Problem is that already existing feature for syntax highlighting is gone
when I override doubleclicked() method by extending
DefaultTextDoubleClickStrategy and implementing ITextDoubleClickStrategy.
Why does overriding doubleclicked() method turns off syntax highlighting?
What is the solution for this?
Any help is greatly appreciated.
eclipse remove syntax highlighting?
I am implementing custom sql editor using eclipse rcp. My requirement is
to highlight keywords when user double clicks on a word.
Problem is that already existing feature for syntax highlighting is gone
when I override doubleclicked() method by extending
DefaultTextDoubleClickStrategy and implementing ITextDoubleClickStrategy.
Why does overriding doubleclicked() method turns off syntax highlighting?
What is the solution for this?
Any help is greatly appreciated.
Thursday, 12 September 2013
PHP Email a list to user
PHP Email a list to user
I have a php script that has taken user input from a html page and created
a list. I want to be able to email that list to the user, and already have
the user's email address from the html page.
So far, when the user hits 'email me the list' I can get the program to
automatically open the person's outlook program. I want to be able to copy
and paste the list into the email document, or at least copy and paste the
link to the page where the list exists.
Any help would be appreciated.
Thanks
Andrew
EDIT:
HTML FORM:
<strong>Email Address</strong><FONT COLOR="#FF0000">*</FONT>:
<input type="text" name="emailaddress2"/>
<input type="submit" value="Submit"/>
PHP :
<a href="mailto:<?php echo $_POST['emailaddress']; ?>">Email me List</a>
(So basically I want the list pasted into the email)
I have a php script that has taken user input from a html page and created
a list. I want to be able to email that list to the user, and already have
the user's email address from the html page.
So far, when the user hits 'email me the list' I can get the program to
automatically open the person's outlook program. I want to be able to copy
and paste the list into the email document, or at least copy and paste the
link to the page where the list exists.
Any help would be appreciated.
Thanks
Andrew
EDIT:
HTML FORM:
<strong>Email Address</strong><FONT COLOR="#FF0000">*</FONT>:
<input type="text" name="emailaddress2"/>
<input type="submit" value="Submit"/>
PHP :
<a href="mailto:<?php echo $_POST['emailaddress']; ?>">Email me List</a>
(So basically I want the list pasted into the email)
get the option chosen from a form in html and assign it to php variable
get the option chosen from a form in html and assign it to php variable
I need to collect the option chosen from a form in html and use it to
increment a value in a mysql database. The idea is: chose your name (from
the html form, already populated by mysql) chose name of your opponent
(from the html form, already populated by mysql) click submit to:
increment one victory to you and increment one defeat to your opponent.
I have the following code:
echo '<select name="tabela">';
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['Nome'] . "'>" . $row['Nome'] . "</option>";
}
echo '</select>';
echo $teste=$_POST['tabela'];
if ($teste=='Filipe')
{
$sql="UPDATE Jogadores SET Vitorias=Vitorias+1 WHERE Nome='Filipe'";
mysql_select_db('aventino');
$retval = mysql_query( $sql, $conn );
}
It populates the html form but I can't get 1) the name that is there by
default 2) the name that the user chooses. I have been trying lots of
solutions and nothing seems to exist in order to know and extract which
option is chosen, before clicking submit button!
Many thanks F
I need to collect the option chosen from a form in html and use it to
increment a value in a mysql database. The idea is: chose your name (from
the html form, already populated by mysql) chose name of your opponent
(from the html form, already populated by mysql) click submit to:
increment one victory to you and increment one defeat to your opponent.
I have the following code:
echo '<select name="tabela">';
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['Nome'] . "'>" . $row['Nome'] . "</option>";
}
echo '</select>';
echo $teste=$_POST['tabela'];
if ($teste=='Filipe')
{
$sql="UPDATE Jogadores SET Vitorias=Vitorias+1 WHERE Nome='Filipe'";
mysql_select_db('aventino');
$retval = mysql_query( $sql, $conn );
}
It populates the html form but I can't get 1) the name that is there by
default 2) the name that the user chooses. I have been trying lots of
solutions and nothing seems to exist in order to know and extract which
option is chosen, before clicking submit button!
Many thanks F
How can I perform a background check on iOS?
How can I perform a background check on iOS?
I am needing to perform a very simple background check for my iOS app. It
needs to just make one call to my web server and check the number it
retrieves against something in my app. Is it possible to do that kind of
background check? If so what can I do to put it together?
I am needing to perform a very simple background check for my iOS app. It
needs to just make one call to my web server and check the number it
retrieves against something in my app. Is it possible to do that kind of
background check? If so what can I do to put it together?
Finding element using Selenium Web Driver in C#
Finding element using Selenium Web Driver in C#
So I've been working learning how to use Selenium in C# to do some
automated testing for a project. However, I've hit a roadblock on this
one. I have been trying to figure out of way to click the following link
on this webpage.
Here is what I'm trying to target:
<A class='PortalLink'
HREF="https://mywebsite.com/myprograms/launchprogram.jsp?"
onClick="setUser('login','password');"><span>MyProgram</span></A>
Searching by ClassName hasn't turned up anything. Although there are
multiples, I just wanted to see if I could detect the presence of them.
By.ClassName("PortalLink")
I tried a href based search using CssSelector, but this failed as well.
By.CssSelector("[href*='https://mywebsite.com/myprograms/launchprogram.jsp?']")
Lastly, I tried to use XPath and search by class and span content, but
this failed to find the link as well.
By.XPath("//A[contains(@class,'PortalLink') and span[text()='MyProgram']]")))
The webpage in question contains 2 frames which I've tried both.
I'm waiting 200 seconds before timing out. What am I doing incorrectly?
Thanks in advance for any help!
So I've been working learning how to use Selenium in C# to do some
automated testing for a project. However, I've hit a roadblock on this
one. I have been trying to figure out of way to click the following link
on this webpage.
Here is what I'm trying to target:
<A class='PortalLink'
HREF="https://mywebsite.com/myprograms/launchprogram.jsp?"
onClick="setUser('login','password');"><span>MyProgram</span></A>
Searching by ClassName hasn't turned up anything. Although there are
multiples, I just wanted to see if I could detect the presence of them.
By.ClassName("PortalLink")
I tried a href based search using CssSelector, but this failed as well.
By.CssSelector("[href*='https://mywebsite.com/myprograms/launchprogram.jsp?']")
Lastly, I tried to use XPath and search by class and span content, but
this failed to find the link as well.
By.XPath("//A[contains(@class,'PortalLink') and span[text()='MyProgram']]")))
The webpage in question contains 2 frames which I've tried both.
I'm waiting 200 seconds before timing out. What am I doing incorrectly?
Thanks in advance for any help!
Error 1064 on MySQL 5 database
Error 1064 on MySQL 5 database
I keep getting an error while trying to create a stored procedure. I am
using the following SQL:
CREATE PROCEDURE sp_add_mailing_list_item
(
IN paramA VARCHAR(50) ,
IN paramB VARCHAR(50) ,
IN paramC VARCHAR(255) ,
IN paramD DATE ,
IN paramE VARCHAR(255) ,
)
BEGIN
INSERT INTO MailingList
(
firstName ,
lastName ,
email ,
dob ,
notes
)
VALUES
(
paramA ,
paramB ,
paramC ,
paramD ,
paramE
)
END
I am pretty well versed in SQL (for MSSQL Server), but this is just
eluding me. Any help is appreciated. I have tried using a delimiter, but
that brings up all kinds of other errors.
Thanks.
I keep getting an error while trying to create a stored procedure. I am
using the following SQL:
CREATE PROCEDURE sp_add_mailing_list_item
(
IN paramA VARCHAR(50) ,
IN paramB VARCHAR(50) ,
IN paramC VARCHAR(255) ,
IN paramD DATE ,
IN paramE VARCHAR(255) ,
)
BEGIN
INSERT INTO MailingList
(
firstName ,
lastName ,
email ,
dob ,
notes
)
VALUES
(
paramA ,
paramB ,
paramC ,
paramD ,
paramE
)
END
I am pretty well versed in SQL (for MSSQL Server), but this is just
eluding me. Any help is appreciated. I have tried using a delimiter, but
that brings up all kinds of other errors.
Thanks.
Dice Game, making each Die roll differently
Dice Game, making each Die roll differently
Okay, im just about done with my exercise and stuck on how to get each
dice to roll their own individual randomly generated number. The program
does in fact roll random numbers, it's just every time you re-roll both
dice always roll the same exact numbers. And this simple but yet head
scratching problem occurred, for some reason i'm also having
cout << "Adding both dices up you rolled a total of: " << totalScore() <<
"." << endl;
I was also told by a class mate that my faceValue was an illegal value and
should be set to a legal value. I didn't quite get what he meant and I'm
sure it'll knock off (not a lot) a few of my grade.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <ctime>
using namespace std;
class PairOfDice
{
private:
int diceOne;
int diceTwo;
int score;
int faceVaule;
public:
PairOfDice(){
srand(time(NULL));
roll();
}
void roll(){
diceOne = (rand() % 6) + 1;
diceTwo = (rand() % 6) + 1;
setdiceOne(diceOne);
setdiceTwo(diceTwo);
}
void setdiceOne(int value){
faceVaule = value;
}
int getdiceOne(){
return faceVaule;
}
void setdiceTwo(int value){
faceVaule = value;
}
int getdiceTwo(){
return faceVaule;
}
void totalScore(){
score = diceOne + diceTwo;
}
void display(){
cout << "The first Dice rolled a " << getdiceOne() << " ." << endl;
cout << "The second Dice rolled a " << getdiceTwo() << " ." << endl;
// adding both dices gives an: No operator " < < " matches these operands
cout << "Adding both dices up you rolled a total of: " << totalScore()
<< "." << endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
PairOfDice game;
game.roll();
game.display();
game.totalScore();
return 0;
}
Okay, im just about done with my exercise and stuck on how to get each
dice to roll their own individual randomly generated number. The program
does in fact roll random numbers, it's just every time you re-roll both
dice always roll the same exact numbers. And this simple but yet head
scratching problem occurred, for some reason i'm also having
cout << "Adding both dices up you rolled a total of: " << totalScore() <<
"." << endl;
I was also told by a class mate that my faceValue was an illegal value and
should be set to a legal value. I didn't quite get what he meant and I'm
sure it'll knock off (not a lot) a few of my grade.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <ctime>
using namespace std;
class PairOfDice
{
private:
int diceOne;
int diceTwo;
int score;
int faceVaule;
public:
PairOfDice(){
srand(time(NULL));
roll();
}
void roll(){
diceOne = (rand() % 6) + 1;
diceTwo = (rand() % 6) + 1;
setdiceOne(diceOne);
setdiceTwo(diceTwo);
}
void setdiceOne(int value){
faceVaule = value;
}
int getdiceOne(){
return faceVaule;
}
void setdiceTwo(int value){
faceVaule = value;
}
int getdiceTwo(){
return faceVaule;
}
void totalScore(){
score = diceOne + diceTwo;
}
void display(){
cout << "The first Dice rolled a " << getdiceOne() << " ." << endl;
cout << "The second Dice rolled a " << getdiceTwo() << " ." << endl;
// adding both dices gives an: No operator " < < " matches these operands
cout << "Adding both dices up you rolled a total of: " << totalScore()
<< "." << endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
PairOfDice game;
game.roll();
game.display();
game.totalScore();
return 0;
}
Convert large CSV files to JSON
Convert large CSV files to JSON
I don't mind if this is done with a separate program, with Excel, in
NodeJS or in a web app.
It's exactly the same problem as described here:
Large CSV to JSON/Object in Node.js
It seems that the OP didn't get that answer to work (yet accepted it
anyway?). I've tried working with it but can't seem to get it to work
either.
In short: I'm working with a ~50,000 row CSV and I want to convert it to
JSON. I've tried just about every online "csv to json" webapp out there,
all crash with this large of a dataset.
I've tried many Node CSV to JSON modules but, again, they all crash. The
csvtojson module seemed promising, but I got this error: FATAL ERROR: JS
Allocation failed - process out of memory.
What on earth can I do to get this data in a useable format? As above, I
don't mind if it's an application, something that works within Excel, a
webapp or a Node module, so long as I either get a .JSON file or an object
that I can work with within Node.
Any ideas?
I don't mind if this is done with a separate program, with Excel, in
NodeJS or in a web app.
It's exactly the same problem as described here:
Large CSV to JSON/Object in Node.js
It seems that the OP didn't get that answer to work (yet accepted it
anyway?). I've tried working with it but can't seem to get it to work
either.
In short: I'm working with a ~50,000 row CSV and I want to convert it to
JSON. I've tried just about every online "csv to json" webapp out there,
all crash with this large of a dataset.
I've tried many Node CSV to JSON modules but, again, they all crash. The
csvtojson module seemed promising, but I got this error: FATAL ERROR: JS
Allocation failed - process out of memory.
What on earth can I do to get this data in a useable format? As above, I
don't mind if it's an application, something that works within Excel, a
webapp or a Node module, so long as I either get a .JSON file or an object
that I can work with within Node.
Any ideas?
Wednesday, 11 September 2013
How to Fetch Images from hard drive connected over wifi to my android tablet
How to Fetch Images from hard drive connected over wifi to my android tablet
I am facing issue regarding fetching images stored in wifi enabled hard
drive through my android tablet. My Android tablet has been connected to
that hard drive through wifi and I can watch it's all directories and file
listing but I am not able to display images in imageview. Please suggest
how to do that?
//url= "smb://www.seagatewireless.com/Public-01/Photos/Sample/01 Sample.jpg"
SmbFile[] domains; try {
domains = (new SmbFile(url)).listFiles();
for (int i = 0; i < domains.length; i++) {
System.out.println(domains[i]);
if(domains[i].isDirectory() || domains[i].isFile())
tempal.add(domains[i].toString());
}
} catch (SmbException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
System.out.println("MalformedURLException EXCEPTION===== "+arg0[0]);
e.printStackTrace();
}
Please help...
I am facing issue regarding fetching images stored in wifi enabled hard
drive through my android tablet. My Android tablet has been connected to
that hard drive through wifi and I can watch it's all directories and file
listing but I am not able to display images in imageview. Please suggest
how to do that?
//url= "smb://www.seagatewireless.com/Public-01/Photos/Sample/01 Sample.jpg"
SmbFile[] domains; try {
domains = (new SmbFile(url)).listFiles();
for (int i = 0; i < domains.length; i++) {
System.out.println(domains[i]);
if(domains[i].isDirectory() || domains[i].isFile())
tempal.add(domains[i].toString());
}
} catch (SmbException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
System.out.println("MalformedURLException EXCEPTION===== "+arg0[0]);
e.printStackTrace();
}
Please help...
Ruby, write variable text into object text
Ruby, write variable text into object text
I know the question is most likely silly, but I don't understand Ruby
well, or in programming in general, googled as much as I could, but
couldnt find anything, dont know where else to ask. So, I need to make QT4
app but the problem is that when you click a button, the text from a
variable need to be written into object text. Cant understand why the
following doesn't work:
@questn="hi"
reply.connect(SIGNAL(:clicked)) do
@numberquestion.text = Qt::Application.translate("testapp",
"#{questn}", nil, Qt::Application::UnicodeUTF8)
end
May be I should use Signals, Slots, and methods?
I know the question is most likely silly, but I don't understand Ruby
well, or in programming in general, googled as much as I could, but
couldnt find anything, dont know where else to ask. So, I need to make QT4
app but the problem is that when you click a button, the text from a
variable need to be written into object text. Cant understand why the
following doesn't work:
@questn="hi"
reply.connect(SIGNAL(:clicked)) do
@numberquestion.text = Qt::Application.translate("testapp",
"#{questn}", nil, Qt::Application::UnicodeUTF8)
end
May be I should use Signals, Slots, and methods?
Other elements disapper after page is loaded?
Other elements disapper after page is loaded?
I want call function javascript with Jquery. But after page is loaded, all
other elements are disappeared. You can see my code here. I need your fix.
<script src='http://code.jquery.com/jquery-1.10.1.min.js'></script>
<script type="text/javascript">
$(document).ready(function() {
$("#recentpost").each(function(){
mytext = "Food";
sticky();
});
});
</script>
<script type="text/javascript">
function sticky(){
document.write(""+mytext+"");
}
</script>
<div id="recentpost"></div>
<div>something here disappear after loaded page</div>
Thank for your help
I want call function javascript with Jquery. But after page is loaded, all
other elements are disappeared. You can see my code here. I need your fix.
<script src='http://code.jquery.com/jquery-1.10.1.min.js'></script>
<script type="text/javascript">
$(document).ready(function() {
$("#recentpost").each(function(){
mytext = "Food";
sticky();
});
});
</script>
<script type="text/javascript">
function sticky(){
document.write(""+mytext+"");
}
</script>
<div id="recentpost"></div>
<div>something here disappear after loaded page</div>
Thank for your help
Subscribe to:
Comments (Atom)