Thursday, 3 October 2013

What is the syntax to call parameterized ms-access function from java script?

What is the syntax to call parameterized ms-access function from java script?

I have a function called "test" in module of ms-access. I call this
respective function from javascript. Below is the sample code :
var App = new ActiveXObject("Access.Application")
var fullPath = "Path of accdb file";
App.OpenCurrentDatabase(fullPath);
App.Visible = false;
var sub = App.Run("test"); // i am calling test procedure,
which is public in module and dont require any input
parameter.
This works fine.
Now, I made changes to function test. Function test has a string as input
parameter(ie Public Function test(String as a) As Integer). How to make
call to test function from java script?

Wednesday, 2 October 2013

Trimming and Removing text from string?

Trimming and Removing text from string?

I want to trim a string and remove all the words that occur after a
certain word.
For example - If the string contains 'very' text
string mySentence=" Today is very nice day! ";
if (mysentence.Contains(very))
{
//remove everything that starts with 'very' until rest of the line..
}
result should be:
Today is

Grails get child domain objects

Grails get child domain objects

I have two domain classes one is parent and other one is child and i have
a hasMany relationship between them. Parent class has many childs and
child class belongs to parent class. And here is coding example.
class Parent{
String name
static hasMany = [childs:Child]
static constraints = {
}
}
class Child{
String name
static belongsTo = [parent:Parent]
static constraints={}
}
Problem is as soon as I get the parent object the child objects associated
with parent class were also fetched. But when I convert the object to JSON
I don't see the child object completely I can only able to see the ID's of
child objects. I want to see all columns of child object instead of only
Id.
Converted JSON response:
[{"class":"project.Parent","id":1,"name":"name1","childs":[{"class":"Child","id":1},{"class":"Review","id":2}]}]
But I want the response which contains name of child object too, as follows
[{"class":"project.Parent","id":1,"name":"name1","childs":[{"class":"Child","id":1,"name":"childname1"},{"class":"Review","id":2,"name":"childname2"}]}]
Any help greatly appreciated. Thanks in advance.

Adding a variable to an array

Adding a variable to an array

I'm having trouble writing this instance method.. I'm trying to write the
method so that the method will check if there is space for another
competitor. And if there is, another competitor will be added in the next
available slot.
public boolean addCompetitor(Competitor competitor) {
// TODO
for(int i=0;i<competitors.length; i++){
if(numberOfCompetitors < MAX_COMPETITORS){
numberOfCompetitors++;
return true;
}
}
return false;
}
I've done a loop to see if I can just add the variable to the array if the
conditions met true.

Tuesday, 1 October 2013

Fetching PNR status from PNR no. using json

Fetching PNR status from PNR no. using json

