Skip to main content

Posts

Showing posts from February 28, 2012

Set url pattern to catch all urls like /messages?inbox or /list?orders

i am new to java and i have faced to very strange problem with url mapping... i have to write a url pattern to catch the urls like: XX/../list?inbox ../action?SomeAction .. - means anything. i need such a configuration in my web.xml file, somewhere near: <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.htm</url-pattern> <url-pattern>*.ajax</url-pattern> <url-pattern>*.do</url-pattern> </servlet-mapping>

Fields are cleared but just when I press F5

I don't know if it is a common problem, but this strange problem is giving me some headache... I'm having an strange behavior, my application has a lot of dialogs, and when user opens one, the dialog should show default content. The problem is that I clear all bean's properties before show the dialog, but sometimes it appears that the form isn't cleared!! For example, this is one of the dialogs that are having this problem: This image show how the dialog appears the first time I open it, all fields are cleared and the second radio is selected. If I change the radio selection and enter something in the input field, the datatable immediately shows the data accordingly with the search. So, if I click in "Cancelar" (cancel in portuguese), this dialog is closed, like expected. Then I open this dialog again and: The fields store the last edition user made. I thought I wasn't clearing the bean, but if I just press F5 (refresh) the dialog is shown like i

disable form action redirect when using curl to load a page

Could someone give me an idea on how not to redirect the page when using cUrl. I mean, i got this code: $url = "http://somesite.com/submit.php?name=" . $email . "&email=" . $email; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, false); $curl_output = curl_exec ($ch); curl_close ($ch); echo "Hello!"; What happens is that inside the submit.php there is a form that autosubmits using javascript. the submit.php does not continue since it will redirect to the form's action page. What curl options should I add on the code to make submit.php continue without the form action taking over the page and run the rest of the code of submit.php ? submit.php <?php $name = $_GET['name']; $email = $_GET['email']; ?> <form method="post" action="actionpage.php" name="myform"> .... </form> <script type="text/javascript" lan

Cache (static) content from other website on my own webserver

My website is loading slowly and I ran this test: http://www.webpagetest.org/result/120227_MD_3CQZM/1/performance_optimization/ Which indicates that files stored on gametrackers.com is not being cached. Apache and joomla already cache content that is on my server. I'm using a script from gametrackers.com to show my teamspeak 3 statistics on my website 1 However this script sometimes loads slowly duo to issues with gametrackers.com server and that's why I'd like to store a copy of it on my own webserver as cache and refresh it every 30 minutes from the gametrackers website. If the gametrackers website is down(which is quite common) it should keep the last successful cache check. How would I do this with apache 2.4.1 and possibly php? If its possible I'd also like to use css sprites because webpagetest.org indicates: The following images served from gametracker.com should be combined into as few images as possible using CSS sprites. http://cache.www.gametrack

PHP For Each Download File

I'm either using incorrect syntax or going about this with the wrong method. In the html document that references this php file, there is a simple list of checkboxes. The user checkmarks the boxes and hits submit. This then kicks off with the goal of prompting the user to run or save each file. If I checkmark test1.txt, test2.txt and test3.txt, there should be a popup for each (assuming of course the browser is IE). The issue is that only the 'last' checkmarked item is downloaded - the rest are not. I thought of opening a popup window for each file found but it has no effect. If I use echo $filename, it then correctly displays each entry I checkmarked so the php script appears to be given the multiple file names correctly. Can someone point me in the right direction? I'm pretty sure the $filename in the window.open parameter is not being used in the right syntax right now too. Here is the script: <?php foreach($_POST['files'] as $filename) { echo &quo

JAVA Exception in main thread java.lang.NoDefFounderror: net/&hellip;/AbstractClock

I have a clock program as AbstractClock.java in C:\Users\Neeraj\Prg folder . CLASSPATH is specified as C:\Users\Neeraj\Prg COMPILED javac AbstractClock.java with no errors. RUN AS java -cp . net.sf.fmj.ejmf.toolkit.media.AbstractClock Getting errors as Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/fmj/ejmf/toolkit/media/AbstractClock Caused by: java.lang.ClassNotFoundException: net/sf/fmj/ejmf/toolkit/media/AbstractClock at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:315) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: com.hib.TranslateSQL. Program will exit. PRO

RichFaces Column: Saving value of attribute on a row for comparisons

Hello I'm developing a Web Application using RichFaces 3. I have a rich:dataTable with individual rich:column . One of these columns has a Date value and there is this requirement where if the date is the same on consecutive rows the value has to be shown only on the first row, subsequent rows with same value will show nothing. So I need to save the date value for comparison on subsequent rows. Does anybody know how to do this with richFaces?

How do I add logging.properties to the classpath of an Eclipse project?

I'm using Eclipse 3.7.1 and my code isn't seeing my logging.properties file. (I thought it would see it automatically because it is in the standard place within the JRE but that is apparently wrong). I've been told I need to add this file to the root of the classpath but I'm not sure how to do that. Eclipse gives me ways to add jars, libraries, variables and other things to the classpath but I don't know how to add a properties file. Can anyone clue me in? You'd think it would be easier to add a simple text file than to add a jar but I don't see any options for text files or property files so I'm not sure how to proceed.

Challenges starting jboss v7.1.0 - thunder

My goal is to migrate my application which is running on jboss v4 to jboss v7.1, my application is completely based on EJB2.0 and so as starting point, I wanted to install jboss v7.1 and get it up and running. I have downloaded tar.gz file and i have untared it using 7-zip tool, now when i try to run standalone.bat script, I get below mentioned log message: From errors, it is evident that C:\Users\ados\Softwares\jboss-as-7.1.0.Final\standalone\configuration\mgmt-users.properties and C:\Users\ados\Softwares\jboss-as-7.1.0.Final\standalone\configuration\application-users.properties files are missing. I have checked in the standalone folder and yes, i do not have those file, my question is: Are those files present in the distribution, also when i tried to download zip file, i was not successful in getting data and ended up with error message as compressed file does not contain any data. Also if i try to untar file via cygwin then it ends up with below mentioned error: gzip: stdin

Android - calculating and storing the answer of an arithmetic expression

What would be best way to get the answer to this question which is using random numbers and random operators. editTextEquation.setText(random1 +(String.valueOf(ops[i1]) + random2 + (String.valueOf(ops[i2])+ random3 + (String.valueOf(ops[i3])+ random4)))); I'm displaying this question and then will check the answer against user input. I'm guessing I'd need to store the answer first. Any help/advice will be very much appreciated. Here is how I am generating the expression: int random1 = (int)(Math.random()*100); int random2 = (int)(Math.random()*100); int random3 = (int)(Math.random()*200); int random4 = (int)(Math.random()*20); int min = 0; int max = 3; Random r = new Random(); int i1 = r.nextInt(max - min); int i2 = r.nextInt(max - min); int i3 = r.nextInt(max - min); char[] ops = { '+', '-', '/', '*' }; int answer;

How do i write objects that i have no control over in jaxb?

I am trying to find a way to marshall classes that i have no access to. I am trying to achieve something like this: @XmlRootElement(name="bar") class Bar { @XmlAttribute private Foo foo; @XmlAttribute private String baz; } which should result in a xml file like this: <bar baz="stuff" foo="otherstuff"/> Is this possible? I tried to fiddle with @XmlJavaTypeAdapter with no sucess.

Dynamic binding == late binding in Java or not?

In different sources i've read different things on the topic. For example Wikipedia says: Late binding is often confused with dynamic dispatch, but there are significant differences. But a couple lines later it is popular to use the term late binding in Java programming as a synonym for dynamic dispatch. Specifically, this refers to Java's single dispatch mechanism used with virtual methods. So where's the truth and what are this "significant differences"?

Convert String to Long

Is it possible to convert a String to long without using java's built in function? For instance: String s = "35"; long ans = Long.parseLong(s); How can you carry out the same task without using java's Long.parseLong function

Array lists and string splitting(Java) [closed]

I am trying to read a text file, and read its contends. Easy enough, right? But the files contents read: Part1:Part2 Part1:Part2 I am trying to add the string(s) to a to an array list, with the following protocol: Add "Part1" to an arraylist called p1, then add "Part2" to an arraylist called p2. I need to go through the whole text file with multiple lines. How would I do so?

