Search Results

Search found 2205 results on 89 pages for 'reverse'.

Page 7/89 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • RegEx to reverse order of list?

    - by quantomcat
    Is there a singular regular expression that can be used in, say, a text editor's search/replace dialog to reverse the order of the items in a list? For instance, take this list: First item Second item Third item Select it in a text editor like EditPad, bring up the search and replace box, apply a regex (run as a loop or not) and turn it into: Third item Second item First item Can this be done?

    Read the article

  • Django: How to write the reverse function for the following

    - by ninja123
    The urlconf and view is as follows: url(r'^register/$', register, { 'backend': 'registration.backends.default.DefaultBackend' }, name='registration_register'), def register(request, backend, success_url=None, form_class=None, disallowed_url='registration_disallowed', template_name='registration/registration_form.html', extra_context=None): What i want to do is redirect users to the register page and specify a success_url. I tried reverse('registration.views.register', kwargs={'success_url':'/test/' }) but that doesn't seem to work. I've been trying for hours and can't get my mind around getting it right. Thanks

    Read the article

  • How to reverse bitwise AND (&) in C ?

    - by VaioIsBorn
    For example i have an operation in C like this: ((unsigned int)ptr & 0xff000000)) The result is bf000000. What do i need at this moment is how to reverse the above i.e. determine the ptr by using the result from the operation and offcourse 0xff000000 . I am asking if there's any simple way to implement this in C, tnx.

    Read the article

  • Reverse engineering to get answers

    - by cornjuliox
    So I've spent the last few days looking for a way to create a simple image drawing app with wxPython, and I think the key to doing just that is understanding how to use Device Contexts. The problem is that the wxPython demo program doesn't demonstrate DCs, and the docs for both wxPython and wxWidgets don't explain as much as I'd like to know so I've decided to try and 'reverse engineer' an existing app to see how its done. The first problem I have is that I don't know of any drawing apps written in wxPython (or any written in Python for that matter o.o), and the second is I don't know how I'd go about doing it. Am I right in saying that I'm going to need a copy of an application's Python source and something like Winpdb? What do professional programmers do when they find themselves in a situation like mine, needing answers that the docs don't provide?

    Read the article

  • Reverse-engineer a Javascript object?

    - by TruMan1
    I have a Javascript object that I want to pass in more parameters, but the documentation is non-existant. My only option seems to be to reverse engineer the Javascript object to see what parameters and values I can pass in. For example, I want to see if there is a "zoom" parameter for the object and what values I can pass into the "mapType" parameter: <script type="text/javascript" src="http://maps.google.com/maps?oe=utf-8&amp;file=api&amp;v=2&amp;key=your-gmap-key"></script> <script type="text/javascript" src="https://share.findmespot.com/spot-widget/js/SpotMain.js"></script> <script type="text/javascript"> var widget = new Spot.Ui.LiveWidget({ renderTo: "spot-live-widget", feeds: [ "0Wl3diTJcqqvncI6NNsoqJV5ygrFtQfBB" ], height: 400, width: 500, mapType: "physical" }); </script> <div id="spot-live-widget"/> Any ideas on how to do that?

    Read the article

  • Feasability of reverse engineering some embedded code

    - by user258526
    All, My company is in the situation where we are using an embedded control system from another company in another country. We do not have the source code or the schematics to this system, and the manufacturer doesn't want to release them, seemingly at any price or under any terms. We are thus stuck with a 6 month turn around to get even a small modification done, and they can basically charge any amount they want. Legal aspects aside, would it be at all feasible to reverse engineer the embedded code back into C? Do any companies exist that could do this for us? Thank you, Fred

    Read the article

  • Reverse List<Object>

    - by Mercer
    Hello, i have a List List<DataClient> listDataClient; My class DataCLient: Client client; List<String> phoneNumber; i have a second list List<DataPhoneNumber> listPhoneNumber; My class DataPhoneNumber: String phoneNumber; List<Client> client; In my code i put data in my first list but now i want to reverse my list in the second. In the first list i have a Client wiht x NumberPhone now i want to have NumberPhone for x Client

    Read the article

  • Reverse massive text file in Java

    - by DanJanson
    What would be the best approach to reverse a large text file that is uploaded asynchronously to a servlet that reverses this file in a scalable and efficient way? text file can be massive (gigabytes long) can assume mulitple server/clustered environment to do this in a distributed manner. open source libraries are encouraged to consider I was thinking of using Java NIO to treat file as an array on disk (so that I don't have to treat the file as a string buffer in memory). Also, I am thinking of using MapReduce to break up the file and process it in separate machines. Any input is appreciated. Thanks. Daniel

    Read the article

  • How to configure Hibernate database reverse engineering tool to map database table relation as a ent

    - by Piotr Kochanski
    Is it possible to configure Hibernate reverse engineering and code generation tool in such a way that one-to-many relation between tables is mapped to entities inheritance instead of enrites relation? I have Person table and Employee table, which are related with the foreign key (Person contains basic information, Employee the rest). In my Java code I would like this relation mapped to inheritance Employee extends Person. This can be done by hand, but maybe I missed some custom configuration parameter that I can use. I couldn't find any official documentation - docs link on RedHat Hibernate page (http://www.hibernate.org/5.html#A10) is broken...

    Read the article

  • Reverse Engineer a web page

    - by Phil
    Hi, I wish to reverse engineer any web-page into a logical representation of the page. For example, if a web page has a menu, then I want a logical menu structure perhaps in XML. If the webpage has an article, I want a article XML node, if it has a title for the article I want a title XML node. Basically, I want the logical form of the web-page without any of the user interface. This logical model could either be objects in code or XML it doesn't matter, the important part is that it has identified what everything on the page means.

    Read the article

  • How to diagnose, and reverse (not prevent) Unicode mangling

    - by Steve Bennett
    Somewhere upstream of me, "something" happened that looks like unicode mangling. One symptom is that a lowercase u umlaut (ü) gets converted to "ü" (ie, character FC gets converted to C3 BC). Assuming that I have no control over this upstream process, how can I reverse-engineer what's going on? And if that is possible, can I crank the sausage machine backwards and get the original text back? (If it helps to understand this case, the text I received was in the form of a MySQL dump. I think somwewhere in the dump/transport process it got mangled.)

    Read the article

  • python grep reverse matching

    - by thomytheyon
    Hi Alls, I would like to build a small python script that basicaly does the reverse of grep. I want to match the files in a directory/subdirectory that doesn't have a "searched_string". So far i've done that: import os filefilter = ['java','.jsp'] path= "/home/patate/code/project" for path, subdirs, files in os.walk(path): for name in files: if name[-4:] in filefilter : print os.path.join(path, name) This small script will be listing everyfiles with "java" or "jsp" extension inside each subdirectory, and will output them full path. I'm now wondering how to do the rest, for example i would like to be able if I forgot a session management entry in one file (allowing anyone a direct file access), to search for : "if (!user.hasPermission" and list the file which does not contain this string. Any help would be greatly appreciated ! Thanks

    Read the article

  • IIS7 and ARR as reverse proxy for Subversion

    - by Paul Stovell
    I am using IIS7 and the Application Request Routing extension to act as a reverse proxy to Subversion running on Apache. The proxy works fine and I am able to explore the server, and even perform a "check out". However, I cannot browse to files that would normally be forbidden by ASP.NET - for example, .cs, .csproj, and so on. Files ASP.NET wouldn't be concerned with - such as .txt - are fine. I tried to edit the global web.config to remove the Forbidden handler mapping for these files, but it did not seem to make a difference. Is there any way to allow the URL rewriting module in IIS7 to work, while allowing all file extensions to be rendered?

    Read the article

  • Reverse Search Best Practices?

    - by edub
    I'm making an app that has a need for reverse searches. By this, I mean that users of the app will enter search parameters and save them; then, when any new objects get entered onto the system, if they match the existing search parameters that a user has saved, a notification will be sent, etc. I am having a hard time finding solutions for this type of problem. I am using Django and thinking of building the searches and pickling them using Q objects as outlined here: http://www.djangozen.com/blog/the-power-of-q The way I see it, when a new object is entered into the database, I will have to load every single saved query from the db and somehow run it against this one new object to see if it would match that search query... This doesn't seem ideal - has anyone tackled such a problem before?

    Read the article

  • Reverse geocode street name and city as text

    - by Taylor Satula
    Hello, I have been having some trouble finding a good way to output just the street name and city as text (Infinite Loop, Cupertino shown here) that can be displayed in my iPhone app. This needs to be able to dynamically change as you change streets and city. I don't have the slightest idea of how to do this, I hope someone can help. I have attached a very rough image of what I am trying to acheave. I have found this (http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding) for google maps about how to reverse geocode using javascript, but what I do not understand is how this would be done in a iPhone development setting. I work in web design and I see how it would be done in HTML but I am very new to iPhone development and don't have the slightest clue of how it would be done here. If someone could spell out how to do this I would be extremely grateful. I cannot seem to find what I am looking for by searching Google. Reference picture: http://www.threepixeldrift.com/images/deep-storage/reversegeocodeiphoneapp.jpg

    Read the article

  • Maven nexus with jetty 7 and apache2 reverse proxy

    - by user613154
    Hello stackoverflow ! Here is my problem : i try to run a maven nexus behind an apache reverse proxy. As i have multiples war in my jetty, i want the nexus to run here : http://localhost:8080/nexus I made a jetty context file as follow : {jetty.home}/contexts/nexus.xml <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="contextPath">/nexus</Set> <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/nexus.war</Set> </Configure> My jetty connector in jetty.xml is as follow : <Call name="addConnector"> <Arg> <New class="org.eclipse.jetty.server.nio.SelectChannelConnector"> <Set name="host"><Property name="jetty.host" /></Set> <Set name="port"><Property name="jetty.port" default="8080"/></Set> <Set name="maxIdleTime">300000</Set> <Set name="Acceptors">2</Set> <Set name="forwarded">true</Set> <Set name="statsOn">false</Set> <Set name="confidentialPort">8443</Set> <Set name="lowResourcesConnections">20000</Set> <Set name="lowResourcesMaxIdleTime">5000</Set> </New> </Arg> </Call> I want http://maven.foo.com/ as an end point for the nexus, so i made this apache2 configuration file : ProxyRequests Off ProxyVia Off ProxyPreserveHost On <Proxy *> AddDefaultCharset off Order deny,allow Allow from all </Proxy> <VirtualHost *:80> ServerName maven.foo.com ProxyPass / http://localhost:8080/nexus/ ProxyPassReverse / http://localhost:8080/nexus/ ErrorLog ${APACHE_LOG_DIR}/error_nexus.log </VirtualHost> But i can't manage to make it work. The error message displayed in the browser is "The server has not found anything matching the request URI". I tried to read docs on jetty and apache web site, but didn't find information for mapping a subdomain "sub.foo.com" to a context "localhost:8080/sub" ... Any help welcome ! Thanks

    Read the article

  • Creating a Reverse Proxy using Jpcap

    - by Ramon Marco Navarro
    I need to create a program that receives HTTP request and forwards those requests to the web servers. I have successfully made this using only Java Sockets but the client needed the program to be implemented in Jpcap. I'd like to know if this is possible and what literature I should be reading for this project. This is what I have now by stitching together pieces from the Jpcap tutorial: import java.net.InetAddress; import java.io.*; import jpcap.*; import jpcap.packet.*; public class Router { public static void main(String args[]) { //Obtain the list of network interfaces NetworkInterface[] devices = JpcapCaptor.getDeviceList(); //for each network interface for (int i = 0; i < devices.length; i++) { //print out its name and description System.out.println(i+": "+devices[i].name + "(" + devices[i].description+")"); //print out its datalink name and description System.out.println(" datalink: "+devices[i].datalink_name + "(" + devices[i].datalink_description+")"); //print out its MAC address System.out.print(" MAC address:"); for (byte b : devices[i].mac_address) System.out.print(Integer.toHexString(b&0xff) + ":"); System.out.println(); //print out its IP address, subnet mask and broadcast address for (NetworkInterfaceAddress a : devices[i].addresses) System.out.println(" address:"+a.address + " " + a.subnet + " "+ a.broadcast); } int index = 1; // set index of the interface that you want to open. //Open an interface with openDevice(NetworkInterface intrface, int snaplen, boolean promics, int to_ms) JpcapCaptor captor = null; try { captor = JpcapCaptor.openDevice(devices[index], 65535, false, 20); captor.setFilter("port 80 and host 192.168.56.1", true); } catch(java.io.IOException e) { System.err.println(e); } //call processPacket() to let Jpcap call PacketPrinter.receivePacket() for every packet capture. captor.loopPacket(-1,new PacketPrinter()); captor.close(); } } class PacketPrinter implements PacketReceiver { //this method is called every time Jpcap captures a packet public void receivePacket(Packet p) { JpcapSender sender = null; try { NetworkInterface[] devices = JpcapCaptor.getDeviceList(); sender = JpcapSender.openDevice(devices[1]); } catch(IOException e) { System.err.println(e); } IPPacket packet = (IPPacket)p; try { // IP Address of machine sending HTTP requests (the client) // It's still on the same LAN as the servers for testing purposes. packet.dst_ip = InetAddress.getByName("192.168.56.2"); } catch(java.net.UnknownHostException e) { System.err.println(e); } //create an Ethernet packet (frame) EthernetPacket ether=new EthernetPacket(); //set frame type as IP ether.frametype=EthernetPacket.ETHERTYPE_IP; //set source and destination MAC addresses // MAC Address of machine running reverse proxy server ether.src_mac = new MacAddress("08:00:27:00:9C:80").getAddress(); // MAC Address of machine running web server ether.dst_mac = new MacAddress("08:00:27:C7:D2:4C").getAddress(); //set the datalink frame of the packet as ether packet.datalink=ether; //send the packet sender.sendPacket(packet); sender.close(); //just print out a captured packet System.out.println(packet); } } Any help would be greatly appreciated. Thank you.

    Read the article

  • IIRF reverse proxy problem

    - by Sergei
    Hi everyone, We have a java application ( Atlassian Bamboo) running on port 8085 on Windows 2003. It is accessile as http: //bamboo:8085. I am trying to setup reverse proxy for IIS6 using IIRF so content is accessible via http: //bamboo. It seems that I set it ip correctly, and I can retrieve Status page. This is how my IIRF.ini looks like: RewriteLog c:\temp\iirf RewriteLogLevel 2 StatusUrl /iirfStatus RewriteCond %{HTTP_HOST} ^bambooi$ [I] #This setup works #ProxyPass ^/(.*)$ http://othersite/$1 #This does not ProxyPass ^/(.*)$ http://bamboo:8085/$1 However when I type in http: //bamboo in IE, I get 'page cannot be displayed ' message. FF does not return anything at all. I made Wireshark network dump, selected 'follow TCPstream' and it seems like correct page is being retrieved.Why cannot I see it then? I also noticed that I can retrieve http: //bamboo/favicon.ico so I must be very close to the solution.. This is the Wireshark output: GET / HTTP/1.1 Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */* Accept-Language: en-gb User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Accept-Encoding: gzip, deflate Host: bamboo Connection: Keep-Alive Cookie: JSESSIONID=wpsse0zyo4g5 HTTP/1.1 200 200 OK Date: Sat, 30 Jan 2010 09:19:46 GMT Server: Microsoft-IIS/6.0 Via: 1.1 DESTINATION_IP (IIRF 2.0) Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Dashboard</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="robots" content="all" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <link type="text/css" rel="stylesheet" href="/s/1206/1/_/scripts/yui-2.6.0/build/grids/grids.css" /> <!--<link type="text/css" rel="stylesheet" href="/s/1206/1/_/scripts/yui/build/reset-fonts-grids/reset-fonts-grids.css" />--> <link rel="stylesheet" href="/s/1206/1/_/styles/main.css" type="text/css" /> <link rel="stylesheet" href="/s/1206/1/_/styles/main2.css" type="text/css" /> <link rel="stylesheet" href="/s/1206/1/_/styles/global-static.css" type="text/css" /> <link rel="stylesheet" href="/s/1206/1/_/styles/widePlanList.css" type="text/css" /> <link rel="stylesheet" href="/s/1206/1/_/styles/forms.css" type="text/css" /> <link rel="stylesheet" href="/s/1206/1/_/styles/yui-support/yui-custom.css" type="text/css" /> <link rel="shortcut icon" href="/s/1206/1/_/images/icons/favicon.ico" type="image/x-icon"/> <link rel="icon" href="/s/1206/1/_/images/icons/favicon.png" type="image/png" /> <link rel="stylesheet" href="/s/1206/1/_/styles/bamboo-tabs.css" type="text/css" /> <!-- Core YUI--> <link rel="stylesheet" type="text/css" href="/s/1206/1/_/scripts/yui-2.6.0/build/tabview/assets/tabview-core.css"> <link rel="stylesheet" type="text/css" href="/s/1206/1/_/scripts/yui-2.6.0/build/tabview/assets/skins/sam/tabview-skin.css"> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/yahoo/yahoo-min.js"></script> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/event/event-min.js" ></script> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/dom/dom-min.js" ></script> <!--<script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/animation/animation.js" ></script>--> <!-- Container --> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/container/container-min.js"></script> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/connection/connection-min.js"></script> <link type="text/css" rel="stylesheet" href="/s/1206/1/_/scripts/yui-2.6.0/build/container/assets/container.css" /> <!-- Menu --> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/menu/menu-min.js"></script> <link type="text/css" rel="stylesheet" href="/s/1206/1/_/scripts/yui-2.6.0/build/menu/assets/menu.css" /> <!-- Tab view --> <!-- JavaScript Dependencies for Tabview: --> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/element/element-beta-min.js"></script> <!-- Needed for old versions of the YUI --> <link rel="stylesheet" href="/s/1206/1/_/styles/yui-support/tabview.css" type="text/css" /> <link rel="stylesheet" href="/s/1206/1/_/styles/yui-support/round_tabs.css" type="text/css" /> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/tabview/tabview-min.js"></script> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-2.6.0/build/json/json-min.js"></script> <script type="text/javascript" src="/s/1206/1/_/scripts/yui-ext/yui-ext-nogrid.js"></script> <script type="text/javascript" src="/s/1206/1/_/scripts/bamboo.js"></script> <script type="text/javascript"> YAHOO.namespace('bamboo'); YAHOO.bamboo.tooltips = new Object(); YAHOO.bamboo.contextPath = ''; YAHOO.ext.UpdateManager.defaults.loadScripts = true; YAHOO.ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">Currently loading...</div>'; YAHOO.ext.UpdateManager.defaults.timeout = 60; addUniversalOnload(addConfirmationToLinks); </script> <link rel="alternate" type="application/rss+xml" title="Bamboo RSS feed" href="/rss/createAllBuildsRssFeed.action?feedType=rssAll" /> </head> <body> <ul id="top"> <li id="skipNav"> <a href="#menu">Skip to navigation</a> </li> <li> <a href="#content">Skip to content</a> </li> </ul> <div id="nonFooter"> <div id="hd"> <div id="header"> <div id="logo"> <a href="/start.action"><img src="/images/bamboo_header_logo.gif" alt="Atlassian Bamboo" height="36" width="118" /></a> </div> <ul id="userOptions"> <li id="loginLink"> <a id="login" href="/userlogin!default.action?os_destination=%2Fstart.action">Log in</a> </li> <li id="signupLink"> <a id="signup" href="/signupUser!default.action">Signup</a> </li> <li id="helpLink"> <a id="help" href="http://confluence.atlassian.com/display/BAMBOO">Help</a> </li> </ul> </div> <!-- END #header --> <div id="menu"> <ul> <li><a id="home" href="/start.action" title="Atlassian Bamboo" accesskey="H"> <u>H</u>ome</a></li> <li><a id="authors" href="/authors/gotoAuthorReport.action" accesskey="U">A<u>u</u>thors</a></li> <li><a id="reports" href="/reports/viewReport.action" accesskey="R"> <u>R</u>eports</a></li> </ul> </div> <!-- END #menu --> </div> <!-- END #hd --> <div id="bd"> <div id="content"> <h1>Header here</h1> <div class="topMarginned"> <div id='buildSummaryTabs' class='dashboardTab'> </div> <script type="text/javascript"> function initUI(){ var jtabs = new YAHOO.ext.TabPanel('buildSummaryTabs'); YAHOO.bamboo.tabPanel = jtabs; // Use setUrl for Ajax loading var tab3 = jtabs.addTab('allTab', "All Plans"); tab3.setUrl('/ajax/displayAllBuildSummaries.action', null, true); var tab4 = jtabs.addTab("currentTab", "Current Activity"); tab4.setUrl('/ajax/displayCurrentActivity.action', null, true); var handleTabChange = function(e, activePanel) { saveCookie('atlassian.bamboo.dashboard.tab.selected', activePanel.id, 365); }; jtabs.on('tabchange', handleTabChange); var selectedCookie = getCookieValue('atlassian.bamboo.dashboard.tab.selected'); if (jtabs.getTab(selectedCookie)) { jtabs.activate(selectedCookie); } else { jtabs.activate('allTab'); } } YAHOO.util.Event.onContentReady('buildSummaryTabs', initUI); </script> </div> <script type="text/javascript"> setTimeout( "window.location.reload()", 1800*1000 ); </script> <div class="clearer" ></div> </div> <!-- END #content --> </div> <!-- END #bd --> </div> <!-- END #nonFooter --> <div id="ft"> <div id="footer"> <p> Powered by <a href="http://www.atlassian.com/software/bamboo/">Atlassian Bamboo</a> version 2.2.1 build 1206 - <span title="15:59:44 17 Mar 2009">17 Mar 09</span> </p> <ul> <li class="first"> <a href="https://support.atlassian.com/secure/CreateIssue.jspa?pid=10060&issuetype=1">Report a problem</a> </li> <li> <a href="http://jira.atlassian.com/secure/CreateIssue.jspa?pid=11011&issuetype=4">Request a feature</a> </li> <li> <a href="http://forums.atlassian.com/forum.jspa?forumID=103">Contact Atlassian</a> </li> <li> <a href="/viewAdministrators.action">Contact Administrators</a> </li> </ul> </div> <!-- END #footer --> </div> <!-- END #ft -->

    Read the article

  • Reverse subarray of an array with O(1)

    - by Babibu
    I have an idea how to implement sub array reverse with O(1), not including precalculation such as reading the input. I will have many reverse operations, and I can't use the trivial solution of O(N). Edit: To be more clear I want to build data structure behind the array with access layer that knows about reversing requests and inverts the indexing logic as necessary when someone wants to iterate over the array. Edit 2: The data structure will only be used for iterations I been reading this and this and even this questions but they aren't helping. There are 3 cases that need to be taking care of: Regular reverse operation Reverse that including reversed area Intersection between reverse and part of other reversed area in the array Here is my implementation for the first two parts, I will need your help with the last one. This is the rule class: class Rule { public int startingIndex; public int weight; } It is used in my basic data structure City: public class City { Rule rule; private static AtomicInteger _counter = new AtomicInteger(-1); public final int id = _counter.incrementAndGet(); @Override public String toString() { return "" + id; } } This is the main class: public class CitiesList implements Iterable<City>, Iterator<City> { private int position; private int direction = 1; private ArrayList<City> cities; private ArrayDeque<City> citiesQeque = new ArrayDeque<>(); private LinkedList<Rule> rulesQeque = new LinkedList<>(); public void init(ArrayList<City> cities) { this.cities = cities; } public void swap(int index1, int index2){ Rule rule = new Rule(); rule.weight = Math.abs(index2 - index1); cities.get(index1).rule = rule; cities.get(index2 + 1).rule = rule; } @Override public void remove() { throw new IllegalStateException("Not implemented"); } @Override public City next() { City city = cities.get(position); if (citiesQeque.peek() == city){ citiesQeque.pop(); changeDirection(); position += (city.rule.weight + 1) * direction; city = cities.get(position); } if(city.rule != null){ if(city.rule != rulesQeque.peekLast()){ rulesQeque.add(city.rule); position += city.rule.weight * direction; changeDirection(); citiesQeque.push(city); } else{ rulesQeque.removeLast(); position += direction; } } else{ position += direction; } return city; } private void changeDirection() { direction *= -1; } @Override public boolean hasNext() { return position < cities.size(); } @Override public Iterator<City> iterator() { position = 0; return this; } } And here is a sample program: public static void main(String[] args) { ArrayList<City> list = new ArrayList<>(); for(int i = 0 ; i < 20; i++){ list.add(new City()); } CitiesList citiesList = new CitiesList(); citiesList.init(list); for (City city : citiesList) { System.out.print(city + " "); } System.out.println("\n******************"); citiesList.swap(4, 8); for (City city : citiesList) { System.out.print(city + " "); } System.out.println("\n******************"); citiesList.swap(2, 15); for (City city : citiesList) { System.out.print(city + " "); } } How do I handle reverse intersections?

    Read the article

  • Is it bad to have the Reverse DNS for two IPs point to the same domain name?

    - by Daniel Vandersluis
    I am in the process of setting up a new server for my domain (the site will be moved, it is not for load balancing or the like), which has a different IP address from my existing server. My current server has a reverse DNS PTR record set up pointing its IP to mydomain.com. Is it bad to set up a reverse DNS PTR record for the new IP pointing to mydomain.com as well? Or should I wait until I do my migration to set up the record?

    Read the article

  • Reverse engineering and patching a DirectX game?

    - by yodaj007
    Background I am playing Imperishable Night, one of the Touhou series of games. The shoot button is 'z', moving slower is 'shift', and the arrow keys move. Unfortunately for me, using shift-z ghosts my right arrow key, so I can't move to the right while shooting. This ghosting happens in all applications, and switching keyboards fixes it. Goal I want to locate in the disassembled code the directx function that gets the keyboard input and compares it against the 'z' key, and change that key to 'a'. I'm considering this a fun project. Assuming the size of the scan codes are the same, this should be fairly simple. And because the executable is only 400k, maybe this will provide a unique opportunity for me to explore the dark side of the computing underworld (kidding). Relevant experience I have some experience with coding in assembly, but not in the disassembly of such. I have no experience with the DirectX apis. Question I need some guidance. I've found a listing of directx keyboard scan codes, and a program called PEExplorer that looks like it will do what I need. Is there a means by which I can turn some of the assembly with C function calls so it's more easily read? I will need to locate where the game retrieves the currently pressed keys, compares those against a list, and it's that list I need to modify. Any input would be greatly appreciated.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >