Is it possible to configure nginx to run a unix command based on a url?
For example:
http://localhost/list/usr/local
This runs:
ls /usr/local
Then returns the results?
I am new to java, I have seen in the code at many places where my seniors have declared as
List myList = new ArrayList(); (option1)
Instead of
ArrayList myList = new ArrayList(); (option2)
Can you please tell me why people use Option1, is there any advantages?
If we use option2, do we miss out any advantages or features?
I'm using System.DirectoryServices to list the status of websites running on a server. Currently I'm using impersonation of an admin account for this to run but I'd prefer to have a specific user account with the bare minimum privileges.
Can anyone point me in the right direction?
Hi,
I am able to list Documents from "Public Folders"
Using this sample code :
session.LogonExchangeMailbox("[email protected]", "server");
RDOFolder folder = session.GetFolderFromPath(@"\Public Folders\All Public Folders");
Now i want to Extract this documents to another location.
I would like for the "List" view content views to have a check added to it to first check that the model has elements, it occurs to me that I have no idea how these views are generated. Can those be changed?
Hi,
Environment is:
Windows Server 2008 R2 x64
Slik-Subversion-1.6.11-x64
TortoiseSVN-1.6.8.19260-x64-svn-1.6.11
I have setted up svn srvice based on Jeff Atwood guidlines and can connect work with host via svn command lines like svn list svn://localhost, but TortoiseSVN can't connect to it even on server machine itself. All firewall types are off. TortoiseSVN error message is:
Can't connect to host 'localhost': No connection could be made because the target machine actively refused it.
How can I solve this problem?
Thanks in Advance,
Is there a way to get all format parameters of a string?
I have this string: "{0} test {0} test2 {1} test3 {2:####}"
The result should be a list:
{0}
{0}
{1}
{2:####}
Is there any built in functionality in .net that supports this?
Hello,
I have a folder with .txt files in it. How can i make my menuitem get those .txt files and put the filenames in the menuitem, so that it creates a list of all .txt files in that folder.
So when i put a .txt in the folder the program automaticly creates the menu item.
Does someone knows how to do this, or perhaps an example?
When I do the following
ps -aef|grep "asdf"
I get a list of processes that are running. Each one of my process has the following text in the output:
-ProcessName=XXXX
I'd like to be able to format the out put so all I get is:
The following processes are running:
Process A
Process B
etc..
I have a list of strings of the format "x,y". I would like to make them all into Points. The best Point constructor I can find takes two ints. What is the best way in C# to turn "14,42" into new Point(14,42);?
I know the Regex for doing that is /(\d+),(\d+)/, but I'm having a hard time turning those two match groups into ints in C#.
Hi guys,
I have a question about the JFileChooser in Swing. I'm trying to get multiple file extensions in the drop-down box, but have no idea how to do it.
There is the method
extFilter = FileNameExtensionFilter(description, extensions);
that I can then use by writing
fileChooser.setFileFilter(extFilter);
however, as you can see, this only supports one option in the drop-down list. How do I add more?
I'm developing an eclipse plugin and need to list of IMethods that belong to an IResource.
I see IType has a getMethods function but not sure how to go about converting an IResource to an IType
Help appreciated
Nicky
I'd like to know how to get a list of the windows requiring user attention from the Windows taskbar. Windows requiring attention appear with a flashing orange color within the Windows taskbar.
Un-focused MSN Messenger conversation windows are a good example of this behavior: they turn orange as soon as a remote user sends an instance message.
My code targets the Windows 7 platform, but working on older Windows OS would be nice too.
I am trying to page through a results from an REST API call that supports paging. I would like the UI to just be a list view that as I scroll, the new content is retrieved.
I have some viewdata that is generated by going through my repository to the database to grab some scheduling info. When the information is stored in the Viewdata, I noticed that the viewdata is enumerated. How could I access the enumerated items and generate a table/list based on the viewdata? Most of the information just needs to be spit out into a table, but one item will have a link generated for it.
Thanks!
C# Winforms 3.5
I have a list of user controls all derived from one base class. These controls can be added to various panels and I'm trying to implement the drag-drop functionality, the problem I'm running in to is on the DragDrop event.
The DragEventArgs: e.Data.GetData(typeof(baseClass)) doesn't work. It wants:
e.Data.GetData(typeof(derivedClass1))
e.Data.GetData(typeof(derivedClass2)) etc...
Is there a way I can get around this, or a better way to architect it?
From the following list of frameworks, which one would you use to develop a rich web application and why would you choose it over the others?
Sproutcore
GWT
ExtJS
GXT
SmartGWT
Dojo / Dijit
Flex
Capuccino
Grails
I am using a customised BaseAdapter to display items on a ListView. The items are just strings held in an ArrayList.
The list items have a delete button on them (big red X), and I'd like to remove the item from the ArrayList, and notify the ListView to update itself.
However, every implementation I've tried gets mysterious position numbers given to it, so for example clicking item 2's delete button will delete item 5's. It seems to be almost entirely random.
One thing to note is that elements may be repeated, but must be kept in the same order. For example, I can have "Irish" twice, as elements 3 and 7.
My code is below:
private static class ViewHolder {
TextView lang;
int position;
}
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.language_link_row, null);
holder = new ViewHolder();
holder.lang = (TextView)convertView.findViewById(R.id.language_link_text);
holder.position = position;
final ImageView deleteButton = (ImageView)
convertView.findViewById(R.id.language_link_cross_delete);
deleteButton.setOnClickListener(this);
convertView.setTag(holder);
deleteButton.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.lang.setText(mLanguages.get(position));
return convertView;
}
I later attempt to retrieve the deleted element's position by grabbing the tag, but it's always the wrong position in the list. There is no noticeable pattern to the position given here, it always seems random.
// The delete button's listener
public void onClick(View v) {
ViewHolder deleteHolder = (ViewHolder) v.getTag();
int pos = deleteHolder.position;
...
...
...
}
I would be quite happy to just delete the item from the ArrayList and have the ListView update itself, but the position I'm getting is incorrect so I can't do that.
Please note that I did, at first, have the deleteButton clickListener inside the getView method, and used 'position' to delete the value, but I had the same problem.
Any suggestions appreciated, this is really irritating me.
We are moving over to using Akamai for all of our large static content so far just flash but are planning to include images, css, and js files in that list.
I am curious what methods others employ to switch all of their local/relative paths to using an external hosting company. Also, how they continue to develop their site so that developers can make changes in development without it having to be pushed to their external hosting servers.
I'd like to be able to use ruby's OptionParser to parse sub-commands of the form
COMMAND [GLOBAL FLAGS] [SUB-COMMAND [SUB-COMMAND FLAGS]]
like:
git branch -a
gem list foo
I know I could switch to a different option parser library (like Trollop), but I'm interested in learning how to do this from within OptionParser, since I'd like to learn the library better.
Any tips?
Is there any standard way of providing list of program switches, so it would be possible for zsh to determine possible completions? Or must it provided directly to zsh developers and only they can add completions to zsh?
Given the following case:
<?php
class ParentClass {
public $attrA;
public $attrB;
public $attrC;
public function methodA() {}
public function methodB() {}
public function methodC() {}
}
class ChildClass {
public $attrB;
public function methodA() {}
}
How can I get a list of methods (and preferably class vars) that are overridden in ChildClass?
Thanks,
Joe
Hi,
I have a question for which I'm sure there must a simple solution. I'm writing a small GWT application where I want to achieve this:
www.domain.com : should serve the welcome page
www.domain.com/xyz : should serve page xyz, where xyz is just
a key for an item in a database. If there is an
item associated with key xyz, I'll load that and show a page, otherwise I'll show a
404 error page.
I was trying to modify the web.xml file accordingly but I just couldn't
make it work. I could make it work with an url-pattern if the key in question is after another /, for example: www.domain.com/search/xyz. However,
I'd like to have the key xyz directly following the root / (http://www.domain.com/xyz).
Something like
<servlet-mapping>
<servlet-name>main</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
doesn't seem to work as I don't know how to address the main page
index.html (as it's not an actual servlet) which will then load my
main GWT module.
I could make it work with a bad work around (see below): Redirecting a
404 exception to index.html and then doing the look up in the main
entry point, but I'm sure that's not the best practice, also for SEO
purposes.
Can anyone give me a hint on how to configure the web.xml with GWT for
my purpose?
Thanks a lot.
Mike
Work-around via 404:
Web.xml:
<web-app>
<error-page>
<exception-type>404</exception-type>
<location>/index.html</location>
</error-page>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
index.html -- Main Entry point -- onModuleLoad():
String path = Window.Location.getPath();
if (path == null || path.length() == 0 || path.equalsIgnoreCase("/")
|| path.equalsIgnoreCase("/index.html")) {
... // load main page
} else {
lookup(path.substring(1)); // that's key xyz
I'm seeing a weird error message and am looking for some ideas as to what the problem could be. I'm sort of new to using the JPA.
I have an application where I'm using Spring's Entity Manager Factory (LocalContainerEntityManagerFactoryBean), EclipseLink as my ORM provider, connected to a MySQL DB and built with Maven. I'm not sure if any of this matters.....
When I deploy this application to Glassfish, the application works as expected.
The problem is, I've created a set of stand alone unit tests to run outside of Glassfish that aren't working correctly. I get the following error (I've edited the class names a little)
com.xyz.abc.services.persistence.entity.MyEntity cannot be cast to com.xyz.abc.services.persistence.entity.MyEntity
The object cannot be cast to a class of the same type? How can that be?
Here's a snippet of the code that is in error
Query q = entityManager.createNamedQuery("MyEntity.findAll");
List entityObjects = q.getResultList();
for (Object entityObject: entityObjects) {
com.xyz.abc.services.persistence.entity.MyEntity entity = (com.xyz.abc.services.persistence.entity.MyEntity) entityObject;
Previously, I had this code that produced the same error:
CriteriaQuery cq = entityManager.getCriteriaBuilder().createQuery();
cq.select(cq.from(com.xyz.abc.services.persistence.entity.MyEntity.class));
List entityObjects = entityManager.createQuery(cq).getResultList();
for (Object entityObject: entityObjects) {
com.xyz.abc.services.persistence.entity.MyEntity entity = (com.xyz.abc.services.persistence.entity.MyEntity) entityObject;
This code is question is the same that I have deployed to the server.
Here's the innermost exception if it helps
Caused by: java.lang.ClassCastException: com.xyz.abc.services.persistence.entity.MyEntity cannot be cast to com.xyz.abc.services.persistence.entity.MyEntity
at com.xyz.abc.services.persistence.entity.factory.MyEntityFactory.createBeans(MyEntityFactory.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)
... 37 more
I'm guessing that there's some jar I'm using in Glassfish that is different than the ones I'm using in test. I've looked at all the jars I have listed as "provided" and am pretty sure they are all the same ones from Glassfish.
Let me know if you've seen this weird issue before, or any ideas for correcting it.
I have classnames in a stringlist. For example it could be
'TPlanEvent', 'TParcel', 'TCountry' etc.
Now I want to find out the sizes by looping the list.
It works to have:
Size := TCountry.InstanceSize;
But I want it like this:
for i := 0 to ClassList.Count - 1 do
Size := StringToClass(ClassList[i]).InstanceSize;
Obviously my question is what to write instead of method StringToClass to convert the string to a class.