Wednesday, May 23, 2012

iPhone Sencha Touch: In which JS / HTML file I need to start my application?

I have started implementing my application using phone gap and Sencha Touch.



I have added sencha touch sdk to my application using kitchen sink application.



When I execute the app it displays a list of user interfaces, etc on left side and a home page for sencha touch kitchen sink app on right side.



When I select any rows they shows buttons, lists, pickers and different types of demos as shown in kitchensink demo.



But I need to create my own views rather than kitchen sink demo views.



Here i have bundle of .JS & HTML files in wich file i need to start my application,



How should i create a basic panel as initial step in which .JS file?





Architecture and Serialisation advice

I need a bit of a architecture help, I think what I've been doing may not necessarily be the best approach.



Things to note:




  • This is not an android specific question.

  • Android does however require that I need to serialise objects across 'screens'.



Consider the following:



I'm currently working on a game for android where a character class needs to be passed between different screens. In order to do this I need to serialise the objects. Taking into account that are different types of characters that will be needed I'd like to create a class that inherits for each of these. Where I have static characters I'd like to inherit from the Character class and set the defaults such as 'Name', and 'Description' within the constructor.



Current implementation:



I'm passing the serialised sub class objects around. ( Eg: UserCharacter with a base of Character ) Ideal situation would for me to be able to deserialise the object as it's base class however that doesn't seem to me work. The only working solution I have for this at the moment is by doing the following when trying to do serialise:



new XmlSerializer(typeof (Character, new [] { typeof(CharacterUser)}));


This allows me to pass in multiple sub types. This however is not feasible in the long term as it just means code duplication across my application as well as everytime a new character sub class is created I need to add at it any point I would need to deserialise. I'd rather have the code written and working where I leave it to do it's own thing. I'm sure you can understand that.



Another thing I've tried is to do is use IXmlSerializable on the character object and deal with the Reading and Writing independantly. I think that this however requires implementation of a list to work correctly? Currently my ReadXml never gets called. (Great idea, but it's not worked for me so far)



Anyone got any ideas I could try?



I think it's quite an open question, please let me know if I need to scope a little differently.





Simple script for tracking products sales , refunds etc

I need a script for tracking the product sales , refunds etc. ,& it should save the customers emails/pay pal address . This is for iPhone unlocking website , the customer hits on checkout button , purchase the product . Then after purchasing , the sale record must be saved with his pay pal email.



Please take a look on live website , I need something similar to this



http://tinyurl.com/coz8vg9



check the back end functionality of script here



http://tinyurl.com/dyq8a8k



username - nee
pass - testpass



It's a simple script , tracked all the orders in this website. I need to use the similar script or plugin in my word press website so if someone pointed me to word press script/ plugin , which can do same things then it will be useful., Or if someone just tell me the name of the script , which is used in above domain then it will be much useful, so I will purchase it .



Thanks





C# game development after XNA

I am a game developer who made games in .Net languages with XNA for the past four versions of it.



