pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
8,043,972 | 0 | <p>The main way would be to register the filter file with <code>regsvr32 filter.dll</code> and than create the filter with it's CLSID in your application.</p> <p>If the filter are in the same codebase as the application, you can just create the filter with <code>new</code> and use it.</p> <p>I prefer to load the filter.dll with <code>CoLoadLibrary</code> to get the IClassFactory of the filter and create the filter. You can test this with <a href="http://code.google.com/p/graph-studio-next/" rel="nofollow">GraphStudioNext</a>. You can find sample source code to load a filter this way <a href="http://code.google.com/p/graph-studio-next/source/browse/trunk/src/FilterFromFile.cpp" rel="nofollow">here</a>.</p> |
14,736,701 | 0 | width:100% not extending all the way in ipad portrait mode <p>I have a webpage whose width is over 1000px wide. There is a background DIV element that spans across the entire width</p> <pre><code>.bg_horizon { position:absolute; width:100%; height:800px; background-color:#f7f7f7; border-bottom:1px solid #8d9092; z-index:-9999; margin:0; padding:0; } </code></pre> <p>This box renders fine in landscape orientation and on desktops, but on ipad portrait mode the webpage is wider than the viewport... this is fine, as the user can just pan around, we don't allow scaling... but the background div only rendered the css width:100% up to the visible portion of the viewport. When I pan around, I can see the rest of the webpage but the div did not extend into those areas. How can I get width:100% to span across the entire webpage?</p> |
14,983,603 | 0 | <p>You can do something like this (starting with Lloyd's original regex):</p> <pre><code>^(?:(?:CN|OU|DC)\=\w+,)*(?:CN|OU|DC)\=\w+$ </code></pre> <p>Match zero or more groups followed by a comma, then one final group.</p> <p>If you want to require there at least be two total groups, just change <code>*</code> to <code>+</code>:</p> <pre><code>^(?:(?:CN|OU|DC)\=\w+,)+(?:CN|OU|DC)\=\w+$ </code></pre> <p>If you want to require that the number of groups is within a certain range, use a quantifier:</p> <pre><code>^(?:(?:CN|OU|DC)\=\w+,){1,3}(?:CN|OU|DC)\=\w+$ </code></pre> <p>This would require between two and four groups total.</p> <p>If you have other requirements that you want to enforce (such as always must contain DC, or has at least two DC if OU and CN are absent), then you are asking too much of a single regex. You will need a multi-step approach.</p> |
40,961,230 | 0 | Temporary name resolution error with Test Kitchen EC2 <p>When I run kitchen create with the config below I get an error: </p> <pre><code>"[getaddrinfo: Temporary failure in name resolution] on default-centos-7". </code></pre> <p>This system can resolve dns no issues so I'm not sure what the issue is... </p> <pre><code>--- driver: name: ec2 aws_ssh_key_id: chef security_group_ids: ["sg-5d3276a0"] region: eu-east-1 require_chef_omnibus: true instance_type: t1.micro associate_public_ip: true provisioner: name: chef_zero cookbook_path: cookbooks roles_path: roles environments_path: environments data_bags_path: data_bags platforms: - name: centos-7 image_id: ami-96a818fe transport: ssh_key: /home/user/aws_key.pem username: root suites: - name: default run_list: - recipe[website::default] attributes: </code></pre> <p>Changing the Platform to an ubuntu ami gives the same error. Any ideas?</p> |
24,557,480 | 0 | Import text file with ISO 8601 date/time values (2014-07-02T16:09:49-07:00) <p>When importing a text file into Access 2007 with date/time values like </p> <pre><code>2014-07-02T16:09:49-07:00 </code></pre> <p>Access is unable to convert to date and shows the same as text. How do I convert the same in to date/time in Access?</p> |
23,410,060 | 0 | <p><code>\xa0</code> is <a href="http://en.wikipedia.org/wiki/Non-breaking_space" rel="nofollow">Non-breaking space</a> which is shown as a simple space in a web-page. Is code is <code>A0</code> which is outside of of ASCII range (0-127):</p> <pre><code>Python 2.7.6 (default, Mar 22 2014, 22:59:56) >>> u'Rs.\xa05,000\n\r\n\t\t\t\t\t / -'.encode() Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 3: ordinal not in range(128) </code></pre> <p>So you have to manually replace it with a simple space, before encoding it to ASCII.</p> <p>Be default <a href="https://docs.python.org/2/library/stdtypes.html#str.strip" rel="nofollow"><code>str.strip</code></a> strips only whitespace, so you should manually strip chars <code>/ -</code>.</p> <p>This should work:</p> <pre><code>>>> u'Rs.\xa05,000\n\r\n\t\t\t\t\t / -'.replace(u'\xa0', u' ').encode().rstrip('-/ ').strip() 'Rs. 5,000' >>> </code></pre> |
9,565,209 | 0 | <p>You can save popup window's text in webpart property in toolpart.</p> <p>This property will be accessed in WebPart & ToolPart also.</p> <p>For WebPart Properties see below example,</p> <pre><code> [Personalizable(PersonalizationScope.Shared)] [WebBrowsable(true)] [Category("Display")] [WebDisplayName("Popup Text")] [Description("You can configure this text from here in popup")] public string PopupText { get; set; } </code></pre> <p>add above code in WebPart Class and use this "PopupText" property in assign Literal control OR direct render this property in overwrite Render method.</p> |
39,123,108 | 0 | <p>Both anchor tags are displayed as blocks by neon-forms.css, so they can't be side by side:</p> <pre><code>.mail-env .mail-sidebar .mail-menu > li a { display: block; } </code></pre> <p>So you could change it to inline-block, for example, but it wouldn't solve the problem anyway because of html structure: badge will stay inside of the first anchor tag.</p> <p>Is it possible for you to change html to something like this?</p> <pre><code><li class="active"> <!--1st a tag --> <a href="#" style="padding:12px;"> <i class="entypo-dot">.</i> Moses Danko <span class="label label-info">Parent</span> </a> <!--2nd a tag --> <a href="#" onclick="confirm_modal('<?php ... ?>');"> <i class="entypo-trash"></i>Del </a> <span class="badge badge-danger pull-right"> 2 </span> </li> </code></pre> <p>And css to:</p> <pre><code>.mail-env .mail-sidebar .mail-menu > li a { display: inline-block; } </code></pre> |
8,349,390 | 0 | <p>A clean example.</p> <pre><code><?php header('Content-Type: application/download'); header('Content-Disposition: attachment; filename="example.txt"'); header("Content-Length: " . filesize("example.txt")); $fp = fopen("example.txt", "r"); fpassthru($fp); fclose($fp); ?> </code></pre> |
34,455,312 | 0 | <p>From their documentation.</p> <blockquote> <p>The query() method returns an object of type Zend_Db_Statement or PDOStatement, depending on the adapter type</p> </blockquote> <p>Depending on configuration, PDO can throw Exceptions on errors which you can try/catch or you can inspect the resulting object that is passed back from Zend for errors.</p> <p>For reference:</p> <p><a href="http://php.net/manual/en/pdostatement.errorcode.php" rel="nofollow">http://php.net/manual/en/pdostatement.errorinfo.php</a> <a href="http://php.net/manual/en/pdostatement.errorcode.php" rel="nofollow">http://php.net/manual/en/pdostatement.errorcode.php</a></p> |
33,257,995 | 0 | <p>Navigate to closing/opening bracket feature in IntelliJ could also be useful for this. It works for XML/HTML, Java, etc. See <a href="https://www.jetbrains.com/idea/help/navigating-to-braces.html" rel="nofollow">documentation</a> for more details.</p> <p>The shortcuts are:</p> <ul> <li>Navigate to opening bracket: <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>[</kbd> (<kbd>Ctrl</kbd>+<kbd>[</kbd> on Windows/Linux)</li> <li>Navigate to closing bracket: <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>]</kbd> (<kbd>Ctrl</kbd>+<kbd>]</kbd> on Windows/Linux)</li> </ul> |
18,641,336 | 0 | <p>I know your <code>index.html</code> is placed in the <code>assets</code> folder, but try to change the <i>super.loadUrl</i> line to:</p> <pre><code>super.loadUrl("file:///android_asset/www/index.html"); </code></pre> <p>As per this tutorial <a href="http://docs.phonegap.com/en/2.1.0/guide_getting-started_android_index.md.html" rel="nofollow">PhoneGap Documentation - Getting Started with Android</a></p> |
12,849,109 | 0 | <p>A standard controller method is going to return something with reference to the view associated with it (a <code>ModelAndView</code> or just a <code>String</code> matching the view name, for example).</p> <p>If you want to return custom objects, you need to specify that the response body is content, rather than a view reference. You can do this with the <code>@ResponseBody</code> annotation.</p> <pre><code>@RequestMapping(value = "getSomeList.do", method = RequestMethod.GET) public @ResponseBody List<String> getSomeList() { List<String> myList = getMyList(); return myList; } </code></pre> <p>Combined with a library like <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/bind/annotation/ResponseBody.html" rel="nofollow">Jackson</a>, you can serialize this to JSON and make it easily parsable in your view.</p> |
20,152,526 | 0 | Cannot load a custom gem <p>I have a real newbie problem. I wrote a very small (one-file) library and I wanted to publish it in a gem so that I can use it in other projects modularly. I used the following gemspec:</p> <pre><code>Gem::Specification.new do |s| s.name = 'symbolize-array' s.version = '1.0.0' s.date = '2013-11-22' s.summary = "Symbolizes strings in arrays" s.description = "" s.files = ["lib/array.rb"] s.homepage = 'https://github.com/renra/symbolize-array-ruby' s.license = 'MIT' end </code></pre> <p>I build the gem. Fine. I publish the gem. Fine. I install the gem from rubygems. Fine. But when I run irb and do require 'symbolize-array' I get:</p> <pre><code>LoadError: cannot load such file -- symbolize-array from /home/renra/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from /home/renra/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from (irb):4 from /home/renra/.rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>' </code></pre> <p>As you can see from the backtrace I use rvm. When I run 'gem environment' and I go to the gem path I can see my gem is installed just like the others. I can require the others, but I cannot require my gem. So I guess this is not a problem with the load path (I've seen questions that were answered like that) but maybe in the way I built the gem. Grateful for your ideas.</p> |
33,442,526 | 0 | <p>You can "highlight" mapped portions of your img like this:</p> <ul> <li>Exactly overlay a canvas element of the same size using CSS</li> <li>Tell canvas not to respond to mouse/touch events: <code>pointer-events:none</code></li> <li><p>When a mapped area is clicked, tell canvas to draw that area in a low-opacity fill using path commands:</p> <pre><code>context.beginPath(); context.moveTo(381,90); context.lineTo(386,64); context.lineTo(421,32); context.lineTo(462,19); context.lineTo(501,32); context.lineTo(535,62); context.lineTo(540,83); context.closePath(); // fill the path area with a low-opacity red (or color of you choosing) context.globalAlpha=0.15; context.fillStyle='red'; context.fill(); // this fills the path context.globalAlpha=1.00; // just resetting to default opacity </code></pre></li> </ul> <p>That allows you to keep your existing code that uses img.</p> <p>Alternatively, if your design permits significant refactoring, you can draw the image on canvas and use <code>context.isPointInPath</code> to hit-test each path versus the mouse-click position. Then fill the hit path with the low-opacity fill.</p> <p><strong>[ Addition: Saving area coordinates for later use in hit-testing ]</strong></p> <p><em>Warning: untested code, might need tweaking</em></p> <p>For easy re-use of each areas coordinates, you can put each set of coordinates in an object and put those objects in an array: </p> <pre><code>var areas=[]; // first area coordinates arrays.push([ {x:381,y:90}, {x:386,y:64}, ... etc ]); // second area coordinates arrays.push([ {x:509,y:115}, {x:511,y:127}, ... etc ]); ... </code></pre> <p>Then use those saved area coordinates to do your hit-testing:</p> <pre><code>function isMouseInArea(mouseX,mouseY){ var index; // index of any "hit" area. leave it initially null for(var i=0;i<areas.length;i++){ // create a path from this area's coordinates defineAreaPath(areas[i]); // test if the mouse is inside this area if(ctx.isPointInPath(mouseX,mouseY)){ index=i; } } // return any "hit" index of areas[] or return null if no hits return(index); } // utility function to define a path from the supplied coordinates function defineAreaPath(pts){ // create a path from this area's coordinates ctx.beginPath(); ctx.moveTo(pts[0].x,pts[0].y); for(var i=1;i<pts.length;i++){ ctx.lineTo(pts[i].x,pts[i].y); } ctx.closePath(); } </code></pre> <p>And you can use the <code>isMouseInArea</code> function like this:</p> <pre><code>var index=isMouseInArea(mouseX,mouseY) if( index ){ // draw the area path that was "hit" by the mouse defineAreaPath(areas[index]); // fill that path with low-opacity fill ctx.globalAlpha=0.15; ctx.fillStyle='red'; ctx.fill(); ctx.globalAlpha=1.00; } </code></pre> |
10,975,851 | 0 | <p>I'm a huge fan of <a href="https://github.com/caolan/async" rel="nofollow">Caolan's async library</a>. The big idea with said library is that the first argument of every callback is an error, and if no error is present, the next function in the chain is called. So your could could look like this:</p> <pre><code>vote = (res, data) -> async.series [ (next) -> Case.findOne { caseId: data.id }, next (next) -> myvote = new Vote({case: mycase_id}).save(next) ], (err, result) -> if err console.error err else console.log "Success!" </code></pre> <p>The chain of functions breaks on the first error thrown, that way your final callback is really only responsible for handling a single error. This is great for serial processes where you want to halt and report the first issue you run into.</p> |
35,359,118 | 0 | <p><code>callbackURL</code> tells facebook on which external address could it call back your application after the user completes the authentication form, whereas <code>sucessRedirect</code> is the pair of <code>failureRedirect</code> are internal routes executed depending on the authentication outcome.</p> <p><code>passport.authenticate(...)</code> orchestrates the whole process. The "happy" flow is roughly the following:</p> <ol> <li><code>passport.authenticate(...)</code> detect that there is an unauthenticated user tries to access the given route, redirects it to facebook oauth;</li> <li>if facebook auth was successfull your verify callback is called (this is your "Function A"), which should match the user by facebook userid in your internal user database and set things up accordingly (typically create a session for the user);</li> <li>If everything goes well the user gets redirected to <code>successRedirect</code>, which is usually an internal route like <code>/profile</code>, from that point you could use user data you looked up at the previous step.</li> </ol> <p>I hope that explains it.</p> |
38,724,737 | 0 | <p>You could use the <code>stringr</code> package with the following regular expression (anchored at the front of the string using <code>^</code>):</p> <pre><code>library(stringr) sentences <- c("I went to the store last night", "I went to the park yesterday", "I went to starbucks this morning") str_replace(sentences, "^I went to( the)?", "REPLACED") # [1] "REPLACED store last night" "REPLACED park yesterday" # [3] "REPLACED starbucks this morning" </code></pre> <p>If there are multiple instances to replace within the same string, you may want to omit the <code>^</code> and use <code>str_replace_all()</code></p> |
4,859,507 | 0 | <p>I guess <a href="https://jira.springsource.org/browse/SEC-1408" rel="nofollow">this jira</a> issue of spring security describes your problem and how to handle this.</p> |
15,657,151 | 0 | <p>It think you mean <a href="http://goose.ycp.edu/~dhovemey/fall2011/cs201/lecture/lecture25.html" rel="nofollow noreferrer"><em>Sentinel nodes</em></a> in a linked lists.</p> <p>Some linked-list implementations put one or two extra nodes at the beginning and ending (or both of them) to implement some algorithms simpler. These nodes don't hold special data as a entry of data-structure. It's an alternative for using<code>NULL</code> as first/last node indicators.</p> <p><img src="https://i.stack.imgur.com/K9CyZ.png" alt="enter image description here"></p> <p>The <code>std::list</code> is supposed to be a list in the standards. It maybe uses <em>sentinel nodes</em> or not.</p> |
5,143,732 | 0 | <p>You might want to try parsing the HTML with <a href="http://jsoup.org/" rel="nofollow">jsoup</a> and collect all the anchor tags from the page.</p> |
24,645,174 | 0 | How to parse json response from ajax? <p>I am new to json and ajax this is my first example can any one help me out with this.</p> <pre><code>$.ajax({ type: "GET", url: "ajs/index", dataType: "JSON", success: function(data) { var obj = JSON.parse(data); $("#result").html(obj.name); } }); </code></pre> <p>The output of data is of the form:</p> <pre><code>[Object {id=10, name="ss", title="ss", content="h", ...}, Object {id=12, name="lo", title="gi", content="c", ...}, Object {id=13, name="lo", title="gi", content="c", ...}, Object {id=14, name="lo", title="gi", content="c", ...}, Object {id=15, name="n", title="m", content="m", ...}] </code></pre> <p>The output of obj(after parsing) is of the form:</p> <pre><code>[{"id":10,"name":"ss","title":"ss","content":"h","created_at":"2014-07-07T10:07:02.398Z","updated_at":"2014-07-07T10:07:02.398Z"}]{"id":12,"name":"lo","title":"gi","content":"c","created_at":"2014-07-08T05:26:05.816Z","updated_at":"2014-07-08T05:26:05.816Z"} </code></pre> <p>when i use <strong>obj.name</strong> it is nt displaying any data how can i display all my data.</p> |
40,959,957 | 0 | Linux Timers in C <p>I am working on some Linux applications that uses timers.I need to change the timer interval during runtime.So is there any API that could detect whether any previous timer is running or not.My idea is like i will detect any previous running timer and will delete it and then will re-create the timer with new time value.</p> <p>I am using timer_create(),timer_settime() for timer creation and timer starting. </p> <p>Thanks&Regards Amit Kumar</p> |
13,998,098 | 0 | MATLAB - Sort a matrix based off how a vector is sorted <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/134712/how-can-i-sort-a-2-d-array-in-matlab-with-respect-to-one-column">How can I sort a 2-D array in MATLAB with respect to one column?</a><br> <a href="http://stackoverflow.com/questions/2679022/sort-a-matrix-with-another-matrix">Sort a matrix with another matrix</a> </p> </blockquote> <p>I have a vector 'A' of 429 values and a matrix 'B' of 429x200 values. Rows in A and B are share the same indices. My vector 'A' contains values 1:1:429 but they are randomly ordered throughout the vector. I want to reorder A so that it indexes in order from 1 to 429 and I also want to sort the rows in matrix 'B' in the same order as the newly sorted 'A'.</p> <p>Can this be done quick and easy without a for-loop?</p> <p>Here's an example to illustrate my point:</p> <pre><code>A = 5 3 1 2 4 B = 3 7 0 4 6 1 2 5 0 8 4 0 2 0 0 3 0 1 0 5 2 2 3 4 4 sortedA = 1 2 3 4 5 sortedB = 4 0 2 0 0 3 0 1 0 5 1 2 5 0 8 2 2 3 4 4 3 7 0 4 6 </code></pre> <p>Thank you everyone!</p> |
14,125,701 | 0 | <p><code><+=</code> really is for appending to a "collection" setting, I don't think it is supported for string concatenation. Plus in your second attempt you are both trying to concatenate via an assignment operator (<code><+=</code>) <strong>and</strong> concatenating by hand using the <code>+</code> operator, which is certainly not what you intended. just Replace <code><+=</code> with <code><<=</code> and it should make sbt happy.</p> <pre><code>unmanagedJars in Compile <<= javaHome map { jh => jh + "/jre/lib/jfxrt.jar" } </code></pre> <p><strong>UPDATE</strong>: Turns out I misread your post and was completly wrong. You were right to use <code><+=</code> to append to unamanagedJar, and the use of <code>+</code> was there just to create an absolute file path. Sorry a bout that. This time I acutally tried to fix it with sbt at hand, and managed to make it compile. I didn't actually test it against a real project though, I'll let you try it and report if it works as expected.</p> <pre><code>unmanagedJars in Compile <+= javaHome map { jh => Attributed.blank( new File( jh.getOrElse(sys.error("Error, could not get java home")),"jre/lib/jfxrt.jar" ) ) } </code></pre> <p>This is clearly not very nice though, there might be some helper somewhere to make it more readable.</p> |
28,933,893 | 0 | <p>Use the <code>increaseFill</code> and <code>decreaseFill</code>. If you need to change the colors for different data points, there are datasource methods to provide different fills for each data index.</p> |
3,635,013 | 0 | Add a row to h:dataTable via AJAX with request-scoped bean without losing the row data <p>I think the title tells it all: I want to add a row to dataTable over AJAX. The datatable has input fields where user can put text. As simple as that, a pretty common case.</p> <p>With session-scoped bean this no issue, as the same bean is updated over and over again. However, I want to do this in request scope. For each request, I guess I want to create a new bean and to populate it with the values from my form. Then I want my <code>commandButton</code>'s <code>action</code> to add a new row, finally render the <code>dataTable</code> over AJAX as usual.</p> <p>The issue is that I don't know how to make JSF fill the newly-created request-bean with the current data from the dataTable component?</p> <p>There was <a href="http://stackoverflow.com/questions/2278353/how-to-dynamically-add-a-row-in-a-table-in-jsf">a similar question</a> asked and <a href="http://stackoverflow.com/questions/2278353/how-to-dynamically-add-a-row-in-a-table-in-jsf/2280157#2280157">answered</a>. However, that solution seems to reload the contents of the dataTable each time it is refreshed and manually inserts empty elements for the newly-inserted rows like this:</p> <pre><code>// Preserve list with newly added items. ror (int i = 0; i < (Integer) count.getValue(); i++) { list.add(new Item()); } </code></pre> <p>To me, it seems that this approach also wipes the possible changes that the user did to rows (new and old)... if he doesn't first save them.</p> <p>Any pointers?</p> |
36,249,651 | 0 | <p>Simplest way to split array into chunks is <code>array_chunk</code>:</p> <pre><code>$farmland = array("Duck","Fox","Goose","Cow","Cat","Rabbit","Bull","Mouse","Sheep","Goat"); $chunks = array_chunk($farmland, 5); // get chunks with size of 5 print_r($chunks); </code></pre> |
24,058,310 | 0 | <p>The scope of <code>count</code> is just the single child you are processing. Move it to a higher scope:</p> <pre><code>$(xml).find('parent').each(function () { var body = $('body').addClass('nobg'); var count = 1; $(xml).find('child').each(function() { if ($(this).attr('title') > '') { var title = $('<p></p>').appendTo(body); headline.attr('id'), (count++)); } }) }) </code></pre> <p>Also, to be on the safe side, I would replace <code>count++</code> with <code>++count</code> as you need it to increment before it is used. This is pure readability, though, in your case.</p> |
15,528,432 | 0 | <p>Liferay is very buggy, and community is very bad. Unless you pay the support.</p> <p>GateIn promises much, but still lacks functionality.</p> |
19,586,636 | 0 | <p><a href="https://github.com/sshwsfc/django-xadmin" rel="nofollow noreferrer">django-xadmin</a> has this feature:</p> <p><img src="https://i.stack.imgur.com/cK5Jr.png" alt="django x-admin dynamic columns"></p> <p>It has some other cool features too, but I haven't started using it because the English translation of the documentation hasn't been released yet (as of Oct '13). You could look at the source code to give you some ideas.</p> <p>Check out the <a href="http://demo.xadmin.io" rel="nofollow noreferrer">live demo</a></p> <p>User: admin Password: admin</p> <p>Note: I have no involvement in x-admin, I just have the same question as the OP.</p> |
35,061,221 | 0 | <p>You need to concatenate: </p> <pre><code>url: "productsType.php?id="+data, </code></pre> <p>or you can use <code>data:{}</code> option of ajax: </p> <pre><code>url: "productsType.php", data:{id:data} </code></pre> |
7,213,456 | 0 | <p>Try this:</p> <p>1) when pushing login view, set some flag in MainViewController</p> <p>2) in method <em>viewWillAppear</em> in MainViewController check that flag from 1). If it is set then load the initial data and unset flag. Otherwise push LoginView.</p> |
8,557,490 | 0 | redirect to a different url <p>I have one application where i have three jsp pages, from index.jsp , control goes to process.jsp and after execution control goes to result.jsp to display data. But i want that instead of displaying data in result.jsp, control will go to another url so that that receiver url will get the requested data. that is: my url is 100.20.3.45:8085/myproject/index.jsp then after processing data i want that result should go to a different url of my same network i.e. <code>100.20.3.46</code>. How can I send the requested data to this different url?</p> <p>Ex:</p> <pre><code>100.20.3.45:8085/myproject/index.jsp </code></pre> <p>goes to </p> <pre><code>100.20.3.45.8085/myproject/process.jsp </code></pre> <p>after processing control will go to <code>100.20.3.46</code>.</p> <p>How can I send this data to a different url? what is this mechanism called?</p> |
11,205,657 | 0 | <p>I solved it now on my own by updating some <code>mesa</code> concerning packages. I'm running debian stable with those following packages from backports:</p> <blockquote> <p>initramfs-tools, libdrm-intel1, libgl1-mesa-dev, libgl1-mesa-dri, libgl1-mesa-glx, linux-base, linux-headers-3.2.0-0.bpo.1-all-amd64, linux-headers-3.2.0-0.bpo.1-amd64, linux-headers-3.2.0-0.bpo.1-common, linux-headers-3.2.0-0.bpo.1-common-rt, linux-headers-3.2.0-0.bpo.1-rt-amd64, linux-headers-3.2.0-0.bpo.2-all-amd64, linux-headers-3.2.0-0.bpo.2-amd64, linux-headers-3.2.0-0.bpo.2-common, linux-headers-3.2.0-0.bpo.2-common-rt, linux-headers-3.2.0-0.bpo.2-rt-amd64, linux-image-3.2.0-0.bpo.2-amd64, linux-kbuild-3.2, mesa-common-dev</p> </blockquote> <p>Hoping this info will help other, too.</p> |
3,056,997 | 0 | <p>My vote would be for XStream. The lack of generics support is a small price to pay for the amount of flexibility it offers. You can also easily implement generics by serializing the generic class type at serialization time, or build this into your domain objects. E.g.</p> <pre><code> class Customer { List<Order> orders; public List<Order> getOrders() { return orders; } } </code></pre> <p>In the stream, the element type denotes the type of each object. When the type is an abstract type or interface, the element listed with the implementing class, unless that has been specified as the default for that interface type. (E.g. ArrayList as the default for instances of static type List.)</p> <p>Generics are "rose coloured glasses" in java - they don't really change what you are seeing, just how you see it. The objects would be sent over the wire exactly the same if they were sent with generics support or not.</p> |
2,558,935 | 0 | <p>Picking mode is not available in openGL ES. But it's easy to calculate the screen coordinate of any 3d point using the projection matrix retrieved from current openGL state. Here is how I do it (IMPoint2D and IMPoint3D are basic (x,y) and (x,y,z) structures)</p> <pre><code>+ (IMPoint2D) getScreenCoorOfPoint:(IMPoint3D)_point3D { GLfloat p[16]; // Where The 16 Doubles Of The Projection Matrix Are To Be Stored glGetFloatv(GL_PROJECTION_MATRIX, p); // Retrieve The Projection Matrix /* Multiply M * point */ GLfloat _p[] = {p[0]*_point3D.x +p[4]*_point3D.y +p[8]*_point3D.z + p[12], p[1]*_point3D.x +p[5]*_point3D.y +p[9]*_point3D.z + p[13], p[2]*_point3D.x +p[6]*_point3D.y +p[10]*_point3D.z+ p[14], p[3]*_point3D.x +p[7]*_point3D.y +p[11]*_point3D.z+ p[15]}; /* divide by scale factor */ IMPoint2D _p2D = {_p[0]/_p[3], _p[1]/_p[3]}; /* get result in screen coordinates. In this case I'm in landscape mode */ return (IMPoint2D) {_p2D.x*240.0f + 240.0f, (1.0f - _p2D.y) *160.0f}; } </code></pre> |
1,308,918 | 0 | <p>I'd use the MovieClipLoader because it's got better event handling when you'd like to assign traits to a MovieClip (or image in this case) after it's loaded.</p> <p><em>This code is not tested. Nor is this code complete!</em> It's just to give you the idea. You'll notice some comments in there where I'm telling you that you'll have to layout your images yourself. That is to say you're going to have to account for the sizes of your images and adjust each one's _x and _y after it's loaded.</p> <p>Another thing, this isn't going to work very well when you CTRL + ENTER to test in the Flash IDE because it's using root relative urls for your images and links. Since the Flash IDE isn't running on a web server, it won't be able to find your images! You may want to use a special test XML file while debugging in the Flash IDE.</p> <p>Also, be sure to have a root node in your XML. It's just plain bad XML to have no root node.</p> <p><strong>XML</strong></p> <pre><code><?xml version="1.0" encoding="utf-8"?> <root> <myImage> <imagePath>/flash/image1.jpg</imagePath> <imageurl>/flash/image1.html</imageurl> </myImage> <myImage> <imagePath>/flash/image2.jpg</imagePath> <imageurl>/flash/image2.html</imageurl> </myImage> <myImage> <imagePath>/flash/image3.jpg</imagePath> <imageurl>/flash/image3.html</imageurl> </myImage> </root> </code></pre> <p><strong>Actionscript (frame 1):</strong></p> <pre><code>var xmlData:XML = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = function(loaded) { if (loaded) { for(var i = 0; i < this.firstChild.childNodes.length; i++) { var mc:MovieClip = _root.createEmptyMovieClip("item" + i, _root.getNextHighestDepth()); var node:XMLNode = this.firstChild.childNodes[i]; loadMovieClip(mc, node); } } else { trace("file not loaded!"); } }; xmlData.load("/flash/languages.xml"); function loadMovieClip(mc:MovieClip, node:XMLNode) { var loadListener:Object = new Object(); loadListener.onLoadInit = function(target:MovieClip, httpStatus:Number) { //Be sure to do your positioning here!!! You probably // don't want to stack them on top of each other. // I didn't do that so you'll have to do it yourself. target._x = 30; target._y = 30; var url = node.childNodes[1].firstChild.nodeValue; target.onMouseUp = function() { getURL(url); } //be sure to do positioning of your text field too. var txt:TextField = _root.createTextField(target._name + "_text", _root.getNextHighestDepth(), 30, 100, 100, 20); txt.text = url; txt.type = "static"; txt.onMouseUp = function() { getURL(url); } } var mcl:MovieClipLoader = new MovieClipLoader(); mcl.addListener(loadListener); mcl.loadClip(node.childNodes[0].firstChild.nodeValue, mc); } </code></pre> <p>I hope that helps.</p> |
21,042,895 | 0 | <p></p> <pre><code>function cellB2EqualToA(e) { var sheet = e.source.getActiveSheet(); var range = e.source.getActiveRange(); var rangeA1 = range.getA1Notation(); var value = sheet.getRange(rangeA1).getValue(); if(value != 'A' && rangeA1 != 'B2'){ return; }else{ //do what you need to do }; } </code></pre> |
31,155,310 | 0 | How to publish artifacts to Artifactory with different names? <p>i am using Apache Ant with Ivy to publish artifacts to Artifactory-Server. The way i do this is to generate a pom-File from ivy.xml. However with different names for modules and artifacts. If i retrieve the artifacts from server only the artifacts with the same names are downloaded.</p> <p>ivy.xml:</p> <pre><code><?xml version="1.0" encoding="ISO-8859-1"?> <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> <info organisation="com.ibm" module="db2_driver" revision="4.19.26"/> <publications> <artifact name="db2jcc4_license_cisuz" type="jar" conf="default" ext="jar" /> <artifact name="db2jcc4" type="jar" conf="default" ext="jar" /> <artifact name="db2_driver" type="pom" conf="default" ext="pom" /> </publications> </ivy-module> </code></pre> <p>build.xml:</p> <pre><code><?xml version="1.0" encoding="UTF-8"?> <project name="IVY_TEST" default="ivypom" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"> <property file="build.properties" /> <!- defines ${artifact.path} --> <target name="ivypom" > <ivy:makepom ivyfile="${artifact.path}/ivy.xml" pomfile="${artifact.path}/db2_driver.pom" > <mapping conf="*" scope="*" /> </ivy:makepom> <ivy:publish resolver="main" module="[ivy.module]" revision="4.19.26" organisation="[ivy.organisation]" overwrite="true"> <artifacts pattern="${artifact.path}/[artifact].[ext]" /> </ivy:publish> </target> </project> </code></pre> <p>The Upload is succesfully...</p> <p>That's the result (Artifactory Browser):</p> <pre><code>- db2_driver - 4.14.22 - 4.19.26 - db2_driver-4.19.26.pom - db2jcc4-4.19.26.jar - db2jcc4_license_cisuz-4.19.26.jar - ivy-4.19.26.xml </code></pre> <p>generated pom-File:</p> <pre><code><modelVersion>4.0.0</modelVersion> <groupId>com.ibm</groupId> <artifactId>db2_driver</artifactId> <packaging>pom</packaging> <version>4.19.26</version> </code></pre> <p>Now I want to use the driver. </p> <p>The needed ivy.xml for the application:</p> <pre><code><?xml version="1.0" encoding="ISO-8859-1"?> <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> <info organisation="de.xxx" module="main_steuerprogramm" revision="1.0.0"/> <configurations> <conf name="default" description="Standard Konfiguration" /> </configurations> <dependencies> <dependency org="com.ibm" name="db2_driver" rev="4.19.26"/> </dependencies> </ivy-module> </code></pre> <p>But it don't work. How can I retrieve the jars?</p> <p>There are three good answers... </p> <ul> <li><p><a href="http://stackoverflow.com/questions/9426011/convert-ivy-xml-to-pom-xml/9429286#9429286">Convert ivy.xml to pom.xml</a></p></li> <li><p><a href="http://stackoverflow.com/questions/5111831/how-to-publish-3rdparty-artifacts-with-ivy-and-nexus/5115447#5115447">how to publish 3rdparty artifacts with ivy and nexus</a></p></li> <li><p><a href="http://stackoverflow.com/questions/6942989/ivy-cant-download-because-pom-file-and-the-jar-file-name-arent-matching-patt/6949758#6949758">Ivy - Can't download because POM file and the JAR file name aren't matching patterns</a></p></li> </ul> <p>But in my case the name of the artifacts are different to module name. That's the difficulty.</p> <p>Please help.</p> |
31,929,754 | 0 | <p>I found a solution, so I'll post it here for the public:</p> <ol> <li><p>In the <code>init()</code> function, need to add:</p> <p><code>glEnable(GL_DEPTH_TEST);</code></p></li> <li><p>In the painting function, in the <code>glClear()</code> call, add <code>" | GL_DEPTH_BUFFER_BIT"</code>:</p> <p><code>glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);</code></p></li> <li><p>In the <code>main()</code> function, in the<code>glutInitDisplayMode()</code> call, add <code>" | GLUT_DEPTH"</code>:</p> <p><code>glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);</code></p></li> </ol> |
35,690,340 | 0 | <p>Turns out this is was a symptom of not handling exceptions. </p> <p>See the <a href="http://stackoverflow.com/questions/23219614/why-gcc-4-1-gcov-reports-100-branch-coverage-and-newer-4-4-4-6-4-8-report/23344292#23344292">related post</a> for a quick fix my turning on -fno-exceptions when compiling.</p> |
31,733,411 | 0 | Android: Using 9patch to create a frame around an imageview <p>I've been trying to create a frame around my imageview using a picture of a wooden frame. I turned the woodenframe picture into a 9patch and its still not wrapping around the imageview.</p> <pre><code><RelativeLayout android:id="@+id/ChosenPic" android:layout_width="match_parent" android:layout_height="50dp" android:layout_weight="3" android:orientation="vertical" android:padding="10dp" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:baselineAlignBottom="true" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/ImageView02" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="fill_vertical|fill_horizontal" android:scaleType="fitXY" android:src="@drawable/woodenframe" > </ImageView> </RelativeLayout> </code></pre> <p><a href="https://i.stack.imgur.com/3bgVH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3bgVH.jpg" alt="enter image description here"></a></p> <p>So this is the ninepatch and i want it to fit around a picture of my choosing no matter the size.</p> <p>EDIT:</p> <p>This is what i want: <a href="https://lh3.googleusercontent.com/1n_lKanRLjBPkXBr79vES3v3IwR20u5SDvQnbFztb7VOOFRlru6SRTX3RvNsp5PI2w=h900-rw" rel="nofollow noreferrer">https://lh3.googleusercontent.com/1n_lKanRLjBPkXBr79vES3v3IwR20u5SDvQnbFztb7VOOFRlru6SRTX3RvNsp5PI2w=h900-rw</a></p> |
13,734,250 | 0 | Node.js - single app code, multiple runs with custom settings <p>I'm going to start software as service app in Node.js. Is there any way to have one source code and many app instances? I wanna develop and commit just one repo, that changes will be visible in all of app instances? Of course user can set own config like database and vhost. User files will be stored in his file system directory mounted to the vhost. Where will be his /her public files as images or download added from CMS.</p> <p>Best, Mark.</p> |
16,533,791 | 0 | <p>Here's a better way to do this using MODX inbuilt functionality. </p> <p>Create a plugin that fires on OnPageNotFound and parses the 'not found' url (sitio.com/blog/tag/tecnology) into the format you're expecting (sitio.com/blog/tag.html?tag=tecnology). If the parsed format matches an existing MODX resource you can then redirect to it.</p> <p><a href="http://forums.modx.com/index.php/topic,41502.msg249684.html#msg249684" rel="nofollow">http://forums.modx.com/index.php/topic,41502.msg249684.html#msg249684</a></p> |
1,508,463 | 0 | Integration between Project Web Access and SharePoint (Gantt Charts) <p>I'm a newbie to using Project Web Access and I wondered if someone can guide me by giving links that help in integration of SharePoint site with Project Web Access.</p> <p>What I want to do is to generate Gantt charts inside a regular SharePoint site. I know that there is a standard view to generate charts in SharePoint but I need the more customizable view in Project Web Access.</p> |
10,414,509 | 0 | <pre><code>let exists k l = List.fold_left (fun b x -> b || x = k) false l </code></pre> <p>Two comments on @tonio's answer:</p> <ul> <li>Use <code>||</code> instead of superfluous <code>if ... then true else ...</code>.</li> <li>Use structural equality (<code>=</code>) instead of reference equality (<code>==</code>) for comparing values.</li> </ul> <p>Moreover, <code>exists</code> is available in <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html" rel="nofollow">List module</a>. The built-in function is more efficient since it doesn't have to go through the whole list every time.</p> |
11,301,960 | 0 | <p>Using one floated span with a border:</p> <pre><code><div class="heading"> <span></span> <h3>Heading<h3> </div> .heading { width: 100%; text-align: center; line-height: 100%; } .heading span { float: left; margin: 20px 0 -8px; border: 1px solid; width: 100%; } .heading h3 { display: inline; padding: 0px 0px 0 20px; width: auto; margin: auto; } </code></pre> <p>The negative base margin on the span may need to be adjusted for different heading sizes. , The background colour of the heading should match the background of the overall container.</p> <p><a href="http://jsfiddle.net/QVUKJ/" rel="nofollow">JS Fiddle demo</a></p> |
20,933,990 | 0 | Best performance for SQL DB design? <p>I have a question about DB design and performance.</p> <p>Imagine the following scenario:</p> <p>I have a <code>Product</code> table, each record of products might have different color, different weight and different type. when I want to design my database I have have 2 ways:</p> <ol> <li><p>I can design 3 tables, a <code>Productcolor</code> table with <code>ProductID</code> and <code>Color</code> columns, then one for <code>ProductSize</code> with <code>ProductID</code>, weight columns, and a <code>ProductType</code> table with <code>ProductID</code> and <code>Type</code>. And repeat one product with different colors, wights and types. and use join to have total properties.</p></li> <li><p>I can have color, weight, type columns in <code>Product</code> table and separate different values by a separator like ",". </p></li> </ol> <p>I have some tables like this one, now i want to know is there any better solution for such a scenario? if not which one has better performance in sql and even in my asp.net project?</p> |
8,218,801 | 0 | <p>You should move the time logic into your database query - there's no point in fetching ALL rows, only to throw away some (most? all?) of the rows if there's nothing to do:</p> <pre><code>SELECT * FROM users WHERE `time` < (now() - INTERVAL 3 DAY) </code></pre> <p>Once that's done, I'd suggest moving the actual mail() portion out of the database fetching loop, so that you can batch together each user's brochures first:</p> <pre><code>$users = array(); while($row = mysql_fetch_array($time_query_result)) { if (!array_key_exists($row['userID'], $users)) { $users[$row['userID']] = array('email' => $row['email'], 'brochures' => array()); $users[$row['userID']]['brochures'] = array('b' => $row['brochures'], 't' => $row['time']); } } </code></pre> <p>You'd then loop over this $users array to build emails for the users:</p> <pre><code>foreach ($users as $user) { $text = '<html><body><p>Brochure reminder</p>'; $i = 1; foreach ($user['brochures'] as $brochure) { $text .= 'Brochures:<br />'.$i++ .$row['b']. $row['b']; } $text .= '</body></html>'; mail($user['email'], $subject, $text, $headers); } </code></pre> <p>This way, you fetch all the user details in one go. You then build a SINGLE email to each user, listing all of their brochures, and (hopefully) problem solved.</p> |
9,315,111 | 0 | <pre><code>SELECT ca.CustomerName AS [Affected Users] FROM CustomerActivity ca INNER JOIN ShipperActivity sa ON ca.OrderNumber = sa.OrderNumber WHERE sa.ActivityDate >= '2012-02-15 00:00:00' AND sa.ActivityDate < '2012-02-16 00:00:00' UNION SELECT ea.EmployeeName AS [Affected Users] FROM EmployeeActivity ea INNER JOIN ShipperActivity sa ON ea.OrderNumber = sa.OrderNumber WHERE sa.ActivityDate >= '2012-02-15 00:00:00' AND sa.ActivityDate < '2012-02-16 00:00:00' </code></pre> |
14,646,255 | 0 | <p>Pointers and arrays can be accessed just the same.</p> <p>For example:</p> <pre><code>int array[4] = { 1, 2, 3, 4 }; printf("Third entry in array = %d\n", array[2]); int *pointer = array; printf("Third entry in array using pointer = %d\n", pointer[2]); </code></pre> <p>If the pointer is in a structure or not doesn't matter, just use normal field access (e.g. <code>structure.pointer[2]</code> or <code>structpointer->pointer[2]</code>).</p> |
37,990,312 | 0 | App consumes a lot of memory after integrating advertisement <p>With no advertisement integration in my project my app uses a maximum of 18MB of memory. After integrating AdMob and iAd my app now uses memory up to 60MB.</p> |
17,366,497 | 0 | how to run bundle install without quiet flag <p>When deploying an app with capistrano to a VPS, my deployment script is running bundle install with a quiet flag. Is there a way to make it run without the quiet flag. There's nothing in the deploy.rb file (borrowed from Ryan Bates) that seems to set it to quiet. </p> <pre><code>command finished in 161ms * 2013-06-27 12:57:07 executing `bundle:install' * executing "cd /home/brain/apps/dogapp/releases/2013044444 && bundle install --gemfile /home/brain/apps/dogapp/releases/2013044444/Gemfile --path /home/brain/apps/dogapp/shared/bundle --deployment --quiet --without development test" </code></pre> <p>Deploy.rb</p> <pre><code>require "bundler/capistrano" server "198.69.696969.69", :web, :app, :db, primary: true set :application, "dogapp" set :user, "brain" set :deploy_to, "/home/#{user}/apps/#{application}" set :deploy_via, :remote_cache set :use_sudo, false set :scm, "git" set :repository, "[email protected]:braindead/dogapp.git" set :branch, "master" default_run_options[:pty] = true ssh_options[:forward_agent] = true after "deploy", "deploy:cleanup" # keep only the last 5 releases namespace :deploy do %w[start stop restart].each do |command| desc "#{command} unicorn server" task command, roles: :app, except: {no_release: true} do run "/etc/init.d/unicorn_#{application} #{command}" end end task :setup_config, roles: :app do sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}" sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}" run "mkdir -p #{shared_path}/config" put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml" puts "Now edit the config files in #{shared_path}." end after "deploy:setup", "deploy:setup_config" task :symlink_config, roles: :app do run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" end after "deploy:finalize_update", "deploy:symlink_config" desc "Make sure local git is in sync with remote." task :check_revision, roles: :web do unless `git rev-parse HEAD` == `git rev-parse origin/master` puts "WARNING: HEAD is not the same as origin/master" puts "Run `git push` to sync changes." exit end end before "deploy", "deploy:check_revision" end </code></pre> |
34,399,776 | 0 | Laravel 4.2 custom error handler not working <p>I am trying to handle InvalidArgumentException in a custom way. In app/start/global.php I have the following code block after the built in <code>App::error(Exception $exception... block</code>:</p> <pre><code>App::error(function(InvalidArgumentException $exception, $code){ // die('last'); $exceptionData['exception'] = $exception; $exceptionData['code'] = $code; ExceptionNotificationHandlerController::notify($exceptionData); }); </code></pre> <p>die()ing, breakpoints, etc all suggest to me that it never goes into that block of code when I throw an InvalidArgumentException. Help?</p> |
26,220,857 | 0 | <p>You could add one event handler for each container you actually want to receive the event in (if this is feasable in your setup):</p> <p>(somewhere:)</p> <pre><code>(function() { var container = document.getElementById('mainwrap'); container.addEventListener('click',handler,false); function handler(e) { e = e || window.event; var element = e.target || e.srcElement; console.log("Element actually clicked: ", element); console.log("Container receiving event: ", container); } })(); </code></pre> <p>Or expand to (can register handler for multiple containers..):</p> <pre><code>function registerHandlerForContainer(container_id, handler) { var container = document.getElementById(container_id); container.addEventListener('click',delegating_handler,false); function delegating_handler(e) { handler(container, e); } } function handler(container, e) { e = e || window.event; var element = e.target || e.srcElement; console.log("Element actually clicked: ", element); console.log("Container receiving event: ", container); } registerHandlerForContainer('mainwrap', handler); </code></pre> |
12,064,456 | 0 | <p>This seemed to worked for me:</p> <pre><code> string schemaXPath = "//parent[@name='Iam']//toy[@name='wii']"; XPathNavigator schemaNavigator = oXmlDocument.CreateNavigator(); XPathNodeIterator nodeIter = schemaNavigator.Select(schemaXPath, namespaceMgr); while (nodeIter.MoveNext() == true) { Console.WriteLine(nodeIter.Current.Name); } </code></pre> <p>Hopefully this is what you're looking for.</p> <p>Cheers!</p> |
41,030,439 | 0 | Matrix multiplication performance improvment <p>I have got some unclear questions for the following matrix multiplication algorithm.</p> <p><a href="https://i.stack.imgur.com/oNiQF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oNiQF.png" alt="enter image description here"></a></p> <p>1) Why does the inner for-loop (line 6) do not use a “parallel for” construct?</p> <p>2) Can we further improve the performance of the inner loop computation (lines 6-7) by some form of parallelism?</p> |
17,909,934 | 0 | <p>Please refer to <code>Handling Dynamic Nesting Attributes</code> section in <a href="https://github.com/RestKit/RestKit/wiki/Object-mapping" rel="nofollow">Restkit ObjectMapping</a></p> |
17,145,193 | 0 | How to let a specific android device (fonepad) use different layout folder <p>I'm working on an Android app that has different layouts for phones (designed for portrait) and for tablets (designed for landscape).</p> <p>Now I want to support the Asus Fonepad as a phone but since it has the size and resolution of a 7 inch tablet it always uses the layouts in the layout-sw600dp folder. But the fonepad understands itself as a phone and shows the fullscreen text edit window whenever text input is used in landscape.</p> <p>How can I make this device use layouts and values from the phones and not from the -sw600dp folders? Is this even possible?</p> |
2,200,425 | 0 | <p>While dynamic programming is certainly a correct way to solve this kind of problems, this particular instance shows a regularity that can be exploited. </p> <p>You can see the problem as arranging a number of “right"s and “down"s, being wary not to count multiple times identical arrangements.<br> For example, the solutions of the size 2 problem (reported in the images in the question) can be see this way:</p> <pre><code>→→↓↓ →↓→↓ →↓↓→ ↓→→↓ ↓→↓→ ↓↓→→ </code></pre> <p>So, for any grid of side n, you can find the solution by means of <a href="http://en.wikipedia.org/wiki/Combinatorics" rel="nofollow noreferrer">combinatorics</a>:</p> <pre><code>from math import factorial n = 20 print factorial(2*n)/(factorial(n)*factorial(n)) </code></pre> <p>2n! is the number of arrangements of the 20 → + 20↓, while the two n! account for the identical ways in which the → and ↓ can be arranged. </p> |
6,063,951 | 0 | <p>We like <a href="http://balsamiq.com/">http://balsamiq.com/</a> for building wire frames. It is very fast. </p> |
36,052,505 | 0 | <p>In standard css this would be: </p> <pre><code>button button </code></pre> <p>But you have to be careful on other pages it can also select 3rd, 4th and so on.</p> <p>That is to say, there is no ordinality in standard css - only classes and id's and their hierarchy level (parent/child) relationships, unlike xpath.</p> |
19,275,922 | 0 | <p>I've looked at your code, and I think the problem is that you're outputting the cert in raw binary DER format using certificate.getEncoded() when the browser expects PKCS #12 format. I've never done this programatically, I've always used keytool or openssl to convert between formats so I can't help more than that.</p> <p>eta: this explains how to create, sign and export a PKCS12 in java: <a href="http://www.mayrhofer.eu.org/create-x509-certs-in-java" rel="nofollow">http://www.mayrhofer.eu.org/create-x509-certs-in-java</a> (note: it's an old post and requires bouncycastle and a bit of hacking :( - a modern version of bouncycastle may simply provide this functionality)</p> |
39,556,981 | 0 | Angular Polymer Binding for Number Datatype is not working in Chrome <p>I have created a Polymer Component and the one of the properties created has Number Datatype. This works in all the browser except Google Chrome.(I have included webcomponents-lite.js). In Chrome it gives NaN </p> <pre><code>notificationCount:{ type: Number, notify: true, reflectToAttribute: true } <ng-portal-header-component bind-polymer show-menu='{{vm.showMenu}}' app-name="PORTAL " notification-count="{{vm.notificationCount}}"> </ng-portal-header-component> </code></pre> |
19,421,943 | 0 | Chrome doesn't cache images inside SVG <p>I just discovered that Chrome doesn't cache images which are placed inside SVGs if their <code>cache-control</code> header is set to <code>no-cache</code>. Firefox & IE10 seem to ignore this setting.</p> <p>I've created a little test page with a static SVG:</p> <p>HTML:</p> <pre><code><div style="width: 500px; text-align: center;"> <input id="move-left-btn" type="button" value="&lt;&lt;"> <input id="move-right-btn" type="button" value="&gt;&gt;"> </div> <div class="svgwrapper" style="width: 500px; height: 250px; background-color: lightgrey;"> <svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" width="500" height="250"> <g id="svggroup" class="transition-on" transform="matrix(0.2,0,0,0.2,80,35)"> <image width="1672" height="887" opacity="1" xlink:href="https://dl.dropboxusercontent.com/sh/q7htlj5h8qqfhjf/SVDuynM7R3/car.png"></image> </g> </svg> </div> </code></pre> <p>Javascript:</p> <pre><code>$(document).ready(function() { var curXPos = 80; // Local test function which represent some server calls in my "real life" scenario // Just updates the x-position in the transform matrix in this test case function updateSvgText(svgText, posXDelta) { curXPos += posXDelta; if (curXPos < 0) { curXPos = 160; } else if (curXPos > 160) { curXPos = 0; } return svgText.replace(/matrix\(.*\)/, 'matrix(0.2,0,0,0.2,' + curXPos + ',35)'); } // Fetch the new SVG (in real life from server) and rerender it function moveSvg(posXDelta) { var svg = $('#svg'), svgText = updateSvgText($('.svgwrapper').html(), posXDelta); svg.empty(); svg.append($(svgText).children()); } $('#move-left-btn').click($.proxy(moveSvg, this, -20)); $('#move-right-btn').click($.proxy(moveSvg, this, 20)); }); </code></pre> <ul> <li><p>Working example with <code>cache-control</code> header of source image set to <code>no-cache</code> (flickers in chrome after every press on the "move" buttons):<br> <a href="http://jsfiddle.net/zF6NF/4/" rel="nofollow">http://jsfiddle.net/zF6NF/4/</a></p></li> <li><p>Same example with different source image with <code>cache-control</code> header set to <code>max-age=315360000,public</code> (no flickering):<br> <a href="http://jsfiddle.net/zF6NF/5/" rel="nofollow">http://jsfiddle.net/zF6NF/5/</a></p></li> </ul> <p>In Chrome you can see the reloading of the images on each button click in the first example ("flickering" of the image & visible in the network tab of the dev tools) whereas Firefox rerenders the SVG in both examples smoothly without any reloading.</p> <p><strong>Some additional information:</strong></p> <ol> <li><p>This is just an example. In my "real-life-scenario" I receive a new SVG from the server (instead of the <code>updateSvgText</code> method call) which means that I can't just perform partial updates of the SVG by changing the value of the transform matrix attribute but have to rerender the whole SVG every time (at least by now...).</p></li> <li><p>I can't control where the images come from which means 2 things:</p> <ul> <li>I can't change the <code>cache-control</code> header</li> <li>I can't create Base64 encoded data-uris, save them locally and just replace the images inside the SVG with those data-uris before rendering (can't create Base64 encoded data-uri because of "Same resource origin" policies...)</li> </ul></li> </ol> <p><strong>Is there any way to either...</strong></p> <ul> <li>Overwrite/overrule the <code>cache-control</code> header locally even if the image is from an uncontrolled remote location?</li> <li>Create the Base64 encoded data-uri from an Image that is loaded from a different domain I don't have any control over client sided?</li> <li>Somehow tell Chrome to always cache images inside my SVGs?</li> </ul> <p>Needless to say that other solutions are also very welcome!</p> <p>Thanks</p> |
23,566,445 | 0 | <p>if a sharedPreference doesn't exist a NullPointerException will be thrown, so I recommend you manage your code like this :</p> <pre><code>try { //handle the situation where there exists the shared preference } catch(NullPointerException exc) { //handle the situation of non-existent sharedpreference } </code></pre> |
35,871,655 | 0 | What are the available solution for starting and obtaining Selenium server for Jenkins job? <p>I have a Jenkins job to build application and I want to get another VM with Selenium server and browser installed. What are the available solution to do this?</p> |
9,426,815 | 0 | <p>QtWebkit should be a reasonable choice. You can make a simple application with Qt SDK or QtCreator. You can embedded the HTML/CSS/JS into application within the Qt resource file. Please check the source code below: </p> <pre><code>#include <QtGui/QApplication> #include <QWebView> #include <QNetworkProxy> class MainWin : public QWebView { public: explicit MainWin(QWidget * parent = 0) { m_network = new QNetworkAccessManager(this); // Setup the network proxy when required! //m_network->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, "10.1.1.80", 80)); page()->setNetworkAccessManager(m_network); // You can use the internal HTML/Javascrip/CSS by // specify qrc:// URLs refer to resources. See resource.qrc QUrl startURL = QUrl("http://www.google.com"); // Load web content now! setUrl(startURL); } private: QNetworkAccessManager * m_network; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWin w; w.show(); return a.exec(); } </code></pre> <p>This is a working example with a window frame! <img src="https://i.stack.imgur.com/akO4C.png" alt="Look like this!"> It is working just as a browser. </p> |
17,728,971 | 0 | <pre><code>$query = "SELECT name FROM #table WHERE id=$id"; if(isset($phone)){ $query .= " AND phone = '$phone'"; } </code></pre> |
39,994,056 | 0 | <p>You are appending the same class : <code>color-9999CC</code> to all your <code>rect</code> elements, so once you hover the last legend item having color : <code>#9999CC</code> all <code>rect</code> element will be selected.</p> <p>To create the required class properly, you can add the corresponding color info to each element in your <code>layers</code> object while creating it.</p> <p>I added a <code>color</code> property that has as value the color of the corresponding <code>headers</code> item:</p> <pre><code>var layers = d3.layout.stack()( headers.map(function (count) { return fData.map(function (d,i) { return { x: d.orders, y: +d[count] , color: colorScale(count)}; /*color = current headers item color */ }); })); </code></pre> <p>Then while creating your <code>rect</code> items you can add to each element a class by accessing its color property like this: </p> <pre><code>var rect = layer.selectAll("rect") .data(function (d) { return d; }) ..... .attr("class", function (d) { return "rect bordered " + "color-" +d.color.substring(1); }); </code></pre> <h3>complete code:</h3> <p><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>var margin = {top:10, right: 10, bottom: 80, left: 50}, width =960, height=650; var svg = d3.select("body") .append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); var fData = [{"orders":"A","Total_Orders":76,"A_Lines":123,"B_Lines":0,"C_Lines":0,"D_Lines":0,"Total_Lines":123,"Total_Units":3267}, {"orders":"B","Total_Orders":68,"A_Lines":0,"B_Lines":107,"C_Lines":0,"D_Lines":0,"Total_Lines":107,"Total_Units":3115}, {"orders":"C","Total_Orders":81,"A_Lines":0,"B_Lines":0,"C_Lines":123,"D_Lines":0,"Total_Lines":123,"Total_Units":3690}, {"orders":"D","Total_Orders":113,"A_Lines":0,"B_Lines":0,"C_Lines":0,"D_Lines":203,"Total_Lines":203,"Total_Units":7863}, {"orders":"AB","Total_Orders":62,"A_Lines":70,"B_Lines":76,"C_Lines":0,"D_Lines":0,"Total_Lines":146,"Total_Units":1739}, {"orders":"AC","Total_Orders":64,"A_Lines":77,"B_Lines":0,"C_Lines":79,"D_Lines":0,"Total_Lines":156,"Total_Units":2027}, {"orders":"AD","Total_Orders":100,"A_Lines":127,"B_Lines":0,"C_Lines":0,"D_Lines":144,"Total_Lines":271,"Total_Units":6467}, {"orders":"BC","Total_Orders":64,"A_Lines":0,"B_Lines":80,"C_Lines":84,"D_Lines":0,"Total_Lines":164,"Total_Units":1845}, {"orders":"BD","Total_Orders":91,"A_Lines":0,"B_Lines":108,"C_Lines":0,"D_Lines":135,"Total_Lines":243,"Total_Units":4061}, {"orders":"CD","Total_Orders":111,"A_Lines":0,"B_Lines":0,"C_Lines":132,"D_Lines":147,"Total_Lines":279,"Total_Units":5011}, {"orders":"ABC","Total_Orders":45,"A_Lines":58,"B_Lines":63,"C_Lines":55,"D_Lines":0,"Total_Lines":176,"Total_Units":1245}, {"orders":"ABD","Total_Orders":69,"A_Lines":105,"B_Lines":87,"C_Lines":0,"D_Lines":116,"Total_Lines":308,"Total_Units":4538}, {"orders":"ACD","Total_Orders":66,"A_Lines":91,"B_Lines":0,"C_Lines":88,"D_Lines":132,"Total_Lines":311,"Total_Units":4446}, {"orders":"BCD","Total_Orders":68,"A_Lines":0,"B_Lines":84,"C_Lines":95,"D_Lines":111,"Total_Lines":290,"Total_Units":4187}, {"orders":"ABCD","Total_Orders":56,"A_Lines":96,"B_Lines":90,"C_Lines":93,"D_Lines":143,"Total_Lines":422,"Total_Units":6331}] var headers = ["A_Lines", "B_Lines", "C_Lines", "D_Lines"]; var colors = ["#9999CC", "#F7A35C", "#99CC99", "#CCCC99"]; var colorScale = d3.scale.ordinal() .domain(headers) .range(colors); var layers = d3.layout.stack()( headers.map(function (count) { return fData.map(function (d,i) { return { x: d.orders, y: +d[count] , color: colorScale(count)}; }); })); //StackedBar Rectangle Max var yStackMax = d3.max(layers, function (layer) { return d3.max(layer, function (d) { return d.y0 + d.y; }); }); // Set x, y and colors var xScale = d3.scale.ordinal() .domain(layers[0].map(function (d) { return d.x; })) .rangeRoundBands([25, width], .08); var y = d3.scale.linear() .domain([0, yStackMax]) .range([height, 0]); // Define and draw axes var xAxis = d3.svg.axis() .scale(xScale) .tickSize(1) .tickPadding(6) .orient("bottom"); var yAxis = d3.svg.axis() .scale(y) .orient("left") .tickFormat(d3.format(".2s")) var layer = svg.selectAll(".layer") .data(layers) .enter().append("g") .attr("class", "layer") .style("fill", function (d, i) { return colorScale(i); }); var rect = layer.selectAll("rect") .data(function (d) { return d; }) .enter().append("rect") .attr("x", function (d) { return xScale(d.x); }) .attr("y", height) .attr("width", xScale.rangeBand()) .attr("height", 0) .attr("class", function (d,i) { return "rect bordered " + "color-" +d.color.substring(1); }); layer.selectAll("text.rect") .data(function (layer) { return layer; }) .enter().append("text") .attr("text-anchor", "middle") .attr("x", function (d) { return xScale(d.x) + xScale.rangeBand() / 2; }) .attr("y", function (d) { return y(d.y + d.y0) - 3; }) .text(function (d) { return d.y + d.y0; }) .style("fill", "4682b4"); //********** AXES ************ svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis) .selectAll("text").style("text-anchor", "end") .attr("dx", "-.8em") .attr("dy", ".15em") .attr("transform", function (d) { return "rotate(-45)" }); svg.attr("class", "x axis") .append("text") .attr("text-anchor", "end") // this makes it easy to centre the text as the transform is applied to the anchor .attr("transform", "translate(" + (width / 2) + "," + (height + 60) + ")") // centre below axis .text("Order Velocity Group"); svg.append("g") .attr("class", "y axis") .attr("transform", "translate(20,0)") .call(yAxis) .append("text") .attr("transform", "rotate(-90)") .attr({ "x": -75, "y": -70 }) .attr("dy", ".75em") .style("text-anchor", "end") .text("No. Of Lines"); //********** LEGEND ************ var legend = svg.selectAll(".legend") .data(headers) .enter().append("g") .attr("class", "legend") .attr("transform", function (d, i) { return "translate(" + (headers.length-(i+1))*-100 + "," + (height + 50) + ")"; }); legend.append("rect") .attr("x", width - 18) .attr("width", 18) .attr("height", 18) .style("fill", function (d, i) { return colors[i]; }) .on("mouseover", function (d, i) { svg.selectAll("rect.color-" + colors[i].substring(1)).style("stroke", "blue"); }) .on("mouseout", function (d, i) { svg.selectAll("rect.color-" + colors[i].substring(1)).style("stroke", "white"); }); legend.append("text") .attr("x", width - 24) .attr("y", 9) .attr("dy", ".35em") .style("text-anchor", "end") .text(function (d) { return d; }); transitionStacked(); function transitionStacked() { y.domain([0, yStackMax]); rect.transition() .duration(500) .delay(function (d, i) { return i * 10; }) .attr("y", function (d) { return y(d.y0 + d.y); }) .attr("height", function (d) { return y(d.y0) - y(d.y0 + d.y); }) .transition() .attr("x", function (d) { return xScale(d.x); }) .attr("width", xScale.rangeBand()); };</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.3.0/d3.min.js"></script> <body></body></code></pre> </div> </div> </p> |
15,917,652 | 0 | <p>When you receive the data in the ReadCallback, you then (even if you haven't received all the data you are expecting) call Send(), which then does an async send, in the send callback you then call Send() again, this, I think, is what you mean by spamming the client, as this will just loop around sending the same thing to the client over and over.</p> <p>I suggest you check what you have received in the first place, it's entirely possible that the call to receive won't return all the data you are expecting in one go. Then don't call Send in the SendCallback if you don't want to send the data to the client again.</p> <p>Oh, and remove the calls to shutdown and close the socket...</p> |
28,533,018 | 0 | How to push data with multiple types in Firebase? <p>I want to push an array that has strings, numbers and date. Do I have to update individually or is there another way I can accomplish this?</p> <p>Example:</p> <pre><code>var categories : [String] = self.parseCategories() var standbyDataStrings = [ "firstName":firstName, "lastName":lastName, "categories": categories, "time_stamp":self.date.timeIntervalSince1970 ] var standbyDataNums = [ "radius":nf.numberFromString(self.helpRadiusLabel.text!), "duration":nf.numberFromString(self.helpDurationLabel.text!) ] standbyUserRef.updateChildValues(standbyDataStrings) standbyUserRef.updateChildValues(standbyDataNums) // this gives me a error "string is not identical to NSObject" </code></pre> <p>Combining standByDataStrings and standbyDataNums gives me an error.</p> <p>Or is there a way to retrieve a string from Firebase and using it as an int. It gets stored as a String with the quotations.</p> |
32,340,754 | 0 | <p>Try utilizing <code>css</code> selectors <code>#one:hover, #two:hover, #three:hover</code> , <code>:hover</code> pseudo-class, <code>transition</code> . See also <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity" rel="nofollow">Specificity</a></p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Testing jQuery</title> <style type="text/css"> div { width: 400px; height: 300px; margin: 20px; float: left; } #one { background-color: red; } #two { background-color: green; } #three { background-color: blue; } #one:hover, #two:hover, #three:hover { height: 150px; background-color:rgba(0,0,0,0.4); transition: height 1000ms, background-color 1000ms; } </style> </head> <body> <div id="one"></div> <div id="two"></div> <div id="three"></div> </body> </html></code></pre> </div> </div> </p> |
34,829,241 | 0 | <p>According to the Molliza Developer Network <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta" rel="nofollow">documentation</a>:</p> <blockquote> <p>The HTML <code><meta></code> element represents any metadata information that cannot be represented by one of the other HTML meta-related elements (<code><base></code>, <code><link></code>, <code><script></code>, <code><style></code> or <code><title></code>).</p> </blockquote> <p>Charset (Character set) is a set of encodings used to represent characters to the screen. UTF-8 is a specific type capable of encoding all possible characters, or code points, in <a href="https://en.wikipedia.org/wiki/Unicode" rel="nofollow">Unicode</a>.</p> <blockquote> <p>Q: In the above code what is the meaning of <code><meta charset="utf-8"/></code>?</p> </blockquote> <p>Adding this attribute declares, but don't guarantee the character encoding used for that specific web document.</p> <blockquote> <p>Q: If i remove it from the code, there is no error.</p> </blockquote> <p>Remember when I said there was no guarantee in the previous sentence? This is because the <code><meta ..></code> tag is only part of the algorithm that browsers use to apply. Again, referencing the mozilla docs, <em>The HTTP Content-Type header and any BOM elements have precedence over this element</em>. For a more comprehensive understanding, see <a href="https://html.spec.whatwg.org/multipage/syntax.html#encoding-sniffing-algorithm" rel="nofollow">whatwg.org</a>.</p> <p>You may ask then what is the point of implementing that line at all if the browser can perform shallow reasoning to include the charset encoding by default. The answer is simple:</p> <ul> <li>More assertive programming.</li> <li>Better practice.</li> <li>The browser may get it wrong.</li> <li>Prevents <a href="https://code.google.com/p/doctype-mirror/wiki/ArticleUtf7" rel="nofollow">IE guessing it is encoded in UTF-7</a>.</li> </ul> |
37,664,314 | 0 | <p>I'm not quite sure what you want to do. Do you help aligning the divs in a row or vertically aligning the image in its own row? If the latter, you want to use vertical-align (<a href="http://www.w3schools.com/cssref/pr_pos_vertical-align.asp" rel="nofollow">http://www.w3schools.com/cssref/pr_pos_vertical-align.asp</a>).</p> |
31,866,677 | 0 | <p>If not using NLTK I would go for recognizing specific suffixes to see what is where. Just a layout.</p> <p>So, split a sentence to words and see which words ends with "ed", "ing", "tion", "ay" "et" "ct" "ee" "ly" "ful" "less" "ness" etc.</p> <p>And short forms "n.t" ".ve" "'re" "'d"...</p> <p>Support this with some light weight dictionary like CMUDict which only contains words and their respective pronounciations.</p> <p>Have somewhere a list of irregular verbs and usual forms like "am" "is" "are" "was" "were" "have" "has" "will" "shall" "do" "does" "did" and their negatives.</p> <p>With this system you can see whether you got an English word at all.</p> <p>From its suffix and position in the sentence you can pretty well guess its role in the sentence.</p> <p>Otherwise, even if you have separate lists of verbs and nouns it is usually hard to tell (only by looking at this word) whether it is noun or a verb. So you will have to have a context manager in any case. (If you want your guesses to be 98% correct).</p> <p>Search for any English dictionary (if you would not use CMUDict) and parse it for your use.</p> <p>Don't do it online! It will be slow and there is big amount of other problems that may appear, including inconsistent returns and connection problems.</p> |
12,188,339 | 0 | Java write to Stdin <p>So I have imported a jruby interpreter as a library to run an external ruby application. However I need to interact with the ruby application in some way. Right now I have the ruby application outputting information on stdout and requesting user options in stdin.</p> <p>So if I want java to be able to handle inserting the options instead of a user, I'll need a way that I can write to the stdin somehow from java to choose the options. Does anyone know how I can do this? Or even a better way to do this?</p> <p>I'm calling jruby like so:</p> <pre><code>String[] newargs = new String[2]; newargs[0] = "-S"; newargs[1] = "path_to_some_rubyfile.rb" org.jruby.Main jruby = new org.jruby.Main(); ruby.main(newargs); </code></pre> <p>The ruby app outputs stuff like this:</p> <pre><code>How do you feel today? (1) Happy (2) Sad </code></pre> <p>And then waits for the user input to enter 1 or 2. But I would like Java to input these options instead of having a user do it.</p> |
8,187,736 | 0 | <pre><code>SELECT e.LastName, e.DepartmentID, d.DepartmentName FROM Employee e INNER JOIN Department d ON d.DepartmentID = e.DepartmentID WHERE d.DepartmentID = 31 </code></pre> |
38,202,835 | 0 | <p>Try this:</p> <p>Start by casting <code>destinationViewController</code> to <code>UITabBarController</code> and then using the <code>viewControllers</code> property to access the first viewController in the tabBarController:</p> <pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { let tabVc = segue.destinationViewController as! UITabBarController let navVc = tabVc.viewControllers!.first as! UINavigationController let chatVc = navVc.viewControllers.first as! ChatViewController chatVc.senderId = userID chatVc.senderDisplayName = "" } </code></pre> |
3,115,909 | 0 | How to design a flash based website when user has different screen size and different resolution? <p>I am developing a flash based website using mxml. My monitor's resolution is 1280x768 and is widescreen. The problem is while it appears properly in my screen it doesn't appear properly in others. Which is the best approach to solve the problem ? </p> <p>I have 2 in mind. </p> <blockquote> <ol> <li>Let scrollbars take care of it : If the screen is 14 inch screen with 800x600 resolution it appears zoomed in. So thats a problem</li> <li>Get screen resolution and resize using scaleX and scaleY : The graphic components will get resized but fonts give problem.</li> </ol> </blockquote> <p>Which is the best approach among these ? If there is a better approach please mention. Thanks</p> |
32,034,136 | 0 | <p>You just need a negative condition in your RewriteRule to allow specific directory or path:</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule !^assets(/.*)?$ router.php [L,NC] </code></pre> |
14,338,792 | 0 | <p>Unless you are doing something really special with it, you should not directly read the <code>app.config</code> file, but use <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx" rel="nofollow"><code>ConfigurationManager</code></a> class to read from it. If you really want to read it as XML, use <a href="http://msdn.microsoft.com/it-it/library/875kz807.aspx" rel="nofollow">XmlDocumen.Load()</a> function, but plaease keep in mind that parsing config as an XML file is an unintended way of use.</p> |
8,555,959 | 0 | <p>This constructor is used in another class. In this case it looks like you're trying to make a "point on a graph" so with that assumption in another class you would use this constructor to make an instance of the Point class.</p> <pre><code>public class Example { private Point pt; public static void main(String[]args) { pt = new Point(20,10); } } </code></pre> <p>This example creates a new instance of the Point class where x is 20 and y is 10.</p> |
26,314,758 | 0 | <p><strong>this could be easily done with just editing your css</strong></p> <pre><code>$('.clampjs').click( function() { $(this).css({ //changes the css of the clicked content. 'height':'100px', //give what ever height you want. 'overflow':'hidden' }); }); </code></pre> <p>just now tested in my page it works...</p> |
26,568,666 | 0 | HDF5 Database Design Lookup Tables vs storage of redundant data <p>I've worked on several fairly small scale legacy HDF5 databases and each one utilizes grouping to perform lookups. For example as a contrived example lets say I have one 2 dimensional dataset where each cell maps back to a group which may store another dataset which holds the data which corresponds with the ID contained in the original dataset. This is fine but one project basically utilizes hdf5 in a relational database type system. (dataset contains value for group to open -> Group contains attributes which tell me the name of dataset to open -> finally get to data)</p> <p>Since hdf5 has builtin compression would it make more since to store redundant data (say in compound datatypes).</p> <p>Granted it depends on the requirements/complexity of the data, but just in general is it bad practice to store redundant data in HDF5? </p> |
23,483,538 | 0 | <p>would a php only solution work for you?</p> <pre><code> function list_directories($dir){ $temp_dir = $_SERVER['DOCUMENT_ROOT'].$dir; if (is_link($dir)) { echo "do nothing"; } else { $pattern = '/./'; $bad = array(".", "..", ".DS_Store", "Thumbs.db", ".svn", ".git"); $class = 'dir'; $contents = scandir($temp_dir,1); $files = array_diff($contents, $bad); krsort($files); echo "<ul>"; foreach($files as $item){ $file_extension = strtolower(substr(strrchr($item,"."),1)); echo "<li><a href='http://".$_SERVER['SERVER_NAME'].$dir.$item."'>".$item."</a></li>"; } echo "</ul>"; } } </code></pre> |
11,286,379 | 0 | <pre><code>int main () { char *arr= "abt"; // This could be OK on some compilers ... and give an access violation on others arr++; *arr='e'; // This is where I guess the problem is occurring. cout<<arr[0]; system("pause"); } </code></pre> <p>In contrast:</p> <pre><code>int main () { char arr[80]= "abt"; // This will work char *p = arr; p++; // Increments to 2nd element of "arr" *(++p)='c'; // now spells "abc" cout << "arr=" << arr << ",p=" << p << "\n"; // OUTPUT: arr=abc,p=c return 0; } </code></pre> <p>This link and diagram explains "why":</p> <blockquote> <p><a href="http://www.geeksforgeeks.org/archives/14268" rel="nofollow">http://www.geeksforgeeks.org/archives/14268</a></p> <p><em>Memory Layout of C Programs</em></p> <p>A typical memory representation of C program consists of following sections.</p> <ol> <li>Text segment</li> <li>Initialized data segment</li> <li>Uninitialized data segment</li> <li>Stack</li> <li>Heap</li> </ol> <p>And a C statement like const char* string = "hello world" makes the string literal "hello world" to be stored in initialized read-only area and the character pointer variable string in initialized read-write area.</p> </blockquote> |
28,365,666 | 0 | angular-file-upload is not posting anything <p>I am trying to use angular-file-upload. The file is being sent from the view to the angular controller but it is not sending anything to the apiController. I have made a plunker. </p> <p><a href="http://plnkr.co/edit/lGjgTIeVZdgxcS2kaE7p?p=preview" rel="nofollow">Plunker</a></p> <p>It drops the file at </p> <pre><code>$scope.upload = function (files) { $scope.$watch('files', function () { $scope.upload($scope.files); }); $scope.upload = function (files) { if (files && files.length) { for (var i = 0; i < files.length; i++) { var file = files[i]; $upload.upload({ url: 'https://angular-file-upload-cors-srv.appspot.com/upload', fields: { 'companyName': $scope.companyName }, file: file }).progress(function (evt) { var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); console.log('progress: ' + progressPercentage + '% ' + evt.config.file.name); }).success(function (data, status, headers, config) { console.log('file ' + config.file.name + 'uploaded. Response: ' + data); }); } } }; </code></pre> <p>Update</p> <p>I see how your success function is being hit. mine still is not. and there is no javascript errors in my console. what can i do to debug it?</p> |
27,055,907 | 0 | <p>You cannot get the data from grid for searching, you need to store you data some where for using search. That is to store in a ViewState, Session or call DataBase on every search. Bellow code show data stored in a ViewState, you can acces your data any time by just using GridViewData where you can done search. (if you have very large amount of data first preference is calling data from database on every search.)</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GridView1.DataSource = GridViewData; GridView1.DataBind(); } } public DataSet GridViewData { get { if (ViewState["GridViewData"] == null) { String str = "select * from tblEmployee where (Name like '%' + @search + '%')"; SqlCommand xp = new SqlCommand(str, objsqlconn); xp.Parameters.Add("@search", SqlDbType.NVarChar).Value = TextBox1.Text; objsqlconn.Open(); xp.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = xp; DataSet ds = new DataSet(); da.Fill(ds, "Name"); objsqlconn.Close(); ViewState["GridViewData"] = ds; } return (DataSet)ViewState["GridViewData"]; } } </code></pre> |
1,568,664 | 0 | <p>Assuming that:</p> <ul> <li>You can keep copies of the original and end data on both your field devices and your base system</li> <li>When you talk about swaps, you mean two items in the list are swapped with one another</li> </ul> <p>Your best solution is probably:</p> <p>Rather than keeping a list of all the swaps you do as they are performed, compare your starting and finishing data at the end of the day, and then generate the swaps you would need to make that change. This would ignore any locations in the list that remain unchanged, even if they are only unchanged because a series of swaps "undid" some change. If you have your data take the form of <code>a,b,a,b,...</code> where <code>a</code> tells you the index of the next elements to leave in the same order they're in, and <code>b</code> tells you the index of the item to swap it with.</p> <p>Because you're only doing swaps instead of shifts, you should very rarely end up with data like your sample data where 30, 40, and 50 are in the same order but in a slightly different location. Since the number of swaps will be between 1/4 and 1/10 the number of original items in the list, you'll usually have a big chunk of your data in both the same order and the same location it was in originally. Let's assume the following swaps were made:</p> <pre><code>1 <-> 9 4 <-> 2 5 <-> 2 </code></pre> <p>The resulting list would be:</p> <pre><code> 1. 90 2. 50 3. 30 4. 20 5. 40 6. 60 7. 70 8. 80 9. 10 </code></pre> <p>So the change data could be represented as:</p> <pre><code> 1,9,2,4,4,5 </code></pre> <p>That's only six values, which could be represented as 16-bit numbers (assuming you won't have over 16,000 items in your initial list). So each "effective" swap could be represented with a single 32-bit number. And since the number of actual swaps will generally be 1/5 to 1/2 the size of the original list, you'll end up sending between 10% and 20% of the data in your original list over the wire (or less since the number of "effective" swaps may be even less if some of those swaps undo one another).</p> |
26,222,063 | 0 | <p>Take a look at <a href="https://github.com/gettyimages/connect_sdk_java" rel="nofollow">https://github.com/gettyimages/connect_sdk_java</a>. Specifically, at the test application. It performs a search using an AsyncTask and the private class notifies the UI via onPostExecute. Hopefully, this will get you further along.</p> |
6,675,678 | 0 | <p>Here:</p> <pre><code>$('.someClass').live('click',function(){ // Handle here }) </code></pre> |
30,607,796 | 0 | <p>I may be completely off since I don't do a lot of work with unicode, but it seems to me that the following should work:</p> <pre><code>import csv with open('test.csv', 'ur') as csvin, open('test-write', 'uw') as csvout: reader = csv.DictReader(csvin) writer = csv.DictWriter(csvout, fieldnames=['Indv', 'AttrName', 'AttrValue', 'Start', 'End']) for row in reader: for traitnum in range(1, 4): key = "trait{}".format(traitnum) writer.writerow({'Indv': row['email'], 'AttrName': key, 'AttrValue': row[key]}) </code></pre> |
32,367,825 | 1 | Unbound method must be called with instance as first a <p>So, I have a class, where a class variable is set to the output from a class factory in the <code>__init__</code> method, like so:</p> <pre><code>def MyFooFactory(): def __init__(self, *args): # Do __init__ stuff def MyBar(myFoo_obj): print "MyBar" newclass = type("MyFoo", tuple(object), {"__init__": __init__, "MyBar": MyBar} ) return newclass class Foo: Bar = 0 def __init__(self): if (type(Foo.Bar) is int): Bar = MyFooFactory() def MyBar(a_list): for l in a_list: Bar.MyBar(l) </code></pre> <p>However, when I try this</p> <pre><code>myBar_list = [Foo.Bar() for _ in range(x)] Foo.MyBar(myBar_list) </code></pre> <p>TypeError: unbound method MyBar() must be called with Foo instance as first argument (got list instead)</p> <p>Is this happening because <code>MyBar</code> has the same name in both <code>Foo</code> and <code>MyFoo</code> or is there something else afoot here?</p> <p>For reference, both <code>MyBar</code> methods are supposed to be unbound.</p> <p>Thanks,</p> |
17,673,960 | 0 | <p>Try this .htaccess code :</p> <pre><code>RewriteEngine on RewriteRule ^search+(.*)$ /search.php?s=$1 </code></pre> |
12,334,738 | 0 | <p>There is a warning on the <a href="https://developers.facebook.com/docs/reference/rest/" rel="nofollow">facebook</a> website,</p> <blockquote> <p>We are in the process of deprecating the REST API. If you are building a new Facebook app, please use the <a href="https://developers.facebook.com/docs/reference/api/" rel="nofollow">Graph API</a>. While there is still functionality that we have not ported over yet, the Graph API is the center of Facebook Platform moving forward and where all new features will be found.</p> </blockquote> <p>And according to <a href="http://stackoverflow.com/questions/5053723/how-do-i-send-sms-messages-through-graph-api">this</a> and <a href="http://stackoverflow.com/questions/5524694/sms-through-facebook-graph-api">that</a> Stackoverflow questions, there is no implementation available right now.</p> |
20,371,955 | 0 | <p>Just make the value a <code>String</code> by concatenating an empty <code>String</code>:</p> <pre><code>function getObjects(obj, key, val, path) { var value = val + ""; for (var prop in obj) { if (prop == key && obj[key].toLowerCase().match(value)) { result.push(passName); matchFlag = 1; } } } </code></pre> |
14,949,577 | 0 | How to save append item, if we do page refresh in jquery? <p>i want to append few line of html and that's remains as same if we do page refresh</p> <p>how could i do that</p> <p>code is :</p> <pre><code><!DOCTYPE html> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </script> <script> $(document).ready(function () { $("#btn2").click(function () { $("ol").append("<li>Appended item</li>"); }); }); </script> </head> <body> <p>This is another paragraph.</p> <ol> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> </ol> <button id="btn2">Append list item</button> </body> </html> </code></pre> |
37,240,134 | 0 | <p>CarePlan is used to share information about what the intended course of care is for a patient - what activities are you going to do, when are you going to do them, how are they going, etc. If you wanted to track a plan to have 5 encounters over the course of 6 months, maintain a daily pain log, do a set of exercises at least twice a week, etc., CarePlan could be used. No requirement to use it if not needed though.</p> <p>EpisodeOfCare is used to link activities related to a single condition that span multiple encounters. You can link encounters, procedures, etc. to EpisodeOfCare</p> <p>ClinicalImpression is a new, evolving resource. Think of it as a specialized type of Observation that's intended to tie together a bunch of other observations and make an overall assessment.</p> <p>A complete summary of care would typically be represented as a FHIR document - that's a Bundle instance starting with a Composition that would then organize relevant information about the care into a series of sections. If you don't want the overhead of full document, you can skip the Composition and just have a Bundle containing relevant information.</p> <p>Completion of Referrals is dependent on business process. Typically the ReferralRequest instance is owned by the placing/initiating system. They decide when to mark the request as complete - be that on receiving back a report, knowledge that the transfer of care is done, sufficient elapsed time or other means. The Order/OrderResponse (to be replaced by Task) can be used to communicate back and forth between placer and filler systems to help coordinate when work is deemed to be complete.</p> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.