I am android beginner and trying to fetch pnr status using json here is my
code which is not working please help me . Also tell me which parsing
method is goo xml parse or json parse. When you asking questions, using
some more words to describe your problem will always help. If there are
really nothing more to say, just copy some random paragraph from internet,
but make sure you mark them as dummy text so that people won't pay
attention on them.
public class JSON extends Activity {
String completeData="";
TextView tv;
EditText et;
Button bt;
HttpClient client;
JSONObject jsonobj;
final static String URI="http://pnrapi.alagu.net/api/v1.0/pnr/";
String pnr_no=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_json);
tv=(TextView) findViewById(R.id.textView1);
et=(EditText) findViewById(R.id.editText1);
bt=(Button) findViewById(R.id.button1);
client=new DefaultHttpClient();
}
public void showpnr(View v){
pnr_no=et.getText().toString();
if(pnr_no.equals("")){
Toast.makeText(this, "Enter the Valid Pnr",
Toast.LENGTH_LONG).show();
return;
}
GetPNR pnr=new GetPNR();
pnr.execute("train-name");
completeData="";
}
public JSONArray pnr(String username){
JSONArray jarray=null;
try
{
StringBuilder builder=new StringBuilder(URI);
builder.append(username);
HttpGet get=new HttpGet(builder.toString());
HttpResponse response=client.execute(get);
int status =response.getStatusLine().getStatusCode();
if(status==200){
HttpEntity entity=response.getEntity();
String data=EntityUtils.toString(entity);
jarray=new JSONArray(data);
}
else{
Toast.makeText(this, "Error", Toast.LENGTH_LONG).show();
}
}catch(ClientProtocolException e){
e.printStackTrace();
}
catch(IOException e){
e.printStackTrace();
}
catch(JSONException e){
e.printStackTrace();
}
catch(Exception e){
e.printStackTrace();
}
return jarray;
}
JSONObject js_pnr=new JSONObject();
public class GetPNR extends AsyncTask<String, Integer, ArrayList<String>>
{
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
tv.setText("Loading Pnr status");
super.onPreExecute();
}
@Override
protected ArrayList<String> doInBackground(String... params) {
// TODO Auto-generated method stub
ArrayList<String> al_texts=new ArrayList<String>();
try{
JSONArray data =pnr(pnr_no);
if(data==null){
return null;
}
int count=data.length();
JSONObject jobj=new JSONObject();
for(int i=0;i<count;i++){
jobj=data.getJSONObject(i);
al_texts.add(jobj.getString("train-name").toString());
}
return al_texts;
}catch(JSONException e){
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(ArrayList<String> al_pnrText) {
if(al_pnrText==null){
tv.setText("Pnr not found");
return;
}
for(String string:al_pnrText){
completeData+=string+System.getProperty("line.seperator")
+System.getProperty("line.seperator");
}
tv.setText("pnr
status:"+System.getProperty("line.seperator")+completeData);
}
}
}

Can I manually scope variables to a region of code?

Can I manually scope variables to a region of code?

In C++ I would do this:
{
int var = 1;
int var2 = 2;
// etc...
// do something with var...
}
// the variables are now out of scope
As I understand the Matlab equivalent would be
var = 1;
var2 = 2;
% etc...
% do something with var
clear var var2 etc...;
% the variables are now out of scope (well, they're deleted)
I am fond of the C++ version because it means I don't have to remember
which variables I have to delete, and it conveniently allows me to create
blocks of code that can be easily visualised (the code in the brackets
looks like one unit of code).
Does something like this exist in Matlab?

Find out rendered view in backbone

Find out rendered view in backbone

Is there any way I can find out the rendered view in backbone? I have 4
views Login, Contact, Home and About I would like to find out which view
currently is rendered.

Ubuntu Server 2 NIC's one for LAN and one for Internet one router

Ubuntu Server 2 NIC's one for LAN and one for Internet one router

I have done a bit of research but i can find anything for my specific
situation.
this is my network infrastructure

The Ubuntu server has a 6TB LVM that serves media + a newsgroup indexer
I want to have one NIC on the server used for internet use and one for
serving LAN
I want to limit the Internet using wondershaper so it doesn't max it out
for the other 10+ devices on the network.
the other will be open so that serving media isn't hamstrung when I try
and limit one of the interfaces.
EDIT: I have now changed it so that eth1 connects to the router directly
and Eth0 remains to be connected to the switch
my routing table is as follows.
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0

If the 'delete' key deletes=?iso-8859-1?Q?=2C_what_key_inserts=3F_=96_ux.stackexchange.com?=

If the 'delete' key deletes, what key inserts? – ux.stackexchange.com

I have an application with a standard data grid in which each row
represents an object. Our current application uses F6 and F7 for add and
delete, respectively. I'd like to keep these around for our …

Monday, 30 September 2013

Skype 4.2 Ubuntu 13.04

Skype 4.2 Ubuntu 13.04

http://www.skype.com/en/download-skype/skype-for-computer/
WTF!!! I have tried all of them and none work. I always get the "I836
wrong architecture" or a terminal message saying I screwed up! I don't get
what is going on! I have tried all desperately. I have Ubuntu 13.04 64
bit. Dual booting with Windows 8

likewise remote users authentication failure

likewise remote users authentication failure

I have been trying to add my ubuntu box to the windows AD domain. On that
box, I see the the domain users when i do
lw-enum-users
And if I am already logged into my local user, i can 'su' to a domain user
and that works. However, when I switch user, I have to do
'sudo su domain\user'
which gives
su: Authentication failure (Ignored)
and continues to switch me to that user. If I just do a normal su, it
gives me Authentication Failure
What I can't do, is
ssh 'domain\user'@host
to get into the ubuntu server
When I do, I get the following
Sep 30 15:20:02 ubuntu-trac sshd[1420]: error: PAM: Authentication failure
for domain\user from 10.22.1.220

Designer code in Windows phone 7

Designer code in Windows phone 7

I created a UI using XAML, in windows phone 7. I want to know if this code
exists as C# code in some file and if it is so, where is the designer
code, generated by the xaml?

How can i calculate flight fares for a web application?

How can i calculate flight fares for a web application?

I am developing a web applicaiton for airline? I have already embeded a
database of all the cities of the world. Mow I am supposed to create a
fare estimation. Any idea how can i do that?

Sunday, 29 September 2013

Apple Bluetooth GPS Protocol

Apple Bluetooth GPS Protocol

Does anyone know where to find reference information on the Apple-specific
protocol for external GPS receives that communicate over Bluetooth?
They're using the proprietary vendor extensions to NMEA-0183 as far as I
can tell, but I would love to get actual specifications.
For example, a Dual XGPS150 will dump out messages such as the following:
0000 50 52 4d 43 2c 30 35 30 36 33 37 2e 30 30 2c 56 PRMC,050637.00,V
0010 2c 2c 2c 2c 2c 2c 2c 32 39 30 39 31 33 2c 2c 2c ,,,,,,,290913,,,
0020 4e 2a 37 41 0d 0a N*7A..
0000 50 56 54 47 2c 2c 2c 2c 2c 2c 2c 2c 2c 4e 2a 33 PVTG,,,,,,,,,N*3
0010 30 0d 0a 0..

fill random area with color

fill random area with color

I need to fill any random area with color. I have several points with some
coordinates(number of points > 2). (I should get points by mouse clicking
-> random points). So to test filling with color I use some random points
glBegin(GL_POLYGON);
glVertex2f(200.0 / WIDTH, 300.0 / HEIGHT);
glVertex2f(300.0 / WIDTH, 100.0 / HEIGHT);
glVertex2f(500.0 / WIDTH, 400.0 / HEIGHT);
glVertex2f(400.0 / WIDTH, 200.0 / HEIGHT);
glEnd();
But the result does not look like it supposed to be
I know that points should be in some specific order - but how to apply it
to random points?

how to implement automatic updating for offline embedded .net 3.5 application

how to implement automatic updating for offline embedded .net 3.5 application

I have an application in .net 3.5 that runs on embedded motorola device.
The device works offline. For updating data and install
software\applications, we connect the device to a specific computer vie
usb cable . The computer has a connection to network but one cant download
files (any kind of files) to it. I want the application to be updated once
the user connect the device to the computer. How can I do it? Can click
once be helpful for me? I need to know if click once can be a solution and
if so, how to use it?
Thanks a lot

Round Half Down in VB.Net

Round Half Down in VB.Net

can anyone give me some help on how to round half down in Visual Basic? I
need 0.555 to be converted to 0.55 and NOT 0.56.
Thanks

Saturday, 28 September 2013

Optimal performance of Dictionary with custom Equals() and GetHashCode()

Optimal performance of Dictionary with custom Equals() and GetHashCode()

So I need to create a dictionary with keys that are objects with a custom
Equals() function. I discovered I need to override GetHashCode() too. I
heard that for optimal performance you should have hash codes that don't
collide, but that seems counter intuitive. I might be misunderstanding it,
but it seems the entire point of using hash codes is to group items into
buckets and if the hash codes never collide each bucket will only have 1
item which seems to defeat the purpose.
So should I intentionally make my hash codes collide occasionally?
Performance is important. This will be a dictionary that will probably
grow to multiple million items and I'll be doing lookups very often.

How to insert an array to array in php

How to insert an array to array in php

please help me in this thanks : i have an array like this
Array (
[full_name] => Hitesh Ranaut
[title] => Staff Author
[articles] => Array (
[0] => Array ( [title1] => title 1 value )
[1] => Array ( [title2] => title 2 value )
[2] => Array ( [title3] => title 3 value )
[3] => Array ( [title4] => title 4 value )
[4] => Array ( [title5] => title 5 value )
)
)
now what i want is to insert array such that
Array (
[full_name] => anil kumar
[title] => Staff Author
[articles] => Array (
[0] => Array ( [title1] => title 1 value )
[1] => Array ( [title2] => title 2 value )
[2] => Array ( [title3] => title 3 value )
[3] => Array ( [title4] => title 4 value )
[4] => Array ( [title5] => title 5 value )
[5] => Array ( [title6] => title 6 value )
)
)
actully i am taking this data from user . and this data is comming by
json_decode function but i need to push data into articles

Subsequence of $\sin n$

Subsequence of $\sin n$

Find one subsequence of $a_n= \sin n$ and prove it.
I know that for all $n_1<n_2<n_3<\dots$, then $a_{n_1},a_{n_2},...$ is the
sub-sequence of $a_n$. But I don't know how to use this definition in this
problem