Technology for e-commerce website? [closed]

I am student of Computer engineering. I want to develop e-commerce website(online shopping website). I have good knowledge of JAVA but I dont have any experience in web development. Which language or technology should i choose or which is best for e-commerce site? Also any advice or things i should consider or keep in mind before starting development of e-commerce website.

ResultSet How to get strin from object when data is null?

In my Oracle table there are columns with different type. I want to read all columns as number. String str = resultSet.getString("col1"); The problem is that if column in database is defined as number, and value is 0.5 The returned string will be .5 I can not use any other getter like getDecimal and etc. if I use: String str = resultSet.getObject("col1").toString(); I'll get an exception if the value is null.

Create a stuck thread (Weblogic)(J2SE)(1.5)

I need to test WLST script that checks for stuck threads across some managed instances on a weblogic deployment. Unfortunately when I need to test, I am unable to get my stuck thread problem to rear its head. How can I intentionally create a stuck thread to test my script's detection with? My thoughts presently have been to sleep a thread for more than my stuck thread limit on Weblogic's settings, but that is also longer than the timeout for webpages. So my request should timeout before the thread ever becomes stuck. Apache commons executor is another idea... Does anyone have an elegant solution to reproducing this ugly issue?

Java - How to resize components in GroupLayout

., Hello, I have a problem with GroupLayout . My code is: public chat () { JTextField chatbox; JTextField msgbox; JButton sendbutton; GroupLayout layout; super(); chatbox = new JTextField(); msgbox = new JTextField(); sendbutton = new JButton("Send"); layout = new GroupLayout(this); sendbutton.setPreferredSize(new Dimension(60, 20)); setBackground(new Color(255, 255, 255)); setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(chatbox) .addGroup(layout.createSequentialGroup() .addComponent(msgbox) .addComponent(sendbutton)) ); layout.linkSize(SwingConstants.HORIZONTAL, sendbutton); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(chatbox)

GravityManager.getGravity() returns null

I'm trying to implement Gravity from GraniteDS. I did everything like in example from GraniteDS website, but when I'm trying to get gravity from servlet context, GravityManager.getGravity returns null. Here is the code: Gravity gravity = GravityManager.getGravity(contextManager.getServletContext()); What can be the reason of this error?

"Encode&rdquo; integers from an array via a given scheme to characters

Since I'm rather new to Java, I am not familiar with all the ways of handling this type of an assignment. I studied C and C# throughout my high school but I just started Java few days ago. The task goes like this: Write a program that reads 10 single-digit integers and displays a string consisting of 10 characters using the coding scheme: Digit Corresponding Character 0-a 1-b 2-c … … 9-j For example, if input consists of the 10 digits 1 8 6 1 0 3 1 8 5 5, the application responds with "bigbadbiff." Since I moved from C and C# at first I had trouble allowing user to input the integers of the array, but I got that figured out. And this is what I got so far. import java.util.*; public class UnsualCoding { public static void main (String[] args) { Scanner util = new Scanner(System.in); int[] x = new int[5]; int counter = 0; for(int i = 0; i < x.length && util.hasNextInt(); i++) { x[i] = util.nextIn

Why this null pointer exception when using BufferStrategy with swing timer in Java?

