Parse web page without save local?
Sorry my English a little. I am using CURL because web page is required
this function. I don't get file_get_contents of page. How to parse page
without page save? (fopen,fwrite)
<?PHP
function fileGet($url, $timeout = 55, $ref=true){
$useri = $_SERVER['HTTP_USER_AGENT'];
@set_time_limit($timeout);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION,true);
curl_setopt($curl, CURLOPT_COOKIE,
'PHPSESSID=fztitsfgsafafaq25llwafd0; path:/' );
curl_setopt($curl, CURLOPT_USERAGENT, $useri);
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_REFERER,$url);
$data = curl_exec($curl);
curl_close($curl);
// Save Page Start
$fp = fopen('data.html', 'w');
fwrite($fp, $data);
fclose($fp);
// Save Page End
return $data;
}
// Start Code
fileGet("http://www.example.com",10); // Start Function
$html = file_get_html('data.html'); // Open Saved Page In Local
foreach($html->find('div.columns') as $article) {
// Events.....
mysql_query("Insert Query");
}
// End Code
?>
Saturday, 31 August 2013
trend line using Dots chart in Raphael.js
trend line using Dots chart in Raphael.js
I have to use g.raphaeljs library to create a scatterplot graph. Not only
that but i am trying to get a trend line as well, and am wondering how I
should go about this.
I was thinking of calculating the mean of the x axis and the y axis and
drawing a straight line based on slope.... but am still stuck.
Any help is appreciated.
Also the data used to plot the points on the dot chart is provided by a user.
I have to use g.raphaeljs library to create a scatterplot graph. Not only
that but i am trying to get a trend line as well, and am wondering how I
should go about this.
I was thinking of calculating the mean of the x axis and the y axis and
drawing a straight line based on slope.... but am still stuck.
Any help is appreciated.
Also the data used to plot the points on the dot chart is provided by a user.
COPY command issue
COPY command issue
I'm a novice postgres user and I'm using 9.2: I'm using: COPY tagdata FROM
'C:/Filter112595/QF112595_3.csv' WITH DELIMITER ',' CSV HEADER
FORCE_NOT_NULL;
to read data into the table I created. The data are real, integers and dates.
I get this error:
ERROR: invalid input syntax for type real: "NULL" CONTEXT: COPY tagdata,
line 2, column residual: "NULL"
Before using FORCE_NOT_NULL, I had NULL as '' but changed it because of
the different data types.
Can someone explain what's going on? thanks!
I'm a novice postgres user and I'm using 9.2: I'm using: COPY tagdata FROM
'C:/Filter112595/QF112595_3.csv' WITH DELIMITER ',' CSV HEADER
FORCE_NOT_NULL;
to read data into the table I created. The data are real, integers and dates.
I get this error:
ERROR: invalid input syntax for type real: "NULL" CONTEXT: COPY tagdata,
line 2, column residual: "NULL"
Before using FORCE_NOT_NULL, I had NULL as '' but changed it because of
the different data types.
Can someone explain what's going on? thanks!
how to remove(not delete) dynamically generated table elements?
how to remove(not delete) dynamically generated table elements?
Hi I have looped and echoed out this result
echo '<tr><td id="'.$row['productID'].'"><img height="150px" width="130px"
src="products/'.$row['image_url'].'"></td><td>'.$row['name'].'</td>
<td>'.$row['price'].'</td></tr>';
The above resulted in a table full of data, now How do i remove a specific
row, I want to remove it not delete from the table, as in a shopping cart
where you remove the item but not delete it from the table. How would you
use javascript or any other in this case?
Thank you very much.
Hi I have looped and echoed out this result
echo '<tr><td id="'.$row['productID'].'"><img height="150px" width="130px"
src="products/'.$row['image_url'].'"></td><td>'.$row['name'].'</td>
<td>'.$row['price'].'</td></tr>';
The above resulted in a table full of data, now How do i remove a specific
row, I want to remove it not delete from the table, as in a shopping cart
where you remove the item but not delete it from the table. How would you
use javascript or any other in this case?
Thank you very much.
Dynamically arranging content in a storyboard
Dynamically arranging content in a storyboard
I have a question regarding UI objects and storyboards.
If the same view is going to be populated by multiple different objects
(in my case a recipe display page will be used more than once to display
multiple different recipes) how do you arrange your UI in the storyboard?
Say I have a description string for one recipe that is 4 lines long, and a
description for another which is 9 lines long, how do I move the rest of
the content in the view down, too accommodate for the different sized
strings?
I guess I could develop my page in a webview, but I'd rather not, is there
a way to do this with a normal ios view controller?
Regards,
I have a question regarding UI objects and storyboards.
If the same view is going to be populated by multiple different objects
(in my case a recipe display page will be used more than once to display
multiple different recipes) how do you arrange your UI in the storyboard?
Say I have a description string for one recipe that is 4 lines long, and a
description for another which is 9 lines long, how do I move the rest of
the content in the view down, too accommodate for the different sized
strings?
I guess I could develop my page in a webview, but I'd rather not, is there
a way to do this with a normal ios view controller?
Regards,
Timer for an editText Box : Only the original thread that created a view hierarchy can touch its views
Timer for an editText Box : Only the original thread that created a view
hierarchy can touch its views
I am trying to make the edittext boxvibrate and change color momentarily
if a wrong password is entered
final Drawable oldBackground = findViewById(R.id.email).getBackground();
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
MainActivty.this.findViewById(R.id.password).setBackground(oldBackground);
MainActivty.this.findViewById(R.id.email).setBackground(oldBackground);
}
};
Toast.makeText(MainActivty.this , valArray.get(0).toString(),
Toast.LENGTH_SHORT).show();
findViewById(R.id.password).setBackgroundColor(Color.RED);
findViewById(R.id.email).setBackgroundColor(Color.RED);
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(500);Timer timer = new Timer();
timer.schedule(timerTask, 1000);
hierarchy can touch its views
I am trying to make the edittext boxvibrate and change color momentarily
if a wrong password is entered
final Drawable oldBackground = findViewById(R.id.email).getBackground();
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
MainActivty.this.findViewById(R.id.password).setBackground(oldBackground);
MainActivty.this.findViewById(R.id.email).setBackground(oldBackground);
}
};
Toast.makeText(MainActivty.this , valArray.get(0).toString(),
Toast.LENGTH_SHORT).show();
findViewById(R.id.password).setBackgroundColor(Color.RED);
findViewById(R.id.email).setBackgroundColor(Color.RED);
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(500);Timer timer = new Timer();
timer.schedule(timerTask, 1000);
FQL getting a list of non-friend from my current location
FQL getting a list of non-friend from my current location
I would like to know how to get a list of id facebook's user from my
current location,
I just did that "SELECT uid , current_location FROM user WHERE
current_location = '115175415163151'"
but I get the next error
"{ "error": { "message": "Your statement is not indexable. The WHERE
clause must contain an indexable column. Such columns are marked with * in
the tables linked from http://developers.facebook.com/docs/reference/fql
", "type": "NoIndexFunctionException", "code": 604 } }"
I would like to know how to get a list of id facebook's user from my
current location,
I just did that "SELECT uid , current_location FROM user WHERE
current_location = '115175415163151'"
but I get the next error
"{ "error": { "message": "Your statement is not indexable. The WHERE
clause must contain an indexable column. Such columns are marked with * in
the tables linked from http://developers.facebook.com/docs/reference/fql
", "type": "NoIndexFunctionException", "code": 604 } }"
#EANF#
#EANF#
I have to write a code which recognizes a text line by line and reverses
each line in the output, I dont know how to enter a text with multiple
lines (as "input()" function will take the input after the first "Enter"
but I still want to enter more lines?
second I don't know how to count the input line by line? whould "split(/n)
be an option?
I have to write a code which recognizes a text line by line and reverses
each line in the output, I dont know how to enter a text with multiple
lines (as "input()" function will take the input after the first "Enter"
but I still want to enter more lines?
second I don't know how to count the input line by line? whould "split(/n)
be an option?
Friday, 30 August 2013
Mute functionality not working on SansungSmartTV
Mute functionality not working on SansungSmartTV
Mute functionality for my app is not working on the device(i.e., TV),But
working on the emulator-2.5 and partially working on the emulator-3.5(Here
partially means its silence the audio,But does not applying styles(i.e.,
BackgroundImage which resembles mute).
Importantly my app is rejected showing the reason 'mute doesn't silence
the audio',But its working in 2.5 emulator and partially working on
Emulator-3.5. How can i fix this error to publish my app
Regards chandu
Mute functionality for my app is not working on the device(i.e., TV),But
working on the emulator-2.5 and partially working on the emulator-3.5(Here
partially means its silence the audio,But does not applying styles(i.e.,
BackgroundImage which resembles mute).
Importantly my app is rejected showing the reason 'mute doesn't silence
the audio',But its working in 2.5 emulator and partially working on
Emulator-3.5. How can i fix this error to publish my app
Regards chandu
Thursday, 29 August 2013
How to capture the Parameters being sent to the particular Stored Procedure in sql server 2008?
How to capture the Parameters being sent to the particular Stored
Procedure in sql server 2008?
In SQL Server 2008, do we have a query which can find the parameters being
passed to a particular stored procedure?
Procedure in sql server 2008?
In SQL Server 2008, do we have a query which can find the parameters being
passed to a particular stored procedure?
How get correct type of T
How get correct type of T
I have some code like this:
Private Shared Function ReStoreFromXML(Of T)(ByVal TargetType As T,
ByVal XMLpath As String) As List(Of T)
If Not TypeSupported(TargetType) Then Return Nothing
....
Return CType(mySerializer.Deserialize(fstream), List(Of T))
TargetType is, for example, MyCustomType.
TypeSupported should check if TargetType is ok. When I try something like
TargetType.GetType
Or
GetType(T)
I get only System.RuntimeType or System.Type. How can I fix this issue?
I have some code like this:
Private Shared Function ReStoreFromXML(Of T)(ByVal TargetType As T,
ByVal XMLpath As String) As List(Of T)
If Not TypeSupported(TargetType) Then Return Nothing
....
Return CType(mySerializer.Deserialize(fstream), List(Of T))
TargetType is, for example, MyCustomType.
TypeSupported should check if TargetType is ok. When I try something like
TargetType.GetType
Or
GetType(T)
I get only System.RuntimeType or System.Type. How can I fix this issue?
Wednesday, 28 August 2013
Make vectors of unequal length equal in length by reducing the size of the largest ones
Make vectors of unequal length equal in length by reducing the size of the
largest ones
I am reading 6 columns from a .txt file to 6 vectors.
Sometimes some vectors are one element larger than others, so I need to
check if they are all of equal length, and if not, I have to find which
ones are the largest and delete their last element. I think I should be
able to do this without loops. I was originally thinking of using find in
combination with isequal but isequal only returns a logical, and does not
provide any information on which vectors are the largest.
largest ones
I am reading 6 columns from a .txt file to 6 vectors.
Sometimes some vectors are one element larger than others, so I need to
check if they are all of equal length, and if not, I have to find which
ones are the largest and delete their last element. I think I should be
able to do this without loops. I was originally thinking of using find in
combination with isequal but isequal only returns a logical, and does not
provide any information on which vectors are the largest.
Is there a Ruby equivalent for JavaScript's Function.prototype.bind?
Is there a Ruby equivalent for JavaScript's Function.prototype.bind?
JavaScript happy times fun land
// make a method
var happy = function(a, b, c) {
console.log(a, b, c);
};
// store method to variable
var b = happy;
// bind a context and some arguments
b.bind(happy, 1, 2, 3);
// call the method without additional arguments
b();
Output. Yay!
1 2 3
In Ruby
# make a method
def sad a, b, c
puts a, b, c
end
# store method to variable
b = method(:sad)
# i need some way to bind args now
# (this line is an example of what i need)
b.bind(1, 2, 3)
# call the method without passing additional args
b.call
Desired output
1, 2, 3
JavaScript happy times fun land
// make a method
var happy = function(a, b, c) {
console.log(a, b, c);
};
// store method to variable
var b = happy;
// bind a context and some arguments
b.bind(happy, 1, 2, 3);
// call the method without additional arguments
b();
Output. Yay!
1 2 3
In Ruby
# make a method
def sad a, b, c
puts a, b, c
end
# store method to variable
b = method(:sad)
# i need some way to bind args now
# (this line is an example of what i need)
b.bind(1, 2, 3)
# call the method without passing additional args
b.call
Desired output
1, 2, 3
jsp- when button is clicked, display search results, otherwise display everything in table
jsp- when button is clicked, display search results, otherwise display
everything in table
I'm trying to code a function to display search results when criteria is
entered into the input field and the search button is clicked. but before
someone searches for a particular field, everything from the table will be
displayed using the query "SELECT * from Quotes;".
Both input fields and search results table will be displayed on the same
table. I can get it to work on separate JSP pages, but using a function
would be better coding, as i have to this with a few other JSP pages, and
i dont want to have more JSP pages if i dont need them. so i was thinkin,
something like this.
<td><c:choose>
<c:when button.id=button1 is pressed display}">
<td><c:out value="${row.BookTitle}" /></td>
<td><c:out value="${row.Author}" /></td>
<td><c:out value="${row.Year}" /></td>
</c:when>
<c:otherwise>
SELECT * from Quotes;
</c:otherwise>
</c:choose></td>
Any help would be much appreciate.Thanks in advance.
everything in table
I'm trying to code a function to display search results when criteria is
entered into the input field and the search button is clicked. but before
someone searches for a particular field, everything from the table will be
displayed using the query "SELECT * from Quotes;".
Both input fields and search results table will be displayed on the same
table. I can get it to work on separate JSP pages, but using a function
would be better coding, as i have to this with a few other JSP pages, and
i dont want to have more JSP pages if i dont need them. so i was thinkin,
something like this.
<td><c:choose>
<c:when button.id=button1 is pressed display}">
<td><c:out value="${row.BookTitle}" /></td>
<td><c:out value="${row.Author}" /></td>
<td><c:out value="${row.Year}" /></td>
</c:when>
<c:otherwise>
SELECT * from Quotes;
</c:otherwise>
</c:choose></td>
Any help would be much appreciate.Thanks in advance.
How to display popup in browser using groovy script?
How to display popup in browser using groovy script?
I want to display a popup message in browser using groovy script. Can I
add javascript code for the same in groovy script. If yes, how? Or is
there any other method to display popup msg box
I want to display a popup message in browser using groovy script. Can I
add javascript code for the same in groovy script. If yes, how? Or is
there any other method to display popup msg box
Tuesday, 27 August 2013
Python : comparing tuples
Python : comparing tuples
I am trying to compare tuple A values with tuple B values , and make a 3rd
tuple with common values. This is my code so far. Any attepts i have made
to get a 3rd tuple with common values failed. Any help is apreciated.
#1st nr , print divs
x = int(raw_input('x=' ))
divizori = ()
for i in range(1,x):
if x%i == 0:
divizori = divizori + (i,)
print divizori
#2nd nr , print divs
y = int(raw_input('y=' ))
div = ()
for i in range(1,y):
if y%i == 0:
div = div + (i,)
print div
#code atempt to print commom found divs
I am trying to compare tuple A values with tuple B values , and make a 3rd
tuple with common values. This is my code so far. Any attepts i have made
to get a 3rd tuple with common values failed. Any help is apreciated.
#1st nr , print divs
x = int(raw_input('x=' ))
divizori = ()
for i in range(1,x):
if x%i == 0:
divizori = divizori + (i,)
print divizori
#2nd nr , print divs
y = int(raw_input('y=' ))
div = ()
for i in range(1,y):
if y%i == 0:
div = div + (i,)
print div
#code atempt to print commom found divs
Inserte data into table when click on button
Inserte data into table when click on button
I know how to insert data into table and its working perfect, but I want
to know how can I insert data into table just when user click on button
called "ADD" this is a few lines of my code
"; mysql_query ("INSERT INTO list
(student,school,major)VALUES('$student','$school','$major)"); ?>
I want the data add to the table only when user click on ADD button...
THANK YOU!
I know how to insert data into table and its working perfect, but I want
to know how can I insert data into table just when user click on button
called "ADD" this is a few lines of my code
"; mysql_query ("INSERT INTO list
(student,school,major)VALUES('$student','$school','$major)"); ?>
I want the data add to the table only when user click on ADD button...
THANK YOU!
DataTables : "Cannot read property 'className' of undefined" after adding aoCoumns
DataTables : "Cannot read property 'className' of undefined" after adding
aoCoumns
the datatable was working without any problem ! Problem started when i
started using this
'aoColumns': [
null,
null,
null,
{ 'sType': 'datetime-us' },
null
],
I used this property for sorting date Datatables:sorting date When i
uncomment this property it works (without date been sorted)
aoCoumns
the datatable was working without any problem ! Problem started when i
started using this
'aoColumns': [
null,
null,
null,
{ 'sType': 'datetime-us' },
null
],
I used this property for sorting date Datatables:sorting date When i
uncomment this property it works (without date been sorted)
Send message from server to client
Send message from server to client
If I want to do some tricks' like talking immediately on web site
(ExampleFTalking on Facebook)
I know it need to send message from server to client 'but without refresh.
So how they do it ?
Please tell me the way I can do it, any reference page also give me a big
help, thanks.
If I want to do some tricks' like talking immediately on web site
(ExampleFTalking on Facebook)
I know it need to send message from server to client 'but without refresh.
So how they do it ?
Please tell me the way I can do it, any reference page also give me a big
help, thanks.
android how to play custom music by putting call on hold
android how to play custom music by putting call on hold
I have followed this link but i want some snippet please help me. Also I
have foollow this post Play a music / advertisement when the call is
onHold in Android
I have followed this link but i want some snippet please help me. Also I
have foollow this post Play a music / advertisement when the call is
onHold in Android
Java Jax-ws Dynamic Client - response is null?
Java Jax-ws Dynamic Client - response is null?
I am currently doing a jax-ws client that can connect to any web service
wsdl and perform some actions. However for some reason ( i don't know why
) in my response i am getting null?? although i do not get any errors?
WSDL location: WSDL location
Code:
URL wsdlLocation = new
URL("http://www.dataaccess.com/webservicesserver/textcasing.wso?WSDL");
// Qnames for service as defined in wsdl.
QName sName = new
QName("http://www.dataaccess.com/webservicesserver/",
"TextCasing");//"TextCasting"
// Create a dynamic Service instance
Service service = Service.create(wsdlLocation, sName);
//QName for Port As defined in wsdl.
QName portName = new QName("http://dataaccess.com", "TextCasingSoap");
//Endpoint Address // targetNameSpace
String endpointAddress =
"http://dataaccess.com/webservicesserver/textcasing.wso";
// Add a port to the Service
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
//Create a dispatch instance
Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Service.Mode.MESSAGE);
// Use Dispatch as BindingProvider
BindingProvider bp = (BindingProvider) dispatch;
// Optionally Configure RequestContext to send SOAPAction HTTP Header
Map<String, Object> rc = bp.getRequestContext();
//Ask Requestcontext to use SoapAction
rc.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
//Add SoapAction to request context
//operation name
rc.put(BindingProvider.SOAPACTION_URI_PROPERTY, "InvertStringCase");
// Obtain a preconfigured SAAJ MessageFactory
MessageFactory factory = ((SOAPBinding)
bp.getBinding()).getMessageFactory();
// Create SOAPMessage Request
SOAPMessage request = factory.createMessage();
// Request Header
SOAPHeader header = request.getSOAPHeader();
// Request Body
SOAPBody body = request.getSOAPBody();
// Compose the soap:Body payload (Request Method)
QName payloadName = new
QName("http://www.dataaccess.com/webservicesserver/",
"InvertStringCase");
//message request
SOAPBodyElement payload = body.addBodyElement(payloadName);
SOAPElement message = payload.addChildElement("sAString");
message.addTextNode("HelloWorld");
// Invoke the endpoint synchronously
SOAPMessage reply = null;
try {
//Invoke Endpoint Operation and read response
reply = dispatch.invoke(request);
} catch (WebServiceException wse){
wse.printStackTrace();
}
// process the reply
body = reply.getSOAPBody();
//message response (Response Method)
QName responseName = new
QName("http://www.dataaccess.com/webservicesserver/",
"InvertStringCaseResponse");
System.out.println(responseName);
//SOAPBodyElement
Object bodyElement = body.getChildElements(responseName).next();
System.out.println(bodyElement);
SOAPBodyElement soapbody = (SOAPBodyElement)bodyElement;
System.out.println(soapbody);
String msg = soapbody.getValue();
System.out.println(msg);
Any help appreciated. Thank you
I am currently doing a jax-ws client that can connect to any web service
wsdl and perform some actions. However for some reason ( i don't know why
) in my response i am getting null?? although i do not get any errors?
WSDL location: WSDL location
Code:
URL wsdlLocation = new
URL("http://www.dataaccess.com/webservicesserver/textcasing.wso?WSDL");
// Qnames for service as defined in wsdl.
QName sName = new
QName("http://www.dataaccess.com/webservicesserver/",
"TextCasing");//"TextCasting"
// Create a dynamic Service instance
Service service = Service.create(wsdlLocation, sName);
//QName for Port As defined in wsdl.
QName portName = new QName("http://dataaccess.com", "TextCasingSoap");
//Endpoint Address // targetNameSpace
String endpointAddress =
"http://dataaccess.com/webservicesserver/textcasing.wso";
// Add a port to the Service
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
//Create a dispatch instance
Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Service.Mode.MESSAGE);
// Use Dispatch as BindingProvider
BindingProvider bp = (BindingProvider) dispatch;
// Optionally Configure RequestContext to send SOAPAction HTTP Header
Map<String, Object> rc = bp.getRequestContext();
//Ask Requestcontext to use SoapAction
rc.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
//Add SoapAction to request context
//operation name
rc.put(BindingProvider.SOAPACTION_URI_PROPERTY, "InvertStringCase");
// Obtain a preconfigured SAAJ MessageFactory
MessageFactory factory = ((SOAPBinding)
bp.getBinding()).getMessageFactory();
// Create SOAPMessage Request
SOAPMessage request = factory.createMessage();
// Request Header
SOAPHeader header = request.getSOAPHeader();
// Request Body
SOAPBody body = request.getSOAPBody();
// Compose the soap:Body payload (Request Method)
QName payloadName = new
QName("http://www.dataaccess.com/webservicesserver/",
"InvertStringCase");
//message request
SOAPBodyElement payload = body.addBodyElement(payloadName);
SOAPElement message = payload.addChildElement("sAString");
message.addTextNode("HelloWorld");
// Invoke the endpoint synchronously
SOAPMessage reply = null;
try {
//Invoke Endpoint Operation and read response
reply = dispatch.invoke(request);
} catch (WebServiceException wse){
wse.printStackTrace();
}
// process the reply
body = reply.getSOAPBody();
//message response (Response Method)
QName responseName = new
QName("http://www.dataaccess.com/webservicesserver/",
"InvertStringCaseResponse");
System.out.println(responseName);
//SOAPBodyElement
Object bodyElement = body.getChildElements(responseName).next();
System.out.println(bodyElement);
SOAPBodyElement soapbody = (SOAPBodyElement)bodyElement;
System.out.println(soapbody);
String msg = soapbody.getValue();
System.out.println(msg);
Any help appreciated. Thank you
XmlReaderSettings.Add(Using an instance from an assembly Schema)
XmlReaderSettings.Add(Using an instance from an assembly Schema)
I have a dll Assembly Name.Space.SCHEMAS.dll Inside this dll is a class
TransMsg This class is a XSD schema with a BaseTypes >> SchemaBase >>
Schema Schema is a propert of SchemaBase
I have also XmlReaderSettings booksSettings = new XmlReaderSettings(); The
booksSettings.Schemas.Add(Schema) i.e I need to add the instance of the
schema to XmlReaderSettings, during runtime
<i>string varSchemaNameSpace = ", Name.Space.SCHEMAS";
string varFullySchemaName = "Name.Space.SCHEMAS.TransMsg";
string varStringDocSpecType = varFullySchemaName + varSchemaNameSpace;
// Get type.
Type varDocSpecType = Type.GetType(varStringDocSpecType);
XmlReaderSettings booksSettings = new XmlReaderSettings();
booksSettings.Schemas.Add(varDocSpecType2.Schema); // This is not working
</i>
Please your help is needed
Thanks in Advance
I have a dll Assembly Name.Space.SCHEMAS.dll Inside this dll is a class
TransMsg This class is a XSD schema with a BaseTypes >> SchemaBase >>
Schema Schema is a propert of SchemaBase
I have also XmlReaderSettings booksSettings = new XmlReaderSettings(); The
booksSettings.Schemas.Add(Schema) i.e I need to add the instance of the
schema to XmlReaderSettings, during runtime
<i>string varSchemaNameSpace = ", Name.Space.SCHEMAS";
string varFullySchemaName = "Name.Space.SCHEMAS.TransMsg";
string varStringDocSpecType = varFullySchemaName + varSchemaNameSpace;
// Get type.
Type varDocSpecType = Type.GetType(varStringDocSpecType);
XmlReaderSettings booksSettings = new XmlReaderSettings();
booksSettings.Schemas.Add(varDocSpecType2.Schema); // This is not working
</i>
Please your help is needed
Thanks in Advance
Monday, 26 August 2013
Unity seems to have incorrectly imported materials for a character model
Unity seems to have incorrectly imported materials for a character model
So I'm working on a game and I have a model of a character, in Milkshapes
he appears to be textured correctly. However in Unity the material for his
eye does not seem to be the correct material. It seems to be using the
swatches image that colors the body of the character.
Strangely, I had to put the char_swatches_lit image onto a new material
that doesn't even exist in the Milkshapes project.
I am almost 100% sure that Unity imported the model incorrectly, if you
can help me fix this that'd be great.
So I'm working on a game and I have a model of a character, in Milkshapes
he appears to be textured correctly. However in Unity the material for his
eye does not seem to be the correct material. It seems to be using the
swatches image that colors the body of the character.
Strangely, I had to put the char_swatches_lit image onto a new material
that doesn't even exist in the Milkshapes project.
I am almost 100% sure that Unity imported the model incorrectly, if you
can help me fix this that'd be great.
Download data from sharepoint using ssis
Download data from sharepoint using ssis
I am trying to download a list of columns from a published sharepoint. The
first issue I am running into it how to select a certain list of columns
from sharepoint. There are close to 100 columns and I need about 50
columns only in my task flow.
Second issue while just testing is that is throw an error message saying
that "[SharePoint List Source [1]] Error:
Microsoft.SqlServer.Dts.Pipeline.DoesNotFitBufferException: The value is
too large to fit in the column data area of the buffer. at
Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.SetString(Int32
columnIndex, String value) at
Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.SharePointListSource.PrimeOutput(Int32
outputs, Int32[] outputIDs, PipelineBuffer[] buffers) at
Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100
wrapper, Int32 outputs, Int32[] outputIDs, IDTSBuffer100[] buffers, IntPtr
ppBufferWirePacket)"
Beside there are few data conversion issue like converting DT_NTEXT which
I can do by converting to DT_WSTR using data conversion.
Any suggestions would be greatly appreciated as this is my first
sharepoint ssis package.
I am trying to download a list of columns from a published sharepoint. The
first issue I am running into it how to select a certain list of columns
from sharepoint. There are close to 100 columns and I need about 50
columns only in my task flow.
Second issue while just testing is that is throw an error message saying
that "[SharePoint List Source [1]] Error:
Microsoft.SqlServer.Dts.Pipeline.DoesNotFitBufferException: The value is
too large to fit in the column data area of the buffer. at
Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.SetString(Int32
columnIndex, String value) at
Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.SharePointListSource.PrimeOutput(Int32
outputs, Int32[] outputIDs, PipelineBuffer[] buffers) at
Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100
wrapper, Int32 outputs, Int32[] outputIDs, IDTSBuffer100[] buffers, IntPtr
ppBufferWirePacket)"
Beside there are few data conversion issue like converting DT_NTEXT which
I can do by converting to DT_WSTR using data conversion.
Any suggestions would be greatly appreciated as this is my first
sharepoint ssis package.
One Changing JavaScript Variable Being Displayed (and updated) in Multiple Locations in HTML
One Changing JavaScript Variable Being Displayed (and updated) in Multiple
Locations in HTML
I have some javascript that is returning the word count of a text field
into a 'wordcount' var.
I'd like for the 'wordcount' var (and other variables based on it) to be
displayed throughout my HTML. But in a way where they can be constantly
updated as the word count changes.
e.g. Your current wordcount is 10. You have 5 remaining words. The current
cost is £10 (£1 / Word).
I'm relatively new to the wonders of JavaScript, but I've picked up the
following from what I've read online...
document.write is frowned upon.
getelementsbyid will only allow me to display each variable once.
jQuery has a .data functionality that stores (and updates?) data locally?
Can anyone please point me in the right direction?
Thanks, Andy.
Locations in HTML
I have some javascript that is returning the word count of a text field
into a 'wordcount' var.
I'd like for the 'wordcount' var (and other variables based on it) to be
displayed throughout my HTML. But in a way where they can be constantly
updated as the word count changes.
e.g. Your current wordcount is 10. You have 5 remaining words. The current
cost is £10 (£1 / Word).
I'm relatively new to the wonders of JavaScript, but I've picked up the
following from what I've read online...
document.write is frowned upon.
getelementsbyid will only allow me to display each variable once.
jQuery has a .data functionality that stores (and updates?) data locally?
Can anyone please point me in the right direction?
Thanks, Andy.
Command substitution in for loop not working
Command substitution in for loop not working
I want to keep all files not ending with .bat
I tried
for f in $(ls | egrep -v .bat); do echo $f; done
and
for f in $(eval ls | egrep -v .bat); do echo $f; done
But both approaches yield the same result, as they print everything.
Whereas ls | egrep -v .bat and eval ls | egrep -v .bat work per se, if
used apart from the for loop.
Feel free to edit the question title, as I was not sure what the problem is.
I'm using GNU bash, version 4.1.10(4)-release (i686-pc-cygwin).
Example
$ ls -l | egrep -v ".bat"
total 60K
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 fsc*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scala*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scalac*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scaladoc*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scalap*
Command is working, but not in the for loop.
$ for f in $(ls | egrep -v .bat); do echo $f; done
fsc
fsc.bat
scala
scala.bat
scalac
scalac.bat
scaladoc
scaladoc.bat
scalap
scalap.bat
scalac
scalac.bat
scaladoc
scaladoc.bat
scalap
scalap.bat
I want to keep all files not ending with .bat
I tried
for f in $(ls | egrep -v .bat); do echo $f; done
and
for f in $(eval ls | egrep -v .bat); do echo $f; done
But both approaches yield the same result, as they print everything.
Whereas ls | egrep -v .bat and eval ls | egrep -v .bat work per se, if
used apart from the for loop.
Feel free to edit the question title, as I was not sure what the problem is.
I'm using GNU bash, version 4.1.10(4)-release (i686-pc-cygwin).
Example
$ ls -l | egrep -v ".bat"
total 60K
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 fsc*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scala*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scalac*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scaladoc*
-rwx------+ 1 SYSTEM SYSTEM 5.3K Jun 6 20:31 scalap*
Command is working, but not in the for loop.
$ for f in $(ls | egrep -v .bat); do echo $f; done
fsc
fsc.bat
scala
scala.bat
scalac
scalac.bat
scaladoc
scaladoc.bat
scalap
scalap.bat
scalac
scalac.bat
scaladoc
scaladoc.bat
scalap
scalap.bat
How to change Tomcats JVM version?
How to change Tomcats JVM version?
I have the Java JDK 1.7.0_21 installed on my Debian machine (along with
others). I have configured Debain to use this JDK:
pi@raspberrypi ~ $ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode)
From reading the notes in Tomcat catalina.sh, I understand that the Tomcat
server should use the JAVA_HOME/JRE_HOME system variables
# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
#
# JRE_HOME Must point at your Java Development Kit installation.
# Defaults to JAVA_HOME if empty.
I have set those to the proper directory. Echoing the variables gives the
following output:
pi@raspberrypi ~ $ echo $JAVA_HOME
/opt/Oracle_Java/jdk1.7.0_21/bin
pi@raspberrypi ~ $ echo $JRE_HOME
/opt/Oracle_Java/jdk1.7.0_21/jre
The Tomcat Web Application Manager however still shows 1.6.0_27-b27 as the
JVM in use.
Do you have any advice on how to make Tomcat run with the 1.7.0_21 JDK?
I have the Java JDK 1.7.0_21 installed on my Debian machine (along with
others). I have configured Debain to use this JDK:
pi@raspberrypi ~ $ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode)
From reading the notes in Tomcat catalina.sh, I understand that the Tomcat
server should use the JAVA_HOME/JRE_HOME system variables
# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
#
# JRE_HOME Must point at your Java Development Kit installation.
# Defaults to JAVA_HOME if empty.
I have set those to the proper directory. Echoing the variables gives the
following output:
pi@raspberrypi ~ $ echo $JAVA_HOME
/opt/Oracle_Java/jdk1.7.0_21/bin
pi@raspberrypi ~ $ echo $JRE_HOME
/opt/Oracle_Java/jdk1.7.0_21/jre
The Tomcat Web Application Manager however still shows 1.6.0_27-b27 as the
JVM in use.
Do you have any advice on how to make Tomcat run with the 1.7.0_21 JDK?
Get list of Values for an NSArray of NSDictionary
Get list of Values for an NSArray of NSDictionary
I've got the following NSArray :
NSArray myArray = @[@{@300:@"5 min"},
@{@900:@"15 min"},
@{@1800:@"30 min"},
@{@3600:@"1 hour"}];
I want the list of value of my dictionaries :
@[@"5 min",@"15 min",@"30 min",@"1 hour"]
And the list of key of my dictionaries :
@[@300, @900, @1800, @3600]
What is the best way to do that ? I was thinking about predicate, but I
don't know how to use it ?
I've got the following NSArray :
NSArray myArray = @[@{@300:@"5 min"},
@{@900:@"15 min"},
@{@1800:@"30 min"},
@{@3600:@"1 hour"}];
I want the list of value of my dictionaries :
@[@"5 min",@"15 min",@"30 min",@"1 hour"]
And the list of key of my dictionaries :
@[@300, @900, @1800, @3600]
What is the best way to do that ? I was thinking about predicate, but I
don't know how to use it ?
Validation for all by checkbox not working
Validation for all by checkbox not working
I have a table with a checkbox in the first <td>, now i want to check only
those <tr> where the check boxes are checked.
<table>
<tr>
<th style="width: 5%;">Select</th>
<th style="width: 5%;">ID</th>
<th style="width: 10%;">Name</th>
<th style="width: 5%;">Order</th>
<th style="width: 5%;">Price</th>
</tr>
<c:forEach var="pack" items="${PackList}" varStatus="rowCounter">
<tr class="allPackClass">
<td class="selective_CatCreation"><input type="checkbox"
name="packIdCatCreate" value="${pack.packId}"></td>
<td>${pack.packId}</td>
<td>${pack.name}</td>
<td><input type="text" name="packDisOrder" disabled="disabled"
style="width: 20px;" value=""></td>
<td><input type="text" name="packPrice" disabled="disabled"
style="width: 20px;" value=""></td>
</tr>
</c:forEach>
</table>
validation -->
$("tr.allPackClass").each(function() {
if($(this).is(":checked")== true){
if($(this).closest('tr').find('input:text').val() == ""){
$("#validationDiv_").html("<span
style='font-size:12px;color:red;'>Fileds are
missing</span>");
return false;
}
}
});
Please help, where i am doing wrong
I have a table with a checkbox in the first <td>, now i want to check only
those <tr> where the check boxes are checked.
<table>
<tr>
<th style="width: 5%;">Select</th>
<th style="width: 5%;">ID</th>
<th style="width: 10%;">Name</th>
<th style="width: 5%;">Order</th>
<th style="width: 5%;">Price</th>
</tr>
<c:forEach var="pack" items="${PackList}" varStatus="rowCounter">
<tr class="allPackClass">
<td class="selective_CatCreation"><input type="checkbox"
name="packIdCatCreate" value="${pack.packId}"></td>
<td>${pack.packId}</td>
<td>${pack.name}</td>
<td><input type="text" name="packDisOrder" disabled="disabled"
style="width: 20px;" value=""></td>
<td><input type="text" name="packPrice" disabled="disabled"
style="width: 20px;" value=""></td>
</tr>
</c:forEach>
</table>
validation -->
$("tr.allPackClass").each(function() {
if($(this).is(":checked")== true){
if($(this).closest('tr').find('input:text').val() == ""){
$("#validationDiv_").html("<span
style='font-size:12px;color:red;'>Fileds are
missing</span>");
return false;
}
}
});
Please help, where i am doing wrong
Sunday, 25 August 2013
Generating a SIMPLE licence key system
Generating a SIMPLE licence key system
Every stackoverflow question I read descends into "Everyone can crack it"
and "Dont annoy your customers"...
I get that. I want to know to make a basic, totally crackable, easy to
pirate and non obtrusive licencing system. In fact, I would be happy if
someone was motivated enough to crack my software, it means I am doing the
right thing.
The implementation i have in mind is:
Licence key like:
XXXX-XXXX-XXXX-XXXX
Which then activates with a central database, sending some hardware info
(got that code already). If different, user gets a message saying
"Hardware changed, by clicking OK you will stop other PCs using this
licence from working. Are you sure?" Yes / No
If they proceed it will blacklist the old hardware id with that serial on
my server.
What I need is a way to generate a simple serial number, I am happy to use
a library but I want to get up and running quickly and get back to
development. Whats my best option?
Every stackoverflow question I read descends into "Everyone can crack it"
and "Dont annoy your customers"...
I get that. I want to know to make a basic, totally crackable, easy to
pirate and non obtrusive licencing system. In fact, I would be happy if
someone was motivated enough to crack my software, it means I am doing the
right thing.
The implementation i have in mind is:
Licence key like:
XXXX-XXXX-XXXX-XXXX
Which then activates with a central database, sending some hardware info
(got that code already). If different, user gets a message saying
"Hardware changed, by clicking OK you will stop other PCs using this
licence from working. Are you sure?" Yes / No
If they proceed it will blacklist the old hardware id with that serial on
my server.
What I need is a way to generate a simple serial number, I am happy to use
a library but I want to get up and running quickly and get back to
development. Whats my best option?
If $a\equiv b \ \mathrm{mod}(n)$ and $m|n$, then $a\equiv b \mathrm{mod}(m)$.
If $a\equiv b \ \mathrm{mod}(n)$ and $m|n$, then $a\equiv b \
\mathrm{mod}(m)$.
Is this correct:
If $a\equiv b \ \mathrm{mod}(n)$ and $m|n$, then $a\equiv b \
\mathrm{mod}(m)$.
Let $a=q_{1}n+r$, $b=q_{2}n+r$ and $n=mc$. Then we have \begin{align*}
\frac{q_{1}mc+r -(q_{2}mc+r)}{mc}=\frac{q_{1}m+r -(q_{2}m+r)}{m},
\end{align*} which imply that $a\equiv b \ \mathrm{mod}(m)$.
Thank you in advance.
\mathrm{mod}(m)$.
Is this correct:
If $a\equiv b \ \mathrm{mod}(n)$ and $m|n$, then $a\equiv b \
\mathrm{mod}(m)$.
Let $a=q_{1}n+r$, $b=q_{2}n+r$ and $n=mc$. Then we have \begin{align*}
\frac{q_{1}mc+r -(q_{2}mc+r)}{mc}=\frac{q_{1}m+r -(q_{2}m+r)}{m},
\end{align*} which imply that $a\equiv b \ \mathrm{mod}(m)$.
Thank you in advance.
Could I fetch images from Google with shellscript/applescript/automator?
Could I fetch images from Google with shellscript/applescript/automator?
I have several picture databases in folders on my computer. I want to have
some script (shellscript/applescript/automator workflow) that takes a
picture in the folder and automatically fetches the same picture but with
higher res from google image search.
I could then attach this script to the folder in Hazel and every picture I
save into my DB gets replaced with a high resolution version of it. (at
least the highest it can find)
I've never learned programming, but to achieve this I might want to teach
myself one of these 3 languages. Can anyone set me off with some hints,
and which script language would be best suited? Cheers!
I have several picture databases in folders on my computer. I want to have
some script (shellscript/applescript/automator workflow) that takes a
picture in the folder and automatically fetches the same picture but with
higher res from google image search.
I could then attach this script to the folder in Hazel and every picture I
save into my DB gets replaced with a high resolution version of it. (at
least the highest it can find)
I've never learned programming, but to achieve this I might want to teach
myself one of these 3 languages. Can anyone set me off with some hints,
and which script language would be best suited? Cheers!
Can you join 2 databases in mysql using php?
Can you join 2 databases in mysql using php?
Is it possible to join 2 different databases in mysql using php?
for instance:
$sql = "SELECT * FROM db1.table LEFT JOIN db2.table USING (id)";
$result = mysql_query($sql);
--
I know how to create multiple new different database connections using
php. But I'm unable to figure out if it's possible to acutally join two
different databases in mysql using php in one query.
Is it possible to join 2 different databases in mysql using php?
for instance:
$sql = "SELECT * FROM db1.table LEFT JOIN db2.table USING (id)";
$result = mysql_query($sql);
--
I know how to create multiple new different database connections using
php. But I'm unable to figure out if it's possible to acutally join two
different databases in mysql using php in one query.
Saturday, 24 August 2013
Maybe an error in "beginning php and mysql"
Maybe an error in "beginning php and mysql"
I'm reading your book beginning php and mysql , and I find an error. In
chapter 3, page 111:
For instance, if require() is placed within an
if statement that evaluates to false, the file would be included anyway.
But I test this with my code. It's not true. b.php
<?php
if(false)
{
require "a.php";
}
?>
a.php
<?php
echo "this is a.php<br>"
?>
I run the b.php. Nothing is on the page.
My php version is 5.4.7. So does the book say wrong?
I'm reading your book beginning php and mysql , and I find an error. In
chapter 3, page 111:
For instance, if require() is placed within an
if statement that evaluates to false, the file would be included anyway.
But I test this with my code. It's not true. b.php
<?php
if(false)
{
require "a.php";
}
?>
a.php
<?php
echo "this is a.php<br>"
?>
I run the b.php. Nothing is on the page.
My php version is 5.4.7. So does the book say wrong?
Client Identification Other Than Ip Address
Client Identification Other Than Ip Address
I run a php website where users can only have 1 account, this is a big
deal when users have more than 1 account. I use some IP checks to get an
idea of double accounts, but need to know if there is ANYTHING else I can
do. I know most sites don't care as it looks like more users, but this is
very important for this site that users only have 1 accounts! Getting Ip
addresses don't always work, just looking for any tips!
I run a php website where users can only have 1 account, this is a big
deal when users have more than 1 account. I use some IP checks to get an
idea of double accounts, but need to know if there is ANYTHING else I can
do. I know most sites don't care as it looks like more users, but this is
very important for this site that users only have 1 accounts! Getting Ip
addresses don't always work, just looking for any tips!
How can I get all members whose EOT is set to expire in two weeks from today in WordPress configured with s2Member?
How can I get all members whose EOT is set to expire in two weeks from
today in WordPress configured with s2Member?
I plan on sending an email to users two weeks prior their membership EOT
(end-of-term) in WordPress configured with s2Member. I plan on setting up
a WordPress cron job for sending the actual email.
How can I query the database and get the correct users?
today in WordPress configured with s2Member?
I plan on sending an email to users two weeks prior their membership EOT
(end-of-term) in WordPress configured with s2Member. I plan on setting up
a WordPress cron job for sending the actual email.
How can I query the database and get the correct users?
How can I contain coefficients from the Stationary Wavelet Transform into a column of a variable?
How can I contain coefficients from the Stationary Wavelet Transform into
a column of a variable?
I am trying to apply the stationary wavelet transform to some coefficients
in a cell array, but when doing so I end up with a row of coefficients
stored in the variable as opposed to a column. I have been doing something
similar with the DWT where the coefficients have been contained to just a
column and this has worked well, I was expecting the coefficients from the
SWT to also be contained in columns, but unfortunately not. Does anyone
know why this is?
Here is the function that I'm using:
[L1,H1] = swt(f{1},1,'haar');
Does anyone know how I can get the coefficients contained in a column
instead of a row?
a column of a variable?
I am trying to apply the stationary wavelet transform to some coefficients
in a cell array, but when doing so I end up with a row of coefficients
stored in the variable as opposed to a column. I have been doing something
similar with the DWT where the coefficients have been contained to just a
column and this has worked well, I was expecting the coefficients from the
SWT to also be contained in columns, but unfortunately not. Does anyone
know why this is?
Here is the function that I'm using:
[L1,H1] = swt(f{1},1,'haar');
Does anyone know how I can get the coefficients contained in a column
instead of a row?
Rails Routing -- Adding Custom Route
Rails Routing -- Adding Custom Route
I'm almost certain that someone has asked this question before, but I
can't seem to hit on the right series of words to find it.
I have a resource, Games, with all of the normal resource-y paths. Create,
Edit, etc.
I've created a new action within GamesController called json that I want
to be able to access at mydomain.com/games/json but the routing keeps
picking up 'json' as the ID and routing it to the 'show' action instead.
Presumably this is because of the default route:
match ':controller(/:action(/:id))'
I've tried a number of things, but no matter what I do it keeps routing to
'show.' I've been attempting to figure it out using this guide, but for
someone that's pretty new to rails its quite a bit to take in and apply.
I'd like to say that for any controller /json would take you to the json
action (instead of show with id 'json'), but I'd settle for having to
specify it for every controller individually.
Any help is greatly appreciated. (Even if that's just pointing me to the
already answered question.) In all cases I've been placing the route I'm
attempting to create above the default route.
My routes:
root :to => 'home#index'
resources :events, :players, :sets, :matches, :characters, :videos,
:games, :event_instances, :game_instances
resource :user_session
resource :account, :controller => "users"
resources :users
match '/login', :to => 'user_sessions#new', :as => 'login'
match '/logout', :to => 'user_sessions#destroy', :as => 'logout'
match '/register', :to => 'users#create', :as => 'register'
match '/games/json', :to => 'games#json', :as => 'gameList'
match ':controller(/:action(/:id))'
I'm almost certain that someone has asked this question before, but I
can't seem to hit on the right series of words to find it.
I have a resource, Games, with all of the normal resource-y paths. Create,
Edit, etc.
I've created a new action within GamesController called json that I want
to be able to access at mydomain.com/games/json but the routing keeps
picking up 'json' as the ID and routing it to the 'show' action instead.
Presumably this is because of the default route:
match ':controller(/:action(/:id))'
I've tried a number of things, but no matter what I do it keeps routing to
'show.' I've been attempting to figure it out using this guide, but for
someone that's pretty new to rails its quite a bit to take in and apply.
I'd like to say that for any controller /json would take you to the json
action (instead of show with id 'json'), but I'd settle for having to
specify it for every controller individually.
Any help is greatly appreciated. (Even if that's just pointing me to the
already answered question.) In all cases I've been placing the route I'm
attempting to create above the default route.
My routes:
root :to => 'home#index'
resources :events, :players, :sets, :matches, :characters, :videos,
:games, :event_instances, :game_instances
resource :user_session
resource :account, :controller => "users"
resources :users
match '/login', :to => 'user_sessions#new', :as => 'login'
match '/logout', :to => 'user_sessions#destroy', :as => 'logout'
match '/register', :to => 'users#create', :as => 'register'
match '/games/json', :to => 'games#json', :as => 'gameList'
match ':controller(/:action(/:id))'
Minimization problem convex set
Minimization problem convex set
I'm trying to minimize the function: $$f(w)=w^T\mu+k\sqrt{w^T\Sigma w}$$
where $w$ is a vector in $W=\{x \in \mathbb{R}^n|x_1+...+x_n=1 , x_i \geq
0 \forall i\}$.
The vector $\mu \in \mathbb{R}^n$, the constant $k\in \mathbb{R}$ and the
symmetric positive-semidefinite matrix $\Sigma\in \mathbb{R}^{n*n}$ are
given.
Does this problem have an unique solution? I am able to see that $W$ is
convex but I don't think $f(w)$ is convex. How can I numerically solve the
problem? I know some theory of linear and quadratic programming but I' not
able to use them in this case.
I'm trying to minimize the function: $$f(w)=w^T\mu+k\sqrt{w^T\Sigma w}$$
where $w$ is a vector in $W=\{x \in \mathbb{R}^n|x_1+...+x_n=1 , x_i \geq
0 \forall i\}$.
The vector $\mu \in \mathbb{R}^n$, the constant $k\in \mathbb{R}$ and the
symmetric positive-semidefinite matrix $\Sigma\in \mathbb{R}^{n*n}$ are
given.
Does this problem have an unique solution? I am able to see that $W$ is
convex but I don't think $f(w)$ is convex. How can I numerically solve the
problem? I know some theory of linear and quadratic programming but I' not
able to use them in this case.
Joining two 32 bit variables into a 64 bit one in inline CUDA ptx
Joining two 32 bit variables into a 64 bit one in inline CUDA ptx
int lo, hi;
unsigned long long x;
asm volatile("mov.b32 {%0, %1}, %2;" : "=r"(lo), "=r"(hi): "l"(x));
Can anyone pointed out why NVCC report the following error with this
simple inline ptx code?
error : Arguments mismatch for instruction 'mov' ptxas : fatal error :
Ptx assembly aborted due to errors
int lo, hi;
unsigned long long x;
asm volatile("mov.b32 {%0, %1}, %2;" : "=r"(lo), "=r"(hi): "l"(x));
Can anyone pointed out why NVCC report the following error with this
simple inline ptx code?
error : Arguments mismatch for instruction 'mov' ptxas : fatal error :
Ptx assembly aborted due to errors
__________ READ __ BEFORE ___ DELETED ___ BY ___ MODS _____________
__________ READ __ BEFORE ___ DELETED ___ BY ___ MODS _____________
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1: you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool key ctrl+v
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest. ..........................................
............................................................
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1: you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool key ctrl+v
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest. ..........................................
............................................................
Friday, 23 August 2013
Storing an array in a separate class file
Storing an array in a separate class file
I am coding for the Ludum Dare right now and I was trying to make a
separate class that would give me an array as the return type of a
function. I have an array set up, but I can't figure out how to make the
return type an array so that I can use it in the main function. How would
I go about returning an array and setting a variable in the main.cpp to
that array?
I am coding for the Ludum Dare right now and I was trying to make a
separate class that would give me an array as the return type of a
function. I have an array set up, but I can't figure out how to make the
return type an array so that I can use it in the main function. How would
I go about returning an array and setting a variable in the main.cpp to
that array?
Why i can't lock DrawerLayout with layout gravity
Why i can't lock DrawerLayout with layout gravity
I use DrawerLayout and recently i want to change gravity of listView in
drawerLayout. But after i change gravity of listView to
android:layout_gravity="start|bottom"from android:layout_gravity="start",
drawerLayout can't be lock to
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
setDrawerLockMode() work with;
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#F3F3F4"
android:choiceMode="singleChoice" >
</ListView>
But it doesn't lock with;
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start|bottom"
android:background="#F3F3F4"
android:choiceMode="singleChoice" >
</ListView>
`
Any clues of why can't I use lock mode with other gravities?
Thanks!
I use DrawerLayout and recently i want to change gravity of listView in
drawerLayout. But after i change gravity of listView to
android:layout_gravity="start|bottom"from android:layout_gravity="start",
drawerLayout can't be lock to
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
setDrawerLockMode() work with;
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#F3F3F4"
android:choiceMode="singleChoice" >
</ListView>
But it doesn't lock with;
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start|bottom"
android:background="#F3F3F4"
android:choiceMode="singleChoice" >
</ListView>
`
Any clues of why can't I use lock mode with other gravities?
Thanks!
Linq List of Objects GroupBy Multiple Property Equality
Linq List of Objects GroupBy Multiple Property Equality
I have a List<ReportObject> and want to be able to combine certain
elements of the list into a single element based on the equality of
certain properties from one element matching certain other properties from
a second element in the list. In this case, I want to update the first
element with values from the second element and then return a list with
only the collection of "first elements".
Perhaps GroupBy (or LINQ in general) isn't the right solution here, but it
does seem like it would be a lot cleaner than doing a traditional foreach
loop and newing up a second list. What I want is something like this:
List<ReportObject> theList = new List<ReportObject>()
{ new ReportObject() { Property1 = "1",
Property2 = "2" },
new ReportObject() { Property1 = "2",
Property2 = "3" }
new ReportObject() { Property1 = "1",
Property2 = "3" } };
List<ReportObject> newList = new List<ReportObject>();
for(int i = 0; i < theList.Count; i++)
{
if (theList[i].Property1 == theList[i+1].Property2)
{
theList[i].Property2 = theList[i+1].Property2);
newList.Add(theList[i]);
theList.RemoveAt(i+1);
}
}
return newList;
I have a List<ReportObject> and want to be able to combine certain
elements of the list into a single element based on the equality of
certain properties from one element matching certain other properties from
a second element in the list. In this case, I want to update the first
element with values from the second element and then return a list with
only the collection of "first elements".
Perhaps GroupBy (or LINQ in general) isn't the right solution here, but it
does seem like it would be a lot cleaner than doing a traditional foreach
loop and newing up a second list. What I want is something like this:
List<ReportObject> theList = new List<ReportObject>()
{ new ReportObject() { Property1 = "1",
Property2 = "2" },
new ReportObject() { Property1 = "2",
Property2 = "3" }
new ReportObject() { Property1 = "1",
Property2 = "3" } };
List<ReportObject> newList = new List<ReportObject>();
for(int i = 0; i < theList.Count; i++)
{
if (theList[i].Property1 == theList[i+1].Property2)
{
theList[i].Property2 = theList[i+1].Property2);
newList.Add(theList[i]);
theList.RemoveAt(i+1);
}
}
return newList;
How to authenticate Facebook User after receiving response.status === 'connected'?
How to authenticate Facebook User after receiving response.status ===
'connected'?
Perhaps I am going about this the wrong way but I have a website that
allows facebook login.
1) If the user has already registered on my website 2) and is logged into
facebook but not logged into my site 3) when visiting the login page i
check for their facebook login status and get response.status ===
'connected' via
FB.Event.subscribe('auth.authResponseChange', function (response) {
if (response.status === 'connected') {
var s = JSON.stringify(response.authResponse);
LogMeIn(s, function(response) {
HandleAjaxError(response, function(msg){
window.location = '/_/';
});
});
4) I then want to pass their authResponse object to the server and confirm
that this userid works with this token before I log them in as this user
I have read to simply grab the json contents of
https://graph.facebook.com/{userID}?access_token={accessToken}
and if it does not return an error then it is good! But when testing this
method I noticed that the same access_token worked for two different user
ids (meaning it did not return an error for the userid that was not logged
in on my computer). Instead it returned the facebook user object with name
, location etc.
This really surprised me, as I expected the access_token to work only with
a single user id.
In an effort to prevent someone from simply changing the user id before
continuing the script I need to authenticate via server side. What is a
way to accomplish this?
Proof, go to these links to see profile information
My profile
https://graph.facebook.com/1233822590?access_token=CAACCBJJZBgjABAOGmvmsou8gMYGulLHTgAr5ZCHZAU7pKEp0cMAeX8r4qHLpiVuZCOT1v0ulMZAxX5YfLJkcZBr9l6qJQoPxWS5Fs5ndohDnH6ZAPPfZCZCTQtwWgAZAg6I1PAOIpdtCc0OUaMmBZAvGiMm9gQhmNXRbocZD
Another userid with same access_token
https://graph.facebook.com/100000116781159?access_token=CAACCBJJZBgjABAOGmvmsou8gMYGulLHTgAr5ZCHZAU7pKEp0cMAeX8r4qHLpiVuZCOT1v0ulMZAxX5YfLJkcZBr9l6qJQoPxWS5Fs5ndohDnH6ZAPPfZCZCTQtwWgAZAg6I1PAOIpdtCc0OUaMmBZAvGiMm9gQhmNXRbocZD
'connected'?
Perhaps I am going about this the wrong way but I have a website that
allows facebook login.
1) If the user has already registered on my website 2) and is logged into
facebook but not logged into my site 3) when visiting the login page i
check for their facebook login status and get response.status ===
'connected' via
FB.Event.subscribe('auth.authResponseChange', function (response) {
if (response.status === 'connected') {
var s = JSON.stringify(response.authResponse);
LogMeIn(s, function(response) {
HandleAjaxError(response, function(msg){
window.location = '/_/';
});
});
4) I then want to pass their authResponse object to the server and confirm
that this userid works with this token before I log them in as this user
I have read to simply grab the json contents of
https://graph.facebook.com/{userID}?access_token={accessToken}
and if it does not return an error then it is good! But when testing this
method I noticed that the same access_token worked for two different user
ids (meaning it did not return an error for the userid that was not logged
in on my computer). Instead it returned the facebook user object with name
, location etc.
This really surprised me, as I expected the access_token to work only with
a single user id.
In an effort to prevent someone from simply changing the user id before
continuing the script I need to authenticate via server side. What is a
way to accomplish this?
Proof, go to these links to see profile information
My profile
https://graph.facebook.com/1233822590?access_token=CAACCBJJZBgjABAOGmvmsou8gMYGulLHTgAr5ZCHZAU7pKEp0cMAeX8r4qHLpiVuZCOT1v0ulMZAxX5YfLJkcZBr9l6qJQoPxWS5Fs5ndohDnH6ZAPPfZCZCTQtwWgAZAg6I1PAOIpdtCc0OUaMmBZAvGiMm9gQhmNXRbocZD
Another userid with same access_token
https://graph.facebook.com/100000116781159?access_token=CAACCBJJZBgjABAOGmvmsou8gMYGulLHTgAr5ZCHZAU7pKEp0cMAeX8r4qHLpiVuZCOT1v0ulMZAxX5YfLJkcZBr9l6qJQoPxWS5Fs5ndohDnH6ZAPPfZCZCTQtwWgAZAg6I1PAOIpdtCc0OUaMmBZAvGiMm9gQhmNXRbocZD
c#: static member vs instance member
c#: static member vs instance member
why would i need a static function, over a member function..
we know
static function/variable doesn't require an object to access
static member maintains its state across multiple object (ex: static int
couter = 0;)
but wht's the big deal in creating an object, to access a behavior of a
class... is it because i don't have to initialize memory (for an object),
when accessing a static function, thereby save some bytes of memory...
if that's the case then, where does a class definition live so that my
currently executing class can have access to it...if it lives in memory,
then y can't i create an object for the same...
is it because, object(size in memory) > class definition (size in memory)
in some cases its also said that
a function which has no impact on an instance object we need to make use
of a static function (for ex: Math related functions in System.Math) (is
that true...)
why would i need a static function, over a member function..
we know
static function/variable doesn't require an object to access
static member maintains its state across multiple object (ex: static int
couter = 0;)
but wht's the big deal in creating an object, to access a behavior of a
class... is it because i don't have to initialize memory (for an object),
when accessing a static function, thereby save some bytes of memory...
if that's the case then, where does a class definition live so that my
currently executing class can have access to it...if it lives in memory,
then y can't i create an object for the same...
is it because, object(size in memory) > class definition (size in memory)
in some cases its also said that
a function which has no impact on an instance object we need to make use
of a static function (for ex: Math related functions in System.Math) (is
that true...)
Which one subsumes the other: class-based object-orientation of prototypal inheritance?
Which one subsumes the other: class-based object-orientation of prototypal
inheritance?
In this talk: http://www.youtube.com/watch?v=hQVTIJBZook, Douglas
Crockford claims that class-based object-orientation can be represented in
terms of prototypal inheritance. The construction he gives is something
like:
var theObject = function() {
var private1 = ...;
var private2 = ...;
...
return {
public1: ...,
public2: ...,
...
};
};
He also claims that the converse is not true: prototypal inheritance
cannot be in general encoded using class-based constructs only. I have
been thinking about it for a while, and it seems to me that both claims
are wrong.
The supposed "encoding" of class-based object-orientation is wrong from an
operational semantics point of view. In a typical class-based
object-oriented language, member variables and functions are known to
exist, so they can be directly used. The prototypal "encoding" relies on
testing at runtime whether a member with a specific member is present in
an object/hashtable. Ergo, the semantics are different.
Prototypal inheritance actually can be encoded in a class-based
object-oriented language.
I will use C++ as an example, but any other class-based object-oriented
language could be used.
struct prototypal
{
std::shared_ptr<prototypal> base;
std::unordered_map<std::string, boost::any> members;
const member & operator [] (const std::string & key) const
{
auto it = members.find (key);
if (it == members.end ())
{
if (base)
return base [key];
else
throw std::logic_error { "Member not found." };
}
else
return *it;
}
member & operator [] (const std::string & key)
{
auto it = members.find (key);
if (it == members.end ())
{
if (base)
return base [key];
else
throw std::logic_error { "Member not found." };
}
else
return *it;
}
};
Is my analysis wrong? Am I missing something?
inheritance?
In this talk: http://www.youtube.com/watch?v=hQVTIJBZook, Douglas
Crockford claims that class-based object-orientation can be represented in
terms of prototypal inheritance. The construction he gives is something
like:
var theObject = function() {
var private1 = ...;
var private2 = ...;
...
return {
public1: ...,
public2: ...,
...
};
};
He also claims that the converse is not true: prototypal inheritance
cannot be in general encoded using class-based constructs only. I have
been thinking about it for a while, and it seems to me that both claims
are wrong.
The supposed "encoding" of class-based object-orientation is wrong from an
operational semantics point of view. In a typical class-based
object-oriented language, member variables and functions are known to
exist, so they can be directly used. The prototypal "encoding" relies on
testing at runtime whether a member with a specific member is present in
an object/hashtable. Ergo, the semantics are different.
Prototypal inheritance actually can be encoded in a class-based
object-oriented language.
I will use C++ as an example, but any other class-based object-oriented
language could be used.
struct prototypal
{
std::shared_ptr<prototypal> base;
std::unordered_map<std::string, boost::any> members;
const member & operator [] (const std::string & key) const
{
auto it = members.find (key);
if (it == members.end ())
{
if (base)
return base [key];
else
throw std::logic_error { "Member not found." };
}
else
return *it;
}
member & operator [] (const std::string & key)
{
auto it = members.find (key);
if (it == members.end ())
{
if (base)
return base [key];
else
throw std::logic_error { "Member not found." };
}
else
return *it;
}
};
Is my analysis wrong? Am I missing something?
Thursday, 22 August 2013
Table column align on decimal
Table column align on decimal
Jeff Dean published this famous table of "numbers every software developer
should know". I'm struggling to format it properly for a publication that
is written in LaTeX.
As you can see, the left column is easy. It is left justified.
The right column needs to be aligned on the word "ns" with an occasional
note after it. Also the first line has a decimal, while the other numbers
are integers.
Here's my best attempt so far:
\begin{tabular}{ | l | r |}
\hline
L1 cache reference & 0.5 ns \\
Branch mispredict & 5 ns \\
L2 cache reference & 7 ns \\
Mutex lock/unlock & 100 ns (25) \\
Main memory reference & 100 ns \\
Compress 1K bytes with Zippy & 10,000 ns (3,000) \\
Send 2K bytes over 1 Gbps network & 20,000 ns \\
Read 1 MB sequentially from memory & 250,000 ns \\
Round trip within same datacenter & 500,000 ns \\
Disk seek & 10,000,000 ns \\
Read 1 MB sequentially from network & 10,000,000 ns \\
Read 1 MB sequentially from disk & 30,000,000 ns (20,000,000) \\
Send packet CA to Netherlands to CA & 150,000,000 ns \\
\hline
\end{tabular}
My biggest concern is how to align the "ns". I'm less concerned with the
0.5 being formatted decimal aligned.
Jeff Dean published this famous table of "numbers every software developer
should know". I'm struggling to format it properly for a publication that
is written in LaTeX.
As you can see, the left column is easy. It is left justified.
The right column needs to be aligned on the word "ns" with an occasional
note after it. Also the first line has a decimal, while the other numbers
are integers.
Here's my best attempt so far:
\begin{tabular}{ | l | r |}
\hline
L1 cache reference & 0.5 ns \\
Branch mispredict & 5 ns \\
L2 cache reference & 7 ns \\
Mutex lock/unlock & 100 ns (25) \\
Main memory reference & 100 ns \\
Compress 1K bytes with Zippy & 10,000 ns (3,000) \\
Send 2K bytes over 1 Gbps network & 20,000 ns \\
Read 1 MB sequentially from memory & 250,000 ns \\
Round trip within same datacenter & 500,000 ns \\
Disk seek & 10,000,000 ns \\
Read 1 MB sequentially from network & 10,000,000 ns \\
Read 1 MB sequentially from disk & 30,000,000 ns (20,000,000) \\
Send packet CA to Netherlands to CA & 150,000,000 ns \\
\hline
\end{tabular}
My biggest concern is how to align the "ns". I'm less concerned with the
0.5 being formatted decimal aligned.
Passing an object in MVC 4
Passing an object in MVC 4
I'm having a bit of trouble learning MVC 4 at the moment, and I was hoping
someone could help. As far as I can tell, there isn't a duplicate of this
question that showed up in search, but if there is, please direct me to
it.
My question is this: in a list of schools that I have shown on my
index.aspx page, is it possible to then have a user click on the "details"
link such that it goes back and brings up the details for that specific
school? I've included all of the relevant information from my code below,
but please excuse me if it is too much (I wasn't sure exactly what was
needed).
As you can see, the ActionResult Index() brings back a list of all schools
in my database. What I want to do is post back when they click "details"
so that the view then returns with specific information about that school.
Is this possible? I figured that it would be possible to just pass the Id
of the school that was clicked on, but then when I get back down to the
DAC layer, it's accepting an Id (int) as a parameter, when I want it to
return an object of type "School". Does this make sense?
For what it's worth, I know a small bit of Javascript, but no jQuery,
JSON, etc (yet).
So I have 5 layers:
Index.aspx (View)
SchoolController (Controller)
SchoolBus (Business layer)
SchoolDAC (Database Access Class)
SchoolVO (View Object)
My view object:
SchoolVO.cs:
public int Id { get; set; }
public string Name { get; set; }
public string Slogan { get; set; }
My database access class:
SchoolDAC.cs
public static School GetSchool(School school)
{
try
{
using (SqlConnection conn =
ConnectionHelper.GetConnection("SchoolDB"))
{
SqlCommand cmd = new SqlCommand("Schools.GetSchool", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@SchoolId", school.Id);
using (SqlDataReader dr = cmd.ExecuteReader())
{
if (dr.Read())
{
school = readRecord(dr);
// readRecord() is just another method that fills
the 3 properties of the school object with data
from the database.
}
}
return school;
}
}
catch (Exception ex)
{
throw new Exception("Failed to get school", ex);
}
}
My "business" layer:
SchoolBus.cs:
public static School GetSchool(School school)
{
school = SchoolDAC.GetSchool(school);
return school;
}
My Controller:
SchoolController.cs:
public ActionResult Index()
{
List<School> model = SchoolBus.GetAllSchools();
return View(model);
}
[HttpPost]
public ActionResult Index(School school)
{
School model = SchoolBus.GetSchool(school);
return View(model);
}
My View:
index.aspx:
<table>
<tr>
<th>
<%: Html.DisplayNameFor(model => model.Id) %>
</th>
<th>
<%: Html.DisplayNameFor(model => model.Name) %>
</th>
<th>
<%: Html.DisplayNameFor(model => model.Slogan) %>
</th>
<th></th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%: Html.DisplayFor(modelItem => item.Id) %>
</td>
<td>
<%: Html.DisplayFor(modelItem => item.Name) %>
</td>
<td>
<%: Html.DisplayFor(modelItem => item.Slogan) %>
</td>
<td> <!--- possible to pass an object through here? --->
<%: Html.ActionLink("Sign Up", "Index", new { id=item.Id
}) %> |
<%: Html.ActionLink("Details", "Details", new { id=item.Id
}) %> |
<%: Html.ActionLink("Delete", "Delete", new { id=item.Id
}) %>
</td>
</tr>
<% } %>
</table>
I'm having a bit of trouble learning MVC 4 at the moment, and I was hoping
someone could help. As far as I can tell, there isn't a duplicate of this
question that showed up in search, but if there is, please direct me to
it.
My question is this: in a list of schools that I have shown on my
index.aspx page, is it possible to then have a user click on the "details"
link such that it goes back and brings up the details for that specific
school? I've included all of the relevant information from my code below,
but please excuse me if it is too much (I wasn't sure exactly what was
needed).
As you can see, the ActionResult Index() brings back a list of all schools
in my database. What I want to do is post back when they click "details"
so that the view then returns with specific information about that school.
Is this possible? I figured that it would be possible to just pass the Id
of the school that was clicked on, but then when I get back down to the
DAC layer, it's accepting an Id (int) as a parameter, when I want it to
return an object of type "School". Does this make sense?
For what it's worth, I know a small bit of Javascript, but no jQuery,
JSON, etc (yet).
So I have 5 layers:
Index.aspx (View)
SchoolController (Controller)
SchoolBus (Business layer)
SchoolDAC (Database Access Class)
SchoolVO (View Object)
My view object:
SchoolVO.cs:
public int Id { get; set; }
public string Name { get; set; }
public string Slogan { get; set; }
My database access class:
SchoolDAC.cs
public static School GetSchool(School school)
{
try
{
using (SqlConnection conn =
ConnectionHelper.GetConnection("SchoolDB"))
{
SqlCommand cmd = new SqlCommand("Schools.GetSchool", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@SchoolId", school.Id);
using (SqlDataReader dr = cmd.ExecuteReader())
{
if (dr.Read())
{
school = readRecord(dr);
// readRecord() is just another method that fills
the 3 properties of the school object with data
from the database.
}
}
return school;
}
}
catch (Exception ex)
{
throw new Exception("Failed to get school", ex);
}
}
My "business" layer:
SchoolBus.cs:
public static School GetSchool(School school)
{
school = SchoolDAC.GetSchool(school);
return school;
}
My Controller:
SchoolController.cs:
public ActionResult Index()
{
List<School> model = SchoolBus.GetAllSchools();
return View(model);
}
[HttpPost]
public ActionResult Index(School school)
{
School model = SchoolBus.GetSchool(school);
return View(model);
}
My View:
index.aspx:
<table>
<tr>
<th>
<%: Html.DisplayNameFor(model => model.Id) %>
</th>
<th>
<%: Html.DisplayNameFor(model => model.Name) %>
</th>
<th>
<%: Html.DisplayNameFor(model => model.Slogan) %>
</th>
<th></th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%: Html.DisplayFor(modelItem => item.Id) %>
</td>
<td>
<%: Html.DisplayFor(modelItem => item.Name) %>
</td>
<td>
<%: Html.DisplayFor(modelItem => item.Slogan) %>
</td>
<td> <!--- possible to pass an object through here? --->
<%: Html.ActionLink("Sign Up", "Index", new { id=item.Id
}) %> |
<%: Html.ActionLink("Details", "Details", new { id=item.Id
}) %> |
<%: Html.ActionLink("Delete", "Delete", new { id=item.Id
}) %>
</td>
</tr>
<% } %>
</table>
What is next(); in this code?
What is next(); in this code?
There's a line of code using next(); in this Express app (for Nodejs) that
I don't understand. I wonder if you could clarify.
In index.js, the express app calls a function isLoggedInMiddleware. It
doesn't pass any parameters
app.use(sessionHandler.isLoggedInMiddleware);
Here is that function. When it was called, it wasn't passed any
parameters, but it's set up to accept three, with next being the last,
which is called as the return value of getUsername.
this.isLoggedInMiddleware = function(req, res, next) {
var session_id = req.cookies.session;
sessions.getUsername(session_id, function(err, username) {
"use strict";
if (!err && username) {
req.username = username;
}
return next();
});
}
This is getUserName which next(); gets passed to as part of the callbak.
Can you explain how next(); was being used? what is it in this context?
what is it doing?
this.getUsername = function(session_id, callback) {
"use strict";
if (!session_id) {
callback(Error("Session not set"), null);
return;
}
sessions.findOne({ '_id' : session_id }, function(err, session) {
"use strict";
if (err) return callback(err, null);
if (!session) {
callback(new Error("Session: " + session + " does not
exist"), null);
return;
}
callback(null, session.username);
});
}
There's a line of code using next(); in this Express app (for Nodejs) that
I don't understand. I wonder if you could clarify.
In index.js, the express app calls a function isLoggedInMiddleware. It
doesn't pass any parameters
app.use(sessionHandler.isLoggedInMiddleware);
Here is that function. When it was called, it wasn't passed any
parameters, but it's set up to accept three, with next being the last,
which is called as the return value of getUsername.
this.isLoggedInMiddleware = function(req, res, next) {
var session_id = req.cookies.session;
sessions.getUsername(session_id, function(err, username) {
"use strict";
if (!err && username) {
req.username = username;
}
return next();
});
}
This is getUserName which next(); gets passed to as part of the callbak.
Can you explain how next(); was being used? what is it in this context?
what is it doing?
this.getUsername = function(session_id, callback) {
"use strict";
if (!session_id) {
callback(Error("Session not set"), null);
return;
}
sessions.findOne({ '_id' : session_id }, function(err, session) {
"use strict";
if (err) return callback(err, null);
if (!session) {
callback(new Error("Session: " + session + " does not
exist"), null);
return;
}
callback(null, session.username);
});
}
HTML5 functions not working in external js class file
HTML5 functions not working in external js class file
var Player1 = new character;
When I attempt to call the function with "Player1.Logic();" or "Logic();"
I get an error: "Uncaught TypeError: Object # has no method 'Logic'"
Here is my character.js class file:
(function(window){
function character(){
}
function Logic(){
console.log("new character loaded!");
}
window.character = character;
}(window));
Should I be declaring the function differently or calling it differently?
Everything else seems to work fine except for this. The only luck that
I've had so far is with declaring functions with event handlers.
var Player1 = new character;
When I attempt to call the function with "Player1.Logic();" or "Logic();"
I get an error: "Uncaught TypeError: Object # has no method 'Logic'"
Here is my character.js class file:
(function(window){
function character(){
}
function Logic(){
console.log("new character loaded!");
}
window.character = character;
}(window));
Should I be declaring the function differently or calling it differently?
Everything else seems to work fine except for this. The only luck that
I've had so far is with declaring functions with event handlers.
PHP - get data from select box without the value
PHP - get data from select box without the value
I'm having a bit of a confusing question but hopefully you'll get what I
mean:
In my website I'm trying to implement a select box which is updated based
on the value from a previous select box. For that I'm using a javascript
that takes the values. For example an option from the select box looks
like this:
option value="22">Apple/option>
I need the value in order to filter the select boxes but in my PHP script
I need to get that 'Apple' text. Is there a way to do that?
Sorry for the noob question but web development is new for me. Thanks in
advance!
I'm having a bit of a confusing question but hopefully you'll get what I
mean:
In my website I'm trying to implement a select box which is updated based
on the value from a previous select box. For that I'm using a javascript
that takes the values. For example an option from the select box looks
like this:
option value="22">Apple/option>
I need the value in order to filter the select boxes but in my PHP script
I need to get that 'Apple' text. Is there a way to do that?
Sorry for the noob question but web development is new for me. Thanks in
advance!
Wednesday, 21 August 2013
how to filter products using AJAX & php and any php framework available for the same?
how to filter products using AJAX & php and any php framework available
for the same?
i want to create a website in which we can search a product from the home
page and after that there will be filter menu on the left side which works
on ajax. so my question is how to create such site on php with a available
frameworks... which is the best framework for this project? and if a done
this project without framework then please give some tutorials regarding
the same.
for the same?
i want to create a website in which we can search a product from the home
page and after that there will be filter menu on the left side which works
on ajax. so my question is how to create such site on php with a available
frameworks... which is the best framework for this project? and if a done
this project without framework then please give some tutorials regarding
the same.
API for facebook graph search
API for facebook graph search
Does Facebook provide APIs that allows a person to put queries in the same
way as we put in the Graph search itself i.e "People who like tennis". I
am making a Facebook app and I want to facilitate the user the put queries
in the same way as they do in Facebook Graph search and then use that API
to search for that query. If not how can I possibly get close to doing my
task.
Does Facebook provide APIs that allows a person to put queries in the same
way as we put in the Graph search itself i.e "People who like tennis". I
am making a Facebook app and I want to facilitate the user the put queries
in the same way as they do in Facebook Graph search and then use that API
to search for that query. If not how can I possibly get close to doing my
task.
Algorithm: Determine if a combination of min/max values fall within a given range
Algorithm: Determine if a combination of min/max values fall within a
given range
Imagine you have 3 buckets, but each of them has a hole in it. I'm trying
to fill a bath tub. The bath tub has a minimum level of water it needs and
a maximum level of water it can contain. By the time you reach the tub
with the bucket it is not clear how much water will be in the bucket, but
you have a range of possible values.
Is it possible to adequately fill the tub with water?
Pretty much you have 3 ranges (min,max), is there some sum of them that
will fall within a 4th range?
given range
Imagine you have 3 buckets, but each of them has a hole in it. I'm trying
to fill a bath tub. The bath tub has a minimum level of water it needs and
a maximum level of water it can contain. By the time you reach the tub
with the bucket it is not clear how much water will be in the bucket, but
you have a range of possible values.
Is it possible to adequately fill the tub with water?
Pretty much you have 3 ranges (min,max), is there some sum of them that
will fall within a 4th range?
Replace factory with AutoFac
Replace factory with AutoFac
I'm accustomed to creating my own factories as shown (this is simplified
for illustration):
public class ElementFactory
{
public IElement Create(IHtml dom)
{
switch (dom.ElementType)
{
case "table":
return new TableElement(dom);
case "div":
return new DivElement(dom);
case "span":
return new SpanElement(dom);
}
return new PassthroughElement(dom);
}
}
I'm finally getting around to using an IoC container (AutoFac) in my
current project, and I'm wondering is there some magic way of achieving
the same thing elegantly with AutoFac?
I'm accustomed to creating my own factories as shown (this is simplified
for illustration):
public class ElementFactory
{
public IElement Create(IHtml dom)
{
switch (dom.ElementType)
{
case "table":
return new TableElement(dom);
case "div":
return new DivElement(dom);
case "span":
return new SpanElement(dom);
}
return new PassthroughElement(dom);
}
}
I'm finally getting around to using an IoC container (AutoFac) in my
current project, and I'm wondering is there some magic way of achieving
the same thing elegantly with AutoFac?
android device browser display problems
android device browser display problems
My website does not display properly on Samsung and Motorola device
despite using different browsers. All others are fine. area using
transform css breaks apart. http://www.cawws.org/index.html
I don't get it. I've tried various fixes. Nada. Any help?
Thanks
MRT
My website does not display properly on Samsung and Motorola device
despite using different browsers. All others are fine. area using
transform css breaks apart. http://www.cawws.org/index.html
I don't get it. I've tried various fixes. Nada. Any help?
Thanks
MRT
Visualstudio makefile (NMAKE)
Visualstudio makefile (NMAKE)
I am in need to create a makefile for visual studio. however the
documentation for this on Microsoft websites is very gently speaking:
lousy. Googling doesn't help either. Could somebody paste a link or simple
tutorial on how to create such makefile (for example compiling one program
from two cpp files). Also mentioning if include files like in GNU are
possible to use (and how to import them in makefile). Or how can i echo
something in makefile.
I have seen this but is of not much help.
I am in need to create a makefile for visual studio. however the
documentation for this on Microsoft websites is very gently speaking:
lousy. Googling doesn't help either. Could somebody paste a link or simple
tutorial on how to create such makefile (for example compiling one program
from two cpp files). Also mentioning if include files like in GNU are
possible to use (and how to import them in makefile). Or how can i echo
something in makefile.
I have seen this but is of not much help.
Display multi images with condition
Display multi images with condition
I try to display a part of gallery's photo=> this is result when i did the
search action. This result have avatar like a picture and infomation like
username or email.
I create Photo.java like child of Users.java in relationship @ManytoOne
Here is my code :
Photo.java----
@Entity
public class Photo extends Model{
@Id
public Long id;
public String path;
@ManyToOne
@JoinColumn(name = "user_id")
public Users user;
}
Users.java-----
@Entity
public class Users extends Model{
@Id
public Long id;
@Constraints.Required
public String username;
@Constraints.Required
public String email;
@Constraints.Required
public String password;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
public List<Photo> photo = new ArrayList<Photo>();
public Users(){}
public Users(String username,String email,String password){
this.username=username;
this.email=email;
this.password=password;
}
}
Search.java -----
public static Result search(){
DynamicForm form = form().bindFromRequest();
String name = form.get("name");
Finder<Long, Users> find = new Finder<Long, Users>(Long.class,
Users.class);
List<Users> users = find.where().like("username", '%'+ name
+'%').findList();
if (form.get("name")=="" || users.isEmpty() || users==null){
return ok(search_again.render());
}
else{
return ok (search_result.render(users));
}
}
search_result.scala.html----
@(users : List[Users])
@main(nav= "search"){
<h3>Result</h3>
<a href="@routes.Search.blank"><input class="button" type="button"
value="Back to Search"></a>
<a href="@routes.Application.index"><input class="button"
type="button" value="Back to Home"></a>
<p>Found @users.size() result(s) : </p>
<div class="sresult">
@for(user <- users){
<div id="sresult">
<div id="haha"><img
src="@routes.Assets.at("upload/"+user.photo.path)"></div>
//Error here. Why "user.photo.path" not working ?
<p>
@user.username</a></br>
@user.password</a></br>
@user.email</a>
</p>
</div>
}
</div>
}
Why "user.photo.path" not working ? any ideal in my case ?
I try to display a part of gallery's photo=> this is result when i did the
search action. This result have avatar like a picture and infomation like
username or email.
I create Photo.java like child of Users.java in relationship @ManytoOne
Here is my code :
Photo.java----
@Entity
public class Photo extends Model{
@Id
public Long id;
public String path;
@ManyToOne
@JoinColumn(name = "user_id")
public Users user;
}
Users.java-----
@Entity
public class Users extends Model{
@Id
public Long id;
@Constraints.Required
public String username;
@Constraints.Required
public String email;
@Constraints.Required
public String password;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
public List<Photo> photo = new ArrayList<Photo>();
public Users(){}
public Users(String username,String email,String password){
this.username=username;
this.email=email;
this.password=password;
}
}
Search.java -----
public static Result search(){
DynamicForm form = form().bindFromRequest();
String name = form.get("name");
Finder<Long, Users> find = new Finder<Long, Users>(Long.class,
Users.class);
List<Users> users = find.where().like("username", '%'+ name
+'%').findList();
if (form.get("name")=="" || users.isEmpty() || users==null){
return ok(search_again.render());
}
else{
return ok (search_result.render(users));
}
}
search_result.scala.html----
@(users : List[Users])
@main(nav= "search"){
<h3>Result</h3>
<a href="@routes.Search.blank"><input class="button" type="button"
value="Back to Search"></a>
<a href="@routes.Application.index"><input class="button"
type="button" value="Back to Home"></a>
<p>Found @users.size() result(s) : </p>
<div class="sresult">
@for(user <- users){
<div id="sresult">
<div id="haha"><img
src="@routes.Assets.at("upload/"+user.photo.path)"></div>
//Error here. Why "user.photo.path" not working ?
<p>
@user.username</a></br>
@user.password</a></br>
@user.email</a>
</p>
</div>
}
</div>
}
Why "user.photo.path" not working ? any ideal in my case ?
Tuesday, 20 August 2013
Create jquery countdown timer for minutes and seconds
Create jquery countdown timer for minutes and seconds
I am trying to create a countdown timer where I need to show timer with
minutes and seconds as mm:ss till it is 00:00. I am getting input in the
same format. Can some one please guide me how to do that. I have found few
tutorials online but they are just for seconds. Thanks in advance.
I am trying to create a countdown timer where I need to show timer with
minutes and seconds as mm:ss till it is 00:00. I am getting input in the
same format. Can some one please guide me how to do that. I have found few
tutorials online but they are just for seconds. Thanks in advance.
How to see source code for functions written in C/C++?
How to see source code for functions written in C/C++?
In general, the source code for functions written in R can be looked up
just by typing the name of the function on R console. How do you do it for
functions which are written in C or C++?
For e.g. when I try and look up the code for lapply() function, it shows
me this -
function (X, FUN, ...)
{
FUN <- match.fun(FUN)
if (!is.vector(X) || is.object(X))
X <- as.list(X)
.Internal(lapply(X, FUN))
}
<bytecode: 0x0000000007384128>
<environment: namespace:base>
which doesn't help in anyways to understand what exactly this function is
doing.
In general, the source code for functions written in R can be looked up
just by typing the name of the function on R console. How do you do it for
functions which are written in C or C++?
For e.g. when I try and look up the code for lapply() function, it shows
me this -
function (X, FUN, ...)
{
FUN <- match.fun(FUN)
if (!is.vector(X) || is.object(X))
X <- as.list(X)
.Internal(lapply(X, FUN))
}
<bytecode: 0x0000000007384128>
<environment: namespace:base>
which doesn't help in anyways to understand what exactly this function is
doing.
How do the President's three initial decisions affect the story?
How do the President's three initial decisions affect the story?
At the beginning of the game, the President makes three selections about
supporting a humanitarian action, punching a politician, and hanging out
with someone. What are the ramifications of choosing one option versus the
other? What effect do the choices have on the game and its story?
At the beginning of the game, the President makes three selections about
supporting a humanitarian action, punching a politician, and hanging out
with someone. What are the ramifications of choosing one option versus the
other? What effect do the choices have on the game and its story?
Make bot login to encrypted site
Make bot login to encrypted site
I am building a bot that scrapes data from a secure page www.jtracker.com.
my problem is that i need my bot to login (with a fixed username and
password) so that i can scrape the data. i began by setting up something
with php/curl. I think I'm having trouble with the cookies. any advice??
$data_array['username'] = $_POST['username'];
$data_array['password'] = $_POST['password'];
$account = $_POST['accounts'];
$type = $_POST['type'];
$target = "https://www.jtracker.com/account/login.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target); // Define target site
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01;
Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return page in string
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_array);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
$page = curl_exec($ch);
echo $page;
I am building a bot that scrapes data from a secure page www.jtracker.com.
my problem is that i need my bot to login (with a fixed username and
password) so that i can scrape the data. i began by setting up something
with php/curl. I think I'm having trouble with the cookies. any advice??
$data_array['username'] = $_POST['username'];
$data_array['password'] = $_POST['password'];
$account = $_POST['accounts'];
$type = $_POST['type'];
$target = "https://www.jtracker.com/account/login.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target); // Define target site
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01;
Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return page in string
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_array);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
$page = curl_exec($ch);
echo $page;
get emacs to automatically use biber instead of bibtex
get emacs to automatically use biber instead of bibtex
I was reading the question titled Customizing emacs to use biblatex-biber
instead of bibtex. In that question, user @PLK mentions that as of auctex
11.87, auctex should automatically check if you are using biblatex and if
so, switch to using biber. I have auctex 11.87 installed and running, but
I am not getting this automatic switching behavior.
Say I have two files (borrowed from this question).
test.tex
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{test.bib}
\defbibheading{bibliography}{}
\begin{document}
\nocite{*}
\subsection*{Journal Publications:}
\printbibliography[type=article]
\subsection*{Conference Publications:}
\printbibliography[type=inproceedings]
\end{document}
and test.bib
@ARTICLE{abc,
author = {A Author},
title = {the article title},
journal = {the journal},
year = {2012},
volume = {1},
pages = {1--2},
number = {1},
month = {1},
doi = {1234/5678}
}
@INPROCEEDINGS{def,
author = {A Author},
title = {the proceeding title},
journal = {the conference},
year = {2012},
volume = {1},
pages = {11--12},
number = {1},
month = {1},
doi = {5678/1234}
}
If I run the following commands:
pdflatex test.tex
biber test
pdflatex test.tex
I end up with a properly processed document. In emacs, when I press C-c
C-c and select the BibTeX command, emacs runs bibtex test instead of biber
test. I am then greeted with errors about no \citation \bibdata or
\bibstyle commands. My bibtex-dialect variable is automatically getting
set to biblatex, LaTeX-biblatex-use-Biber is set to t, TeX-command-Biber
is set to Biber, but for some reason TeX-command-BibTex variable is still
set to BibTeX. Should this automatically get changed to Biber? Do I have
to set it using a local variable? Is this a bug, or am I doing something
wrong?
EDIT
According to this page in the AUCTeX 11.87 manual:
In case you use biblatex in a document, AUCTeX switches from BibTeX to
Biber for bibliography processing.
So I feel like this automatic switch should already be happening.
I was reading the question titled Customizing emacs to use biblatex-biber
instead of bibtex. In that question, user @PLK mentions that as of auctex
11.87, auctex should automatically check if you are using biblatex and if
so, switch to using biber. I have auctex 11.87 installed and running, but
I am not getting this automatic switching behavior.
Say I have two files (borrowed from this question).
test.tex
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{test.bib}
\defbibheading{bibliography}{}
\begin{document}
\nocite{*}
\subsection*{Journal Publications:}
\printbibliography[type=article]
\subsection*{Conference Publications:}
\printbibliography[type=inproceedings]
\end{document}
and test.bib
@ARTICLE{abc,
author = {A Author},
title = {the article title},
journal = {the journal},
year = {2012},
volume = {1},
pages = {1--2},
number = {1},
month = {1},
doi = {1234/5678}
}
@INPROCEEDINGS{def,
author = {A Author},
title = {the proceeding title},
journal = {the conference},
year = {2012},
volume = {1},
pages = {11--12},
number = {1},
month = {1},
doi = {5678/1234}
}
If I run the following commands:
pdflatex test.tex
biber test
pdflatex test.tex
I end up with a properly processed document. In emacs, when I press C-c
C-c and select the BibTeX command, emacs runs bibtex test instead of biber
test. I am then greeted with errors about no \citation \bibdata or
\bibstyle commands. My bibtex-dialect variable is automatically getting
set to biblatex, LaTeX-biblatex-use-Biber is set to t, TeX-command-Biber
is set to Biber, but for some reason TeX-command-BibTex variable is still
set to BibTeX. Should this automatically get changed to Biber? Do I have
to set it using a local variable? Is this a bug, or am I doing something
wrong?
EDIT
According to this page in the AUCTeX 11.87 manual:
In case you use biblatex in a document, AUCTeX switches from BibTeX to
Biber for bibliography processing.
So I feel like this automatic switch should already be happening.
nppiFilter breaks output image
nppiFilter breaks output image
I wrote an example of BoxFilter using NPP, but the output image looks
broken. This is my code:
#include <stdio.h>
#include <string.h>
#include <ImagesCPU.h>
#include <ImagesNPP.h>
#include <Exceptions.h>
#include <npp.h>
#include "utils.h"
void boxfilter1_transform( Npp8u *data, int width, int height ){
size_t size = width * height * 4;
// declare a host image object for an 8-bit RGBA image
npp::ImageCPU_8u_C4 oHostSrc(width, height);
//printf("Pitch: %d\n", oHostSrc.pitch());
Npp8u *nDstData = oHostSrc.data();
memcpy(nDstData, data, size * sizeof(Npp8u));
//printf("Size: %d\n", oHostSrc.data());
// declare a device image and copy construct from the host image,
// i.e. upload host to device
npp::ImageNPP_8u_C4 oDeviceSrc(oHostSrc);
// create struct with box-filter mask size
NppiSize oMaskSize = {3, 3};
// Allocate memory for pKernel
Npp32s hostKernel[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
Npp32s *pKernel;
checkCudaErrors( cudaMalloc((void**)&pKernel, oMaskSize.width *
oMaskSize.height * sizeof(Npp32s)) );
checkCudaErrors( cudaMemcpy(pKernel, hostKernel, oMaskSize.width *
oMaskSize.height * sizeof(Npp32s),
cudaMemcpyHostToDevice) );
Npp32s nDivisor = 9;
// create struct with ROI size given the current mask
NppiSize oSizeROI = {oDeviceSrc.width() - oMaskSize.width + 1,
oDeviceSrc.height() - oMaskSize.height + 1};
// allocate device image of appropriatedly reduced size
npp::ImageNPP_8u_C4 oDeviceDst(oSizeROI.width, oSizeROI.height);
// set anchor point inside the mask
NppiPoint oAnchor = {2, 2};
// run box filter
NppStatus eStatusNPP;
eStatusNPP = nppiFilter_8u_C4R(oDeviceSrc.data(), oDeviceSrc.pitch(),
oDeviceDst.data(), oDeviceDst.pitch(),
oSizeROI, pKernel, oMaskSize, oAnchor,
nDivisor);
//printf("NppiFilter error status %d\n", eStatusNPP);
NPP_DEBUG_ASSERT(NPP_NO_ERROR == eStatusNPP);
// declare a host image for the result
npp::ImageCPU_8u_C4 oHostDst(oDeviceDst.size());
// and copy the device result data into it
oDeviceDst.copyTo(oHostDst.data(), oHostDst.pitch());
memcpy(data, oHostDst.data(), size * sizeof(Npp8u));
return;
}
Most part of code was copied from example boxFilterNPP.cpp. And the output
image: http://img153.imageshack.us/img153/7716/o8z.png
Why it can be?
I wrote an example of BoxFilter using NPP, but the output image looks
broken. This is my code:
#include <stdio.h>
#include <string.h>
#include <ImagesCPU.h>
#include <ImagesNPP.h>
#include <Exceptions.h>
#include <npp.h>
#include "utils.h"
void boxfilter1_transform( Npp8u *data, int width, int height ){
size_t size = width * height * 4;
// declare a host image object for an 8-bit RGBA image
npp::ImageCPU_8u_C4 oHostSrc(width, height);
//printf("Pitch: %d\n", oHostSrc.pitch());
Npp8u *nDstData = oHostSrc.data();
memcpy(nDstData, data, size * sizeof(Npp8u));
//printf("Size: %d\n", oHostSrc.data());
// declare a device image and copy construct from the host image,
// i.e. upload host to device
npp::ImageNPP_8u_C4 oDeviceSrc(oHostSrc);
// create struct with box-filter mask size
NppiSize oMaskSize = {3, 3};
// Allocate memory for pKernel
Npp32s hostKernel[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
Npp32s *pKernel;
checkCudaErrors( cudaMalloc((void**)&pKernel, oMaskSize.width *
oMaskSize.height * sizeof(Npp32s)) );
checkCudaErrors( cudaMemcpy(pKernel, hostKernel, oMaskSize.width *
oMaskSize.height * sizeof(Npp32s),
cudaMemcpyHostToDevice) );
Npp32s nDivisor = 9;
// create struct with ROI size given the current mask
NppiSize oSizeROI = {oDeviceSrc.width() - oMaskSize.width + 1,
oDeviceSrc.height() - oMaskSize.height + 1};
// allocate device image of appropriatedly reduced size
npp::ImageNPP_8u_C4 oDeviceDst(oSizeROI.width, oSizeROI.height);
// set anchor point inside the mask
NppiPoint oAnchor = {2, 2};
// run box filter
NppStatus eStatusNPP;
eStatusNPP = nppiFilter_8u_C4R(oDeviceSrc.data(), oDeviceSrc.pitch(),
oDeviceDst.data(), oDeviceDst.pitch(),
oSizeROI, pKernel, oMaskSize, oAnchor,
nDivisor);
//printf("NppiFilter error status %d\n", eStatusNPP);
NPP_DEBUG_ASSERT(NPP_NO_ERROR == eStatusNPP);
// declare a host image for the result
npp::ImageCPU_8u_C4 oHostDst(oDeviceDst.size());
// and copy the device result data into it
oDeviceDst.copyTo(oHostDst.data(), oHostDst.pitch());
memcpy(data, oHostDst.data(), size * sizeof(Npp8u));
return;
}
Most part of code was copied from example boxFilterNPP.cpp. And the output
image: http://img153.imageshack.us/img153/7716/o8z.png
Why it can be?
How to check whether a number is a "NaN" in java / android?
How to check whether a number is a "NaN" in java / android?
Please have a look at the following code
private List createTheDynamicWordList(String algorithm, double averageStat)
{
Toast.makeText(context, ""+averageStat, Toast.LENGTH_LONG).show();
}
in some cases, I get the averageStat as a 'NaN' value. I need to check
whether the number if 'NaN' ir not. How can I do this? Using
NumberFormatException here didn't work. Please help.
Please have a look at the following code
private List createTheDynamicWordList(String algorithm, double averageStat)
{
Toast.makeText(context, ""+averageStat, Toast.LENGTH_LONG).show();
}
in some cases, I get the averageStat as a 'NaN' value. I need to check
whether the number if 'NaN' ir not. How can I do this? Using
NumberFormatException here didn't work. Please help.
Monday, 19 August 2013
Scrapy dynamic file name based on timestamp for the logfile
Scrapy dynamic file name based on timestamp for the logfile
I am using scrapy and logging the results to a log file using the
LOG_FILE= in settings.py. However what I want is that each time I run the
spider it should log to a different filename based on the timestamp. Is it
possible to achieve this by doing some setting in settings.py?
I am using scrapy and logging the results to a log file using the
LOG_FILE= in settings.py. However what I want is that each time I run the
spider it should log to a different filename based on the timestamp. Is it
possible to achieve this by doing some setting in settings.py?
Wondering about Face Recognition methods
Wondering about Face Recognition methods
Is there any face recognition method that's better than OpenCV and gives
better results? I want to be able to use in C# if possible. Also if
possible please provide me with a place to start with. I don't want to
recognize only faces but also to train cascades for any other object.
Thanks a lot
Is there any face recognition method that's better than OpenCV and gives
better results? I want to be able to use in C# if possible. Also if
possible please provide me with a place to start with. I don't want to
recognize only faces but also to train cascades for any other object.
Thanks a lot
PHP Curl http code 100 and failing
PHP Curl http code 100 and failing
I'm trying to use a web service with php curl but I'm getting the http
code "100" and an "Recv failure: Connection was reset" error.. I tested
the web service with google chrome's extension "Postman -REST Client" and
it works perfectly. I searched this http code and it looks like the server
is expecting a body request data but I don't know what it's expecting me
to send since I'm not posting any data, just the headers.
My code looks like this:
error_reporting(-1);
$header = array('Content-Length: 1831', 'Content-Type:
application/json', 'Authorization: '. $authorization,
'Authorization-Admin: '. $authorization_admin);
$url =
'http://api.bookingreports.com/public/1/analytics/reports/departures';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$result = curl_exec($ch);
$errorCode = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $result;
echo curl_error($ch);
echo $errorCode;
echo $httpcode;
//log_message('debug', 'HTTP HEADER '. $errorCode);
curl_close($ch);
and the header I'm sending looks like this:
POST /public/1/analytics/reports/departures HTTP/1.1
Host: api.bookingreports.com
Accept: */*
Content-Length: 1831
Content-Type: application/json
Authorization: myauthcode
Authorization-Admin: myauthadmin
Expect: 100-continue
I'm trying to use a web service with php curl but I'm getting the http
code "100" and an "Recv failure: Connection was reset" error.. I tested
the web service with google chrome's extension "Postman -REST Client" and
it works perfectly. I searched this http code and it looks like the server
is expecting a body request data but I don't know what it's expecting me
to send since I'm not posting any data, just the headers.
My code looks like this:
error_reporting(-1);
$header = array('Content-Length: 1831', 'Content-Type:
application/json', 'Authorization: '. $authorization,
'Authorization-Admin: '. $authorization_admin);
$url =
'http://api.bookingreports.com/public/1/analytics/reports/departures';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$result = curl_exec($ch);
$errorCode = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $result;
echo curl_error($ch);
echo $errorCode;
echo $httpcode;
//log_message('debug', 'HTTP HEADER '. $errorCode);
curl_close($ch);
and the header I'm sending looks like this:
POST /public/1/analytics/reports/departures HTTP/1.1
Host: api.bookingreports.com
Accept: */*
Content-Length: 1831
Content-Type: application/json
Authorization: myauthcode
Authorization-Admin: myauthadmin
Expect: 100-continue
Transparent View over ImageView
Transparent View over ImageView
I'm blocked there. I'm trying to put a transparent View over a background.
I've tried several methods.
throught XML with:
android:background="@color/transparent"
or
android:color="#80000000"
or putting a reference to color.xml file as so
<resources>
<color name="transp">#80000000</color>
</resources>
with my layout.xml like this
android:background="@color/transp"
I've also tried to do it by generated code
myView.getBackground().setAlpha(45);
or
myViewm.setBackgroundResource(R.color.trans);
I've seen some posts related, but none of the answers worked.
Besides which is even stranger is that all of these solutions seems to
wrok fine on the GraphicalLayout in Eclipse. But when I launch my device,
the screen remains not transparent.I've drawn a line on that view to make
sure that something happens; and the line does show.
here is my layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/backgroundview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/space_bg"
android:contentDescription="@string/desc" />
<View
android:id="@+id/tileview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/><!--
android:background="@color/transp"/>-->
</RelativeLayout>
and my code
private ImageView bg;
MyView tV;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
tV = new MyView(this);
setContentView(tV);
}
and the myView onDraw
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
this.setBackgroundResource(R.color.transp);
canvas.drawLine(10,20,30,40, paint);
}
So, where am I wrong? Thanks!!!
I'm blocked there. I'm trying to put a transparent View over a background.
I've tried several methods.
throught XML with:
android:background="@color/transparent"
or
android:color="#80000000"
or putting a reference to color.xml file as so
<resources>
<color name="transp">#80000000</color>
</resources>
with my layout.xml like this
android:background="@color/transp"
I've also tried to do it by generated code
myView.getBackground().setAlpha(45);
or
myViewm.setBackgroundResource(R.color.trans);
I've seen some posts related, but none of the answers worked.
Besides which is even stranger is that all of these solutions seems to
wrok fine on the GraphicalLayout in Eclipse. But when I launch my device,
the screen remains not transparent.I've drawn a line on that view to make
sure that something happens; and the line does show.
here is my layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/backgroundview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/space_bg"
android:contentDescription="@string/desc" />
<View
android:id="@+id/tileview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/><!--
android:background="@color/transp"/>-->
</RelativeLayout>
and my code
private ImageView bg;
MyView tV;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
tV = new MyView(this);
setContentView(tV);
}
and the myView onDraw
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
this.setBackgroundResource(R.color.transp);
canvas.drawLine(10,20,30,40, paint);
}
So, where am I wrong? Thanks!!!
How to renew cell in uitableview in ios
How to renew cell in uitableview in ios
I'm a newbie. I use this code to create uitableview cell but when
reloadtable, image of these buttons is overload but all Labels is works
fine. I don't know why. How can i fix this error? Thanks much
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [_tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];
}
UILabel *pricelabel = [[UILabel alloc]
initWithFrame:CGRectMake(80, 0, 80, 30)];
pricelabel.backgroundColor = [UIColor clearColor];
pricelabel.font = [UIFont fontWithName:@"Helvetica" size:16];
pricelabel.font = [UIFont boldSystemFontOfSize:16];
pricelabel.textColor = [UIColor darkGrayColor];
pricelabel.tag = 3000;
//pricelabel.hidden = YES;
pricelabel.textAlignment = NSTextAlignmentRight;
[cell.contentView addSubview: pricelabel];
[pricelabel release];
UIButton * market = [[UIButton alloc] init];
market= [UIButton buttonWithType:UIButtonTypeCustom];
if([sellingArray count]>0)
{
NSLog(@"sellingArray %@",sellingArray);
if([[sellingArray objectAtIndex:indexPath.row]
isEqualToString:@"0"]) // nothing
{
[market clearsContextBeforeDrawing];
[market setSelected:NO];
[market setImage:[UIImage imageNamed:@"Marketplace.png"]
forState:UIControlStateNormal];
market.enabled = YES;
}
}
[market addTarget:self action:@selector(marketPressedAction:)
forControlEvents:UIControlEventTouchDown];
[market setTag:indexPath.row];
[market setFrame:CGRectMake(200, 6, 30, 30)];
[cell.contentView addSubview:market];
return cell;
}
I'm a newbie. I use this code to create uitableview cell but when
reloadtable, image of these buttons is overload but all Labels is works
fine. I don't know why. How can i fix this error? Thanks much
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [_tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];
}
UILabel *pricelabel = [[UILabel alloc]
initWithFrame:CGRectMake(80, 0, 80, 30)];
pricelabel.backgroundColor = [UIColor clearColor];
pricelabel.font = [UIFont fontWithName:@"Helvetica" size:16];
pricelabel.font = [UIFont boldSystemFontOfSize:16];
pricelabel.textColor = [UIColor darkGrayColor];
pricelabel.tag = 3000;
//pricelabel.hidden = YES;
pricelabel.textAlignment = NSTextAlignmentRight;
[cell.contentView addSubview: pricelabel];
[pricelabel release];
UIButton * market = [[UIButton alloc] init];
market= [UIButton buttonWithType:UIButtonTypeCustom];
if([sellingArray count]>0)
{
NSLog(@"sellingArray %@",sellingArray);
if([[sellingArray objectAtIndex:indexPath.row]
isEqualToString:@"0"]) // nothing
{
[market clearsContextBeforeDrawing];
[market setSelected:NO];
[market setImage:[UIImage imageNamed:@"Marketplace.png"]
forState:UIControlStateNormal];
market.enabled = YES;
}
}
[market addTarget:self action:@selector(marketPressedAction:)
forControlEvents:UIControlEventTouchDown];
[market setTag:indexPath.row];
[market setFrame:CGRectMake(200, 6, 30, 30)];
[cell.contentView addSubview:market];
return cell;
}
Sunday, 18 August 2013
Intercepting "call to undefined method" error?
Intercepting "call to undefined method" error?
I'm learning my way into some more advanced programming with PHP.
I've seen that calling an non-existent method produces "call to undefined
method" error.
PHP being quite flexible is there a technique that allows to intercept
this error ? If so, how is this usually done ?
I'm learning my way into some more advanced programming with PHP.
I've seen that calling an non-existent method produces "call to undefined
method" error.
PHP being quite flexible is there a technique that allows to intercept
this error ? If so, how is this usually done ?
ARM Cortex Architecture
ARM Cortex Architecture
I have multiple questions to ask about the ARMv7-A architecture for
Cortex-A9 CPU.
1) How wide the instruction bus is?
2) How many instructions are fetched in parallel?
3) Are L1, L2 cache and main memory buses all the same width?
Thanks in advance.
I have multiple questions to ask about the ARMv7-A architecture for
Cortex-A9 CPU.
1) How wide the instruction bus is?
2) How many instructions are fetched in parallel?
3) Are L1, L2 cache and main memory buses all the same width?
Thanks in advance.
Update BitmapImage every second flickers
Update BitmapImage every second flickers
I am trying to update an image by setting the source property every
second, this works however causes a flicker when updated.
CurrentAlbumArt = new BitmapImage();
CurrentAlbumArt.BeginInit();
CurrentAlbumArt.UriSource = new Uri((currentDevice as AUDIO).AlbumArt);
CurrentAlbumArt.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
CurrentAlbumArt.EndInit();
If I don't set IgnoreImageCache, the image does not update thus no
flickering either.
Is there a way around this caveat?
Cheers.
I am trying to update an image by setting the source property every
second, this works however causes a flicker when updated.
CurrentAlbumArt = new BitmapImage();
CurrentAlbumArt.BeginInit();
CurrentAlbumArt.UriSource = new Uri((currentDevice as AUDIO).AlbumArt);
CurrentAlbumArt.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
CurrentAlbumArt.EndInit();
If I don't set IgnoreImageCache, the image does not update thus no
flickering either.
Is there a way around this caveat?
Cheers.
what is the word for "contributing honestly sincerely for betterment"?
what is the word for "contributing honestly sincerely for betterment"?
Can anybody please suggest a word for "contributing honestly sincerely for
betterment" ?
Can anybody please suggest a word for "contributing honestly sincerely for
betterment" ?
How do I select the last child of element with specific class name in CSS=?iso-8859-1?Q?=3F?=
How do I select the "last child" of element with specific class name in CSS?
So I have a nice HTML table and I want the last row excluding row with
class .table-bottom, and remove its border-bottom:
<table cellpadding="0" cellspacing="0" style="width:752px;" class="table">
<tr class="table-top"><th style="width:40px;">ID</th> <th>Post title</th>
<th>Date</th> <th>Owner</th> <th style="width:100px;">Actions</th></tr>
<tr class="table-middle"><td>1</td> <td>Test</td> <td>16.7.2013</td>
<td>Admin</td> <td>Delete</td></tr>
<tr class="table-middle"><td>2</td> <td>Test 2</td> <td>3.8.2013</td>
<td>Admin</td> <td>Delete</td></tr>
<tr class="table-bottom"><td colspan="5"></td></tr>
.table tr th {
color:#929191;
font-weight:bold;
font-size:14px;
text-align:left;
padding-left:19px;
border-right:1px solid #d7d7d7;
border-bottom:1px solid #d7d7d7;
}
.table tr th:last-child {
border-right:none;
}
.table tr td {
color:#929191;
font-weight:bold;
font-size:12px;
padding:19px;
border-right:1px solid #d7d7d7;
border-bottom:1px solid #d7d7d7;
}
.table tr td:last-child {
border-right:none;
}
.table .table-middle:last-of-type td {
border-bottom:none;
background:red;
}
.table tr.table-middle td:first-child {
text-align:center;
}
.table tr th:first-child {
text-align:center;
padding-left:0px;
}
.table tr.table-bottom td {
border-right:none;
border-bottom:none;
}
But it's not working....You can see here: http://jsfiddle.net/VAqSw/ ,
.table .table-middle:last-of-type td is not working... please can you help
me solve this? Thanks!
So I have a nice HTML table and I want the last row excluding row with
class .table-bottom, and remove its border-bottom:
<table cellpadding="0" cellspacing="0" style="width:752px;" class="table">
<tr class="table-top"><th style="width:40px;">ID</th> <th>Post title</th>
<th>Date</th> <th>Owner</th> <th style="width:100px;">Actions</th></tr>
<tr class="table-middle"><td>1</td> <td>Test</td> <td>16.7.2013</td>
<td>Admin</td> <td>Delete</td></tr>
<tr class="table-middle"><td>2</td> <td>Test 2</td> <td>3.8.2013</td>
<td>Admin</td> <td>Delete</td></tr>
<tr class="table-bottom"><td colspan="5"></td></tr>
.table tr th {
color:#929191;
font-weight:bold;
font-size:14px;
text-align:left;
padding-left:19px;
border-right:1px solid #d7d7d7;
border-bottom:1px solid #d7d7d7;
}
.table tr th:last-child {
border-right:none;
}
.table tr td {
color:#929191;
font-weight:bold;
font-size:12px;
padding:19px;
border-right:1px solid #d7d7d7;
border-bottom:1px solid #d7d7d7;
}
.table tr td:last-child {
border-right:none;
}
.table .table-middle:last-of-type td {
border-bottom:none;
background:red;
}
.table tr.table-middle td:first-child {
text-align:center;
}
.table tr th:first-child {
text-align:center;
padding-left:0px;
}
.table tr.table-bottom td {
border-right:none;
border-bottom:none;
}
But it's not working....You can see here: http://jsfiddle.net/VAqSw/ ,
.table .table-middle:last-of-type td is not working... please can you help
me solve this? Thanks!
Does an ipv6 anycast address generated
Does an ipv6 anycast address generated
I read from the rfc that anycast addresses are derived from unicast
addresses, but unicast addresses' interface identifiers(IID) is of EUI-64
format, which is generated by link layer address, so we can indicate a
link layer address from a unicast address.
So, how are anycast addresses' IIDs generated. It doesn't comply to the
EUI-64 format any more, any one can answer my question?
Thanks.
I read from the rfc that anycast addresses are derived from unicast
addresses, but unicast addresses' interface identifiers(IID) is of EUI-64
format, which is generated by link layer address, so we can indicate a
link layer address from a unicast address.
So, how are anycast addresses' IIDs generated. It doesn't comply to the
EUI-64 format any more, any one can answer my question?
Thanks.
Saturday, 17 August 2013
HOW TO RUN NEW FQL QUERY IN PHP
HOW TO RUN NEW FQL QUERY IN PHP
according to https://developers.facebook.com/docs/technical-guides/fql/ we
sholud use sign "+" but it doesnt work with my query, please help me, this
my source :
// run fql query
$fql_query_url = 'https://graph.facebook.com/'
.
'fql?q=SELECT+message+FROM+status+WHERE+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1
= me()) '
. '&access_token=' . $access_token;
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
// display results of fql query
echo '<pre>';
print_r("query results:");
print_r($fql_query_obj);
echo '</pre>';
according to https://developers.facebook.com/docs/technical-guides/fql/ we
sholud use sign "+" but it doesnt work with my query, please help me, this
my source :
// run fql query
$fql_query_url = 'https://graph.facebook.com/'
.
'fql?q=SELECT+message+FROM+status+WHERE+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1
= me()) '
. '&access_token=' . $access_token;
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
// display results of fql query
echo '<pre>';
print_r("query results:");
print_r($fql_query_obj);
echo '</pre>';
Return in a function while in loop
Return in a function while in loop
I have a function, which checks a query, and then uses a while loop to
extract data, I would like to return this data but I still want it to
increment, but I read that return terminates a function, and thus would
make it unable to increment. Is there a way around this? $this->messages =
array(); while($row = $data) { $this->messages[$i]['id'] = $row['id'];
$this->messages[$i]['title'] = $row['title'];
$this->messages[$i]['message'] = $row['message']; $i++;
This loop is inside the function, I want to continue until the loop is
done, but then I can't return any values.. is there a work around this?
Thank you
I have a function, which checks a query, and then uses a while loop to
extract data, I would like to return this data but I still want it to
increment, but I read that return terminates a function, and thus would
make it unable to increment. Is there a way around this? $this->messages =
array(); while($row = $data) { $this->messages[$i]['id'] = $row['id'];
$this->messages[$i]['title'] = $row['title'];
$this->messages[$i]['message'] = $row['message']; $i++;
This loop is inside the function, I want to continue until the loop is
done, but then I can't return any values.. is there a work around this?
Thank you
Prevent UiNavigationBar Title from getting Cut off?
Prevent UiNavigationBar Title from getting Cut off?
I am trying to customize the appearance of the navigationBar title in my
ios application. This is the code I currently have:
NSMutableDictionary *navigationTitleAttributes = [NSMutableDictionary
dictionary];
[navigationTitleAttributes setValue:[UIColor whiteColor]
forKey:UITextAttributeTextColor];
[navigationTitleAttributes setValue:[UIColor clearColor]
forKey:UITextAttributeTextShadowColor];
[navigationTitleAttributes setValue:[NSValue
valueWithUIOffset:UIOffsetMake(0.0, 0.0)]
forKey:UITextAttributeTextShadowOffset];
[navigationTitleAttributes setValue:[UIFont fontWithName:@"Calibri"
size:30] forKey:UITextAttributeFont];
[[UINavigationBar appearance]
setTitleTextAttributes:navigationTitleAttributes];
[[UINavigationBar appearance] setTitleVerticalPositionAdjustment:-8
forBarMetrics:UIBarMetricsDefault];
The code yields the following effect:
It works great but my title gets cut off from the bottom.
I've seen solutions to this problem that use a custom UIView (such as this
one: UINavigationbar title is cut off when using titleTextAttributes).
However, that particular solution requires that the titleView property of
the navigation bar be updated for each screen.
I was wondering if there was a simple solution that would cascade through
my entire application.
Thanks
I am trying to customize the appearance of the navigationBar title in my
ios application. This is the code I currently have:
NSMutableDictionary *navigationTitleAttributes = [NSMutableDictionary
dictionary];
[navigationTitleAttributes setValue:[UIColor whiteColor]
forKey:UITextAttributeTextColor];
[navigationTitleAttributes setValue:[UIColor clearColor]
forKey:UITextAttributeTextShadowColor];
[navigationTitleAttributes setValue:[NSValue
valueWithUIOffset:UIOffsetMake(0.0, 0.0)]
forKey:UITextAttributeTextShadowOffset];
[navigationTitleAttributes setValue:[UIFont fontWithName:@"Calibri"
size:30] forKey:UITextAttributeFont];
[[UINavigationBar appearance]
setTitleTextAttributes:navigationTitleAttributes];
[[UINavigationBar appearance] setTitleVerticalPositionAdjustment:-8
forBarMetrics:UIBarMetricsDefault];
The code yields the following effect:
It works great but my title gets cut off from the bottom.
I've seen solutions to this problem that use a custom UIView (such as this
one: UINavigationbar title is cut off when using titleTextAttributes).
However, that particular solution requires that the titleView property of
the navigation bar be updated for each screen.
I was wondering if there was a simple solution that would cascade through
my entire application.
Thanks
UINavigationController in UITableViewCell
UINavigationController in UITableViewCell
I created a custom UITabelViewCell with property:
@property (nonatomic, strong) UINavigationController *navigationController;
Synthetized:
@syntethized navigationController = _navigationController
"Contructor":
+ (CustomCell *)cellForTableView:(UITableView *)tableView
navigationController:(UINavigationController *)navigationController {
CustomCell *cell = (CustomCell *)[tableView
dequeueReusableCellWithIdentifier:kCustomCellIdentifier];
if(cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle]
loadNibNamed:@"AddressCell" owner:self options:nil];
for (id currentObject in topLevelObjects)
if ([currentObject isKindOfClass:[UITableViewCell class]]) {
cell = (CustomCell *) currentObject;
break;
}
}
cell.navigationController = navigationController;
return cell;
}
With method:
- (IBAction)viewMapAction:(id)sender {
MyViewController *controller = [[MyViewController alloc]
initWithNibName:@"MyViewController" bundle:nil];
[_navigationController pushViewController:controller animated:YES];
}
When I press the button inside my CustomCell, the navigation controller
push MyViewController normally. inside of MyViewController has a MKMapView
with an annotation, and in the viewDidAppar of MyViewController [_mapView
selectAnnotation:myAnnotation] has called, but a callout (popup) don't be
showed. If i press on annotation, callout don't be showed also.
Why?????
If change the constructor/property of my CustomCell and pass a
target/selector instead of UINavigationController, and create a
viewMapAction inside my UITableViewController instead of in my CustomCell,
the map callout appears normally. But I would centralized all cell action
inside cell class...
I created a custom UITabelViewCell with property:
@property (nonatomic, strong) UINavigationController *navigationController;
Synthetized:
@syntethized navigationController = _navigationController
"Contructor":
+ (CustomCell *)cellForTableView:(UITableView *)tableView
navigationController:(UINavigationController *)navigationController {
CustomCell *cell = (CustomCell *)[tableView
dequeueReusableCellWithIdentifier:kCustomCellIdentifier];
if(cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle]
loadNibNamed:@"AddressCell" owner:self options:nil];
for (id currentObject in topLevelObjects)
if ([currentObject isKindOfClass:[UITableViewCell class]]) {
cell = (CustomCell *) currentObject;
break;
}
}
cell.navigationController = navigationController;
return cell;
}
With method:
- (IBAction)viewMapAction:(id)sender {
MyViewController *controller = [[MyViewController alloc]
initWithNibName:@"MyViewController" bundle:nil];
[_navigationController pushViewController:controller animated:YES];
}
When I press the button inside my CustomCell, the navigation controller
push MyViewController normally. inside of MyViewController has a MKMapView
with an annotation, and in the viewDidAppar of MyViewController [_mapView
selectAnnotation:myAnnotation] has called, but a callout (popup) don't be
showed. If i press on annotation, callout don't be showed also.
Why?????
If change the constructor/property of my CustomCell and pass a
target/selector instead of UINavigationController, and create a
viewMapAction inside my UITableViewController instead of in my CustomCell,
the map callout appears normally. But I would centralized all cell action
inside cell class...
Javascript & Jquery defining a global variable?
Javascript & Jquery defining a global variable?
I am trying to define a global jquery object variable so that I can access
it from different functions.
This is what I am doing:
var object_list = $("#object__list");
var list_length = object_list.find("li").length;
$(document).on('keydown', '#object_list', function(event) {
//both of these don't work
alert(object_list);
alert(list_length);
});
Well,, for some reason this is not working (the first alert gives me NULL
and the second gives me 0, which is not).
Why aren't my global variables working..??
Thanks!!
I am trying to define a global jquery object variable so that I can access
it from different functions.
This is what I am doing:
var object_list = $("#object__list");
var list_length = object_list.find("li").length;
$(document).on('keydown', '#object_list', function(event) {
//both of these don't work
alert(object_list);
alert(list_length);
});
Well,, for some reason this is not working (the first alert gives me NULL
and the second gives me 0, which is not).
Why aren't my global variables working..??
Thanks!!
how to submit many data files once using ajax in Extjs
how to submit many data files once using ajax in Extjs
Now, I have a task. import many excel files once in batch mode. firstly,
the number of files is about some hundreds. I can't submit in one ajax
request. They are too large.
So, I try to submit many ajax request in turn in one function(in
CodeIgniter).
then, I hope to track them.
waitmsg is good, but every ajax request has itself waitmsg. I hope just one.
like a normal progress bar, first file ,second file ... the x hundredth file.
Can you help me?
Thanks a lot.
Now, I have a task. import many excel files once in batch mode. firstly,
the number of files is about some hundreds. I can't submit in one ajax
request. They are too large.
So, I try to submit many ajax request in turn in one function(in
CodeIgniter).
then, I hope to track them.
waitmsg is good, but every ajax request has itself waitmsg. I hope just one.
like a normal progress bar, first file ,second file ... the x hundredth file.
Can you help me?
Thanks a lot.
Two contradictory errors about Type mismatch in Java?
Two contradictory errors about Type mismatch in Java?
What on earth could be causing this? I'm getting two contradicting errors
on one method I'm trying to create in a java program
public void numberOfTrianglesIncidentToVertex(){
for(String pairs: neighbors.get(2)){ // Type mismatch: cannot
convert from element type Integer to List<Integer>
}
int fail = neighbors.get(2); // Type mismatch: cannot convert
from List<Integer> to int
}
The neighbors variable is declared in a super class as follows:
List<List<Integer>> neighbors
= new ArrayList<List<Integer>>();
I don't know why it would tell me on one line that its an Integer and
can't be converted to a List of integers and then on the very next line
just change its mind and say the exact opposite. which is it?
What on earth could be causing this? I'm getting two contradicting errors
on one method I'm trying to create in a java program
public void numberOfTrianglesIncidentToVertex(){
for(String pairs: neighbors.get(2)){ // Type mismatch: cannot
convert from element type Integer to List<Integer>
}
int fail = neighbors.get(2); // Type mismatch: cannot convert
from List<Integer> to int
}
The neighbors variable is declared in a super class as follows:
List<List<Integer>> neighbors
= new ArrayList<List<Integer>>();
I don't know why it would tell me on one line that its an Integer and
can't be converted to a List of integers and then on the very next line
just change its mind and say the exact opposite. which is it?
Thursday, 8 August 2013
How to combine Google Apps Script with JavaScript?
How to combine Google Apps Script with JavaScript?
I want to use HTML to create form, use JavaScript to interact with users,
and use Google Apps Script to create workflow. But I don't know who to
combine Google Apps Script with JavaScript?
Thanks!
I want to use HTML to create form, use JavaScript to interact with users,
and use Google Apps Script to create workflow. But I don't know who to
combine Google Apps Script with JavaScript?
Thanks!
Why does autovacuum: VACUUM ANALYZE (to prevent wraparound) run?
Why does autovacuum: VACUUM ANALYZE (to prevent wraparound) run?
I have an autovacuum VACUUM ANALYZE query running on a table, and it
always takes many hours, even a couple of days to finish. I know Postgres
runs autovacuum jobs occasionally to perform cleanup and maintenance
tasks, and it's necessary. However, most tables simply have an VACUUM, not
a VACUUM ANALYZE.
Why does this specific table require a vacuum analyze, and how can I
resolve the issue of it taking so long?
On a separate note, I did not notice this vacuum analyze query running
before a few days ago. This is when I was attempting to create an index,
and it failed prematurely saying it ran out of open files (or something
like that). Could this contribute to the vacuum analyze running for so
long?
I have an autovacuum VACUUM ANALYZE query running on a table, and it
always takes many hours, even a couple of days to finish. I know Postgres
runs autovacuum jobs occasionally to perform cleanup and maintenance
tasks, and it's necessary. However, most tables simply have an VACUUM, not
a VACUUM ANALYZE.
Why does this specific table require a vacuum analyze, and how can I
resolve the issue of it taking so long?
On a separate note, I did not notice this vacuum analyze query running
before a few days ago. This is when I was attempting to create an index,
and it failed prematurely saying it ran out of open files (or something
like that). Could this contribute to the vacuum analyze running for so
long?
How to make "Previous Page" go to the permalink of the previous post on Tumblr?
How to make "Previous Page" go to the permalink of the previous post on
Tumblr?
On Tumblr, I'm trying to set up a webcomic format for my theme.
I have it set so that you see 1 post per page. When you hit the front
page, you should see the most recent post and then the "Previous Post"
button. I want this button to link to the permalink of the previous post,
not the next page of the blog.
I know that within a post, you can navigate to the previous/next posts
with this block:
{block:PermalinkPagination}
{block:NextPost}<a href="{NextPost}">Next</a>{/block:NextPost}
{block:PreviousPost}<a
href="{PreviousPost}">Previous</a>{/block:PreviousPost}
{/block:PermalinkPagination}<p>
Is there any way to get this to work on the front page?
Tumblr?
On Tumblr, I'm trying to set up a webcomic format for my theme.
I have it set so that you see 1 post per page. When you hit the front
page, you should see the most recent post and then the "Previous Post"
button. I want this button to link to the permalink of the previous post,
not the next page of the blog.
I know that within a post, you can navigate to the previous/next posts
with this block:
{block:PermalinkPagination}
{block:NextPost}<a href="{NextPost}">Next</a>{/block:NextPost}
{block:PreviousPost}<a
href="{PreviousPost}">Previous</a>{/block:PreviousPost}
{/block:PermalinkPagination}<p>
Is there any way to get this to work on the front page?
Google Maps Api v2 key does not work properly
Google Maps Api v2 key does not work properly
So everything works fine with the key that i generate for me. i wanted to
export the apk and did as follows:
generate sha-1
get google apikey1, include in manifest(if i run the app from eclipse
directly to my phone, the map works)
generate keystore1 in debug mode & apk1
generate another sha-1 using keystore1
use last sha-1 to get apikey2 (include apikey2 in manifest)
generate keystore2 in debug mode and apk2 which i can use to install on
any phone and it should work.
but it doesnt work on my phone. What am i doing wrong?
So everything works fine with the key that i generate for me. i wanted to
export the apk and did as follows:
generate sha-1
get google apikey1, include in manifest(if i run the app from eclipse
directly to my phone, the map works)
generate keystore1 in debug mode & apk1
generate another sha-1 using keystore1
use last sha-1 to get apikey2 (include apikey2 in manifest)
generate keystore2 in debug mode and apk2 which i can use to install on
any phone and it should work.
but it doesnt work on my phone. What am i doing wrong?
How can I link to revision history on Google Docs?
How can I link to revision history on Google Docs?
When I load revision history in Google Docs, it does not change the URL.
Is it possible to link to a history entry in Google Docs?
When I load revision history in Google Docs, it does not change the URL.
Is it possible to link to a history entry in Google Docs?
Apache - Redirect external traffic to a particular page - internal links can access page
Apache - Redirect external traffic to a particular page - internal links
can access page
I'm new to appache so please forgive me if this has been answered before -
I searched...
I have a page: gateway.html
I only want links from within my domain, example.com, and traffic from one
other domain, otherdomain.com, to be able to access the page.
All other external traffic I would like to redirect to a different page on
my domain: about.html
I've googled the heck out of mod_rewrite and http_host but I haven't seen
this specific question addressed.
I assume it's a combination of RewriteCond and RewriteRule
To sum up:
Only links from within my domain and one other domain should be able to
access gateway.html. All other links & manually entered URLs trying to get
that page should be redirected to a 'about.html' and if they still need to
access gateway.html they can from there.
Reasoning: Preventing 'back door' access to a chat service that costs $$$.
Users should go through self-help steps before accessing chat.
Thanks!I'm new to appache so please forgive me if this has been answered
before - I searched...
I have a page: gateway.html
I only want links from within my domain, example.com, and traffic from one
other domain, otherdomain.com, to be able to access the page.
All other external traffic I would like to redirect to a different page on
my domain: about.html
I've googled the heck out of mod_rewrite and http_host but I haven't seen
this specific question addressed.
I assume it's a combination of RewriteCond and RewriteRule
To sum up:
Only links from within my domain and one other domain should be able to
access gateway.html. All other links & manually entered URLs trying to get
that page should be redirected to a 'about.html' and if they still need to
access gateway.html they can from there.
Reasoning: Preventing 'back door' access to a chat service that costs $$$.
Users should go through self-help steps before accessing chat.
Thanks!
can access page
I'm new to appache so please forgive me if this has been answered before -
I searched...
I have a page: gateway.html
I only want links from within my domain, example.com, and traffic from one
other domain, otherdomain.com, to be able to access the page.
All other external traffic I would like to redirect to a different page on
my domain: about.html
I've googled the heck out of mod_rewrite and http_host but I haven't seen
this specific question addressed.
I assume it's a combination of RewriteCond and RewriteRule
To sum up:
Only links from within my domain and one other domain should be able to
access gateway.html. All other links & manually entered URLs trying to get
that page should be redirected to a 'about.html' and if they still need to
access gateway.html they can from there.
Reasoning: Preventing 'back door' access to a chat service that costs $$$.
Users should go through self-help steps before accessing chat.
Thanks!I'm new to appache so please forgive me if this has been answered
before - I searched...
I have a page: gateway.html
I only want links from within my domain, example.com, and traffic from one
other domain, otherdomain.com, to be able to access the page.
All other external traffic I would like to redirect to a different page on
my domain: about.html
I've googled the heck out of mod_rewrite and http_host but I haven't seen
this specific question addressed.
I assume it's a combination of RewriteCond and RewriteRule
To sum up:
Only links from within my domain and one other domain should be able to
access gateway.html. All other links & manually entered URLs trying to get
that page should be redirected to a 'about.html' and if they still need to
access gateway.html they can from there.
Reasoning: Preventing 'back door' access to a chat service that costs $$$.
Users should go through self-help steps before accessing chat.
Thanks!
How can I get version of release before updating application?
How can I get version of release before updating application?
I am beginner in android programming, so please help me to find out in
some questions and sorry for my English. I develop application on eclipse
for android. And I want to develop module of load update file from
website. I know how can I get update file, load and launch it from
programm code (example of code you can see by this link Android: install
.apk programmatically). But before I want to get version of release of
update file. And I don't know how I can do it. May be somebody developed
the same module and can give me advise.
I am beginner in android programming, so please help me to find out in
some questions and sorry for my English. I develop application on eclipse
for android. And I want to develop module of load update file from
website. I know how can I get update file, load and launch it from
programm code (example of code you can see by this link Android: install
.apk programmatically). But before I want to get version of release of
update file. And I don't know how I can do it. May be somebody developed
the same module and can give me advise.
Subscribe to:
Comments (Atom)