pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
33,726,802 | 0 | Destroy PHP session after set amount of time (not due to inactivity) <p>I have read numerous posts about destroying a PHP session after a set amount of time, but many of the answers don't clarify whether the solution works for inactivity or for a set period of time. Let me expound.</p> <p>I am using php to generate and grade a quiz. Each question is dynamically generated and the user must hit the submit button to move on to the next question, thereby generating a request to the php script. </p> <p>I want the user to only have 15 total minutes to complete it. In other words, if it takes the user 6 minutes to do the first 3 problems, then the user has 9 minutes left to do the other 3 problems.</p> <p>If you set your inactive time to 15 minutes, then presumably the user has 15 minutes in-between requests to the webpage, correct? <a href="http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes">This</a> is the solution that this answer provides I believe.</p> <p>However, that is not what I need. I need for the session to terminate after 15 total minutes from the start, regardless of whenever the last request was made by the user.</p> <p>Thank you</p> |
8,705,962 | 1 | python: HTTP PUT with unencoded binary data <p>I cannot for the life of me figure out how to perform an HTTP PUT request with verbatim binary data in Python 2.7 with the standard Python libraries.</p> <p>I thought I could do it with urllib2, but <a href="http://stackoverflow.com/questions/7983303/python-http-put-with-binary-data">that fails</a> because <a href="http://docs.python.org/library/urllib2.html#urllib2.Request"><code>urllib2.Request</code></a> expects its data in <code>application/x-www-form-urlencoded</code> format. I do not want to encode the binary data, I just want to transmit it verbatim, after the headers that include </p> <pre><code>Content-Type: application/octet-stream Content-Length: (whatever my binary data length is) </code></pre> <p>This seems so simple, but I keep going round in circles and can't seem to figure out how. </p> <p>How can I do this? (aside from open up a raw binary socket and write to it)</p> |
38,391,669 | 0 | Lazy Load Directives in Angular2 <p>I could not really find an answer on SO about this, so if there exists a solution or even best practice about lazy loading of directives in Angular (RC4), I would be happy to hear.</p> |
6,731,094 | 0 | <p>wait... what do you mean by test script we're using rack/test right</p> <p>imho a sinatra app will be much more test-friendly if your main app class can be started independent of config.ru</p> <p>such that you can require just 'rack/test' and 'app.rb' in your test files</p> |
1,854,259 | 0 | Are there any lightweight ASP.NET MVC-based frameworks supporting OpenID? <p>I am looking for a lightweight framework that will allow me to knock out a MVC CRUD website very quickly, and I need it to support OpenID.</p> <p>Is there anything like this?</p> |
12,711,657 | 0 | <p>you can publish the code under Apache License, however the runtime would be under GPL. Got any details? </p> |
10,754,867 | 0 | xml transform using XSLT, order by alphabet in inner node <p>I have next WSDL file</p> <pre><code> <definitions targetNamespace="http://soft.com/" name="LoggingWebService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.config.softid.softcomputer.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <types> <xsd:schema> <xsd:import namespace="http://soft.com/" schemaLocation="my.xsd"/> </xsd:schema> </types> <message name="log"> <part name="parameters" element="tns:log"/> </message> <message name="getLogs"> <part name="parameters" element="tns:getLogs"/> </message> <portType name="LoggingWebService"> <operation name="log"> <input message="tns:log"/> </operation> <operation name="getLogs"> <input message="tns:getLogs"/> <output message="tns:getLogsResponse"/> </operation> </portType> </definitions> </code></pre> <p>I want transform this file using <code>javax.transformation</code> to another file, where <code>messages</code> will be ordered by alphabet (using string in 'name'). </p> <pre><code><definitions targetNamespace="http://soft.com/" name="LoggingWebService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.config.softid.softcomputer.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <types> <xsd:schema> <xsd:import namespace="http://soft.com/" schemaLocation="my.xsd"/> </xsd:schema> </types> <message name="getLogs"> <part name="parameters" element="tns:getLogs"/> </message> <message name="log"> <part name="parameters" element="tns:log"/> </message> <portType name="LoggingWebService"> <operation name="getLogs"> <input message="tns:getLogs"/> <output message="tns:getLogsResponse"/> </operation> <operation name="log"> <input message="tns:log"/> </operation> </portType> </definitions> </code></pre> <p>What XSLT file I need for this? Help me plz</p> |
37,434,135 | 0 | <p>Checkout if this can be helpful: </p> <p><a href="https://github.com/google/material-design-icons" rel="nofollow">https://github.com/google/material-design-icons</a></p> |
37,571,857 | 0 | <p>As @teleaziz suggested, you should do this only once. So such processing needs to be moved into the <code>karma-test-shim.js</code> file. Here is a sample:</p> <pre><code>System.import('@angular/platform-browser/src/browser/browser_adapter') .then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); }) .then(function() { return Promise.all([ System.import('@angular/core/testing'), System.import('@angular/platform-browser-dynamic/testing/browser') ]); }) .then(function(modules) { var testing = modules[0]; var testingBrowser = modules[1]; testing.setBaseTestProviders( testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS); }) .then(function() { return Promise.all(resolveTestFiles()); }) .then(function() { __karma__.start(); }, function(error) { __karma__.error(error.stack || error); }); </code></pre> |
40,970,335 | 0 | Writing to virtual memory in Windows without writing back to disk <p>I have to deal with a huge amount of temporary data, which I don't wish to saved to disk wasting precious space. </p> <p>Instead, I want is that I keep the data in virtual memory so that the data is only on disk temporarilly and discard it once the processing has finished. </p> <p>Neither, 'Boost memory mapping' nor, 'Windows CreateFileMapping' works this way, and In both the cases the changes affect available disk space.</p> <p>Is there any way to get it done?</p> |
19,762,320 | 0 | <p>Firstly, what this program is doing is instantiating a new thread from within your main method that prints text to the console.</p> <p>Now, the Thread class constructor accepts a class that implements the Runnable interface. We can supply a instance to the Thread constructor two ways. We can use a concrete class that implements Runnable or supply an Anonymous Inner Class. In this case you are doing the later.</p> <p>According to the Oracle Documentation on Anonymous inner classes. Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name. Use them if you need to use a local class only once.</p> <pre><code> new Thread(new Runnable() { public void run() { System.out.print("bar"); } }).start(); </code></pre> <p>So you can think of this as passing a class of the Runnable interface which satisfies the contract by overriding the run method and defining it within the constructor parameter.</p> |
24,541,133 | 0 | <p>From your error message: <code>Duplicate entry '0' for key 'PRIMARY'</code></p> <p>I'm assuming id is your primary key. Make sure you have auto increment setup on this column and then just exclude the id field completely in the query.</p> <p>Right now your inserting a blank ID. Without strict enforcement, MySQL will convert an empty value to a 0 for an integer field. So you are trying to insert into ID 0 every time rather than creating a new row.</p> <p><strong>Dangers of your query</strong></p> <p>You are using unsanitized user input in your query (GET). GET, POST, REQUEST, and COOKIE variables should always be used with prepared queries.</p> <p>Right now I could load your url with something like <code>?name="'; DELETE FROM 49 WHERE 1;"</code> and wipe out your entire table. Research SQL injections and how to use MySQLi to make prepared queries.</p> |
37,784,726 | 0 | <p>In my case problem was with Scheme.</p> <ul> <li>go to Product -> Scheme -> Edit Scheme</li> <li>click on Build</li> <li>add the Pods static library, and make sure it's at the top of the list</li> <li>clean and build again</li> </ul> |
34,530,518 | 0 | <p>I don't think that it's possible from Code > Folding or using the icons from the left bar (collapse/expand), but you can do it in a harder way: manually.</p> <p>E.g.: </p> <ul> <li>select the try block</li> <li>Code > Folding > Fold Selection / Remove Section ( <kbd>Ctrl</kbd> + <kbd>Period</kbd>, where <kbd>Period</kbd> is the <kbd>.</kbd>)</li> <li>you'll see <code>...</code> instead of that block</li> <li>now that block also has the icons for collapse/expand on the left bar</li> </ul> |
15,072,586 | 0 | <p>If you check the WSDL file for your web service, the parameter should have minOccurs=0. That's why the SOAPUI request put the optional comments there. </p> <p>Please use <code>@XmlElement(required=true)</code> to annotate your WebParam that is required.</p> |
33,950,980 | 0 | <p>Right; let's see what we have here.</p> <p>First, the code has to be blocked as follows:</p> <pre><code>variable declarations cursor declarations handler declarations everything else </code></pre> <p>So your <code>DECLARE CURSOR c2</code> <em>must</em> appear between <code>DECLARE CURSOR c1</code> and <code>DECLARE CONTINUE HANDLER</code>. Also, you only need one <code>CONTINUE HANDLER</code> because it takes effect from the point of declaration to the end of the procedure.</p> <p>Next is the statement</p> <pre><code>INSERT INTO ip_ER_subtotal SELECT Starting_Pitcher, Game_Date, Game_Number, innings_pitched, 0.0 FROM starting_pitchers_game_log; </code></pre> <p>The named columns in the <code>SELECT</code> clause are the columns you're <em>selecting from,</em> <strong>not</strong> the ones you're <em>inserting into,</em> so they have to be columns in the table <code>starting_pitchers_game_log</code>. Also, since the columns not being copied from <code>starting_pitchers_game_log</code> (that is, <code>ip_total</code>, <code>er_total</code> and <code>era</code>) all have default values, you could use a column list on the <code>INSERT</code> statement, like so:</p> <pre><code>INSERT INTO pitcher_stats_temp (Starting_Pitcher, Game_Date, Game_Number, innings_pitched, er) SELECT pitcher_id, game_date, game_seq, innings_pitched, runs FROM starting_pitchers_game_log; </code></pre> <p>This saves typing, documents which columns you're actually inserting values into and insulates your <code>INSERT</code> statement from the physical order of columns in the source and target tables.</p> <p>Next, once you finish the <code>CURSOR c1</code> loop, <strong>don't truncate the table</strong> or you'll lose all the work you've just done! <code>TRUNCATE TABLE</code> deletes all rows currently in the table, and is used here to clear out the results of the previous run.</p> <p>Finally, the two loops have to have different labels, say <code>fetch_loop_1</code> and <code>fetch_loop_2</code>. You would also need to reset <code>accum</code> and <code>end_of_cursor</code> before entering the second loop. However, in this case I believe we can do everything in one loop with one cursor, which makes the code simpler and thus easier to maintain.</p> <p>Here's the complete procedure:</p> <pre><code>DROP PROCEDURE IF EXISTS pitcher_stats_era; DELIMITER $$ CREATE PROCEDURE pitcher_stats_era() BEGIN DECLARE pit_id CHAR(10); DECLARE gdate DATE; DECLARE seq INT; DECLARE in_pit REAL; DECLARE er INT; DECLARE accum_ip REAL; DECLARE accum_er INT; DECLARE earned_run_avg REAL; DECLARE prev_year YEAR(4); DECLARE end_of_cursor BOOLEAN; DECLARE no_table CONDITION FOR SQLSTATE '42S02'; DECLARE c1 CURSOR FOR SELECT pitcher_id, game_date, game_seq, innings_pitched, earned_runs FROM pitcher_stats_temp ORDER BY pitcher_id, game_date, game_seq; DECLARE CONTINUE HANDLER FOR NOT FOUND SET end_of_cursor := TRUE; DECLARE EXIT HANDLER FOR no_table BEGIN SIGNAL no_table SET MESSAGE_TEXT = "Work table not initialized. Please call pitcher_stats_reset() before continuing", MYSQL_ERRNO = 1146; END; ------------------------------------------------------------------ -- The following steps are now performed by pitcher_stats_reset() ------------------------------------------------------------------ -- TRUNCATE TABLE ip_subtotal; -- Clear our work table for a new run -- Copy data from main table into work table -- INSERT INTO ip_subtotal -- (pitcher_id, game_date, game_seq, innings_pitched, earned_runs) -- SELECT pitcher_id, game_date, game_seq, -- IFNULL(innings_pitched, 0), -- replace NULL with 0, if -- IFNULL(runs, 0) -- column not initialized -- FROM starting_pitchers_game_log; --------------------------------------------------------------------- SET end_of_cursor := FALSE; -- reset SET prev_year := 0; -- reset control-break OPEN c1; fetch_loop: LOOP FETCH c1 INTO pit_id, gdate, seq, in_pit, er; IF end_of_cursor THEN LEAVE fetch_loop; END IF; -- check control-break conditions IF YEAR(gdate) != prev_year THEN SET accum_ip := 0.0; SET accum_er := 0; SET prev_year := YEAR(gdate); END IF; SET accum_ip := accum_ip + in_pit; SET accum_er := accum_er + er; IF accum_er = 0 THEN -- prevent divide-by-zero SET earned_run_avg := 0; ELSE SET earned_run_avg := (accum_ip / accum_er) * 9; END IF; UPDATE pitcher_stats_temp SET ip_total = accum_ip, er_total = accum_er, std_era = earned_run_avg WHERE pitcher_id = pit_id AND game_date = gdate AND game_seq = seq; END LOOP; CLOSE c1; END $$ DELIMITER ; </code></pre> <p>That should do the job. If anyone finds a bug, by all means please point it out.</p> <p>EDIT: I've just added some code to illustrate how to protect against nulls coming from the source table, and how to avoid a divide-by-zero on the ERA calculation.</p> <p>EDIT: I've changed back to my original column and table names in order to reduce my own confusion.</p> <p>EDIT: Code changed to be consistent with the answer to <a href="http://stackoverflow.com/questions/33988958/how-can-i-add-a-column-to-a-work-table-using-a-new-stored-procedure">How can I add a column to a work table using a new stored procedure</a></p> |
4,705,427 | 0 | <p>Here is some quick'n'dirty code I could come up with. I will refine this, but as a POC this works...</p> <pre><code>public class PrioritisedLock { private List<CountdownEvent> waitQueue; //wait queue for the shared resource private Semaphore waitQueueSemaphore; //ensure safe access to wait queue itself public PrioritisedLock() { waitQueue = new List<CountdownEvent>(); waitQueueSemaphore = new Semaphore(1, 1); } public bool WaitOne(int position = 0) { //CountdownEvent needs to have a initial count of 1 //otherwise it is created in signaled state position++; bool containsGrantedRequest = false; //flag to check if wait queue still contains object which owns the lock CountdownEvent thisRequest = position<1 ? new CountdownEvent(1) : new CountdownEvent(position); int leastPositionMagnitude=Int32.MaxValue; waitQueueSemaphore.WaitOne(); //insert the request at the appropriate position foreach (CountdownEvent cdEvent in waitQueue) { if (cdEvent.CurrentCount > position) cdEvent.AddCount(); else if (cdEvent.CurrentCount == position) thisRequest.AddCount(); if (cdEvent.CurrentCount == 0) containsGrantedRequest = true; } waitQueue.Add(thisRequest); foreach (CountdownEvent cdEvent in waitQueue) if (cdEvent.CurrentCount < leastPositionMagnitude) leastPositionMagnitude = cdEvent.CurrentCount; //If nobody holds the lock, grant the lock to the current request if (containsGrantedRequest==false && thisRequest.CurrentCount == leastPositionMagnitude) thisRequest.Signal(leastPositionMagnitude); waitQueueSemaphore.Release(); //now do the actual wait for this request; if it is already signaled, it ends immediately thisRequest.Wait(); return true; } public int Release() { int waitingCount = 0, i = 0, positionLeastMagnitude=Int32.MaxValue; int grantedIndex = -1; waitQueueSemaphore.WaitOne(); foreach(CountdownEvent cdEvent in waitQueue) { if (cdEvent.CurrentCount <= 0) { grantedIndex = i; break; } i++; } //remove the request which is already fulfilled if (grantedIndex != -1) waitQueue.RemoveAt(grantedIndex); //find the wait count of the first element in the queue foreach (CountdownEvent cdEvent in waitQueue) if (cdEvent.CurrentCount < positionLeastMagnitude) positionLeastMagnitude = cdEvent.CurrentCount; //decrement the wait counter for each waiting object, such that the first object in the queue is now signaled foreach (CountdownEvent cdEvent in waitQueue) { waitingCount++; cdEvent.Signal(positionLeastMagnitude); } waitQueueSemaphore.Release(); return waitingCount; } } </code></pre> <p>}</p> |
23,620,004 | 0 | How can I select a specific jquery element value from inside a loop? <p>I am trying to put a string value in an array based on their position in relation to all of the elements with a class name. I get an array of the indexes that I want to use now I want to use each of the index values to select the appropriate value. </p> <pre><code>$(function () { $("#date").datepicker(); $('input[name=date]').datepicker(); var dateInput = $("select[name='searchString']"); var theClassTime = $("input.TextBoxDate"); var checkedindex = []; var classday = []; $("input[name='selectedCourses']").each(function (i) { if (this.checked) { // this works fine checkedindex.push(parseInt(i)); // this is where I’m trying to select values based on index. var dayofclass = $(".TextBoxDate:eq(" + checkedindex[i] + ")"); classday.push(dayofclass); alert(classday); } }); }); </code></pre> <p>Say checkedindex has values: 2,3,9 meaning at index 0 of checkedindex is 2, at 1=3 and at 2=9. I want to use 2, 3 and 9 to do something like this:</p> <pre><code>var dayofclass = $(".TextBoxDate:eq(" + checkedindex[i] + ")"); </code></pre> <p>What am I doing wrong here?</p> |
34,432,416 | 0 | <p>You can do something like as</p> <pre><code>$get = "19 March"; $given_date = "01 January 2010"; $date_month = date('d F',strtotime($given_date)); $year = date('Y',strtotime($given_date)); if(strtotime($given_date) - strtotime($date_month) < 0){ echo date('l,d F Y',strtotime("$get $year")); }else{ echo date('l,d F Y',strtotime("$get ".($year+1))); } </code></pre> |
24,355,862 | 0 | <p>You <em>are</em> looping through the arrays. The <code>puts</code> function on its own just makes that difficult to see. Try this:</p> <pre><code>arrays = [[1, 52], [30, 1], [2, 1]] arrays.each do |array| puts array.inspect end </code></pre> <p>Output:</p> <pre><code>[1, 52] [30, 1] [2, 1] </code></pre> <hr> <p>See also:</p> <pre><code>puts [1, 2, 3] </code></pre> <p>Output:</p> <pre><code>1 2 3 </code></pre> |
6,287,258 | 0 | <p>Few points:</p> <ul> <li><p>Make sure you have git.exe on path. Do a <code>where git</code> and you must get something like </p> <pre><code>C:\Program Files (x86)\Git\bin\git.exe </code></pre> <p>If git.cmd is being used ( from C:\Program Files (x86)\Git\cmd\git.cmd ), you have to do <code>call git pull</code> for it to continue execution. I would say add <code>git.exe</code> to path and start using it.</p></li> <li><p>Even on Windows, you must have the shebang - <code>#!/bin/sh</code> for the hooks to properly run.</p></li> <li><p>If you want a hook to run on pull, you probably want to use the <code>post-merge</code> hook. <code>post-receive</code> and <code>post-update</code> run on remote repos when you push to them.</p></li> </ul> |
22,484,993 | 0 | <p>Using <code>NeighborSearch</code> is definitely the right idea - it constructs a <a href="https://en.wikipedia.org/wiki/K-d_tree" rel="nofollow">k-d tree</a>, which performs very fast lookups on nearest neighbors.</p> <p>If you have just a few residues to search around, I would use the <a href="http://www.biopython.org/DIST/docs/api/Bio.PDB.NeighborSearch.NeighborSearch-class.html#search" rel="nofollow"><code>search()</code></a> method on those residues' atoms (perhaps just their CA atoms for speed). This will be more efficient than using <code>search_all()</code> then filtering. I'll answer your two questions, then provide a complete solution at the bottom.</p> <hr> <blockquote> <p>How can I just create the atom_list using CA atoms only?</p> </blockquote> <p>You can either use <a href="http://docs.python.org/2.7/library/functions.html#filter" rel="nofollow"><code>filter</code></a>, or a list comprehension (I think list comprehensions are more readable):</p> <pre><code>atom_list = [atom for atom in structure.get_atoms() if atom.name == 'CA'] </code></pre> <hr> <blockquote> <p>Second, is <code>residuepair[0].id[1]</code> the correct way of generating the residue numbers (it works but is there a method to get this)?</p> </blockquote> <p>This is definitely the right approach. <em>However</em> (and this is a significant caveat), note that this will not handle residues with <a href="http://deposit.rcsb.org/adit/docs/pdb_atom_format.html#ATOM" rel="nofollow">insertion codes</a>. Why not deal with the <code>Residue</code> objects themselves?</p> <hr> <p>My code:</p> <pre><code>from Bio.PDB import NeighborSearch, PDBParser, Selection structure = PDBParser().get_structure('X', "1xxx.pdb") chain = structure[0]['A'] # Supply chain name for "center residues" center_residues = [chain[resi] for resi in [100, 140, 170, 53]] center_atoms = Selection.unfold_entities(center_residues, 'A') atom_list = [atom for atom in structure.get_atoms() if atom.name == 'CA'] ns = NeighborSearch(atom_list) # Set comprehension (Python 2.7+, use `set()` on a generator/list for < 2.7) nearby_residues = {res for center_atom in center_atoms for res in ns.search(center_atom.coord, 10, 'R')} # Print just the residue number (WARNING: does not account for icodes) print sorted(res.id[1] for res in nearby_residues) </code></pre> |
40,420,177 | 0 | <p>There's not really well defined method of doing this - it's more of a manual task, defining how to transform the data. A form of ETL (Extract, Transform and Load) as it were.</p> <p>Start with your base tables and write some insert statements to get the core data in there, transformed as applicable. Then move onto the "next level" of related data and repeat until all of your info is copied over.</p> <p>Note that often times the new, ideal schema cannot be fully implemented (with all constraints, etc) with the legacy database as some pieces of information may be missing. In these cases you have to either a) generate the data as required during the load, or b) turn off constraints so you can load the legacy data until such data is cleaned up enough to enforce them.</p> <p>All in all, it's a very per-scenario type of thing that tends to be handled manually in most cases. To the best of my knowledge, anyway.</p> <p>Finally, it's been a while since I worked with MySQL, but most database engines allow for two-part naming of some sort, so you can access two separate databases (on the same server) from within a single script, so your insert statements might end up looking like this:</p> <pre><code>INSERT INTO newdb.newtable (thisfield, thatfield) SELECT thisfield, thatfield FROM olddb.oldtable; </code></pre> <p>(with applicable transformations applied, of course)</p> |
18,526,985 | 0 | jquery single each() function for both radio and checkboxes <p>I'm having requirement that to check each radio button and checkbox of same div that was checked/unchecked. I tried this and found some what uneasy to have too separate loops.</p> <pre><code> { $('#div1 input[type=radio]').each(...); } </code></pre> <p>and </p> <pre><code> { $('#div1 input[type=CHECKBOX]').each(...); } </code></pre> <p>Instead of calling 2 methods, how can I use single each function for both types?</p> <pre><code> { //Like $('#div input[type=radio || CHECKBOX]') } </code></pre> |
92,941 | 0 | <p>It's just a convention. Structs can be created to hold simple data but later evolve time with the addition of member functions and constructors. On the other hand it's unusual to see anything other than public: access in a struct.</p> |
37,813,940 | 0 | <p>You need to set :</p> <pre><code>tableView.rowHeight = UITableViewAutomaticDImension </code></pre> <p>and </p> <pre><code>tableView.estimatedRowHeight = 44.0 </code></pre> |
40,859,730 | 0 | create .ipa using command line tool with dynamic app icon <p>I want to create an <code>.ipa</code> file for an iOS project with different base URL, app icon images and splash images using command line tool or else.</p> <p>Is it feasible by which we can change app icons and splash images from some uploaded directories.</p> <p>Like an admin panel, in which a table is shown where multiple sizes of app icon images can be upload and same as splash.</p> <p>And there will be button to create IPA for a project.</p> |
23,502,087 | 0 | <p>We ran into this and after a lot of time trying to debug, I came across this: <a href="https://code.google.com/p/go/source/detail?r=d4e1ec84876c" rel="nofollow">https://code.google.com/p/go/source/detail?r=d4e1ec84876c</a></p> <blockquote> <p>This shifts the burden onto clients to read their whole response bodies if they want the advantage of reusing TCP connections.</p> </blockquote> <p>So be sure you read the entire body before closing, there are a couple of ways to do it. This function can come in handy to close to let you see whether you have this issue by logging the extra bytes that haven't been read and cleaning the stream out for you so it can reuse the connection:</p> <pre><code>func closeResponse(response *http.Response) error { // ensure we read the entire body bs, err2 := ioutil.ReadAll(response.Body) if err2 != nil { log.Println("Error during ReadAll!!", err2) } if len(bs) > 0 { log.Println("Had to read some bytes, not good!", bs, string(bs)) } return response.Body.Close() } </code></pre> <p>Or if you really don't care about the body, you can just discard it with this:</p> <pre><code>io.Copy(ioutil.Discard, response.Body) </code></pre> |
20,193,771 | 0 | <p>From error description you provided I can see that:</p> <p>During linking phase for Intel 64bit architecture _OBJC_CLASS_$MYFramework symbol was not found. Which is quite strange as you sure you compiling for arm architecture. Maybe you should revise Makefiles of your framework?</p> <p>Have a look <a href="http://stackoverflow.com/questions/18913906/xcode-5-and-ios-7-architecture-and-valid-architectures">here</a> Shell you make target IOS7 32bit?</p> |
32,050,895 | 0 | <p>This may help.</p> <pre><code>import re string = 'account_id 37318 not found' match = re.search(r'\baccount_id\b.*?\bnot found\b',string) if match: print 'Do something' else: print 'Do nothing' </code></pre> <p>Let me know if it helps :).</p> |
6,761,975 | 0 | <p>You could do it like this</p> <pre><code>sed -ne '/$engineinfo = engine_getinfo();/a\'$'\n''$engineinfo['engine']="asterisk";\'$'\n''$engineinfo['version']="1.6.2.11";'$'\n'';p' /var/lib/asterisk/bin/retrieve_conf </code></pre> <p>Add <code>-i</code> for modification in place once you confirm that it works.</p> <p>What does it do and how does it work?</p> <p>First we tell sed to match a line containing your string. On that matched line we then will perform an <code>a</code> command, which is "append text". </p> <p>The syntax of a sed <code>a</code> command is</p> <pre><code>a\ line of text\ another line ; </code></pre> <p>Note that the literal newlines are part of this syntax. To make it all one line (and preserve copy-paste ability) in place of literal newlines I used <code>$'\n'</code> which will tell bash or zsh to insert a real newline in place. The quoting necessary to make this work is a little complex: You have to exit single-quotes so that you can have the <code>$'\n'</code> be interpreted by bash, then you have to re-enter a single-quoted string to prevent bash from interpreting the rest of your input.</p> <p>EDIT: Updated to append both lines in one append command.</p> |
35,945,228 | 0 | Find 4 minimal values in 4 __m256d registers <p>I cannot figure out how to implement:</p> <pre><code>__m256d min(__m256d A, __m256d B, __m256d C, __m256d D) { __m256d result; // result should contain 4 minimal values out of 16 : A[0], A[1], A[2], A[3], B[0], ... , D[3] // moreover it should be result[0] <= result[1] <= result[2] <= result[2] return result; } </code></pre> <p>Any ideas of how to use <code>_mm256_min_pd</code>, <code>_mm256_max_pd</code> and shuffles/permutes in a smart way?</p> <p>==================================================</p> <p>This where I got so far, after:</p> <pre><code> __m256d T = _mm256_min_pd(A, B); __m256d Q = _mm256_max_pd(A, B); A = T; B = Q; T = _mm256_min_pd(C, D); Q = _mm256_max_pd(C, D); C = T; D = Q; T = _mm256_min_pd(B, C); Q = _mm256_max_pd(B, C); B = T; C = Q; T = _mm256_min_pd(A, B); Q = _mm256_max_pd(A, B); A = T; D = Q; T = _mm256_min_pd(C, D); Q = _mm256_max_pd(C, D); C = T; D = Q; T = _mm256_min_pd(B, C); Q = _mm256_max_pd(B, C); B = T; C = Q; </code></pre> <p>we have : A[0] < B[0] < C[0] < D[0], A[1] < B[1] < C[1] < D[1], A[2] < B[2] < C[2] < D[2], A[3] < B[3] < C[3] < D[3],</p> <p>so the minimal value is among A's, second minimal is among A's or B's, ... Not sure where to go from there ...</p> <p>========================================================</p> <p>Second idea is that the problem is reducible to itself, but with 2 input __m256 elements. If this can be done, then just do min4(A,B) --> P, min4(C,D) --> Q, min4(P,Q) --> return value.</p> <p>No idea how to that for two vectors though :)</p> <p>=======================================================================</p> <p>Update 2 : problem almost solved -- the following function computes 4 minimal values.</p> <pre><code>__m256d min4(__m256d A, __m256d B, __m256d C, __m256d D) { __m256d T; T = _mm256_min_pd(A, B); B = _mm256_max_pd(A, B); B = _mm256_permute_pd(B, 0x5); A = _mm256_min_pd(T, B); B = _mm256_max_pd(T, B); B = _mm256_permute2f128_pd(B, B, 0x1); T = _mm256_min_pd(A, B); B = _mm256_max_pd(A, B); B = _mm256_permute_pd(B, 0x5); A = _mm256_min_pd(A, B); T = _mm256_min_pd(C, D); D = _mm256_max_pd(C, D); D = _mm256_permute_pd(D, 0x5); C = _mm256_min_pd(T, D); D = _mm256_max_pd(T, D); D = _mm256_permute2f128_pd(D, D, 0x1); T = _mm256_min_pd(C, D); D = _mm256_max_pd(C, D); D = _mm256_permute_pd(D, 0x5); C = _mm256_min_pd(C, D); T = _mm256_min_pd(A, C); C = _mm256_max_pd(A, C); C = _mm256_permute_pd(C, 0x5); A = _mm256_min_pd(T, C); C = _mm256_max_pd(T, C); C = _mm256_permute2f128_pd(C, C, 0x1); T = _mm256_min_pd(A, C); C = _mm256_max_pd(A, C); C = _mm256_permute_pd(C, 0x5); A = _mm256_min_pd(A, C); return A; }; </code></pre> <p>All that remains is to sort the values in increasing order inside A before return.</p> |
11,585,955 | 0 | <p>Ideally you have a static and perhaps a non-static <code>create()</code> functions. There is a clever way to accomplish this.</p> <ol> <li><p>Define a <code>SuperBase</code> class. It needs a virtual destructor and a pure virtual <code>create()</code> function. You'll use pointers/references to this class for normal late-binding OOP behaviours.</p></li> <li><p>Define a <code>Base</code> class template that inherits from <code>SuperBase</code>. <code>Base</code>'s template parameter will be the type of the <code>Derived</code> class. <code>Base</code> will also have a traits class template with a static function called <code>create()</code>. This static <code>create()</code> function will create a default object with <code>new</code>. Using the trait's <code>create()</code> function, <code>Base</code> will define both a <code>static_create()</code> and the pure virtual <code>SuperBase::create()</code> functions.</p></li> <li><p>Implement <code>Derived</code> by inheriting from <code>Base<Derived></code>.</p></li> </ol> <p>One this is done, if you know you are using a derived type, then you can write <code>Derived::create()</code> to statically create a new one. If not, then you can always use an instance's <code>create()</code> method. Polymorphism is not broken since <code>SuperBase</code> would have the polymorphic interface you need/want --<code>Base<D></code> is simply a helper class that auto defines the <code>static_create()</code> and <code>create()</code> functions so you would not normally use <code>Base<D></code> directly.</p> <p>Sample code appears below:</p> <pre><code>#include <memory> #include <iostream> class SuperBase { public: virtual ~SuperBase() = default; virtual std::shared_ptr<SuperBase> create() const = 0; }; template <typename T> struct Base_Traits { static T* create() { return new T; } }; template <typename Derived, typename Traits=Base_Traits<Derived>> class Base : public SuperBase { public: // Define a static factory function... static std::shared_ptr<SuperBase> static_create() { return std::shared_ptr<SuperBase>{Traits::create()}; } // Define pure virtual implementation... std::shared_ptr<SuperBase> create() const override { return static_create(); } }; class Derived : public Base<Derived> { }; int main() { auto newone = Derived::static_create(); // Type known @ compile time auto anotherone = newone->create(); // Late binding; type not known @ compile time } </code></pre> |
40,710,336 | 0 | |
2,380,518 | 0 | <p>I'm not sure I understand the question correctly so forgive me if my answer is off. From what I understand you want to send non-POD datatypes using MPI. </p> <p>A library that can do this is <a href="http://www.boost.org/doc/libs/1_42_0/doc/html/mpi.html" rel="nofollow noreferrer">Boost.MPI</a>. It uses a serialization library to send even very complex data structures. There is a catch though: you will have to provide code to serialize the data yourself if you use complicated structures that Boost.Serialize does not already know about.</p> <p>I believe message passing is typically used to transmit POD datatypes.</p> <p>I'm not allowed to post more links so here is what I wanted to include:</p> <p>Explanation of POD: www.fnal.gov/docs/working-groups/fpcltf/Pkg/ISOcxx/doc/POD.html</p> <p>Serialization Library: www.boost.org/libs/serialization/doc</p> |
13,159,428 | 0 | <p>Note that <strong>armv6</strong> was deprecated when iPhone 5 go out.</p> <blockquote> <p><strong>Xcode 4.5</strong> doesn't permit you to buil an ipa for armv6 devices (iphone 3G), only for armv7 and armv7s.<br> And <strong>Xcode < 4.5</strong> doesn't permit you to build an armv7s... How you can made it all toghether?</p> </blockquote> <p>The sync error come on iphone 3G? If yes, it's normal, your ipa is not compatible with this phone...</p> |
21,045,496 | 0 | <p>The output will be :</p> <pre><code> /url/absolute/depending.on.urls.py </code></pre> <p>To use it with an "a" just do :</p> <pre><code><a href="{% url 'polls:detail' poll.id %}">Poll {{ poll.id }}</a> </code></pre> |
33,170,208 | 0 | ng-attr where the attribute has a dash <p>I need to use angular to evaluate an attribute value. The catch is that this attribute value has a dash (-).</p> <p>In short, I need:</p> <pre><code><div ng-attr-my-attribute="{{5+5}}"></div> </code></pre> <p>To render into:</p> <pre><code><div my-attribute="10"></div> </code></pre> <p>What actually happens is the DOM just shows this verbatim:</p> <pre><code><div ng-attr-my-attribute="{{5+5}}"></div> </code></pre> <p>I feel like I need to use ng-attr because when I don't, for example:</p> <pre><code><div my-attribute="{{5+5}}"></div> </code></pre> <p>renders exactly as:</p> <pre><code><div my-attribute="{{5+5}}"></div> </code></pre> <p>Using angular 1.4.1</p> <p>Question: How to use <code>ng-attr</code> with an attribute that has a dash in it? </p> |
29,092,910 | 0 | itext pdf PageSize.LEGAL_LANDSCAPE.rotate() does not print <p>I have created a program to write pdf having two page, first page is portrait and second one is landscape. It creates pdf but when I print that file it does not print second page i.e. landscape page.</p> <p>Below is my code</p> <pre><code>/******************/ import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Element; import com.itextpdf.text.PageSize; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; import java.io.FileNotFoundException; import java.io.FileOutputStream; public class TestPDF { public static void main(String args[]) throws DocumentException, FileNotFoundException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("/home/devang/test.pdf")); document.setMargins(10.0f, 10.0f, 20.0f, 2.0f); document.open(); //PAGE1 addFirstPage(document); //PAGE2 addSecondPage(document); document.close(); } public static Document addFirstPage(Document document) throws DocumentException { document.addTitle("Test PDF"); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.add("Page 1"); paragraph.add("\nPage 1"); paragraph.add("\nPage 1"); paragraph.add("\nPage 1"); paragraph.add("\nPage 1"); document.add(paragraph); return document; } public static Document addSecondPage(Document document) throws DocumentException { document.setPageSize(PageSize.LEGAL_LANDSCAPE.rotate()); document.newPage(); document.addTitle("Test PDF"); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.add("Page 2"); paragraph.add("\nPage 2"); paragraph.add("\nPage 2"); paragraph.add("\nPage 2"); paragraph.add("\nPage 2"); document.add(paragraph); return document; } } </code></pre> <p>Thanks in advance.</p> |
33,098,060 | 0 | <p>You can get column in string by following static method and appending row number to result column String</p> <pre><code>ColString= CellReference.convertNumToColString(columnIdex) </code></pre> |
30,544,241 | 0 | $http.get method of angularJS doesnot accept 5th parameter in URL string <p>i am developing mobile application in cordova+angularJS in ionic framework. I am trying to send parameters in the get request body that is probably the request to get specific data based on input parameters. My query string is this:</p> <pre><code>var queryString = base_url + "get/requestChartData.php?userid=" + window.localStorage.userid + "&token=" + token + "&formid=" + formID + "&questionid=" + questionID + "&chart=" + chartType; $http.get(queryString, {}).success(function (data, status, headers, config) { ..... ... </code></pre> <p>This request when i send to the server where PHP handles the request, send me back response as <code><b>Notice</b>: Undefined index: chart in....</code></p> <p>and even on my firebug debugging console, on the get request link when i expand, it shows me only four parameters instead of five.</p> <p>is there any limit of sending number of parameters in the get request as a query string???</p> <p>at PHP side i am doing this:</p> <pre><code>$userid = trim($_REQUEST['userid']); $formid = trim($_REQUEST['formid']); $fieldName = trim($_REQUEST['questionid']); $chartType = trim($_REQUEST['chart']); $token = trim($_REQUEST['token']); </code></pre> <p>i am not getting this one any resolution to it????</p> |
18,261,260 | 0 | <p>You can use one of the following.</p> <pre><code>expr length "$*" echo "$*" | awk '{print length}' </code></pre> |
25,528,559 | 0 | Resize text to totally fill container <p>I have a <code>div</code> with a fixed height and a fluid width (15% of <code>body</code> width). I want the paragraph text inside to totally fill the <code>div</code>; not overflow and not underfill.</p> <p>I've tried with jQuery to increment the text size until the height of the paragraph is equal to the height of the container <code>div</code>. At that point, the text should be totally covering the <code>div</code>. The only problem is that font-size increments in 0.5px values. You can't do 33.3px; it has to be either 33.0px or 33.5px. So at 33px, my text is far too short to cover the <code>div</code>, and at 33.5px it overflows.</p> <p>Does anyone have any ideas on how to remedy this? There are lots of plugins for making text fill the whole width of a container, but not for text that has to fill both the width and height. At least, none that I've seen.</p> <pre><code><head> <style type="text/css"> .box { display:block; position:relative; width:15%; height:500px; background:orange; } .box p { background:rgba(0,0,0,.1); /* For clarity */ } </style> </head> <body> <div class="box"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <br><br> Suspendisse varius nibh quis urna porttitor, pharetra elementum nisl egestas. Suspendisse libero lacus, faucibus id convallis sit amet, consequat vitae odio.</p> </div> <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script> <script type="text/javascript"> function responsiveText(){ var i = 0.5; do { $(".box p").css("font-size",(i) + "px"); var textHeight = $(".box p").height(), containerHeight = $(".box").height(); i += 0.5; } while ( textHeight < containerHeight ); // While the height of the paragraph block is less than the height of the container, run the do...while loop. } responsiveText(); $(window).resize(function(e) { responsiveText(); }); </script> </body> </code></pre> <p><img src="https://i.stack.imgur.com/BGz0d.jpg" alt="Text set at 33px. It is too short."> Text set at 33px. It is too short.</p> <p><img src="https://i.stack.imgur.com/NVyrT.jpg" alt="Text set at 33.5px. It overflows."> Text set at 33.5px. It overflows.</p> |
28,398,167 | 0 | <p>It is hard to figure out exactly what you're really asking.</p> <p>Running <code>eval()</code> on user generated content (which it appears you are doing) does bring into play all sorts of security risks because it allows user generated code to be injected right into a context that it might not normally be able to get into. That is what it is and there is nothing you can do to change it. If you're going to run arbitrary user code (no matter how you do it), you will have this risk.</p> <p>What most sites that want to run arbitrary user generated code do is they fence off the user generated code in a different domain that due to the browser's cross-origin restrictions that domain that runs user generated code cannot freely access the rest of the page that is housed in some other domain and cannot freely access your main server. This gives you some protection. Look carefully at what jsFiddle does and you will see this technique being used as the user's code is served into an iframe from <code>http://fiddle.jshell.net</code> which is different than the other frames that make the site work which comes from <code>http://jsfiddle.net</code>. jsFiddle is also using some sandbox capabilities for the iframe.</p> <p>In the newest browsers you can also set up additional cross frame security restrictions with the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox" rel="nofollow">sandbox capabilities</a> (newest generation browsers only).</p> |
23,728,415 | 0 | <p>I was able to fix this problem by deleting my eclipse files, and other associated files. Then re-installing them. This fixed the error. I am sure there is a better way of doing this (I hope so anyway) but this will work.</p> |
16,076,586 | 0 | How to establish Asynchronous Process in MVC3? <p>I am using MVC3 and Entity Framework.</p> <p>In my project, I have a view and a controller. From my view I am importing 1000 records from excel to the database and that works fine.</p> <p>My requirement is, while inserting large rows of data to the database I need to indicate<br> the status of the importing rows and the % of loading completed and need to add background process( thread).. How to achieve this one? Need Help on this.</p> <p>View Code:</p> <pre><code>@using (Html.BeginForm("FImport", "Import", FormMethod.Post, new { enctype = "multipart/form-data" })) { //Here i'm Inserting 1000 of records using table <input type="submit" value="Start Import" /></td> } </code></pre> <p>Controller Code:</p> <pre><code>[HttpPost] public ActionResult FImport(FormCollection collection) { } </code></pre> <p>How to do that?</p> |
29,576,337 | 1 | Writing to file overwrites the contents <p>So when I run this code it works perfectly, but it overwrites the previous times in the <code>stopwatch_times.txt</code> so, I searched high and low but <code>couldn't</code> find out how to do it.</p> <pre><code>#!/usr/bin/python import time var_start = input("Press Enter To START The stopwatch") t0 = time.time() var_stop = input("Press Enter to STOP The stopwatch") stopwatch_time = round(time.time() - t0,2) stopwatch_time = str(stopwatch_time) file_ = open("stopwatch_times.txt") with open('stopwatch_times.txt', 'w') as file_: file_.write(stopwatch_time) print ("Stopwatch stopped - Seconds Elapsed : ",round(time.time() - t0,2)) </code></pre> |
15,414,753 | 0 | Shared memory between C++ and Java processes <p>My aim is to pass data from a C++ process to a Java process and then to receive a result back.</p> <p>I have achieved this via a named pipe but I would prefer to share the data rather than passing or copying it, assuming the access would be faster.</p> <p>Initially, I thought of creating a shared segment in C++ that I could write to and read with Java, but I'm not sure if this is possible via JNI, let alone safe.</p> <p>I believe it's possible in Java to allocate the memory using ByteBuffer.allocateDirect and then use GetDirectBufferAddress to access the address in C++, but if I'm correct this is for native calls within JNI and I can't get this address in my C++ process?</p> <p>Lost.</p> <p>Many thanks in advance.</p> |
28,779,717 | 0 | Why this Java program hangs (asynchronous html downloader)? <p>Could you please tell me why this Java program hangs ? It's a simple program to download HTML asynchronously using ExecutorCompletionService. I tried to use <code>executor.shutdown()</code> and <code>completionService.shutdown()</code> but both give <code>no such method</code>. I think the problem is with <code>executor</code> and <code>completionService</code> but can't figure out how to stop them not using their shutdown method. </p> <pre><code>import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.concurrent.*; class Main { public static void main(String[] args) throws Exception { Executor executor = Executors.newFixedThreadPool(2); CompletionService<String> completionService = new ExecutorCompletionService<>(executor); completionService.submit(new GetPageTask(new URL("http://xn--80adxoelo.xn--p1ai/")));//slow web site completionService.submit(new GetPageTask(new URL("http://example.com"))); Future<String> future = completionService.take(); System.out.println(future.get()); Future<String> future2 = completionService.take(); System.out.println(future2.get()); } } final class GetPageTask implements Callable<String> { private final URL url; GetPageTask(URL url) { this.url = url; } private String getPage() throws Exception { final BufferedReader reader = new BufferedReader(new InputStreamReader(this.url.openStream())); String str = ""; String line; while ((line = reader.readLine()) != null) { str += line + "\n"; } reader.close(); return str; } @Override public String call() throws Exception { return getPage(); } } </code></pre> |
13,306,274 | 0 | <p>Call flush() before closing the FileOutputStream.</p> |
1,519,662 | 0 | iPod controls will exit my application <p>I would like to allow controlling the iPod on top of my application when the user double taps the home button. I know there are a few apps out there that allow this. Unfortunately my app just quits.</p> <p>Do I have to set anything to allow this behavior? Is it possible that my app prevents the iPod app from showing above it because it also plays a sound from time to time?</p> |
13,974,013 | 0 | <p>I think that it isn't possible...</p> <p>I can only suggest to you something that can give you something to getting started on it.</p> <p><a href="http://stackoverflow.com/questions/4742477/jquery-on-a-big-html-with-scroll-how-to-capture-only-the-visible-part-of-the-h">Jquery, on a big HTML with scroll, how to capture only the visible part of the HTML?</a></p> <p>or you can use this plug-in:</p> <p><a href="http://larsjung.de/fracs/" rel="nofollow">jQuery.fracs</a>, see the demo: <a href="http://larsjung.de/fracs/0.11/demo/" rel="nofollow">demo</a></p> <p>Probably if you want to show a portion of HTML and get only this visible part you must think up something and probably you can't use iFrame.</p> |
14,729,119 | 0 | How do I use Svgeezy? (SVG fallback) <p>I'm trying to switch out the SVG images I am using to PNG on browsers that don't support them - namely IE8/7 and old versions of Android.</p> <p>After a lot of looking, I think I've found the tool for the job - <a href="https://github.com/benhowdle89/svgeezy" rel="nofollow">svgeezy</a> - The issue is, I have no idea how to use it! (I don't understand the tiny documentation given) </p> <p>I'd really appreciate it if someone could explain it to like I'm two, I ahve no idea where to begin (I'm new at this) :)</p> <p>p.s - I know there are other ways of doing it, but I was having all kinds of trouble with using the SVGs as a background, I want to avoid that way of doing it.</p> <p>Thanks :)</p> |
25,974,367 | 0 | <p>Can you provide js fiddle. Actually I am not able to add a comment to your question so I have to write this as an answer.</p> |
38,583,662 | 0 | Database system for many read/writes per second <p>I'm going to write my project in the client-server architecture. The main part of the system will be a database storage. There will be tens of thousands read/write requests per second. The raw structure of database will be very simple and can be even simplified to the key-value pairs. I'm going to use one of the NoSql database for this purpose. I need your architectural advice if it will be suitable for such case. Now I think about Apache Couch DB or Mongo DB. What is your experience in this area? Thank you for any knowledge sharing.</p> |
4,386,925 | 0 | <p>Unfortunately, we don't have the FindAncestor mode on the RelativeSource markup extension that WPF has, so you can't use that (this will be added in Silverlight 5). It's nasty, but you can give your UserControl element a name, and use ElementName binding to bind to the command on the object assigned to its DataContext.</p> <p>For example:</p> <pre><code><UserControl Name="root"> </code></pre> <p>Then bind the command (using dot notation from the DataContext of the UserControl):</p> <pre><code>Command="{Binding Path=DataContext.MyCommand, ElementName=root}" </code></pre> <p>Give that a try.</p> |
11,077,922 | 0 | <h3>TL;DR</h3> <p>No branch heads exist yet.</p> <h3>Detailed Explanation</h3> <p>A Git repository has no branches until you make your first commit. A newly-initialized repository sets HEAD to refs/heads/master, but refs/heads/master won't exist or contain a commit pointer until after the first commit is made.</p> <p>During a commit, Git dereferences the symbolic-ref HEAD to find the head of the current branch, and then updates that head with the commit hash supplied by git-commit-tree.</p> <p>The end result is that <code>git branch</code> has nothing to report in a new repository. With no branch heads present, it simply terminates silently with an exit status of zero.</p> <h3>See Also</h3> <ul> <li>git-branch(1)</li> <li>git-commit-tree(1)</li> <li>git-symbolic-ref(1).</li> <li>git-update-ref(1)</li> <li>gitcore-tutorial(7)</li> </ul> |
3,404,500 | 0 | <p>You could find a file named as config.xml.</p> <p>It has an item to config log. </p> <p>Like: </p> <p></p> <pre><code> <file-name>logs/examplesServer.log</file-name> <rotation-type>byTime</rotation-type> <number-of-files-limited>true</number-of-files-limited> <file-time-span>24</file-time-span> <rotation-time>00:00</rotation-time> <rotate-log-on-startup>true</rotate-log-on-startup> <logger-severity>Info</logger-severity> <log-file-severity>Debug</log-file-severity> <stdout-severity>Notice</stdout-severity> <domain-log-broadcast-severity>Notice</domain-log-broadcast-severity> <memory-buffer-severity>Trace</memory-buffer-severity> <log4j-logging-enabled>false</log4j-logging-enabled> <redirect-stdout-to-server-log-enabled>false</redirect-stdout-to-server-log-enabled> <domain-log-broadcaster-buffer-size>1</domain-log-broadcaster-buffer-size> </log> </code></pre> <p>Thanks, Joseph</p> |
7,865,388 | 0 | Why is path not working in Xcode 4.2? <p>I am learning to write an iOS-native webkit app. In Xcode 3.x, I have index.html distributed in Resources folder and the following code works correctly:</p> <pre><code>- (void)viewDidUnload { [super viewDidUnload]; NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; NSData *htmlData = [NSData dataWithContentsOfFile:filePath]; if (htmlData) { NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [bundle bundlePath]; NSString *fullPath = [NSBundle pathForResource:@"index" ofType:@"html" inDirectory:path]; [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fullPath]]]; } } </code></pre> <p>The index.html is not loaded when I create a project on Xcode 4.2. I have the index.html in the "Supporting Files" folder. Have I missed something? Please help.</p> <p>Thanks</p> <p>Adrian</p> |
8,020,388 | 0 | How initial startup for NHibernate Profiler <p>I have a Wpf application using Nhibernate. I want to see details of sent query to database by NHibernate Profiler. For initial startup, what should I do?</p> |
31,329,917 | 0 | how to use facebook SDK (with feed dialog) on password protected site <p>I'm trying to create a Facebook share using the Feed Dialog with the Javascript SDK. I need this on a password protected site for clients to test. How can I get this to work? Is there a certain way I need to set up the FB App? I've tried to add the password protected URL in the the app setting for "App Domains" but it doesn't allow it.</p> |
33,909,930 | 0 | What is the best way to get the name of the caller class in an object? <p>I could get this working using this:</p> <pre><code>scala> object LOGGER { | def warning(msg: String)(implicit className:String) = { | className | } | } defined object LOGGER scala> class testing { | lazy implicit val className = this.getClass.getName | def test = LOGGER.warning("Testing") | } defined class testing scala> val obj = new testing() obj: testing = testing@11fb4f69 scala> obj.test res51: String = testing <======= scala> class testing2 { | lazy implicit val className = this.getClass.getName | def test = LOGGER.warning("Testing") | } defined class testing2 scala> val obj2 = new testing2() obj2: testing2 = testing2@2ca3a203 scala> obj2.test res53: String = testing2 <===== </code></pre> <p>I also tried using Thread.currentThread.getStackTrace in the <code>object LOGGER</code> but couldn't get it to print the calling class <code>testing</code> in the <code>warning</code> function. Any other ways to do this?</p> |
19,524,086 | 0 | <p>Try using <a href="https://www.hex-rays.com/products/ida/support/idapython_docs/idc-module.html#PatchByte" rel="nofollow"><code>PatchByte</code></a> (or <a href="https://www.hex-rays.com/products/ida/support/idapython_docs/idaapi-module.html#patch_byte" rel="nofollow"><code>idaapi.patch_byte</code></a>). Then you should see the correct value with <code>idaapi.get_byte</code>. There are equivalent patch functions for words, dwords, and even variable-length buffers.</p> <p>(Note that this requires you to know the exact byte encoding of the instruction you want to change)</p> |
15,806,112 | 0 | Getting full path from an HTTP request <p>I would like to know how can I get the full path of an HTTP request.</p> <p>If a have a request like <code>http://localhost:8080/path1/path2</code> how can I get the full <code>/path1/path2</code>?</p> <p>Using <code>request.getContextPath()</code> returns only the /path1 section.</p> |
5,255,113 | 0 | <p>In the onCreate method of your activity, put in the following</p> <pre><code>getWindow().setLayout (LayoutParams.FILL_PARENT /* width */ , LayoutParams.WRAP_CONTENT /* height */); </code></pre> |
28,028,360 | 0 | <p>Change your rule so that the slash and everything after it is optional:</p> <pre><code>RewriteEngine On RewriteBase / RewriteRule ^technology(?:/(.*)|)$ /view.php?cat=technology&short_url=$1 [L] </code></pre> |
26,198,745 | 0 | <p>The easiest way to do this is to wrap your content with a inline-block level element with max-height 100%, and, you need to set <code>height: inherit</code> on the <code>table-cell</code> elements.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html,body { height: 100%; } .table { float:left; margin: 10px; display:table; height:500px; vertical-align:middle; background:#ccc; } .table-cell { height: inherit; vertical-align:middle; display:table-cell; } .wrapper { border: 1px dotted blue; display: inline-block; max-height: 100%; overflow: auto; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><div class="table"> <div class="table-cell"> <div class="wrapper"> some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br> </div> </div> </div> <div class="table"> <div class="table-cell"> <div class="wrapper"> some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br>some tall content <br> </div> </div> </div></code></pre> </div> </div> </p> |
24,049,422 | 0 | <p>Your issue is likely because of the brackets on your ExternalInface call:</p> <pre><code>ExternalInterface.call("enter()"); </code></pre> <p>Use this instead:</p> <pre><code>ExternalInterface.call("enter"); </code></pre> <p>Also, make sure you're allowing script access in the swf embed code:</p> <pre><code><param name='AllowScriptAccess' value='always'/> </code></pre> |
16,549,840 | 0 | Problems with CSP in the manifest.json file <p>the script of my first GC extension doesn't work when loaded as .crx . i've checked the debugging section and this is my error:</p> <p>Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' <a href="https://www.lolking.net/" rel="nofollow">https://www.lolking.net/</a>". popup.html:8</p> <p>Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' <a href="https://www.lolking.net/" rel="nofollow">https://www.lolking.net/</a>". popup.html:9 </p> <p>so i guess the error is from the manifest.json file:</p> <pre><code>{ "name": "LolKing Searcher", "version": "1.1", "manifest_version": 2, "description": "Search your LoL profile", "content_security_policy": "script-src 'self' https://www.lolking.net/; object-src 'self'", "permissions": [ "tabs", "http://*/*/" ], "content_scripts": [ { "matches": ["http://*/*/","https://*/*/"], "js": ["popup.js"] } ], "browser_action": { "default_title": "LolKing Searcher", "default_icon": "icon.png", "default_popup": "popup.html" } } </code></pre> <p>also every advice is well accepted!</p> |
22,349,777 | 0 | <p>MATLAB is regularly updated with new functions, and there are also multiple toolboxes (with their own updates). So the functions you can use depends on your version of MATLAB. Unfortunately it is not easy to find out in which version of MATLAB a function first became available.</p> <p>You can use these functions to get some more information:</p> <p><code>ver</code> - to see what MATLAB version you have and which which toolboxes you have access to.</p> <p><code>which</code> - to see if a particular function is on your MATLAB path</p> <p>e.g. <code>which imguidedfilter</code> will show you if you have access to the function <code>imguidedfilter</code>.</p> <p>This particular function appears to be a very new function which you may need R2014a for (as I have R2013b and Image Processing Toolbox and don't have it).</p> |
22,915,394 | 0 | <p>The relative links are returned from the get_template_directory_uri() function.</p> <p>It probably returns a string that looks like this : "/path/to/file.jpg"</p> <p>I have no experience in wordpress but making relative links isn't specifically a php thing.</p> |
30,033,663 | 0 | <p>I could not get the asp:DropdownList to fire the SelectedIndexChanged event. So this is how I completed the task.</p> <p>Adding the dropdown dynamically as shown above and adding the change event that calls a javascript:</p> <pre><code> onchange='UpdateLocationList()' </code></pre> <p>This function had to be put in a .js file. This web site had a .js file already. It also had some AJAX calls that I used to complete the task. In the UpdateLocationList(), I get the ID of the service type that was set as a value attribute in the dropdown. Then I use a function that is already part of the .js file to the LocationDetails page using the Service Type ID to display only the facilities of that service type. This is the function:</p> <pre><code> function updateLocationList() { var ddlFacilityType = document.getElementById("FacilityTypeDDL"); var facilityValue = ddlFacilityType.options[ddlFacilityType.selectedIndex].value; processAjax("/editor/Locations.aspx?Location_ID=" + facilityValue, "navPanel"); } </code></pre> <p>Works like a charm. </p> <p>Thanks for all of your help.</p> |
16,027,451 | 0 | <p>The simplest way to do this is to use code mentioned on <a href="http://msdn.microsoft.com/en-us/library/ms229711.aspx" rel="nofollow">this</a> link and use this in a separate thread. You don't have to worry about creating asynchronous handlers in C#. Infact you could simply take the code on the link put into a method and use this :</p> <pre><code>YourClass c = new YourClass(); Thread thread = new Thread(c.method_to_download); thread.Start(); // continue with WinForms application. /* You can also do the following */ YourClass c = new YourClass(); c.Execute(); // where YourClass is defined as : public class YourClass() { public YourClass() {} public void Execute() { // code to execute the download in a try-catch block. } } </code></pre> <p>YourClass is a custom class that you may use to perfrom the download. It can raise a simple event optionally with arguments when the download is completed from the finally block. Your calling code can accept this event via an event handler and find out the result of the download.</p> <p>This is just two of the ways you can deal with this, there are other ways such as using a Background thread or using asynchronous callbacks with FtpWebRequest class but they all achieve the same result.</p> |
19,993,004 | 0 | Do people ever use a variable.php file? <p>As I'm learning PHP, a lot of scripts I write end up with a lot of variables. I've gotten very used to using files such as functions.php and sessions.php in my includes folder. What about variables? Is it better to just create a bunch of variables on pages or to store them all in a single file? If not - would a better option be a constants.php file?</p> |
29,217,222 | 0 | <p>This works on ios 8 - just add seconds since 00:00 1 Jan 2001, so to open cal on 2 Jan 2001</p> <pre><code>NSString* launchUrl = @"calshow:86400"; [[UIApplication sharedApplication] openURL:[NSURL URLWithString: launchUrl]]; </code></pre> <p>I'm using RubyMotion, so my code looks something like this:</p> <pre><code>url = NSURL.URLWithString("calshow:#{my_date - Time.new(2001,1,1)}") UIApplication.sharedApplication.openURL(url) </code></pre> |
25,482,565 | 0 | <p>You need a <a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#name" rel="nofollow">named tracker</a>. You can set this up in the configuration object that can be passed as the third parameter instead of a cookie domain (in that case the cookieDomain setting goes into the configuration object). Plus you need two send pageview calls, one for each tracker.</p> <pre><code><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXX', { 'name' : 'mycustomtracker', 'cookieDomain' : 'customersdomain.com' }); ga('create', 'UA-YYYYYYY', 'customersdomain.com'); ga('mycustomtracker.send', 'pageview'); ga('send', 'pageview'); </script> </code></pre> |
1,019,431 | 0 | <p>Try setting a property in each pom to find the main project directory. </p> <p>In the parent: </p> <pre><code><properties> <main.basedir>${project.basedir}</main.basedir> </properties> </code></pre> <p>In the children: </p> <pre><code><properties> <main.basedir>${project.parent.basedir}</main.basedir> </properties> </code></pre> <p>In the grandchildren: </p> <pre><code><properties> <main.basedir>${project.parent.parent.basedir}</main.basedir> </properties> </code></pre> |
5,005,426 | 0 | <p>Here is the answer, at least partially, from <a href="http://msdn.microsoft.com/en-us/library/sbbt4032.aspx" rel="nofollow">MSDN</a>:</p> <blockquote> <p>Every enumeration type has an underlying type, which can be any integral type except char. The default underlying type of enumeration elements is int. To declare an enum of another integral type, such as byte, use a colon after the identifier followed by the type, as shown in the following example.</p> <p>Copyenum Days : byte {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri}; </p> <p>The approved types for an enum are byte, sbyte, short, ushort, int, uint, long, or ulong.</p> </blockquote> |
9,416,484 | 0 | <p><strong>Try with following regex:</strong></p> <pre><code>(?:^|[^\^])((?:\- *)?\d+) </code></pre> <p>Combine it with <a href="http://php.net/manual/en/function.preg-match-all.php" rel="nofollow"><code>preg_match_all</code></a> function.</p> <p><strong>Explanation:</strong></p> <p>It matches all digits</p> <pre><code>(\d+) </code></pre> <p>with optional negative sign (whitespacesbetween allowed)</p> <pre><code>(?:\- *)? </code></pre> <p>that are not followed with <code>^</code> sign</p> <pre><code>[^\^] </code></pre> <p>or are on the beggining of the string</p> <pre><code>^ </code></pre> <p>(so there is <code>^|[^\^]</code>) matched in non-captured group</p> <pre><code>(?:^|[^\^]) </code></pre> |
40,482,409 | 0 | <p>I have had issues once or twice with it not skipping blanks, particularly on reports that have blanks that aren't really blank.</p> <p>To be safe I use </p> <pre><code>{=AVERAGEIF(IF(ISNUMBER(F:F),A:A)} </code></pre> |
17,956,276 | 0 | <p>Just refactor the name of <code>Employee</code> class to <code>SuperEmployee</code>. Make sure you make a copy of the original <code>Employee</code> and <code>SuperEmployee</code> somewhere else.</p> <p>Then replace the refactored <code>SuperEmployee</code> with the original <code>SuperEmployee</code>. Also replace the original <code>Employee</code> back.</p> <p>To refactor, select the <code>Employee</code> type. Don't do it on the variable.</p> |
21,289,587 | 0 | Is there a function conditionally to concatenate cells and delete certain rows? <p>I have an Excel sheet with data arranged like this: </p> <p><img src="https://i.stack.imgur.com/CdFB4.gif" alt="SO21289587 question first example"></p> <p>For every row of column A that repeats (by necessity as the database is arranged alphabetically) I need to concatenate the number for the repeating row from column B into the cell above it (inserting, say, a comma between the two strings). Then I need to delete the repeating row to end up with the following: </p> <p><img src="https://i.stack.imgur.com/mbv4S.gif" alt="SO21289587 question second example"> </p> <p>Breaking this down:</p> <ol> <li>In column A, identify a row that is a copy of the row above it.</li> <li>Concatenate the information from column B of the repeated row into the original row, column B.</li> <li>Delete the repeated row. </li> <li>Repeat until a blank cell is encountered. </li> </ol> <p>I hope someone will advise me on the possibility of producing a function that would execute these actions. I'm looking for a push in the right direction or confirmation that it isn't possible, rather than someone to solve the issue for me.</p> |
38,929,212 | 0 | <p>Unfortunately that page is quite dated and not correct for Grails 3+.</p> <p>You can find <code>BootStrap.groovy</code> under <code>grails-app/init</code>, and the settings that were specified in <code>DataSource.groovy</code> are now with the rest of the config settings in <code>application.yml</code> (or <code>application.groovy</code> if you create it).</p> |
29,324,959 | 0 | <p>Ya, I think you misunderstand what <code>virtualenv</code> does:</p> <p><a href="https://virtualenv.pypa.io/en/latest/" rel="nofollow">https://virtualenv.pypa.io/en/latest/</a></p> <blockquote> <p>The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.7/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded.</p> </blockquote> <p>Your project files don't need to be (and shouldn't be) where the <code>virtualenv</code> files are. </p> <p><code>virtualenv</code> installs your app's python dependancies in a folder for the specific <code>virtualenv</code> that is being used. </p> <p>Let's say you are not using <code>virtualenv</code>, the dependencies would be installed into into the site-packages folder for your system. The dependancies aren't installed in your project directory and your project directory isn't in your system's site-packages directory. </p> <p>Using <code>virtualenv</code> doesn't change that, it just changes where the dependencies are installed.</p> |
10,118,607 | 0 | <p>You can achieve this by configuring your web.config file. Please check the link below to an article, which explains at the bottom of the page, how to display different custom error pages for different HTTP error statuses.</p> <ul> <li><a href="http://www.asp.net/web-forms/tutorials/deployment/displaying-a-custom-error-page-cs">Displaying a Custom Error Page</a></li> </ul> |
29,318,674 | 0 | Why does Angularjs Service Return a Character Array instead of an Array of Objects? <p>I am using a service(.factory) to hold an array of objects/items which gets updated by multiple controllers and then the data is pulled back down by each controller. Each time I add a new array of data, I push it onto the array. However, when I attempt to load an array within my controller so I can display it my view, it is returning a character array which makes it impossible to use ng-repeat to iterate over the values.</p> <pre><code>// controllers.js angular.module('myapp.controllers', []) .controller('MainCtrl', function($scope, MainService) { $scope.mainItems = MainService.all(); // Why does this return a char array? // get the count $scope.getCount = function(item){ return TempOrder.getCount(item); } // add an item $scope.addItem = function(item){ TempOrder.addItem(item); return TempOrder.getCount(item); } }) .controller('SecondaryCtrl', function($scope, MainService) { $scope.items = MainService.all(); // Why does this return a char array? // get the count $scope.getCount = function(item){ return TempOrder.getCount(item); } // add an item $scope.addItem = function(item){ TempOrder.addItem(item); return TempOrder.getCount(item); } }); </code></pre> <p>This is my service </p> <pre><code>// services.js angular.module('myapp.services', []) .factory('MainService', function() { orderItems = []; return { all: function() { return orderItems; // Why does return a char array??? }, getCount: function(item){ var count = 0; for (i = 0;i<orderItems.length;i++) { if (orderItems[i] === item ){ count++; } } return count; }, addItem: function(item) { orderItems.push(item); } } }); </code></pre> |
7,165,887 | 0 | <p>3 extra strings for every item</p> <ul> <li><code>part[0];</code></li> <li><code>part[1];</code></li> <li><code>part[1] + " "</code></li> </ul> <p>the least allocations possible would be to avoid all the temporary allocations completely, but the usual micro-optimization caveats apply.</p> <pre><code>var start = part.IndexOf(':') + 1; stringbuilder.Append(part, start, part.Length-start).Append(' '); </code></pre> |
34,464,148 | 0 | Parse Facebook Utils - Cannot resolve Parse <p>According to Facebook: Parse tutorials <strong>4th Point</strong> <a href="https://www.parse.com/docs/android/guide#users-facebook-users" rel="nofollow">https://www.parse.com/docs/android/guide#users-facebook-users</a></p> <p>I followed it and removed the dependency com.parse:parse-android:1.10.3.</p> <p>There is nothing in the libs folder as well. But all the code of using Parse library is now red giving an error - <strong>Cannot resolve parse</strong></p> <p>I am unable to understand, if the tutorials are incorrect ?</p> |
36,865,325 | 0 | <p>Ok then the correct source code is </p> <pre><code>program operateur implicit none CHARACTER(LEN=1) :: oper real::a,b,res print*,'Give the first number a :' read*,a print*,'Give the second number b :' read*,b print*,'which operation ?' read (*,"(A1)") oper select case (oper) case ('+') res=a+b case ('-') res=a-b case ('*') res=a*b case ('/') res=a/b case default print*, "Invalid Operator, thanks" end select print*,'the result is ',res end program operateur </code></pre> |
23,711,968 | 0 | Google map cut inside bootstrap modal <p>This problem is bugging me for few days now. I almost gave up when yesterday I accidentally discovered something. I'm using Google map inside bootstrap modal. Problem is when I call modal, map is cut in half and I can pan and zoom it in the half of div, but strange thing is that when I turn on inspector(in any browser) entire map is shown right away and everything works like it should. Anyone had similar problem?</p> <p>On calling modal:</p> <p><img src="https://i.stack.imgur.com/kbCgW.png" alt="enter image description here"></p> <p>After calling inspector:</p> <p><img src="https://i.stack.imgur.com/JY2e7.png" alt="enter image description here"></p> |
18,665,378 | 0 | <p>Why should this not be acceptable? It should, however, be clearly documented. If you look at the .net class libraries or the JDK, there are collection interfaces defining methods to add or delete items, but there are unmodifiable classes implementing these interfaces. It is a good idea in this case - as you did - to provide a method to query the object if it has some capabilities, as this helps you avoid exceptions in the case that the method is not appropriate.</p> <p>OTOH, if this is an API, it might be more appropriate to use an <code>interface</code> than a <code>class</code>.</p> |
15,776,809 | 0 | Can I display an "incorrect password" message in a previous signin.html page after i have already moved to a logincheck.php page <p>my signin.html is just a common html page with username and password fields..nd a sign in button ..and i just want to display all those error messages under echo in the previous signin.html page.The code for logincheck.php is as followed:</p> <pre><code><?php session_start(); $username = $_POST['username']; $password = $_POST['password']; if($username && $password) { $connect = mysql_connect("localhost","root","") or die("Couldn't connect!"); mysql_select_db("project") or die("Couldn't find db"); $query= mysql_query("SELECT * From signup1 WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows!=0) { //code to login while ($row = mysql_fetch_assoc($query)) { $dbusername = $row['username']; $dbpassword = $row['password']; } if($username==$dbusername&&$password==$dbpassword) { $_SESSION['username']=$username; header('Location:mailbox.php'); } else echo "Incorrect password!"; } else die("That user does't exist!"); } else die("Please enter username and Password!"); if($_SESSION['username']) echo "Welcome, " .$_SESSION['username']."!<br><a href='logout.php'>Logout</a><br> "; else die ("You must be logged in!"); ?> </code></pre> |
11,086,498 | 0 | <p>You need to export the variable before running g++:</p> <pre><code>export CPLUS_INCLUDE_PATH </code></pre> |
26,838,058 | 0 | <p>Ok, this looks like some loading order / mixing different version or dependency - issue(s). <br/> However, as it turned out it is the version of angular (1.1.3) that don't play nice with this version of bootstrap. <br/>So first, <a href="http://plnkr.co/edit/0Wt4LiQvBfPNXwpZBdtw?p=preview" rel="nofollow">Here</a> is a working version of your code (the main part), with angular 1.2.25. <br/> I've also included on the index.html, version 1.1.3 of angular (currently marked out). If you replace the two version, the error reproduces:</p> <pre><code><!-- <script src="https://code.angularjs.org/1.1.3/angular.min.js"></script> --> </code></pre> <p>Regardless specific errors, I strongly recommend upgrading angular to version 1.3 (or 1.2.25 incase IE8 support is a must). It is by far faster, includes much more cool features and leverages many EMCA5 and HTML5 / CSS3 Capabilities.<br/> Can't upgrade? Well it is debugging time... No you know what is wrong, "just" have to find why.<br/> Good Luck!</p> |
2,690,919 | 0 | Can I add Controls that are not ListItems to a RadioButtonList? <p>I need to provide a way to allow users to select 1 Subject, but the subjects are grouped into Qualifications and so I want to show a heading for each 'group'. My first thought is an asp:RadioButtonList as that provides a list of options from which <strong>only one</strong> can be selected but there's no means to add break the list up with headings. </p> <p>So I tried the following code - but I can't see that the LiteralControl is being added, which makes me think it's not a valid approach.</p> <pre><code>For Each item As Subject In Qualifications If item.QualCode <> previousQualCode Then rblSelection.Controls.Add(New LiteralControl(item.QualName)) End If rblSelection.Items.Add(New ListItem(item.SubjectName, item.SelectionCode)) previousQualCode = item.QualCode Next </code></pre> |
28,197,925 | 1 | Tkinter Mac Checkbutton Deselect Animation Glitch <p>I'm using Tkinter on my Mac. Whenever I have a Checkbutton or a Radiobutton, the animation when I deselect it glitches. For instance, a checkbutton that is checked, onclick, will deselect for a fraction of a second, select for a second, then deselect - has anyone come across this issue and if so, is it fixable?</p> <pre><code>from Tkinter import * root = Tk() Checkbutton1 = Checkbutton(root).pack() root.mainloop() </code></pre> |
18,829,024 | 0 | Passing object by using ViewDataDictionary instance? <p>I got one small doubt,that is the following method adds object to ViewData Model property. </p> <pre><code> public ActionResult StronglyTypedView() { var obj = new MvcRouting.Models.Student(); obj.age = 24; obj.name = "prab"; ViewData.Model = obj; return View(); } </code></pre> <p><code>ViewData property</code> return type in <code>ViewDataDictionary</code>.So i created instance of <code>ViewDataDictionary</code> and assigned object to <code>Model</code> property.But its not working,how to solve this?</p> <pre><code>public ActionResult StronglyTypedView() { var obj = new MvcRouting.Models.Student(); obj.age = 24; obj.name = "prab"; var DicObj = new ViewDataDictionary(); DicObj.Model = obj; return View(); } </code></pre> |
26,934,622 | 0 | <p>ui-router has a <a href="https://github.com/angular-ui/ui-router/wiki" rel="nofollow"><code>resolve</code></a> method that you can use in your routes.<br/> The <a href="https://github.com/angular-ui/ui-router/wiki" rel="nofollow"><code>resolve</code></a> will tell the routing to wait and resolve something before it moves to the new route.</p> <p>Here are some examples(Your problem is similar to authentication):</p> <ul> <li><a href="http://stackoverflow.com/questions/22537311/angular-ui-router-login-authentication">angular ui-router login authentication</a></li> <li><a href="https://gist.github.com/leon/6550951" rel="nofollow">https://gist.github.com/leon/6550951</a></li> </ul> |
3,554,469 | 0 | <p>Gartner estimates 160 lines of code converted per man day for roughly similar languages. That plus the size of your code base gives you a rough estimate, if you assume the ColdFusion is "like" C# (e.g., all the Coldfusion constructs translate easily, which probably isn't the case; then the conversion rate goes down).</p> <p>See also discussion at <a href="http://stackoverflow.com/questions/2830612/things-to-keep-in-mind-during-application-migration-coldfusion-to-spring/2830712#2830712">Things to keep in mind during Application Migration: ColdFusion to Spring</a></p> <p>Our web page on <a href="http://www.semanticdesigns.com/Products/Services/LegacyMigration.html" rel="nofollow noreferrer">migration</a> provides more details including discussion of pitfalls and alternatives. </p> |
2,589,954 | 0 | Empty PHP variables <p>Is there a better way besides <code>isset()</code> or <code>empty()</code> to test for an empty variable?</p> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.