Sunday, 15 July 2012

javascript - Broken If/Else Statement using Randomizer -


OK, I'm still starting JavaScript, but I try to type a rock-paper-scissy type game I am doing Everything is working very well, except that every time I run the "reload" function the output is that first "if" second if / Else statement This means that the output "both sides are reloaded." Every time it comes back, the code is organized to see how it is down. Apart from this I already know that random works. Any help will be greatly appreciated. Thank you.

  var reload = function () {var random = function () {var randomizer = Math.random () * 100 if (randomizer & lt; = 33) {var compDecision = 1} Else If (randomizer> 67) {var compDecision = 2} and if (33 & lt; randomizer & randomizer & lt; = 67) {var compDecision = 3}} if (compDecision = 1) {confirm ("both Confirm the sides (Compdecision = 2) ("You reload and raise the defensive positions of the enemy.")} And if (compDecision = 3) {Confirm ("The enemy takes you out as the reload . "}}}  

= , And logical comparison For operation, == then you should declare the var compdecision as blank or default var followed by var . I recommend terminating your statement using the semi-colon ; , unlike JavaScript, they are not optional for other languages I'm your work code, look at the end of the solution:

  var reload = function () {v Ar compDecision = 0; Var random2 = function () {var randomizer = Math.random () * 100 if (randomizer & lt; = 33) {compDecision = 1; } Else if (randomizer> 67) {compDecision = 2; } And {compDecision = 3; }} Random2 (); If (compdeecision == 1) {warning ("reload both sides."); } And if (compdeecision == 2) {warnings ("You reload and takes enemy defensive position."); } And if (compdeecision == 3) {Warning ("The enemy takes you out as the reload."); }} Reload ();  

Tested here:


sorting - My code for merge sort in C++ using dynamic arrays returning garbage values -


Please tell me why this code is refusing garbage. Well compiled, it is implemented on the basis of the Coromandel Algorithm, taking the given numbers originally given two zeros functions are taken in a dynamic array. One is to merge two sub arrays through merge sort and the other to divide the array into the array.

  # include & lt; Iostream & gt; using namespace std; In zero, two merge (int * A, int p, int q, int r) // to merge a function two / sub arrays {int n1 = q-p + 1; Int N2 = R-Q; Int L [N1]; Int r [n 2]; For (int i = 0; i & lt; n1; i ++) {l [i] = a [p + i]; } Int m = 1; (Int j = 0; j & lt; n2; j ++) for (r [j] = a [q + m]; m = m + 1;) int i = 0; int j = 0; For (int k = 0; k & lt; r; k ++) {if (l [i] & lt; = r [j]) {a [k] = l [i]; i = i + 1; } And {a [k] = r [ja] j = j + 1;}}} zero merge (int * a, int p, int r) // sort the sub arrays {if (p  & gt; n; Int * a = NULL; A = new int [n]; int temp {Cin> gt; & gt; temp; cout & lt; & lt; for "enter number" & lt; endl; (int i = 0; i & lt; n; i ++) * (A + I) = floating; // insert the given numbers into the dynamic array cout  

You are getting your gaps inaccurately in your code everywhere For example:

  • Based on your usage, main , mergeresort is considered to sort the codeal of indices [0, n -1] .

In this sense, your recursion index of [p, r-1] , in mergeresort , first of all you [P, q-1] sorting [q + 1, r-1] should: completely ignore the index . . . Similarly, merge is confused: when you compete in L ( A [i], should be A [p + I] ), takes it as [p, q] as a list, and [q, r] as another list: note That you copy the entry to q twice, and you probably also copy r when you probably should not be.


To fix your code, you need to fix that it should be working at all intervals. It's not an hard problem, you just brought yourself to clearly to write all your functions and loops and accessories It is supposed to do this.

Typical conference these days are half open intervals: You should generally think of taking the [p, q] indicator from the list. <<> [p, q] is same [p, q-1] ) Here are several examples why it is preferred:

< Ul>
  • [p, r] number of entries for rp
  • for through the loop > >
  • divide the interval [p, r] gives you interval in parts [p, q] and [q, R] - - No worries about adding 1 to places Is.
  • For example merge will usually be designed to take the first list index comes from [p, q] and index Second list from [q, r] .


    javascript - How to refactor this code if I need to rate-limit it's execution speed -


    I was thinking, I can use the sleep function - but javascript does not work for sleep.

    How can I slow down a bit to stop the parsight rate? I want to execute one (1) pars.clid.ron method every 5 seconds.

      $ ('website') each (function (i) {var website = $ (this) .text (); Parse.Cloud.run ('getMainEmail', {url: website }, {Success: work (result) {cell.next (). Text (result);}, error: Function (error) {console.log ("Email for website could not be found:" + website); console Log (error);}});  

    Currently, this code finds all the websites in the DOM and a TON fire of parsed requests at the same time - which gives me the rate of approx. Immediately decreases.

    just Use Setimeme and pass the website as a passmaster

      $ ('website'). (Function (i) {var website = $ (this) .text (); SetTimeout (pane.clood.run ('getMainEmail', {url: siteText}, {success} function (result) {cell.next (). Text (result);}, error: function (error) {Console.log ("Email for website could not be found:" + sitetext); console.log (error);}}, (I + 1) * 5000, website);});  

    php - Multidimensional Array on TWIG loop -


    I am trying to save a few values ​​in a multirection on Twig, but for some reason this is not working .

    I want to save the list of users and some values ​​to an array. I am using the merge function to create merge arguments.

    {% result for %%} {% set users = users> merge ({('(' name '~ loop.index)): result .name, (' age ' Loop.index): result.age, ('credits' ~ loop.index): result.credits})%} {% endfor%}

    Try this:

      {% set users = []%} {% result result%} {% set user = User | Merge ([{{'name': result.name, 'age': result.age, 'credits': result.credits}])%} {% endfor%}  

    c# - Unity 5 Trail Renderer on UI button -


    I'm having a really difficult time with the new Unity 5 UI system and trailer renderer. I want to engage the trace renderer on the UI button. I need to drag the user on the button and draw marks of action. Unfortunately, I can not see the mark in the game, it only appears in the editor. I have tried many tricks with order, camera attachment etc. But nothing helped, did anyone solve this issue and guide how? Thanks!

    Because if the z value of the camera is similar to the z value of the trailer renderer gamebase, then the mark renderer gameback Will not be seen in the game, but you can see it in the visual inspector. So try to see it, you will never set the z value of the camera so that the travel renderer is equal to gamebank value. Like: None with 0 .... I use this method to solve this problem.


    jquery - clone() the initial element after is removed -


    I have some problems with this for a few hours and have not managed to find solutions, although I understand the reason Problem's.

    I clone the elements one by one and when I remove them from the top of the scroll bar apers, to change the colors from red or black depending on the number generated by the elements The phenomenon of Moissardown is.

    My problem occurs when the first element is removed (initial red with color), clone (clone) with the next one color change. I only want to clone the initial class.

    This incident occurs because I want to tell the machine to use the method .first () which element I want to clone. If I remove .first () , then the clone () method will create several elements instead of one per time, but this will also cause the problem to make the changing color element.

    Here is the code:

      var current = false $ (document). Click (function () {if (running)} {return}} running = true; var endless = SetInterval (function () {var random = Math.floor (2 * Math.random ()); var math = ( Random ('' background '' ('background', 'silver', 'background' $ ('Body', 'html'), chetan ({scrollTop: '+ = 70'}, 1000, 'linear')}, 1000); $ (window); unbind ('mousedown')}}; On ('scroll', function (if ($ (".: First"). Offset (). Top + $ ("square: first"). Height () <$ (window) .scrollTop () ) {$ ("Class: first"). Remove ()}})}}  

    Please be hello.

    This event occurs because I used the method (first) I want to clone.

    It seems as if you Want to remember for future cloning, so that your running variable, add:

      var class;  

    And then change it:

      $ ("square"). first (). Clone () AddClass (...  
    if (! Square) {class = $ ("square"). First ();} class.clone (). AddClass (... >


    socket.io - Angularjs socket.on event not working when socket connection changed in factory -


    I am doing a factory for socket.io, if the user is not logged in, then I

      var socket = io.connect (SOCKET_URL);  

    When the user logs in to the site, then I am changing the socket value.

      socket = io.connect (SOCKET_URL, {forceNew: true});  

    I have in my controller

      socket.on ('notification', function (data) {console.log (data);}) Code>  

    This socket.one ('Notification') is working after factory replacement socket variable.

    My factory

      app .factory ('socket', function ($ rootScope)) {var socket = io.connect (SOCKET_URL); Return {reconnect: function () {console.log ("reconnect"); Socket = io.connect (SOCKET_URL, {forceNew: True});}, on: function (eventName, callback) {socket.on (eventName, function) {var args = arguments; $ RootScope $ Applied (function () {callback.apply (socket, args);})}});}});  

    My Controller

      app.controller ('myCtrl1', function ($ radius, socket) {$ scope.login = function () {// ............. socket.reconnect ();}}); App.controller ('myCtrl2', function ($ scope, socket) {socket.on ('notification', function (data) {// it is not working console.log (data); // call socket.reconnect after ( );})});  


    sql - How to insert both a variable and result of stored procedure into the same row in a temporary table? -


    मेरे पास तालिका के रूप में घोषित है

    DECLARE @tbl तालिका (एक int, b int )

    और मेरे पास एक संग्रहीत कार्यविधि है dbo.sp जो बिल्कुल एक इंट और एक वेरिएबल @ ए देता है जो कि एक int मूल्य। मैं इन दोनों मूल्यों को तालिका में एक पंक्ति में डालना चाहता हूं।

    मुझे पता है कि मैं कर सकता हूँ

    INSERT @tbl (a) SELECT a = @a

    और

    INSERT @tbl (बी) EXEC dbo.sp PARAMS

    लेकिन, मेरा प्रश्न है , मैं एक पंक्ति पाने के लिए दोनों कैसे करूँ?

    मुझे जोड़ना चाहिए कि मेरे पास बहुत ही सीमित एसक्यूएल के साथ अनुभव है और मैं एसक्यूएल 2012 का उपयोग कर रहा हूं।

    कुछ और टिंकरिंग के साथ, मैं इसे निम्नलिखित के साथ काम करने में सक्षम था

      बनाएँ तालिका # टी 1 (बीआईएटी) में # टी 1 एक्ससीसी डीबीओएसएपी पैरामीटर INTER में @टीबीएल (ए, बी) का चयन करें ए = ए ए, बी एफ टीएमटीए से   

    लेकिन अगर कोई बेहतर समाधान, मुझे यह सुनना अच्छा लगेगा।


    semaphore - Different uses of the value parameter in sem_init(...) in c -


    Suppose I initialize a semaphore in two different ways

    1. < Code> sem_init (& randommem, 0,1)
    2. sem_init (& randomsem, 0,0)

    Now,

    or

    will it work for only

    sem_wait (& randomsem) Work in both cases

    sem_init (& amp; randomsem, 0,1) , using sem_wait (& amp; randomsem) As decreases the value parameter when it more than 0 and so if I Ndera the sem_init (& randomsem, 0,0) ??

    , then this will not work? Please help!

      int sem_init (sem_t * sem, int pshared, unsigned int value);  

    sem_init indicates by semaphore object end. The number associated with the semaphore is initially set to the value Pshared logic indicates that the sequor is current to the current process (pshared is zero) or to be shared between multiple processes (pshared is not zero).

    The third parameter sets the value, the initial value of the semaphore, then in the first case your semaphore starts with the value of 1, the second cast 0;


    php - Wordpress - is_page_template -


    I am using the following code to set the column width on some pages within a WordPress site:

      if (is_page_template ('fullwidthhome.php')) {global $ content_width; $ Content_width = 1080; / * Pixel * /} otherwise (is_page_template ('wideContent.php')) {global $ content_width; $ Content_width = 1080; / * Pixel * /}  

    This works great on pages with custom templates, but I'm not sure how it should work for custom post types.

    This does not look like when I set up my custom post type template:

      elseif (is_page_template ('single-widecontent.php')) {global $ Content_width; $ Content_width = 1080; Class = "post-text" itemprop = "text"> 

    About this function get_post_type ()

    / P>


    opencart layout and position issue -


    I have installed open sequence 1.5.6 with the OK theme and im having a strange problem with the layout im .. < / P>

    I want to show the slider and the latest products on the homepage and in the layout I have selected "Home" for common / home routes

    but the problem is that when I Go to the internal pages slider and the latest products are still showing

    and the other thing is that the left There is a problem with column and column on the right. Im has set category links on left column and layout category but they are not visible.

    Can someone tell me what is wrong?

    • If more than one root has been added, then this problem will occur. Go to Admin -> System then go to Design-> Layout and check other layout routes. If any other page removes a common 'mango / house' route then remove it. I think your first problem will be solved.

    Check the category template to see if the value is $ column_left, if the $ column_right is present or not, if not, then do not echo it here. After that check it once.


    javascript - Unable to change background of div containing unordered list -


    Just want to change the background dynamically, do not feel able to do this, what do I remember here? I should clarify, that this is the backdrop of the container device I'm trying to change ...

      $ ('# container'). Click (function () {$ (this) ToggleClass ('bgchange');}); $ ('# Container ul li'). Click (function () {$ (this) .toggleClass ('bgchange');});  

    Bella

    ID identifier class is more specific than container CSS For the identifier so that it gets overwritten, therefore if you want to override the container and also changes the color, then ! Important Add Example


    domain driven design - DDD: Storing reference to non-Aggregate Root Entity from different Bounded Context -


    I am struggling to understand the model of my problem:

    • A company There may be several teams.
    • Each team should have a unique name per team.
    • With a list of all reports for a company, a particular team should be able to retrieve the report.

    Right now, I have 3 round contexts - company, team and report. I believe that I should go to the team to unite my unique name inside the company - though , As I think:

    "There is nothing beyond all limits, if I can only reference an AR from my report AR, then I do not store that team Which can come under my report - just the company.

    I It is thought that this team can be present in the form of BC and the company can also be within BC.One team is formed when the company is in the form of a unit within BC Here, Naming the team and irreversible enforcement can be ensured. Team BC still existed and the report can still retrieve the reference of TeamID from the report AR, however, this Team ID and team repetition both

    Is this approach correct or am I missing something?

    I am confused if I have 3 BC, which is 2E Should be of P., or the concept of a team unit inside company BC should be missing.

    Maybe I am confusing Gautam relations I need a total route - I'm not sure!

    Gulp, help!

    In your example the company and the team can not have a contex connected, this unit (company or group) Aggregation can be root, it depends on work), identification of company identity, team name + team name identification is in the team.

    Bound context is a combination of model, which should reflect the meaning of the selected subdomain Team and company can make a BC, Reporting is another reference.

    If in your example reporting is just some information for easy display for the user, then there is no aggregation route in the context related to this reporting because there is no business logic and rule. Use simple DTO to display.


    html - How to put an 'if' statement in an asp Repeater ItemTemplate to determine if a DataItem list property is empty? -


    मेरे पास एक दोहराने वाला एक दो-स्तरीय सूची प्रदर्शित करता है:

      & lt; ul & gt; & Lt; एएसपी: पुनरावर्तक आईडी = "मेन्यूरुपीटर" रनैट = "सर्वर" ऑन आईटमेडाटाबाउंड = "मेनूरूपीटर_आईटम डेटाबाउंड" & gt; & LT; ItemTemplate & gt; & Lt; li & lt;% # (लिंकडेटा के रूप में कंटेनर.डेटाइटम) .क्लास% & gt; & gt; & Lt; asp: हाइपरलिंक आईडी = "मेनूहाइपरलिंक" runat = "server" & gt; & Lt; / एएसपी: हाइपरलिंक & gt; & LT; ul & gt; & Lt; asp: पुनरावर्तक डेटा स्रोत = '& lt;% # DataBinder.Eval (कंटेनर.डेटाइटम, "सब लिंक")% & gt;' runat = "सर्वर" & gt; & LT; ItemTemplate & gt; & Lt; li & lt;% # (लिंकडेटा के रूप में कंटेनर.डेटाइटम) .क्लास% & gt; & gt; & Lt; a href = '& lt;% # DataBinder.Eval (कंटेनर.डेटाइटम, "लिंक")% & gt;' & gt; & lt;% # DataBinder.Eval (कंटेनर.डेटाइटम, "टेक्स्ट")% & gt; & lt; / एक & gt; & Lt; / li & gt; & Lt; / ItemTemplate & gt; & Lt; / एएसपी: पुनरावर्तक & gt; & Lt; / ul & gt; & Lt; / li & gt; & Lt; / ItemTemplate & gt; & Lt; / एएसपी: पुनरावर्तक & gt; & Lt; / ul & gt;  

    यह ठीक काम करता है, लेकिन मैं नेस्टेड सूचियों को विस्तारणीय और भयानक बनाने चाहता हूं मैं बाह्य सूची आइटम को एक आइकन जोड़ना चाहता हूं जो कि "सब लिंक" खाली सूची नहीं है, लेकिन मुझे यकीन नहीं है कि पुनरावर्तक में यह कंडीशनल स्टेटमेंट कैसे करना चाहिए।

    मैं सोच रहा था कि मैं ऐसा कुछ कर सकता हूं, लेकिन यह काम नहीं करता।

      & lt;% # (DataBinder.Eval (कंटेनर.डेटाइटम, "सब लिंक" )। कोई भी () ?? "& lt; i वर्ग =" एफए-प्लस "& gt; & lt; / i & gt;")% & gt;  

    यह कोशिश करें

      & lt;% अगर ( सत्य)% & gt; & LT;% {% & gt; & Lt; li & gt; --------- & lt; / li & gt; & Lt;%} अन्य {% & gt; & Lt; li & gt; --------- & lt; / li & gt; & LT;%}% & gt;  

    symfony - Extra field in manyToMany relationship -


    I have two tables: users and estate

    A user can be "linked" to many assets, and for many users a property can be "linked". To handle many of these many relationships, I have created a "connectable" wealth in which the primary key is actually a combined one, in which two foreign key userId and estateId Includes.

    It was okay till I wanted to add additional fields to this table.

    I have read that when there are additional fields for such a table, the relationships are no longer "too many", but the relationship between two "one"

    My problem is that the theory still does not consider this table (table joining) and when I run the php app / console principle: mapping: Import AppBundle yml

    How can I get a command line tool to handle those relationships correctly and generate this new unit (yml schema file)? Additional questions: How do I earn tool to create a repository class for each unit before running php app / console doctrine (inside yml schema files): generated: institutions MyBundle ?

    Thank you!


    objective c - Bridge to objc, how can it knows arguments types? -


    I am writing a bridge with a language that I am developing and the ObjC objective is a good introspection C function in the runtime And I'm able to retrieve the logic type for ways to use method_getTypeEncoding.

    The main problem is with object arguments, which are returned in the form of an ID (encoded @), but will I need the actual objection class name like NSSTing or NSNumber.

    Is there any way to solve this problem without parsing this file?

    "Text">

    Add another layer where you can dynamically verify assumptions by using things.

    You want to be like careful hardcoding things, "Oh, this is a string that looks for __NCFF string" - because you have no way to know that you have __NFFF string Or an example of another type. NSString is a class cluster - you can get any custom implementation while using one.

    The actual type of objects for Objective-C runtime is not important, so you have to add your layer. You can get some useful information by using the CLAG / LLVM as a tool.


    r - "lm" extended function. Linear model -


    इस सवाल का पहले से ही एक उत्तर है: < / P>

    • 1 उत्तर

    मेरे पास एक रेखीय मॉडल है लगभग 0 रुपयेक्वायर मैं 1 पैरामीटर n के साथ एक फ़ंक्शन बना रहा हूं जो कि उस विद्युत परिवर्तन का वर्णन करता है जिसे लिया जाना है।

    यदि मॉडल बन जाता है:

      y = x1 + x2 + x1 ^ 2 + x2 ^ 2 + x1 ^ 3 + X2 ^ 3  

    मैं इसे बार-बार लिखने के बिना कैसे इन मॉडल को दर्ज कर सकता हूं?

    आप सूत्र की तरह पॉली फ़ंक्शन का उपयोग कर सकते हैं

      set.seed (123) डेटा & lt; - डेटा। फ़्रेम (y = rnorm (10), x1 = rnorm (10), x2 = rnorm (10)) n & lt; -3 fm & lt; -lm (y ~ poly (x1, डिग्री = n, कच्चा = सच) + पाली (एक्स 2, डिग्री = एन, कच्चा = सच), डेटा = डीएटी) सारांश (एफएम) ## गुणांक: ## अनुमान त्रुटि टी मूल्य पीआर (& gt; | टी |) ## (अवरोधक) 0.50796 0.81187 0.626 0.576 ## पॉली (एक्स 1, डिग्री = एन, कच्चा = TRUE) 1 -0.44354 0.86195 -0.631 0.573 ## पाली (x1, डिग्री = n , कच्चा = सत्य) 2 -06,6328 0.55169 -1.202 0.315 ## पॉली (x1, डिग्री = एन, कच्चा = TRUE) 3 0.05989 0.35421 0.169 0.876 ## पाली (एक्स 2, डिग्री = एन, कच्चा = TRUE) 1 1.068 9 0 1.00518 1.063 0.366 ## पॉली (एक्स 2, डिग्री = एन, कच्चा = TRUE) 2 0.01655 0.76730 0.022 0.984 ## पॉली (एक्स 2, डिग्री = एन, कच्चा = TRUE) 3 -1.18610 0.84214 -1.408 0.254  
    <पी > डिग्री ज़ाहिर है कि एक्स 1 और एक्स 2 की अधिकतम डिग्री, कच्चा = सत्य इसका अर्थ है कि यह x1 + I (x1 ^ 2) + के बराबर है .. । , यदि कच्चे = गलत बहुपदों को ओर्थोगोनल किया जाएगा।

    ध्यान दें कि गुणांक के नाम के अंत में संख्या संबंधित बहुपदों की डिग्री दर्शाती है।

    पीएस: आप पाली (x1, x2, डिग्री) का उपयोग कर सकते हैं = N, raw = TRUE) , एक समान सूत्र लिखने के लिए जिसमें इंटरैक्शन शामिल हैं।


    jquery - Duplicate a row in JQGrid and save it to model, using mvc4 visual studio 2012 -


    Good day, this is my first question in StackVareflow, I need to duplicate a line using JQGRID, and its Save it after the database, I am using jqgrid 4.4.4, jquery, Visual Studio 2012, MVC4 and SQL Server 2008 R2. I created a custom button, the idea was that when I click it, it duplicates the selected row and when I click on the Save button, it can save the duplicate line in the database.

    I duplicated the blind line, but I do not know how to save the database. Save Button Always Post With Operation Price "Edit" Has anyone done this before? Thanks for any help.

    This selectec line is a duplicate code:

      newId = "new"; $ ('#' + Grid2.id) .jqGrid ('addRowData', New ID, Myadata, "After", Celi Idrro); $ ('#' + Grid2.id) .jqGrid ('setSelection', new id, incorrect); $ ('#' + Grid2.id) .jqGrid ('editRow', newId); $ ("#" + Grid2.id + "_iledit"). AddClass ('UI-state-disabled'); $ ("#" + Grid2.id + "_ilsave"). RemoveClass ('UI-state-disabled'); $ ("#" + Grid2.id + "_ilcancel"). RemoveClass ('UI-state-disabled');  


    Integrating jQuery DatePicker Calendar into Page -


    I am trying to integrate the calendar of jQuery into my page. I do not want the user to click on the date fields for the calendar, I want them to see the calendar only when they load the page. Is it possible, and if so, how?

    I'm looking at Stack Overflow for help, but I'm not sure what I'm looking for is the right way to describe it correctly.

    Thank you very much.

    As described in, you can just call Datepicker inline to display inline code Instead of a

    .datepicker () method.

    The arousing problem of this usecase is fasct only, that you will not get the date you entered directly in an input field, you can get the value by calling $ ("# yourDatepickerDiv"). Datepicker ('getDate');


    c++ - Where can I get the STL <map> header for fedora 21? -


    अगर मैं #include & lt; map & gt; या & lt; सेट & gt; / Code>, मुझे निम्न त्रुटि मिलती है ..

      घातक त्रुटि: नक्शा: ऐसा कोई फ़ाइल या निर्देशिका # शामिल नहीं & lt; नक्शा & gt; ^ संकलन समाप्त  

    शेष एसटीएल वहां दिखाई देता है। मैं #include & lt; vector & gt; ठीक

    मैं निम्नलिखित टूलचैन का उपयोग कर रहा हूं

      g ++ (जीसीसी) 4.9.2 20150212 libstdc ++ -4.9.2-6.fc21.x86_64 libstdc ++ - devel-4.9.2-6.fc21.x86_64  


    java - Where is documented the JBoss EAP runtime dependencies to be added in a maven project? -


    I am using Zebaus EAP 6.1 and Java EE6.

    The Jabos tools add jabs runtime libraries, such as org.jboss.resteasy.annotations.cache.NoCache is on eclipse, but it fails to compile on Maven because Maven does not know anything about it.

    I would like to add all Jbis successfully to make it EAP library through Maven, did I use more artifacts to be able to connect all the JBS EAP libraries in the classpath? Is there any dependency that I can represent the whole Java EE6 stack and its jbis extensions such as org.jboss.resteasy.annotations.cache.NoCache ?

    I was seeing something like this:

      & lt; Dependency & gt; & Lt; Group & gt; Org.jboss.eap & lt; / Group & gt; & Lt; ArtifactId & gt; Jboss-eap & lt; / ArtifactId> & Lt; Version & gt; 6.1 & lt; / Edition & gt; & Lt; Type & gt; Pom & lt; / Type & gt; & Lt; Scope & gt; Provided & lt; / Scope & gt; & Lt; / Dependencies & gt;  

    Then we just go to & lt; Version & gt; 6.2 & lt; / Version & gt;

    This information is included in pob.xml files when updating the container and boom, magic That is what is included in Quick Blocks bundled with Jebus.

    From the example of the kitchen:

       & Lt; Version & gt; $ {Version.jboss.bom.eap} & lt; / Edition & gt; & Lt; Type & gt; Pom & lt; / Type & gt; & Lt; Scope & gt; Import & lt; / Scope & gt; & Lt; / Dependencies & gt; & Lt; Dependency & gt; & Lt; Group & gt; Org.jboss.bom.eap & lt; / Group & gt; & Lt; ArtifactId & gt; Jboss-javaee-6.0-accompany-hibernate & lt; / ArtifactId> & Lt; Version & gt; $ {Version.jboss.bom.eap} & lt; / Edition & gt; & Lt; Type & gt; Pom & lt; / Type & gt; & Lt; Scope & gt; Import & lt; / Scope & gt; & Lt; / Dependencies & gt; & Lt; / Dependencies & gt;  

    $ {version.jboss.bom.eap} is defined in parent palm

       6.2.0.GA & LT; /version.jboss.bom.eap>  

    explained here (redhat support account is required)

    JBoss component versions are listed here


    Excel - Adding time due to specific value -


    I need help in formulating Excel formulas. I want a formula for viewing the value in a cell. If the price is "telephone", then I want to add it 5 minutes to my timeline. If the value is "email / fax", then I want to add it 2-1 / 2 minutes. Please help?

    Say that the time passed is in A1 and the text is in the cell < Enter strong <1> , 5,0)), if (b1 = "email / fax", a1 + time (0,2, 30), a1))


    why mips is called load/store architecture? -


    I am studying my high school computer architecture course where I learn MIPS to understand the pipe lining! So you guys can help me understand this puzzle, thanks in advance!

    Load / storage architecture for MIPS because the instructions available in the MIPS for interaction with the memory only load and Are the stores. To load data from memos, LW to store data for memory from reg and sw to LW.


    cassandra - Delete rows vs Delete Columns performance -


    I am creating datamodals for chain applications at Cassandra 2.1.3 once. We will preserve the data of X volume for each user of the system and I am wondering what is the best way to design for this requirement.

    Option 1:

    In a 'Use Bucket' partition key, so the data goes for the X period in the same row:

      ((ID, bucket), timestamp) - & gt; Data   

    Once I can delete the same row at the expense of maintaining this bucket concept. This

    option 2:

    may limit the query range on possibly timestamp to store all data in a single line . N are deleted columns.

      (id, timestamp) - & gt; Data  

    Category question is easy again. But what about the performance after the removal of several columns?

    Given that we use TTL to expire the data, which of the two models will give the best performance? What option 1 & amp; Lt; & Lt; Will a columnist column be reflected on option 2 or both models?

    I am trying to avoid myself burying in a cemetery graveyard.

    I think it will all depend on whether you have given the partition key How many data plans are, what your TTL is and what are you questioning? / P>

    I usually bend to option # 1, especially if your TTL is all the same for writing. In addition to this, if you are using LeveledCompactionStrategy or DataTieredCompactionStrategy, Cassandra will share the same segment in the same SSTable Good data will keep working, keeping improving performance.

    If you use option # 2, then the data for the same partition can spread on multiple levels (using LCS) or in general, in many setstals, which you can get from many SSTBs Depending on the nature of your questions, you can read. There is also the issue of hotspotting, where you can surcharge to specific cassandra nodes if you actually have a wide partition.

    The second advantage of # 1 (which lets you forward) is that you can easily remove it from the whole partition, which creates a single tombstone marker which is very cheap. In addition, if you are using the same TTL, the data will be terminated at the same time within that partition.

    I believe that it is a bit of a pain which is going to read many questions, in the form of many divisions this application finally pushes some complications.

    As far as performance goes on, are you likely to see that you will need it? When your app asks questions to read the cross-section? For example, if you have a query of 'most recent 1000 records' and a partition is usually broad, then you may only need to create 1 query for option # 1 However, if you want to' record me all If you want a query like 'Give', option # 2 might be better otherwise you will need to do a query for each bucket.


    ios - dispatch_after is persisting view controller in memory -


    I have this code, which runs the block of code after the delay. Public Fancy Delay (Delay: Double, Closed: () -> ()) {Dispatch_more (DISPATCH_time (DISPATCH_TIME_NOW, Int64 (Delayed * Double (NSEC_PER_SEC), Sending_out_man_Q (), Closed)}

    The problem is that view controller persists even after the dismissal using the delay function. With the code being removed, it becomes zero, as it Should be.

    I have to know how to do a delay function, in this way, but whoever He will not release the object, and instead just do not call the block, in this event it is not otherwise in existence.

    It is in Swift, but the answer in the objective-cuites is completely appreciated. .

    The problem, as others have pointed out, that you might see this function as a visual controller , But click on self , which captures the view controller and for this one Then the context is called.

    So, suppose you did something like this from your visual controller class:

      delay (5) {self.label.hidden = true Return}  

    You will replace it with the thing that clearly says that it is weak reference self :

      delay (5) {{weak self] in itself .. Label.hidden = true return}  

    Note, I had to open the optional self when I used it. In this example, I have used alternative chaining to ensure that if it is turned off, then self is zero if it stops.


    design patterns - Is my style of coding - using static object with non-static getter - causing 'memory leaks' or 'performance issues' in my Java app on Heroku -


    I am running Play Framework 1.2.7 on Heroku, and my app is only working because I pushed it up Restart every ten minutes I want to go to the bottom of this problem and I suspect that the following aspect of my code is the issue.

    I hit a certain style of coding in which a non -Static method is used, in which one object is located The example is example. The way I read the code and it can be arranged. Like if I need the version of the object that contains the state, then I instill it, if not, then I just like Obj.instance () Do something TheMethod () However this can cause problems.

    Assume that there is a square called shop I am doing this:

      public class shop Shop INSTANCE = new shop (); Public Stable Shop Example () {Return INSTANCE; } // Some goods are public dos doSomething () {// method stuff}}  

    which I call in my code like this:

      store .instance () DoSomething ()  

    If you can tell me that this is a problem, then it would be greatly appreciated.

    Edit: The main issue is that CS / SE is not being studied, so I do not have so much knowledge, so that they will get back. If you can point me out some keywords to Google that would be very appreciated.


    Dependent Drop down list Jquery, AJAX, PHP, MYSQL -


    I am trying to create a dependent drop down list, but after making my first selection it is populating. Each selection will receive data from the MySQL database in order for the second drop down to select any option (other then a default "selection option" value) in order for the user to make a selection on the first drop down. After a lot of googling, it takes me a simple time

    drop down list (I use PHP and )

    > MySQL here in a getter.php and need_once in a index.php to create and output drop down list And echo drop down for)

      $ accountOptions = ""; $ Feature option = ""; $ Dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); If (! $ Dbc) {dead ("Connection failure:". Mysqli_connect_error ()); } /// ACCOUNTS ///// $ accountQuery = "SELECT account_id, from account_name account"; $ AccountData = mysqli_query ($ dbc, $ accountQuery); // Looping through data and displaying all accounts ($ aRow = mysqli_fetch_array ($ accountData)) {$ accountOptions. = "& Lt; option value = \" ". $ ARow ['account_id']." \ "& Gt;" . $ ARow ['account_name'] "& lt; / options & gt;"; } $ AccountDropDown = "& lt; Labels & gt; Account: & lt; / label & gt; & lt; br & gt; & lt; name select name = 'account' id = 'account' change = ' GetFacility (this.value) '& gt; & lt; option selected =' selected 'disable =' disabled 'value =' '& gt; Select account & lt; / options & gt; $ AccountOptions "& lt; / Select & gt; "; //// utilities ///// $ feature_download =" & lt; Label & gt; Feature: & lt; / Label & gt; & Lt; Br> Select name = 'feature' id = 'feature' & gt; & Lt; Option selected = selected 'disabled =' disabled 'value =' '& gt; Select feature & lt; / Option & gt; & Lt; / Select & gt; ";  

    JQuery / AJAX

      function getFacility (val) {$ .ajax ({type:" POST " Url: "Getfacility.php", data: 'account_id =' + val, success: function (data) {$ ("#type") .html (data);}});}  

    getfacility.php

      // db connection .. if (! ($ _ POST ["account_id"])) {$ AccountID = $ _POST ['Account_id']; $ Sql ​​= "SELECT *, from the account.account_name facility" "Join the account in the INNER account. Account_id = facility.account_id "" WHERE facility.account_id = '"$ AccountID."' "$ Data = mysqli_query ($ dbc, $ sql); resonance" & lt; Option selected = 'selected' disabled = 'disabled' value = '' & gt; Select feature & lt; / Option & gt; "; while ($ FRow = mysqli_fetch_array ($ data)) {$ feature option. =" & Lt; Option value = \ "". $ FRO ['feature_id']. "\" & Gt; "$ FRO ['feature_name']" & lt; / Option & gt; ";} $ feature = dropdown =" & lt; Label & gt; Feature: & lt; / Label & gt; & Lt; Br> & Lt; Select name = 'feature' id = 'feature' & gt; & Lt; Option selected = 'selected' disabled = 'disabled' value = '' & gt; Select feature & lt; / Option & gt; ". $ Feature Option" & lt; / Select & gt; ";}  

    Right now, when I make a selection on my first drop, nothing else happens, where I am getting wrong?

    Expected response in the "text">

    network (console)

      // db connection .. if (! ($ _ POST ["account_id"])) {$ accountID = $ _POST ['account_id']; $ Sql ​​= "SELECT *, account.account_name", in the account "INNER" Account_id = facility.account_id "" WHERE facility.account_id = '"$ AccountID."' "$ Data = mysqli_query ($ dbc, $ sql); resonance" & lt; Option selected = 'selected' disabled = 'disabled' value = '' & gt; Select feature & lt; / Option & gt; "; while ($ FRow = mysqli_fetch_array ($ data)) {echo" & lt; Option value = \ "". $ FRow ['account_id']. "\" & Gt; "$ FRO ['account_name']" & lt; / Option & gt; ";}  

    php - I have code that works, with picture uploaded from gimp. But image created with gd not -


    My problem is, I want to add an image of 3 image, first there is a yellow background, then I use PHP and GD To write some text on this, the text is black, so I made it transparent in the next phase, then I want to keep that picture on the background picture, so the text is textured on it. It works fine, if I upload PNG from my computer built in GIMP, but there is transparency on the picture created with GD, but the result is a yellow background with black letters again.

    How should this be?

    What is the code I am getting now from:

    How does it come with an image made from GD now?

      & lt ;? Php header ('content-type: image / png'); $ Title = "Puluania"; $ Im = imagecreatetruecolor (1200, 320); // $ im = imagecreatetruecolor (1200, 320); $ White = imagecolorallocate ($ im, 255, 255, 255); $ Crna = imagecolorallocate ($ im, 0, 0, 0); $ Black = imagecolorallocatealpha ($ im, 255, 255, 255, 127); $ Yellow = imagecolorallocate ($ im, 251, 18, 8); // External Bracket South Poseidon ImageFilm ($ im, 0, 0, yellow $); $ Font = "/ alrightites-ultra-v3.ttf"; // Dodajam Text to Jattu Pozdinu ImageText ($ im, 122, 0, 40, 160, $ crna, $ font, $ title); // Kriarum Slim Krani Text Najetos Possadini Imaging ($ im, 'sl.png'); Imagedestroy ($ im); // Ovaz Dio Bi Trebao Napervicae Dr. Karen Slova Postnu Projorna $ image = imagecreatefrompng ('sl.png'); $ Odabirprozirne = imagecolorallocatealpha ($ image, 0, 0, 0, 127); Imagealphobalending ($ image, true); Imagecolortransparent ($ image, $ odabirprozirne); Imagepng ($ image, 'sl114.png'); Imagedestroy ($ image); / * Dodaj zvijezed Audišipod * / $ image_1 = imagecreatefrompng ('TexturaZvijezde.png'); $ Image_2 = imagecreatefrompng ('sl114.png'); Image swords ($ image_1, true); ImageCopy ($ image_1, $ image_2, 0, 0, 0, 0, 1200, 120); Imagepng ($ IMAGE_1); Imagedestroy ($ IMAGE_1);  

    I did not test it, but according to the function's manual,

    For example

    // Close alpha blending and set alpha flag immatovalating ($ png, false); Image swords ($ PNG, true);


    php - Extract emails from a list of url -


    I have a list of URLs, which I want to remove email or from href or by text.

      & lt; A href = "mailto: EMAIL" class = "spamspan" & gt; EMAIL & lt; / A & gt;  

    How can I do this using PHP regex?

      / mailto: ([a-zA-Z0-9 _ \ .-] + @ [\ Da-z] .-] + \. [Ed.] {2,6}) "/ gm  

    view this demo


    multithreading - Interrupt a thread safely in Java -


    is a thread that connects to the server (HTTP) and waits for response or response timeout (server until Returns a loop does not respond to the data to return) When a thread processing is returned in response

    There is a need to stop / interrupt all threads on the Stop service, but threads have to complete the response processing (if there is a thread processing and not waiting for the response).

    Here is an example of code

      Public square waiting Response thread thread extension extended {Fixed final end TIMEOUT = 4 * 1000; Fixed final distance PROCESSING_DURATION = 2000; Private volatile bullion stops = false; Private volatile bullion processing = false; Run public void () {System.out.println ("initial hair thread"); While (Stop!) {Try {// here is waiting for a thread server response (real life response timeout in 400 seconds) // Probably it is now safe to interrupt the thread. Sleep () is simulating with the system. Out.println ("Waiting for response"); Thread.Sleep (timeout); Processing = true; // There is some work on the response and we will be allowed to terminate it / thread again. Imitate the delay with sleep () Thread.sleep (PROCESSING_DURATION); Processing = false; } Grip (Interrupted e) e.printStackTrace (); }} System.out.println ("Child Thread Ends"); } Public Zero Set Off (Boolean Closed) {this.stopped = Closed; } Public Boolean Processing () {Return Process; } Public static zero main (string [] args) {Waiting responseTr = new waiting response;); // Start thread, it sends a request and is waiting for the response to t.start (); Try {Thread.sleep (1); // Let's allow thread to end normally, if this response is for processing, set (true); System.out.println ("Waiting for the child to get a response"); Thread Sleep (TIMEOUT + 1); // Let's allow thread to finish processing (T. Processing ()) {System.out.println ("Processing"); Thread.Sleep (500); } // We can not wait up to 400 seconds until the next loop check / so that the thread is sleeping if we are obstructing it in bus (T. aslive ()) {System.out.println ("killing"); T.interrupt (); }} Grip (Interrupted e) e.printStackTrace (); } System.out.println ("main thread terminated"); }}  

    Is this "hindering" method good? Is there another way to wait as time to time and to lose data that is processed?

    this

      while (processing. ()) {System .out.println ("Processing"); Thread.Sleep (500); }  

    There is a form of voting that you should avoid voting at all costs. If possible, use a form of delegation where the collar indicates the collar during processing.

    Besides, I'm pretty sure that interfering with a thread is something that you hardly want to do, but the way you are doing it is okay if you have to do it anyway.


    ruby - Separate assets repo for multiple Rails apps -


    I am using Rail 3 and Ruby 2. I have the following apps:

    1. App A
    2. App b

    Now through App A and App B API, each other Talk to It's SOA, as apps grow more, I found out that the application has CSS and Javascript which can be used again on all apps. I want to separate assets (CSS, JS) into separate repos (such as AppC) so that app A and B can use the same property repo.

    These are my questions:

    1. For deployment, app c should be precompiled and shortened, and app A and B should point to that repo. What are the options?
    2. For development, app C should not be shortened, but how should app C and AC be used to make all changes to the CSS / JS in app?

    I searched through Google, but could not find more results. Maybe my keywords were wrong Please feel free to name the rules / conventions used for this exercise.

    If there are other better practices, please also give suggestions.

    simple option to use one to share asset files between your two projects / applications Maybe for me.

    Another option is to have your own gem files in those assets, and use that gem in both of your projects, this will require a little more work, but it is easy to manage the versions under the track (GIT Submissions need some additional manual steps so that you can change the subpload repository to keep things up to date).


    windows - Wireless connection in WinPE 5.1 -


    I have to deploy an image of Windows 8.1 with only one USB port. For the convenience of the system, I successfully try to connect to WinPE via Wi-Fi. I get an error 0x000022f when I try to load the netwibibes to the driver. I have not found any other solution; Existing plugin for this

    Any ideas or directions for this?

    is concerned,


    ios - CloudKit errors "Bad Container" (5/1014); "Couldn't get container configuration from the server for container "iCloud.com.abc.def""> -


    I'm new to the cloud kit, someone can help me with error because I have a record in my public database I am trying to implement and receive this error.

    "Bad container" (5/1014); "Could not get container configuration for container" iCloud.com.abc.def ""

    Thanks.

    Is this your bundle ID of application? Xcode creates a container on the server with the existing application's bundle ID. Double check your application's bundle ID then follow the instructions to set that container.


    casting - T-SQL find only the columns which can be casted as INT -


    I have to write a SELECT statement, which has a WHERE block, where only I

    is it possible

    I am on a SQL server **

    I am doing something like this:

    / p>

      column Cast (INT) Where the table ISNUMERIC (column) = 1  

    but then I have lots of different data conversion 275,949,275,947 'varchar value' column - But I only need INTs

    A Kyuel Server 2012:

      select try_parse (select "+1231321313" As Integer) try_parse ( '234242342341231321' as integer)  

    SQL Server & lt; 2012:

      select case when ISNUMERIC ( '+1231321313') = 1 and PATINDEX ( '% [^ 0-9 -]%', '+1231321313') = 0 and artists ( the "+1231321313 '-2147483648 and 2147483647 cast among bigint) aS (" +1231321313 "in -2147483648 and 2147483647 as select case integer) end when ISNUMERIC (' 234242342341231321 ') = 1 and bigint between cast ( '234242342341231321') so as to cast ( '234242342341231321' integer) end  

    edit: potential currency values ​​( '$ +23424231321', '€ +234 4231321 "etc.) to deal with, you can also add PATINDEX ( '% [^ 0-9-]%', '1231321313') = 0


    php - NULL value in specific column results in field duplication when extracting mysql record set -


    I have the following mySQL query:

      $ query = sprintf ("select AA, AB, ..., AC, from AA =% s by Order AA; ", implode (" OR AA = ", $ _SESSION ['value']); For some records the value of  b , and for others,  b  is NULL  

    I remove the query with the following PHP: For

      ($ i = 0; $ i & lt; $ nrows; $ i ++) {$ row = mysqli_fetch_assoc ($ results); // contains the data stored in each row ($ line); Echo "& lt; tr & gt;"; Forex currency ($ line $ $ column = & gt; $ as field) {If ($ field == $ ...) {...} elseif ($ field == $ C) {echo " & lt; input type = 'text' name = 'C + []' value = '$ C' & gt; & lt; / td & gt; "; } Echo "& lt; / tr & gt;" }  

    The not blank b fields are presented accurately in the resulting HTML table, while null Apply the duplication of the B field C field This offset occurs at the beginning of the record, puts the final boundary in the records outside the table boundaries.

    I think I have reduced the problem () to remove the problem, because r_print readouts of each other variable in the script returns the exact field name and value. However, print_r on the $ line after extract provides a similar printout for the other variables in the script.

    In some probable ways, can I stop the repetition of the C field? Happy to provide more information on request


    redirect - Contourn Paypal redirection -


    I use the payment sandbox method and when a user pays, he does not click on "return to" Site, "but that page closes, it is paid, but my page which manages the treatment if payment is not called ... how can I return this page automatically? Thanks

    what you are looking for It will configure auto-rear in April. It is part of the system

    He said, I do not advise you to withdraw the payment processing work back from URL even if auto-return enabled. There is no guarantee that the user will make it on that page (for example, they can close their browser window), and in those cases your code never runs, so that your system is properly Instead, you should use, which is similar to PDT, except that it will post data to the "listeners" script, which you are sitting on your server, even if the consumer returns to your returns or not . Url This will ensure that your code always runs as expected.

    The IPN allows you to organize things like e-checks properly, which gets cleared for a few days, so you will need to update your system on pending payments. As a payment, you can automate the tasks for things such as refunds, customer disputes, membership payments etc. through IPN.


    node.js - node inspector -brk not working -


    I'm trying to use node-inspector with a simple script. I have some console logs, so I can tell whether this is going on or not I have tried two ways:

    1. node-debug test.js

    With this approach, the debugger opens in chrome, but I do not have breaks and runs without giving me the chance to enter the break points. Go to http://127.0.0.1:8080/debug?port=5858 to begin debugging in Terminal Window # 1

    ~ $ node-inspector node inspector v0.9.2.

    In Open Debugger Terminal Window # 2 in Chrome:

    Node - Debug-Brack Test. JS

    The script is waiting, but I have not been able to open the debugger window, so I refresh the page. As soon as I do, I see my console logs (not breaking).

    I am running OSX Yosemite (10.10.1), node.js v0.12.0, NPM 2.5.1, and node-inspector v0.9.2.

    Why is any thoughts happening?

    This is a known bug while running node v0.12 and io.js,


    Unable to find OraOLEDB.Oracle provider in the Linked Server Providers -


    I try to configure linked server SQL Server I'm having the Oracle database, however, I'm unable to find OraOLEDB.Oracle in the list of providers of linked servers.

    Will you guide me to solve this issue?

    Thanks

    You must have Oracle installed on SQL Server termination. It includes an OLEDB driver.


    reportbuilder3.0 - Report Builder TeeChart -


    I am developing a report to one of my clients, using two linked tables, The group I'm grouping on the report.

    At the top of the group, I need to put a DPT charge, which shows the flow of cash on that group.

    The group works well, receives all the correct data, but the DPT chartt considers the entire pipeline, and prints the same, overloaded chart for each group.

    Is there any way I can print it correctly?

    Or can I clear the graphic on every group?

    Asked about the problems of digital faceters, he said that this is because this operation is my The version used by is not supported. Current Version: 15.04 Build 145


    jquery - Multiple controls using the same javascript -


    I have a jquery calendar in which the js files are stored in the calendar folder. When I select the date, the date is inserted into a textbox. It's working fine. But I have another textbox and I want to use the same script and function for the same box. I am new to jquery, so help me with this one here is scripting:

      & lt; Head & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Link href = "calendar / jquery-ui.theme.css" rel = "stylesheet" /> & Lt; Script src = "// code.jquery.com/jquery-1.10.2.js"></script> & Lt; Script src = "calendar / jquery-ui.js" & gt; & Lt; / Script & gt; & Lt; Link href = "calendar / jquery-ui.css" rel = "stylesheet" /> & Lt; Script & gt; $ (Function () {$ ("# date picture"). DatePicker ();}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; TR & gt; & Lt; Td class = "unmaintable1" & gt; Registration started: & lt; / Td> & Lt; Td class = "unmaintable2" & gt; & Lt; Input type = "text" id = "datepicker" /> gt; & Lt; / Td> & Lt; Td class = "unmaintable3" & gt; Registration ends: & lt; Input type = "text" id = "datepicker0" /> gt; & Lt; / Td> & Lt; Td square = "unmountable 4" & gt; & Amp; Nbsp; & Lt; / Td> & Lt; / TR & gt;  

    I know that this is something to do with ID, but I'm not sure how to solve it. Thanks in advance.

    "false">

      & Lt; Head & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Link href = "calendar / jquery-ui.theme.css" rel = "stylesheet" /> & Lt; Script src = "// code.jquery.com/jquery-1.10.2.js"></script> & Lt; Script src = "calendar / jquery-ui.js" & gt; & Lt; / Script & gt; & Lt; Link href = "calendar / jquery-ui.css" rel = "stylesheet" /> & Lt; Script & gt; $ (Function () {$ ("datepicker") Datepicker ();}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; TR & gt; & Lt; Td class = "unmaintable1" & gt; Registration started: & lt; / Td> & Lt; Td class = "unmaintable2" & gt; & Lt; Input type = "text" class = "datepicker" id = "datepicker" /> gt; & Lt; / Td> & Lt; Td class = "unmaintable3" & gt; Registration ends: & lt; Input type = "text" class = "datepicker" id = "datepicker0" /> gt; & Lt; / Td> & Lt; Td square = "unmountable 4" & gt; & Amp; Nbsp; & Lt; / Td> & Lt; / Tr & gt;  


    matrix - Solve wrong type argument 'cell' -


    I type some value in variable 'O'

      I for = 1: Size (I, 1) for j = 1: Size (1, I) H = I * J; O {h} = i (i, j) * theta (h); End  

    I - double, theta - double me sum () all O ' values ​​are required, but when I do this, give me the error: sum: incorrect type argument' cell '. How do I sum () ? Postcode when I want to see O () , give me

      o = {[1,1] = 0.0079764 [1,2] = 0.0035291 [1] , 3] = 0.0027539 [1,4] = 0.0034392 [1,5] = 0.017066 [1,6] = 0.0082958 [1,7] = 1.4764e-04 [1,8] = 0.0024597 [1,9] = 1.1155 E-04 [1,10] = 0.0010342 [1,11] = 0.0039654 [1,12] = 0.0047713 [1,13] = 0.0054305 [1,14] = 3.3794e-04 [1,15] = 0.014323 [1 , 16] = 0.0026826 [1,17] = 0.013864 [1,18] = 0.0097778 [1,19] = 0.0058029 [1,20] = 0.0020726 [1,21] = 0.0016430 etc ...    

    Yoga (cell2 matte (your_cell_o))

    However, this is a very wrong way to solve your problem. The thing is that You should not have created a cell array in the first place. You should create a numerical array:

      O = zero (size (i), orbit (i)); For I = 1: J = 1 for rows (i): column (i) h = i * j; O (h) = i (i, j) * theta (h);  

    For the end is the end but it is actually very bad and slow is the vector language for octave operation. Instead, you should be:

      h = (1: rows (I)) '. * (1: column (I)); #automatic broadcasting = I. * Theta (h);  

    which treats your function auspicious correctly and if the given matrix will calculate the value for each element and return some of the same size.

    If you get an error about the wrong size, I think you have an older version of Octave which does not autocomplete. If so, update Octave if you really do not Then:

      h = bsxfun (times, (1: rows (I)) ', 1: column (i));  

    wordpress - Trying to edit MailChimp button, but CSS rule messes up rest of site -


    In trying to change the color of the "Subscribe" button I added the CSS while editing the CSS plugin.

      #mc_embed_signup .button {background color: gray; White color; }  

    This bit of code meets the purpose you want, but it also changes many other things on my website, but not limited to: header, footer, H1 Text, H2 text, etc.

    Why is this bit of code destroying so much trouble?

    This particular bit CSS is probably not what's to screw the rest of your site.

    Your #mc_embed_signup .button {} selector is OK. The # mc_embed_signup element has an div element that wraps the MailChimp signup form, the square of the .button button, and your selector means " Apply the following styles to anything with a class of 'button' inside the element with an ID of 'MC_mbed_sign'. "

    Since there is only one button inside of that form, however, id , you complete the same thing by writing #mc-embedded-subscribe {} Can also do

    In any case, this is probably another error. Look at your CSS which produces to disturb the rest of your site for any shy braces or missing semicolons carefully.


    http - java HttpServer unable to authenticate using kerberos -


    I am running a Java server process that creates an HTTP server () object.

    The following arguments

      -Dusun.security.krb5.debug = true -Djava.security.krb5.conf = "C: \ Windows \ krb5.ini" -Djava .security.auth.login. Config = "D: \ jaas.conf" -Djavax.security.auth.useSubjectCredsOnly = false -Dhttp.auth.preference = "Kerberos"  

    The jaas.conf content is as follows.

      com.sun.security.jgss.krb5.accept {com.sun.security.auth.module.Krb5LoginModule Essential UsesTitk Cache = True Shopkey = True Keytab = "D: \ mykey.keytab" DoNotPrompt = true use kitab = true debug = true principal = "full_sufide_span"; };  

    But the http server is not asking the client to use Kerobors, but GET requests only provide services without any authentication.

    I hope that http.auth is specified for the Kerberos transmission plan and to specify all the necessary config files, this client should ask to authenticate.

    I also do not see any additional logs after enabling Desun.security.krb5.debug = true

    What is the HTTP server? Your server requires some SPNEGO authentication as configured otherwise it will not be prompt at all.


    c - Program exits after calling malloc -


    I have a simple program that allocates memory, and copies one file from that resource to that memory space , But the problem is programmable after calling the malloc function without any exceptions or errors I use VS2010 Express, I keep a breakpoint, and when I exit the program F10 (upwards) hit here The code is:

      int main NY) {Acarsarsi Arinfo; HGLOBAL rPointer; PVOD file indicator; Int fileSize; Unsigned char * buffer; RInfu = Search Resource (0, Mccentreras (101), RDRCDATA); If (rInfo == faucet) {return 0; } RPointer = LoadResource (NULL, rInfo); If (rpinder == faucet) {return 0; } FilePointer = LockResource (rPointer); If (filePointer == NULL) {return 0; } FileSize = SizeofResource (0, rInfo); If (fileSize == 0) {return 0; } Buffer = (unsigned char *) malloc (fileSize); // & lt; - Breakpoints here (buffer == tap) {message box A (0, "Error in allocating memory.", "My app", 0); } Other {Messbox A (0, "Allocated memory without errors.", "My app", 0); } Memcpy (buffer, stub pointer, stub size); }  

    I SizeofResource (0, rInfo); (1024 bytes, by using the debugger) has been verified by the size returned by I do not know whether you want and infos. Tell me


    Redmine Install, only seeing file and folders. Possible Apache config issue -



    Redmine Install, only seeing file and folders. Possible Apache config issue -

    so tried install redmine next official instructions here:

    http://www.redmine.org/projects/redmine/wiki/redmineinstall

    and managed run webrick (step 9). after (the machine using debian) used guide:

    http://www.redmine.org/projects/redmine/wiki/howto_install_redmine_210_on_debian_squeeze_with_apache_passenger

    to "serve up" redmine. after doing of see list of files , folders. here 000-default.conf has redmine configuration:

    <virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www/ errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined railsenv production railsbaseuri /redmine <directory /redmine> options followsymlinks order deny,allow passengerresolvesymlinksindocumentroot on allowoverride allow railsbaseuri /redmine options -multiviews </directory> </virtualhost>

    this latest config tried since have added every alternative come seek work. appreciate help on matter.

    change directory path:

    <directory "/redmine/public/">

    see farther info on redmine @ http://www.redmine.org/projects/redmine/wiki/howto_configure_apache_to_run_redmine

    apache redmine

    javascript - Auto refresh/load data only if new data inserted or updated -



    javascript - Auto refresh/load data only if new data inserted or updated -

    in case, create auto refresh after x seconds. want create refresh when new info inserted or updated.

    here script.

    refresh.php

    <script src="jquery-1.4.js"></script> <script> $(document).ready(function() { $("#responsecontainer").load("refreshnow.php"); var refreshid = setinterval(function() { $("#responsecontainer").load('refreshnow.php?randval='+ math.random()); }, 1000); }); </script> <div id="responsecontainer"></div>

    refreshnow.php

    <?php $query = mysqli_query($connection,"select * `table`"); $rows = mysqli_num_rows($query); ?> <table style="background:#f0f0f0;" border=1 style="border-collapse:collapse"> <tr> <th>name</th> <th>job</th> </tr> <tbody> <?php while($result = mysqli_fetch_array($query)){ echo "<tr>"; echo "<td>".$result["name"]."</td>"; echo "<td>".$result["job"]."</td>"; echo "</tr>"; } ?> </tbody>

    so, possible load new info automatically when new info inserted or updated without refresh after x seconds?

    if want utilize existing code, add together column in mysql table (if got config or settings table, easyer, if not advertisement timestamp each record insert) value time(), updates timestamp in database each time row inserted/modified. query like:

    "select timestamp_column `settings_table` order timestamp_column limimt 1" if ($result["timestamp_column"]+1000>=time()){ //do refreshnow.php code here }

    hope helps, cheers

    javascript php jquery html ajax

    parsing - MediaWiki parser function #if for undefined template parameter -



    parsing - MediaWiki parser function #if for undefined template parameter -

    i have mediawiki site semantic mediawiki extension installed. i'd test if string empty. do:

    {{#if: {{{transcript.lncrna}}} | yes | no}}

    apparently, {{{transcript.lncrna}}} empty, contains nothing. however, parser function #if tells me yes answer.

    what wrong?

    a variable beingness empty, , variable beingness defined are 2 different things, when comes mediawiki parser functions. in case {{{transcript.lncrna}}} isn't defined. mediawiki treat literally trying write out text “{{{transcript.lncrna}}}”, which, of course, create if statement homecoming true.

    to check if parameter empty, need add together empty default value, writing {{{transcript.lncrna|}}} (note horizontal bar):

    {{#if: {{{transcript.lncrna|}}} | yes | no}}

    here table different possibilities

    value of {{{param}}}: undefined | nil | whitespace | -------------------------------------------------------------------------------- {{#if: {{{param|}}} | yes | no}} | no | no | no | yes {{#if: {{{param}}} | yes | no}} | yes | no | no | yes

    parsing mediawiki

    javascript - How to pass data from EJS template to AngularJS controller -



    javascript - How to pass data from EJS template to AngularJS controller -

    i've got user info expressjs through nodejs following:

    app.js

    app.get('/user', function(req, res) { res.render('users', { title: 'foo', user: req.user }); });

    users.ejs

    <%= user %>

    i need user info user.ejs above angularjs controller, display on other named views.

    could help me it?

    some ng-init feels dirty , wrong me. can set inline , mess window , rootscope can messy. or can inline module like:

    <script> angular.module('preloadeddata', []) .constant('user', <%- user %>); </script>

    then available other dependency.

    javascript node.js angularjs express ejs

    django - Configure databases section in settings.py for Travis CI -



    django - Configure databases section in settings.py for Travis CI -

    i have locally running django 1.7 app tests, connecting mysql i configured travis ci repo

    question:

    i want have have separate database travis , different 1 utilize development.

    i tried adding separate settings in settings.py : default (for utilize tests) , development (for utilize in dev boxes); , thought .travis.xml utilize 'default' when ran migrate tasks.

    but travis ci errors out error : django.db.utils.operationalerror: (1045, "access denied user 'sajay'@'localhost' (using password: yes)")

    i have no thought why trying access development db settings? checked django1.7 docs, googled around no luck.

    appreciate help, thanks

    my settings.py database section looks below :

    databases = { 'default': { 'engine':'django.db.backends.mysql', 'name':'expenses_db', 'user':'root', 'password':'', 'host':'127.0.0.1', 'port':'3306', }, # 'development': { # 'engine':'django.db.backends.mysql', # 'name':'myapp_db', # 'user':'sajay', # 'password':'secret', # 'host':'127.0.0.1', # 'port':'3306', # }, }

    note : when 'development' section commented, travis ci build green

    my .travis.yml pasted below:

    language: python services: - mysql python: - "2.7" env: - django_version=1.7 db=mysql install: - pip install -r requirements.txt - pip install mysql-python before_script: - mysql -e 'create database if not exists myapp_db;' -uroot - mysql -e "grant privileges on *.* 'root'@'localhost';" -uroot - python manage.py migrate script: - python manage.py test

    the problem getting because haven't got right database name , settings travis ci. first need separate out settings between travis , project. utilize environment variable called build_on_travis (alternatively can utilize different settings file if prefer).

    settings.py:

    import os #use next live settings build on travis ci if os.getenv('build_on_travis', none): secret_key = "secretkeyforuseontravis" debug = false template_debug = true databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': 'travis_ci_db', 'user': 'travis', 'password': '', 'host': '127.0.0.1', } } else: #non-travis db configuration goes here

    then in .travis.yml file in before_script sections need utilize same database name in databases settings. have set environment variable in .travis.yml file so:

    env: global: - build_on_travis=true matrix: - django_version=1.7 db=mysql

    django travis-ci

    cq5 - Additive logback configuration for OSGi log configuration -



    cq5 - Additive logback configuration for OSGi log configuration -

    i installed bundle cq5.6.1

    <dependency> <groupid>org.apache.sling</groupid> <artifactid>org.apache.sling.commons.log</artifactid> <version>4.0.0</version> </dependency>

    it works good, have problem additivity flag.

    if add together apache sling logging logger configuration (org.apache.sling.commons.log.logmanager.factory) specific package, won't additive doesn't inherit configuration parent loggers.

    i'm using external logback.xml.

    <?xml version="1.0" encoding="utf-8"?> <configuration debug="true"> <jmxconfigurator/> <newrule pattern="*/configuration/osgi" actionclass="org.apache.sling.commons.log.logback.osgiaction"/> <newrule pattern="*/configuration/appender-ref-osgi" actionclass="org.apache.sling.commons.log.logback.osgiappenderrefaction"/> <osgi/> <appender name="syslog" class="net.logstash.logback.appender.logstashsocketappender"> <host>host</host> <port>port</port> </appender> <logger name="com.my.package" level="info"/> <root level="warn"> <appender-ref ref="syslog" /> </root> </configuration>

    i have osgi config:

    org.apache.sling.commons.log.file="logs/other.log" org.apache.sling.commons.log.level="debug" org.apache.sling.commons.log.file.size="'.'yyyy-mm-dd" org.apache.sling.commons.log.file.number=i"7" org.apache.sling.commons.log.pattern="{0,date,dd.mm.yyyy hh:mm:ss.sss} *{4}* [{2}] {3} {5}" org.apache.sling.commons.log.names="com.my.package.other"

    but logs com.my.package.other never goes syslog.

    if add together line logback.xml:

    <logger name="com.my.package.other" level="info"/>

    then on /system/console/slinglog can see logger com.my.package.other not additive.

    so how can utilize logs configured org.apache.sling.commons.log.logmanager.factory additive loggers?

    thanks in advance!

    "unfortunately cannot configured on osgi console (no field)."

    you cannot set hidden properties via felix console. can set using sling:osgiconfig nodes (http://sling.apache.org/site/jcr-installer-provider.html)

    cq5 logback sling

    node.js - How to deploy an application using Docker -



    node.js - How to deploy an application using Docker -

    i have node.js application depends on phantom.js. since both node , phantom.js not breeze set up, created docker container this. how deploy updates of application docker container running on our production server.

    for me, there 2 possibilities.

    set ssh , force git repository straight docker container add volume , update repository outside container

    i tend latter, i'm not sure there improve way.

    thanks in advance!

    both ways allow update application in existing container.

    however happens if delete container?

    in sec way can recreate brand new container linked same volume holds app in first way have connect ssh , upload app code

    moreover dockerfile more complicated in first case , more hard maintain. have take care of security issues , create sure whole world won't able connect ssh server.

    to sum up, create kiss , go volume way. consider adding ssh service if need more pushing files.

    node.js git deployment docker

    javascript - undefined is not a function in backbone -



    javascript - undefined is not a function in backbone -

    i using backbone , workflow.js extension set flow of application. have next backbone model

    var invoicemodel = backbone.model.extend({ workflow: { initial: 'draft', events: [ { name: 'issue', from: 'draft', to: 'issued' }, { name: 'payout', from: 'issued', to: 'paid' }, { name: 'cancel', from: 'draft', to: 'canceled' }, { name: 'cancel', from: 'issued', to: 'canceled' } ] }, initialize: function () { _.extend(this, new backbone.workflow(this, { attrname: 'status' })); } });

    i using above model below

    var invoicemodel = new invoicemodel(); console.log(invoicemodel.get('status')); invoicemodel.triggerevent('issue'); // uncaught typeerror: undefined not function

    somehow when utilize triggerevent() function returns undefined not function. why , how can prepare error?

    update

    here fiddle

    the method triggerevent() hides in prototype of workflow object.

    _.extend() copies object's own properties without properties prototype.

    your illustration work with:

    class="lang-js prettyprint-override">initialize: function () { _.extend(this, (new backbone.workflow(this, { attrname: 'status' })).__proto__, new backbone.workflow(this, { attrname: 'status' })); }

    as can see, explicitly added prototype extend chain.

    know it's inelegant solution. though didn't find improve 1 yet, hope explain problem.

    this works:

    class="lang-js prettyprint-override">var workflow = new backbone.workflow(this, { attrname: 'status' }); _.extend(this, workflow); $.extend(this, workflow);

    here underscore copies workflows own properties (model) , jquery deep-copies properties prototype.

    javascript jquery backbone.js workflow

    algorithm - Given k-coloring of graph's vertices calculate (k-1)-coloring -



    algorithm - Given k-coloring of graph's vertices calculate (k-1)-coloring -

    it's mutual knowledge coloring vertices of graph np-complete. it's known there efficient greedy algorithms can approximate solution. why not utilize these randomized greedy algorithms calculate coloring k colors , utilize slower algorithms cut down k?

    in situation know minimal number of colors sufficient color graph g - let's phone call k. i've managed implement sl algorithm gave me (k+2)-coloring. 1 color used color 1 vertex managed remove manually recoloring other nodes. therefore, have (k+1)-coloring , write algorithm cut down k (or rather k+1) 1.

    i've tried manually - found color used in minimal number of vertices colored same color , reduced color's uses 3. have recolor 3 nodes.

    one thought create 3 recursive calls - 1 each badly colored nodes. let's analyze recursive function have node v. have check every color apart v's color , 1 we'd remove. each color c should set v's color c , create recursive phone call each node neighbour of v , has color c. after checking colors should retrieve v's old color , set again. 1 more optimisation may not trying alter v's color 1 more x of neighbours has (as recursion tree deep) - little x may not able alter color @ all.

    another thought check nodes color can changed (not color want remove) wouldn't collide neighbours' colors. , create recursive calls alter other nodes' colors until 1 color want remove recolored.

    here's implementation of first algorithm intended work n < 90 doesn't seem end (500 minutes of execution):

    class="lang-cpp prettyprint-override">#include<stdio.h> #include<assert.h> #include<vector> using namespace std; vector<int> graph[99]; int hash[10009], color[99]; const int colors = 9, color_to_change = 7; void change_color(int v) { int tmp = color[v], count; for(int = 1; <= colors; ++i) { count = 0; for(int j = 0; j < graph[v].size(); ++j) count += color[graph[v][j]] == i; if(!count) { color[v] = i; return; } if(count < 4 && != color_to_change && != color[v]) { color[v] = i; for(int j = 0; j < graph[v].size(); ++j) if(color[graph[v][j]] == i) change_color(graph[v][j]); } } color[v] = tmp; } int main() { int n, m, a, b, max = 0, j = -1; scanf("%d%d", &n, &m); while(m--) { scanf("%d%d", &a, &b); assert(a != b); if(hash[a*100+b] || hash[b*100+a]) continue; assert(a*100+b < 10000 && b*100+a < 10000); hash[a*100+b] = hash[b*100+a] = 1; graph[a].push_back(b); graph[b].push_back(a); } for(int = 1; <= n; ++i) scanf("%d", &color[i]); for(int = 1; <= n; ++i) if(color[i] == color_to_change) change_color(i); for(int = 1; <= n; ++i) printf("%d ", color[i]); homecoming 0; }

    any ideas how create faster?

    i've looked @ code briefly, , read explaination, seems infinite loop switching , forth between neighbours. you'll need store flag in each node note it's beingness recoloured, , recurse neighbours not beingness recoloured.

    however - algorithm looks exponential in worst case - , i'm pretty sure there cases k coloured graph can not recoloured k-1 graph without changing big fraction of graphs, if number of nodes of colour k 1.

    here's illustration graph simple topology. clear can 2 coloured (r,g), , have 3 colour version using (r,g,b). way recolour correctly alter approximately 1/2 nodes colours, ending 1 of other versions below. () denotes single node of colour b, , [] denotes sections need recoloured.

    3 colour version : r-g-r-g-r-g-(b)-r-g-r-g-r-g-r 2 colour version 1: [r-g-r-g-r-g- r]-g-r-g-r-g-r-g 2 colour version 2: g-r-g-r-g-r-[g -r-g-r-g-r-g-r]

    this means minimum depth of (potentially exponential) search may more 1/2 number of nodes. may kill sensible performance times (or may not depending on topology of graphs guess.)

    algorithm optimization recursion np-complete graph-coloring

    Is Threadfence Needed for Cuda Volatile Variables? -



    Is Threadfence Needed for Cuda Volatile Variables? -

    volatile forcefulness each shared/global memory write/read goes straight shared/global memory. automatically accomplish threadfenced does? example:

    volatile __shared__ int s; s = 2; s = 10

    then no need of threadfence between "s = 2" , "s = 10"?

    can volatile variable, threadfence not needed? if not, example?

    for volatile variable in shared memory defined this:

    volatile __shared__ int s;

    any access other threads in threadblock after execution of next line:

    s = 2;

    will see s containing 2, assuming there no farther updates s. volatile not cause sort of barrier. __threadfence() and derivatives execution barriers. thread in question not proceed beyond barrier until guaranteed updates shared memory and global memory (for __threadfence()) visible other threads.

    however, next sequence:

    s = 2; s = 10;

    there no guarantee other threads see (except in warp synchronous case, , subject farther scenario description have not provided), except see either 2 or 10 (and again, assuming there no farther updates s).

    cuda

    android - ActivitySceneTransitionBasicSample setViewName -



    android - ActivitySceneTransitionBasicSample setViewName -

    has compiled activityscenetransitionbasicsample project, error"cannot find symbol method setviewname(string)",i can't find method.

    setviewname method removed time l-preview , api 21 released. looks activityscenetransitionbasicsample setup l-preview, using api 21.

    check link see alter log showing method removed: https://developer.android.com/sdk/api_diff/preview-21/changes/android.view.view.html

    android

    Java Event Generation -



    Java Event Generation -

    i want design scheme generate specific event @ constant rate , go on doing in background. in foreground give output of other events if want. background event not stop. best way accomplish in java?

    this definition of threading , needs come level of understanding.

    on simplest level, create thread sleeps amount of time executes code. there lots of other ways it, few shorter overriding run method of thread.

    if want more abstract, through concurrent bundle in java docs, there many methods want, , java.util.timer 1 @ well.

    be aware of variables , collections might accessed different threads @ same time. aware if have gui shuold not update gui new thread.

    edit add together non-thread solution

    (i don't think want, in comments asked non-threaded solution).

    if wish without threads (meaning wish in current thread) have "interrupt" current thread check see if other task needs process. first need method this:

    long lastrun=system.currenttimeinmillis(); final long howoftentorun=60*1000 // every min testforbackgroundtask() { if(lastrun + howoftentorun < system.currenttimeinmillis()) { // drift, if don't want drift utilize lastrun+=howoftentorun lastrun=system.currenttimeinmillis() // occasional task is. // task in-line here of course of study violate srp runbackgroundtask() } }

    after that, need sprinkle testforbackgroundtask throughout code:

    lotsofstuff.... testforbackgroundtask() longmethod() testforbackgroundtask() morestuff... testforbackgroundtask() ...

    note if longmethod() takes long time need set calls testforbackgroundtask() within well.

    i know ugly, , uglyness of solution why threads used. advantage absolutely prevent threading conflicts.

    the other single threaded solution--making code event driven--is harder , impacts code (there build called finite state engine made purpose).

    java

    Matlab: How to build array with strings at specific index -



    Matlab: How to build array with strings at specific index -

    i have cell array of strings (length = 4): a = {'a', 'b', 'c', 'd'} have double matrix of indices (length = 4): b = [2, 4, 6, 8]

    how can create new cell array c (of strings) of length = 8, uses indices in b place strings a new array c. index not specified in b, want come in ' ' space (empty string). note: real info not go "every-other".

    c = {' ', 'a', ' ', 'b', ' ', 'c', ' ', 'd'}

    how can done in matlab?

    one possible approach:

    c = repmat({' '}, 1, max(b)); %// predefine ' '; c(b) = a; %// replace actual values

    or:

    c(b) = a; %// automatically fills missing values [] ind = cellfun('isempty', c); %// find occurrences of [] c(ind) = repmat({' '}, 1, sum(ind)); %// replace them ' '

    the lastly line simplified follows (no repmat needed), noted @parags.chandakkar:

    c(ind) = {' '}; %// replace them ' '

    arrays matlab

    php - JSON - Importing Data Using FileGetContents not showing? -



    php - JSON - Importing Data Using FileGetContents not showing? -

    i've been writing little script monthly views user. when i've got access token of user , var_dump file_get_contents($url) correct-json, looks this.

    $views = file_get_contents('https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3d%3dmine&start-date=2014-09-29&end-date=2014-10-29&metrics=views&access_token='.$responseobj->access_token); var_dump($views);

    the result being:

    { "kind": "youtubeanalytics#resulttable", "columnheaders": [ { "name": string, "datatype": string, "columntype": string }, ], "rows": [ [ 2204 ] ] }

    i'm unsure how utilize json import number "2204" , echo out. i'm trying:

    $monthlyviews = $views['rows'][0]; var_dump($monthlyviews)

    but isn't working , i'm not sure why. i'm getting nil responded except error saying:

    fatal error: cannot utilize string offset array in /home/a1059253/public_html/oauth/callback.php on line 39

    first, need parse json object:

    $json = json_decode($views);

    php parses json object, not array, code should this:

    $monthlyviews = $json->rows[0][0]; echo $monthlyviews;

    php json youtube-api

    gwt - How to use javascript to store variables to window correctly? -



    gwt - How to use javascript to store variables to window correctly? -

    i trying utilize jsni (gwt's javacript interface) set/get variable to/from js object:window this:

    private final native <t> t get(string key)/*-{ homecoming $wnd.key; }-*/; private final native void set(string key, object value)/*-{ $wnd.key = value; }-*/;

    ///// js equivalent should this

    function get(string key){ homecoming window.key; } function set(string key, var value){ window.key = value; }

    and if set variable: var_1 window:

    var var_1={"id":"id_1","name":"name_1"} set("key_1",var_1)

    then

    get("key_1")

    i var_1 correctly

    and set variable var_2 window

    var var_2={"id":"id_2","name":"name_2"} set("key_2",var_2)

    then,try key_1 again

    get("key_1")

    unexpectedly,var_2 returned

    so,the problem obvious:the get() function homecoming lastly set variable no matter key is.questions are:

    1,why? 2,how create right?

    after changing to

    private final native <t> t get(string key)/*-{ homecoming $wnd[key]; }-*/; private final native void set(string key, object value)/*-{ $wnd[key] = value; }-*/;

    both set , work expected now.

    javascript gwt

    c# - Is there a Linq method to 'extend' collection? -



    c# - Is there a Linq method to 'extend' collection? -

    i wonder if there linq method enumerate on collection after current one? if not, why not?

    to highlight mean, imagine had:

    list<int> = new list<int> { 1, 2, 3 }; int[] b = { 1, 5, 6 };

    then asking if there linq method such a.myhypotheticalextensionmethod(b) produce ienumerable containing: {1,2,3,1,5,6}

    of course, trivial roll one's own (or work around) definately seems ought included in linq?

    you're looking a.concat(b).

    c# linq

    c# - IOException: The process cannot access the file 'file path' because it is being used by another process -



    c# - IOException: The process cannot access the file 'file path' because it is being used by another process -

    i have code , when executes, throws ioexception, saying

    process cannot access file 'filename' because beingness used process

    what mean, , can it?

    of course of study not real question; found many questions here on related error general guidance (like 1 nullreferenceexception , indexoutofrangeexception) may useful.

    answer community wiki sense free edit , improve more mutual scenarios , suggestions.

    what cause?

    error message pretty clear: you're trying access file , it's not accessible because process (or same process) doing (and didn't allow sharing).

    debugging

    it may pretty easy solve (or pretty hard understand), depending on specific scenario. let's see some.

    your process 1 access file you're sure other process own process. if know open file in part of programme first of have check close file handle after each use. here illustration of code bug:

    var stream = new filestream(path, fileaccess.read); var reader = new streamreader(stream); // read info file, when i'm done don't need more file.delete(path); // ioexception: file in utilize

    fortunately filestream implements idisposable it's easy wrap code within using statement:

    using (var stream = file.open("myfile.txt", filemode.open)) { // utilize stream } // here stream not accessible , has been closed (also if // exception thrown , stack unrolled

    this pattern ensure file won't left open in case of exceptions (it may reason file in use: went wrong , no 1 closed it, see this post example).

    if seems fine (you're sure close every file open, in case of exceptions) , have multiple working threads have 2 options: rework code serialize file access (not doable , not wanted) or apply retry pattern. it's pretty mutual pattern i/o operations: seek , in case of error wait , seek 1 time again (did inquire why, example, windows shell takes time inform file in utilize , cannot deleted?). in c# it's pretty easy implement (see improve examples disk i/o, networking , database access).

    private const int numberofretries = 3; private const int delayonretry = 1000; (int i=1; <= numberofretries; ++i) { seek { // stuff file break; // when done can break loop } grab (ioexception e) { // may check error code filter exceptions, not every error // can recovered. if (i == numberofretries) // lastly one, (re)throw exception , exit throw; thread.sleep(delayonretry); } }

    please note mutual error can see on stackoverflow:

    var stream = file.open(path, fileopen.read); var content = file.readalltext(path);

    in case readalltext() fail because file in utilize (file.open() in line before). open file before them not unnecessary wrong. same applies file functions doesn't homecoming handle file you're working with: file.readalltext(), file.writealltext(), file.readalllines(), file.writealllines() , others (like file.appendallxyz() functions) open , close file themselves.

    your process not 1 access file if process not 1 access file interaction can harder. retry pattern help (if file shouldn't open else need utility process explorer check who doing what).

    ways avoid

    when applicable utilize using statement open files. said in previous paragraph it'll actively help avoid many mutual errors (see this post illustration how don't utilize it).

    if possible seek decide owns access specific file , centralize access through few well-known methods. if, example, have info file programme read , write should box i/o code within single class. it'll create debug easier (because can set breakpoint there , see doing what) , it'll synchronization point (if required) multiple access.

    don't forget i/o operations can fail, mutual illustration this:

    if (file.exists(path)) file.delete(path);

    if someone delete file after file.exists() before file.delete() it'll throw ioexception in place may wrongly sense safe.

    whenever it's possible apply retry pattern , if you're using filesystemwatcher consider postpone action (because you'll notified application may still working exclusively file).

    advanced scenarios it's not easy may need share access else. if, example, you're reading origin , writing end have @ to the lowest degree 2 options.

    1) share same filestream proper synchronization functions (because it not thread-safe). see this , this posts example.

    2) utilize fileshare enumeration instruct os allow other processes (or other parts of own process) access same file concurrently.

    using (var stream = file.open(path, filemode.open, fileaccess.write, fileshare.read)) { }

    in illustration shown how open file writing , share reading, please note when read , write overlaps result undefined , info may invalid. it's situation must handled when reading. note doesn't create access stream thread safe object can't shared multiple threads unless access synchronized somehow (see previous links). other sharing options available , open more complex scenarios please refer msdn details.

    in general n processes can read same file 1 should write, in controlled scenario may enable concurrent writings can't generalized in few text paragraphs within answer.

    is possible unlock file used process? it's not safe , not easy yes, it's possible.

    c# .net language-agnostic ioexception