I am surveying the ecosystem of game engines, looking for something that supports coding in Visual Studio (I use F# heavily, believe it or not!) and I am having trouble finding something that is high quality, still alive, and high performance to replace XNA. Unity for example misses the mark because it only allows for scripting in MonoDevelop, while I want a more developer friendly experience.



So what is a good replacement for XNA?





TableView does not always resize the columns

I have a TableView with CONSTRAINED_RESIZE_POLICY column resize policy.
It works great when I resize the window manually, but when I maximize it or restore it from a maximized state, the columns do not adjust.



Is there a way to force a "refresh" on the TableView so columns resize in these cases?





Repeater inside a Repeater

I have a Repeater inside a Repeater, how can a use the code below:



<input type="hidden" value='<%# Container.ItemIndex %>' />


pointing to the first repeater?





asp.net mvc3,c#

I want separate friends facebook and twitter.
Like this :



Twitter Facebook



EditorTemplates: FriendModel.cshtml



@model App.Web.Models.FriendModel
<div>
<input type="checkbox" name="saveInputs" value="@Model.FriendID"/>
<img alt="" src="@Model.ProfileImageUrl" />
<strong>@Model.Name</strong> Friends: <strong>@Model.FriendsCount</strong>
</div>
<br />


Views: FriendTeam.cshtml



@model App.Web.Models.FriendTeamModel
@{
ViewBag.Title = "FriendTeam";
}
<h2>
FriendTeam</h2>

@using (@Html.BeginForm())
{ @Html.ValidationSummary(true)
<h3>Twitter</h3>
<br />
@Html.EditorFor(model => model.Friends.Where(x=>x.SocialNetworkName=="Twitter"))

<h3>Facebook</h3>
<br />
@Html.EditorFor(model => model.Friends.Where(x=>x.SocialNetworkName=="Facebook"))
}
<div>
@Html.ActionLink("Back to List", "Index")




FriendTeamModel:



   public class FriendTeamModel
{
public long FriendTeam{ get; set; }
public IEnumerable<FriendModel> Friends { get; set; }
}


FriendModel:



public class FriendModel
{
public string FriendID { get; set; }
public string SocialNetworkName { get; set; }

public string Name { get; set; }
public int FriendsCount { get; set; }
public string ProfileImageUrl { get; set; }
}


error :
Models can only be used with expressions access field of homeownership, the index of one-dimensional array or custom indexer single parameter.



Thanks,





why in file server program socket write as "Socket s =null"?

here , i am creating file server program .in this i have noticed that socket s= null is written.i want to know actual reason why null is given.I thought that it is either related to the ObjectInputStream or Scanner.is it true it related to the ObjectInputStream or Scanner .Here the code for



Server.java 

public class Server{
public static void main(String[] args){
Socket s=null;
ServerSocket ss=null;
ObjectInputStream ois=null;
ObjectOutputStream oos=null;
Scanner sc=new Scanner(System.in);


try
{
ss = new ServerSocket(1234);
System.out.println("server is created");

}
catch(Exception e)
{
System.out.println(e.getMessage());
}



try {
s=ss.accept();
System.out.println("connected");
oos = new ObjectOutputStream(s.getOutputStream());
oos.writeObject("Welcome");
ois= new ObjectInputStream(s.getInputStream());
}catch(Exception e)
{
e.printStackTrace();
}
try{
String fil=(String)ois.readObject();
FileInputStream fis = new FileInputStream(fil);
int d;
String data="";
while(true)
{
d=fis.read();
if(d==-1)
break;
data = data+(char)d;
}
oos.writeObject(data);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}


can anyone explain actual reason? Thanks in advance .





line chart using jfreechart

I have created line chart using jfreeChart API inside jsp and servlet.



Following is the code in servlet



// Get the output stream from the response object:
OutputStream out = response.getOutputStream();

// Set the HTTP Response Type:
response.setContentType("image/png");

XYSeries series = new XYSeries("Average Weight1233");
series.add(1.48, 20.0);
series.add(1.52, 25.0);
series.add(2.02, 50.0);
series.add(2.05, 65.0);
series.add(3.30, 2);
series.add(3.52, 50);
XYDataset xyDataset = new XYSeriesCollection(series);

// Create chart:
JFreeChart chart
= ChartFactory.createXYLineChart("XYLine Chart using JFreeChart",
"Age", "Weight",xyDataset,
PlotOrientation.VERTICAL,
true, true, false);

// Write the data to the output stream:
ChartUtilities.writeChartAsPNG(out, chart, 400, 300);


It creates horizontal number automatically from values that I have added on XYSeries But I want to set that value manually.



Is it possible? How?





Which memory is used for external process run from java - java heap space or OS memory?

If I run the following line



final String[] command = new String[]{ffmpeg -y -i /home/user/video.mov -ss 0 -t 20 -vcodec libx264 -vpre slow -crf 18 -f flv -bf 0 -g 10 -vsync 1 -r 30 -an -threads 0 -s 1920x1080 /home/user/video0.flv};

final Process process = Runtime.getRuntime().exec(command, null, null);


It will start ffmpeg and convert first 20 seconds of a video.mov to video.flv. But sometimes with high resolution videos, OutOfMemory is thrown. Obviously ffmpeg takes too much memory.



My question is the following - are external processes started from java taking memory from java heap space or from OS memory?



Knowing this, I will know how to adjust -Xms and -Xmx parameters. If external processes take from OS memory, I will leave -Xms and -Xmx with low values(leaving OS with more free memory). Otherwise, I will set -Xms and -Xmx to high values, giving the Java process more memory.





Where to write down the update infomation when submitting a update in app hub?

I just submitting a update version of my app in App Hub.



But what confused me a lot is that all the steps for updating is as same as when I submit a new app.



So I just don't know where to write down the update infomation.



I check the MSDN but found no answer with this, so,er,need help -_-





Struts2 - How to create a <s:form> for each row in <display:table>

I was trying to show a displaytag table and I wish to map each row on a different s:form.
Each row show all the attributes of my System object and I wish to choose one row and act on the related object.
I tryed to put multiple display:column in one form, but when I load the JSP, I don't find any form tag.



Any suggestion?



My code:



<display:table name="${systemList}" uid="row" pagesize="20" sort="list" requestURI="" >

<display:column title="System ID" property="systemID" sortable="true" />

... other columns ...

<s:form action="provision.action" method="post" name="provisionForm%{#attr.row.systemID}">

<display:column title="IP" >
<s:textfield name="systemList[%{#attr.row_rowNum - 1}].ip" />
</display:column>

<display:column>
<s:submit type="image" src='image.png' name='submit' />
</display:column>
</s:form>

</display:table>


Thanks in advance





How and why does the compiler replace extern functions with a null function?

Consider the following code in linux/drivers/usb/hid-core.c:



static void hid_process_event (struct hid_device *hid,
struct hid_field *field,
struct hid_usage *usage,
__s32 value)
{
hid_dump_input(usage, value);
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_hid_event(hid, field, usage, value);
#ifdef CONFIG_USB_HIDDEV
if (hid->claimed & HID_CLAIMED_HIDDEV)
hiddev_hid_event(hid, usage->hid, value);

slideToggle: Change the text a second time (open -> close -> open -> close...)

<div id="sidebar_archive_infoline_bottom"><a id="showallnews" href="#">SHOW ALL NEWS</a></div>     

<script>
$('#newsdiv').hide();
$('#showallnews').click(function () {
$('#newsdiv').slideToggle('fast');
$('#showallnews').text('CLOSE')
}); </script>


The text "SHOW ALL NEWS" changes to "CLOSE" after clicking the first time on it. Now I need a method to change it from "CLOSE" to "SHOW ALL NEWS" and so on...



Best regards!





call function before scrolling to the bottom of page

I know how to call a function when scrolling hits the bottom of the page.



$(window).scrollTop() == $(document).height() - $(window).height()


But I would like to do it a little bit before it hits the bottom. How would I accomplish this?





Using a checkbox outside of a datagrid to affect its contents

I am using a Checkbox outside of a datagrid. When i select the check box autopostback is true, and this would then show the image, but i cant access the images within the datagrid with that script. If i use a seperate image outside of the datagrid the script works. How can i get this script to work finding when the checkbox out side of the datagrid is checked to then show the image within the datagrid?



The script i am using is



<script runat="server">

Sub Check(sender As Object, e As EventArgs)
If checkShowImages.Checked Then
img.Visible = True

Else
img.Visible = False
End If
End Sub

</script>




Twitter API - Reply to a retweet

I am writing a little twitter API (using Elliot Haughin's library) and I want to reply to a retweet that the app posts.



I have read the docs for statues/update, and have tried using '*in_reply_to_status_id*' with the value taken from '*user_mentions*', but it doesn't seem to work.



What am I doing wrong, or is there a better way to do it?



Code sample;



$answer = '@'.$retweet->entities->user_mentions[0]->screen_name.' thanks!!';
$this->tweet->call('post', 'statuses/update', array('status' => $answer, 'in_reply_to_status_id' => $retweet->id));




Extended class running from super via same method (Java)

The title is pretty confusing I know but I could not think of another way of wording it.



So, what I am trying to achieve: I have seen some java programs have a load of subclasses that have a method in their super class, and they all run when the supers method is called.



I have tried multiple things and I've googled a lot but what I've found doesn't work for me.



Here is what I have: The SUPER class



public class Synchroniser 
{
public Synchroniser()
{
RunAll();
}

protected void RunAll()
{
System.out.println("RunAll");
}
}


The SUBCLASS:



import org.lwjgl.input.Keyboard;

public class ArrayList extends Synchroniser
{
public ArrayList()
{

}

public static void Keybind(Info info)
{
info.Toggle();
}

@Override
protected void RunAll()
{
System.out.println("Ran ArrayList");
}
}




Remove partial string in Shell Script

How can I remove price from following data in Shell Script? I am printing labels and don't want to show price.



Input:



Order: 12
Name: Raj K
ABC Inc
123 Main St
Edison NJ

1 Printer - $50.09
Router - $30.00
2 AirPrint - $56.10


Output



Order: 12
Name: Raj K
ABC Inc
123 Main St
Edison NJ

1 Printer
Router
2 AirPrint


Any ideas?





how Deploy asp.net application on windows azure..?

I have created a media player in asp.net and now I want to deploy this application on windows azure. Which role can I use to deploy this application? Also, can anyone tell me the procedure for this?





More than one type in @Category annotation

The GWT AutoBean page says:




The @Category annotation may specify more than one category type.




The following syntax gives Syntax error on token ",", / expected :



@Category(FooCategory.class, BarCategory.class)
public interface FooBarFactory extends AutoBeanFactory {
...
}


What is the syntax for specifying multiple category classes?





Sorting array of custom objects in JavaScript

Say I have an array of Employee Objects:



var Employee = function(fname, age) {
this.fname = fname;
this.age = age;
}

var employees = [
new Employee("Jack", "32"),
new Employee("Dave", "31"),
new Employee("Rick", "35"),
new Employee("Anna", "33")
];





At this point, employees.sort() means nothing, because the interpreter does not know how to sort these custom objects. So I pass in my custom sort function.



employees.sort(function(employee1, employee2){
return employee1.age > employee2.age;
});




Now employees.sort() works dandy.



But what if I also wanted to control what field to be sorted on, passing it in somehow during runtime? Can I do something like this?



employees.sort(function(employee1, employee2, on){
if(on === 'age') {
return employee1.age > employee2.age;
}
return employee1.fname > employee2.fname;
});


I can't get it to work, so suggestions? Design pattern based refactoring perhaps?





Calculating six dimensional integral in Fortran 90

I want to calculate a six dimensional integral with multivariable (six variables). I don't know how to do it in Fortran 90. I want to calculate the integral using the trapezoid rule. The function to integrate is six dimensional.



I attached the image file that is the formula I want to calculate. This is part of my code for calculating this integral.



Integral





zabbix reporting error string

Let's say a storage is monitored with zabbix through an agent. We want that when the storage fails for zabbix to email us with the error description, produced by some script. Is it possible for zabbix to get string output(ala nagios) and report it (not just string monitoring and report found/notfound) or does reporting only work with integers?





retrieveRequestToken(CommonsHttpOAuthConsumer,CALLBACK_URI) functions throws OAuthCommunicationException

I want to make an android app which will update status in twitter.
I am using signpost-core-1.2.1.1 and signpost-commonshttp4-1.2.1.1 jar files.I have given internet uses permission and i have registered app in twitter giving read,write and direct messages permission. Also filled up the callback Url.



code snippet:



private  static  final  String CALLBACK_URI = "app://twitter";
private static final String REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";
private static final String ACCESS_TOKEN_URL = "https://api.twitter.com/oauth/access_token";
private static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authorize";

String CONSUMER_KEY = "I4bwezijxf6VwpU8x0tygg";
String CONSUMER_SECRET = "Y6vSdZs3zWBrNogXZWSHKZ590RSXqB5wBwj8vFaayk";

private static CommonsHttpOAuthConsumer consumer;
private static CommonsHttpOAuthProvider provider;

consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
provider = new DefaultOAuthProvider(REQUEST_TOKEN_URL,ACCESS_TOKEN_URL, AUTHORIZE_URL);
String authUrl="";

authUrl = provider.retrieveRequestToken(consumer,CALLBACK_URI);


I am totally stuck with this.Please reply.