pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
20,239,024 | 0 | <p>Well,</p> <p>problem solved. I had to declare the resolver extension in the global scope, so that the subprojects also use it:</p> <pre><code>resolvers in Global ++= Seq( "Developer's repo" at "file://"+Path.userHome.absolutePath+"/maven2.artifacts/www" ) </code></pre> <p>Then project <code>def_symbol</code> also uses "Developer's repo" and everything works exactly as expected with versions like <code>"1.0.+"</code> or <code>"1.+"</code>.</p> <p>Not having the resolver in global scope available but having the library resolving working nevertheless was due to version 1.0.1 being available in Ivy's local cache from another build. From scratch, it would not have worked either.</p> <p>Sorry for the noise. I should have waited one more day before posting.</p> |
35,983,874 | 0 | AndroidViewClient: junk after document element <p>I tried to take dump on Samsung S6. </p> <pre><code>$dump </code></pre> <p>Following is the output I received (last line):</p> <pre><code></hierarchy>sh: resetreason: can\'t execute: Permission denied\r\nKilled \r\n </code></pre> <p>Which permission is denied and who's getting killed?</p> |
2,807,823 | 0 | <p>With <code>printf</code>, the <code>%i</code> format outputs a <code>signed int</code>. Use <code>%u</code> to output an <code>unsigned int</code>. This is a common issue when beginning C programming. To address your question, the result of <code>v1 - v2</code> is -10, but <code>sum</code> is an <code>unsigned int</code>, so the real answer is probably something like 4294967286 (2<sup>32</sup> - 10). See what you get when you use <code>The subtraction of %i from %i is %u \n</code>. :)</p> |
13,495,840 | 0 | postgresql UPDATE error " ERROR: invalid input syntax for type boolean: " <p>I'm trying to make a simple update query on postgresql. I don't really understand the error as there is no boolean value or column type. Here is the log :</p> <pre>cat=> UPDATE categories SET epekcategoryid='27af8b1e-c0c9-4084-8304-256b2ae0c8b2' and epekparentcategoryid='root' WHERE categoryId='281' and siteid='0' and categoryparentid='-1'; ERROR: invalid input syntax for type boolean: "27af8b1e-c0c9-4084-8304-256b2ae0c8b2" LINE 1: UPDATE categories SET epekcategoryid='27af8b1e-c0c9-4084-830... </pre> <p>The table config :</p> <pre>cat=> \d categories; Table "public.categories" Column | Type | Modifiers ----------------------+-----------------------+----------- categoryid | character varying(32) | categoryname | text | siteid | integer | categoryparentid | character varying(32) | status | integer | default 0 epekcategoryid | text | epekparentcategoryid | text | categorylevel | character varying(37) | categoryidpath | character varying(37) | </pre> |
18,496,335 | 0 | <p>I would suggest looking into the Assembly plugin: <a href="http://maven.apache.org/plugins/maven-assembly-plugin/" rel="nofollow">http://maven.apache.org/plugins/maven-assembly-plugin/</a> I have not used it in any Android project yet, but I do use it in my regular java server projects which require non-maven items be in expected locations.</p> |
15,927,875 | 0 | Calling a script which calls an MPI process from an MPI process <p>I have an MPI program (Fortran, <a href="http://www.mpich.org/" rel="nofollow">MPICH</a>) which I need to shell out from to a script which, in turn, starts its own MPI program (using <code>mpirun</code>). Thus far, I've wrapped the shell out (<code>system</code>) command in an <code>if(system_num .eq. root_system_num)</code> thing so only one MPI process runs the script. However, this causes a series of <code>HYDU_create_process</code> errors.</p> <p>I considered using <code>MPI_Comm_spawn</code> but there are warnings like "MPI does not say what happens if the program you start is a shell script and that shell script starts a program that calls <code>MPI_INIT</code>", so this seems less than ideal, as well.</p> <p>Some points:</p> <ul> <li>The program called in shell script does not need to interact with the calling program at all. The calling program just needs to wait until that process is done.</li> <li>There is not an easy way to turn the shell script into a separate executable (lots of environment variable setting, and so on).</li> <li>Ideally, this should work for both MPICH and <a href="http://www.open-mpi.org/" rel="nofollow">Open MPI</a>.</li> </ul> <p>Is there a way to do this?</p> |
11,445,168 | 0 | <p>You should initialize the object of <code>DisplayViewController</code> class, </p> <pre><code> static void on_status_state(NSString *) stats { DisplayViewController* display = [[[DisplayViewController alloc] init] autorelease]; [display toReceiveStatus:@"Sample Label"]; } </code></pre> <p>You should check <code>- (void)toReceiveStatus:</code> is called or not. Declare statusLabel in DisplayConn.h as <code>UILabel *statusLabel;</code></p> <p>Try like this i think it will be helpful to you.</p> <pre><code>- (void)viewDidLoad { statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 30, 20)]; statusLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14]; statusLabel.font = [UIFont systemFontOfSize:15.0]; [self.view addSubview:statusLabel]; } </code></pre> |
38,255,048 | 0 | Separating axes from plot area in MATLAB <p>I find that data points that lie on or near the axes are difficult to see. The obvious fix, of course, is to simply change the plot area using <code>axis([xmin xmax ymin ymax])</code>, but this is not preferable in all cases; for example, if the x axis is time, then moving the minimum x value to -1 to show activity at 0 does not make sense. </p> <p>Instead, I was hoping to simply move the x and y axes away from the plot area, like I have done here: <a href="https://i.stack.imgur.com/WzkUw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WzkUw.png" alt="left: Matlab generated, right: desired (image editing software)"></a> left: MATLAB generated, right: desired (image editing software) </p> <p>Is there a way to automatically do this in MATLAB? I thought there might be a way to do it by using the <code>outerposition</code> axes property (i.e., set it to <code>[0 0 0.9 0.9]</code> and drawing new axes where they originally were?), but I didn't get anywhere with that strategy.</p> |
19,999,138 | 0 | <p>Read <a href="http://www.nodeclipse.org/" rel="nofollow">http://www.nodeclipse.org/</a> carefully </p> <blockquote> <p><h3>Features</h3> <ul> <li>Creating default structure for New Node Project and New Node Source File</li> <li>Generating Express project with Wizard</li> <li>JavaScript Syntax highlighting</li> <li>Bracket matching and marking selection occurences with background color</li> <li>Content Assistant within one file</li> <li>Go to definition with <kbd>Ctrl</kbd>+click when <a href="http://usejsdoc.org/" rel="nofollow">JSDoc is used</a></li> <li>Refactoring within one file (<kbd>Alt+Shift+R</kbd>)</li> <li>JSON files highlight and validation</li> <li>NPM support</li> <li>Debugging - Breakpoint, Trace, Variables, Expressions, etc... via Eclipse debugger plugin for V8</li> <li>Setting project properties for JSHint-Eclipse automatically; <a href="http://www.jshint.com/" rel="nofollow">JSHint</a> settings template </li> <li>Passing arguments to Node application and Node.js, specifying environment variables values to use</li> <li>Running CoffeeScript *.coffee files</li> <li>Running *.js files with PhantomJS, MongoDB Shell or Java 8 Nashorn <pre>jjs</pre> util</li> <li>Bundled together with Markdown Editor, GitHub Flavored Markdown, StartExplorer (for system explorer and shell), RegEx, Icon Editor, MongoDB, RestClient Tool and other plugins (20+ in total, check update site and Nodeclispe Plugin List) </li> <li>Support for Eclipse Juno, Kepler, Luna M3</li> </ul></p> </blockquote> <p>As of 0.7 completion work as standard JSDT functionality, that is </p> <ul> <li>for objects defined in the same class,</li> <li>for objects annotated with with JSDoc</li> </ul> <p>If you want more, do it yourself with help from the other people.</p> |
18,881,432 | 0 | Grails template inheritance <p>I'm trying to mimic template inheritance as found in Django with a Grails app. I want to be able to define a '_header.gsp' which includes all the shared resources across the app:</p> <pre><code><!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>${title}</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> %{--Shared Styles--}% <link rel="stylesheet" href="${resource(dir: 'app/shared/css/bootstrap', file: 'bootstrap.min.css')}" type="text/css"> %{--Shared Libraries--}% <script src="${resource(dir: 'lib/jquery', file: 'jquery.js')}"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script> %{--View-specific styles--}% <g:each var="style" in="${styles}"> <link rel="stylesheet" href="${style}" type="text/css"> </g:each> %{--View-specific scripts--}% <g:each var="include" in="${includes}"> <script src="${include}" type="text/javascript"></script> </g:each> </code></pre> <p>For each specific view template I will include this _header.gsp with a dictionary to fill in the view-specific requirements:</p> <pre><code><g:render template="/header" model="[ title:'Alerts', styles:[ '${resource(dir: "app/stuff/css", file: "other.css")}', '${resource(dir: "app/stuff/css", file: "second.css")}' ], includes:[ '${resource(dir: "app/stuff/src/main/js/", file: "app.js")}', '${resource(dir: "app/stuff/src/main/js/", file: "filters.js")}' ] ]" /> </code></pre> <p>This is not working, and I'm sure my syntax is wrong somewhere. Can you define a <code>'$resource(dir)'</code> path inside of a g:each like I have? Perhaps I need to use <code>g:link</code>? Can this be done with Grails?</p> |
29,713,866 | 1 | Python3: File path problems <p>Suppose my <code>Python3</code> project structure is :</p> <pre><code>Project | App.py | AFolder | | tool.py | | token.json </code></pre> <p>In <code>tool.py</code>, I use <code>os.path.exists('token.json')</code> to check whether the Json file exits. As expected, it returns <strong>true</strong>.</p> <pre><code>def check(): return os.path.exists('token.json') </code></pre> <p>However, when I call this in <code>App.py</code>, it returns <strong>false</strong>. </p> <p>It seems file path is different when calling functions between modules. How to solve it ?</p> |
30,675,592 | 0 | <h1>Other XQuery implementations <em>do</em> support this query</h1> <p>If you want to validate that your query (as corrected per discussion in comments) <strong>does</strong> in fact work with other XQuery implementations when entered exactly as given in the question, you can run it as follows (tested in BaseX):</p> <pre><code>declare context item := document { <actors> <actor filmcount="4" sex="m" id="15">Anderson, Jeff</actor> <actor filmcount="9" sex="m" id="38">Bishop, Kevin</actor> </actors> }; //actor/@id </code></pre> <hr> <h1>Oxygen XQuery needs some extra help</h1> <p>Oxygen XML doesn't support serializing attributes, and consequently discards them from a result sequence when that sequence would otherwise be provided to the user.</p> <p>Thus, you can work around this with a query such as the following:</p> <ul> <li><code>//actor/@id/string(.)</code></li> <li><code>data(//actor/@id)</code></li> </ul> <hr> <h2><em>Below applies to a historical version of the question.</em></h2> <p>Frankly, I would not expect <code>//actors/@id</code> to return anything against that data with any valid XPath or XQuery engine, ever.</p> <p>The reason is that there's only one place you're recursing -- one <code>//</code> -- and that's looking for <code>actors</code>. The single <code>/</code> between the <code>actors</code> and the <code>@id</code> means that they need to be <strong>directly</strong> connected, but that's not the case in the data you give here -- there's an <code>actor</code> element between them.</p> <p>Thus, you need to fix your query. There are numerous queries you could write that would find the data you wanted in this document -- knowing which one is appropriate would require more information than you've provided:</p> <ul> <li><code>//actor/@id</code> - Find <code>actor</code> elements anywhere, and take their <code>id</code> attribute values.</li> <li><code>//actors/actor/@id</code> - Find <code>actors</code> elements anywhere; look for <code>actor</code> elements directly under them, and take the <code>id</code> attribute of such <code>actor</code> elements.</li> <li><code>//actors//@id</code> - Find all <code>id</code> attributes in subtrees of <code>actors</code> elements.</li> <li><code>//@id</code> - Find <code>id</code> attributes anywhere in the document.</li> </ul> <p>...etc.</p> |
19,731,457 | 0 | UNIX shell script to read files, copy files and delete files <p>Hi I am writing a shell script in UNIX which reads a directory and copies the files in to another directory and then deletes the files in the first directory</p> <p>I have tried this but it does not work:-</p> <pre><code>files"=/project/scripts/input/" for f in $files; do [ mv /project/scripts/input/$f.txt /project/scripts/output/$f.xml rm /project/scripts/input/$f.txt ] else echo "Nothing to process will try later" exit fi </code></pre> |
18,590,755 | 0 | How to split a csv file 20 lines at a time using Splitter EIP, in apache camel? <p>I have a <strong>csv file</strong> having 2000 lines. I wish to <strong>split it 20 lines</strong> at a time and send each to a processor in apache camel. How do I do it using <strong>Splitter EIP</strong> ? Please help ..</p> |
25,650,791 | 0 | <p>You can change the raw data from "<0" to "-1" before you tabulate it with:</p> <pre><code>credit_arff$checking_status[ credit_arff$checking_status=="<0" ] <- "-1" </code></pre> <p>Or you can tabulate it first and then get the headings with</p> <pre><code>rownames(table(credit_arff$checking_status) </code></pre> <p>...and change it there if you want. The limiting factor is that the vector of data, or the vector of rownames, will not contain a mix of numeric and character data. Even if you omit the doublequotes around "-1" from the code above, the data will change to "-1". Whether that's acceptable depends what you're doing with the numbers next. Or will you be changing all the other contents to numeric as well?</p> |
7,864,869 | 0 | Using awk for conditional find/replace <p>I want to solve a common but very specific problem: due to OCR errors, a lot of subtitle files contain the character "I" (upper case i) instead of "l" (lower case L).</p> <p>My plan of attack is:</p> <ol> <li>Process the file word by word</li> <li>Pass each word to the hunspell spellchecker ("echo the-word | hunspell -l" produces no response at all if it is valid, and a response if it is bad)</li> <li>If it is a bad word, AND it has uppercase Is in it, then replace these with lowercase l and try again. If it is now a valid word, replace the original word.</li> </ol> <p>I could certainly tokenize and reconstruct the entire file in a script, but before I go down that path I was wondering if it is possible to use awk and/or sed for these kinds of conditional operations at the word-level? </p> <p>Any other suggested approaches would also be very welcome! </p> |
33,315,302 | 0 | <p>Yes it is a good approach. when you go through the go documentation it clearly tells you </p> <blockquote> <p>It is rare to Close a DB, as the DB handle is meant to be long-lived and shared between many go routines.</p> </blockquote> <p>Go maintains its own pool of idle connections. Thus, the Open function should be called just once. It is rarely necessary to close a DB.</p> |
34,404,403 | 0 | <p>There is no circuit breaker library from Microsoft. I have used <a href="https://github.com/App-vNext/Polly" rel="nofollow">Polly</a> with great success.</p> <p>It is really easy to use</p> <pre><code>var policy = Policy .Handle<TimeoutException>() .CircuitBreaker(2, TimeSpan.FromMinutes(1)); var result = policy.Execute(() => FetchData(p1, p2)); </code></pre> <p>Read more about in my blogpost <a href="http://www.lybecker.com/blog/2013/08/07/automatic-retry-and-circuit-breaker-made-easy/" rel="nofollow">Automatic Retry and Circuit Breaker made easy</a>.</p> <p>If my answer is useful, please accept the answer.</p> |
27,273,909 | 0 | CHECK_LIBRARY_EXISTS library with dependencies <p>I'm using cmake to build my c++-project that uses a library that is located in my "/usr/local/bin/" directory. The relevant part in the CMakeList.txt reads:</p> <pre><code>CHECK_INCLUDE_FILES("/usr/local/include/fann.h" HAVE_FANN_HEADER) CHECK_LIBRARY_EXISTS(fann fann_get_errno "/usr/local/lib/" HAVE_FANN_LIB) if(${HAVE_FANN_HEADER} AND ${HAVE_FANN_LIB}) </code></pre> <p>the header is found without a problem the while library is not. Looking into the CMakeError.txt shows:</p> <pre><code>`/usr/bin/cc -DCHECK_FUNCTION_EXISTS=fann_get_errno CMakeFiles/cmTryCompileExec2973046031.dir/CheckFunctionExists.c.o -o cmTryCompileExec2973046031 -L/usr/local/lib -rdynamic -lfann -Wl,-rpath,/usr/local/lib /usr/local/lib/libfann.so: undefined reference to 'sin' /usr/local/lib/libfann.so: undefined reference to 'exp' /usr/local/lib/libfann.so: undefined reference to 'cos' /usr/local/lib/libfann.so: undefined reference to 'log' /usr/local/lib/libfann.so: undefined reference to 'pow' /usr/local/lib/libfann.so: undefined reference to 'sqrt' /usr/local/lib/libfann.so: undefined reference to 'floor'` </code></pre> <p>in the subsequent if-statement the second variable is therefore undefined.</p> <p>I suspect that this is because the test program is not linked with the standard math library. However in my main program the libm.so will be linked.</p> <p>How do I fix the linking of the cmake test program?</p> <p>I would be happy about any comments Thank you</p> <p>Arne</p> |
5,813,550 | 0 | Call win32 CreateProfile() from C# managed code <p>Quick question (hopefully), how do I properly call the win32 function CreateProfile() from C# (managed code)? I have tried to devise a solution on my own with no avail.</p> <p><b>The syntax for CreateProfile() is:</b></p> <pre><code> HRESULT WINAPI CreateProfile( __in LPCWSTR pszUserSid, __in LPCWSTR pszUserName, __out LPWSTR pszProfilePath, __in DWORD cchProfilePath );</code></pre> <p>The supporting documents can be found in the <a href="http://msdn.microsoft.com/en-us/library/bb762271(v=VS.85).aspx" rel="nofollow">MSDN library</a>.</p> <p>The code I have so far is posted below.</p> <p><b>DLL Import:</b></p> <pre><code> [DllImport("userenv.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern int CreateProfile( [MarshalAs(UnmanagedType.LPWStr)] string pszUserSid, [MarshalAs(UnmanagedType.LPWStr)] string pszUserName, [Out][MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszProfilePath, uint cchProfilePath); </code></pre> <p><b>Invoking the function:</b></p> <pre><code> /* Assume that a user has been created using: net user TestUser password /ADD */ // Get the SID for the user TestUser NTAccount acct = new NTAccount("TestUser"); SecurityIdentifier si = (SecurityIdentifier)acct.Translate(typeof(SecurityIdentifier)); String sidString = si.ToString(); // Create string buffer StringBuilder pathBuf = new StringBuilder(260); uint pathLen = (uint)pathBuf.Capacity; // Invoke function int result = CreateProfile(sidString, "TestUser", pathBuf, pathLen); </code></pre> <p><br /> The problem is that no user profile is ever created and CreateProfile() returns an error code of: <em>0x800706f7</em>. Any helpful information on this matter is more than welcomed.</p> <p>Thanks,<br /> -Sean</p> <p><br /> <b>Update:</b> Solved! string buffer for pszProfilePath cannot have a length greater than 260.</p> |
19,403,651 | 0 | <p>Looks like you must replace manually</p> <pre><code>for (int i=0; i < str.length(); i++){ if (str[i] == '/') str[i] = '-'; } </code></pre> |
33,103,947 | 0 | Unexpected error running stored oracle PL/SQL proceedure <p>The database I am accessing has a whole API of stored procedures (several hundred) in several packages. I working on new client software to interact with this database and I need to invoke these stored procedures using OCI. Since I am new at this, I decided to start with the easiest one first. It is not working. </p> <p>It would be helpful if I could get the actual PL/SQL code of the stored procedure. The package does not reside in my user schema, but I do have execute privileges on it. When I query the ALL_SOURCE view I get the package declarations, but not the package body. I also tried the dbms_metadata.get_ddl view, but it just says "Package PTAPI not found in schema for ". Are there any other ways to get the actual PL/SQL code from the package body?</p> <p>Here is the PL/SQL package declaration of the example procedure I am trying to use. This particular one creates a textual error message given an error code and some optional parameters that depend on the specific error code. </p> <pre><code>-- format an error message from ERRMSGS table PROCEDURE formatmessage( p_error IN errmsgs.error%TYPE -- index into ERRMSGS , p_errnum OUT errmsgs.error%TYPE -- adjusted error number , p_errmsg OUT errmsgs.MESSAGE%TYPE -- formatted message , p_a IN VARCHAR2 DEFAULT NULL , p_b IN VARCHAR2 DEFAULT NULL , p_c IN VARCHAR2 DEFAULT NULL , p_d IN VARCHAR2 DEFAULT NULL , p_e IN VARCHAR2 DEFAULT NULL ); -- formatmessage </code></pre> <p>My code to invoke the procedure is below [statement and err are OCI handles passed into this function from higher up]</p> <pre><code>char errmsg[256]; //buffer to receive the error message long errnum; //buffer to receive the adjusted error number memset(errmsg,0,256); errnum = 0; //start the message buffer empty OCIBind* bind1 = NULL, *bind2 = NULL; //to receive the bind handles ub4 curelep1 = 1; //1 errnum element ub4 curelep2 = 1; //1 errmsg element ub2 alenp1 = sizeof(long); //errnum element size ub2 alenp2 = 256; //errmsg element size char sql[] = "BEGIN PTAPI.FORMATMESSAGE(193,:P_ERRNUM,:P_ERRMSG, '','','','',''); END;\0" OCIStmtPrepare(statement,err,(text*)sql,strlen(sql),OCI_NTV_SYNTAX, OCI_DEFAULT); //parse the SQL statement OCIBindByName(statement,&bind1,err,(text*)":P_ERRNUM",-1,&errnum, sizeof(long),SQLT_INT,NULL,&alenp1,NULL,1,&curelep1,OCI_DEFAULT); //bind errnum OCIBindByName(statement,&bind2,err,(text*)":P_ERRMSG",-1,errmsg,256, SQLT_STR,NULL,&alenp2,NULL,1,&curelep2,OCI_DEFAULT); //bind errmsg if(OCIStmtExecute(svcctx,statement,err,1,0,NULL,NULL,OCI_DEFAULT) != OCI_SUCCESS) //execute the statement { long errcode; char errbuf[512]; OCIErrorGet (err,1,NULL,(sb4*)&errcode,(OraText*)errbuf,512, OCI_HTYPE_ERROR); //check to see what the error was printf("ERROR %d - %s\n",errcode,errbuf); return FAIL; } </code></pre> <p>The statement parses properly and the two binds succeed, but I get an error on execute. The error I get is</p> <pre><code>ERROR 6550 - ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'FORMATMESSAGE' ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'FORMATMESSAGE' ORA-06550: line 1, column 7: PL/SQL: Statement ignored </code></pre> <p>I am confused by this error because I imitated a call to this same function from the old client software that works properly. I definitely have the right number and types of arguments. Any ideas why I would be getting this error?</p> <p><strong>---- UPDATE ----</strong> </p> <p>I found a better example procedure to test. This one is not stored in a package, it is a standalone procedure, and so I have the full PL/SQL code. I get the exact same error. It has to be something to do with how I am invoking them. Thanks for any ideas.</p> <p>This one deletes an item of a certain type from the database (entries on 3 different tables). </p> <p>Here is the PL/SQL</p> <pre><code>PROCEDURE DELSTL(comp IN 3DCOMPS.COMPID%TYPE, rowcount OUT integer, errorcode OUT number) AS tempcount INTEGER; BEGIN errorcode := 0; DELETE FROM 3DCOMPS WHERE COMPID = comp; tempcount := sql%rowcount; IF (sql%rowcount < 1) THEN errorcode := 330; END IF; DELETE FROM IDINF WHERE COMPID = comp; IF (sql%rowcount < 1) THEN errorcode := 332; ELSIF (tempcount < sql%rowcount) THEN tempcount := sql%rowcount; END IF; rowcount := tempcount; DELETE FROM ATTLOC WHERE COMPID1 = comp OR COMPID2 = comp; END; </code></pre> <p>Here is my slightly modified code for this new test procedure</p> <pre><code>long errnum; //buffer to receive the error number long rowcnt; //buffer to receive the row count OCIBind* bind1 = NULL, *bind2 = NULL; //to receive the bind handles ub4 curelep1 = 1; //1 errnum element ub4 curelep2 = 1; //1 rowcnt element ub2 alenp1 = sizeof(long); //errnum element size ub2 alenp2 = sizeof(long); //rowcnt element size char sql[] = "BEGIN DELSTL('FAKEIDNUM',:P_ROWCNT,:P_ERRNUM); END;\0" OCIStmtPrepare(statement,err,(text*)sql,strlen(sql),OCI_NTV_SYNTAX, OCI_DEFAULT); //parse the SQL statement OCIBindByName(statement,&bind1,err,(text*)":P_ERRNUM",-1,&errnum, sizeof(long),SQLT_INT,NULL,&alenp1,NULL,1,&curelep1,OCI_DEFAULT); //bind errnum OCIBindByName(statement,&bind2,err,(text*)":P_ROWCNT",-1,&rowcnt, sizeof(long),SQLT_INT,NULL,&alenp2,NULL,1,&curelep2,OCI_DEFAULT); //bind rowcnt if(OCIStmtExecute(svcctx,statement,err,1,0,NULL,NULL,OCI_DEFAULT) != OCI_SUCCESS) //execute the statement { long errcode; char errbuf[512]; OCIErrorGet (err,1,NULL,(sb4*)&errcode,(OraText*)errbuf,512, OCI_HTYPE_ERROR); //check to see what the error was printf("ERROR %d - %s\n",errcode,errbuf); return FAIL; } </code></pre> <p>I use 'FAKEIDNUM' since I obviously dont want to actually delete anything during this test. Since that doesnt exist in those tables, rowcnt should be 0 and errnum should be 332 when the procedure ends.</p> <p>I get exactly the same error as with the other procedure. </p> <pre><code>ERROR 6550 - ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'DELSTL' ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'DELSTL' ORA-06550: line 1, column 7: PL/SQL: Statement ignored </code></pre> <p>Does this give anyone any ideas? Thanks!</p> |
22,447,955 | 0 | Simple ColdFusion Form <p>This is for a simple submit into a database. I have two tables. One is called "Authors", while the other is called "corpPosts".</p> <p>The Form consist of a Title, and a Body value that will be inserted as a new entry into the corpPosts Table.</p> <p>The form also consists of a drop down box which collects values from the Authors table. The user clicks the designated author to decide who posted the blog.</p> <p>Once the form is submitted, it Creates a new record in the corpPosts Table, inserting the Title, Body, as well as the author into the corpposts table. The Author in the corppost table is represented by "UserID".</p> <p>I do not remember how to associate the AuthorName to the UserID however. I know this is a relatively simple query.</p> <pre><code><cfform action="AddCorp.cfm" method="post"> <cfinput type="text" reqired="yes" name="Title" id="Title"> <textarea style="width: 1000px; height: 600px;" name="CorpBody" id="Body"></textarea> <select Name="SelectAuthor"> <!--- Queries ---> <cfquery name="Authors" datasource="corpposts"> SELECT Name FROM Authors </cfquery> <cfoutput QUERY="Authors"><option>#Name#</option></cfoutput> </select> <cfinput type="Submit" name="Submit" id="Submit" value="Submit"> </cfform> </code></pre> <p>On the Next Page:</p> <pre><code><!--- Query to Insert ---> <CFQUERY name="AddPosts" datasource="corpposts"> INSERT INTO CorpPosts (Title, CorpBody, UserID) VALUES ('#Form.Title#', '#Form.CorpBody#', '#Form.UserID#') </CFQUERY> </code></pre> |
3,127,877 | 0 | <p>The dot added to the name is used by the <a href="http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx" rel="nofollow noreferrer">default model binder</a> when the form is submitted in order to correctly populate the model. As far as validation is concerned you could set it like this:</p> <pre><code>$("#myForm").validate({ rules: { 'Box.Name': { required: true } }, messages: { 'Box.Name': { required: 'some error message' } } }); </code></pre> |
35,020,279 | 0 | Edit image in UIImageView and use new image <p>I have an app where you enter information into some forms and press a button to email the image with the information from the forms put on the image. I turn the strings from the forms into UILabels and place those on the UIImageView and then I try to get that image and email it as an attachments. When I do press the button, I just get the original image in the email. Here's my code:</p> <pre><code>-(IBAction)emailToCustomer:(id)sender { UIImage *rebateImage = [UIImage imageNamed:@"rebate.png"]; UIImageView *rebateImView = [[UIImageView alloc]initWithImage:rebateImage]; UILabel *rebateLabel = [[UILabel alloc]init]; rebateLabel.text = productField.text; [rebateImView addSubview:rebateLabel]; NSData *rebateData = UIImagePNGRepresentation(rebateImView.image); MFMailCOmposeViewController *mailVC = [[MFMailComposeViewController alloc]init]; [mailVC setMailComposeDelegate:self]; if([MFMailComposeViewController canSendMail]) { [mailVC setSubject:@"Rebate"]; [mailVC addAttachmentData:rebateData mimeType:@"image/png" filename:@"RebateCoupon.png"]; [self presentViewController:mailVC animated:YES completion:nil]; } else { NSLog(@"Can't Send Mail"); } } </code></pre> <p>All I get in the email is the original rebate image, even though I enter information in the fields. I want the text from productField to be put on the image from the UIImageView and attach the new image to the email.</p> |
11,341,997 | 0 | <p>Have you tried</p> <pre><code> if(s1 == "Computer" ) { sb.Append("<tr><td>"+s1+"</td></tr>"); } </code></pre> |
40,682,298 | 0 | <p>You should have a Source and Design button in your project, so when you select Design button, it lets you update properties of all objects. You have it?</p> |
11,039,790 | 0 | <p>Per this <a href="http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Pluggable+Enterprise+Search+with+Solr" rel="nofollow">link</a> it is to externalize the search function from the portal. </p> <p>Using Solr instead of Lucene gives you the additional capabilities of Solr such as Replication, Sharding, Result clustering through Carrot2, Use of custom Analyzers/Stemmers etc. </p> <p>It also can offload search server processing to a separate cluster.</p> <p>Opens up the possibilities of search driven UI (facetted classification etc) separate from your portal UI.</p> |
38,395,857 | 0 | Two synchronous http calls using Observable <p>I have a problem with Observables in Angluar2 app. Let assume hypothetical situation that I need to make two separate http calls. One call depends directly on the result of the other. The code looks like this:</p> <pre><code>this.http.get('http://kalafior/group/'+id) .map(res => res.json()) .subscribe(group => { //url depends on previous call result this.http.get('http://kalafior/group/'+group.id+'/posts') .map(res => res.json()) .subscribe((res) => { console.log(res); }); }); </code></pre> <p>There are nested subscribe() calls which I want to get rid of. </p> |
38,504,716 | 0 | <blockquote> <p>What's the easiest method to solve this?</p> </blockquote> <p>Brute force.</p> <p>Compute all products of 3 numbers in N choose 3 time, and then take the maximum.</p> <p>How big is your input? You could reuse products of 2 numbers with a memoizing (dynamic programming) approach.</p> |
27,174,398 | 0 | AngularJS. Possible to add custom properties on a $resource factory? <p>I have a HTTP based RESTful APIs When i connect for example to www.domain.com/chiamate/ELSENWZ i got this result:</p> <pre><code>{ "TICKET": "155112-I", "TICKET_2": "ATRE6463", "ACCOUNT_NAME": "PIPPO", "CUSTOMER_NUMBER": "AG5", "PROBLEM_TYPE": "H", "VENDOR": "ITALWARE-CON", "DESCR": "HP 6300 PRO SFF", } </code></pre> <p>I have implemented into AngularJS a service to use the rest api in this way:</p> <pre><code>var services = angular.module('ngdemo.services', ['ngResource']); services.factory('ChiamataFactory', function ($resource) { return $resource('/chiamate/:id', {}, { show: { method: 'GET', isArray: false, // <- not returning an array transformResponse: function(data, headers){ var wrapped = angular.fromJson(data); alert(JSON.stringify(wrapped, null, 4)); angular.forEach(wrapped.items, function(item, idx) { wrapped.items[idx] = new Post(item); //<-- replace each item with an instance of the resource object }); return wrapped; } }, create: { method: 'POST' }, update: { method: 'PUT', params: {id: '@id'} }, }) }); </code></pre> <p>because i want that when the controller use the service,</p> <pre><code>$scope.chiamata = ChiamataFactory.show({id: 'ELSENWZ'}); </code></pre> <p>into result i need to add some extra properties.</p> <p>The problem is that the service don't use the transformResponse</p> |
2,271,532 | 0 | Android: Forcing a WebView to a certain height (or triggering scrolling for a div) <p>I am building an app which contains an input form and a WebView. The project is available at <a href="http://code.google.com/p/android-sap-note-viewer/" rel="nofollow noreferrer">http://code.google.com/p/android-sap-note-viewer/</a></p> <p>The WebView will render a website based on the input and this page has a DIV with the main contents (could be hundreds of lines). I have no control of the contents on the website.</p> <p>Android WebKit doesn't seem to do any scrolling in a DIV, ref <a href="http://www.gregbugaj.com/?p=147" rel="nofollow noreferrer">http://www.gregbugaj.com/?p=147</a>. Therefore, only parts of the DIV is shown to the user, with no method of retrieving the rest of the text. <strong>My challenge is to find a way that all the text of the DIV is shown</strong>.</p> <p>My view is defined as the following: </p> <pre><code> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content" android:text="@string/lblNote" /> <EditText android:id="@+id/txtNote" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:numeric="decimal" android:maxLength="10" /> <Button android:id="@+id/bView" android:text="@string/bView" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:isScrollContainer="false" android:keepScreenOn="false" android:minHeight="4096px" /> </LinearLayout> </code></pre> <p>Here I've tried to hardcode the WebView to a large height in order to make sure the DIV is stretched out and shows all the text, and also force the LinearLayout to do the scrolling.</p> <p>However, the WebView is always adapting to the screen size (which would be good in most cases, but not this).</p> <p><strong>Any ideas on how to solve this problem?</strong></p> <p>(only solution I see now is to fetch the HTML myself, remove the DIV and send it to the WebView)</p> |
959,692 | 0 | <p>I guess it's a hard thing to do. Firstly you need to read the text in that pdf, and then use some mechanism of synthetic voice generation to create the audio content. Then you have to store it as an mp3.</p> |
40,123,506 | 0 | <p>try this answer from @J Santosh</p> <p><a href="http://stackoverflow.com/a/32103637/6952155">http://stackoverflow.com/a/32103637/6952155</a></p> <p>this is the fiddle</p> <p><a href="http://jsfiddle.net/SantoshPandu/z2v31Leo/3/" rel="nofollow">http://jsfiddle.net/SantoshPandu/z2v31Leo/3/</a></p> <p>snippet <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() { var dateStart = new Date(); dateStart.setDate(dateStart.getDate()-1); var dp = document.getElementById("datepicker1"); $("#datepicker1").datepicker( { format: "mm-yyyy", startView: "months", minViewMode: "months", startDate: dateStart, datesDisabled: dp.dataset.datesDisabled.split() }).datepicker("setDate",null); $("#datepicker1").on('changeMonth',function(date){ console.log(date.date.getMonth()+1); }) });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.min.js"></script> <div class="modal-body"> <div class="input-append date" id="datepicker1" data-date="Aug-2015" data-date-format="mm-yyyy" data-dates-disabled="Sep-2015,Oct-2015" style="display:inline-block; font-weight:bold;"> Check In: <input type="text" readonly="readonly" name="date1" > <span class="add-on"><i class="glyphicon glyphicon-calendar"></i></span> </div> </div> </code></pre> </div> </div> </p> |
27,270,532 | 1 | better way to find pattern in string? <p>I have two strings from which I want to extract IPs.</p> <p>These are:</p> <pre><code>a = """+CGCONTRDP: 1,0,"open.internet","100.80.54.162.255.255.255.255","100.80.54.162","8.8.8.8 ","62.40.32.33","0.0.0.0","0.0.0.0",0 OK """ b = """+UIPADDR: 1,"usb0:0","100.80.54.93","255.255.255.255","","" OK """ </code></pre> <p>From the first I want <code>100.80.54.162</code> and the second I want <code>100.80.54.162</code>. Now obviously lengths of numbers in an IP changes. For the moment I am spitting on <code>","</code> and finding the numbers before the first 4 <code>.</code>'s. What is a better way to do this as it seems dirty, perhaps the first occurrence of digits.digits.digits.digits and stopping at the next non digit character, a pattern looking for that? How would you do it?</p> |
15,125,945 | 0 | <p><a href="http://ideone.com/bGg6Wm" rel="nofollow">The code in your question compiles.</a> Does your <em>real</em> code have <code>public static void Order()</code> instead?</p> <p>Either way, I'm guessing you meant to do this in a constructor, so remove the <code>void</code>:</p> <pre><code>public class Order { private static int totalOrdersPlaced; public final int orderID; public Order() { totalOrdersPlaced++; orderID = totalOrdersPlaced; } } </code></pre> |
41,003,216 | 0 | <p>Use <a href="http://dev.mysql.com/doc/refman/5.7/en/load-data.html" rel="nofollow noreferrer">LOAD DATA INFILE</a> to import from CSV to MySQL databse table. Example:</p> <pre><code>LOAD DATA INFILE 'data.csv' INTO TABLE my_table; </code></pre> |
23,811,584 | 0 | scraping a dynamic and inconsistent dom site <p>topic 2 is trending thread so it returned an extra markup span, that broke my query. How to solve this kind of problem? if I do //span at the end then the others three are out.</p> <pre><code> <li> topic 1 </li> <li> <span style="color:red">topic 2</span> </li> <li> topic 3 </li> "poll" <li> topic 4 </li> </code></pre> |
35,488,813 | 0 | <p>Your PNG is very likely 32-bit color. In your <code>ImageList_Create()</code> calls, use the flags <code>ILC_COLOR32 | ILC_MASK</code>, not <code>ILC_MASK</code> only.</p> <p>According to <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb775232%28v=vs.85%29.aspx" rel="nofollow">MSDN</a>, if you don't specify one of the <code>ILC_COLORxxx</code> flags, it defaults to <code>ILC_COLOR4</code>, which is 4-bit 16 color graphics. This explains your reduced image quality. Explicitly specifying <code>ILC_COLOR32</code> will give you the full-color icons you want.</p> |
37,658,989 | 0 | Using RegularExpressionValidator how can I check whether a textBox includes either an at (@) or a hyphen (-)? <p>This is very basic and not thorough validation I know but the textbox needs to accept for example [email protected] as well as 4556-222-44444.</p> <p>I've tried </p> <pre><code><asp:RegularExpressionValidator Display="Dynamic" runat="server" ControlToValidate="txtAddToBlacklist" ErrorMessage="Invalid" ValidationExpression="^[\-\@]$"></asp:RegularExpressionValidator> </code></pre> <p>This attempt included the escaping backslashes to no avail.</p> <p>My logic for using "[-@]" to check for either to be present came from <a href="http://stackoverflow.com/a/4068725/2823680">this answer</a>.</p> <p>I know that the hyphen has to be at the beginning or the end but as it's only two characters, I don't think this is the issue.</p> <p>The ^ and $ are included as that seems to be recommended practice to prevent malicious extras being appended.</p> <p>Must be missing something though so any help is appreciated!</p> |
19,218,550 | 0 | <p>I think you need to implement a kind of a chat and not how to send a SMS via WiFi.</p> <p>There is a good example at the Android Developers page: <a href="https://code.google.com/p/simple-android-instant-messaging-application/" rel="nofollow">https://code.google.com/p/simple-android-instant-messaging-application/</a></p> <p>Also check this link : <a href="http://stackoverflow.com/questions/16954712/android-whatsapp-chat-examples">Android Whatsapp/Chat Examples</a></p> <p>gl, Refael</p> |
30,585,081 | 0 | Different notification partials for different models? <p><strong>notifications/index</strong> has <code><%= render partial: "notifications/notification", collection: @notifications %></code>, which contains:</p> <pre><code><%= link_to "", notifications_habit_path(notification.id), method: :delete, class: "glyphicon glyphicon-remove" %> <%= link_to Comment.find_by(notification.comment_id).user.name, user_path(Comment.find_by(notification.comment_id).user.id) %> commented on <%= link_to "your habit", habit_path(notification) %> </code></pre> <p>which shows:</p> <p><img src="https://i.stack.imgur.com/zVT87.png" alt="enter image description here"></p> <p>This is problematic because it should say 3x <em>".com commented on your habit"</em> and 2x <em>".com commented on your value"</em>.</p> <p>We need to create two separate partials <strong>notifications/_habits</strong> & <strong>notifications/_values</strong>.</p> <p>My confusion is how to make the code know when to direct to the habit partial or the value partial based on whether it's a habit or value.</p> <p><strong>notifications_controller</strong></p> <pre><code>def index @habits = current_user.habits @valuations = current_user.valuations #aka values @notifications = current_user.notifications @notifications.each do |notification| notification.update_attribute(:read, true) end </code></pre> <p>The notifications are based on if a user comments on one of your habits or values:</p> <p><strong>comment.rb</strong></p> <pre><code>class Comment < ActiveRecord::Base after_save :create_notification has_many :notifications belongs_to :commentable, polymorphic: true belongs_to :user validates :user, presence: true private def create_notification Notification.create( user_id: self.user_id, comment_id: self.id, read: false ) end end </code></pre> <p>I followed this tutorial but it is based on using just one model: <a href="http://evanamccullough.com/2014/11/ruby-on-rails-simple-notifications-system-tutorial/" rel="nofollow noreferrer">http://evanamccullough.com/2014/11/ruby-on-rails-simple-notifications-system-tutorial/</a></p> <h2>UPDATE FOR VALADAN</h2> <pre><code>class CommentsController < ApplicationController before_action :load_commentable before_action :set_comment, only: [:show, :edit, :update, :destroy, :like] before_action :logged_in_user, only: [:create, :destroy] def index @comments = @commentable.comments end def new @comment = @commentable.comments.new end def create @comment = @commentable.comments.new(comment_params) if @comment.save redirect_to @commentable, notice: "comment created." else render :new end end def edit @comment = current_user.comments.find(params[:id]) end def update @comment = current_user.comments.find(params[:id]) if @comment.update_attributes(comment_params) redirect_to @commentable, notice: "Comment was updated." else render :edit end end def destroy @comment = current_user.comments.find(params[:id]) @comment.destroy redirect_to @commentable, notice: "comment destroyed." end def like @comment = Comment.find(params[:id]) @comment_like = current_user.comment_likes.build(comment: @comment) if @comment_like.save @comment.increment!(:likes) flash[:success] = 'Thanks for liking!' else flash[:error] = 'Two many likes' end redirect_to(:back) end private def set_comment @comment = Comment.find(params[:id]) end def load_commentable resource, id = request.path.split('/')[1, 2] @commentable = resource.singularize.classify.constantize.find(id) end def comment_params params[:comment][:user_id] = current_user.id params.require(:comment).permit(:content, :commentable, :user_id, :like) end end </code></pre> |
33,756,349 | 0 | Can I see object sent from ajax to php in php with a debugger? <p>I have a problem, I make an ajax call to a php file and I send a json object as a param from ajax/javascript to php, then php is supposed to do some logic with that object and return it with echo <code>json_encode('whatever');</code> My problem is when I'm working with the javascript object in php I'm blind, because my ajax call only have the success or the error function to "know" what hapenned in php, but I would like to know what mechanism can I use to see what happens inside php, like for example print the object received from ajax and see whatever is inside of it. How can I debug when I'm inside a php file called from ajax?? I've tryed chrome debuger and also firebug, and followed both tutorials, but I don't even see the php file that is called from ajax, so I can't set breakpoints into it. This is my code to do the ajax call to my php file and my php file that echos whatever information back:</p> <pre><code>function loadFormAdvanced(advancedFormVars) { var json = new Array(); json = '['; for (var prop in advancedFormVars) { if (advancedFormVars.hasOwnProperty(prop)) { // or if (Object.prototype.hasOwnProperty.call(obj,prop)) for safety... json += '{"' + prop + ":" + advancedFormVars[prop] + '},'; } } json += ']'; $.ajax({ url: 'AL_loadForm.php', type: 'POST', data: { advancedFormVars: json //"[{"OfferID:"OfferID"},{"offerName:"Offer Name"},{"campaignID:"CampaignID"},{"campaignName:"CampaignName"},{"offerIDFilt:"OfferID"},{"dates:"Dates"},]" }, dataType: 'json', success: function (data) { alert(data); }, error: function (request, error) { alert("Error: please fill the required fields"); } }); } </code></pre> <p>What I would like is to be abble to see what happens in my php file, or for example, to see the content of <code>$val</code> variable. </p> |
21,174,310 | 0 | Loop with trigger (which contains animation) not working <p>So I seem to have run into a bit of a dead end. I'm making a page which has an image slider. The slider has three images, one centered on the screen, the other two overflow on the left and right. When you click on the button to advance the slides it runs this code.... </p> <pre><code>$('#slideRight').click(function() { if ($('.container').is(':animated')) {return false;} var next=parseInt($('.container img:last-of-type').attr('id')) + 1; if (next == 12) { next = 0; } var diff = galsize() - 700; if ($('.thumbs').css("left") == "0px") { var plus = 78; } else { var plus = 0; } var app='<img id="' + next + '" src="' + imgs[next].src + '">'; $('.container').width('2800px').append(app); $('.container').animate({marginLeft: (diff + plus) + "px"}, 300, function() { $('.container img:first-of-type').remove(); $('.container').width('2100px').css("margin-left", (galsize() + plus) + "px"); }); }); // end right click </code></pre> <p>This works just fine, not a problem..... I also have an interval set up to run this automatically every 5 seconds to form a slideshow...</p> <pre><code>var slideShow = setInterval(function() { $('#slideRight').trigger("click"); }, 5000); </code></pre> <p>This also works perfectly, not a problem.... However my problem is this.... I have thumbnails, when you click on a thumbnail, it should run this code until the current picture is the same as the thumbnail.... here is the code....</p> <pre><code>$('img.thumbnail').click(function() { clearInterval(slideShow); var src = $(this).attr("src"); while ($('.container img:eq(1)').attr('src') != src) { $('#slideRight').trigger("click"); } }); </code></pre> <p>When I click on the thumbnail nothing happens... I've used alert statements to try and debug, what ends up happening is this.... </p> <p>The while loop executes, however nothing happens the first time. The slide is not advanced at all. Starting with the second execution, the is('::animated') is triggered EVERY TIME and the remainder of the slideRight event is not executed...</p> <p>So my first problem, can anyone shed some light on why it doesn't run the first time?</p> <p>And my second question, is there any way to wait until the animation is complete before continuing with the loop?</p> <p>Any help would be appreciated. Thank you!</p> |
6,237,766 | 0 | Slicing Tools for Eclipse <p>Does anyone know if there are any open source tools for eclipse that can generate static program slices according to the slicing technique outlined by Mark Weiser (<a href="http://en.wikipedia.org/wiki/Program_slicing" rel="nofollow">http://en.wikipedia.org/wiki/Program_slicing</a>)? I can only seem to find JSlice, which only works for Fedora. Any pointers about how I could tackle this (and libraries out there, or example algorithms for java) would be great.</p> |
17,143,195 | 0 | <p>Use Include method for eager loading related entities, like described here: <a href="http://msdn.microsoft.com/en-US/data/jj574232" rel="nofollow">http://msdn.microsoft.com/en-US/data/jj574232</a></p> |
30,365,893 | 0 | <p>You can check if the respective device has an app is installed using:</p> <pre><code>// url = "example" (check the following image to understand) let canOpen = UIApplication.sharedApplication().canOpenURL(NSURL(string: url as String)!) </code></pre> <p>Where <code>url</code> is pre configured (have a URL scheme registered for your app in your Info.plist)</p> <p>So, if canOpen is <code>true</code> means that app is installed and you can open using:</p> <pre><code>UIApplication.sharedApplication().openURL(NSURL(string:url)!) </code></pre> <p><img src="https://i.stack.imgur.com/YuFk9.png" alt="enter image description here"></p> |
32,937,832 | 0 | <p>I believe you want something like this</p> <pre><code>//class hierarchy to set the priority for type matching struct second_priority { }; struct first_priority : public second_priority {}; template<typename T> auto size_impl(T const & data, second_priority t) -> int { return sizeof(data); } template<typename T> auto size_impl(T const & data , first_priority t) -> decltype(data.size(),int()) { return data.size(); } template<typename T> int size(T const & data ) { return size_impl(data,first_priority{}); } </code></pre> |
14,898,728 | 0 | <p>You can use <code>position</code>ing.</p> <pre class="lang-css prettyprint-override"><code>#content h1 {position: relative; top: -15px;} </code></pre> <p>Or to put it in a better way, give <code>position</code>ing for both.</p> <pre class="lang-css prettyprint-override"><code>#content {position: relative;} #content h1 {position: absolute; top: -15px;} </code></pre> <p>For the query about negative <code>top</code> values:</p> <blockquote> <p>Negative values are allowed and would result in the element being moved in the opposite direction to those already stated above.</p> </blockquote> <p>References:</p> <ul> <li><a href="http://reference.sitepoint.com/css/top" rel="nofollow">Sitepoint</a></li> </ul> |
15,937,853 | 0 | <p>Just in case... Did you check that your memory card is correct ? if you use wifi - The connection is good ?</p> |
25,497,505 | 0 | <p>Wrong reallocation.</p> <pre><code>// filename = realloc(filename, i+1); filename = realloc(filename,(i+1) * sizeof *filename);` </code></pre> <p>BTW: No need to differentiate memory allocation calls. Since the pointer is initialized to <code>NULL</code>, use <code>realloc()</code> the first and subsequent times.</p> <pre><code>char **filename = NULL; ... // if (i == 0) filename = malloc(sizeof(char*)*(i+1)); // else filename = realloc(filename,i+1); filename = realloc(filename,(i+1) * sizeof *filename);` </code></pre> <p>@PaulMcKenzie well points out code should check for problem return values. Further, <code>fileanme</code> should be <code>free()</code> in the end.</p> |
37,699,538 | 0 | How to immediately know if connection is lost with Socket.IO? <p>I'm working on a project that includes BeagleBoneBlack and web server written in NodeJs. The idea is that when Beaglebone detects something from enviroment sends it to web server, and if connection is lost for some reason BBB stores the log in it's own database.</p> <p>So I use SocketIO, and I emit when BBB detects something. I use flag variable isConnected that I put on false on "disconnect" event, and if isConnected is false I'm not emiting to server, just writing in database. </p> <p>Problem is that when computer, where server is running, goes to sleep (simulating lost connection), SocketIo needs sometimes more than a minute to detect that connection is lost, and emit disconnect event. Is there any way to get this info faster, because the program tries to send readings to server and can't, but it's not written in database. </p> |
22,594,705 | 0 | <p>To extend on the Scott Answer, dont forget to add the filePath: property to log.js file... otherwise it will not work :)</p> <p>So it should be something like:</p> <pre><code>log: { level: 'info', maxSize: 1000, filePath: 'c://serverlogs/mylogfilename.log' </code></pre> <p>Answer is changed based on Joseph question.</p> |
32,299,130 | 0 | <p>Please update your updateInput with following code</p> <pre><code>function updateInput(ish){ cc2=ish; } </code></pre> <p>This will assign the value of your input to cc2 var. So on each change in input will make cc2 to holds the latest value.</p> |
4,635,377 | 0 | Java API Source Code <p>Where can I find the source code of the Java API?</p> |
20,993,115 | 0 | <p>I don't know if it is related, I had a lot of trouble with embedded script in jade file. Syntax changed. You might have to add a dot to the script tags in jade file, if JS is followed in next lines.</p> <p>There is another evil change, you need to write doctype html instead of doctype 5</p> <pre> script var x=1 is now script. var x=1 </pre> |
29,729,896 | 0 | In the following multithreaded applet only the first thread is getting executed? <p>The program is sending packets from sender to receiver and back to sender from receiver. It is using thread for each packet but only first packet is traversing the route.</p> <pre><code>import java.applet.Applet; import java.awt.*; import java.util.ArrayList; import java.util.*; public class CongestionControl extends Applet { ArrayList<Packets> packetList = new ArrayList(); static int width, height; int packetCount; static int sourceLocationX; private Label ls = new Label("Sender"); private Label lr = new Label("Reciever"); int sourceLocationY; int SWS; int packetWidth; int packetHeight; static int destLocationX; Random random = new Random(); int RTT; public CongestionControl() { sourceLocationX = 100; sourceLocationY = 200; destLocationX = 400; RTT = 5; SWS = 4; packetWidth = 10; packetHeight = 10; packetCount = 10; } public void init() { width = getSize().width; height = getSize().height; setLayout(null); for (int i = 0; i < packetCount; i++) { packetList.add(new Packets(sourceLocationX, sourceLocationY, Math .round(((2 * (-sourceLocationX + destLocationX)) / RTT) + 2))); // adding 2 purposely } add(ls); ls.setBounds(100, 240, 140, 30); add(lr); lr.setBounds(destLocationX + 20, 240, 140, 30); } private class MovingRunnable implements Runnable { private final Packets p; private MovingRunnable(Packets p) { this.p = p; } public void run() { for (;;) { p.move(); repaint(); try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } } } } public void start() { for (Packets packet : packetList) { Thread t; t = new Thread(new MovingRunnable(packet)); try { Thread.sleep(RTT / SWS); // packet generation interval } catch (InterruptedException e) { e.printStackTrace(); } t.start(); System.out.println("New thread generated"); } } public void paint(Graphics g) { super.paint(g); for (Packets Packet : packetList) { g.drawRect(Packet.x, Packet.y, packetHeight, packetWidth); g.drawLine(sourceLocationX, sourceLocationY + packetHeight, destLocationX, sourceLocationY + packetHeight); } } public class Packets { int x; int y; int deltaX; int deltaY; public Packets(int startx, int starty, int deltax) { this.x = startx; this.y = starty; this.deltaX = deltax / 5; } public void move() { x += deltaX; if (x >= CongestionControl.destLocationX - packetWidth) { x = x - deltaX; deltaX = -deltaX; y += (packetHeight + 10); } } } } </code></pre> <p>Why only first thread is running?</p> |
23,659,766 | 0 | <p>On you dumbed down question (which is synchronous). Sure you could, but you'd have to return the value from your callback, your callback handler and your calling function.</p> <pre><code>var a = function (param, callback) { return callback(param); }; var base = function () { return a(5, function (a) { return 2*a; }); } </code></pre> <p>This would not work in an asynchronous case, Then you need callback functions, or instead returning a deferred, promise or future.</p> <p>For example</p> <pre><code>function asynchDoubler(number) { var deferred = new Deferred(); setTimeout(function () { deferred.callback(2*number); }, 1); return deferred; } asynchDoubler(5).addCallback(function (result) { console.log(result); }); // outputs 10 </code></pre> |
21,454,159 | 0 | <p>If I understand you correctly you have one table with words (or more general text). This is your table $nome. Now you want to select all rows from another table table_dediche, where column dediche does not containt anything that is in the table $nome. Is this correct?</p> <p>That is not possible, if you get the values from another table. There is nothing like combining like and in with the result of a subquery. You can have a look at <a href="http://stackoverflow.com/questions/1127088/mysql-like-in">MySQL LIKE IN()?</a> where they solve that problem using an regex. Not sure if that works in your case.</p> |
23,468,464 | 0 | <p>I've put an example directive here: <a href="http://embed.plnkr.co/fQhNUGHJ3iAYiWTGI9mn/preview" rel="nofollow">http://embed.plnkr.co/fQhNUGHJ3iAYiWTGI9mn/preview</a></p> <p>It activates on the <code>my-grid</code> attribute and inserts a checkbox column. The checkbox is bound to the <code>selected</code> property of each item (note that it's an Angular template and it uses <code>dataItem</code> to refer to the current item). To figure out the selected items you can do something like:</p> <pre><code>var selection = $scope.grid.dataSource.data().filter(function(item){ return item.selected; }); </code></pre> <p>The checkbox that is added in the header will toggle the selection.</p> <p>HTH.</p> |
29,850,688 | 0 | <p>Before <code>listViewTweets.setAdapter(adapter);</code> insert:</p> <pre><code>listviewo.setEmptyView(findViewById(R.id.loading)); </code></pre> <p>loading is a <code>ProgressBar</code> put it inside your XML where you have the <code>ListView</code>:</p> <pre><code><ProgressBar android:id="@+id/loading" android:layout_width="wrap_content" android:layout_height="match_parent" android:indeterminateDrawable="@anim/loading_rotation" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:visibility="gone" /> </code></pre> <p>by this: <code>android:indeterminateDrawable="@anim/loading_rotation"</code> i created a picture that rotate.</p> <p>to set the animation just create an <code>xml</code> file put it in a folder called <code>anim</code> : </p> <pre><code><?xml version="1.0" encoding="utf-8"?> <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/iconloading" android:pivotX="50%" android:pivotY="50%" /> </code></pre> <p>the loading picture is<code>iconloading</code>.</p> <p>hope this helps.</p> |
22,723,277 | 0 | <p>If you've posted your code correctly, the problem is with Coffeescript.</p> <p>According to the translator at <a href="http://coffeescript.org" rel="nofollow">coffeescript.org</a>, your future translates to</p> <pre><code>myFuture = new Future; popular_imgs = function() { ... }; </code></pre> <p>This is obviously not what you want. The fix is simple:</p> <pre><code>myFuture = new Future -> Insta.media.popular (img, err)-> myFuture.return img </code></pre> |
30,638,029 | 0 | session_start() not working and giving warning although it's on the top of the page <p>This code was working properly in Xampp but it's not working after I uploaded it on the server</p> <pre><code><?php ob_start(); session_start(); if(session_status()!=PHP_SESSION_ACTIVE) { session_start();} if(!isset($_SESSION['username']) || !isset($_SESSION['password'])) { header('location:login.php'); } $connection=mysqli_query('localhost','username','password','dbname') ?> <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/html"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </code></pre> <p>The page has loaded fine but it's giving error on top of the page and because it's an admin page it must not open unless the session is set. this is the warning that I am getting right now.</p> <pre><code>Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home3/index.php:1) in /home3/index.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at /home3/index.php:1) in /home3/index.php on line 7 </code></pre> |
415,850 | 0 | <p>The standard creation of folders in Windows XP is <a href="http://msdn.microsoft.com/en-us/library/aa363855%28VS.85%29.aspx" rel="nofollow noreferrer">CreateDirectory</a>. This is a Kernel32 function. </p> <p>Since you're referring to "New Folder", and expect to have UI, I think you are actually refering to Explorer, the default shell for XP. "Ne Folder"is a predefined entry in the context menu, and that list is extensible. However, you'll notice a divider line. "Folder'and "shortcut" are built-ins; the other entries are configured. It would be trivial to add a "New Folder Structure" entry below the divider (ShellNew key in HKCR)</p> |
8,638,847 | 0 | Google Cloud Print is built on the idea that printing can be more intuitive, accessible, and useful. Using Google Cloud Print you can make your printers available to you from any Google Cloud Print enabled web, desktop or mobile app. |
7,381,723 | 0 | <p>PS1=.. Is setting the value of the prompt that is displayed</p> <p>export LC_ALL is settiing an environment variable that will be available to programmes that bash executes. See <a href="http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html" rel="nofollow">http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html</a></p> |
38,531,617 | 0 | underscore in Map function in scala <p>A quick question about use of underscore in map function, suppose I have a RDD below:</p> <pre><code>val R_1 = sc.parallelize(List((1, 2), (3, 4), (5, 6))) R_1.map(x => x._1 + x._2) </code></pre> <p>result is (3, 7, 11)</p> <p>I got a error when I use <code>R_1.map(_._1 + _._2)</code> to do this.</p> <p>I dont really understand underscore magic in scala lambda expression. So my question is what is difference between <code>R_1.map(x => x._1 + x._2)</code> and <code>R_1.map(_._1 + _._2)</code>. Is there any other way to write <code>R_1.map(x => x._1 + x._2)</code>? any help is appreciated.</p> |
22,049,033 | 0 | how do i create a debuggable axis2 project in eclipse using maven? <p>I followed the tutorial at <a href="http://www.itcuties.com/j2ee/axis2-java2wsdl-approach/" rel="nofollow">this link</a> to create a axis2 webservice project using maven and eclipse. </p> <p>However, this setup doesn't allow me to debug my code. Can someone point me to a link which will allow me to use maven to build my axis2 webservice and debug the code inside eclipse? </p> |
18,297,306 | 1 | python can't find file it just made <p>My program cannot find the path that it just made, the program is for sorting files in the download folder. If it finds a new type of file it should make a folder for that file type. </p> <pre><code>import os FileList = os.listdir("/sdcard/Download/") for File in FileList: #print File extension = ''.join(os.path.splitext(File)[1]) ext = extension.strip('.') if os.path.exists("/mnt/external_sd/Download/" + ext): Data = open("/sdcard/Download/" + File, "r").read() file("/mnt/external_sd/" + ext + "/" + File, "w").write(Data) elif os.path.exists("/mnt/external_sd/Download/" + ext) != True: os.makedirs("/mnt/external_sd/Download/" + ext) Data = open("/sdcard/Download/" + File, "r").read() file("/mnt/external_sd/" + ext + "/" + File, "w").write(Data) </code></pre> |
17,329,927 | 0 | WiX Make a Sub-Dir a Component Group when running heat <p>Hello all my fellow WiX'ers,</p> <p>I was wondering if it possible, and if so where I can go to learn how to do it, to run heat on a directory and have each directory inside that one be it's own Component Group.</p> <p>Example:</p> <ul> <li>Root Directory <ul> <li>Sub Dir 1 <ul> <li>Sub Sub Dir 1</li> <li>Sub Sub Dir 2</li> <li>Sub Sub Dir 3</li> </ul></li> <li>Sub Dir 2 <ul> <li>Sub Sub Dir 1</li> <li>Sub Sub Dir 2</li> <li>Sub Sub Dir 3</li> </ul></li> <li>Sub Dir 3 <ul> <li>Sub Sub Dir 1</li> <li>Sub Sub Dir 2</li> <li>Sub Sub Dir 3</li> </ul></li> </ul></li> </ul> <p>Then run a heat command in the Build Event of the VS2010 project (example below): </p> <pre><code>heat dir "Root Directory" -gg -sfrag -srd -dr INSTALLFOLDER -out MyWXS.wxs </code></pre> <p>and then have that WXS file structured like so:</p> <pre><code><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <DirecotryRef Id="INSTALLFOLDER"> <Directory Id="dir84156489" Name="Sub Dir 1"> ... </Directory> <Directory Id="dir84156489" Name="Sub Dir 2"> ... </Directory> <Directory Id="dir84156489" Name="Sub Dir 3"> ... </Directory> </DirectoryRed> </Fragment> <Fragment> <ComponentGroup Id="Sub Dir 1"> ... </ComponentGroup> <ComponentGroup Id="Sub Dir 2"> ... </ComponentGroup> <ComponentGroup Id="Sub Dir 3"> ... </ComponentGroup> </Fragment> </wix> </code></pre> <p>If there is any confusion in my question or if anyone has any additional questions for me please let me know. Thank you and I look forward to hearing from you.</p> <p><strong>EDIT</strong> Using the following xslt file I am getting the WXS structure that follows after:</p> <pre><code>**XLST File** <?xml version="1.0" encoding="utf-8"?> </code></pre> <p></p> <p></p> <p> </p> <p> </p> <pre><code>**WXS File Result** <Wix> <Fragment> <DirectoryRef Id="INSTALLFOLDER"> <Directory Id="dir846546" Name="SubDir1"> ... </Directory> <Directory Id="dir846546" Name="SubDir2"> ... </Directory> <Directory Id="dir846546" Name="SubDir3"> ... </Directory> </DirectoryRef> </Fragment> <wix:Fragment xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"> <wix:ComponentGroup Id="SubDur1"> ... </wix:ComponentGroup> </wix:Fragment> <wix:Fragment xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"> <wix:ComponentGroup Id="SubDur2"> ... </wix:ComponentGroup> </wix:Fragment> <wix:Fragment xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"> <wix:ComponentGroup Id="SubDur3"> ... </wix:ComponentGroup> </wix:Fragment> </Wix> </code></pre> <p>No matter what I do I cannot get the Directories to be created as component groups...</p> |
34,984,012 | 0 | <p>It is not obvious why you get extra exit events, but it may be because you are trying to register more than the 20 allowed monitoring regions. Perhaps you get exit events when the older regions are unloaded by CoreLocation when you go over the limit.</p> <p>The issue with going over the limit happens because you call <code>startMonitoringForRegion</code> when the ViewController loads, but never call <code>stopMonitoringFirRegion</code> on each region when the ViewController becomes inactive. </p> <p>I would change this and maybe it will fix your problem. Just a guess -- if that does not work it may be time to decouple the beacon code from your ViewController as you suggest.</p> |
24,976,770 | 0 | <p>Try this code.</p> <pre><code>echo ' <div class=\"col-md-3\"> <div class=\"thumbnail\"> <span>'.$pdimg.'</span> <div class=\"caption\"> <p>'.$pdetails.'</p> <p><a href=\"#\" class=\"btn btn-primary\" role=\"button\">Button</a> <a href=\"#\" class=\"btn btn-default\" role=\"button\">Button</a></p> </div> </div> </div>"'; </code></pre> <p>I hope this helps you.</p> |
22,261,878 | 0 | How to use pretty-error within a sailsjs app? <p><a href="https://www.npmjs.org/package/pretty-error" rel="nofollow">pretty-error</a> has to be set up like this:</p> <pre><code>require('pretty-error').start(function(){ startTheApp(); }); </code></pre> <p>As I don't now where sailsjs starts the app, I've tried this on <code>config/bootstrap.js</code>:</p> <pre><code>module.exports.bootstrap = function (cb) { require('pretty-error').start(cb) } </code></pre> <p>but it's not working.</p> <p>Any guideline?</p> |
4,655,309 | 0 | TabBar Support of Three20 iPhone Photo Gallery <p>I wend through <a href="http://mobile.tutsplus.com/tutorials/iphone/iphone-photo-gallery-three20/" rel="nofollow">this</a> tutorial and created a photo gallery for the iPhone. Now I want to add it to my TabBar project. I already heard, that Three20 doesn't support XIB, so I changed my whole tab bar setup to programmatically. I think I am not too far from a final solution. </p> <p>I was able to get the photo gallery working in one tab but without functions (click on a pic --> it opens, etc). There is no navigation on top of the page that leads you to the detail image page. I faced this when I removed this from didFinishLaunchingWithOptions-method in app delegate:</p> <pre><code>// Override point for customization after application launch TTNavigator* navigator = [TTNavigator navigator]; TTURLMap* map = navigator.URLMap; [map from:@"demo://album" toViewController: [AlbumController class]]; [navigator openURLAction:[TTURLAction actionWithURLPath:@"demo://album"]]; return YES; </code></pre> <p>I had to remove it because otherwise the whole tab bar is not shown. The photo gallery uses the whole screen. I am not sure if it is just not shown, or not loaded. I also tried:</p> <pre><code>tabbar.hidesBottomBarWhenPushed = NO; </code></pre> <p>But that did not work at all. I tried to add the TTNavigator-code to loadView(), viewDidLoad() and init() in the AlbumController itself without a result. Does anyone know where I have to put this in order to get it working?</p> <p>My AlbumController.h:</p> <pre><code>#import <Foundation/Foundation.h> #import <Three20/Three20.h> @interface AlbumController : TTThumbsViewController { // images NSMutableArray *images; // parser NSXMLParser * rssParser; NSMutableArray * stories; NSMutableDictionary * item; NSString * currentElement; NSMutableString * currentImage; NSMutableString * currentCaption; } @property (nonatomic, retain) NSMutableArray *images; @end </code></pre> <p>And my implementation of the didFinishLaunchingWithOptions-method:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // set up tab bar controller tabBarController = [[UITabBarController alloc] init]; albumController = [[AlbumController alloc] init]; firstViewController = [[FirstViewController alloc] init]; secondViewController = [[SecondViewController alloc] init]; firstViewController.delegateRef = self; tabBarController.viewControllers = [NSArray arrayWithObjects:firstViewController, secondViewController, albumController, nil]; [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; // Override point for customization after application launch TTNavigator* navigator = [TTNavigator navigator]; TTURLMap* map = navigator.URLMap; [map from:@"demo://album" toViewController: [AlbumController class]]; [navigator openURLAction:[TTURLAction actionWithURLPath:@"demo://album"]]; return YES; } </code></pre> <p>Thanks guys, Cheers, dooonot</p> |
6,738,180 | 0 | <p>What you described is essentially the <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" rel="nofollow">Model-View-Controller</a> paradigm used by most web application frameworks. MVC is designed to separate business logic from presentation. </p> <p>I can't really give you a more specific answer since your question is very vague, but the simplest, most stripped-down way to accomplish MVC is to have two php files, one accessible from the outside, which then includes another file in a protected directory.</p> <p>So for example you can have a functions.php file and then in your index.php file</p> <pre><code>require_once('lib/functions.php'); //call functions defined in functions.php </code></pre> <p>Aside from that, I think you just need to read up a bit and experiment on your own.</p> |
8,403,394 | 0 | <p>If you have multiple CTE's, they need to be at the beginning of your statement (comma-separated, and only one <code>;WITH</code> to start the list of CTE's):</p> <pre><code>;WITH CTE AS (......), [UserDefined] AS (.......) SELECT..... </code></pre> <p>and then you can use both (or even more than two) in your <code>SELECT</code> statement.</p> |
33,278,078 | 0 | How can I save a relationship entry to a pivot table in laravel? <p>I have created some relationships where 2 models work together, currently they are <code>Offer</code> and <code>OfferDay</code>. I have created 2 tables one for Offers and one for OfferDays. Here are the migrations:</p> <p>offers</p> <pre><code>class CreateOffersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('offers', function(Blueprint $table) { $table->increments('id'); $table->string('offer_title'); $table->string('offer headline'); $table->string('offer_subheader'); $table->string('image'); $table->text('offer_terms'); $table->string('featured_date'); $table->boolean('is_featured'); $table->string('distance_to_offer'); $table->string('offer_end_time'); $table->string('offer_start_time'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('offers'); } } </code></pre> <p>I then have a migration that runs to create the days for the relationship to work and this holds the day name and the day id in the table where I have seeded the database with days already. Here's the migration schema:</p> <p>offer_days</p> <pre><code>public function up() { Schema::create('offer_days', function(Blueprint $table) { $table->increments('id'); $table->string('day'); $table->timestamps(); }); } </code></pre> <p>This forms the basis of the relationships and the data we have got. The next bit is making them work and when adding an offer making sure I can populate the pivot table with the correct data that relates to offers and offer_days. Below are the 2 models I have got setup with all the correct <code>$fillable</code> attributes for the relationships to work:</p> <p>Offer</p> <pre><code> protected $fillable = ['id','venue_id','offer_day_id','offer_id','day','venue_address','is_featured','repeater_days','image', 'venue_description', 'offer_headline','offer_subheader','offer_terms','venue_phone_number','venue_website', 'venue_name', 'venue_headline','venue_description','venue_latitude','venue_longitude','days','offer_when','offer_end_time','offer_start_time','offer_start_date','offer_end_date','featured_date','current_time','current_date']; /** * Get the offers for the offer. */ public function offerdays() { return $this->belongsToMany('App\OfferDay', 'offer_day_offer', 'offer_day_id', 'offer_id'); } </code></pre> <p>OfferDay</p> <pre><code>protected $fillable = ['offer_id','offer_day_id']; /** * Get the offer days for the offer. */ public function offers() { //return $this->belongsToMany('App\Offer'); return $this->belongsToMany('App\Offer', 'offer_day_offer', 'offer_id', 'offer_day_id'); } </code></pre> <p>I have then created the pivot tables to correspond with this like so:</p> <pre><code>class CreateOfferDayOfferPivotTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('offer_day_offer', function (Blueprint $table) { $table->integer('offer_day_id')->unsigned()->index(); // $table->foreign('offer_day_id')->references('id')->on('offer_days')->onDelete('cascade'); $table->integer('offer_id')->unsigned()->index(); // $table->foreign('offer_id')->references('id')->on('offers')->onDelete('cascade'); $table->primary(['offer_day_id', 'offer_id']); }); Schema::table('offer_day_offer', function($table) { $table->foreign('offer_id')->references('id')->on('offers'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('offer_day_offer'); } } </code></pre> <p>In my controller I have setup the save method which should work like so:</p> <pre><code>if ($validation->fails()) { return redirect('offers')->with('message', $validation->errors()); } else { $file = Input::file('image'); $filename = date('Y-m-d-H')."-".$file->getClientOriginalName(); $path = public_path('images/offers/' . $filename); Image::make($file->getRealPath()) ->save($path); $venue = Input::get('venue_id'); $day = Input::get('day'); $data['image'] = url('/') . '/' . 'images/offers/'.$filename; if($days){ $d = implode(',', $days); $data['days'] = $d; } $data['venue_id'] = $venue; $data['day'] = $day; $offer->offerdays()->attach(['offer_day_id' => 13, 'offer_id' => 530]); Offer::create( $data ); return redirect('offers')->with('message', 'Offer added!'); } </code></pre> <p>This <code>$offer->offerdays()->attach(['offer_day_id' => 13, 'offer_id' => 530]);</code> is the important bit but for some reason I am getting this error below:</p> <pre><code>SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`homestead`.`offer_day_offer`, CONSTRAINT `offer_day_offer_offer_id_foreign` FOREIGN KEY (`offer_id`) REFERENCES `offers` (`id`)) (SQL: insert into `offer_day_offer` (`offer_day_id`, `offer_id`) values (, 13), (, 530)) </code></pre> <p>Can someone try and shed light onto this?</p> <p>Thanks!</p> |
37,945,146 | 0 | <p>So, essentially what you're doing here is dynamic dispatch. by specifying </p> <pre><code>Request request= new AddressRequest (); </code></pre> <p>what you're doing is saying this Request is an AddressRequest, but by calling it a Request you are unable to access the method for AddressRequest.</p> <p>A quick solution would be to Safe Cast -> If you're sure that you're dealing with and AddressRequest, then cast request as </p> <pre><code>(AddressRequest) request.setUserId("11"); </code></pre> |
11,091,707 | 0 | unable to get correct layout <p>Following is the layout of app. It has two views under <code>viewflipper</code>. In the second view, there are 3 rows, row 1 has 3 buttons, row 2 has a image and row 3 has 3 buttons. I want row 1 to be aligned with the top of screen, row 3 to be aligned with the bottom of screen and the image to take the rest of space in between. Could anybody tell me how to achieve that ?</p> <pre><code><?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"> <ViewFlipper android:id="@+id/ViewFlipper01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!--adding views to ViewFlipper--> <!--view=1--> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/tv1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/hello" > </TextView> <VideoView android:id="@+id/myvideoview" android:layout_width="wrap_content" android:layout_height="match_parent" /> <Button android:id="@+id/b" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> </LinearLayout> <!--view=2--> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <!--row 1--> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" xmlns:android="http://schemas.android.com/apk/res/android" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:text="Back" /> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="Upload to Facebook" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/button3" android:text="Save" /> </RelativeLayout> <!--row 2--> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/img" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> <!--row 3--> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Previous" /> <Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/button4"> </Spinner> <Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/spinner" android:text="Next" /> </RelativeLayout> </LinearLayout> </ViewFlipper> </LinearLayout> </code></pre> |
21,635,255 | 0 | <p>Use the <a href="http://php.net/datetime" rel="nofollow">DateTime</a> classes, They are directly comparable and very useful.</p> <pre><code>$test_date= DateTime::createFromFormat('d/m/y', "08/02/2012"); $todays_date = new DateTime(); if($test_date < $todays_date){ echo "Past"; } else { echo "Future"; } </code></pre> <p><a href="http://3v4l.org/kZnCX" rel="nofollow">See it working</a>.</p> |
38,487,553 | 0 | <p>I would go with the first option as it makes little sense to make different actions just for filtering articles/content.</p> <p>Also using enums in the route doesn't seem to be the perfect choice. Meaningful strings are better.</p> |
8,281,199 | 0 | <p>You have to decompress the gzip-file, that step is missing. Try this: <a href="http://stackoverflow.com/questions/1581694/gzipstream-and-decompression">GZipStream and decompression</a></p> |
17,770,510 | 0 | sum of date difference of different id in sql <p>I have user defined function like this:</p> <pre><code>create FUNCTION dbo.FormattedTimeDiff (@Date1 DATETIME, @Date2 DATETIME) RETURNS VARCHAR(10) AS BEGIN DECLARE @DiffSeconds INT = sum(DATEDIFF(SECOND, @Date1, @Date2) ) DECLARE @DiffHours INT = @DiffSeconds / 3600 DECLARE @DiffMinutes INT = (@DiffSeconds - (@DiffHours * 3600)) / 60 DECLARE @RemainderSeconds INT = @DiffSeconds % 60 DECLARE @ReturnString VARCHAR(10) SET @ReturnString = RIGHT('00' + CAST(@DiffHours AS VARCHAR(2)), 2) + ':' + RIGHT('00' + CAST(@DiffMinutes AS VARCHAR(2)), 2) + ':' + RIGHT('00' + CAST(@RemainderSeconds AS VARCHAR(2)), 2) RETURN @ReturnString END </code></pre> <p>I try execute out put like this:</p> <pre><code>SELECT t.vtid, dbo.FormattedTimeDiff(PayDate, DelDate) FROM dbo.Transaction_tbl t where t.Locid = 5 </code></pre> <p>but I am getting output like this:</p> <pre><code>vtid ----------- ---------- 7 00:21:42 7 01:05:30 7 00:37:43 7 NULL 8 00:00:42 8 00:07:25 7 00:25:36. </code></pre> <p>I want to get sum of date difference of vtid 7 and 8</p> <p>Expected output:</p> <pre><code>vtid 7 01:25:45 8 00:07:45 </code></pre> <p>I tried giving group by but showing error, so where I have to made changes in my stored procedure?</p> |
26,275,154 | 0 | How to change url based on input type selected using javaScript/Jquery? <p>I have a form </p> <pre><code> <form name="categoryform" method="post"> Category:<select name="category" id="category" > <option value="games">games</option> <option value="books">books</option> <option value="toys">toys</option> <option value="clothes">clothes</option> </select> Age: <select multiple name="age" id="age" > <option value="5">5</option> <option value="10">10</option> <option value="15">15</option> </select> <input type="submit" name="submit" value="submit"/> </form> </code></pre> <p>Initially the url is <code>http://localhost/childzone/</code></p> <p>If I select the option <code>books</code> from Category the URL must change to <code>http://localhost/childzone/books</code> and when I select option <code>clothes</code> the url must be <code>http://localhost/childzone/clothes</code>.</p> <p>If I also select age=5 from the dropdown <code>age</code> the url must be <code>http://localhost/childzone/clothes&age=5</code>. For multiple options selected i.e, if I select 5 and 10 both from <code>age</code> the url must be <code>http://localhost/childzone/clothes&age=5,10</code>.</p> <p>How do I get such a URL. I am new to php, can anyone help. Thank you in advance</p> |
6,820,096 | 0 | Dismiss ModalView does not work here <p>So I have a tabBarController as a modalview, and it shows up fine. As I click some of the tabs, the views are loading properly. I want to dismiss the modalView when I click on <code>tabBarController.selectedIndex ==4</code></p> <p>So I write in the <code>viewDidLoad</code> and also tried in the <code>viewWillAppear</code> of that view controller to <code>dismissModalViewController</code> and it does not work.</p> <p>I tried</p> <pre><code>[self.parentViewController dismissModalViewControllerAnimated:YES]; // ... And also // [self dismissModalViewControllerAnimated:YES]; </code></pre> <p>Could someone point out why it does not work ?</p> |
17,586,806 | 0 | <ol> <li>Run you app. In debug are you can find "Simulate location" button <img src="https://i.stack.imgur.com/O6Cxn.png" alt="enter image description here"></li> </ol> <p>2.You can select one of default locations (here is list)</p> <p><img src="https://i.stack.imgur.com/O00ka.png" alt="enter image description here"></p> <p>If you need a custom location </p> <p>Create new file : File -> New ->File (Resources tab) GPX file click (at the bottom of locations list) "Add GPX File to workspace"</p> <ol start="3"> <li>Go to this <a href="http://itouchmap.com/latlong.html" rel="nofollow noreferrer">website</a> and get Latitude and Longitude of a Point that you need.</li> <li>Edit GPX file that you have created.</li> <li>Open "Simulate Location", the same as in step 1, and Your location from GPX file will be available in the list.The name of location will be same same as a name of the file. </li> </ol> |
6,677,391 | 0 | sencha touch :: how to make store sorter ignore if first letter is small or capitalized <p>I wonder how to make store sorters ignore if the first letter of a name is small or capitalized? I want to have the list items with the same first letter be grouped together or at least having the small first letter beneath the capitalized and not like it is initially first having a list ob capitalized names and the following the list of small first letters.</p> <p>I found something like</p> <pre><code>var sorter = new Ext.util.Sorter({ property : 'myField', sorterFn: function(o1, o2) { // compare o1 and o2 } }); var store = new Ext.data.Store({ model: 'myModel', sorters: [sorter] }); store.sort(); </code></pre> <p>which could be usefull.</p> <p>thanx!</p> <p>edit: this seems to work:</p> <pre><code>var mySubStore = app.stores.myStore.findRecord('id', recordID).websites(); app.stores.myStore.findRecord('id', recordID).websites().getGroupString = function(instance) { return instance.get('name')[0].toUpperCase(); }; var sorter = new Ext.util.Sorter({ property : 'name', sorterFn: function(o1, o2) { var v1 = this.getRoot(o1).get(this.property).toLowerCase(), v2 = this.getRoot(o2).get(this.property).toLowerCase(); return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0); }, clear: function(){} }); //mySubStore.sorters = [sorter]; mySubStore.sort(sorter); </code></pre> |
15,731,615 | 0 | <p>a simple option is to combine the two scripts</p> |
8,487,729 | 0 | Asp.net 3.0 and 64 bit sqlite dll file <p>Greetings!</p> <p>I am developing Asp.net application, in which i need to use sqlite as database, i tried to add reference to 64 bit dll file System.Data.SQlite file. When i run my application it shows as below error Error 1 Could not load file or assembly 'SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format. </p> <p>What will be the reason for this, and how can i fix this.I am using visual studio 2010.</p> <p>Thanks in advance sangita</p> |
33,846,225 | 0 | <p>As @jewelsea suggests, setting the modality and owner for the alert box will assure that the alert will appear over the stage, even if the stage is moved.</p> <pre><code>import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.ListView; import javafx.scene.layout.BorderPane; import javafx.stage.Modality; import javafx.stage.Stage; public class DeleteAlertDemo extends Application { Stage owner; ObservableList<String> observablePlantList; ListView<String> plantList; protected void handleDeleteButtonClick(ActionEvent event) { String item = plantList.getSelectionModel().getSelectedItem(); Alert alertBox = new Alert(Alert.AlertType.CONFIRMATION, "Confirm Delete", ButtonType.OK, ButtonType.CANCEL); alertBox.setContentText("Are you sure you want to delete this " + item.toLowerCase() + "?"); alertBox.initModality(Modality.APPLICATION_MODAL); /* *** */ alertBox.initOwner(owner); /* *** */ alertBox.showAndWait(); if (alertBox.getResult() == ButtonType.OK) { int selectedPlant = plantList.getSelectionModel().getSelectedIndex(); observablePlantList.remove(selectedPlant); } else { alertBox.close(); } } @Override public void start(Stage primaryStage) { owner = primaryStage; /* *** */ Button deleteBtn = new Button(); deleteBtn.setText("Delete"); deleteBtn.setOnAction(this::handleDeleteButtonClick); observablePlantList = FXCollections.observableArrayList("Begonia", "Peony", "Rose", "Lilly", "Chrysanthemum", "Hosta"); plantList = new ListView<>(observablePlantList); plantList.getSelectionModel().select(0); BorderPane root = new BorderPane(); root.setCenter(plantList); root.setRight(deleteBtn); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Delete Alert Demo"); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } } </code></pre> |
12,085,296 | 0 | java.sql.SQLException: Already closed error with IBatis 2.3.4 <p>I am seeing a strange behavior in the code. I am using Spring DI for getting connection. Following is my ibatis-context.xml </p> <pre><code><bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> <property name="url" value="jdbc:oracle:thin:@hostname:port:dbname" /> <property name="username" value="$usrname" /> <property name="password" value="$pwd" /> <property name="initialSize" value="1"/> <property name="maxActive" value="1"/> <property name="maxIdle" value="1"/> <property name="testWhileIdle" value="true"/> <property name="minEvictableIdleTimeMillis" value="500"/> <property name="timeBetweenEvictionRunsMillis" value="500"/> <property name="validationQuery" value="select 1 from dual"/> </bean> </code></pre> <p>When i execute first query, it returns me the ResultSet. But when i execute second query with the same connection, it throws me error(java.sql.SQLException: Already closed).<br> <code>code</code> </p> <pre><code> try { // First Query personList = sqlMap.queryForList("getPersonList", parameterMap); } catch (Exception e) { e.printStackTrace(); } try { // Second Query firstNameList = sqlMap.queryForList("getfirstNameList", parameterMap); } catch (Exception e) { e.printStackTrace(); } </code></pre> <p>The same code and configuration works fine few days before but now i am getting error.<br> The stack trace of the issue. </p> <pre><code>java.sql.SQLException: Already closed. at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191) at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:278) at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:160) at $Proxy10.close(Unknown Source) at com.ibatis.sqlmap.engine.transaction.external.ExternalTransaction.close(ExternalTransaction.java:82) at com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:93) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:734) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:153) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:835) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:574) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) </code></pre> <p>Is it code issue or database issue?<br> Anyone have solution for this?</p> |
3,802,067 | 0 | <p>just read the list from *.sln file. There are "Project"-"EndProject" sections. <br>Here is <a href="http://msdn.microsoft.com/en-US/library/bb165951%28v=VS.90%29.aspx" rel="nofollow">an article from MSDN.</a></p> |
36,078,747 | 0 | <p>You need to make the function doSomething like below, pass null for btn_b and pass value for btn_a. Hope this helps.</p> <p><strong>HTML</strong></p> <pre><code><input type="button" id="btn_a"> <input type="button" id="btn_b"> </code></pre> <p><strong>SCRIPT</strong></p> <pre><code>$("#btn_a").on("click", function() { return doSomething(p,q,r); }); $("#btn_b").on("click", function() { return doSomething(p,q,null); }); function doSomething(p,q,r){ if(r != null){ //do something for btn_a and return } else { //do something for btn_b and return } } </code></pre> |
31,790,012 | 0 | <p>The <code>RedirectsUsers</code> class is a trait so you cloud override the <code>redirectPath</code> method in your <code>AuthController</code>, to do so just copy the method and paste it in your <code>AuthController</code> making the modifications you need, something like this.</p> <pre><code>/** * Get the post register / login redirect path. * * @return string */ public function redirectPath() { return route('home'); } </code></pre> |
39,128,801 | 0 | Soot Framework Intraprocedural Graph Traverse Giving Exception: Invalid Unit <ol> <li>I am traversing body of methods using soot framework. So, I get a directed graph of the method body, together with other method calls that are inside the body. I want to traverse this new method and so on. Can somebody help with this recursion logic.</li> <li>After writing recursion logic it gives me <code>NoSuchElementException: Invalid unit return</code>.</li> </ol> |
25,125,597 | 0 | <pre><code>my $_pCombos = [ [{row => 9,col => 0},{row => 1,col => 9},{row => 1,col => 2},{row => 1,col => 3},{row => 1,col => 4}], [{row => 0,col => 0},{row => 0,col => 1},{row => 0,col => 2},{row => 0,col => 3},{row => 0,col => 4}], [{row => 2,col => 0},{row => 2,col => 1},{row => 2,col => 2},{row => 2,col => 3},{row => 2,col => 4}], [{row => 0,col => 0},{row => 1,col => 1},{row => 2,col => 2},{row => 1,col => 3},{row => 0,col => 4}], ]; print $_pCombos->[0][0]{row}, "\n"; print $_pCombos->[0][1]{col}, "\n"; </code></pre> <p>will print</p> <pre><code>9 9 </code></pre> <p>if you want to maintain the javascript syntax, you can use json, like this:</p> <pre><code>use JSON::XS; my $_pCombos_JSON_normalized = <<'END'; [ [{"row":9,"col":0},{"row":1,"col":9},{"row":1,"col":2},{"row":1,"col":3},{"row":1,"col":4}], [{"row":0,"col":0},{"row":0,"col":1},{"row":0,"col":2},{"row":0,"col":3},{"row":0,"col":4}], [{"row":2,"col":0},{"row":2,"col":1},{"row":2,"col":2},{"row":2,"col":3},{"row":2,"col":4}], [{"row":0,"col":0},{"row":1,"col":1},{"row":2,"col":2},{"row":1,"col":3},{"row":0,"col":4}] ] END my $_pCombos = decode_json($_pCombos_JSON_normalized); print $_pCombos->[0][0]{row}, "\n"; print $_pCombos->[0][1]{col}, "\n"; </code></pre> <p>will also print</p> <pre><code>9 9 </code></pre> |
18,472,197 | 0 | <p>It is not. One is in seconds, the others in in microseconds, you you need to scale:</p> <pre><code>1393031459 > (1377624200429 / 1000) </code></pre> <p>nsICookie2:</p> <pre><code>/** * the actual expiry time of the cookie, in seconds * since midnight (00:00:00), January 1, 1970 UTC. * * this is distinct from nsICookie::expires, which * has different and obsolete semantics. */ readonly attribute int64_t expiry; /** * the creation time of the cookie, in microseconds * since midnight (00:00:00), January 1, 1970 UTC. */ readonly attribute int64_t creationTime; /** * the last time the cookie was accessed (i.e. created, * modified, or read by the server), in microseconds * since midnight (00:00:00), January 1, 1970 UTC. * * note that this time may be approximate. */ readonly attribute int64_t lastAccessed; </code></pre> <p>Admittedly, it is quite confusing to use different time units. :p</p> |
21,841,604 | 0 | <p>Waffle is drop in solution that can be used with springsecurity to achieve this: <a href="https://github.com/dblock/waffle" rel="nofollow">https://github.com/dblock/waffle</a></p> <p>I've used it myself with for example hybris. They have some examples. Beware of version 1.5 that uses jna3.5 which can cause problems at high load Also beware that you may need to extend negotiatesecurityfilter if our application needs to do authorization(I had to do that, may be fixed in 1.6.</p> |
10,188,425 | 0 | <p>I think <a href="http://developer.apple.com/library/ios/#samplecode/PhotoScroller/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010080-Intro-DontLinkElementID_2" rel="nofollow">this</a> will solve your problem. This question may give you some context:</p> <p><a href="http://stackoverflow.com/questions/4914427/how-to-reuse-recycle-custom-custom-element-like-uitableviewcell-does">How to reuse/recycle custom custom element like uitableviewcell does?</a></p> |
29,556,702 | 0 | <p><code>IsInRange</code> is a function template, not a class template, so an instantiation of it is not a type, so you can't create a typedef for it.</p> |
Subsets and Splits