UILabel with multiple lines and Auto Resizing Masks (UIViewAutoresizingMask)
I have a problem with UILabels that contain text that is spread on
multiple lines. It's nested into a fullscreen UIView that has autoresizing
mask as well:
view.autoresizingMask =
UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
I'd like to add autoresizingMask on the label
label.autoresizingMask =
UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
But the problem is, this doesn't work as I'd like it to work. If I do
this, after rotating the screen (which changes size of the view) then the
label has smaller height and some of the text is cut off. (It doesn't
display the whole text). If I don't add UIViewAutoresizingFlexibleHeight,
then the label after rotation has big gaps above and under text (And I
don't want that). I tried adding also
UIViewAutoresizingFlexibleBottomMargin, but this doesn't help, as still
not whole text is displayed. I really don't know how to make this work,
I'm almost convinced autoresizing masks don't work with multiline
uilabels... Any idea on this would be appreciated. Thanks :)
Thursday, 3 October 2013
Wednesday, 2 October 2013
Unclear Compile-time Java Exception
Unclear Compile-time Java Exception
I'm running into peculiar behavior in terms of compile time exceptions
with the following code (I'm using JDK7):
public class classA { public void foo( List<Object> o ){} }
public classB<T>{ public void bar( List<Object> o ){} }
We consider the the following test object
List<String> o = new ArrayList<String>();
There is no way to get java to compile by passing o as a parameter to the
method foo of class classA, and as far as I can figure, there shouldn't
be.
Now say we're in the main method of classB and try to just call bar
without instantiating an instance of classB to call it on. I might expect
to get a non-static method can't be called from static context compilation
error like I would if I tried to pull that in classA, but instead I get a
conversion invocation error. That, makes sense - the types don't line up.
However if I try call bar from a nonstatic context, as in
ClassB b = new classB();
b.bar( o );
Java seems to forgive me for not lining up the types and runs the code no
problem. I haven't done anything to fix the issue of typcasting, so why
does Java let this code execute, where it wouldn't with classA?
I'm running into peculiar behavior in terms of compile time exceptions
with the following code (I'm using JDK7):
public class classA { public void foo( List<Object> o ){} }
public classB<T>{ public void bar( List<Object> o ){} }
We consider the the following test object
List<String> o = new ArrayList<String>();
There is no way to get java to compile by passing o as a parameter to the
method foo of class classA, and as far as I can figure, there shouldn't
be.
Now say we're in the main method of classB and try to just call bar
without instantiating an instance of classB to call it on. I might expect
to get a non-static method can't be called from static context compilation
error like I would if I tried to pull that in classA, but instead I get a
conversion invocation error. That, makes sense - the types don't line up.
However if I try call bar from a nonstatic context, as in
ClassB b = new classB();
b.bar( o );
Java seems to forgive me for not lining up the types and runs the code no
problem. I haven't done anything to fix the issue of typcasting, so why
does Java let this code execute, where it wouldn't with classA?
How to map two String[] to each other
How to map two String[] to each other
I'm developing an Android app. I'm mapping two arrays to each other with a
HashMap. I change these arrays into String[]'s, and map them together. It
should return values, but it returns null. I'm not sure where I'm going
wrong. I've searched online, but I haven't found anything useful. My code
is below:
Part of StationList.java
Spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
String selectedValue =
arg0.getItemAtPosition(arg2).toString();
String[] Yellow_ID =
getResources().getStringArray(R.array.Yellow_ID);
String[] Yellow_Li =
getResources().getStringArray(R.array.Yellow_Line);
Map<String[], String[]> myMap = new HashMap<String[],
String[]>();
myMap.put(Yellow_Li, Yellow_ID);
String[] value = myMap.get(selectedValue);
tv12.setText(String.valueOf (value));
}
Value returns null in the TextView. I think this is due to the values not
mapping to each other. I would appreciate any help you could give me.
I'm developing an Android app. I'm mapping two arrays to each other with a
HashMap. I change these arrays into String[]'s, and map them together. It
should return values, but it returns null. I'm not sure where I'm going
wrong. I've searched online, but I haven't found anything useful. My code
is below:
Part of StationList.java
Spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
String selectedValue =
arg0.getItemAtPosition(arg2).toString();
String[] Yellow_ID =
getResources().getStringArray(R.array.Yellow_ID);
String[] Yellow_Li =
getResources().getStringArray(R.array.Yellow_Line);
Map<String[], String[]> myMap = new HashMap<String[],
String[]>();
myMap.put(Yellow_Li, Yellow_ID);
String[] value = myMap.get(selectedValue);
tv12.setText(String.valueOf (value));
}
Value returns null in the TextView. I think this is due to the values not
mapping to each other. I would appreciate any help you could give me.
How to separate a string into 4 separate arrays
How to separate a string into 4 separate arrays
Ok so to start off i'm a beginner to objective c. I got a project where
i'm suppose to take a csv file and read it into the system into 4 separate
arrays, (City, Country, Latitude, and Longitude. My first question is can
you use the old school string instead of NNString. I did the same project
in c++ and this is what i got.
`ifstream file("worldcities.csv");
getline(file, temporay);
//inputs the file into 4 arrays for each catergories
for (i=0;getline(file,(cities[i]),',');i++)
{
getline(file, countries[i], ',');
getline(file, latitude[i], ',') ;
getline(file, longitude[i]); }'
How can i get the same outcome in Objective c? I tried fgets instead of
getline but i'm still not familiar with it so thats why i come to you
guys. I really do appreciate the help
Ok so to start off i'm a beginner to objective c. I got a project where
i'm suppose to take a csv file and read it into the system into 4 separate
arrays, (City, Country, Latitude, and Longitude. My first question is can
you use the old school string instead of NNString. I did the same project
in c++ and this is what i got.
`ifstream file("worldcities.csv");
getline(file, temporay);
//inputs the file into 4 arrays for each catergories
for (i=0;getline(file,(cities[i]),',');i++)
{
getline(file, countries[i], ',');
getline(file, latitude[i], ',') ;
getline(file, longitude[i]); }'
How can i get the same outcome in Objective c? I tried fgets instead of
getline but i'm still not familiar with it so thats why i come to you
guys. I really do appreciate the help
#EANF#
#EANF#
Can anyone explain me how to connect Java with MySQL?
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
Connection conn = null;
...
try {
conn =
DriverManager.getConnection("jdbc:mysql://localhost/test?" +
"user=monty&password=greatsqldb");
}
catch (SQLException ex)
{
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
This is how i made it but mine is windows authintication and not sql
server authentication. So how to complete the connection with windows
authentication??
Can anyone explain me how to connect Java with MySQL?
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
Connection conn = null;
...
try {
conn =
DriverManager.getConnection("jdbc:mysql://localhost/test?" +
"user=monty&password=greatsqldb");
}
catch (SQLException ex)
{
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
This is how i made it but mine is windows authintication and not sql
server authentication. So how to complete the connection with windows
authentication??
Tuesday, 1 October 2013
Why does sizeToFit not work when trying to vertically align my UILabel? It just stays in the center
Why does sizeToFit not work when trying to vertically align my UILabel? It
just stays in the center
I was reading this post for advice on how to vertically align text within
a UILabel, and the top comment seemed to present a great solution.
I have my UILabel, and I set number of lines to 0. Then in viewDidLoad for
the View Controller it's a part of, I called sizeToFit on it, but it still
only occupies the middle.
It looks like this in Interface Builder:
And looks the exact same when I run it, the text is still really far away
from the navigation bar when I'd prefer it to be very close, preferably at
the top of that outline box.
What am I doing wrong?
just stays in the center
I was reading this post for advice on how to vertically align text within
a UILabel, and the top comment seemed to present a great solution.
I have my UILabel, and I set number of lines to 0. Then in viewDidLoad for
the View Controller it's a part of, I called sizeToFit on it, but it still
only occupies the middle.
It looks like this in Interface Builder:
And looks the exact same when I run it, the text is still really far away
from the navigation bar when I'd prefer it to be very close, preferably at
the top of that outline box.
What am I doing wrong?
CORS Options response working in IISExpress but not IIS7.5
CORS Options response working in IISExpress but not IIS7.5
I'm trying to get a CORS request to work however I've been running into
problems when running it on a deployed server
I'm using thinktecture identity model to set up my CORS which works
beautifully when running on a local instance of IIS-express but fails on a
proper IIS 7.5 version of the site.
This is the local version and works perfectly
OPTIONS http://local.api.mysite.org:57339/api/search HTTP/1.1
Host: local.api.mysite.org:57339
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://local.mysite.org:62747
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/29.0.1547.76 Safari/537.36
Access-Control-Request-Headers: accept, origin, content-type
Accept: */*
Referer: http://local.mysite.org:62747/search
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
=======
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Server: Microsoft-IIS/8.0
Access-Control-Allow-Origin: http://local.mysite.org:62747
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: accept,origin,content-type
X-AspNet-Version: 4.0.30319
X-SourceFiles:
=?UTF-8?B?QzpcR2l0XGxpdmVzLWRldmVsb3BcQnJpZ2h0U29saWQuTGl2ZXMuV2ViQXBpXGFwaVxzZWFyY2g=?=
X-Powered-By: ASP.NET
Date: Tue, 01 Oct 2013 21:28:06 GMT
Content-Length: 0
This is the deployed version and fails
OPTIONS http://betatest.api.mysite.org/api/search HTTP/1.1
Host: betatest.api.mysite.org
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://betatest.mysite.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/29.0.1547.76 Safari/537.36
Access-Control-Request-Headers: accept, origin, content-type
Accept: */*
Referer: http://betatest.mysite.org/search
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
=======
HTTP/1.1 200 OK
Allow: OPTIONS, TRACE, GET, HEAD, POST
Server: Microsoft-IIS/7.5
Public: OPTIONS, TRACE, GET, HEAD, POST
X-Powered-By: ASP.NET
Date: Tue, 01 Oct 2013 21:31:24 GMT
Content-Length: 0
The GETS work fine on the deployed instance but not the POSTS.
It appears like the OPTIONS preflight response is different between
IISExpress and IIS7.5
I've tried cleaning the cache but that's not made a difference.
I'm trying to get a CORS request to work however I've been running into
problems when running it on a deployed server
I'm using thinktecture identity model to set up my CORS which works
beautifully when running on a local instance of IIS-express but fails on a
proper IIS 7.5 version of the site.
This is the local version and works perfectly
OPTIONS http://local.api.mysite.org:57339/api/search HTTP/1.1
Host: local.api.mysite.org:57339
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://local.mysite.org:62747
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/29.0.1547.76 Safari/537.36
Access-Control-Request-Headers: accept, origin, content-type
Accept: */*
Referer: http://local.mysite.org:62747/search
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
=======
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Server: Microsoft-IIS/8.0
Access-Control-Allow-Origin: http://local.mysite.org:62747
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: accept,origin,content-type
X-AspNet-Version: 4.0.30319
X-SourceFiles:
=?UTF-8?B?QzpcR2l0XGxpdmVzLWRldmVsb3BcQnJpZ2h0U29saWQuTGl2ZXMuV2ViQXBpXGFwaVxzZWFyY2g=?=
X-Powered-By: ASP.NET
Date: Tue, 01 Oct 2013 21:28:06 GMT
Content-Length: 0
This is the deployed version and fails
OPTIONS http://betatest.api.mysite.org/api/search HTTP/1.1
Host: betatest.api.mysite.org
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://betatest.mysite.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/29.0.1547.76 Safari/537.36
Access-Control-Request-Headers: accept, origin, content-type
Accept: */*
Referer: http://betatest.mysite.org/search
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
=======
HTTP/1.1 200 OK
Allow: OPTIONS, TRACE, GET, HEAD, POST
Server: Microsoft-IIS/7.5
Public: OPTIONS, TRACE, GET, HEAD, POST
X-Powered-By: ASP.NET
Date: Tue, 01 Oct 2013 21:31:24 GMT
Content-Length: 0
The GETS work fine on the deployed instance but not the POSTS.
It appears like the OPTIONS preflight response is different between
IISExpress and IIS7.5
I've tried cleaning the cache but that's not made a difference.
Surprising identities / equations math.stackexchange.com
Surprising identities / equations – math.stackexchange.com
What are some surprising equations / identities that you have seen, which
you would not have expected? This could be complex numbers, trigonometric
identities, combinatorial results, algebraic ...
What are some surprising equations / identities that you have seen, which
you would not have expected? This could be complex numbers, trigonometric
identities, combinatorial results, algebraic ...
Remove Unity And Replace With Something Cool
Remove Unity And Replace With Something Cool
I need to "Safely" remove Unity 12.04 and replace it with something cool.
I have looked and I have tried a couple of things (one which cause a
complete re-install of Ubuntu). So maybe someone else can help.
I am a Tinkerer! I Love Customization! I get bored and have to constantly
change things, and Unity just won't give me that FREEDOM!! Don't get me
wrong, I love Unity for something else, and there are a lot of great
things about it. But it is just NOT for me...
Any suggestions would be greatly appreciated...
What I am looking for:
"SAFE REMOVAL", of Unity, and install of "Something New"...
As much customization as possible...
Bells and Whistles!
Please Help! Unity is making me crazy...
I need to "Safely" remove Unity 12.04 and replace it with something cool.
I have looked and I have tried a couple of things (one which cause a
complete re-install of Ubuntu). So maybe someone else can help.
I am a Tinkerer! I Love Customization! I get bored and have to constantly
change things, and Unity just won't give me that FREEDOM!! Don't get me
wrong, I love Unity for something else, and there are a lot of great
things about it. But it is just NOT for me...
Any suggestions would be greatly appreciated...
What I am looking for:
"SAFE REMOVAL", of Unity, and install of "Something New"...
As much customization as possible...
Bells and Whistles!
Please Help! Unity is making me crazy...
Monday, 30 September 2013
Unity bad workspace switch clicking on unity panel icon
Unity bad workspace switch clicking on unity panel icon
I think I've found a bug in Unity, Ubuntu 12.10.
It's really annoying to me so I'd like to report it.
I'm asking where to report it and if it hasn't been fixed in 13.04 or
13.10 yet.
Steps to reproduce:
1) Open and maximize a window on workspace 1
2) Switch to workspace 2, open another window and align it to the right
side (Ctrl++➡)
3) Switch back to workspace 1 and click on the unity panel icon of the app
on workspace 2
What is supposed to happen:
Unity should switch to workspace 2 and add focus to the app running here.
What actually happens:
Unity stays at workspace 1 and moves the right-alligned window on
workspace 2 to the right, resulting it to appear at the left side of
workspace 1.
Additional information: It's not necessary to open a window on workspace 1
to reproduce this bug, I did it for clarity purposes. This bug can be
avoided by moving the window on workspace 2 about 10 pixels to the left:
Thanks for the support :)
I think I've found a bug in Unity, Ubuntu 12.10.
It's really annoying to me so I'd like to report it.
I'm asking where to report it and if it hasn't been fixed in 13.04 or
13.10 yet.
Steps to reproduce:
1) Open and maximize a window on workspace 1
2) Switch to workspace 2, open another window and align it to the right
side (Ctrl++➡)
3) Switch back to workspace 1 and click on the unity panel icon of the app
on workspace 2
What is supposed to happen:
Unity should switch to workspace 2 and add focus to the app running here.
What actually happens:
Unity stays at workspace 1 and moves the right-alligned window on
workspace 2 to the right, resulting it to appear at the left side of
workspace 1.
Additional information: It's not necessary to open a window on workspace 1
to reproduce this bug, I did it for clarity purposes. This bug can be
avoided by moving the window on workspace 2 about 10 pixels to the left:
Thanks for the support :)
Dual boot windows 8 & ubuntu
Dual boot windows 8 & ubuntu
I have 3 partions with windows 8 installed in the first one then i
installed ubuntu in the second one.By the end of the installation, my pc
reboot on ubuntu and doesnt show windows8. So I run boot repair but it
gaves me windows vista loader on sda1 and when i click on, it shows me a
black screen.
this the report of boot-repair http://paste.ubuntu.com/6173647/
I've been looking over 8 hours for a solution and i looked up to every
threads about this problem but no one works for me. Plz Help me
I have 3 partions with windows 8 installed in the first one then i
installed ubuntu in the second one.By the end of the installation, my pc
reboot on ubuntu and doesnt show windows8. So I run boot repair but it
gaves me windows vista loader on sda1 and when i click on, it shows me a
black screen.
this the report of boot-repair http://paste.ubuntu.com/6173647/
I've been looking over 8 hours for a solution and i looked up to every
threads about this problem but no one works for me. Plz Help me
Adding Win 7 to SBS 2003 domain issue
Adding Win 7 to SBS 2003 domain issue
I am attempting to add a Windows 7 PC to a SBS 2003 remotely via LogMeIn.
The SBS server resides at 192.168.0.100 The attempt fails because the
Windows 7 box gets its DNS from 192.168.0.254 & that DNS server apparently
does not have a domain service record for the SBS server.
Doing research I found an article that stated the Win 7 box should use the
SBS servers IP address ONLY for DNS, no secondary DNS address, in order to
domain join.
I changed the DNS address on the Win 7 box to 192.168.0.100, rebooted the
Win 7 box & promptly lost connectivity to the Win 7 box until this morning
when the user came into the office & I talked him through setting the DNS
to 192.168.0.254 which gave back connectivity via LogMeIn.
Any ideas on how to connect this PC to the SBS server domain?
I am using connectcomputer option is there another way to join a PC to SBS
2003?
TIA
I am attempting to add a Windows 7 PC to a SBS 2003 remotely via LogMeIn.
The SBS server resides at 192.168.0.100 The attempt fails because the
Windows 7 box gets its DNS from 192.168.0.254 & that DNS server apparently
does not have a domain service record for the SBS server.
Doing research I found an article that stated the Win 7 box should use the
SBS servers IP address ONLY for DNS, no secondary DNS address, in order to
domain join.
I changed the DNS address on the Win 7 box to 192.168.0.100, rebooted the
Win 7 box & promptly lost connectivity to the Win 7 box until this morning
when the user came into the office & I talked him through setting the DNS
to 192.168.0.254 which gave back connectivity via LogMeIn.
Any ideas on how to connect this PC to the SBS server domain?
I am using connectcomputer option is there another way to join a PC to SBS
2003?
TIA
Dynamic field content as Row Sql
Dynamic field content as Row Sql
I have the following dataset on a sql database
----------------------------------
| ID | NAME | AGE | STATUS |
-----------------------------------
| 1ASDF | Brenda | 21 | Single |
-----------------------------------
| 2FDSH | Ging | 24 | Married|
-----------------------------------
| 3SDFD | Judie | 18 | Widow |
-----------------------------------
| 4GWWX | Sophie | 21 | Married|
-----------------------------------
| 5JDSI | Mylene | 24 | Singe |
-----------------------------------
I want to query that dataset so that i can have this structure in my result
--------------------------------------
| AGE | SINGLE | MARRIED | WIDOW |
--------------------------------------
| 21 | 1 | 1 | 0 |
--------------------------------------
| 24 | 1 | 1 | 0 |
--------------------------------------
| 18 | 0 | 0 | 1 |
--------------------------------------
And the status column can be dynamic so there will be more columns to
come. Is this possible?
I have the following dataset on a sql database
----------------------------------
| ID | NAME | AGE | STATUS |
-----------------------------------
| 1ASDF | Brenda | 21 | Single |
-----------------------------------
| 2FDSH | Ging | 24 | Married|
-----------------------------------
| 3SDFD | Judie | 18 | Widow |
-----------------------------------
| 4GWWX | Sophie | 21 | Married|
-----------------------------------
| 5JDSI | Mylene | 24 | Singe |
-----------------------------------
I want to query that dataset so that i can have this structure in my result
--------------------------------------
| AGE | SINGLE | MARRIED | WIDOW |
--------------------------------------
| 21 | 1 | 1 | 0 |
--------------------------------------
| 24 | 1 | 1 | 0 |
--------------------------------------
| 18 | 0 | 0 | 1 |
--------------------------------------
And the status column can be dynamic so there will be more columns to
come. Is this possible?
Sunday, 29 September 2013
Bash Scripting -Use Of Regular Expression In Variable
Bash Scripting -Use Of Regular Expression In Variable
I am new to bash scripting so please excuse me if i am asking the wrong
question.
I am trying to write a script :)
First_Variable=800
Second_Variable=850
I want to feed all the number between First and Second variable to my
script excluding 830. Say i am using seq command to count from first
variable to second one but skip one number in between deliberately.
Any help??? please
I am new to bash scripting so please excuse me if i am asking the wrong
question.
I am trying to write a script :)
First_Variable=800
Second_Variable=850
I want to feed all the number between First and Second variable to my
script excluding 830. Say i am using seq command to count from first
variable to second one but skip one number in between deliberately.
Any help??? please
If i have one output value and two input values i need to enter on the float line in c# how would i do that?
If i have one output value and two input values i need to enter on the
float line in c# how would i do that?
If my output value is Miles Per Gallon and my input values are Miles
traveled and Gallons of Gas Used how would i enter that after inputting
float?
Please help, my assignment is due tonight and i am pulling my hair out
trying to figure this out.
float line in c# how would i do that?
If my output value is Miles Per Gallon and my input values are Miles
traveled and Gallons of Gas Used how would i enter that after inputting
float?
Please help, my assignment is due tonight and i am pulling my hair out
trying to figure this out.
Choosing database (single/server) for restaurant desktop application
Choosing database (single/server) for restaurant desktop application
I've started developing desktop app for my father's restaurant, I decided
to solve the problem in WPF (c#), so now i need database.
I love the simplicity of SQLite, but i don't know if it would be good for
this solution
SQL Server Compact, seems interesting, but I'm beginner with it and I
can't find any tutorials
SQL Server Express, amazing, but i think it will take more space than my
application overall
So what should I choose and also all 3 of these can be locked, right?
I've started developing desktop app for my father's restaurant, I decided
to solve the problem in WPF (c#), so now i need database.
I love the simplicity of SQLite, but i don't know if it would be good for
this solution
SQL Server Compact, seems interesting, but I'm beginner with it and I
can't find any tutorials
SQL Server Express, amazing, but i think it will take more space than my
application overall
So what should I choose and also all 3 of these can be locked, right?
Facebook - multiple like buttons with one host page (GWT)
Facebook - multiple like buttons with one host page (GWT)
I want to add facebook like buttons to different pages and use different
titles, descriptions and images.
The problem now is: Facebook uses meta tags from the header to determine
this values, e.g.: . I use GWT and therefore I only have one host page
(e.g. index.html) and different content is rendered in this page:
"www.myurl.com#blogpost:1" would load the blogpost with id "1". Therefore
every blogpost would have the same title, description, image. I could
change the metatags with javascript according to which blogpost is
requested. But I guess javascript is not executed by the facebook parser.
Is there a way to realize different like buttons with only one host page?
I want to add facebook like buttons to different pages and use different
titles, descriptions and images.
The problem now is: Facebook uses meta tags from the header to determine
this values, e.g.: . I use GWT and therefore I only have one host page
(e.g. index.html) and different content is rendered in this page:
"www.myurl.com#blogpost:1" would load the blogpost with id "1". Therefore
every blogpost would have the same title, description, image. I could
change the metatags with javascript according to which blogpost is
requested. But I guess javascript is not executed by the facebook parser.
Is there a way to realize different like buttons with only one host page?
Saturday, 28 September 2013
Overlapping borders in choropleth plotting in R
Overlapping borders in choropleth plotting in R
I am trying to color counties according to certain criteria and then add
borders to some counties according to another criteria. The problem is
both the base plotting package and ggplot2 cover up some of the borders
that I care about; if a red bordered county is adjacent to all black
bordered counties the red border is sometimes covered up. Does anyone have
a fix for this?
Edit: I have found a way in the base plotting package. When reading in the
shapefile using readShapeSpatial from maptools there is a slot called
plotOrder. If you rearrange the plot order so that the counties with red
borders are plotted last, it does a better job.
I am trying to color counties according to certain criteria and then add
borders to some counties according to another criteria. The problem is
both the base plotting package and ggplot2 cover up some of the borders
that I care about; if a red bordered county is adjacent to all black
bordered counties the red border is sometimes covered up. Does anyone have
a fix for this?
Edit: I have found a way in the base plotting package. When reading in the
shapefile using readShapeSpatial from maptools there is a slot called
plotOrder. If you rearrange the plot order so that the counties with red
borders are plotted last, it does a better job.
Best way to pass delegate parameters
Best way to pass delegate parameters
What is the best way to pass parameters through to a delegate? I can see
benefits for both of the following ways so I would like to know the most
used and industry accepted way of doing it:
1) I can pass any parameters individually with each parameters being just
that, a parameter.
Example Delegate
public delegate void MyDelegate(bool PARAM1, String PARAM2, int PARAM3);
2) I can pass any parameters through a struct and the only parameter of
the delegate is that struct.
Example Struct
public struct MyDelegateArgs
{
public bool PARAM1;
public String PARAM2;
public int PARAM3;
}
Example Delegate
public delegate void MyDelegate(MyDelegateArgs args);
What is the best way to pass parameters through to a delegate? I can see
benefits for both of the following ways so I would like to know the most
used and industry accepted way of doing it:
1) I can pass any parameters individually with each parameters being just
that, a parameter.
Example Delegate
public delegate void MyDelegate(bool PARAM1, String PARAM2, int PARAM3);
2) I can pass any parameters through a struct and the only parameter of
the delegate is that struct.
Example Struct
public struct MyDelegateArgs
{
public bool PARAM1;
public String PARAM2;
public int PARAM3;
}
Example Delegate
public delegate void MyDelegate(MyDelegateArgs args);
Keep all html whitespaces in php mysql
Keep all html whitespaces in php mysql
i want to know how to keep all whitespaces of a text area in php (for send
to database), and then echo then back later. I want to do it like
stackoverflow does, for codes, which is the best approach?
For now i using this:
$text = str_replace(' ', '&nbs p;', $text);
It keeps the ' ' whitespaces but i won't have tested it with
mysql_real_escape and other "inject prevent" methods together.
For better understanding, i want to echo later from db something like:
function jack(){
var x = "blablabla";
}
Thanks for your time.
i want to know how to keep all whitespaces of a text area in php (for send
to database), and then echo then back later. I want to do it like
stackoverflow does, for codes, which is the best approach?
For now i using this:
$text = str_replace(' ', '&nbs p;', $text);
It keeps the ' ' whitespaces but i won't have tested it with
mysql_real_escape and other "inject prevent" methods together.
For better understanding, i want to echo later from db something like:
function jack(){
var x = "blablabla";
}
Thanks for your time.
Php read directory with absolute path
Php read directory with absolute path
I have this php script which reads mp3 files from the directory:
// Set your return content type
header('Content-type: text/xml');
//directory to read
$dir = ($_REQUEST['dir']);
$sub_dirs = isBoolean(($_REQUEST['sub_dirs']));
if(file_exists($dir)==false){
//echo $_SERVER['DOCUMENT_ROOT'];
//echo "current working directory is -> ". getcwd();
echo 'Directory \'', $dir, '\' not found!';
}else{
$temp = getFileList($dir, $sub_dirs);
echo json_encode($temp);
}
function isBoolean($value) {
if ($value && strtolower($value) !== "false") {
return true;
} else {
return false;
}
}
function getFileList($dir, $recurse){
$retval = array(); // array to hold return value
if(substr($dir, -1) != "/") // add trailing slash if missing
$dir .= "/"; // open pointer to directory and read list of files
$d = @dir($dir) or die("getFileList: Failed opening directory $dir for
reading");
while(false !== ($entry = $d->read())) { // skip hidden files
if($entry[0] == "." || $entry[0] == "..") continue;
if(is_dir("$dir$entry")) {
if($recurse && is_readable("$dir$entry/")) {
$retval = array_merge($retval, getFileList("$dir$entry/",
true));
}
}else if(is_readable("$dir$entry")) {
$path_info = pathinfo("$dir$entry");
if(strtolower($path_info['extension'])=='mp3'){
$retval[] = array(
"path" => "$dir$entry",
"type" => $path_info['extension'],
"size" => filesize("$dir$entry"),
"lastmod" => filemtime("$dir$entry")
);
}
}
}
$d->close();
return $retval;
}
This file sits in the same directory as the html page which executes the
script. For example, I pass the relative path 'audio/mp3' or
'../audio/mp3' and it all works well.
Is it possible to make this read directory with absolute path?
For example, if I would pass this:
http://www.mydomain.com/someFolder/audio/mp3, and html page which executes
the script and the php file would be placed in this location:
http://www.mydomain.com/someFolder/
Thank you!
I have this php script which reads mp3 files from the directory:
// Set your return content type
header('Content-type: text/xml');
//directory to read
$dir = ($_REQUEST['dir']);
$sub_dirs = isBoolean(($_REQUEST['sub_dirs']));
if(file_exists($dir)==false){
//echo $_SERVER['DOCUMENT_ROOT'];
//echo "current working directory is -> ". getcwd();
echo 'Directory \'', $dir, '\' not found!';
}else{
$temp = getFileList($dir, $sub_dirs);
echo json_encode($temp);
}
function isBoolean($value) {
if ($value && strtolower($value) !== "false") {
return true;
} else {
return false;
}
}
function getFileList($dir, $recurse){
$retval = array(); // array to hold return value
if(substr($dir, -1) != "/") // add trailing slash if missing
$dir .= "/"; // open pointer to directory and read list of files
$d = @dir($dir) or die("getFileList: Failed opening directory $dir for
reading");
while(false !== ($entry = $d->read())) { // skip hidden files
if($entry[0] == "." || $entry[0] == "..") continue;
if(is_dir("$dir$entry")) {
if($recurse && is_readable("$dir$entry/")) {
$retval = array_merge($retval, getFileList("$dir$entry/",
true));
}
}else if(is_readable("$dir$entry")) {
$path_info = pathinfo("$dir$entry");
if(strtolower($path_info['extension'])=='mp3'){
$retval[] = array(
"path" => "$dir$entry",
"type" => $path_info['extension'],
"size" => filesize("$dir$entry"),
"lastmod" => filemtime("$dir$entry")
);
}
}
}
$d->close();
return $retval;
}
This file sits in the same directory as the html page which executes the
script. For example, I pass the relative path 'audio/mp3' or
'../audio/mp3' and it all works well.
Is it possible to make this read directory with absolute path?
For example, if I would pass this:
http://www.mydomain.com/someFolder/audio/mp3, and html page which executes
the script and the php file would be placed in this location:
http://www.mydomain.com/someFolder/
Thank you!
Friday, 27 September 2013
How to dynamically rename an appended item of a list
How to dynamically rename an appended item of a list
Trying to change a name dynamically on a html list, my rename functions
works on the items that were already on the list, but doesn't work on the
appended items code is blow $(document).ready(function(){
// Append items functions
$("#btn2").on('click', function () {
var name = $('#name').val();
$('<li>', {
text: name
}).appendTo('ol').append($('<button />', {
'class': 'btn3',
text: 'Remove'
})).append($('<button />',{
'class': 'btn4',
text: 'Rename'}));
});
//delete items functions
$(document).on('click', 'ol .btn3', function () {
$(this).closest('li').remove();
});
//rename function
$(".btn4").on('click', function () {
var rename = "test"//$('#rename').val();
$(this).closest('li').after($('<li>', {
text: rename
}).appendTo('ol').append($('<button />', {
'class': 'btn3',
text: 'Remove'
})).append($('<button />',{
'class': 'btn4',
text: 'Rename'}))).remove();
}
);
});
</script>
</head>
<body>
<div class = "container">
<ol >
<li >List item 1 <button class ="btn3"> remove</button> <button class
="btn4">rename</button></li>
<li>List item 2 <button class ="btn3"> remove</button><button class
="btn4">rename</button></li>
<li>List item 3 <button class ="btn3"> remove</button><button class
="btn4">rename</button></li>
</ol>
</div>
<input id = "name" type = "text"> <button id="btn2">Append list
items</button>
</body>
Tips and help much appreciated
Trying to change a name dynamically on a html list, my rename functions
works on the items that were already on the list, but doesn't work on the
appended items code is blow $(document).ready(function(){
// Append items functions
$("#btn2").on('click', function () {
var name = $('#name').val();
$('<li>', {
text: name
}).appendTo('ol').append($('<button />', {
'class': 'btn3',
text: 'Remove'
})).append($('<button />',{
'class': 'btn4',
text: 'Rename'}));
});
//delete items functions
$(document).on('click', 'ol .btn3', function () {
$(this).closest('li').remove();
});
//rename function
$(".btn4").on('click', function () {
var rename = "test"//$('#rename').val();
$(this).closest('li').after($('<li>', {
text: rename
}).appendTo('ol').append($('<button />', {
'class': 'btn3',
text: 'Remove'
})).append($('<button />',{
'class': 'btn4',
text: 'Rename'}))).remove();
}
);
});
</script>
</head>
<body>
<div class = "container">
<ol >
<li >List item 1 <button class ="btn3"> remove</button> <button class
="btn4">rename</button></li>
<li>List item 2 <button class ="btn3"> remove</button><button class
="btn4">rename</button></li>
<li>List item 3 <button class ="btn3"> remove</button><button class
="btn4">rename</button></li>
</ol>
</div>
<input id = "name" type = "text"> <button id="btn2">Append list
items</button>
</body>
Tips and help much appreciated
bitwise-ANDing with 0xff is important?
bitwise-ANDing with 0xff is important?
Doesn't bitwise-ANDing with 0xff essentially mean getting the same value
back, for that matter, in this code?
byte[] packet = reader.readPacket();
short sh;
sh = packet[1];
enter code here`sh &= 0xFF;
System.out.print(sh+" ");
Weirdly, I get a -1 if that ANDing is not included but a 255 when included
Could someone explain the reason?
As I see it 0xff is just 1111 1111. Isn't it?
Doesn't bitwise-ANDing with 0xff essentially mean getting the same value
back, for that matter, in this code?
byte[] packet = reader.readPacket();
short sh;
sh = packet[1];
enter code here`sh &= 0xFF;
System.out.print(sh+" ");
Weirdly, I get a -1 if that ANDing is not included but a 255 when included
Could someone explain the reason?
As I see it 0xff is just 1111 1111. Isn't it?
Random numbers in java does not work properly
Random numbers in java does not work properly
I am new to java and in the learning phase.I want to create a lottery
program that creates four random numbers, each between 0 and
9(inclusive).This program asks user to guess four numbers and compares
each user guesses to four random numbers and displays the won message as:
No matches 0 points Any one digit matching 5 points Any two digits
matching 100 points Any three digits matching 2,000 points All four digits
matching 1,000,000 points
My program runs but it has some logic errors.
For example,the output should be:
Random numbers:2 3 3 4
Guess numbers: 1 2 5 7-->1 matching digit
Guess numbers: 3 5 7 3-->2 matching digits
Guess numbers: 3 3 3 1-->2 matching digits
Guess numbers: 3 3 3 3-->2 matching digits
**public class Lottery
{
public static void main(String[] args) {
final int LIMIT=10;
int totalCount=0;
int totalPoint;
Random random=new Random(); //creating object of random class
Scanner input=new Scanner(System.in);//creating object of scanner
class
//declaring two arrays
int[] guessNumber= new int[4];
int[] randomNumber=new int[4];
for(int i=0;i<4;i++)
{
randomNumber[i]=random.nextInt(LIMIT);//returns value between 0 to
9(inclusive)
}
for(int i=0;i<4;i++)
{
System.out.println("Enter your first guess number from 0 to 9:");
guessNumber[i]=input.nextInt();
}
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if (randomNumber[i] == guessNumber[j])
{
++totalCount;
break;
}
}
}
if(totalCount == 1)
{
totalPoint=5;
}
else if(totalCount == 2)
{
totalPoint=100;
}
else if(totalCount == 3)
{
totalPoint=2000;
}
else if(totalCount == 4)
{
totalPoint=100000;
}
else{
totalPoint=0;}
//dispalying points
System.out.println("You have earned " +totalPoint+ "points!!");
}
}**
I am new to java and in the learning phase.I want to create a lottery
program that creates four random numbers, each between 0 and
9(inclusive).This program asks user to guess four numbers and compares
each user guesses to four random numbers and displays the won message as:
No matches 0 points Any one digit matching 5 points Any two digits
matching 100 points Any three digits matching 2,000 points All four digits
matching 1,000,000 points
My program runs but it has some logic errors.
For example,the output should be:
Random numbers:2 3 3 4
Guess numbers: 1 2 5 7-->1 matching digit
Guess numbers: 3 5 7 3-->2 matching digits
Guess numbers: 3 3 3 1-->2 matching digits
Guess numbers: 3 3 3 3-->2 matching digits
**public class Lottery
{
public static void main(String[] args) {
final int LIMIT=10;
int totalCount=0;
int totalPoint;
Random random=new Random(); //creating object of random class
Scanner input=new Scanner(System.in);//creating object of scanner
class
//declaring two arrays
int[] guessNumber= new int[4];
int[] randomNumber=new int[4];
for(int i=0;i<4;i++)
{
randomNumber[i]=random.nextInt(LIMIT);//returns value between 0 to
9(inclusive)
}
for(int i=0;i<4;i++)
{
System.out.println("Enter your first guess number from 0 to 9:");
guessNumber[i]=input.nextInt();
}
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if (randomNumber[i] == guessNumber[j])
{
++totalCount;
break;
}
}
}
if(totalCount == 1)
{
totalPoint=5;
}
else if(totalCount == 2)
{
totalPoint=100;
}
else if(totalCount == 3)
{
totalPoint=2000;
}
else if(totalCount == 4)
{
totalPoint=100000;
}
else{
totalPoint=0;}
//dispalying points
System.out.println("You have earned " +totalPoint+ "points!!");
}
}**
Android. How to make some changes in Main class for the second class
Android. How to make some changes in Main class for the second class
/Hello, please help me to solve this problem. I am making an application
like "Millionaire"
I have made two Classes and two XML files for them. In the first class -
the first question, and in the second class - the second questions. in
both classes I made the button of 50:50(as in Millionaire). And I want to
make the 50:50 button in the second class not visible if I have already
used it in the first class./
public void onClick(View v){
Button btn50 = (Button) findViewById(R.id.btn50);
btn50.setVisibility(View.GONE);}
/btn50 is the Button of the second class and I am writing the code in the
first class, but when I try by this version and go from the first class to
the second one the application "unfortunately stops working"/
Please help me to solve this problem
/Hello, please help me to solve this problem. I am making an application
like "Millionaire"
I have made two Classes and two XML files for them. In the first class -
the first question, and in the second class - the second questions. in
both classes I made the button of 50:50(as in Millionaire). And I want to
make the 50:50 button in the second class not visible if I have already
used it in the first class./
public void onClick(View v){
Button btn50 = (Button) findViewById(R.id.btn50);
btn50.setVisibility(View.GONE);}
/btn50 is the Button of the second class and I am writing the code in the
first class, but when I try by this version and go from the first class to
the second one the application "unfortunately stops working"/
Please help me to solve this problem
SQL: How to update multiple values using a subquery that has group by
SQL: How to update multiple values using a subquery that has group by
I have the below table:
row_date logid type Interval availtime avail_distribution 9/25/2013 122 4
850 640 NULL 9/25/2013 122 5 850 0 NULL 9/25/2013 122 7 850 0 NULL
9/26/2013 122 4 850 500 NULL 9/26/2013 122 5 850 0 NULL 9/26/2013 122 7
850 0 NULL
Here EACH of avail_distribution is to be updated by the average of the
'availtime', group by row_date,logid and Interval.
The required table after update:
row_date logid type Interval availtime avail_distribution 9/25/2013 122 4
850 640 213.3333 9/25/2013 122 5 850 0 213.3333 9/25/2013 122 7 850 0
213.3333 9/26/2013 122 4 850 500 167.66667 9/26/2013 122 5 850 0 167.66667
9/26/2013 122 7 850 0 167.66667
Select sum(availtime)/count(availtime) from table group by
row_date,logid,Interval gives me the values that i am seeking.. but I am
not able to update the avail_distribution column the way i am intending.
I have the below table:
row_date logid type Interval availtime avail_distribution 9/25/2013 122 4
850 640 NULL 9/25/2013 122 5 850 0 NULL 9/25/2013 122 7 850 0 NULL
9/26/2013 122 4 850 500 NULL 9/26/2013 122 5 850 0 NULL 9/26/2013 122 7
850 0 NULL
Here EACH of avail_distribution is to be updated by the average of the
'availtime', group by row_date,logid and Interval.
The required table after update:
row_date logid type Interval availtime avail_distribution 9/25/2013 122 4
850 640 213.3333 9/25/2013 122 5 850 0 213.3333 9/25/2013 122 7 850 0
213.3333 9/26/2013 122 4 850 500 167.66667 9/26/2013 122 5 850 0 167.66667
9/26/2013 122 7 850 0 167.66667
Select sum(availtime)/count(availtime) from table group by
row_date,logid,Interval gives me the values that i am seeking.. but I am
not able to update the avail_distribution column the way i am intending.
Thursday, 26 September 2013
Enumerating list of applications installed using .NET
Enumerating list of applications installed using .NET
I use the following code to enumerate applications installed in my system:
ManagementObjectSearcher mos = new
ManagementObjectSearcher("SELECT * FROM Win32_Product");
ManagementObjectCollection collection = mos.Get();
List<string> appList = new List<string>();
foreach (ManagementObject mo in collection)
{
try
{
string appName = mo["Name"].ToString();
appList.Add(appName);
}
catch (Exception ex)
{
}
}
When I use this code in console or a WPF application, I get the exact list
of apps. But when I use it in a windows service, I'm not getting the
entire list. In my case its 1 application less. Is there a limitation to
use this in Windows Service?
I use the following code to enumerate applications installed in my system:
ManagementObjectSearcher mos = new
ManagementObjectSearcher("SELECT * FROM Win32_Product");
ManagementObjectCollection collection = mos.Get();
List<string> appList = new List<string>();
foreach (ManagementObject mo in collection)
{
try
{
string appName = mo["Name"].ToString();
appList.Add(appName);
}
catch (Exception ex)
{
}
}
When I use this code in console or a WPF application, I get the exact list
of apps. But when I use it in a windows service, I'm not getting the
entire list. In my case its 1 application less. Is there a limitation to
use this in Windows Service?
Wednesday, 25 September 2013
How to vertically center align UIButton in UITableViewCell? (Objective C)
How to vertically center align UIButton in UITableViewCell? (Objective C)
I have a custom table cell to which I want to add a custom UIButton on the
left side, vertically centered within the cell. I tried to do that with
the code shown below, which is in my custom table cell implementation.
I'm trying to achieve the vertical center alignment by taking the height
of self.frame and sizing the button such that it would appear 5px from the
top and bottom of the cell. When I run this, I see that the button appears
5px from the top, but considerably more from the bottom (20px or so).
What is the proper way to achieve the vertical alignment?
This is my code in the custom table cell implementation:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString
*)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
// Create the audio button on the left side:
self.audioButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.audioButton.frame = CGRectMake(5, 5, self.frame.size.height -
10, self.frame.size.height - 10);
[self.audioButton setImage:[UIImage imageNamed:@"ec-icon-speaker.png"]
forState:UIControlStateNormal];
[self.audioButton addTarget:self
action:@selector(playWordAudio)
forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.audioButton];
Thanks for any suggestions,
Erik
I have a custom table cell to which I want to add a custom UIButton on the
left side, vertically centered within the cell. I tried to do that with
the code shown below, which is in my custom table cell implementation.
I'm trying to achieve the vertical center alignment by taking the height
of self.frame and sizing the button such that it would appear 5px from the
top and bottom of the cell. When I run this, I see that the button appears
5px from the top, but considerably more from the bottom (20px or so).
What is the proper way to achieve the vertical alignment?
This is my code in the custom table cell implementation:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString
*)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
// Create the audio button on the left side:
self.audioButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.audioButton.frame = CGRectMake(5, 5, self.frame.size.height -
10, self.frame.size.height - 10);
[self.audioButton setImage:[UIImage imageNamed:@"ec-icon-speaker.png"]
forState:UIControlStateNormal];
[self.audioButton addTarget:self
action:@selector(playWordAudio)
forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.audioButton];
Thanks for any suggestions,
Erik
Thursday, 19 September 2013
Mongodb query specific month|year not date
Mongodb query specific month|year not date
How can I query a specific month in mongodb, not date range, I neeed month
to make a list of customer birthday for current month.
In SQL will be something like that:
SELECT * FROM customer WHERE MONTH(bday)='09'
Now I need to translate that in mongodb. Note: My dates are already saved
in MongoDate type, I used this thinking that will be easy to work before
but now I can't find easily how to do this simple thing.
Thanks.
How can I query a specific month in mongodb, not date range, I neeed month
to make a list of customer birthday for current month.
In SQL will be something like that:
SELECT * FROM customer WHERE MONTH(bday)='09'
Now I need to translate that in mongodb. Note: My dates are already saved
in MongoDate type, I used this thinking that will be easy to work before
but now I can't find easily how to do this simple thing.
Thanks.
Java Beginner: Variable Initialization
Java Beginner: Variable Initialization
I'm a total beginner in Java so bare with me. Here's a code snippet that
won't compile. I get an error on the last line claiming that the
dots_per_page variable wasn't initialized. This error goes away when I set
it equal to a value on the first line shown. Is there something I'm
overlooking? I didn't think that I would have to set it equal to a value
upon declaration. Thanks for any guidance.
long dots_per_page;
if (print_type == 'T' || print_type == 't') {
dots_per_page = 5000;
}
else if (print_type == 'I' || print_type == 'i') {
dots_per_page = 10000;
}
else {
System.out.println("You did not provide a valid option.");
}
System.out.println(dots_per_page);
I'm a total beginner in Java so bare with me. Here's a code snippet that
won't compile. I get an error on the last line claiming that the
dots_per_page variable wasn't initialized. This error goes away when I set
it equal to a value on the first line shown. Is there something I'm
overlooking? I didn't think that I would have to set it equal to a value
upon declaration. Thanks for any guidance.
long dots_per_page;
if (print_type == 'T' || print_type == 't') {
dots_per_page = 5000;
}
else if (print_type == 'I' || print_type == 'i') {
dots_per_page = 10000;
}
else {
System.out.println("You did not provide a valid option.");
}
System.out.println(dots_per_page);
Kohana 3.3: ORM è _load_with äëÿ òàáëèö èç ðàçíûõ áàç
Kohana 3.3: ORM è _load_with äëÿ òàáëèö èç ðàçíûõ áàç
Ñóùåñòâóåò äâå ìîäåëè äëÿ òàáëèö èç ðàçíûõ áàç (äîïóñòèì db_1.tbl_1 è
db_2.tbl_2). Â îáåèõ ìîäåëÿõ, åñòåñòâåííî, óêàçàíû $_db_group. Â ïåðâîé
ìîäåëè íàñòðîåíà ñâÿçü "ìíîãî ê îäíîìó".
Ïðè ïîïûòêå óêàçàòü â ïåðâîé ìîäåëè $_load_with ïî÷åìó-òî ôîðìèðóåòñÿ
ïðèìåðíî òàêîé çàïðîñ:
SELECT `tbl_1`.*, `tbl_2`.*
FROM `tbl_1` LEFT JOIN `tbl_2` ON (`tbl_1`.`method` = `tbl_2`.`id`)
âìåñòî:
SELECT `tbl_1`.*, `tbl_2`.*
FROM `db_1`.`tbl_1` LEFT JOIN `db_2`.`tbl_2` ON (`tbl_1`.`method` =
`tbl_2`.`id`)
Ïðè ýòîì áåç $_load_with ñâÿçü ðàáîòàåò íîðìàëüíî.
×òî íóæíî ó÷åñòü, ÷òîáû èñïîëüçóÿ $_load_with ïîëó÷èòü çàïðîñ êàê âî
âòîðîì ïðèìåðå?
Ñóùåñòâóåò äâå ìîäåëè äëÿ òàáëèö èç ðàçíûõ áàç (äîïóñòèì db_1.tbl_1 è
db_2.tbl_2). Â îáåèõ ìîäåëÿõ, åñòåñòâåííî, óêàçàíû $_db_group. Â ïåðâîé
ìîäåëè íàñòðîåíà ñâÿçü "ìíîãî ê îäíîìó".
Ïðè ïîïûòêå óêàçàòü â ïåðâîé ìîäåëè $_load_with ïî÷åìó-òî ôîðìèðóåòñÿ
ïðèìåðíî òàêîé çàïðîñ:
SELECT `tbl_1`.*, `tbl_2`.*
FROM `tbl_1` LEFT JOIN `tbl_2` ON (`tbl_1`.`method` = `tbl_2`.`id`)
âìåñòî:
SELECT `tbl_1`.*, `tbl_2`.*
FROM `db_1`.`tbl_1` LEFT JOIN `db_2`.`tbl_2` ON (`tbl_1`.`method` =
`tbl_2`.`id`)
Ïðè ýòîì áåç $_load_with ñâÿçü ðàáîòàåò íîðìàëüíî.
×òî íóæíî ó÷åñòü, ÷òîáû èñïîëüçóÿ $_load_with ïîëó÷èòü çàïðîñ êàê âî
âòîðîì ïðèìåðå?
Capistrano-uniocorn gem multistage environment defaulting to unicorn_rails and -E production
Capistrano-uniocorn gem multistage environment defaulting to unicorn_rails
and -E production
I've been using this gem for a while and just took the dive to try
deploying an actual staging environment to my staging server, and I ran
into issues. Unicorn starts with the command unicorn_rails and -E
production despite all the settings being correct afaik.
I noticed in deploy.rb that my unicorn_bin variable was set as
unicorn_rails. I took out this setting in my deploy.rb. However
unicorn:duplicate still executes the unicorn_rails command, when the
default should be unicorn.
My vars are all set to staging in the deploy/staging.rb, as outlined in
the multistage setup wiki document, but I noticed -E is still getting set
to production.
Relevent info:
Here's my output from my unicorn.log file after a deploy:
executing
["/var/www/apps/myapp/shared/bundle/ruby/2.0.0/bin/unicorn_rails", "-c",
"/var/www/apps/bundio/current/config/unicorn.rb", "-E", "production",
"-D", {12=>#<Kgio::UNIXServer:/tmp/bundio.socket>,
13=>#<Kgio::TCPServer:fd 13>}] (in /var/www/apps/bundio/current)
Here's the output from cap -T (defaults to staging)
# Environments
rails_env "staging"
unicorn_env "staging"
unicorn_rack_env "staging"
# Execution
unicorn_user nil
unicorn_bundle "/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/bundle"
unicorn_bin "unicorn"
unicorn_options ""
unicorn_restart_sleep_time 2
# Relative paths
app_subdir ""
unicorn_config_rel_path "config"
unicorn_config_filename "unicorn.rb"
unicorn_config_rel_file_path "config/unicorn.rb"
unicorn_config_stage_rel_file_path "config/unicorn/staging.rb"
# Absolute paths
app_path "/var/www/apps/myapp/current"
unicorn_pid "/var/www/apps/myapp/shared/pids/unicorn.myapp.pid"
bundle_gemfile "/var/www/apps/myapp/current/Gemfile"
unicorn_config_path "/var/www/apps/myapp/current/config"
unicorn_config_file_path "/var/www/apps/myapp/current/config/unicorn.rb"
unicorn_config_stage_file_path
->
"/var/www/apps/myapp/current/config/unicorn/staging.rb"
And another curiousity, the unicorn_rails -E flag should reference the
rails environment, whereas the unicorn -E should reference the rack env --
the rack env should only get the values developement and deployment, but
it gets set to production, which is a bit strange (see unicorn docs for
settings of the RACK_ENV variable.
Any insight into this would be much appreciated. On my staging server,
I've also set the RAILS_ENV to staging. I've set up the things for rails
for another environment, like adding staging.rb in my environments folder,
adding a staging section to database.yml, etc.
Important lines in lib/capistrano-unicorn/config.rb talking about
unicorn_rack_env:
_cset(:unicorn_env) { fetch(:rails_env, 'production' ) }
_cset(:unicorn_rack_env) do
# Following recommendations from http://unicorn.bogomips.org/unicorn_1.html
fetch(:rails_env) == 'development' ? 'development' : 'deployment'
end
Thanks in advance.
and -E production
I've been using this gem for a while and just took the dive to try
deploying an actual staging environment to my staging server, and I ran
into issues. Unicorn starts with the command unicorn_rails and -E
production despite all the settings being correct afaik.
I noticed in deploy.rb that my unicorn_bin variable was set as
unicorn_rails. I took out this setting in my deploy.rb. However
unicorn:duplicate still executes the unicorn_rails command, when the
default should be unicorn.
My vars are all set to staging in the deploy/staging.rb, as outlined in
the multistage setup wiki document, but I noticed -E is still getting set
to production.
Relevent info:
Here's my output from my unicorn.log file after a deploy:
executing
["/var/www/apps/myapp/shared/bundle/ruby/2.0.0/bin/unicorn_rails", "-c",
"/var/www/apps/bundio/current/config/unicorn.rb", "-E", "production",
"-D", {12=>#<Kgio::UNIXServer:/tmp/bundio.socket>,
13=>#<Kgio::TCPServer:fd 13>}] (in /var/www/apps/bundio/current)
Here's the output from cap -T (defaults to staging)
# Environments
rails_env "staging"
unicorn_env "staging"
unicorn_rack_env "staging"
# Execution
unicorn_user nil
unicorn_bundle "/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/bundle"
unicorn_bin "unicorn"
unicorn_options ""
unicorn_restart_sleep_time 2
# Relative paths
app_subdir ""
unicorn_config_rel_path "config"
unicorn_config_filename "unicorn.rb"
unicorn_config_rel_file_path "config/unicorn.rb"
unicorn_config_stage_rel_file_path "config/unicorn/staging.rb"
# Absolute paths
app_path "/var/www/apps/myapp/current"
unicorn_pid "/var/www/apps/myapp/shared/pids/unicorn.myapp.pid"
bundle_gemfile "/var/www/apps/myapp/current/Gemfile"
unicorn_config_path "/var/www/apps/myapp/current/config"
unicorn_config_file_path "/var/www/apps/myapp/current/config/unicorn.rb"
unicorn_config_stage_file_path
->
"/var/www/apps/myapp/current/config/unicorn/staging.rb"
And another curiousity, the unicorn_rails -E flag should reference the
rails environment, whereas the unicorn -E should reference the rack env --
the rack env should only get the values developement and deployment, but
it gets set to production, which is a bit strange (see unicorn docs for
settings of the RACK_ENV variable.
Any insight into this would be much appreciated. On my staging server,
I've also set the RAILS_ENV to staging. I've set up the things for rails
for another environment, like adding staging.rb in my environments folder,
adding a staging section to database.yml, etc.
Important lines in lib/capistrano-unicorn/config.rb talking about
unicorn_rack_env:
_cset(:unicorn_env) { fetch(:rails_env, 'production' ) }
_cset(:unicorn_rack_env) do
# Following recommendations from http://unicorn.bogomips.org/unicorn_1.html
fetch(:rails_env) == 'development' ? 'development' : 'deployment'
end
Thanks in advance.
Request method 'GET' not supported Spring MVC
Request method 'GET' not supported Spring MVC
I have the following code in the controller
private static final String CJOB_MODEL = "cJobNms";
@RequestMapping(value = MAIN_VIEW, method = RequestMethod.POST)
public String showTestXsd(//@ModelAttribute(FORM_MODEL) TestXsdForm
xsdForm,
//@ModelAttribute(MODEL) @Valid
//TestXsdTable testXsdTable,
@RequestParam String selected,
Model model) throws DataException {
String cJobNm =null;
List<String> cJobNmList = null;
System.out.println("selected:"+ selected);
String xsdView = testXsdService.getXsdString();
cJobNmList = testXsdService.getCJobNm();
Set<String> cJobNmSet = new HashSet<String>(cJobNmList);
TestXsdForm xsdForm = new TestXsdForm();
model.addAttribute("xsdView", xsdView);
model.addAttribute("xsdFormModel", xsdForm);
model.addAttribute(CJOB_MODEL, cJobNmSet);
xsdForm.setXsdString(xsdView);
return MAIN_VIEW;
}
And the following code in my jsp.
<form:form modelAttribute="testXsdTable" name="xsdForm"
action="/xsdtest/testXsdTables"
id="xsdForm" method="POST" class="form"
enctype="multipart/form-data" >
<tr>
<td>
<label for="cJobs" class="fieldlabel">Jobs:</label>
<select id="cJobs" name="cJobs" >
<option value="${selected}" selected>${selected}</option>
<c:forEach items="${cJobNms}" var="table">
<c:if test="${table != selected}">
<option value="${table}">${table}</option>
</c:if>
</c:forEach>
</select>
</td>
</tr>
<pre>
<c:out value="${xsdForm.xsdString}"/>
</pre>
<div class="confirmbuttons">
<a href="#"class="button positive" id="saveXsdButton"
onclick="saveTestXsd();">
<span class="confirm">Save</span>
</a>
</div>
When the user selects an option from the cJobNms list the selected value
should be displayed in the controller method showTestXsd. Please let me
know what I am doing wrong.
Currently I am getting a message : Request method 'GET' not supported
I have the following code in the controller
private static final String CJOB_MODEL = "cJobNms";
@RequestMapping(value = MAIN_VIEW, method = RequestMethod.POST)
public String showTestXsd(//@ModelAttribute(FORM_MODEL) TestXsdForm
xsdForm,
//@ModelAttribute(MODEL) @Valid
//TestXsdTable testXsdTable,
@RequestParam String selected,
Model model) throws DataException {
String cJobNm =null;
List<String> cJobNmList = null;
System.out.println("selected:"+ selected);
String xsdView = testXsdService.getXsdString();
cJobNmList = testXsdService.getCJobNm();
Set<String> cJobNmSet = new HashSet<String>(cJobNmList);
TestXsdForm xsdForm = new TestXsdForm();
model.addAttribute("xsdView", xsdView);
model.addAttribute("xsdFormModel", xsdForm);
model.addAttribute(CJOB_MODEL, cJobNmSet);
xsdForm.setXsdString(xsdView);
return MAIN_VIEW;
}
And the following code in my jsp.
<form:form modelAttribute="testXsdTable" name="xsdForm"
action="/xsdtest/testXsdTables"
id="xsdForm" method="POST" class="form"
enctype="multipart/form-data" >
<tr>
<td>
<label for="cJobs" class="fieldlabel">Jobs:</label>
<select id="cJobs" name="cJobs" >
<option value="${selected}" selected>${selected}</option>
<c:forEach items="${cJobNms}" var="table">
<c:if test="${table != selected}">
<option value="${table}">${table}</option>
</c:if>
</c:forEach>
</select>
</td>
</tr>
<pre>
<c:out value="${xsdForm.xsdString}"/>
</pre>
<div class="confirmbuttons">
<a href="#"class="button positive" id="saveXsdButton"
onclick="saveTestXsd();">
<span class="confirm">Save</span>
</a>
</div>
When the user selects an option from the cJobNms list the selected value
should be displayed in the controller method showTestXsd. Please let me
know what I am doing wrong.
Currently I am getting a message : Request method 'GET' not supported
find sortest path in mutablearray in iphone app
find sortest path in mutablearray in iphone app
I have ten Location with origin. i want shortest path NSMutableArray.
For example
These are my locations:
Starting point(Current Location):- Ahmedabad 0 km
(lat:XXXXXXX,lng:XXXXXXX)
Gandhinagar 30 km (lat:XXXXXXX,lng:XXXXXXX)
Rajkot 200 km (lat:XXXXXXX,lng:XXXXXXX)
Limdi 100 km (lat:XXXXXXX,lng:XXXXXXX)
Junagadh 300 km (lat:XXXXXXX,lng:XXXXXXX)
Vanthli 315 km (lat:XXXXXXX,lng:XXXXXXX)
palanpur 400 km (lat:XXXXXXX,lng:XXXXXXX)
keshod 350 km (lat:XXXXXXX,lng:XXXXXXX)
veraval 420 km (lat:XXXXXXX,lng:XXXXXXX)
i want shortest array like this
Output:- Ahmedabad
Gandhinagar
Limdi
Rajkot
Junagadh
Vanthli
Keshod
Veraval
Palanpur
Means in first position is my starting point so Ahmedabad is First,
Gandhinagar is nearest from ahmedabad so Gandhinagar is second, then limdi
is nearest than gandhinagar so Limdi is third, rajkot is nearest from
Limdi so Rajkot is Forth, at last i have to cover all the locations with
shortest algorithm,
i use Google's Distance Matrix API but it time consuming. (because i have
to call this method 8 times than i get exact result.)
Is there any method or algorithm to find out and return me shortest
NSMutableArray
I have ten Location with origin. i want shortest path NSMutableArray.
For example
These are my locations:
Starting point(Current Location):- Ahmedabad 0 km
(lat:XXXXXXX,lng:XXXXXXX)
Gandhinagar 30 km (lat:XXXXXXX,lng:XXXXXXX)
Rajkot 200 km (lat:XXXXXXX,lng:XXXXXXX)
Limdi 100 km (lat:XXXXXXX,lng:XXXXXXX)
Junagadh 300 km (lat:XXXXXXX,lng:XXXXXXX)
Vanthli 315 km (lat:XXXXXXX,lng:XXXXXXX)
palanpur 400 km (lat:XXXXXXX,lng:XXXXXXX)
keshod 350 km (lat:XXXXXXX,lng:XXXXXXX)
veraval 420 km (lat:XXXXXXX,lng:XXXXXXX)
i want shortest array like this
Output:- Ahmedabad
Gandhinagar
Limdi
Rajkot
Junagadh
Vanthli
Keshod
Veraval
Palanpur
Means in first position is my starting point so Ahmedabad is First,
Gandhinagar is nearest from ahmedabad so Gandhinagar is second, then limdi
is nearest than gandhinagar so Limdi is third, rajkot is nearest from
Limdi so Rajkot is Forth, at last i have to cover all the locations with
shortest algorithm,
i use Google's Distance Matrix API but it time consuming. (because i have
to call this method 8 times than i get exact result.)
Is there any method or algorithm to find out and return me shortest
NSMutableArray
Include new lines when posting to facebook by email
Include new lines when posting to facebook by email
Is there any way of including new lines when posting a status update to a
facebook page by email?
Because you put the message in the subject, hitting enter doesn't work of
course. Tried manually typing "\n" just in case, but that didn't work.
Is there any way of including new lines when posting a status update to a
facebook page by email?
Because you put the message in the subject, hitting enter doesn't work of
course. Tried manually typing "\n" just in case, but that didn't work.
Wednesday, 18 September 2013
Is it right if I read view on other thread,Android UI
Is it right if I read view on other thread,Android UI
Anroid can't update view direct on non-ui thread,but if I just read/get
some information for ui?
For example I have a method updateModel() like
void updateModel() {
dailyReport.log.setValue(editLog.getText().toString());
dailyReport.plan.setValue(editPlan.getText().toString());
dailyReport.question.setValue(editQuestion.getText().toString());
}
Is it a problem if I run this method on non-ui thread.
Anroid can't update view direct on non-ui thread,but if I just read/get
some information for ui?
For example I have a method updateModel() like
void updateModel() {
dailyReport.log.setValue(editLog.getText().toString());
dailyReport.plan.setValue(editPlan.getText().toString());
dailyReport.question.setValue(editQuestion.getText().toString());
}
Is it a problem if I run this method on non-ui thread.
jquery top drawer with tabs navigation
jquery top drawer with tabs navigation
I'm trying to create horizontal navigation fixed to the top of the page
that uses a drawer like effect to drop down some content when clicking
each link. I'm using jquery from a lynda training course to create the
tabbed like effect to show different content when clicking between links.
I'm having a problem adding in an effect I want. When a user clicks a link
the drawer slides down and the content with it, instead of just revealing
the content. However, I can't seem to get the effect to work properly when
you click #close and have the content and drawer slide back up. The
closing animation is supposed to animate the height of #drawer-conent to
0px and also the top-margin to a number equal to the height of the current
panel being displayed. Both animations together give the effect of the
drawer and its content sliding back up.
Here is the code I'm using:
var panelWidth = 0;
$(document).ready(function(){
window.panelWidth = $('#drawer').width();
$('#drawer-content .panel').each(function(index){
$(this).css({'width':
window.panelWidth+'px','left':(index*window.panelWidth)+'px'});
$('#drawer .panels').css('width',(index+1)*window.panelWidth+'px');
});
$('nav ul li').each(function(){
$(this).on('click', function(){
changePanels( $(this).index() );
collapsePanel( $(this).index() );
});
});
// Animate each panel to slide down as the drawer slides down.
$("nav ul li").click(function(){
$('.panel').animate({marginTop:0+'px'},300);
});
// prevent the close and nav links from loading the #
$("nav ul li a, #drawer-toggle a").click(function( event ) {
event.preventDefault();
});
});
function changePanels(newIndex){
var newPanelPosition = (window.panelWidth*newIndex)* -1;
var newPanelHeight = $('#drawer
.panel:nth-child('+(newIndex+1)+')').find('.panel-content').height()
+ 15;
$('#drawer .panels').animate({left:newPanelPosition},0)
$('#drawer #drawer-content').animate({height:newPanelHeight},300);
if ( $("#drawer-content").css("height") == 0+'px' ) {
$('#drawer .panel').css('margin-top', -newPanelHeight);
return false;
}
$('nav ul li').removeClass('selected');
$('nav ul li:nth-child('+(newIndex+1)+')').addClass('selected');
}
function collapsePanel(newIndex){
var anotherPanelHeight = $('#drawer
.panel:nth-child('+(newIndex+1)+')').find('.panel-content').height() +
15;
$("#close").on('click', function(){
$("#drawer-content").animate({height:0 +'px'},300);
$("#drawer .panel").animate({marginTop:-anotherPanelHeight},300)
});
}
I'm trying to create horizontal navigation fixed to the top of the page
that uses a drawer like effect to drop down some content when clicking
each link. I'm using jquery from a lynda training course to create the
tabbed like effect to show different content when clicking between links.
I'm having a problem adding in an effect I want. When a user clicks a link
the drawer slides down and the content with it, instead of just revealing
the content. However, I can't seem to get the effect to work properly when
you click #close and have the content and drawer slide back up. The
closing animation is supposed to animate the height of #drawer-conent to
0px and also the top-margin to a number equal to the height of the current
panel being displayed. Both animations together give the effect of the
drawer and its content sliding back up.
Here is the code I'm using:
var panelWidth = 0;
$(document).ready(function(){
window.panelWidth = $('#drawer').width();
$('#drawer-content .panel').each(function(index){
$(this).css({'width':
window.panelWidth+'px','left':(index*window.panelWidth)+'px'});
$('#drawer .panels').css('width',(index+1)*window.panelWidth+'px');
});
$('nav ul li').each(function(){
$(this).on('click', function(){
changePanels( $(this).index() );
collapsePanel( $(this).index() );
});
});
// Animate each panel to slide down as the drawer slides down.
$("nav ul li").click(function(){
$('.panel').animate({marginTop:0+'px'},300);
});
// prevent the close and nav links from loading the #
$("nav ul li a, #drawer-toggle a").click(function( event ) {
event.preventDefault();
});
});
function changePanels(newIndex){
var newPanelPosition = (window.panelWidth*newIndex)* -1;
var newPanelHeight = $('#drawer
.panel:nth-child('+(newIndex+1)+')').find('.panel-content').height()
+ 15;
$('#drawer .panels').animate({left:newPanelPosition},0)
$('#drawer #drawer-content').animate({height:newPanelHeight},300);
if ( $("#drawer-content").css("height") == 0+'px' ) {
$('#drawer .panel').css('margin-top', -newPanelHeight);
return false;
}
$('nav ul li').removeClass('selected');
$('nav ul li:nth-child('+(newIndex+1)+')').addClass('selected');
}
function collapsePanel(newIndex){
var anotherPanelHeight = $('#drawer
.panel:nth-child('+(newIndex+1)+')').find('.panel-content').height() +
15;
$("#close").on('click', function(){
$("#drawer-content").animate({height:0 +'px'},300);
$("#drawer .panel").animate({marginTop:-anotherPanelHeight},300)
});
}
Hive query HBase so slow
Hive query HBase so slow
I want to use Hive to query the data which is HBase table, like:
100 column=cf1:val, timestamp=1379536809907, value=val_100
And I type the following command in hive:
select * from hbase_table where value = 'val_100';
I believe everything has been set up. When I type the above command, it
shows me like this:
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_201309031344_0024, Tracking URL =
http://namenode:50030/jobdetails.jsp?jobid=job_201309031344_0024
Kill Command = /usr/libexec/../bin/hadoop job -kill job_201309031344_0024
Hadoop job information for Stage-1: number of mappers: 1; number of
reducers: 0
2013-09-18 14:45:53,815 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:46:54,654 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:47:55,449 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:48:56,193 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:49:56,990 Stage-1 map = 0%, reduce = 0%
Why the map task is always 0%? What's wrong with it? Does any place which
I do not configure?
I want to use Hive to query the data which is HBase table, like:
100 column=cf1:val, timestamp=1379536809907, value=val_100
And I type the following command in hive:
select * from hbase_table where value = 'val_100';
I believe everything has been set up. When I type the above command, it
shows me like this:
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_201309031344_0024, Tracking URL =
http://namenode:50030/jobdetails.jsp?jobid=job_201309031344_0024
Kill Command = /usr/libexec/../bin/hadoop job -kill job_201309031344_0024
Hadoop job information for Stage-1: number of mappers: 1; number of
reducers: 0
2013-09-18 14:45:53,815 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:46:54,654 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:47:55,449 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:48:56,193 Stage-1 map = 0%, reduce = 0%
2013-09-18 14:49:56,990 Stage-1 map = 0%, reduce = 0%
Why the map task is always 0%? What's wrong with it? Does any place which
I do not configure?
Is that possible to run a python built program on iOS as a static lib?
Is that possible to run a python built program on iOS as a static lib?
I have some AI code developed in python 2.7 that uses non-standard libraries.
I intend to compile it to work with my iPhone app.
I wouldn't like to re-program everything so, is that a way to compile my
python code + all dependencies into a static file so I can call it from my
iOS app as a function?
I have some AI code developed in python 2.7 that uses non-standard libraries.
I intend to compile it to work with my iPhone app.
I wouldn't like to re-program everything so, is that a way to compile my
python code + all dependencies into a static file so I can call it from my
iOS app as a function?
WinRT timed logout
WinRT timed logout
I am developing a WinRT app. One of the requirements is that the app
should have a "timed logout" feature. What this means is that on any
screen, if the app has been idle for 10 mins, the app should logout and
navigate back to the home screen.
The brute force way of doing this obviously would be to hook up pointer
pressed events on every grid of every page and resetting the timer if any
of these events is fired but I was wondering if there was a more elegant
and more reliable way of doing this.
Thanks, Rajeev
I am developing a WinRT app. One of the requirements is that the app
should have a "timed logout" feature. What this means is that on any
screen, if the app has been idle for 10 mins, the app should logout and
navigate back to the home screen.
The brute force way of doing this obviously would be to hook up pointer
pressed events on every grid of every page and resetting the timer if any
of these events is fired but I was wondering if there was a more elegant
and more reliable way of doing this.
Thanks, Rajeev
How to turn an object around and move into the opposite direction?
How to turn an object around and move into the opposite direction?
Considering out of bounds position is 6 and -6.
I want to make the ship turn around and move in the opposite direction.
This is the code I have.. It is still not working 100% how I want it. I am
curious to see if anyone had any ideas how do improve. Here is the logic
of my code.
//If the ship hits a boundary it turns around and moves in
the opp.
//direction. To do this, the ship's velocty should be
flipped from a
//negative into a positive number, or from pos to neg if
boundary
//is hit.
//if ship position is -5 at velocity -1 new ship pos is -6
//if ship position is -6 at velocity -1 new ship velocity
is +1
// new ship position
is +5
Here is my code:
public void move()
{
position = velocity + position;
if (position > 5)
{
velocity = -velocity;
}
else if (position < -5)
{
velocity = +velocity;
}
}
Considering out of bounds position is 6 and -6.
I want to make the ship turn around and move in the opposite direction.
This is the code I have.. It is still not working 100% how I want it. I am
curious to see if anyone had any ideas how do improve. Here is the logic
of my code.
//If the ship hits a boundary it turns around and moves in
the opp.
//direction. To do this, the ship's velocty should be
flipped from a
//negative into a positive number, or from pos to neg if
boundary
//is hit.
//if ship position is -5 at velocity -1 new ship pos is -6
//if ship position is -6 at velocity -1 new ship velocity
is +1
// new ship position
is +5
Here is my code:
public void move()
{
position = velocity + position;
if (position > 5)
{
velocity = -velocity;
}
else if (position < -5)
{
velocity = +velocity;
}
}
Raise error and don't execute else block if is the condition is true
Raise error and don't execute else block if is the condition is true
I want to write sql script to update my table if some columns don't have
null value, if it have null value the update statements will not be
executed, my code here raise the error and execute the else block,
why?????
IF EXISTS(select 1 from Invoices where Trx_Date is null or Trx_no is null
or OperaKey is null)
RAISERROR('This script can not been executed because of null value/values
in this columns.',0,1)
ELSE -- else code
I want to write sql script to update my table if some columns don't have
null value, if it have null value the update statements will not be
executed, my code here raise the error and execute the else block,
why?????
IF EXISTS(select 1 from Invoices where Trx_Date is null or Trx_no is null
or OperaKey is null)
RAISERROR('This script can not been executed because of null value/values
in this columns.',0,1)
ELSE -- else code
Tuesday, 17 September 2013
Displaying Textual Data from a remote webserver's jQuery.getJSON() script
Displaying Textual Data from a remote webserver's jQuery.getJSON() script
I'm working on a personal project to display data from a remote server,
the HTML code contains the something like the following:
<script>
jQuery.getJSON("http://someurl.com/something.cgi?
AJZ=1&STOCK=S",
function(data) {
if (data.information[0]) {
var returnHTML = "<table style=\"border: 1px solid
#E0E0E0;border-collapse: collapse;\"
It works fine on the remote server that calls the script, but I'm trying
to just copy the data fields (they are 4 or 5 lines of textual data). I've
attempted to write a simple perl script with use LWP::UserAgent and
HTTP::Request::Common to fetch it to a html page, but the script data
obviously needs a browser to execute.
Anyone have any tips on how to accomplish this?
I'm working on a personal project to display data from a remote server,
the HTML code contains the something like the following:
<script>
jQuery.getJSON("http://someurl.com/something.cgi?
AJZ=1&STOCK=S",
function(data) {
if (data.information[0]) {
var returnHTML = "<table style=\"border: 1px solid
#E0E0E0;border-collapse: collapse;\"
It works fine on the remote server that calls the script, but I'm trying
to just copy the data fields (they are 4 or 5 lines of textual data). I've
attempted to write a simple perl script with use LWP::UserAgent and
HTTP::Request::Common to fetch it to a html page, but the script data
obviously needs a browser to execute.
Anyone have any tips on how to accomplish this?
PostgreSQL time range duration over time series with default end if null
PostgreSQL time range duration over time series with default end if null
I need to be able to calculate the duration (in seconds) between two time
stamps as an aggregate over a time series using a default end_datetime if
it is null.
Imagine you have something like a punch card when you puch in and out:
username, start_datetime, end_datetime
What I want is a generated time series of the last N minutes with the
duration for all users that overlap within that time frame. So it would be
the SUM(end_datetime - start_datetime) where you would COALESCE a default
end_datetime if it is null.
So the basic pieces I think I need are:
Generate the time interval:
select TIMESTAMP '2013-01-01 12:01:00' - (interval '1' minute *
generate_series(0,5)) as timestamps;
COALESCE a default end_datetime
COALESCE(end_datetime, NOW())
Figure out the seconds difference between the start and end dates
So if one user logged in at 11:56:50 and it is now 12:01:40 we should get
a table like:
timestamps duration
-------------------------------------
2013-01-01 12:01:00 40
2013-01-01 12:00:00 60
2013-01-01 11:59:00 60
2013-01-01 11:58:00 60
2013-01-01 11:57:00 60
2013-01-01 11:56:00 10
I need to be able to calculate the duration (in seconds) between two time
stamps as an aggregate over a time series using a default end_datetime if
it is null.
Imagine you have something like a punch card when you puch in and out:
username, start_datetime, end_datetime
What I want is a generated time series of the last N minutes with the
duration for all users that overlap within that time frame. So it would be
the SUM(end_datetime - start_datetime) where you would COALESCE a default
end_datetime if it is null.
So the basic pieces I think I need are:
Generate the time interval:
select TIMESTAMP '2013-01-01 12:01:00' - (interval '1' minute *
generate_series(0,5)) as timestamps;
COALESCE a default end_datetime
COALESCE(end_datetime, NOW())
Figure out the seconds difference between the start and end dates
So if one user logged in at 11:56:50 and it is now 12:01:40 we should get
a table like:
timestamps duration
-------------------------------------
2013-01-01 12:01:00 40
2013-01-01 12:00:00 60
2013-01-01 11:59:00 60
2013-01-01 11:58:00 60
2013-01-01 11:57:00 60
2013-01-01 11:56:00 10
How to Invoke-Command and pass path to command as parameter
How to Invoke-Command and pass path to command as parameter
I'm tearing my hair out trying to invoke-command but pass the path to the
exe as a parameter
eg: I want to take this command
powershell Invoke-Command -ComputerName server -ScriptBlock {
param($command ) C:\windows\system32\getmac.exe /$command } -ArgumentList
?
and translate it into a form like this
powershell Invoke-Command -ComputerName server -ScriptBlock { param($path,
$command ) $path\getmac.exe /$command } -ArgumentList
C:\windows\system32,?
I've tried all manner of quoting, ampersands and other contortions but
can't get it to work. The above attempt results in
Unexpected token '\getmac.exe' in expression or statement. At line:1 char:97
(I don't really want to invoke getmac, this is the SO distilled version)
I'm tearing my hair out trying to invoke-command but pass the path to the
exe as a parameter
eg: I want to take this command
powershell Invoke-Command -ComputerName server -ScriptBlock {
param($command ) C:\windows\system32\getmac.exe /$command } -ArgumentList
?
and translate it into a form like this
powershell Invoke-Command -ComputerName server -ScriptBlock { param($path,
$command ) $path\getmac.exe /$command } -ArgumentList
C:\windows\system32,?
I've tried all manner of quoting, ampersands and other contortions but
can't get it to work. The above attempt results in
Unexpected token '\getmac.exe' in expression or statement. At line:1 char:97
(I don't really want to invoke getmac, this is the SO distilled version)
How to find table name if i know only data which stored in it
How to find table name if i know only data which stored in it
I have DB which contane more than 100 tables. Most of the tables have
names like SY0001234 i know data which stored in that table but do not
know name of it so cant runn nosrmal select agens it. Do you have any
ideas how to find table name?
I have DB which contane more than 100 tables. Most of the tables have
names like SY0001234 i know data which stored in that table but do not
know name of it so cant runn nosrmal select agens it. Do you have any
ideas how to find table name?
SQL - Converting data to DateTime intervals
SQL - Converting data to DateTime intervals
I'm looking for some elegant SQL code that will read this
and create this
when given a parameter of @interval (minutes integer)
Thank you very much in advance.
I'm looking for some elegant SQL code that will read this
and create this
when given a parameter of @interval (minutes integer)
Thank you very much in advance.
Sunday, 15 September 2013
Solving approach a Perm Gen out of memory memory issue
Solving approach a Perm Gen out of memory memory issue
Please read it completely before marking it duplicate
I have gone through many blogs/post here and on google in order to find a
concrete way to resolve the perm gen OOM issue; but none of them has
solved the issue so far. Here is the my use-case:
I have a tomcat server on which many individual project *.war files are
deployed.
The perm gen issue was not a problem initially and we kept on adding more
modules.
Recently we faced Perm Gen - OOM issue and it was successfully resolved by
increasing perm gen memory in JVM parameter.
We kept on adding more modules and then one fine day again encountered
this issue.
As a temporary solution, we keep on re-starting our server and the issue
remain silent for a week or so.
Approach towards permanent solution:
The famous approach to increase perm gen in JVM parameter is not an option
anymore.
I understand that this could be a code issue, which is causing perm gen
memory leak. But reviewing the huge codebase is almost impossible.
Your help needed:
Is there a free tool or quick way (or tips) to figure out a bad code here?
One observation in our code module:
I have observed that in each of the module *war, there is 80% common jar
used, but all of them is bundled individually into each of the war.
What I see here (I may be wrong)
The tomcat server must be using individual app-classloader for each of the
modules war.
So, even though two same classes from a jar (say same abcd.jar located
into different war) gets loaded in perm gen area; they would not be
visible to each other (due to java security model).
In short for each of the app, many copies of a class may be getting loaded
(which, otherwise could be made common).
Your help needed:
Is the above analysis holds true?
If we move the common jars into some common lib path and include that path
into tomcat shared lib configuration, would it help? My target is only one
copy of class loaded into perm gen area.
At last - What other way I should think about?
Please read it completely before marking it duplicate
I have gone through many blogs/post here and on google in order to find a
concrete way to resolve the perm gen OOM issue; but none of them has
solved the issue so far. Here is the my use-case:
I have a tomcat server on which many individual project *.war files are
deployed.
The perm gen issue was not a problem initially and we kept on adding more
modules.
Recently we faced Perm Gen - OOM issue and it was successfully resolved by
increasing perm gen memory in JVM parameter.
We kept on adding more modules and then one fine day again encountered
this issue.
As a temporary solution, we keep on re-starting our server and the issue
remain silent for a week or so.
Approach towards permanent solution:
The famous approach to increase perm gen in JVM parameter is not an option
anymore.
I understand that this could be a code issue, which is causing perm gen
memory leak. But reviewing the huge codebase is almost impossible.
Your help needed:
Is there a free tool or quick way (or tips) to figure out a bad code here?
One observation in our code module:
I have observed that in each of the module *war, there is 80% common jar
used, but all of them is bundled individually into each of the war.
What I see here (I may be wrong)
The tomcat server must be using individual app-classloader for each of the
modules war.
So, even though two same classes from a jar (say same abcd.jar located
into different war) gets loaded in perm gen area; they would not be
visible to each other (due to java security model).
In short for each of the app, many copies of a class may be getting loaded
(which, otherwise could be made common).
Your help needed:
Is the above analysis holds true?
If we move the common jars into some common lib path and include that path
into tomcat shared lib configuration, would it help? My target is only one
copy of class loaded into perm gen area.
At last - What other way I should think about?
Calling the method - new to this
Calling the method - new to this
I am writing a program to collate two inputted strings of text e.g.
"google" "chrome" becomes "gcohorgmlee" (you can assume that the letters
are equal length).
import java.util.Scanner;
public class Collate{
String result;
String a;
String b;
public void main(String[] args){
System.out.printf("Enter 1st word: ");
Scanner in1 = new Scanner(System.in);
a = in1.next();
System.out.printf("Enter second word: ");
Scanner in2 = new Scanner(System.in);
b = in2.next();
}
public String collate(String a, String b){
String accumulator;
this.a = a;
this.b = b;
for(int i = 0; i < a.length(); i++)
{
result += a.charAt(i);
result += b.charAt(i);
}
return (result);
}
}
I am stuck however on how to call the method (collate). I am very new to
java and hardly know anything so some pointers and help would be greatly
appreciated! Many thanks, Miten
I am writing a program to collate two inputted strings of text e.g.
"google" "chrome" becomes "gcohorgmlee" (you can assume that the letters
are equal length).
import java.util.Scanner;
public class Collate{
String result;
String a;
String b;
public void main(String[] args){
System.out.printf("Enter 1st word: ");
Scanner in1 = new Scanner(System.in);
a = in1.next();
System.out.printf("Enter second word: ");
Scanner in2 = new Scanner(System.in);
b = in2.next();
}
public String collate(String a, String b){
String accumulator;
this.a = a;
this.b = b;
for(int i = 0; i < a.length(); i++)
{
result += a.charAt(i);
result += b.charAt(i);
}
return (result);
}
}
I am stuck however on how to call the method (collate). I am very new to
java and hardly know anything so some pointers and help would be greatly
appreciated! Many thanks, Miten
How to get the background-image to show in the web browser?
How to get the background-image to show in the web browser?
I am making a webpage on basic smartphone photography and I spent a lot of
time trying to figure out why the background image didn't show up as it's
suppose to. I tested it by moving everything (index.html, screen.css, and
the image) to the desktop without directories and the background image
shows up. My final theory is that it doesn't show due to the directories
they were put in.
CORRECT DIRECTORY:
index.html > assets > css > screen.css
index.html > assets > img > Nokia-Lumia-1020.jpg
My HTML and CSS code is in jsfiddle:
http://jsfiddle.net/TheAmazingKnight/U5QnK/
CSS:
html{
background: url('assets/img/Nokia-Lumia-1020.jpg') no-repeat center center
fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
I also tried it in the body element, they both work without directories,
but in directories not. What could be wrong here?
I am making a webpage on basic smartphone photography and I spent a lot of
time trying to figure out why the background image didn't show up as it's
suppose to. I tested it by moving everything (index.html, screen.css, and
the image) to the desktop without directories and the background image
shows up. My final theory is that it doesn't show due to the directories
they were put in.
CORRECT DIRECTORY:
index.html > assets > css > screen.css
index.html > assets > img > Nokia-Lumia-1020.jpg
My HTML and CSS code is in jsfiddle:
http://jsfiddle.net/TheAmazingKnight/U5QnK/
CSS:
html{
background: url('assets/img/Nokia-Lumia-1020.jpg') no-repeat center center
fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
I also tried it in the body element, they both work without directories,
but in directories not. What could be wrong here?
Surface Table - how to uninstall a Program from start menu
Surface Table - how to uninstall a Program from start menu
i am stuck in a severe situation as i have no mouse and No right click is
working on the Surface tab start menu. is the start menu entirely mouse
dependent or there's some gesture I am missing ??
Please advice.
i am stuck in a severe situation as i have no mouse and No right click is
working on the Surface tab start menu. is the start menu entirely mouse
dependent or there's some gesture I am missing ??
Please advice.
Best way for UI program to check for internal event
Best way for UI program to check for internal event
I have a WinForms application that is the UI layer running over the logic
layers.
My application is a client-server IM program. When the internal program
accepts an incoming connection request I'd like the UI to be updated by a
simple button text change.
One way to do this would be to expose an internal boolean that is changed
by the logic layer when it has processed a request and is constantly
checked by the UI on its own thread.
This doesn't seem like the best way to me, I assume there are much better
built in ways for doing this?
I have a WinForms application that is the UI layer running over the logic
layers.
My application is a client-server IM program. When the internal program
accepts an incoming connection request I'd like the UI to be updated by a
simple button text change.
One way to do this would be to expose an internal boolean that is changed
by the logic layer when it has processed a request and is constantly
checked by the UI on its own thread.
This doesn't seem like the best way to me, I assume there are much better
built in ways for doing this?
How to declare a constant with only function scope in PHP
How to declare a constant with only function scope in PHP
I'm writing a standalone function in PHP and I want to declare a constant
to prevent using a magic number. The constant does not need to be global,
which is what define()would produce; function-level scope would be the
best option. Basically, I'm looking for the equivalent of a local
finalvariable in Java.
I'm writing a standalone function in PHP and I want to declare a constant
to prevent using a magic number. The constant does not need to be global,
which is what define()would produce; function-level scope would be the
best option. Basically, I'm looking for the equivalent of a local
finalvariable in Java.
get a variable from javascript and use it in php
get a variable from javascript and use it in php
I want that when the user clicks an image a pop up window shows up asking
the user to input a name, in this case I want to create a folder in a
directory therefore the user has to input the name of the new folder to be
created.
Now to create the pop up I need to use javascript and to create the folder
I need to use PHP (server side). I am using the following code:
When the user clicks the image:
<div>
<a id="myLink" onclick="MyFunction();">
<img src="images/create_folder.png" width="60px" alt="create folder"/>
</a>
</div>
The code I am using to execute this operation:
<script>
function MyFunction(){
var foldername = prompt('Enter Folder Name');
<?php
$foldername = $_GET['foldername'];
mkdir('users_page/folders/', true);
?>
}
</script>
The pop up window I showing however when I click the ok button the folder
is not being created.
Can any one please help.
Thanks!
I want that when the user clicks an image a pop up window shows up asking
the user to input a name, in this case I want to create a folder in a
directory therefore the user has to input the name of the new folder to be
created.
Now to create the pop up I need to use javascript and to create the folder
I need to use PHP (server side). I am using the following code:
When the user clicks the image:
<div>
<a id="myLink" onclick="MyFunction();">
<img src="images/create_folder.png" width="60px" alt="create folder"/>
</a>
</div>
The code I am using to execute this operation:
<script>
function MyFunction(){
var foldername = prompt('Enter Folder Name');
<?php
$foldername = $_GET['foldername'];
mkdir('users_page/folders/', true);
?>
}
</script>
The pop up window I showing however when I click the ok button the folder
is not being created.
Can any one please help.
Thanks!
Saturday, 14 September 2013
Hadoop ConnectException
Hadoop ConnectException
I recently installed hadoop on my local ubuntu. I have started data-node
by invoking bin/start-all.sh script. However when I try to run the word
count program
bin/hadoop jar hadoop-examples-1.2.1.jar wordcount
/home/USER/Desktop/books /home/USER/Desktop/books-output
I always get a connect exception. The folder 'books' is on my deskop. Any
suggestions on how to overcome this?
I have followed every steps in this tutorial. I am not sure how to get rid
of that error. All help will be appreciated.
I recently installed hadoop on my local ubuntu. I have started data-node
by invoking bin/start-all.sh script. However when I try to run the word
count program
bin/hadoop jar hadoop-examples-1.2.1.jar wordcount
/home/USER/Desktop/books /home/USER/Desktop/books-output
I always get a connect exception. The folder 'books' is on my deskop. Any
suggestions on how to overcome this?
I have followed every steps in this tutorial. I am not sure how to get rid
of that error. All help will be appreciated.
NSURConnection GET REQUEST
NSURConnection GET REQUEST
I came across NSURLConnection, I used it before, simply on request, and
getting data and parsing it. However this time web developer has developed
GET and POST requests.
I want through many tutorials and stack question and tried to get desired
result. As I see there is sometime request, like this
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL
URLWithString:@"URL"]
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:10];
[request setHTTPMethod: @"GET"];
NSError *requestError;
NSURLResponse *urlResponse = nil;
NSData *response1 = [NSURLConnection sendSynchronousRequest:request
returningResponse:&urlResponse error:&requestError];
also few others I have seen.
I looks easy but I am unable to find what is required for any POST and GET
request.
The data which I have received from my web developer is
SOAP 1.2
POST /DEMOService/DEMO.asmx HTTP/1.1
Host: projects.demosite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
and in return there will be GET and POST
The following is a sample HTTP GET request and response. The placeholders
shown need to be replaced with actual values.
GET
/DEMOService/DEMO.asmx/VerifyLogin?username=string&password=string&AuthenticationKey=string
HTTP/1.1
Host: projects.demosite.com
I am well-aware of delegates of NSURLConnections, which are following..
#pragma mark NSURLConnection Delegate Methods
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSURLResponse *)response {
// A response has been received, this is where we initialize the instance
var you created
// so that we can append data to it in the didReceiveData method
// Furthermore, this method is called each time there is a redirect so
reinitializing it
// also serves to clear it
_responseData = [[NSMutableData alloc] init];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData
*)data {
// Append the new data to the instance variable you declared
[_responseData appendData:data];
}
- (NSCachedURLResponse *)connection:(NSURLConnection *)connection
willCacheResponse:(NSCachedURLResponse*)cachedResponse {
// Return nil to indicate not necessary to store a cached response for
this connection
return nil;
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
// The request is complete and data has been received
// You can parse the stuff in your instance variable now
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError
*)error {
// The request has failed for some reason!
// Check the error var
}
THE ONLY THING WHERE I AM STUCK IS
How to write request where I have pass arguments, in GET or POST request.
Thanks
I came across NSURLConnection, I used it before, simply on request, and
getting data and parsing it. However this time web developer has developed
GET and POST requests.
I want through many tutorials and stack question and tried to get desired
result. As I see there is sometime request, like this
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL
URLWithString:@"URL"]
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:10];
[request setHTTPMethod: @"GET"];
NSError *requestError;
NSURLResponse *urlResponse = nil;
NSData *response1 = [NSURLConnection sendSynchronousRequest:request
returningResponse:&urlResponse error:&requestError];
also few others I have seen.
I looks easy but I am unable to find what is required for any POST and GET
request.
The data which I have received from my web developer is
SOAP 1.2
POST /DEMOService/DEMO.asmx HTTP/1.1
Host: projects.demosite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
and in return there will be GET and POST
The following is a sample HTTP GET request and response. The placeholders
shown need to be replaced with actual values.
GET
/DEMOService/DEMO.asmx/VerifyLogin?username=string&password=string&AuthenticationKey=string
HTTP/1.1
Host: projects.demosite.com
I am well-aware of delegates of NSURLConnections, which are following..
#pragma mark NSURLConnection Delegate Methods
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSURLResponse *)response {
// A response has been received, this is where we initialize the instance
var you created
// so that we can append data to it in the didReceiveData method
// Furthermore, this method is called each time there is a redirect so
reinitializing it
// also serves to clear it
_responseData = [[NSMutableData alloc] init];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData
*)data {
// Append the new data to the instance variable you declared
[_responseData appendData:data];
}
- (NSCachedURLResponse *)connection:(NSURLConnection *)connection
willCacheResponse:(NSCachedURLResponse*)cachedResponse {
// Return nil to indicate not necessary to store a cached response for
this connection
return nil;
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
// The request is complete and data has been received
// You can parse the stuff in your instance variable now
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError
*)error {
// The request has failed for some reason!
// Check the error var
}
THE ONLY THING WHERE I AM STUCK IS
How to write request where I have pass arguments, in GET or POST request.
Thanks
how to get google search url as reference url in javascript?
how to get google search url as reference url in javascript?
i'm creating a project which needs the keywords from search engines to
show users.
i have tried document.referrer but it shows only referrer domain.
if user searches like "buy a pc" then this url is generating by google
https://www.google.com/search?q=buy+a+pc&oq=buy+a+pc&aqs=chrome..69i57j5j0l2j69i61.1674j0&sourceid=chrome&ie=UTF-8#psj=1&q=buy+a+pc
now i need this url when user choose the my website or my site page from
google results to extract keywords from url but i have to do this by
javascript only.
Thanks.
i'm creating a project which needs the keywords from search engines to
show users.
i have tried document.referrer but it shows only referrer domain.
if user searches like "buy a pc" then this url is generating by google
https://www.google.com/search?q=buy+a+pc&oq=buy+a+pc&aqs=chrome..69i57j5j0l2j69i61.1674j0&sourceid=chrome&ie=UTF-8#psj=1&q=buy+a+pc
now i need this url when user choose the my website or my site page from
google results to extract keywords from url but i have to do this by
javascript only.
Thanks.
Deleting item from ListView and SharedPreferences
Deleting item from ListView and SharedPreferences
I've been having a lot of trouble trying to figure out how to delete an
item from a ListView. I saw some similar questions, though none with
answers that helped me to produce a working solution.
I have a layout which includes the listview, an edittext and a button. On
button click, the edittext's string is added to the listview. Clicking on
a listview item opens a dialog which asks for confirmation to delete that
item. When confirmation is received, the item appears to delete. But when
the delete button is clicked on another item, the item deletes, but the
previous item reappears in its spot. From my limited understanding, I
assume that the item doesn't delete from the SharedPreferences, and so
when they are loaded again, the item reappears. I've tried clearing the
SharedPreferences before saving after delete, but this didn't help (though
I could've been doing it wrong).
I've included the whole class incase anyone has time to test it out in
their IDE, and incase any other beginners can make use of the working
parts.
package com.example.send2omni;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.AndroidCharacter;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ContextsList extends Activity {
public static final String CONTEXTS = "contexts_list";
EditText display;
ListView lv;
public ArrayAdapter<String> adapter;
Button addButton;
String temp_appender;
String appender = "";
List<String> dataset;
String[] splitup;
public String items;
ArrayList<String> itemsarraylist;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contexts_list);
display = (EditText) findViewById(R.id.editText);
lv = (ListView) findViewById(R.id.listView);
addButton = (Button) findViewById(R.id.bAdd);
LoadPreferences();
lv.setAdapter(adapter);
LoadPreferences();
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
appender = LoadPreferences();
if(display.getText().toString() != null){
temp_appender = display.getText().toString();
String string_to_split = appender + "," + temp_appender;
List<String> items =
Arrays.asList(string_to_split.split(","));
adapter = new ArrayAdapter<String>
(getApplicationContext(), android.R.layout.simple_list_item_1, items);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
SavePreferences("LISTS", string_to_split, null);
LoadPreferences();
}
display.setText("");
}
});
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
deleteItem(arg1);
}
});
}
protected void deleteItem(final View arg1)
{
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
dialogBuilder.setTitle("Delete");
dialogBuilder.setMessage
("Do you want to delete \"" + ((TextView) arg1).getText() + "\"?");
dialogBuilder.setPositiveButton("Yes", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String splitit = LoadPreferences();
List<String> listit = Arrays.asList(splitit.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <listit.size(); i++){
itemsarraylist.add(i, listit.get(i));
}
try {
adapter.remove(((TextView) arg1).getText().toString());
adapter.notifyDataSetChanged();
itemsarraylist.remove(((TextView)
arg1).getText().toString());
try{
SavePreferences("LISTS", null, itemsarraylist);
}catch(Exception e){
}
} catch (Exception e) {
Log.e("remove", "failed");
}
}
});
dialogBuilder.setNeutralButton("No", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog deleteDialog = dialogBuilder.create();
deleteDialog.show();
}
protected void SavePreferences(String key, String value, ArrayList<String>
opt) {
// TODO Auto-generated method stub
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
if (opt != null){
for (int i = 0 ; i <= opt.size(); i++)
value += opt.get(i) + ",";
}
SharedPreferences.Editor editor = data.edit();
editor.putString(key, value);
editor.commit();
}
protected String LoadPreferences(){
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
String dataSet = data.getString("LISTS", "");
dataset = Arrays.asList(dataSet.split(","));
splitup = dataSet.split(",");
List<String> items = Arrays.asList(dataSet.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <items.size(); i++){
itemsarraylist.add(i, items.get(i));
}
adapter = new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, itemsarraylist);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
return dataSet;
}
}
And here's the layout to save some time:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Context"
android:id="@+id/bAdd"
android:layout_gravity="center_horizontal|top"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/editText"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_gravity="center"
android:longClickable="true"
android:headerDividersEnabled="false"
/>
</LinearLayout>
</LinearLayout>
I cannot express how grateful I'd be if anyone could get this to work.
It's the last step I have in completing my first app.
Thanks for your time everyone.
I've been having a lot of trouble trying to figure out how to delete an
item from a ListView. I saw some similar questions, though none with
answers that helped me to produce a working solution.
I have a layout which includes the listview, an edittext and a button. On
button click, the edittext's string is added to the listview. Clicking on
a listview item opens a dialog which asks for confirmation to delete that
item. When confirmation is received, the item appears to delete. But when
the delete button is clicked on another item, the item deletes, but the
previous item reappears in its spot. From my limited understanding, I
assume that the item doesn't delete from the SharedPreferences, and so
when they are loaded again, the item reappears. I've tried clearing the
SharedPreferences before saving after delete, but this didn't help (though
I could've been doing it wrong).
I've included the whole class incase anyone has time to test it out in
their IDE, and incase any other beginners can make use of the working
parts.
package com.example.send2omni;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.AndroidCharacter;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ContextsList extends Activity {
public static final String CONTEXTS = "contexts_list";
EditText display;
ListView lv;
public ArrayAdapter<String> adapter;
Button addButton;
String temp_appender;
String appender = "";
List<String> dataset;
String[] splitup;
public String items;
ArrayList<String> itemsarraylist;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contexts_list);
display = (EditText) findViewById(R.id.editText);
lv = (ListView) findViewById(R.id.listView);
addButton = (Button) findViewById(R.id.bAdd);
LoadPreferences();
lv.setAdapter(adapter);
LoadPreferences();
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
appender = LoadPreferences();
if(display.getText().toString() != null){
temp_appender = display.getText().toString();
String string_to_split = appender + "," + temp_appender;
List<String> items =
Arrays.asList(string_to_split.split(","));
adapter = new ArrayAdapter<String>
(getApplicationContext(), android.R.layout.simple_list_item_1, items);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
SavePreferences("LISTS", string_to_split, null);
LoadPreferences();
}
display.setText("");
}
});
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
deleteItem(arg1);
}
});
}
protected void deleteItem(final View arg1)
{
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
dialogBuilder.setTitle("Delete");
dialogBuilder.setMessage
("Do you want to delete \"" + ((TextView) arg1).getText() + "\"?");
dialogBuilder.setPositiveButton("Yes", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String splitit = LoadPreferences();
List<String> listit = Arrays.asList(splitit.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <listit.size(); i++){
itemsarraylist.add(i, listit.get(i));
}
try {
adapter.remove(((TextView) arg1).getText().toString());
adapter.notifyDataSetChanged();
itemsarraylist.remove(((TextView)
arg1).getText().toString());
try{
SavePreferences("LISTS", null, itemsarraylist);
}catch(Exception e){
}
} catch (Exception e) {
Log.e("remove", "failed");
}
}
});
dialogBuilder.setNeutralButton("No", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog deleteDialog = dialogBuilder.create();
deleteDialog.show();
}
protected void SavePreferences(String key, String value, ArrayList<String>
opt) {
// TODO Auto-generated method stub
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
if (opt != null){
for (int i = 0 ; i <= opt.size(); i++)
value += opt.get(i) + ",";
}
SharedPreferences.Editor editor = data.edit();
editor.putString(key, value);
editor.commit();
}
protected String LoadPreferences(){
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
String dataSet = data.getString("LISTS", "");
dataset = Arrays.asList(dataSet.split(","));
splitup = dataSet.split(",");
List<String> items = Arrays.asList(dataSet.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <items.size(); i++){
itemsarraylist.add(i, items.get(i));
}
adapter = new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, itemsarraylist);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
return dataSet;
}
}
And here's the layout to save some time:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Context"
android:id="@+id/bAdd"
android:layout_gravity="center_horizontal|top"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/editText"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_gravity="center"
android:longClickable="true"
android:headerDividersEnabled="false"
/>
</LinearLayout>
</LinearLayout>
I cannot express how grateful I'd be if anyone could get this to work.
It's the last step I have in completing my first app.
Thanks for your time everyone.
Animate rotation and location of view at same time
Animate rotation and location of view at same time
What is the best way to rotate a view and move its location at the same time?
I want this view to rotate 1 full revolution while sliding to the left,
then rotate the other direction while sliding back to its original
position. I got the first part of this working (rotate while sliding to
left), but when I try to rotate while sliding back to the right, the view
jumps back to its original spot without animating.
What am I doing wrong?
// step 1 (this works)
[UIView animateWithDuration:0.3f animations:^{
self.number.transform =
CGAffineTransformMakeRotation(DegreesToRadians(180));
self.number.transform = CGAffineTransformMakeTranslation(-160, 0);
self.number.center = CGPointMake(self.number.center.x - 160,
self.number.center.y);
} completion:nil];
// step 2 (this doesn't work)
[UIView animateWithDuration:0.2f animations:^{
self.number.transform =
CGAffineTransformMakeRotation(DegreesToRadians(180));
self.number.transform = CGAffineTransformMakeTranslation(160, 0);
self.number.center = CGPointMake(self.number.center.x + 160,
self.number.center.y);
} completion:nil];
What is the best way to rotate a view and move its location at the same time?
I want this view to rotate 1 full revolution while sliding to the left,
then rotate the other direction while sliding back to its original
position. I got the first part of this working (rotate while sliding to
left), but when I try to rotate while sliding back to the right, the view
jumps back to its original spot without animating.
What am I doing wrong?
// step 1 (this works)
[UIView animateWithDuration:0.3f animations:^{
self.number.transform =
CGAffineTransformMakeRotation(DegreesToRadians(180));
self.number.transform = CGAffineTransformMakeTranslation(-160, 0);
self.number.center = CGPointMake(self.number.center.x - 160,
self.number.center.y);
} completion:nil];
// step 2 (this doesn't work)
[UIView animateWithDuration:0.2f animations:^{
self.number.transform =
CGAffineTransformMakeRotation(DegreesToRadians(180));
self.number.transform = CGAffineTransformMakeTranslation(160, 0);
self.number.center = CGPointMake(self.number.center.x + 160,
self.number.center.y);
} completion:nil];
PHP, error Undefined offset
PHP, error Undefined offset
I have a script that lists a few Twitch.tv and shows if they are offline
or online. I'm trying to integrate it in one of my pages, but I'm getting
several Undefined offset errors.
This is the script:
$members = array("maegis","androide456","avonmexicola","iksf");
// This variable becomes one long url with the channel names stringed up
behind it
// This url then fetches a json file from twitch with all the selected
channels information
$userGrab = "http://api.justin.tv/api/stream/list.json?channel=";
//I use this array to compare with the members array. All users in this
arrat are substracted from the members array and hence are //"offline"
$checkedOnline = array ();
foreach($members as $i =>$value){
$userGrab .= ",";
$userGrab .= $value;
}
unset($value);
//grabs the channel data from twitch.tv streams
$json_file = file_get_contents($userGrab, 0, null, null);
$json_array = json_decode($json_file, true);
//get's member names from stream url's and checks for online members
foreach($members as $i =>$value){
$title = $json_array['$i']['channel']['channel_url'];
$array = explode('/', $title);
$member = end($array);
$viewer = $json_array['$i'] ['stream_count'];
onlinecheck($member, $viewer);
$checkedOnline[] = signin($member);
}
unset($value);
unset($i);
//checks if player streams are online
function onlinecheck($online, $viewers)
{
//If the variable online is not equal to null, there is a good change this
person is currently streaming
if ($online != null)
{
echo '<a href="http://www.twitch.tv/'.$online.'">
<strong>'.$online.'</strong></a>';
echo '  <img src="/images/online.png"><strong> Status:</strong>
Online! </br>';
echo '<img src="/images/viewers.png"><strong>Viewers:</strong>  '
.$viewers.'</br>';
}
}
//This funcion add's online channel names to the checked online array
function signin($person){
if($person != null){
return $person;
}
else{
return null;
}
}
After this, I'm using this code to display the streams:
//This part list all the people currently offline. Here the array with
online users is compared with the total users.
//online users are then removed from the total users array.
foreach ($members as $i => $value1) {
foreach($checkedOnline as $ii => $value2){
if($value1 == $value2){
unset($members[$i]);
}
}
}
//print a nice list with people that can't currently be bothered with
streaming their games
foreach ($members as $i => $value) {
echo '<a href="http://www.twitch.tv/'.$value.'">
<strong>'.$value.'</strong></a>';
echo ' <img src="/images/offline.png"> <strong> Status :</strong>
Offline! </br>';
}
Now, the errors. I'm getting this:
Notice: Undefined offset: 0 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Notice: Undefined offset: 0 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 45
Notice: Undefined offset: 1 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Notice: Undefined offset: 1 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 45
Notice: Undefined offset: 2 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Notice: Undefined offset: 2 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 45
Notice: Undefined offset: 3 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Warning: Invalid argument supplied for foreach() in
C:\xampp\htdocs\wp-content\themes\fesport\sidebar.php on line 75
Warning: Invalid argument supplied for foreach() in
C:\xampp\htdocs\wp-content\themes\fesport\sidebar.php on line 84
Can someone help? Is there a way to solve this? I'm not that good at PHP
and I don't know what to do.
I have a script that lists a few Twitch.tv and shows if they are offline
or online. I'm trying to integrate it in one of my pages, but I'm getting
several Undefined offset errors.
This is the script:
$members = array("maegis","androide456","avonmexicola","iksf");
// This variable becomes one long url with the channel names stringed up
behind it
// This url then fetches a json file from twitch with all the selected
channels information
$userGrab = "http://api.justin.tv/api/stream/list.json?channel=";
//I use this array to compare with the members array. All users in this
arrat are substracted from the members array and hence are //"offline"
$checkedOnline = array ();
foreach($members as $i =>$value){
$userGrab .= ",";
$userGrab .= $value;
}
unset($value);
//grabs the channel data from twitch.tv streams
$json_file = file_get_contents($userGrab, 0, null, null);
$json_array = json_decode($json_file, true);
//get's member names from stream url's and checks for online members
foreach($members as $i =>$value){
$title = $json_array['$i']['channel']['channel_url'];
$array = explode('/', $title);
$member = end($array);
$viewer = $json_array['$i'] ['stream_count'];
onlinecheck($member, $viewer);
$checkedOnline[] = signin($member);
}
unset($value);
unset($i);
//checks if player streams are online
function onlinecheck($online, $viewers)
{
//If the variable online is not equal to null, there is a good change this
person is currently streaming
if ($online != null)
{
echo '<a href="http://www.twitch.tv/'.$online.'">
<strong>'.$online.'</strong></a>';
echo '  <img src="/images/online.png"><strong> Status:</strong>
Online! </br>';
echo '<img src="/images/viewers.png"><strong>Viewers:</strong>  '
.$viewers.'</br>';
}
}
//This funcion add's online channel names to the checked online array
function signin($person){
if($person != null){
return $person;
}
else{
return null;
}
}
After this, I'm using this code to display the streams:
//This part list all the people currently offline. Here the array with
online users is compared with the total users.
//online users are then removed from the total users array.
foreach ($members as $i => $value1) {
foreach($checkedOnline as $ii => $value2){
if($value1 == $value2){
unset($members[$i]);
}
}
}
//print a nice list with people that can't currently be bothered with
streaming their games
foreach ($members as $i => $value) {
echo '<a href="http://www.twitch.tv/'.$value.'">
<strong>'.$value.'</strong></a>';
echo ' <img src="/images/offline.png"> <strong> Status :</strong>
Offline! </br>';
}
Now, the errors. I'm getting this:
Notice: Undefined offset: 0 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Notice: Undefined offset: 0 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 45
Notice: Undefined offset: 1 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Notice: Undefined offset: 1 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 45
Notice: Undefined offset: 2 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Notice: Undefined offset: 2 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 45
Notice: Undefined offset: 3 in
C:\xampp\htdocs\wp-content\plugins\twitchlist\twitchlist.php on line 42
Warning: Invalid argument supplied for foreach() in
C:\xampp\htdocs\wp-content\themes\fesport\sidebar.php on line 75
Warning: Invalid argument supplied for foreach() in
C:\xampp\htdocs\wp-content\themes\fesport\sidebar.php on line 84
Can someone help? Is there a way to solve this? I'm not that good at PHP
and I don't know what to do.
How to render a mesh behind another mesh, like a mask?
How to render a mesh behind another mesh, like a mask?
I've tried googling this, but I've been having trouble phrasing this
problem because I don't know the terms involved in the process.
To be blunt: I would like it so that when mesh A (the character), is
behind mesh B (a wall), it is still rendered but with a solid gray color.
I'm beginning opengles 2.0 and I'm still unsure as to go about this. From
what I understand the depth buffer allows meshes to fight out who will be
seen in the fragments they encompass, also there are various blend
functions that could possibly involved in this, finally the stencil buffer
looks like it would also have this desirable functionality.
So is there a way to output different colors through the shader based on a
failed depth test? Is there a way to do this through blending? Or must I
use the stencil buffer some how?
And what is this technique called for future reference? I've seen it used
in a lot of video games.
Thanks
I've tried googling this, but I've been having trouble phrasing this
problem because I don't know the terms involved in the process.
To be blunt: I would like it so that when mesh A (the character), is
behind mesh B (a wall), it is still rendered but with a solid gray color.
I'm beginning opengles 2.0 and I'm still unsure as to go about this. From
what I understand the depth buffer allows meshes to fight out who will be
seen in the fragments they encompass, also there are various blend
functions that could possibly involved in this, finally the stencil buffer
looks like it would also have this desirable functionality.
So is there a way to output different colors through the shader based on a
failed depth test? Is there a way to do this through blending? Or must I
use the stencil buffer some how?
And what is this technique called for future reference? I've seen it used
in a lot of video games.
Thanks
Kohana 3.2 validate multiple fields
Kohana 3.2 validate multiple fields
I have following table
create table `groupusers`(
`id` int not null auto_increment,
`user` varchar(100) not null,
`group` varchar(100) not null,
UNIQUE KEY(`id`),
PRIMARY KEY(`user`, `group`)
)
My model looks like this,
class Model_Groupuser extends ORM{
protected $_table_name = 'groupusers';
public function rules(){
return array(
'user' => array(
array('not_empty'),
array(array($this, 'user_group_not_exists')),
),
'group' => array(
array('not_empty'),
array(array($this, 'user_group_not_exists')),
)
);
}
public function user_group_not_exists($param){
// Need to get other field's value here.
}
}
Problem is every time user_group_not_exists is called, its called with a
single parameter. Either user or group. But I need both to determine if
the combination exists in the db already.
How can I get current model's fields' value?
I have following table
create table `groupusers`(
`id` int not null auto_increment,
`user` varchar(100) not null,
`group` varchar(100) not null,
UNIQUE KEY(`id`),
PRIMARY KEY(`user`, `group`)
)
My model looks like this,
class Model_Groupuser extends ORM{
protected $_table_name = 'groupusers';
public function rules(){
return array(
'user' => array(
array('not_empty'),
array(array($this, 'user_group_not_exists')),
),
'group' => array(
array('not_empty'),
array(array($this, 'user_group_not_exists')),
)
);
}
public function user_group_not_exists($param){
// Need to get other field's value here.
}
}
Problem is every time user_group_not_exists is called, its called with a
single parameter. Either user or group. But I need both to determine if
the combination exists in the db already.
How can I get current model's fields' value?
Friday, 13 September 2013
How can i pass List response as an xml document using c#
How can i pass List response as an xml document using c#
I would like to pass an List response as an xml document and want to load
it as xml. Currently i am performing it using this code :
List<string> BugWSResponseList1 = new List<string>();
BugWSResponseList1 =
CreateBugs(FilePath_EXPRESS_API_BugAdd_CreateBugs_DataFile, newValue);
XmlDocument xd = new XmlDocument();
//string s = string.Join(",", BugWSResponseList2);
//xd.LoadXml(s);
string s = "<Bugs>" + string.Join(",",
BugWSResponseList1) + "</Bugs>";
xd.LoadXml(s);
//Dictionary Creation for Benchmark API
XmlDocument ResponseNode_bugs = null;
ResponseNode_bugs = new
DrWatsonCore().LoadXMLDocument(s);
I would like to avoid to convert the List<string> response to string first
and then loading it as xml. Please suggest how can i achieve that.
I would like to pass an List response as an xml document and want to load
it as xml. Currently i am performing it using this code :
List<string> BugWSResponseList1 = new List<string>();
BugWSResponseList1 =
CreateBugs(FilePath_EXPRESS_API_BugAdd_CreateBugs_DataFile, newValue);
XmlDocument xd = new XmlDocument();
//string s = string.Join(",", BugWSResponseList2);
//xd.LoadXml(s);
string s = "<Bugs>" + string.Join(",",
BugWSResponseList1) + "</Bugs>";
xd.LoadXml(s);
//Dictionary Creation for Benchmark API
XmlDocument ResponseNode_bugs = null;
ResponseNode_bugs = new
DrWatsonCore().LoadXMLDocument(s);
I would like to avoid to convert the List<string> response to string first
and then loading it as xml. Please suggest how can i achieve that.
Jquery accordion working fine locally but not online
Jquery accordion working fine locally but not online
Hi I have a responsive website http://netzed.ca/unit.html which has
textual information on the mobile version of it. the accordions work
perfectly fine on system locally but when I upload the files on the server
they dont.
Resize the window below 760px and you can see the layout. The features
with the + sign in front of them are suppose to act like accordions
Any help is appreciated. If you need more info please let me know. thanks
Hi I have a responsive website http://netzed.ca/unit.html which has
textual information on the mobile version of it. the accordions work
perfectly fine on system locally but when I upload the files on the server
they dont.
Resize the window below 760px and you can see the layout. The features
with the + sign in front of them are suppose to act like accordions
Any help is appreciated. If you need more info please let me know. thanks
jquery kill long-running .each function
jquery kill long-running .each function
I'm using this to sequentially fadeIn a stack of div's:
$('#headerwrapper div').each(function(i) {
$(this).delay(999 + (i * 999)).fadeIn();
});
http://jsfiddle.net/Wkjdd/3/
I'm trying to figure out how to stop it via .scroll. (Pause/resume would
be nice, but after searching around and trying dozens of things, I'm ready
to let go of wanting that much.)
Here's the scroll function:
$(window).scroll(function(){
if ($(this).scrollTop() > 20) {
$('#headerwrapper').fadeOut();
} else {
$('#headerwrapper').fadeIn();
}
});
The reason it seems so important to be able to kill the .each function is
the finished product is going to be loading dozens of images, and to me,
if those aren't even in the viewport the function should just stop so as
to free up processing/memory.
I have no idea is .fadeOut of the parent div is enough to actually
stop/kill the .each function, or if it's still firing off continuously in
the background for nothing. What's a more correct way to kill (or
pause/resume if you're feeling generous) this .each function?
I'm using this to sequentially fadeIn a stack of div's:
$('#headerwrapper div').each(function(i) {
$(this).delay(999 + (i * 999)).fadeIn();
});
http://jsfiddle.net/Wkjdd/3/
I'm trying to figure out how to stop it via .scroll. (Pause/resume would
be nice, but after searching around and trying dozens of things, I'm ready
to let go of wanting that much.)
Here's the scroll function:
$(window).scroll(function(){
if ($(this).scrollTop() > 20) {
$('#headerwrapper').fadeOut();
} else {
$('#headerwrapper').fadeIn();
}
});
The reason it seems so important to be able to kill the .each function is
the finished product is going to be loading dozens of images, and to me,
if those aren't even in the viewport the function should just stop so as
to free up processing/memory.
I have no idea is .fadeOut of the parent div is enough to actually
stop/kill the .each function, or if it's still firing off continuously in
the background for nothing. What's a more correct way to kill (or
pause/resume if you're feeling generous) this .each function?
Is there a safe way to make a HashSet without manually wrapping it in another object?
Is there a safe way to make a HashSet without manually wrapping it in
another object?
I have recently been having problems with Java apparently swallowing
entire int[] which are different from each other in value when I try to
merge two HashSet<int[]> using the addAll method. I do not have a small
working example because I only observe this behavior in a large dataset of
a million.
My understanding is that the equals and hashCode methods of the int[] are
not implemented to respect either the content or the pointer value of the
reference to an int array. Is there a way to modify the HashSet or the
int[] short of wrapping it, to make it safe to work with HashSet<int[]>?
another object?
I have recently been having problems with Java apparently swallowing
entire int[] which are different from each other in value when I try to
merge two HashSet<int[]> using the addAll method. I do not have a small
working example because I only observe this behavior in a large dataset of
a million.
My understanding is that the equals and hashCode methods of the int[] are
not implemented to respect either the content or the pointer value of the
reference to an int array. Is there a way to modify the HashSet or the
int[] short of wrapping it, to make it safe to work with HashSet<int[]>?
passing an array of structures from C# to C++ using IntPtr
passing an array of structures from C# to C++ using IntPtr
I have a structure -->
public struct readers
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1000)]
public IntPtr[] tag_list;
};
Marshalling has to be done in between "IntPtr[] tag_list" & structure
TAG_IN_PARAM
[StructLayout(LayoutKind.Sequential)]
internal struct TAG_IN_PARAM
{
public int vis_cnt;
public bool valid;
}
Also its an array as => TAG_IN_PARAM[] tag_list = new TAG_IN_PARAM[1000];
I want to pass structure "readers" from C# to C++ DLL. However, i have
been doing marshalling but garbage value is coming on DLL side.
// allocating memory Marshal.StructureToPtr(tag_list[j],
Reader.tag_list[j], false);
OR IF ANY OTHER WAY I CAN DO IT, PLEASE CONVEY. Any help would be
appreciated. Thanks in Advance.
I have a structure -->
public struct readers
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1000)]
public IntPtr[] tag_list;
};
Marshalling has to be done in between "IntPtr[] tag_list" & structure
TAG_IN_PARAM
[StructLayout(LayoutKind.Sequential)]
internal struct TAG_IN_PARAM
{
public int vis_cnt;
public bool valid;
}
Also its an array as => TAG_IN_PARAM[] tag_list = new TAG_IN_PARAM[1000];
I want to pass structure "readers" from C# to C++ DLL. However, i have
been doing marshalling but garbage value is coming on DLL side.
// allocating memory Marshal.StructureToPtr(tag_list[j],
Reader.tag_list[j], false);
OR IF ANY OTHER WAY I CAN DO IT, PLEASE CONVEY. Any help would be
appreciated. Thanks in Advance.
Thursday, 12 September 2013
Helvetica font is not supported on Internet Explorer 9
Helvetica font is not supported on Internet Explorer 9
I am developing site on drupal ,and I am using Helvetica font but not
supported on IE 9 ,is there any way to solve this problem.
I am developing site on drupal ,and I am using Helvetica font but not
supported on IE 9 ,is there any way to solve this problem.
How to Clear the Frame Work Boby
How to Clear the Frame Work Boby
Hi I am Working on the Selenium Web driver With TestNG Class, In My Web
Application I found small
Issue. In My Web Application Frame Work Body (Like Compose Box in Gmail),
In that Frame Work Body
Default Text Will be displaying, I need to Clear that Default Values in
the Frame Work and I need to
send the new Values in to the Frame Work Body, So I am using Below Code.
//Clearing the Values in the Body
//Entering the Cursor into the Body of the Text
driver.switchTo().frame(APL.MT_ET_FrameWork_Body_ID);
System.out.println("Entered the Cusor into the Body of the Text Box");
//Clicking the Cursor in the Frame Work Main Body.
driver.findElement(By.id(APL.MT_ET_MainBody_TxtBox_ID)).click();
System.out.println("Clicking the Cursor in the Body");
//Clearing the Frame Work Main Body
driver.findElement(By.id(APL.MT_ET_MainBody_TxtBox_ID)).clear();
System.out.println("Clearing the Values in the Body");
Note:- Here Frame Work Main Body is Not Clearing. So I need some Code and
I am using this Code also
But Not Working Fine. Below Three Options also not working fine.
//Clear the Frame Work Main Body by using Back_Space![enter image
description here][1] and Sending
Keys into that Frame Work
//driver.findElement(By.id(APL.MT_ET_MainBody_TxtBox_ID)).sendKeys(s16.getCell(1,j).BACK_SPACE);
//Clearing the Frame Work Main Body
//driver.findElement(By.tagName("//p")).clear();
//Clearing the Frame Work Main Body
// driver.findElement(By.tagName("//body/p")).clear();
// System.out.println("Clearing the Values in the Body");
Hi I am Working on the Selenium Web driver With TestNG Class, In My Web
Application I found small
Issue. In My Web Application Frame Work Body (Like Compose Box in Gmail),
In that Frame Work Body
Default Text Will be displaying, I need to Clear that Default Values in
the Frame Work and I need to
send the new Values in to the Frame Work Body, So I am using Below Code.
//Clearing the Values in the Body
//Entering the Cursor into the Body of the Text
driver.switchTo().frame(APL.MT_ET_FrameWork_Body_ID);
System.out.println("Entered the Cusor into the Body of the Text Box");
//Clicking the Cursor in the Frame Work Main Body.
driver.findElement(By.id(APL.MT_ET_MainBody_TxtBox_ID)).click();
System.out.println("Clicking the Cursor in the Body");
//Clearing the Frame Work Main Body
driver.findElement(By.id(APL.MT_ET_MainBody_TxtBox_ID)).clear();
System.out.println("Clearing the Values in the Body");
Note:- Here Frame Work Main Body is Not Clearing. So I need some Code and
I am using this Code also
But Not Working Fine. Below Three Options also not working fine.
//Clear the Frame Work Main Body by using Back_Space![enter image
description here][1] and Sending
Keys into that Frame Work
//driver.findElement(By.id(APL.MT_ET_MainBody_TxtBox_ID)).sendKeys(s16.getCell(1,j).BACK_SPACE);
//Clearing the Frame Work Main Body
//driver.findElement(By.tagName("//p")).clear();
//Clearing the Frame Work Main Body
// driver.findElement(By.tagName("//body/p")).clear();
// System.out.println("Clearing the Values in the Body");
how to implement custom methods of an ArrayList in Java?
how to implement custom methods of an ArrayList in Java?
Lets suppose that I have an ArrayList defined as follows:
ArrayList<Employee> listWithItems=new ArrayList();
I was wondering if there is a way so that I can create a custom method and
call it from the ArrayList created. I mean, for example if I create a
method for computing the taxes I want to call it like this:
listWithItems.computeTaxes();
Is there a way to extend the ArrayList in Java to implement custom user
methods? I mean if there is like an ArrayList interface that I could use
it for those purposes.
Thanks
Lets suppose that I have an ArrayList defined as follows:
ArrayList<Employee> listWithItems=new ArrayList();
I was wondering if there is a way so that I can create a custom method and
call it from the ArrayList created. I mean, for example if I create a
method for computing the taxes I want to call it like this:
listWithItems.computeTaxes();
Is there a way to extend the ArrayList in Java to implement custom user
methods? I mean if there is like an ArrayList interface that I could use
it for those purposes.
Thanks
EXCEPTION_ACCESS_VIOLATION - Java Game
EXCEPTION_ACCESS_VIOLATION - Java Game
I get the following error when running my game:
This error occurs when I create an instance of a class called Portal_Sign.
Typically I use the following code: game.stage.addActor((Actor)
con.newInstance(parameters)); I retrieved the "con" object from
Class.class.getConstructor(), which means I'm using reflection to
instantiate objects(Because I could be constructing any of many objects,
each with reasonably similar constructors).
I know I'm only getting the error when the Portal_Sign is being created.
If I change the values in the Vector2 that represents location to new
Vector2(1,1) I don't get a problem. The same applies for
(0,0),(0,1),(1,0),(0,-1),(-1,0),and (-1,-1), or any values that are
greater than or equal to -1 and less than or equal to +1.
if(c.getSimpleName().equals(Portal_Sign.class.getSimpleName())){
game.stage.addActor(new Portal_Sign(game,new
Vector2(2,1),0,0,"asdf|ASDF"));
}else{
game.stage.addActor((Actor) con.newInstance(parameters));
}
If I create 2 Portal_Signs the error goes away.
Here is some source code:
http://hobogames.atspace.cc/TEMPFORERROR/LevelManager.java (Relevant code
is in the try/catch at the bottom of the load method)
http://hobogames.atspace.cc/TEMPFORERROR/Portal_Sign.java
http://hobogames.atspace.cc/TEMPFORERROR/packs.level The file being
loaded. Note, the version uploaded DOES NOT cause error because it creates
2 signs. HOWEVER, if you remove the last
line(Portal_Sign(4,1,0,0,"Baddies|0/32");), you do get the listed error.
http://hobogames.atspace.cc/TEMPFORERROR/Solid.java The highest parent of
Portal_Sign, deals with Libgdx and box2D physics stuff, and the location.
I don't understand why I am getting this issue, any tips would be great,
please help. If you want anything else from me just ask for it.
I get the following error when running my game:
This error occurs when I create an instance of a class called Portal_Sign.
Typically I use the following code: game.stage.addActor((Actor)
con.newInstance(parameters)); I retrieved the "con" object from
Class.class.getConstructor(), which means I'm using reflection to
instantiate objects(Because I could be constructing any of many objects,
each with reasonably similar constructors).
I know I'm only getting the error when the Portal_Sign is being created.
If I change the values in the Vector2 that represents location to new
Vector2(1,1) I don't get a problem. The same applies for
(0,0),(0,1),(1,0),(0,-1),(-1,0),and (-1,-1), or any values that are
greater than or equal to -1 and less than or equal to +1.
if(c.getSimpleName().equals(Portal_Sign.class.getSimpleName())){
game.stage.addActor(new Portal_Sign(game,new
Vector2(2,1),0,0,"asdf|ASDF"));
}else{
game.stage.addActor((Actor) con.newInstance(parameters));
}
If I create 2 Portal_Signs the error goes away.
Here is some source code:
http://hobogames.atspace.cc/TEMPFORERROR/LevelManager.java (Relevant code
is in the try/catch at the bottom of the load method)
http://hobogames.atspace.cc/TEMPFORERROR/Portal_Sign.java
http://hobogames.atspace.cc/TEMPFORERROR/packs.level The file being
loaded. Note, the version uploaded DOES NOT cause error because it creates
2 signs. HOWEVER, if you remove the last
line(Portal_Sign(4,1,0,0,"Baddies|0/32");), you do get the listed error.
http://hobogames.atspace.cc/TEMPFORERROR/Solid.java The highest parent of
Portal_Sign, deals with Libgdx and box2D physics stuff, and the location.
I don't understand why I am getting this issue, any tips would be great,
please help. If you want anything else from me just ask for it.
Odd duplicate symbol error in C
Odd duplicate symbol error in C
Ok so i have a project, and i have some helper functions which need to be
shared in various other files. call it Helper.c /.h , with the
corresponding compilation flag to avoid multiple inclusion (#ifndef
SymbolName #define Symbolname blah blahblah
Ok so i have a project, and i have some helper functions which need to be
shared in various other files. call it Helper.c /.h , with the
corresponding compilation flag to avoid multiple inclusion (#ifndef
SymbolName #define Symbolname blah blahblah
Text loads too big in small window
Text loads too big in small window
I'm working on a site that uses jquery to change the font size on any
window resize, to keep everything in the right place. It works great, but
when someones browser isn't maximized, the font still loads as if it is,
until the user resizes their browser. Even if I make the browser smaller
than it was on page load, the font will adjust. Here is my code:
$(document).ready(function() {
var mainwidth = $('.main').width();
var mainheight = $('.main').height(mainwidth * .8895);
var headerwidth = $('.header-middle').width();
$('.main').height(mainwidth * .8895)
$('.logo').width(headerwidth * .049);
$('.logo').height(headerheight * .7533);
$('.divider').width(headerwidth * .00204);
$('.design-image').width(headerwidth * .2547);
$('.call-us-today').css({'font-size': headerwidth * .01836});
$('.header-paragraph').css({'font-size': headerwidth * .01734});
$('.header-paragraph-footer').css({'font-size': headerwidth * .01632});
$('.top-text').css({'font-size': headerwidth * .02448});
$('.graybar-text').css({'font-size': headerwidth * .03265});
$('.body-header').css({'font-size': headerwidth * .02245});
$('.body-text').css({'font-size': headerwidth * .01632});
$('.footer').css({'font-size': headerwidth * .01224});
$('.banner-text').css({'font-size': headerwidth * .02244});
$('.graybar-text').css({'letter-spacing': headerwidth * .00408});
});
$(window).resize(function() {
var mainwidth = $('.main').width();
var mainheight = $('.main').height(mainwidth * .8895);
var headerwidth = $('.header-middle').width();
var headerheight = $('.header-middle').height();
$('.main').height(mainwidth * .8895);
$('.logo').width(headerwidth * .049);
$('.logo').height(headerheight * .7533);
$('.lady-image').width(headerwidth * .2835);
$('.divider').width(headerwidth * .00204);
$('.design-image').width(headerwidth * .2547);
$('.call-us-today').css({'font-size': headerwidth * .01836});
$('.header-paragraph').css({'font-size': headerwidth * .01734});
$('.header-paragraph-footer').css({'font-size': headerwidth * .01632});
$('.top-text').css({'font-size': headerwidth * .02448});
$('.graybar-text').css({'font-size': headerwidth * .03265});
$('.body-header').css({'font-size': headerwidth * .02245});
$('.body-text').css({'font-size': headerwidth * .01632});
$('.footer').css({'font-size': headerwidth * .01224});
$('.banner-text').css({'font-size': headerwidth * .02244});
$('.graybar-text').css({'letter-spacing': headerwidth * .00408});
});
Does document.ready not load until after the pages loads? Any help with
this would be appreciated!
I'm working on a site that uses jquery to change the font size on any
window resize, to keep everything in the right place. It works great, but
when someones browser isn't maximized, the font still loads as if it is,
until the user resizes their browser. Even if I make the browser smaller
than it was on page load, the font will adjust. Here is my code:
$(document).ready(function() {
var mainwidth = $('.main').width();
var mainheight = $('.main').height(mainwidth * .8895);
var headerwidth = $('.header-middle').width();
$('.main').height(mainwidth * .8895)
$('.logo').width(headerwidth * .049);
$('.logo').height(headerheight * .7533);
$('.divider').width(headerwidth * .00204);
$('.design-image').width(headerwidth * .2547);
$('.call-us-today').css({'font-size': headerwidth * .01836});
$('.header-paragraph').css({'font-size': headerwidth * .01734});
$('.header-paragraph-footer').css({'font-size': headerwidth * .01632});
$('.top-text').css({'font-size': headerwidth * .02448});
$('.graybar-text').css({'font-size': headerwidth * .03265});
$('.body-header').css({'font-size': headerwidth * .02245});
$('.body-text').css({'font-size': headerwidth * .01632});
$('.footer').css({'font-size': headerwidth * .01224});
$('.banner-text').css({'font-size': headerwidth * .02244});
$('.graybar-text').css({'letter-spacing': headerwidth * .00408});
});
$(window).resize(function() {
var mainwidth = $('.main').width();
var mainheight = $('.main').height(mainwidth * .8895);
var headerwidth = $('.header-middle').width();
var headerheight = $('.header-middle').height();
$('.main').height(mainwidth * .8895);
$('.logo').width(headerwidth * .049);
$('.logo').height(headerheight * .7533);
$('.lady-image').width(headerwidth * .2835);
$('.divider').width(headerwidth * .00204);
$('.design-image').width(headerwidth * .2547);
$('.call-us-today').css({'font-size': headerwidth * .01836});
$('.header-paragraph').css({'font-size': headerwidth * .01734});
$('.header-paragraph-footer').css({'font-size': headerwidth * .01632});
$('.top-text').css({'font-size': headerwidth * .02448});
$('.graybar-text').css({'font-size': headerwidth * .03265});
$('.body-header').css({'font-size': headerwidth * .02245});
$('.body-text').css({'font-size': headerwidth * .01632});
$('.footer').css({'font-size': headerwidth * .01224});
$('.banner-text').css({'font-size': headerwidth * .02244});
$('.graybar-text').css({'letter-spacing': headerwidth * .00408});
});
Does document.ready not load until after the pages loads? Any help with
this would be appreciated!
Android, Activities
Android, Activities
This might be really basic but I keep getting crashes.
I need to have the option of going from two different activities to one.
Basically, from screen A I go to screen B using Intent. I then move on to
Screen C but I want to hit a button and return to B from C. Like i have
said, when I use intent I crash
if this question is jumbled up I am sorry Thanks for any help
This might be really basic but I keep getting crashes.
I need to have the option of going from two different activities to one.
Basically, from screen A I go to screen B using Intent. I then move on to
Screen C but I want to hit a button and return to B from C. Like i have
said, when I use intent I crash
if this question is jumbled up I am sorry Thanks for any help
I want to rename column name in sql server
I want to rename column name in sql server
i have column name [car_no] i want to rename it....
I am thinking like this :
exec sp_rename 'add_duty_slip.[car_no]' , 'car_no', 'column'
but it didn't work.
thanks
i have column name [car_no] i want to rename it....
I am thinking like this :
exec sp_rename 'add_duty_slip.[car_no]' , 'car_no', 'column'
but it didn't work.
thanks
Wednesday, 11 September 2013
I can't input anything in the wxTextCtrl
I can't input anything in the wxTextCtrl
Recently I'm working on a program using wxWidgets All the UI is not from
the system(Mac OS X) We rebuild the UI ourselves,but now I build a
wxTextCtrl,it seems not work,like this
we use xrc to build the text ctrl
I don't kown what's wrong.. Thank you!
Recently I'm working on a program using wxWidgets All the UI is not from
the system(Mac OS X) We rebuild the UI ourselves,but now I build a
wxTextCtrl,it seems not work,like this
we use xrc to build the text ctrl
I don't kown what's wrong.. Thank you!
Cocos2d-x 2.1.5 win32 setup failed
Cocos2d-x 2.1.5 win32 setup failed
I trying to install cocos2d-x on window , as saw a lot of tutorial are
said just run build_win32.bat is ok , unless got some problem like
"tests.exe doesn't work anymore" or "Get data from
file(C:\Windows\system32\fps_images.png) failed!" , however , both of
common are not appear to me but other unknown error. could anyone help me
? below is the console output of my error :
/*
* Check VC++ environment...
*/
/*
* Building cocos2d-x library binary, please wait a while...
*/
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1008]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/9/2013 10:30:38.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error MSB5009:
Erro
r parsing the nested project section in solution file.
Build FAILED.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error
MSB5009: Er
ror parsing the nested project section in solution file.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.01
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1008]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/9/2013 10:30:38.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error MSB5009:
Erro
r parsing the nested project section in solution file.
Build FAILED.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error
MSB5009: Er
ror parsing the nested project section in solution file.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.01
/*
* Check the cocos2d-win32 application "TestCpp.exe" ...
*/
The system cannot find the path specified.
/*
* Run cocos2d-win32 tests.exe and view Cocos2d-x Application Wizard for
Visual
Studio User Guide.
*/
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - js
0 File(s) copied
File not found - tests
0 File(s) copied
File not found - MoonWarriors
0 File(s) copied
File not found - WatermelonWithMe
0 File(s) copied
File not found - Published files iOS
0 File(s) copied
Can't find the binary "TestCpp.exe", is there build error?
Press any key to continue . . .
I trying to install cocos2d-x on window , as saw a lot of tutorial are
said just run build_win32.bat is ok , unless got some problem like
"tests.exe doesn't work anymore" or "Get data from
file(C:\Windows\system32\fps_images.png) failed!" , however , both of
common are not appear to me but other unknown error. could anyone help me
? below is the console output of my error :
/*
* Check VC++ environment...
*/
/*
* Building cocos2d-x library binary, please wait a while...
*/
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1008]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/9/2013 10:30:38.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error MSB5009:
Erro
r parsing the nested project section in solution file.
Build FAILED.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error
MSB5009: Er
ror parsing the nested project section in solution file.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.01
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1008]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/9/2013 10:30:38.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error MSB5009:
Erro
r parsing the nested project section in solution file.
Build FAILED.
C:\cocos2d-x-2.1.5\cocos2d-win32.vc2010.sln : Solution file error
MSB5009: Er
ror parsing the nested project section in solution file.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.01
/*
* Check the cocos2d-win32 application "TestCpp.exe" ...
*/
The system cannot find the path specified.
/*
* Run cocos2d-win32 tests.exe and view Cocos2d-x Application Wizard for
Visual
Studio User Guide.
*/
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - Resources
0 File(s) copied
File not found - js
0 File(s) copied
File not found - tests
0 File(s) copied
File not found - MoonWarriors
0 File(s) copied
File not found - WatermelonWithMe
0 File(s) copied
File not found - Published files iOS
0 File(s) copied
Can't find the binary "TestCpp.exe", is there build error?
Press any key to continue . . .
Subscribe to:
Comments (Atom)