Trying not to re-invent the wheel...
Howdy, all;
I'm sure that some of the tasks in my current project have been done by others. Are there any code repositories out there? I'm not above paying for useful code...
Specifically, I'm trying to convert a string such as "8+(2+2)" into the string "12". I'm using a streamTokenizer and iterating through, and then nesting when hitting parens. It's a lot of work and I'm just wondering if someone hasn't done all this before...
So, any repositories out there?
TIA
Thank you both! This has pointed me in the direction
of the resources I needed/wanted.
BTW, beanshell looked like more, much moree, than I wa
slooking for, I'm pursuing jbcParser instead.
Thanks againMore than you were looking for? The following code:import bsh.Interpreter;
public class BeanShellExample {
public static void main(String[] args) {
try {
Interpreter bsi = new Interpreter();
System.out.println(bsi.eval(args[0]));
catch (bsh.EvalError ee) {
System.out.println("Eval Error: " + ee.toString());
} produced the following output:
$ java -classpath ".;bsh-2.0b2.jar" BeanShellExample "8+(2+2)"
12I am not sure how much easier it could get!
Good Luck
Lee
Similar Messages
-
what does it take to find a simple ringtone to load onto my phone without re-inventing the wheel?
you could use a free ringtone app or
RINGTONE
This how to make ring tones for your iPhone:
Choose the desired song from you library
Do a secondary click on your song if you are using a MAC (right click for PC)
Click "Get Info"
Go to Options tab
Set Start Time and Stop Time, some iOS only allow for a 30 sec duration for ringtones, then click OK
Do secondary click (right click for PC) to your selected song
Click "Create AAC Version", new song from your selected will added to your library (short one)
Do secondary click (right click for PC) to your short one (new song)
Click "Show in Finder"
Rename file *.m4a to *.m4r, click "use *.m4r"
Drag the file to library, for the first time it would automatically add your library with new folder "Tones" under Apps folder
Open the ring tones in the Tones folder of your library than drag it to your iPhone and your ringtone also would be automatically added "Tones" folder.
Last but not least, set the ring tone in your iPhone under the "Setting-Sound"
For information on how to make ringtones read http://www.ehow.com/how_2160460_custom-iphone-ringtones-free.html
Or
http://www.demogeek.com/2009/07/31/how-to-add-custom-ringtones-to-your-iphone/ -
My computer will not start. Just the wheel spinning
My computer will not start. I get the apple with a spinning wheel.
What is happening?Take each of these steps that you haven't already tried. Stop when the problem is resolved.
Step 1
The first step in dealing with a boot failure is to secure your data. If you want to preserve the contents of the startup drive, and you don't already have at least one current backup, you must try to back up now, before you do anything else. It may or may not be possible. If you don't care about the data that has changed since your last backup, you can skip this step.
There are several ways to back up a Mac that is unable to boot. You need an external hard drive to hold the backup data.
a. Boot into the Recovery partition, or from a local Time Machine backup volume (option key at startup.) When the OS X Utilities screen appears, launch Disk Utility and follow the instructions in this support article, under “Instructions for backing up to an external hard disk via Disk Utility.”
b. If you have access to a working Mac, and both it and the non-working Mac have FireWire or Thunderbolt ports, boot the non-working Mac in target disk mode. Use the working Mac to copy the data to another drive. This technique won't work with USB, Ethernet, Wi-Fi, or Bluetooth.
c. If the internal drive of the non-working Mac is user-replaceable, remove it and mount it in an external enclosure or drive dock. Use another Mac to copy the data.
Step 2
Press and hold the power button until the power shuts off. Disconnect all wired peripherals except those needed to boot, and remove all aftermarket expansion cards. Use a different keyboard and/or mouse, if those devices are wired. If you can boot now, one of the devices you disconnected, or a combination of them, is causing the problem. Finding out which one is a process of elimination.
If you've booted from an external storage device, make sure that your internal boot volume is selected in the Startup Disk pane of System Preferences.
Step 3
Boot in safe mode. Note: If FileVault is enabled on some models, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Post for further instructions.
Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
When you boot in safe mode, it's normal to see a dark gray progress bar on a light gray background. If the progress bar gets stuck for more than a few minutes, or if the system shuts down automatically while the progress bar is displayed, your boot volume is corrupt and the drive is probably malfunctioning. In that case, go to Step 5.
If you can boot and log in now, empty the Trash, and then open the Finder Info window on your boot volume ("Macintosh HD," unless you gave it a different name.) Check that you have at least 9 GB of available space, as shown in the window. If you don't, copy as many files as necessary to another volume (not another folder on the same volume) and delete the originals. Deletion isn't complete until you empty the Trash again. Do this until the available space is more than 9 GB. Then reboot as usual (i.e., not in safe mode.)
If the boot process hangs again, the problem is likely caused by a third-party system modification that you installed. Post for further instructions.
Step 4
Sometimes a boot failure can be resolved by resetting the NVRAM.
Step 5
Launch Disk Utility in Recovery mode (see Step 1.) Select your startup volume, then run Repair Disk. If any problems are found, repeat until clear. If Disk Utility reports that the volume can't be repaired, the drive has malfunctioned and should be replaced. You might choose to tolerate one such malfunction in the life of the drive. In that case, erase the volume and restore from a backup. If the same thing ever happens again, replace the drive immediately.
This is one of the rare situations in which you should also run Repair Permissions, ignoring the false warnings it may produce. Look for the line "Permissions repair complete" at the end of the output. Then reboot as usual.
Step 6
Reinstall the OS. If your Mac was upgraded from an older version of OS X, you’ll need the Apple ID and password you used to upgrade.
Step 7
Repeat Step 6, but this time erase the boot volume in Disk Utility before installing. The system should automatically reboot into the Setup Assistant. Follow the prompts to transfer your data from a Time Machine or other backup.
Step 8
This step applies only to older Macs (not current models) that have a logic-board ("PRAM") battery. Both desktop and portable Macs used to have such a battery. The logic-board battery is separate from the main battery of a portable. A dead logic-board battery can cause a gray screen at boot. Typically the boot failure will be preceded by loss of the startup disk and system clock settings. See the user manual for replacement instructions. You may have to take the machine to a service provider to have the battery replaced.
Step 9
If you get this far, you're probably dealing with a hardware fault. Make a "Genius" appointment at an Apple Store to have the machine tested. If you can't get to an Apple Store, go to another authorized service provider. -
The wheel that shows your downloading something on my iPhone 5 will not stop spinning. What can I do to stop it? I have shut down all apps, restarted my phone as well I have pushed the power button & home button at the same time. Still no luck.
If restart and reset don't solve this problem then something must be being started when your iPhone starts up that cannot complete.
You might consider restoring your iPhone to Factory via iTunes. -
Hp wireless laser mini mouse will not scroll pages with the wheel
Hello, I switched to firefox as my main browser, much better than IE9 in vista 32 bit. I am using a Hp Pavilion entertainment PC laptop with a HP wireless mini mouse and the scroll wheel will not move the web pages up or down, works okay in IE9. I can use the keyboard to scroll and cursor click arrows okay, I really like the mouse wheel better. Thanks for your help.
hello Thegman50, have you already tried installing the latest drvier version that is available for this mouse model from: http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=no-75205-1&cc=us&dlc=en&lc=en&os=2093&product=3209078&sw_lang= ?
-
Run Into Problem When Trying Not To Hard Code the Host Name
My code (using the JavaMail API) works fine when the SMTP host name is hard coded in the program:
props.put( "mail.smtp.host", "TheHostName" );Then, I tried to put the host name in a properties file (smtpServer.properties). The properties file is in the $TOMCATHOME\webapps\AppName\WEB-INF\classes\resources directory. And the properties file has this one single line:
smtpServer = TheHostName //Note: The host name has only alpha characters, dots, and dashesIn my program, I did:
private final String PROPFILE = "resources/smtpServer.properties";
private Properties oProp = null;
public SendBatchMails() // this is the constructor in my class
try
oProp = new Properties();
oProp.load ( getClass().getClassLoader().getResourceAsStream( PROPFILE ) );
catch( IOException oEx )
System.out.println("Unable to load the Properties " + PROPFILE + oEx );
String smtpServer = oProp.getProperty( "smtpServer" );
Properties props = System.getProperties();
props.put( "mail.smtp.host", smtpServer );And, I got this runtime error:
java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)I would agree with Reply 1. From the stack trace it is apparent that it comes from Struts, where it is failing to set some kind of property in a bean. However the code that you posted doesn't seem to have anything to do with that. Check your Struts configuration.
-
Has anyone had problems shutting down your IPad 2. I have what looks like a wheel in the middle of my screen that goes around and around. 3 hrs now!!
Hold down the home button and power button until you see the Apple logo and that will reboot it.
-
Stop me re-inventing the wheel
I have an application to build that does the following.
1. Receives a request for data.
2. Passes the request to other sources.
3. Aggregates the data from all the sources.
4. Returns the aggregated data.
If there are 10 sources and each one takes 10 seconds to return the data and the sources are hit sequentially then it is going to take 100 seconds. However, if I start 10 threads then it will take 10 seconds.
Is there a pattern for aggregating results like this? And even better a worked example in Java ;)
Thanks for your advice.if you are using java 1.5, then there is a class to
synchronize the work of multiple threads called a
cyclic barrier.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/conc
urrent/CyclicBarrier.htmlA lot, if not all of those concurrent classes are available for 1.4 also. Search for 'Doug Lea Concurrent' on Google. -
Managing shared assets? (Re-inventing the wheel)
My company has been using Eloqua for quite some time. When I joined, I found a long list of shared assets -- some dating back to the Eisenhower administration.
During my Eloqua University training, I've been encouraged to "share" assets with my team whenever possible. However, I'm not entirely clear on how to best take advantage of useful assets that a long-departed co-worker may have created.
For example, let's say that I created a shared filter that gives me a list of all people in the US who would gladly trade a cow for a sack of Magic Beans.
I save it as a shared filter (and maybe or maybe not include the optional description)
Now, assume that a co-worker in another department (perhaps in another country, who probably doesn't know me) needs to find a list of customers who are interested in Magic Beans.
Other than wading through the hundreds of shared filters that have accumulated in the system over the years, is there a "Smart" way of finding that filter (and, by extension, any useful shared asset?)
I am eager to share my new assets -- but even more eager to leverage what the more-experienced Eloquans have shared.
Thanks!!I'm an Eloqua newbie -- in my "Fundamentals" classes, the instructors advised me that the "Descriptions" fields were ignored by the Eloqua search bots (which seemed really strange). The question arose from my instructors urging us to "share, share, share" our assets -- but not really providing any assistance to co-workers who might benefit from those shares. (Unless you know what your co-worker wants and you tell them about it, they probably won't find your shared work.)
I stumbled across the EloquaBulkAPI document, though. When I get a bit more comfortable with the Eloqua GUI, I'll have to dig-in and play with it.
(Are there other Eloqua APIs available?) -
XML Reader - why re-invent the wheel
Does anyone want to post the code to a good XML Reader that they currently have in use?
Here is some very simple code that reads all of the nodes in an XML doc. I apologize to the writer of this code, I can't remember where I got it and what his/her name is. If someone recognizes it, please pipe up. Oh yeah, and I can't remember what needed to be referenced so I included a bunch of stuff.
anywho:
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.parsers.*;
import java.util.*;
import java.io.*;
public class LoadXMLdoc {
private Document document;
public LoadXMLdoc() {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse( new File(yourDocumentPathAsStringHere) );
Element root = document.getDocumentElement();
String rootElement = (root.getTagName());
root.normalize();
System.out.println(rootElement);
NodeList children = root.getChildNodes();
System.out.println("It has "+ children.getLength() + " child nodes\n");
for (int i=0;i<children.getLength();i++) {
System.out.println(children.item(i).getNodeName());
System.out.println("I'm done");
} catch (SAXParseException spe) {
// Error generated by the parser
System.out.println("\n** Parsing error"
+ ", line " + spe.getLineNumber()
+ ", uri " + spe.getSystemId());
System.out.println(" " + spe.getMessage() );
// Use the contained exception, if any
Exception x = spe;
if (spe.getException() != null)
x = spe.getException();
x.printStackTrace();
} catch (SAXException sxe) {
// Error generated during parsing)
Exception x = sxe;
if (sxe.getException() != null)
x = sxe.getException();
x.printStackTrace();
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
pce.printStackTrace();
} catch (IOException ioe) {
// I/O error
ioe.printStackTrace();
}Hope that helps you. It helped me.
Good Luck.
Ben -
Why arent the wheels connected to Havok
Ok I am totally lost with this havok thing. I am trying to
understand what gets attached to the havok physics engine when
designing a car racing game. However, after downloading both the
jeep car and the remote control car games from director-online
havok archive site, I noticed something very stange. While trying
to decipher the code on both files it seems to me that the wheels
are not attached to the Havok physic's engine. Now I could be
wrong, but I wanted to ask you guys if this is correct, and if so,
then how do the wheels follow the car as well as stay on the ground
and without going through the ground? I am asking this becuase I
could not pick it out through its lingo. There are so many
behaviours attached to the 3d world that it is impossible to know
where Director starts to read each behaviour.
I understand a little bit about havok, such as if you want
something movable then you attach a movable rigid body to it and if
the object is fixed then you would attach the fixed rigid body to
it. In addition, I also know a little bit about mass which sets the
weight of the object. However, it seems to me that both of these
games are way too advamced for me especially when just for now all
I am trying to unserstand is how the wheels of a car can follow the
body of the car and also for the wheels to stay on the ground and
without them going through the ground.Roofy wrote:
>
quote:
IIRC, the example you?re talking about has a "chassis" whose
model
> consists in 4 wheels and the car itself it?s only
attached to the
> chassis by a spring or dashpot to give the amortiguation
effect.
>
> ok, I might be wrong on this, but after pressing play
and typing the following
> syntax in the message window...
> form the jeep demo ....
> put member("blankHavok").lineardashpot
> put member("blankHavok").spring.count
>
> and from the RemoteControl Car demo
> put member("carHKE").lineardashpot
> put member("carHKE").spring.count
>
>
>
> ... doing this in both files and after pressing play, I
get an emplty list
> returned back for the dashpot and 0 for the count of the
spring. So I don't
> think there are any dashpots nor springs on either demo.
Sorry, I thought you were talking about this demo:
http://director-online.com/havok/demos/demo-dashcar.html
> However, what I am
> concluding is that I think they are using 2 custom
handlers called
> initializeHover and updateHover which is somehow
detecting the chassis and its
> wheels if they collide or not. I did a test by disabling
both of these custom
> handlers and by doing so, the chassis would fall through
the wheels and land on
> the ground instead. On the other hand, if these 2 custom
handlers are causing
> this effect, then I srill don't understand how the the
wheels are following the
> chassis. Therefore, I am wondering if it would be easier
to use modelsUnderRay
> considering that all I am trying to do is do collision
detection? What do you
> think?
Actually, this RayCastCar demo uses modelsUnderRay() for
collision
detection of the wheels with the ground:
-- For each wheel do
repeat with i = 1 to pWheelPointList.count
pIsHoveringList
= false
worldWheelPoint = pChassisMDL.transform *
pWheelPointList
intersectDetails = pMember.ModelsUnderRay(worldWheelPoint,
worldDownDir, 2, #detailed)
So the physics and control are applied to the chassis and the
wheels are
just "floating". At which distance should they float is what
modelsUnderRay() is used for.
This doesn�t mean that you don�t need Havok at
all and you can use
modelsUnderRay() instead since havok handles all the driving
physics and
MUR just the distance of the wheels to the chassis.
Regards,
Agust�n Mar�a Rodr�guez
www.onwine.com.ar > Macromedia Director demos & code -
Why does the wheel keep spinning at the top of my screen on my iphone 5
Basically,
I noted the past 2-3 days that my battery is dying really quick. It dies after being charged all night within 25 minutes. I also noticed that the wheel keeps spinning at the top of my screen between the time and wifi symbol. Is there a connection?I think that it is turning the WiFi switch on in Settings (from "not connected" ) that starts the wheel.
In normal circumstances the wheel stops when you have selected and connected to a network of your choice. -
I tried the Aperature trial and liked it, but did not purchase it when the trial ended. A few weeks later, i purchased snow lepord and purchased aperture via the app store. I have had not been able to use it since. Each time i open it , afer a few seconds i get the spinning wheel of death and Aperture is frozen. I have to force quit Aperture to shot down mycomputer. I have re-installed Aperture 3 times with th e same result. I have iphoto on my computer as well is this causing the problem? I want my money back!!! Can anyone help?
You need to delete the trial & then reinstall from the boxed DVD or the Mac App Store. The files to delete are the iWork ’09 folder from the main HD > Applications; the iWork ’09 folder in HD > Library > Application Support & the individual iWork application plist files found in HD > Users > (your account) > Library > Preferences for each user.
Yvan Koenig has written an AppleScript that removes the files. You can find it on his box.com account in for_iWork'09 > other_iWork'09 items > uninstall iWork '09.zip. -
My iphone4 will not connect to my network. My iPad and my wife's iPad and iphone4 all connect to my network. I have tried the solutions in Apple trouble shooting site. I even tried the freezer option. Still no connection.The "wheel" turns for 2 secOne then stops without connecting. Anyine have a solution to this issue?
I have an AT&T contracted iphone 5. Cannot send mms to anyone but other iPhone users. If you search the Internet, you'll see that the problem is everywhere...both the carriers and Apple are actling like the problem belongs to the other, or feigning any knowledge (which is kind of funny since the no MMS thing was in an ios6 beta that was released awhile ago, so I KNOW apple knows about it). No, I'm not running a beta (obviously, I just got my iphone 5). Awesome. Have a great camera on this thing, but cannot send OR receive MMS from anyone other than other iphone users. Gotta love it.
-
Wifi working on 1 iPad and iPhone but not on another IPad (same model). All posted fixes tried with no help. The iPad recognizes the network but the wheel keeps spinning. Any help is greatly appreciated.
first step would be reboot
http://www.apple.com/support/iphone/assistant/phone/#section_1 the cure for most ios ills
then I would troubleshoot by taking it to another wifi network to see if it had problems in general with wifi
then if it did not then I would try to update the firmware of my wifi router for better compatability
Maybe you are looking for
-
Hi, I have set max numb of leaves in the Generation rules as 48 days. I am using 2013 infotype to upload last year quota." ONly transfer quota correctionimmediately " is the option that i selected ,as i gave 01.01.2007 date to upload the quota.... Pr
-
Grayed out, weird photos when importing from Camera Roll
OK, wondering if anyone else is experiencing this? I use Photoshop's Bridge import to pull my photos of my iPhone 3Gs. When I do, I often have these weird photos - I'm not totally sure why they are happening. And, the good news is that once they are
-
Runtime error in sales order creation
Hai,When I am trying to create sales order one run time error is occured.The error is CALL_TRANSACTION_NOT_FOUND TRANSACTION "%_GS" IS UNKNOWN.TRANSACTION "%_GS" IS NOT LISTED IN TABLE OF T.CODES.CURRENT ABAP PROGRAMME HAD TO BE TERMINATED BECAUSE O
-
Setting value in cookie using ABAP code
Hai All, Is it possible to set value in a cookie using ABAP code. Regards, H.K.Hayath Basha.
-
Hi All, Is there a way to consume data from HANA to ECC? Eg: I have a Sales order in HANA. If I pass the Sales order number then it should return the details of that Sales Order. Thanks in advance. -Chandra