Why might I be getting the following exception with the below code? Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at java.awt.Component$BltBufferStrategy.showSubRegion(Unknown Source) at java.awt.Component$BltSubRegionBufferStrategy.show(Unknown Source) at javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(Unknown Source) ... It only happens about every other time I run it but always right at the start. I'm using if(bs.contentLost()){...} so I don't understand why it would be having problems. import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import java.util.Random; public class MLM2 extends JFrame implements ActionListener { private final Timer timer = new Timer(20, this); private Insets insets; private BufferStrategy bs; private BufferedImage drawing; int lastW; int lastH; int pos = 0; public static void main (String[] args) { MLM2 ex = new MLM2()

arraylist java compiling errors

ok i try to play with arraylist in java awhile to experiment some thing that related my project..so i come up with a simple code like this having 3 file...DataStruc.java , DataStrucHand.java , testcase1.java DataStruc.java public class DataStruc { private String testString; public DataStruc(String s){ this.testString = s; } public String getTestString() { return testString; } public void setTestString(String testString) { this.testString = testString; } public String toString(){ return String.format("%s",testString); } } DataStrucHand.java import java.util.ArrayList; public class DataStrucHand { private ArrayList<DataStruc> ds; public void addData(String ss){ ds.add(new DataStruc(ss)); } public ArrayList<DataStruc> getData(){ return ds; } } testcase1.java import java.util.*; public class testcase1 { public static void main(String args []){ DataStrucHand dsh = new DataStrucHand(); String gdata = "test"; dsh.add

Unable to execute dex: GC overhead limit exceeded

I have a problem. When I download from git project OsmAnd and want to compile him Eclipse returned me such erros: [2012-02-27 21:32:03 - Dex Loader] Unable to execute dex: GC overhead limit exceeded [2012-02-27 21:32:03 - OsmAnd] Conversion to Dalvik format failed: Unable to execute dex: GC overhead limit exceeded google and stackoverflow sad that i must change in eclipse.ini this Xms40m -Xmx384m Conversion to Dalvik format failed: Unable to execute dex: Java heap space I cleaned project and restart Eclipse, but never helps. I find this link ips for Android developer: “Conversion to Dalvik format failed: Unable to execute dex: null” But I do not know what .jar from my project input there. If anyone want help, I can send project to him. Please help me! :(

Socket communication between server and client using threads [closed]

I am busy with a project where the client Gui sends user and password details to a server where the details needs to be verified Sever side against the data in the database on the server. We are required to use Threads(from what I understand is that the Server needs to be able to handle multiple requests). Where I get stuck is when the server is started it is set so that is can listen to requests from clients. However the Server gets stuck listening to client requests until it received a request from the client. Furthermore on the client side if I send wrong username and password I struggle to re-submit the info for verification. This is the code that I have used. Would just like to know if I am on the right track? Firstly I start the server. private void butStartUpServerActionPerformed(java.awt.event.ActionEvent evt) { try { Class.forName(driverName); connection = DriverManager.getConnection(SourceURL);

Good video tutorials for learning Java Spring? [closed]

I am a complete newcomer to Web Development. I briefly went through JSP and Servlets. Now I am trying to learn Java Spring, but unfortunately, there aren't many good tutorials online. I saw the official Spring documentation, but it is not geared towards beginners. I didn't understand much of what I read. The only helpful online video tutorial so far was this one . It covers quite a bit of the basics, but not everything. I have tried searching for good tutorials, but unfortunately, I didn't find many useful ones. Do you have any recommendations? I am looking especially for video tutorials.

Java HttpConnection/HttpsConnection input/error stream

In java how do you know whether you have an error stream from a Http(s)connection or if it is an InputStream? The only way I can tell to do it is go for both, check for null and catch any exceptions. HttpConnection con = (HttpConnection)URL.openConnection(); //Write to output InputStream in = con.GetInputStream(); //Vs InputStream error = con.getErrorStream(); How does java determine which stream it has? Is it based solely on response code of the connetion? So if its >200 and >300 then its inputStream otherwhise its an errorStream? Thanks.

Change Activity layout

In my app i want to change the Activity contentview if a button was clicked for example. In the begining i call the first layou: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.catalog); } and when a button was pressed i call this one: public void showItemActivity(int position){ setContentView(R.layout.item_view); } and in this method my app crash. i need to say that if i try this method: setContentView(R.layout.item_view); in the begin of another Activity it work perfectly, but it reali important for me that it will be in the same Activity . Edit the logchat error msg: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

How to disable/enable button when the edit text is empty/nonempty

i have 2 edit text and 1 button, how can i make this button disable until the user fill all the edit text and i used this code but when i run this code it always disable the button even when i fill the 2 Edit text,also i do not know what the onTextChanged and beforeTextChanged doing !! please help me,i will appreciate it. public class TestActivity extends Activity { /** Called when the activity is first created. */ EditText edit1; EditText edit2; EditText edit3; Button button; String test1; @Override protected void onCreate(Bundle savedInstanceState) { // Your initialization code... // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); edit1= (EditText) findViewById(R.id.edit1); edit2= (EditText) findViewById(R.id.edit2); button=(Button) findViewById(R.id.button); TextWatcher watcher = new LocalTextWatcher(); edit1.addTextChangedListener(watcher); edit2.addTe

Jersey Client: Cache-Manager for Conditional GET?

Jersey has wonderful support for server-side handling of Preconditions to respond to a Conditional-GET-request. On the client-side it seems a bit less elegant/manual. As far as I know you'd need to store the metadata of the entity yourself (etag, last-modified header) and make a decision, when to set which headers, evaluate the response code, update your local cache of entity/metadata ... etc. Do you know of a ready, free implementation that wraps up the conditonal GET? I found this example , where the poster is using CacheManager and CacheEntry ; I suspect his own implementation. Shouldn't this be part of Jersey Client itself?

Invoking variable-arity methods with Java reflection?

I would like to understand what might be going on with invoking variable-arity methods using Java reflection. Let's say we have a simple method: void doAllTheThings(Object ... things) { // ...which does something with all the things... } And we want to invoke it dynamically, so we grab the method through reflection: Method doItAll = Superklass.getDeclaredMethod("doAllTheThings", Object[].class); And pass in an array: Object[] allTheThings = new Object[] { "abc", true, 15 }; doItAll.invoke(allTheThings); Now, this doesn't seem to work quite like my intuition had figured; in particular, I seem to be getting various shades of IllegalArgumentException when I try invoking a method with varargs like this. There's clearly something I'm missing here. My guess is this is related somehow to how the variables get marshalled into the varargs. I've found this four year old blog post which seems to be talking about the same issue , but am unable

Using RestAPI calls with MGTwitterEngine+Oauth

I am using MGTwitterEngine+Oauth for twitter integration in iPhone. I need to post status and status with media on twitter.When searching I came to know that it can be possible with REST API. https://dev.twitter.com/docs/api But I did not find any links which can help how to use this api after I get authenticated with twitter. So what I did I tried using Oauth but it requires manually entering the pin which is not accepted in my case. So what I did it. I fetch information from mgtwitter engine methods:- - (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *) username { NSLog(@"Inside authenticatedWithUsername"); NSLog(@"%@",[[_engine tokenOFAuth] key]); NSLog(@"%@",[[_engine tokenOFAuth] pin]); NSLog(@"%@",[[_engine tokenOFAuth] secret]); [_engine getUserInformationFor:username]; } tokenOFAuth is the instance of OAToken. - (void)userInfoReceived:(NSArray *)userInfo

Form Data Request using NSURLConnection in IOS

I want to make http form post using NSURLConnection in IOS.I have two form field and one file upload option in html form.When I am doing same thing using NSURLConnection I am not getting response. NSString *urlString = @"http://url/test.php"; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data"]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"file\"; filename=\"myphoto.png\"rn"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithString:@"Content-Type: application/octet-streamrnrn"] dataUsingEncoding:NSUTF8StringEncoding]];

moving view well by UIPanGestureRecognizer but sometimes goes jumpy

i am moving views by this code, it is moving well but sometimes they are very jumpy, any idea about this ? [[[(UITapGestureRecognizer*)sender view] layer] removeAllAnimations]; [self.view bringSubviewToFront:[(UIPanGestureRecognizer*)sender view]]; CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:self.view]; if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateBegan) { firstX = [[sender view] center].x; firstY = [[sender view] center].y; } translatedPoint = CGPointMake(firstX+translatedPoint.x, firstY+translatedPoint.y); [[sender view] setCenter:translatedPoint]; if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) { CGFloat finalX = translatedPoint.x + (.35*[(UIPanGestureRecognizer*)sender velocityInView:self.view].x); CGFloat finalY = translatedPoint.y + (.35*[(UIPanGestureRecognizer*)sender velocityInView:self.view].y); [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.3

UIBezierpath Shadow effect - iOs

Currently i am working on a paint app for iPhone and iPad.I am stuck with applying shadow effect to a paticular drawn path. I have use UIBezierpath to draw paths. Is there any way to apply shadow effect on UIBezierpath ? Thanks in Advance

Deserialize nested class using yamlbeans

I'm using yamlbeans to deserialize yaml files into Java objects. This works fine as long as I only have one class. The problem is when I want to nest a field, I am forced to specify the nested class in the yaml description. Single class example: Java: public class MessageField { public String name; public String type; public int length; public String comment; } yaml: name: field1 type: int length: 4 comment: first field --- name: field2 type: string length: 16 comment: second field --- Multiple classes (requires !com.mylib.VariableField in yaml file) Java: public class MessageField { public String name; public String type; public int length; public String comment; public List<VariableField> variableFields; } public class VariableField extends MessageField{ public int id; } yaml: name: field3 type: short length: 2 comment: variableFields: - !com.mylib.VariableField id: 1 name: nestedField 1 type: string le

JAVA: How can I download an HTML file from a site that requires cookies enabled?

I'm trying to download an HTML file from a site. I'm using the following simple method: URL url = new URL("here goes the link to the html file"); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String htmlfile = ""; String temp; while ((temp = br.readLine()) != null) { htmlfile+= temp; } The problem is that I get the following String in the htmlfile variable: The installation of ... requires the acceptance of a cookie by your browser software. The cookie is used to ensure that you and only you are able to access information .... In other words, I need to somewhat enable cookies when opening a stream from the url. Is it possible to achieve this by using URL or do I need a different method? Thanks in advance

How to detect particular UIImageView for UITouch Events

I've added 5 UIImageView dynamically and filled it with different images, what I am trying to do is "Allow user to set position for any UIImageView", for that I used -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Here I want the object of particular UIImageView on which user touched. } NSLog(@"%@",[touches anyObject]); //It returns output like below, /*<UITouch: 0x68b95e0> phase: Began tap count: 1 window: <UIWindow: 0x68875d0; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x68b6470>> view: <UIImageView: 0x6a74cf0; frame = (83.7763 83.7763; 182.447 182.447); transform = [0.968912, -0.247404, 0.247404, 0.968912, 0, 0]; alpha = 0.8; opaque = NO; tag = 3; layer = <CALayer: 0x6a74980>> location in window: {161, 230} previous location in window: {161, 230} location in view: {52.7761, 105.448} previous location in view: {52.7761, 105.448}*/ //Note, in above output, it showing my UIImageView object on which I touc

Is it possible to convert audio file with some music notes?

I have a music file with a particular tone(music.mp4). I want to convert existing sound file (speech.mp4) into the tone which is specified in music.mp4. Its like converting a speech into some particular tone. I do not want to play both files simultaneously. I want to convert source file with help of some music file. So, output file will be converted file. Is it possible? I searched for Audio Unit Hosting and Multimedia guide. But do not get any clue. Thanks in advance.

Launch a controller from within an active story board

I have a pretty basic app flow that is quite linear, so it fits in with the storyboard quite well. However there is one requirement that I am not sure on how to achieve. Structurally the app flow looks like this. Table View Controller (Master) Static Table View Controller (Detail, bound to a core data model) Launches a modal web view. (uses a delegate for callbacks) Now the requirement is that one of the options on the detail is to set the item as "default". Then if one were to suspend the app and go to the settings app and enable an "auto launch" option, then when resuming the app it should launch the modal web view directly, when dismissed the user is to be returned to the Table View Controller in #1. Initially I was going to terminate the app if the auto launch was enabled, however I have since read that this practice is frowned upon. So my confusion is, the user could be at any stage through the storyboard, then suspends the app, enables the

how to get the type of uicontrol event?

AS 3.0 code mc.addEventListener(MouseEvent.MOUSE_DOWN, eventHandler); mc.addEventListener(MouseEvent.MOUSE_UP, eventHandler); mc.addEventListener(MouseEvent.MOUSE_OVER, eventHandler); function eventHandler(e:MouseEvent):void { if(e.type == MouseEvent.MOUSE_DOWN) { //do stuff about mouseDownEvent } else if(e.type == MouseEvent.MOUSE_UP) { //do stuff about mouseUpEvent } else if(e.type == MouseEvent.MOUSE_OVER) { //do stuff about mouseOverEvent } } cocoa Code [myButton addTarget:self action:@selector(buttonEvent:withEvent:) forControlEvents:UIControlEventTouchDown]; [myButton addTarget:self action:@selector(buttonEvent:withEvent:) forControlEvents:UIControlEventTouchUpInside]; [myButton addTarget:self action:@selector(buttonEvent:withEvent:) forControlEvents:UIControlEventTouchUpOutside]; - (void)buttonEvent:(UIButton *)sender withEvent:(UIEvent *)event { // how to get a UIControlEvents Type? } I want getting the ty

add uiview at row selection

I want when tab on row a uiview containing two button appear at the center of the cell, so I did the following code - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //how can I get the text of the cell here? UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; UIView *v = [[UIView alloc] init]; v.center = cell.center; UIButton*button1 =[[UIButton alloc] init]; button1.frame = CGRectMake(v.center.x - 5 , v.center.y , 5 , v.center.y + 4 ); button1.titleLabel.text = @"I'm label 1"; [v addSubview: button1]; UIButton*button2 =[[UIButton alloc] init]; button2.frame = CGRectMake(v.center.x - + 1 , v.center.y , 5 , v.center.y + 4 ); button2.titleLabel.text = @"I'm label 2"; [v addSubview: button2]; [cell addSubview:v]; /* <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"&

inapp purchase verifyreceipt status = 21002

i was developing in app purchase app.i was created test account in my apple id. inapp purchase app is tested in device i was entered test account details in inapp purchase application.transactions are completed if i verify receipt in sandboxurl:https://sandbox.itunes.apple.com/verifyReceipt i got a error receipt like this format exception = "java.lang.NullPointerException"; status = 21002; please help me.

Capture image when scanning bar code

I'm using BarcodeScanner from phonegap-plugins, it is working fine, but i want to capture the image when it completes scanning and gives success result. I want that captured image which i'll show that this barcode is scanned. From this url i got BarcodeScanner plugin. Thanks in advance

xcode 4.2.1 - limiting character length in TextField

I have been trying to limit a textField by many codes available out there in the internet but with no luck. I have added UIViewController<UITextFieldDelegate> in my header file and textField.delegate = self; in my viewDidLoad and implemented the following fundtion in my .m file: - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string]; return !([newString length] > 5); } this stil does not limit my text field. any idea?

Core Data - how to generate CoreDataGeneratedAccessors?

I've gone through apple dev website, google and stack overflow to figure out the basics behind CoreDataGeneratedAccessors. I'm using Xcode 4.2 and core data. I created entities and their relationships properly including inverse. Following code is failing: self.remdetail = [NSEntityDescription insertNewObjectForEntityForName:@"RemDetail" inManagedObjectContext:context]; [rem addRemDetailObject:remdetail]; --> I'm trying to add rem detail to rem object because there are no accessor methods generated automatically, I put the following code manually in one of the NSManagedObject subclass. The following code was not generated when i created NSManagedObjects for my entities. I tried to generate accessors automatically by going through few articles and suggestions like Xcode copy & paste etc but nothing is generating the following code. in rem ManagedObject --> @interface Rem (CoreDataGeneratedAccessors) - (void)addRemDetailObject:(RemDetail *)va

My first web-based iPhone application - how to do it right?

I've built my first web-based iPhone app and I have some performance issues that I needs to be resolved. I want to verify that I'm doing it right, so your feedback is really appreciated... :-) The application presenting data - images & text directly from my remote MySQL DB using PHP based web-services. I'm using the SDWebImage for lazy-downloading. Now, I wonder if I'm doing everything right or is there something needs to be modified for better performance - Each connection to the DB is handling via NSMutableURLRequest using POST method. It's running again if I receive time-out connection from the DB and displaying an alert-view if connection fails. There is only one PHP web-service for every operation - I mean - if, for instance, I'm running the remote getInfo.php script for fetching information from my DB to be presented on info-view-controller, there is only one copy of this script on my web-site, so everyone's ru