Sunday, 15 January 2012

How are properties defined in a class diagram when using UML? -


Development has not started when I'm trying to wrap my head about the construction of a class diagram. My understanding is that you put the UML diagram together before any development. I have come to an article.

If I look under the title 'Square' then I get details about the properties of a class eg.

  • I think that when it is referred to public and private, it means that in the case of the former, the property is accessible by any other object and whenever it is private, it is limited to the user class. Is it true?
  • Why there is no discriminating between the salt, and so on. Login Logout?
  • Do class diagrams come only after use case and activity diagram? 1 and 2: Think about your functional context, make a software, say, make a library Will happen? You will probably manipulate the books, so you will have a "book" in UML. And you will need to know the book and author's title and author. So naturally, using UML, you will create a UML class named Utility Title and Book with Author. And you do not need to know that it will actually be in accordance with the actual class of a real deity.

    3: That's right.

    4: There are properties above the divider, below the operation (i.e.)

    5: There is no unique answer to this question. It depends on your project method. UML does not tell you which diagram you use, T only gives you the tools. Personally, I want to start with the use cases, that I think basic, and then to clarify clearly, with only the first classes and very important characteristics (no operation, no visibility) I want to create the first first general class diagram, a global view of the data included. Then I will use the activity diagram, the detailed class diagram and sequence diagrams, and Do Istarit. But how I want to work, is not a general requirement.

  • c# - How to continuously monitor a group of threads then perform some action after they have ended? -


    How can I continually monitor a group of threads and can take some action after it ends.

    My code is as follows:

      int threadcount = 5; For (Int i = 0; I   

    In the above case, 5 threads (_azgetThread) have been created and I would like to monitor them and when they will know.

    I'm familiar with _azgetThread. I IsAlive but there are many examples in this case.

    Using a good option here can each thread complete the event, and the main thread only Check to see if the event is set or call it.

    You always have the same mechanism ( IsAlive ), but instead of using one variable for your thread or for all 5 thread instead of list & lt ; Thread & gt; will need to be stored.

    It is being said, I suggest using TPL instead of individual threads. Depending on your work, you can use parallel.for or parallel.forh to run all 5 objects, or use PLINQ in a collection of items Can also do If you want to keep the same logic, you can use the Task.Factory.StartNew and schedule the task that will notify you at the completion of 5 initial tasks.

    knockout.js - Knockout Templates with Wijmo -


    I'm trying to dynamically add a tab to a Vizzo tab with a knockout, but after compelling I get an exception addSingleExecution: (execution) - & gt; TABNAME = "#tabs - # {@ tabCounter}" tab = $ (@ targetDomElement) .wijtabs (tabTemplate: '

  • & lt; a href = "# {href}" & gt; # {label } & Lt; / a & gt; & lt; span class = "ui-icon ui-icon-pass" & gt; Remove tab & lt; / span & gt; & lt; / li & gt; 'Add: ( Event, UI) - & gt; $ (ui.panel) .append ('& lt; div data-dam = "template: {name: singleExecutionTemplate}",'.) ('/ & Gt') $ (ui .tab) .siblings ('span.ui-icon-click-close', null, self (event) -> index = $ ('li', tab). Index ($ (this) .parent ()) Tab.wijtabs ('add', moment of TABNAME (execution.date ()). Format ('DD MMM YYYY')) ko.applyBindings (execution, $ [TABNAME] [0]) @ tabCounter ++

    More obvious exceptions I have a line of knockout 2.2.1 debug at 3008:

      Uncaught TypeError : An array of dom node null property can not be read 'length' // is loosely checking the result if ((typeof renderedNodesArray.length = "number") || (renderedNodesArray.length & gt;! 0 & amp; & Amp;! Typeof renderedNodesArray [0] .nodeType = "number")) Uncaught TypeErr or: Throwing property can not be read 'length' of the new error ("template engine should return an array of dom nodes");   

    This is my template

      & lt; Script type = "text / html" id = "singleExecutionTemplate" & gt; & Lt; Div & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; H1 & gt; Step 1 & lt; / H1> Set input data & lt; / Li & gt; & Lt; Li & gt; & Lt; H1 & gt; Step 2 & lt; / H1> This is the second step & lt; / Li & gt; & Lt; Li & gt; & Lt; H1 & gt; Step 3 & lt; / H1> Analyze results and records & lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div & gt; Setup & lt; / Div & gt; & Lt; Div & gt; Run & lt; / Div & gt; & Lt; Div & gt; Analyze & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Script & gt;   

    Why is it not rendered correctly?

    I took part in this, I was switching to ASP.Net MVC using the razor template Was there. The difference in the markup was subtle and without the answer given by Edmondo 1984, I never caught my mistake.

    Yes, this would be a string asset with a razor, I had to change my form:

        

    Hope this helps.

  • android - ImageView with setBackgroundResource and setImageBitmap -


    I have an image view that I'm making it dynamic, now I

      set imageView I am doing SetImageBitmap (bitmap); ImageView.setBackgroundResource (R.drawable.a);   

    setBackgroundResource is dragging the image, because bitmap size increases.

    Why is that so? Is there any remedy?

    A background resource is designed to fill the entire scene, which is why the content of the scene Has increased in size.

    A possible solution would be to use 9-patch drawables, which is only assigned by you.

    Alternatively, your background needs to be scaled to normal view content increase, and reset it to a new background.

    jquery - how to display images in a javascript Array -


    I'm trying to display images in an array on the page but I'm facing difficulties

    That JS

      var movieArray = [{title: "artist", image: "http://cmclove.org/img/sw_off_off.png"}, {title: "one Better life ", picture:" Http://cmclove.org/img/sw_off_off.png "}, {title:" abduction ", image:" http://cmclove.org/img/sw_off_off.png "}, { Title: "African cat", Image: "http://cmclove.org/img/sw_off_off.png"}, {title: "Angel Crest", Picture: "http://cmclove.org/img/sw_off_off.png "}, {Title:" R Stather ", picture:" http://cmclove.org/img/sw_off_off.png "}, {title:" Anonymous ", diagram:" http://cmclove.org/img/sw_off_off.png "}, {title : "A Dangerous Method", Image: "http://cmclove.org/img/sw_off_off.png"},]; For (var p in film array) {console.log (p + ':' + movie around [p] .title + '|' + movie around [p].); }   

    There is a link to Bella

    You are not inserting anything into the page.

    A solution would be:

     for  (var p = 0; p & lt; movieArray.length; p ++) {$ ('Body'). Endend ('& lt; img src =' '+ movieArre [P]. Picture +' 'title = "' + movieArtre [P] .title + '" "& gt;'); }   

    Demo:

    c++ - 'SDL_main' : must return a value -


    I am trying to retrieve the contents of the websice in the ccess ++ usin SDL but this is giving me this error Is:

    'SDL_main': a value must be returned

    My code is:

      #include & lt ; Iostream & gt; #include "SDL.h" #include "SDL_net.h" #includes & lt; Cstring & gt; Int main (int argc, char ** argv) {SDL_Init (SDL_INIT_EVERYTHING); SDLNet_Init (); IP Address IP; SDLNet_ResolveHost (& amp; IP, "www.linux.org", 80); Const char * http = "GET / HTTP / 1.1 \ n Host: www.linux.org \ n \ n"; TCPsocket client = SDLNet_TCP_Open (& amp; ip); SDLNet_TCP_Send (customer, http, strlen (http) +1); Four lessons [10000]; While (SDLNet_TCP_Recv (Client, Text, 10000)) std :: cout & lt; & Lt; Text; SDLNet_TCP_Close (Customer); SDLNet_Quit (); SDL_Quit (); }   

    When I put back 0; Lastly, this project was created but it ended immediately afterwards (I'm using vs. 2012)

    UPDATE

      Cout   

    Does not print anything, is it possible that I have configured my import incorrectly? Are they additional dependencies right?

    SDL.lib; SDL_net.lib; SDLmain.lib

    I do not know what else could be wrong ...

    This is because SDL defines a macro like this:

      #define main SDL_main   

    then the function that you write In fact, it is called SDL_main and like any other function that is not the actual main function, if it does not happen, return t zero , Give it a return statement Will.

    php - Paypal standard buttons not returning transaction variables -


    I am using the PayPal standard button in the sandbox environment, but it is spoiling me, I return the custom variable Setting up with RM2, Paypal should return to the return URL, with the $ _POST array populated with transaction information, what happens is that it returns to my return URL, but a blank With $ _POST !! Is it really crazy about me that sometimes with a populated $ _POST array, it comes back for the same scenario !!! Why is this happening? Please thank me in advance asap your help.

    Is Auto and PDT active in your account? If you have PDT enabled, turn it off Do you try to test even with auto return disabled in your account? Try both of these, and see if the data has returned.

    c# - String manipulation of Serial Port data -


    I am working on creating a windows form application and I have a problem. I am reading data from a serial port.

      string RxString = serialPort1. ReadExisting ();   

    It works fine, but now what I want to do is remove the value from my RxString and puts them in my string array.

    This RxString format:

      GPS: 050.1347, N, 00007.3612, WMAG: +231 \ r \ n   

    More data Is added because it repeats itself, the number varies from the serial port but remains the same length, and changes in + -. I want to place the numbers between the GPS: and, the number between a string array, n in n, and, in the second string array, and finally the number between + and \ r \ n in another string array .

    How would I go about doing this?

    OK, Regex Solution:

      String Pattern = @ " ^ GPS: (? Lt; gps>; {8}), n, (? & Lt; n & gt;., {10}), wmag: (\ + | \ -) ​​(? & Amp; LT; wmag>. {3}) \\ r \\ $ n "; String gps = string Empty; String n = string Empty; String wmag = string.Empty; String input = @ "GPS: 050.1347, n, 00007.3612, WMAG: +231 \ r \ n"; Reggae Reggae = new Reggae (Pattern); If (regex.ismatch (input)) match {match = regex.match (input); External Capture Capture Group ("GPS" in Capture. Capture) GPS = Capture. Value; Capture Capture Capture in Group (Group "[" "N"]) Capture N = Capture. Value; Capture Capture Capture in Group ("wmag"]. Capture) wmag = capture.Value; } Console. Type ("GPS:"); Console.WriteLine (GPS); Console Type ("N:"); Console.WriteLine (N); Console Write ("WMAG:"); Console.WriteLine (wmag); Console.ReadLine ();    

    php - No POST parameters when upload file -


    I am creating an upload file form, but a very weird bug appears ... when I upload the file, Symphony does not see. Post Standards

    My Form Class:

      Class UploadDocumentForm Extends {AbstractType {Public Function buildForm (FormBuilderInterface $ Builder, Array $ option) $ builder- & gt; Add ('name', 'text', array ('label' => gt; 'name')); $ Manufacturer- & gt; Add ('file', 'file', array ('label' = & gt; 'fichier')); } Public function getName () {return 'upload_document_form'; }}   

    My templates:

      & lt; Form action = "{{path ('upload_file')}}" enctype = "multiparty / form data" method = "post" & gt; {{Form_widget (upload_file_form)}} & lt; Input type = "submit" value = "environment le earther" /> & Lt; / Form & gt;   

    My Controller Action Method:

      Public Function uploadAction (request $ request) {$ form = $ this- & gt; CreateForm (new UploadDocumentForm (), new document ()); $ Form & gt; Tie ($ request); If ($ form-> isValid ()) {[...]} [...]}   

    My request (debug with firebug): < Pre> upload_document_form [name] blablabla upload_document_form [file] ID3��½ ¿½TRCK��½3/12TIT2 [...] upload_document_form [_token] bb5f9925002dafbab [.. .]

    My request in the Symphony debug toolbar:

    Request Post Parameter

    No Post Standards

    If I do one:

      dead (var_dump ($ request-> get ($ form-> getName ())));   

    $ request return null

    I have configured php.ini of my /etc/php5/apache/php.ini:

    upload_max_filesize = 100M

    max_file_uploads = 28

    So, naturally, my form is not valid. The most odd is that if I upload a small file (under ~ 4mo), the post data is here, and all the work is fine!

    out of memory - Stopping Couchbase Elasticsearch XDCR OutOfMemory Error -


    I am running a proof of concept on VM with 4 GB Ram. I have around 2 million docs in Couchbase and they all want to use the XCDR plugin in LCLSec, although Couchbase ES is very difficult and falls on ES. I have not had enough room to increase the memory before the 1 GB default, is there a way to slow down the S room to give breath?

    Edit:

    I should add some history here. I used to do this work, EE Couchbase was indexing documents very quickly, but then I ran away from disk space on my VM. I've added a new disc and changed the path.data property in elasticsearch.yml. After this I could not start ES using the given init.d script in IBS. It says that the e-start is OK, but then if I run the /etc/init.d/elasticsearch status then it says "elastic service server is not running but pid file exists". I just installed it again just for hell but nothing was done. How can I know about the failure to run the Init script? I can start ES completely again manually and if the Couchbase is all running then everything is cool. I'm not sure that it Is relevant, but at some point I need to do the same.

    Do you have a small number in elasticsearch.yml couchbase.maxConcurrentRequests: 1024 Can you try to modify? Maybe it can set up to 256?

    mysql - SQL vs XML for data transfer -


    I am new to the web of web services and web API. I have noticed that most companies provide XML or JSN based connections, Who basically collects data from their database and encodes them in the format of choice. My question is why do not I offer anyone a SQL connection?

    At first I thought this was security. But with MySQL you can restrict users to all methods of a specific column. You can only allow them to view or just insert. You can create ideas and stored procedures to join or veil in your true backend structure. You can use SSL connections to correctly encode the transmitted data. So in fact I think that the only difference is the style I think people must write to me

      $ conn- & gt; GetWidgetAttr ('WidgetName'); Instead of   

      select widget name from the widget; Can anyone tell me what am I missing?  

    1. Configuration complexity It is difficult to configure permissions for all users for all possible use cases.
    2. Opening a security database connection and query is not secure, and offers a wider possibility of SQL injection / exploitation attacks.
    3. Hiding the details of the implementation of stored items in the Contract Stability Database allows you to change the underlying storage without breaking the existing client. For example, at one point you can decide to change the server with sql mongodb.
    4. Firewall Problems HTTP connections are widely available, with port 80 Web API open for most functions, while exposing the SQL Server port (default 1433) additional costs can be deployed.

    php - OOPHP MySQLi Parameterized Query not working? -


    I am trying to create this work for a few days. I want to develop my knowledge about PHP and database security and looking to use OOPH and Powered Queries. I thought I would just start by connecting to the database and selecting and displaying the results. I know that paramerized queries work on themselves, but when I put it in a class and call it, it will not get results and will not display them. This is my code I'm working on:

      & lt ;? Php class connect {public static function run () {$ mysqli = new mysqli ("*****", "*****", "*****"); $ Db = "sale"; Mysqli_select_db ($ Database); If (! $ Mysqli) {printf ("Connection failed:% s \ n", mysqli_connect_error ()); } Else {echo ("Maria DB Connection Successful !!!"); }}} // call_user_func (array ($ classname, 'run')); Class contacts {Select Public Function () (if ($ stmt = $ mysqli- & gt; Prepare ("Select consensus_ID, Con_fanny, contact with Kondi_LMM, Conmark")) Execute {$ stmt- & gt;; $ Stmt- & gt; bind_result ($ id, $ fname, $ lname, $ email); echo ("& lt; table alignment = 'center' width = '40% '"); echo ("& lt; tr & gt; ;); Echo ("& lt; td align = 'center' width = '25% '& gt; contact id & lt; / td & gt;"); echo (" fetch Echo ("& lt; tr & gt;"); echo ("& lt; TD alignment = 'center' width = '25% '& gt;"); printf ("% s", $ this- & Echo ("& lt; TD alignment = 'center' width = '25% '& gt;"); printf ("% s" , $ This-> $ fname); echo (""); Echo ("& lt; td alignment = 'center' width = '25% '& gt;"); Printf ("% s", $ this- & gt; $ lname); Echo ("& lt; / td>"); Echo ("& lt; td alignment = 'center' width = '25% '& gt;"); Printf ("% s", $ this- & gt; $ email); Echo ("& lt; / td>"); Echo ("& lt; / tr & gt;"); } Printf ("& lt; / table & gt;"); $ Stmt- & gt; near (); } Other {printf ("Ready statement error:% s \ n", $ mysqli-> Error ()); }} Connect = "connect"; $ Connect :: runs (); $ Contact = "Contact"; $ Contact select: (); ? & Gt;   

    When I run the page, only the output I get is "Maria DB connection successful !!!", but this class does not seem to run in selection () within "Contacts" it happens . I want to learn better ways of coding with PHP, so if there is a better way, I would love to learn it!

    I would be very grateful for any help that anyone can give.

    There are two major problems with your code

    1. You are using mysqli instead, making your goal ten times harder.
    2. You are trying to get everyone together. There is no way to know that you have to open the API Try to get acquainted with it, just run a few questions using plain text code. Then combine these codes into the work and then start for the class.

    java - ArrayAdapter - how do I stop getView calls? -


    How do I stop the getView call, unless I change the dataset and do not call?

    My problem:

    I have a textfield that filters the adapter on textAvents if I change the text multiple times, then I get anAntxOutOfBoode exception because getView is still the adapter's Accessing the list, while the second time the filtering operation is already running.

    Then the ATM goes like this:

    1. Filter in the background + Notify the data set
    2. Many times called GetView < / Li>
    3. While the next filter is being processed, due to the first filter, GetView is still being called in the background but due to list access, GetView gets an exception (filtering operation changes list). So I want to stop GetView calls and then start any filter operation.

      Edit:

      If I think the filter thread is active?

      Edit:

      Correctly relevant adapter code:

        @ Override protected filterReturning filtering (Charsimension barrier) {filterLock.acquireUninterruptibly (); FilterResults r = New FilterResults (); & Lt; T & gt; Item = null; M_Filter = Handicap; If (obstruction == faucet / * textualis empty (interrupt) * /) {// ar // asymmetric / da // unexpected nctity item = M_allimes; } And {items = m_FilteredItems; Items.clear (); Synchronize (sync) {for (t item: m_AllItems) {if (DynamicArrayAdapter.this.filter (item, constraint)) {items.add (item); }}}} R.values ​​= items; Arconton = Itemsize (); Return r; } @SuppressWarnings ("uncheck") @ Override protected zero published (squared barrier, filter result result) {m_Items = (list & lt; T & gt;) results.values; NotifyDataSetChanged (); FilterLock.release (); }   

      This is the filter that spreads by filter. M_Items and m_AllItems are used in adapters (first filtered, second unfiltered). As you can see that they have not been modified for the filtering (), the filter lock is a size 1 semaphore, so 2 filters are being handled at the same time.

      EDIT2:

      Also, in my on-test switch I can assure you that I do not modify the adapter either in any way, In the method which is called "PerformFiltering ()

      Changing the adapter not replaced by the UDI thread is your problem If you modify all your adapter UI threads then this will not happen because this is happening after the second.

      You can make heavy processing at a different thread but when you change the adapter that you have to do it on the UI thread using a handler or for example:

       < Code> // Really heavy filtering process RunOnYuththread (new Runnabal () (run from public zero) {// Change the contents of adapters // Now we are informing that the data has changed MAdapter.notifyDataSetChanged ();} });   

      After viewing your code: As LucasProog says, you should not change the list directly from the second thread, but the copy of the list should be used. What happens is that listView accepts a list with the size of X but you have already changed it to the size of the Wi and ListView did not know about it, to work on a copy of your item list After you have done, and after you do, post the UI thread on a Runnable that change the list of items in the adapter and call NotifyDataSetChanged () , this It was in that you list and you have to adapter With will not struggle.

    jquery - How to create a .cfc file using Ajax? -


    I am trying to create a ColdFusion component (.cfc) file and use Ajax to pass my query I do Am I doing it correctly and can I use Ajax in CxX 7?

    Added to the comment of OP

    I have updated it once again and as I mentioned above my Button click works and my components work, but the call to the component does not do anything. Can anyone see what the problem might be, can see it another time. I think I am very close to this, how can I get back the value back?

    Added to OP comment

    I updated code, but, I still can not find anything Anyone can please me, please help me understand that what am I missing?

    The following is in the form.cfm:

      & lt; Script src = "/ /ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script language = "javascript" type = "text / javascript" & gt; Click (function ($ {$ .aJX {{type: "get", url: "awardTotals.cfc? Method = searchAward", data: {total: $ ("val (), codeNum: $ (" codeNum "Val", "selJuris: $ (" selJuris ") .value}, success: work (data) {Values}: $ (" test year ") Val, selType: $ (" selType "). If (hatotles == true) {warnings ('a match is');} and {warnings (' this is not a match)}}}});})}}   

    My reward is total cfc.

       cfunction name = "searchAward" access = "remote" returntype = "any">       

    You are passing in a grandolate and your method is looking for awards. You are returning empty string and looking for boolean. Try it:

      FunctionAdvancedFunding (AwardTotals) {$ .ajax ({url: 'awardTotals.cfc', data: {Method: 'SearchAwards', AwardTotals: NumberTop}, Success: Work ( Data) {if (isTotals == true) {Warning ('is a match');} else {warning ('this is not a match;)}}}}); }   

    then

      & lt; Cfcomponent & gt; & Lt; Cffunction name = "myfunction" access = "public" returntype = "query" & gt; & Lt; Cfargument name = "awardTotals" type = "string" required = "true" & gt; & Lt; Cfset var searchAward = queryNew () & gt; & Lt; Cfquery name = "searchAward" data source = "test" & gt; Please select G. Code 1 + G Code 2 + G Code 3+ Code 4 AS Grandetral FRR Code GJ WHERE G. Coding = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.coding # #" & gt; And G. TestYear = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#forms.act year #" & gt; And g Cell type = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.selete type #" & gt; And g Jurisdiction = & lt; Cfqueryparam cfsqltype = "cf_sql_varchar" value = "#forms .seeljuris #" & gt; & Lt; / Cfquery & gt; & Lt; Cfscript & gt; If (arguments.awardTotals eq searchAward.grandTotal) {return true; } Other {return false; } & Lt; / Cffunction & gt; & Lt; / Cfcomponent & gt;   

    And @ Billy Craven is correct, you can not use cfajaxproxy, but jquery ajax will work.

    javascript - retrieve value of input -


    मेरे पास यह है:

      & lt;? Php $ i = 0;? & Gt; & Lt;? Php foreach ($ x $ y):? & Gt; & Lt; इनपुट प्रकार = "छिपी" id = "theid & lt;? Php echo $ i?; & Gt;" मान = "& lt;? Php $ कुछ वैरिएबल;; & gt;" & gt; & Lt;? Php $ i = $ i + 1; ? & Gt; & Lt;? Php endforeach; ? & Gt;   

    मुझे इस तरह प्रत्येक "theid" का मान प्राप्त करने की आवश्यकता है:

      & lt; script type = "text / javascript" & gt; फ़ंक्शन एफंक्शन (एलीमेंट, ऑप्शनटिटल) {var num = document.getElementById ('theid')। मान; ... & lt; / स्क्रिप्ट & gt;   

    मैं इस तथ्य पर विचार कर सकता हूं कि "theid" में $ I जोड़ा गया है? धन्यवाद।

    यदि आपके पास एकाधिक इनपुट फ़ील्ड हैं और आप कई पर एक ही कार्रवाई करना चाहते हैं, तो आप getElementById के बजाय getElementsByClassName का उपयोग करें:

      & lt; input type = "hidden" class = "theclassname "Id =" theid & lt;? Php echo $ i?? & Gt; " मान = "& lt;? Php $ कुछ वैरिएबल;; & gt;" & gt;   

    जेएस:

      & lt; स्क्रिप्ट प्रकार = "टेक्स्ट / जावास्क्रिप्ट" & gt; फ़ंक्शन किसी क्रिया (तत्व, optionTitle) {var myEles = document.getElementsByClassName ('theclassname'); // आईओल पर लूप और हर एक पर कार्य (var i = 0; i & lt; myEles.length; i ++) {चेतावनी ("आईडी के साथ इनपुट:" + myEles [i] .ID + "का मान है:" + myEles [मैं कद्र करता हूं); }} & Lt; / script & gt;    

    How can I get oauth token and oauth token secret using the ruby omniauth-twitter gem? -


    I set up my app as a tutorial - If you can not access it, then my code

    Omniauth control callback

      def all users = User.from_omniauth (request.env ["omniauth.auth"]) If user.persisted? Flash.notice = "Sign In!" Sign_in_and_redirect user and session ["devise.user_attributes"] = user.attributes redirect_to new_user_registration_url end-end alias_method: twitter, all end   

    user model

      def Where is self.from_omniauth (auth) (auth.slice (: provider,: uid)). First_or_create do User | User.provider = auth.provider user.uid = auth.uid user.username = auth.info.nickname user.name = auth.info.name end-end self.new_with_session (parameters, session) if session ["devise.user_attributes" ] New (session ["devise.user_attributes"], without protection: true) user | User.attributes = params user.valid?  

    Thanks

    If you want to take a look at the information returned by a specific provider, then keep it as the first line of your callback controller:

      raise env ["omniauth.auth"]. To_yaml   

    You will be able to see that the information you want can be accessed in auth .credentials.token and auth.credentials.secret < / Code>.

    EDIT: Now that rail uses the 4th best_carms gem, this method of monitoring omniauth hash does not work so well. There is a better way now:

      render: text = & gt; "& Lt; ago" + Env ["omniauth.auth"]. To_yaml and Return    

    c# - Getting unique identifications from windows -


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

    • 4 जवाब
    • 9 उत्तरों

      सीपीयू नाम और आईपी के अलावा अन्य पहचान क्या मैं खिड़कियों से प्राप्त कर सकते हैं? मुझे ऐसे कई अनूठी पहचान की जरूरत है, जो मिल सकती हैं - ज्यादातर महत्वपूर्ण: सीरियल नंबर, निर्माता, मॉडल, विंडोज़ लाइसेंस संभव है?

      आप सीरियल नंबर, एसेट टैग, यूयूआईडी, मैक एड्रेस और WMI से अन्य पहचान वाली जानकारी प्राप्त कर सकते हैं।

      कम्प्यूटरसिस्टम तालिका एक है यह उपयोगी है, जैसा कि Win32_BIOS तालिका है एक ऑपरेटिंग सिस्टम तालिका भी है।

    knockout.js - Knockout computed observable in hottowel SPA default viewmodel -


    I'm trying to calculate a simple knockout after following the view-model pattern in the Hottowel SPA template. What is the best way to do this?

    I was basically something like this:

      define (['services / logger'], function (logger) {var vm = {active: active, title} : 'Home view', testfield: co.sevable ("this is an exam"), test computed field: getcomputed (this)}; return vm; / / # field internal methods function getcomputed () {return "calculation : "+ This.testField ();} activate the function () {logger.log ('see home active', empty, 'home', true); true back;} // # endregion});   

    But this is the result of an error, although I'm not 100% sure why

      TypeError: this.testField function is not  < / Pre> 

    Then with some testing and error I found this:

      define (['service / logger'], function (logger) {var vm = {activate} : Activate, title: 'home view', testField: ko.observable ("this is a test"); vm.testComputedField = ko.computed (getComputed, VM); return VM; // # field internally Work getComputed () {Return "computed:" + this.testField ();} Nkshn activate () {logger.log ( 'Home View active "empty" house ", true);) integrity back;} # # endregion});   

    But I'm not sure this is a very beautiful way of doing this; I'm not clearly talking about the module patterns used to look at the hot-towel models. So my questions are:

    Why does not my original method work? Are there any better or alternative ways to define visualmodel than my second method?

    Mutes, this is the normal pattern I'm using, it's working well for me

    I use focus expex and local scocked variable for KO binding, and job announcements for Durandal specific methods (Active, View Attach, etc.). VM object function must be after expression.

      define (['service / logger'], function (logger) {var testField = ko.observable ("this is an exam"); ​​var getcomputed = ko.computed (function ( ) {Return "computed:" + activate function testfield ();) {logger.log ('home view active', blank, 'home', true);;} var vm = {active: active , Title: 'home view', testfield: testfield, test computed field: getcomputed}; return vm;});   

    Note: This hottowel is for SPA template

    python - Simple file upload page not working -


    I am trying to add a simple file upload page to my site. Whenever I submit the form, it says "This field is required" above the file selector, as if it is not crossing it. Here's my form, model, and footage.

    forms.py

      django.http imports from Django import forms from HttpResponseRedirect django.shortcuts render_to_response class UploadFileForm (forms .Form): MURRMACMOD = "MMM" CUBE67 = "C67" CUBE20 = "C20" VDINCONN = "VDC" IMPACT20 = "I -20" IMPACT67 = "I67" CAT_CHOICES = ((MURRMACMOD, 'Murrelektronik MAC modules'), (CUBE67, 'Cube67 / Cube67') , (CUBE20, 'Cube20'), (VDINCONN, 'valve DIN connectors'), (IMPACT20, 'impact 20'), (IMPACT67, 'impact 67')) article = forms.CharField (MAX_LENGTH = 100) title = forms .CharField (MAX_LENGTH = 100) file = forms.FileField () cat = forms.ChoiceField (options = CAT_CHOICES)   

    models.py

      django Db import model class file (models.mo Del) of article = models.CharField (MAX_LENGTH = 100) title = models.CharField (MAX_LENGTH = 100) file = models.FileField () cat = models.CharField ()   

    views .py

      from django.http Import django.shortcut the httpResponseRedirect S import render_to_response import.text_to_response files.forms importPonteForm def upload_file (request): If request.method == ' POST ': form = UploadFileForm (request.POST, request.FILES) If form.is_valid (): Form.save () returns HttpResponseRedirect (' / success / url / ') other: form = UploadFileForm () ctxt_dict = {' form ': Form,} context = RequestContext (request, ctxt_dict) return render_to_response (' upload.html ', context_instance = context)   

    I have some help friends, thank you Please sign

    Edit: .. Here's the template

      {% if user.is_staff%} & lt; Form action = "." Method = "post" & gt; {% Csrf_token%} {{form.as_p}} & lt; Input type = "submit" value = "submit" /> {% Else%} {% endif%} & lt; / Form & gt; If you are trying to render the form to the file format, then in the DJ ango template    

    < P>

    form method = "POST" enctype = "with multipart / form

    form method =" post "action =" "& gt;

    Must change. -Data "& gt;



    java - Maven Unit Tests -


    I am working on a project that has been written using Maven.

    If I do

      mvn clean install   

    I hope this test Dada

    I redirected the build process and stored it in an output file and tried to find unit tests by name. However, I was not able to get some unit tests. It seems that some unit tests were not actually executed during the manufacturing process

    My question is how can I know the selection of unit tests that will be executed during the build process.

    Thank you in advance

    You can explicitly name the group in the command line like this Try to give:

      mvn clean install -Destest.groups = "unit, integration"   

    or simply

      mvn test --Destest.groups = "unit, integration"   

    This is a daily example that I use to either test my unit or < Strong> integration group if you need to explicitly specify all (or some) tests If you want to run all (or some) tests without the need, then you must modify your maven configuration to use which gorups.

    ruby on rails - routing with non rest actions -


    IM My administrator is having trouble creating a path for my non-restfull operation, here's my code:

    Controller: Class Store Controller & lt; ApplicationController def toggle_store @ store = store.find (params [: store]) if @ store.available == correct @ store.update_attribute (available, incorrect) other @ store.update_attribute (available, true) end redirect_to @store end end

    Route: Resources: Groups use resources: Stores members: Toggle_store end and end < P> But when I use the path in a link, I get this URL:

    And I want something like this:

    Any ideas?

    Thanks:

    Rake Route:

      toggle_store_group_store Posts / Groups /: group_id / stores /: id / Toggle_store (.format) Store # toggle_store   

    link:

      & lt;% = link_to "toggle", toggle_store_group_stores_path (group, store) ,: method = & gt; : Post% & gt;    

    OK I fixed it like this:

    routes .rb: Resources: Groups use resources: store posts: toggle_store and end

    Controller:

      Def toggle_store authorized! : Toggle, store @ store = store.find (params [: store_id]) if @ store.available == correct @ store.update_attribute (: available, wrong) else @ store.update_attribute (available, true) end redirect_to @ Group end   

    link:

      <%> link to "to", toggle_store_group_store_path (group, store) ,: method = & gt; : Post% & gt;    

    javascript - CakePHP Dynamic Global Variables -


    I am trying to create a global "ServerStatus" flag for a CakePHP application, to the idea that I Toggle offline / online mode so that when the data is pushed onto the server, the site is offline. I have a javascript toggle set, along with the redirect, but the issue I am running is in the global variable.

    I have tried two things, both of the php file in the bootstrap:

    (1) I had configured the class to write the initial position, and (2) I started the initial Used the $ globals array to write values.

    When I try and later, toggle the optional (non-initial) value to a position after the toggle is activated, it fails to change it. As far as I can tell, this means that when I write a global variable in bootstrap.php, then it works in a constant way and changes the initial value override later on.

    Toggle I have a small script Default Layout Default. Ctp:

      & lt; Script type = "text / javascript" & gt; Var charInputs = []; SetInterval (clearInputBuffer (), 20000); Function KeypressHandler (Events) {var currChar = String.fromCharCode (event.charCode); CharInputs.push (currChar); // warning (pressed currChar + 'key!'); CheckForKeyPhrases (charInputs); } Function checkforker phrase (character) {// get input letters as sequence works = ""; For (var i = 0; i & lt; chars.length; i ++) Seek + = character [ii] + ""; // Check for "Maintenance Mode" if (seq == "Maintenance") {Warning ("Maintenance Mode ... Go!"); & Lt ;? Php if ($ global ['serveronline']) {$ global ['status'] = 'down'; $ Global ['serveronline'] = false; } And {$ globals ['position'] = 'up'; $ Global ['serveronline'] = true; }? & Gt; Var temp = '& lt ;? Php $ Global Global ['Status']; ? & Gt; '; Alert ('Current server status:' + temporary); ClearInputBuffer (); } And if (seq.indexOf ('clear')> 1) clearInputBuffer (); } Function clearInputBuffer () {charInputs = []; } & Lt; / Script & gt;   

    In bootstrap.php, I have $ global ['serveronline'] = true; write; But when the warning comes, it always registers the initial value of the right and I see "down" as the current state. It never changes.

    If I'm right to explain that writing global in initialization bootstrap file overrides changes later, then where is the best place to write a dynamic global CakePHP app? If I am wrong, then someone sees me, what am I missing?

    Thanks for your help before time!

    OK, so I believe that the issue I'm having is a misconception that I How PHP and JavaScript are run. The PHP runs on the server side before the page loads, and then running. Which means that my PHP globals are "per execution" variable until the javascript catches the event and looks in PHP var, it's just reading PHP variables and the set code is already running and not running again.

    Actually, I have client versus server-side scripting.

    This means that I can solve my problem There are two ways: (1) Use any type of continuous storage, a file or a database table which I check and update instead of the scripted variable (2) I can request an AJAX and post the data to the server, which causes the server side code to be run with data.

    how can I select this text in XPATH? -


    I want to select the postal code with the city. All the selectors I used were getting without the whole application or the correct data.

      & lt; Div class = "merchantContact" & gt; & Lt; H2 square = "subheadline firefighter-match" & gt; L 'Otry Paid & lt; / H2 & gt; 5-7 & amp; Nbsp; Blondford Street & lt; Br> London and W1U 3DB & lt; ------------------- I want this line & lt; Br> & Lt; A href = "http://www.lautrepied.co.uk" onclick = "window.open (this.href); returnback;" & Gt; & Lt; Font color = "# 0891b" & gt; Company website & lt; / Font & gt; & Lt; / A & gt; & Lt; Br> & Lt; / Div & gt;    

    Try it out:

      html / body / Div / text () [3]   

    Firefox addon:

     desc img


    Maybe you should be more specific in your expression, so try this:

      // div [@ class = "merchantContact"] / text () [3]    

    ios - Which is better, setEnabled or setUserInteractionEnabled? -


    I want to disable a UIButton for the user code. Both the setEnabled and setUserInteractionEnabled can do that well? How are they different?

    enabled is an property of UIControl , Which is a superclass for UIButton . There is a property of userInteractionEnabled UIView (which is the superclass of UIControl ). The effect of the enabled object has an effect on the visual state (by default, gray), and generally the preferred way of disabling one control is to show the signal of the audience is a good thing.

    The code that interacts with your controls is more likely to check whether buttons are enabled if their user interaction enabled properties are set; This is more traditional

    javascript - What does "this" refer to inside a function in an "on.." attribute? -


    उदाहरण के लिए, & lt; td id = 'xyz' onmouseover = 'doIt (इस) में क्या अंतर है '... और & lt; td id =' xyz 'onmouseover =' doIt () '... यह DOM तत्व है?

    उदाहरण में, यह डॉम एलिमेंट के लिए संदर्भित है, जो हेन्डलर के लिए बाध्य है। मैं पढ़ने की सलाह देता हूं, जो इसे बताता है और इवेंट हैंडलिंग के बारे में अधिक बताता है।

    & lt; td id = 'xyz' onmouseover = 'doIt (this)' में क्या अंतर है? .. और & lt; td id = 'xyz' onmouseover = 'doIt ()' ...

    पहले मामले में आप गुजर रहे हैं फ़ंक्शन के लिए एक तर्क, जो एक DOM तत्व है, दूसरे मामले में आप नहीं करते हैं।

    I wrote some prolog logic, how do I write a script that uses it? -


    I am writing an assignment for a prolog class and I'm stuck on something simple I argued in a file named Question 1 Has written a bunch of. Pl

    I am using SWI on Mac OS X, so at the command prompt, I do this:

      Swazel Consultation ('Question 1.Pl') < / Code>  

    To load the file, then I do this to check:

     ? - Father (Homer, Bart) the truth? - Father (big, Bart). False   

    and so on.

    My question is, how do I write a "test script" for my code?

    I suppose I should write something like Question 1 - tests.pl which looks like this:

      ('write test1 must be correct'). Father (Homer, Bart). ('Write test2, must be incorrect'). Father (Marge, Bart).   

    But how do I run that script?

    Sorry, I know it's easy, but I'm stuck. Thanks!

    Not sure that this is the best way, but you can create a script like this: < / P>

      swipl & lt; & Lt; END [question1] write ('test1 must be true'). Father (Homer, Bart). Write ('test2 should be incorrect'). Father (Marge, Bart). END    

    qt - why use a method to get or set a variable in c++ programming -


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

    • 38 उत्तर

      बस क्यूटी में पसंद है, मैं QPoint वर्ग में देखा इसे सेट करने के लिए QPoint.setX () प्राप्त करने और उपयोग करने के लिए QPoint.x () का उपयोग करें। क्यों नहीं सिर्फ एक सार्वजनिक चर के रूप में एक्स का उपयोग करें? मुझे पता है कि कुछ किताब इसे सुझाती है, लेकिन इसके बारे में गहरी वजह क्या है? और यह कभी कभी बहुत सुविधाजनक नहीं है।

      ऐसा करने के तीन बुनियादी कारण हैं। < Ol>

    • अमूर्त आपके उपयोगकर्ता को नहीं पता होना चाहिए कि अगर x मूल्य से संग्रहीत है या हर बार गणना की जाती है। हो सकता है कि आप एक बॉक्स और इसके चौड़ाई के ऊपरी एक्स समन्वय को संचित करें और x के रूप में max_x - width की गणना करें। शायद आप बदलते हैं कि आप संस्करण 3.4 में डेटा कैसे संग्रहीत करते हैं।
    • संगतता आपके उपयोगकर्ता को फ़ंक्शन ( myobject.width () के रूप में कॉल करने के दौरान x को एक चर ( myobject.x ) के रूप में कॉल करने के लिए याद रखना नहीं चाहिए )। इसलिए इसे आसान बनाएं, और फ़ंक्शन के रूप में सब कुछ (कारण के भीतर) करें।
    • कंट्रोल हो सकता है कि x को केवल सकारात्मक, या यहां तक, या जब आप x , ऊपरी_एक्स को बदलते हैं, तब भी बदलाव की आवश्यकता होती है। सेटर्स / गेटर्स के साथ, आप यह सब लागू कर सकते हैं।

    awk - Split a text file based on delimiter using linux command line -


    I have a file with the following lines of text:
      Jeremy, Thomas, 123 Peter, Paul, 456 Jack, Jill, 789   

    I would like to delete all the data except the center item, for example, ending with a file containing: < Pre> Thomas Paul jill

    I have tried so many strange patterns that my brain is exploding. Any help would be appreciated.

    Try awk :

      Awk -F '[[: space:]] *, [[space:]]' '{print $ 2}' input.txt    

    regex - Insert a word with sed into a text file -


    I have a text file and any words like Home before each word that I start I want to insert a file with a lower-case letter, using sed I tried to do it but it is not working:

      sed / s (/ [ ^ Az] + | [az] + / house (^ [az] + | [az] +) / g "text file    

    I found this line, is it okay for you?

     
      SAD-RS / B [AG] \ w * \ B / house and / g 'file   

    code> Kent echo "Yes No yes no y_e_s _no "| sed -r 's / \ b [az] \ w * \ b / house and / g' home yes no, no house or not y_e_s _no

    contiguous - When is worst fit in memory allocation useful -


    I am reading the Estonian version 8 of operating system concepts. When the author goes over the memory allocation and the worst writer fits the states "allocate the biggest holes again." We will have to search the entire list again, unless it is sorted by size. The largest left holes produce, which can be more useful than this

    So my question is, when the biggest remaining hole is leaving a better perspective?

    java - How to add BNode to binary search tree? -


    From our assignment, one question is that we want to write a method in the Betty class. It will take an integer as a parameter, and then add it to the tree so I did this:

      add the public zeros (int v) {if (root == null) {root = New BNode (v); } And {add (v, root); }} Add Public Zero (Int v, Beanode branch) {if (v == branch.getVal ()) {return; } If (v & lt; branch.getVal ()) {if (branch.getLeft () == faucet) {branch.setLeft (new BNode (v)); } Else {add (v, branch.getLeft ()); }} Else {if (branch.getRight () == faucet) {branch.setRight (new BNode (v)); } Else {add (v, branch.getRight ()); }}}   

    But I wonder how do you add when the parameter of the method is just a biodegradable? Is it just:

      public zero addition (betode B) {add (BNode.getVal ()); }   

    Is there no more efficient way to do this? Any help would be appreciated.

    Yes, replace your parameter in another way: do not do your methods in a int but expect a bnode . Then change it:

      Add public zeros (int v, bnoid branch)   

    to

      add public zeros (   

    and replace:

      Add public zeros (int v)   

    to

      Create a separate method:  
      Public Zero Addition (int b) {add (new)   

    Binode (B));}

    In this way you are avoiding creating an additional object in memory.

    unix - How to get the proper exit code from nohup -


    जानकारी कोरुतिल्स 'नोहूप इनवॉलेशन' में नोहूप दस्तावेज से यह बताता है: < पूर्व> बाहर निकलने की स्थिति: 125 अगर `नोहूप 'स्वयं विफल हो जाती है, और' पॉसिक्सली_CORRECT '126 सेट नहीं है, यदि कमांड मिला है लेकिन 127 को आवेदित नहीं किया जा सकता है, तो COMMAND को COMMAND के बाहर निकलने की स्थिति नहीं मिल सकती अन्यथा

    हालांकि, मैं केवल नोहूप से प्राप्त किए गए केवल बाहर निकलने वाले कोड 1 और 0 कर चुके हैं। मेरे पास एक नोहुप कमांड है जो कि किसी स्क्रिप्ट के भीतर से असफल है, और मुझे अपवाद की उचितता है ... और इस दस्तावेज के आधार पर मुझे लगता है कि नोहअप निकास कोड होना चाहिए 126 होना चाहिए। इसके बजाए, यह 0 है।

    मैं चला रहा हूँ, जो कमांड है: nohup perl myscript.pl & amp;

    क्या ऐसा इसलिए है क्योंकि पर्ल सफलतापूर्वक निकल रहा है?

    यदि आपका खोल स्क्रिप्ट के साथ इस प्रक्रिया को चलाता है:

      नोहुप पर्ल myscript.pl & amp;   

    आप कम से कम nohup से बाहर निकलने की स्थिति को इकट्ठा करने का मौका छोड़ देते हैं। पूर्ण रूप से कमांड 0 के साथ सफल हो जाती है यदि शेल फोर्क करने में विफल रहता है और शेल 1 में विफल रहता है। bash में, आप पृष्ठभूमि प्रक्रिया की प्रतीक्षा कर सकते हैं और इसकी स्थिति को wait :

      via nohup perl myscript.pl & amp; oldpid = $! ... कुछ और करो या इस पूरे रिगारमोल को व्यर्थ है ... रुको $ oldpid $ गूंज ...   

    प्रतिध्वनित $? आमतौर पर निर्दिष्ट पीआईडी ​​के बाहर निकलने की स्थिति है (जब तक कि निर्दिष्ट पीआईडी ​​पहले ही मर गया हो और इसके लिए इंतजार किया गया हो।) < P> यदि आप प्रक्रिया को सिंक्रोनस से चलाते हैं, तो आप अलग से बाहर निकलने की स्थिति का पता लगा सकते हैं:

      (nohup perl myscript.pl "PID $! स्थिति $ से बाहर निकलती है?" & Gt; & amp; 2) & amp;   

    और अब आपको nohup से अलग निकास स्थितियों को हाजिर करने में सक्षम होना चाहिए (उदाहरण के लिए अलग-अलग गलत वर्तनी की कोशिश करें: nohup pearl myscript.pl , आदि)।

    ध्यान दें कि पूरे के रूप में उप-शॉटल पृष्ठभूमि में चलाया जाता है, लेकिन नोहूप उप-शेल के भीतर synchronously चलाया जाता है।

    < / div>

    jsf 2 - Prevent confirmation dialogue from opening when there's a validation error -


    I have a text area inside a tab in the Eordion panel, which is a description. I am trying to edit and save a description. I am validating the text field so that the maximum character does not exceed 1000 characters. To display the verification message I & lt; P: Message & gt; before being saved, a confirmed conversation will be shown to confirm the save.

      & lt; P: Message showDetail = "true" autoupdate = "true" /> & Lt; P: accordionPanel dynamic = "true" & gt; & Lt; P: tab id = "_ 0" header = "description" & gt; & Lt; P: inputTextarea styleClass = "max" id = "editDesc1" widgetVar = "txtBox" value = "# {testBean.description}" rows = "6" cols = "150" validator message = "# {msg.AddSystem_validationMsg5}" autoresize = "False" & gt; & Lt; F: validateLength max = "1000" & gt; & Lt; / F: Valid Lang & gt; & Lt; / P: inputTextarea & gt; & Lt; P: command button value = "save" incomplete = "saveDialog.show ()" /> & Lt; P: confirmDialog message = "# {msg.EditSystem_confirmMsg1}" width = "200" showEffect = "explosion" hide effect = "explosion" header = "confirm" seriousness = "alert" widgetVar = "saveDialog" & gt; & Lt; P: command button value = "# {msg.EditSystem_confirmAnswer1}" action = "# {testBean.saveEdit}" process = "@ this" /> & Lt; P: command button value = "# {msg.EditSystem_confirmAnswer2}" onclick = "saveDialog.hide ()" type = "button" />   

    If a user enters more than 1000 characters and tries to save it, the verification message appears for a short time and then the confirmation dialogue pops, The message disappears. How do I stop confirmation talks when popping up a verification error?

    You must check if the verification has failed, then the incomplete In. In the primaryface javascript scope, enter the global args objects in which a boolean validationFailed is the property you can use:

      & lt ; P: value of the command button = "save" incomplete = "If (RGS & amp;! Args.validationFailed) saveDialog.show ()" />   

    This confirmation dialog will only be shown if the verification has not failed.

    python - in this Semaphore example ,Is it necessary to lock for refill() and buy()? -


    In this semaphore example, is it necessary to refill () and lock to buy?

    The book said: The refill () function is performed when the owner of the fake sells comes to add another item to the list. The entire routine represents an important segment; This is the reason that the only way to get lock is to execute all the lines.

    But I think it is necessary to lock to fill it again () and buy () about your opinion? import from importer, import imported import from the interval import register by #! / Usr / bin / env python import import gold bags, lock, lock = lock () max = 5 canditai = badassamophore (max) DEF refill (): # lock.acquire () try: except valueError : Candytray.release (): pass # lock.release () def buy (): # lock.acquire () candytray.acquire (False) # lock.release () Diff Producer (Loop): For loop in range: Refill (Sleep) (Randrange (3)) DIF Consumer (Loop): In range (loop) I: To buy (sleep (Randrange (3)) def _main (): Print ('Starting from:', ctime ()) Nloops = randrange (2, 6) print ('candy machine (Full with% d times)! '% MAX' thread (target = consumer, args = (Randomization (Nullops, NLops + Max + 2))). Start () # Buyer thread (target = creator, args = ( Nullops,)). Start () # Seller @register def _atexit (): print ('All done at:', ctime ()) If __name__ == '__main__': _main ()

    itemprop = "text">

    A lock is absolutely essential, maybe it will help you if you have the number of candies left after each productive / consumer call To print New codes have changed little.

    I for

      numcandies = 5   

    refill:

    (<> Buy:% d left "% numcandies")

    There is no output without locks (that data race issue ):

      ('Starting from:', 'Mars Mar 26 23:09:41 2013') Candy Machine (complete with 5 bars)! Buy: 4 left again Fill: 5 remaining refill: 6 Buy left: Buy left: 4 left Buy: 3 Leave refill: 6 left Refill: 7 Buy left: 6 left ('Finish:' Between the call of the Creator  and between the actual update of the  numcandies  counter, on March 26 23: 09:43, 2013 ')   

    If we have no control over the order of 2 continuously Consumer

    without locking, which actually modifies the counter, in the above case, even if < Code> numcandies was updated to 3 purchased consumer , there is still a local copy of 5 in producer . After updating, it sets counter to 6, which is completely false

    git - Where is vimrc or vim profile for github's mingw32 shell on a Windows machine? -


    Sigwin has a home directory where I can store the .vimrc file to set syntax highlighting. I know in linux machines that this file is usually in the home directory and it can be stored globally (although I do not know how the global thing works so far)

    I I am a user of windows (I apologize), so I use different shells for different things, and it is not absolutely certain that when I launch it from the git bash shell, the sentence The highlighting of the test is not working. It works fine for Saigwin and Putty. But git is not so much for the mingw32

    One more thing is that when I do SSH on a remote server using Sagvin, I can not use Vim, but when I put it I can use VIM if I connect using the shell.

    This topic will be highly appreciated

    GITSBISISGIT uses Comes with your Vim. One way to see this -

    In your git bash type

      $ type vim   

    it will tell you which VIM execution Is used to be qualified. In my machine this indicates

    / bin / vim

    vim --version , this is a lot of environment .

    Pipe it into a grap, like

    Vim - version. Grep vimrc and it will tell you the location (location) where this example of vim will look for vimrc.

    javascript - Html confirmation popup on submit button -


    In my application, I have submitted a button that says the shop process in my DB on the same page, in which one The text box is where its data are required. I used the required field validate for that textbox. And confirm the Ajax confirmation item and the verification box for submitting my box. If the text box is empty I need to check whether the text box has been filed with the data firs and after the creation, the button is set to fire needed. I do not want popup fire before required field verification

    You can use something like this

      var button = document.getElementById ('button'); // or whatever ID your button contains var textbox = document.getElementById ('textbox'); // or whatever ID is in your input button. Click on = function () {if (textbox.value === "") {return false; } And {return true; }}    

    ruby - Why are `=`, `&` and `?` not altered in `urlsafe_encode64`? -


    बेस64.urlsafe_encode64 धर्मान्तरित + और / से - और _ लेकिन पत्तियां = , और और ? के रूप में है। मेरी समझ यह है कि = एक पैरामीटर कुंजी और मान के बीच एक सीमांकक के रूप में उपयोग किया जाता है, और अगर यूआरएल में उपयोग किया जाता है तो उसे संघर्ष करना चाहिए। इसके अलावा, पैरामीटरों को अलग करने के लिए & amp; और ? का उपयोग किया जाता है यह आधार 64 में समस्या क्यों नहीं है? = , और और क्यों

    संपादित करें मुझे ऐसा लगता है भ्रमित हो गया है, लेकिन अब मैं समझता हूँ यूआरएल के रूप में = , और और ? सुरक्षित हैं, लेकिन url के प्रत्येक घटक (पथ, पैरामीटर कुंजी, पैरामीटर मान)। फिर, क्या एक अवधारणा / विधि है जो स्ट्रिंग को यूआरएल के इन घटकों (पथ, पैरामीटर कुंजी, पैरामीटर मान) में प्रकट करने के लिए सुरक्षित बनाता है? यदि ऐसी अवधारणा है, तो इसे क्या कहा जाता है (यानी, "url सुरक्षित" जैसा कुछ, लेकिन बिल्कुल नहीं)?

    मुझे लगता है कि आपने अभी आपके प्रश्न का उत्तर दिया है। डेटा लिंक पर एक नज़र डालें:

      डेटा: image / gif; बेस 64, R0lGODlhEAAOALMAAOazToeHh0tLS / 7LZv / 0jvb29t / f3 // यूबी // ge8WSLf / RHF / 3kdbW1mxsbP // एमएफ /// yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj / GAwXEQA7   

    उन संकेतों के बराबर चिन्हों की अनुमति है बराबर चिह्नों से बचने के लिए, परिणाम के माध्यम से पास करें।

    php - Pass Variable Number of Parameters to Postgresql -


    How does one pass a random number of parameters for a query? The code blocks shown below show whether the attempt was made. All failures display Bull (false) For testing, three integer IDs are used to represent.

    The query from item 1 was manually executed in pgAdminIII, and was successful. The query was echoed and compared to item 2 and 4. They look closer to seeing, but the parameters are not binding. Select column from

      table WHERE id = any ('{1,2,3}' :: int []); Select column from the table WHERE id = ANY ('{?,?,?}' :: int [])   

    1) This works is the desire that any section 1- N number will be:

      $ sql = "Select column from table WHERE id = any ('{1,2,3}' :: int [])"; $ Sth = $ dbh- & gt; Ready ($ sql); $ Sth- & gt; Executed (); $ Result = $ sth- & gt; Get (PDO :: FETCH_NUM); Echo var_dump ($ result); $ Dbh = null;   

    2) This fails:

      $ value = array (1,2,3); $ PlaceHolders = implode (',', array_fill (0, count ($ value), '?')); $ Sql ​​= sprintf ("The table from the selection column WHERE id = any ('{% s}' :: int [])", $ placeHolders;); $ Sth = $ dbh- & gt; Ready ($ sql); $ Sth- & gt; Execute ($ value); $ Result = $ sth- & gt; Fetch (); Echo var_dump ($ result); $ Dbh = null; 3, it fails:  
      $ value = array (': qwer' = & gt; 1, ': asdf' => 2, '': Zxcv '= & gt; ; 3); $ Sql ​​= "table WHERE id = any from the column column = any (\ '{: qwer,: asdf,: zxcv} \' :: int [])"; // Do not survive a quote below if the error causes $ sth = $ dbh- & gt; Ready ($ sql); $ Sth- & gt; Execute ($ value); // Invalid parameter number :: If single quotes are not saved then qwer $ Result = $ sth- & gt; Fetch (); Echo var_dump ($ result); $ Dbh = null;   

    4) This failed (explicitly binding parameter):

      $ value = array (1,2,3); $ PlaceHolders = implode (',', array_fill (0, count ($ value), '?')); $ Sql ​​= sprintf ("search query nc_reports WHERE id = any ('{% s}' :: int [])", $ placeHolders;); $ Sth = $ dbh- & gt; Ready ($ sql); $ I = 1; Forex currency ($ value as val $) {// $ sth- & gt; Bind Parm ($ i, $ val, PDO :: PARAM_INT); $ Sth- & gt; Bind value ($ i, $ val, PDO :: PARAM_INT); $ I ++; } $ Sth- & gt; carry about (); $ Result = $ sth- & gt; Fetch (); Echo var_dump ($ result); $ Dbh = null;    

    Try to generate the query yourself:

      $ Value = array (1,2,3); // generate query $ params = substr (str_repeat ("?,", Sizeof ($ value)), 0, -1); $ Sql ​​= "nc_reports, select the query where id ($ params)"; $ Sth = $ dbh- & gt; Ready ($ sql); ($ I = 0; $ i & lt; Size ($ value); $ i ++) {$ sth- & gt; Byte value ($ i + 1, $ value [$ i], PDO :: parametti); } $ Sth- & gt; carry about (); // Repeat during the result ($ result = $ sth-> fetch ())! == FALSE {echo var_dump ($ result); } $ Dbh = null;    

    d - Object.Error: Access Violation when printing result of std.algorithm.cartesianProduct -


    I am using DMD 2.062 for x86.

      module testing; Private anonym test1 {one, two, three,} private enum test2 {one, two, three,} auto CT = cartesian product ([EnumMembers! Test1], [EnumMembers! Test2]); Integrate {import std.stdio; Agram (n, m; whistle) {Shelter (n, "", m); }}   

    This program prints:

      one two one three one   

    then an access violation Error is thrown whether I am using cartesianProduct incorrectly or is this a bug in the function?

    Maybe a small part of both, maybe. The point here is that an attempt is made to evaluate ct at compile time and produces the range used in run-time, I think CTF or Cartesian products expect such a scenario. Does not do anything bad that involves the use of invalid memory; I think that should is either work, or a compile-time error, but it will not help you And bug related to Tracker.

    Here's what the matter is, however, if you move the unit-test body or static it () to the module constructor to start ct Everything will work, what do you miss, does not support the initialization of global variables when the D program starts. The value assigned to Global is always assessed at compile-time, which often "just works", is often the result of an error in collection-time (if CTRL-enabled is not an initialization) and in this case there is strange behavior :)

    This code is what you want:

      Auto Test 1 member = [EnumMembers! Test1]; Auto Test 2 Members = [EnumMembers! Test2]; Nickname CT = typef (cartesian product (test 1 member, test 2 member)); Whistle whistle; Stable it () {whistle = cartesian product (test 1 member, test 2member); }   

    In general, the relation between each other in run-time data for complex-time data and complex time is very difficult as the current de-front-end implementation in the form of arrays or associative arrays. And a lot of attention is needed

    cordova - Delete JNI local references in android app -


    Hi, in my Android phonegap app, I have used the following link and said the original code. Two numbers have been added using that native code. Using

    How can I remove genuine local references?

    Here's the link:

    I'm getting this error in the lockback:

      JNI error overrhel local reference table 512 entries VM aborted   

    To resolve this error, I will have to delete the local references

    To delete the local context, you must add a line env-> DeleteLocalRef (jniRef) , where jniRef is an object that you are creating in JNI for example eg jstring The code in the link you shared will not cause the local reference table overflow. An overflow will only happen if you are creating too many objects (usually in the loop) in the context of a function call, because the function exits when all local references are automatically cleared. Post some code for more help

    ibm mobilefirst - Worklight project not working after update -


    I'm working on Vertical 5.0.5 and I've upgraded my work to 5.0.6 and now it's There is no demand for wlInitOptions. I tried to manually create a file with the init options but still it is not reading the variable from that file. Is there a place that has changed since the upgrade which I have to update in my old project? Need help

    Create a new application, copy the initOptions.js file from your normal \ js folder . After this, place this file in the common \ js folder of your own application.

    Form Validation with jquery - Highlight Error Field -


    I need some help with my jquery verification form. Except the highlight of the error text box part, I have been able to do everything. I need to have the following key:

    Whenever a rule breaks for a field, then a yellow background color will apply to that field for 3 seconds; So it turns back on white, can anyone help me with this?

    Here's my code:

      & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Script src = "http://code.jquery.com/jquery-1.9.1.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Validate $ {Document} .ready (function () {$ ("# form1") ({Rule: {name: {expected: true, minnothing: 3}, date: {date: true}, email: {// Compound rule requirement: true, email: true}, url: {url: true},}, message: {name: {minlength: jQuery.format ("requires at least {0} characters.")}} });}); & Lt; / Script & gt; & Lt; Style type = "text / css" & gt; * {Font-family: verdana; Font-size: 11px; Line-height: 14px; }. Submit {margin-left: 125px; Margin-top: 10px;} .label {display: block; Swim left; Width: 120px; Text align: right; Margin-right: 5px; } .form-row {padding: 5px 0; Clean both; Width: 700px; } the label. Terror {Width: 250px; Display area; Swim left; Red color; Padding-left: 10px; } Input [type = text], texture {width: 250px; Swim left; } Texture {height: 50px; } & Lt; / Style & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" method = "post" action = "" & gt; & Lt; Div class = "form-row" & gt; & Lt; Span class = "label" & gt; Name * & lt; / Span & gt; & Lt; Input type = "text" name = "name" /> gt; & Lt; / Div & gt; & Lt; Div class = "form-line" & gt; & Lt; Span class = "label" & gt; Birthday & lt; / Span & gt; Input  gt; & Lt; / Div & gt; & Lt; Div class = "form-line" & gt; & Lt; Span class = "label" & gt; E-mail * & lt; / Span & gt; & Lt; Input type = "text" name = "email" /> gt; & Lt; / Div & gt; & Lt; Div class = "form-line" & gt; & Lt; Span class = "label" & gt; Home page & lt; / Span & gt; & Lt; Input type = "article" name = "url" /> gt; & Lt; / Div & gt; & Lt; Div class = "form-line" & gt; & Lt; Input class = "submit" type = "submit" value = "submit" & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

    I tried to plug it in, but it can not be found to work:

      $ (". Selector"). Validate (Element, errorClass, validClass) {$ (element) .addClass (errorClass) .removeClass (validClass); $ (element.form) .find ("[+ element.id +" for label] ")" .addClass (ErrorClass);}, unhighlight: function (element, error class, valid class) {$ (element) .removeClass (errorClass) .addClass (validClass); $ (element.form) .find ("label [For = "+ element ID +"] ") .removeClass (errorClass);}}};    

    Probably will do this:

     Validate $ (" # Form1 ") ({... highlight: function (element, error class, valid class) {$ (element ) .addClass (errorClass) .removeClass (valid class); $ (element.form) .find ("label [for = element.id + "]") .addClass (errorClass); setTimeout (function () {$ (element) .removeClass (errorClass) .addClass (validClass); $ (element.form) .find ("Label [for =" + element .id + "]") .removeClass (errorClass);});}});    

    jquery - DateTimePicker is not showing -


    I am facing a problem with the datetime picker in jquery in MVC4. Here's my code:

      @ html Textbox ("RELIEVING_DATE", model. RLIEVING_DATE) $ (function () {$ ("#RELIEVING_DATE") Datepicker ();}   

    But the date time picker is showing an error and Untitled type error: Undefined properties can not be read inline.

    In my model RELIEVING_DATE one is not showing

    I want to give it a default value.

    Please help.

    The first thing written in your post is that you $ (function () { one ending ); in the end.

    Also make sure that you right into your page with jQuery and jQuery UI scripts If you are using bundles then you may need the following script before the script that is appending the date picker:

      @ Scripts.Render ("~ / Bundles / jquery ") @ scripts.Render (" ~ / bundle / jqueryui ")   

    Normally the ~ / bundle / jak yuri bundle already _Layout.cshtml is included if you have used the Internet application template to create your project.

    One more thing you should verify is that you do not have many fields with the same ID, and if it's @html If the textbox is inside an editor template, then id can not be #RELIEVING_DATE , but prefixed with shipping property, for example #SomeProperty_RELIEVING_DATE . Look at the HTML generated in the browser to see the exact ID. You can also specify a square in the field:

      @ Html.TextBoxFor (x = & gt; x.RELIEVING_DATE, new {@class = "datepicker"})  < / Pre> 

    and then:

      $ (function () {$ ('datepicker'). Datepicker ();});    

    c# - Load a xml file using XDocument.Load from FileSystemWatcher. Error "The process cannot access the file..etc" -


    What is the method of "file access to ATC can not process" error? The flow is that when I locate an XML file, the file systemwaters will look for an XML file, I need to read the specific node from the XML file.

    How can I fix this? Thanksgiving

    Here is the file system code

      Private Zero FilesSystemWriter Code (Object Sender, System.IO.FileSystemEventArgs e) {try {string type = GetType (e.FullPath) toupper (); If (type == "cc") {if (Global.pc_flag) {ProcessPC (e.FullPath); } And if (Global .mw_flag) {ProcessMW (e.FullPath); } And {process XML (E. fullpath); }} And if (type == "gc") {ProcessMW (e.FullPath); } // Processes (E. Fulpath); } Hold (exception before) {error ++; LblErrors.Text = error.ToString (); MessageBox.Show (ex.Message); }}   

    Here's what GetType is included

      Private string GetType (string file) {string type = string.Empty; (Var Stream = File. Open (File, FileMod. Open, File Access. Read, Fizaire Reddit)) {var request = XDocument.Load (stream); Var get_command = request.Descendants ("Transactions") New {type = R. Select Element ("Type"). Values}; Leading (var c in get_command) {type = c.Type; }} Return type; }    

    You do not use your stream in the code And when the stream is open, you can not see the file in the XDocument.Load (file)

      private string GetType (string file) {string type = string .Empty; Var request = XDocument.Load (file); Var get_command = request.Descendants ("Transactions") New {type = R. Select Element ("Type"). Values}; Leading (var c in get_command) {type = c.Type; } Return type; }    

    iphone - how to overlap image on another images while dragging it in iOS? -


    I have created a Jigasav game. In it, I split the image into 3x3 matrix and displayed on screen (ie [Self.view addSubView: imageview] like I've added all 9 image tiles). Now when I pull an image tile in another image tile, it sometimes goes down on the image or sometimes below the image to solve the image (like the first image to look like the default behavior of iOS Is displayed below all the images and the last uploaded image appears at the top, drag the user into the image attached images) Now I feel that when I drag any image tile, it is the top of the remaining images And should be visible. Appears on top of the previous image similar to the previous image.

    Enter image details here

    < Whenever an image is touched to drag it, you can call it bringSubviewToFront

     . 


    iphone - Core audio.h not found in my project? -


    I've added CoreAudio framework using libraries using link binary, however, when I compile it, then " Core audio / core audio h "was not found. Please help me

    You

      # import & lt; CoreAudio can try to add /CoreAudioTypes.h>    

    Jquery User input into JSON -


    I have a complex form, in which the user has some information to make some selection and to fill with the information There is also some Textera this form works great and the data is passed through JSON for my MVC controller and all the works are fine.

    Although being a user, users have found me that some "$ $$ & amp; etc .. and because of them JSON is being formatted incorrectly, therefore the controller action is not bound correctly .

    So my question is how can I convert text input to user in sign language so that it creates a valid JSON. / P>

    The way I gather the current data Here's what:

      var TelNo = $ ("# TelNo"). Var EmailMessage = $ ("# EmailMessage"). Val ();  

    > Jason to avoid characters There is no real work for this.

    One such task will be done

      function makeSafe (jsonf) {jsonf = JSON.stringify (Jsonf); jsonf = jsonf .replace (/ \\ n / g, "\\ n") .replace (/ \\ '/ g,' \\ '") .replace (/ \\" / g, "\" "\." \ \ T ") .replace (/ \\ b / g," \\ b ") .replace (/ \\ f / g," \\ f "); Return jsonf; }   

    then you can

      email messaging = messaging (email message);   

    I've added it to my string object so that whenever I need it I can reference it

      String.prototype.makeSafe = function () {Change it (/ \\ n / g, "\\ n"). Replace (/ \\ '/ g,' \\ ''). Replace (/ \\ "/ g," \ "" \ "") .replace (/ \\ & amp; / g, "\\ and more") .. (/ \\ r / g, "\\ r") .replace (/ \\ t / g, "\\ t"). .replace (/ \\ b / g, "\\ b") .replace (/ \\ f / g, "\\ f"); }; Var EmailMessage = $ ("# EmailMessage"). Val () EmailMessage = EmailMessage.makeSafe ();    

    android - Looping through TextView and setting the text -


    मेरे पास बिल्कुल 20 TextView है और उनका id अनुक्रम में है, यानी:

      आर.ड.टेक्स्ट दृश्य 1, आरड.टेक्स्ट व्यू 2, आर.आईड.टेक्स्ट विवे 3 ...   

    मेरे पास एक लूप के लिए है: < / P>

      के लिए (इंट i = 1; i & lt; 21; i ++) {टेक्स्टव्यू टेक्स्ट व्यू = (टेक्स्टव्यू) ढूंढिए वीवीबीआईआईडी (आर.ड.टेक्स्ट व्यू ...); // टेक्स्टव्यू .सेट टेक्स्ट (" .. ");   

    क्या लूप के लिए इसका उपयोग करने के लिए TextView प्राप्त करने का एक तरीका है? और

    अगर आपने अपने TextView आईडी को आईडी R.id.textView1 .. R.id.textView21 दिया है, तो आप ( + I इंट आईडी = मिलर संसाधन ()। GetIdentifier (नाम, "आईडी", getPackageName ()); अगर (आईडी! = 0) {टेक्स्टव्यू टेक्स्ट व्यू = (टेक्स्टदृश्य) खोजव्यूबीआईआईडी (आईडी); }}

    sql server - Simple SQL query won't work when using an in clause -


    field 1 has a value of 183872 but the following question does not return anything < Pre-> Select from in Table 1, where in field 1 ('Abbott, Christina D-183872')

    Not only that, you have to use like in what is. Is field 1 also a numeric field? If so, you need to insert / convert to the string:

     select from * select * from table 1 where * '%' + cast like 'Abbott, Christina D - 183872' 1 varchar (10)) + '%'    

    ember.js - Calling App.store.commit() too fast in Ember -


    I have a list of items in my application, and there is a button to delete the previous one. Then on my controller I wrote the following work:

      removeLastItem: - & gt; Previous item = current_order.get ('item'). ('Last Object') lastItem.deleteRecord () App.store.commit ()   

    My problem comes when I'm pretty fast on my button But it seems that when the store has not expired () the item is still dirty, it is already calling store.commit () for another item, throwing this error:

    Error: Attempted to handle the ad deleteRecord on the app. ITM: ember6954: f6a1c932-2db0-4933-7c92-69fbd3838229 & gt; While rootstate.deleted.uncommitted in the state.

    I have already tried to put this code inside the ring or transaction, but nothing worked.

    Any clues? :

    You can try a different approach, for example DidDelete < / Code> event has been removed.

    Example:

      removeLastItem: - & gt; # Get your button reference and disable it altogether IITem = current_order.get ('item'). ('Last Object') lastItem.deleteRecord () lastItem.on 'didDelete', = & gt; # Re-enable your button again Iteem.on 'made error', = & gt; # Notify your user again and again? App.store.commit ()   

    Look for information on the model lifecycle and all the events you can hear.

    Hope it helps.

    git - Autodeleting files from repository I've deleted manually from a working folder -


    I have worked with git for a very long time and can still find out that I have sent some files to < Strong> add , I delete some files ... when I want to do, what do I have to do? git commit -m "123"

     

      # 1 git or  
      # 2 git rm file1_I_removed git rm file2_I_removed Git rm file 3_I_removed git rm file4_I_removed git add git commit -m "123"   

    or

      # 3 git add -u git commit -m "123 "  

    Note that the most I do not remember is the files I have removed (even thought that I could use the git status I can see them and see them), and once I have deleted them, I want them to have repository

    Div class = "post-text" itemprop = "text">

    Try this:

      git add -u   

    this command was deleted Deletes files, and deletes updated updates.

    If you have new files to commit, you can always click git add After .

    sql - taking a very efficient join between two tables in Oracle -


    I have a large table with millions of data (too big too).

    The tables are as follows: post_id for the post: Partition key: user_id user_id comment on post: commentid, post_id, comment_creation_date, comment_type,

      post post_id, user_id, description, Primary key for creation_date, xyz, abc, etc. Note: Comment = comment_creation_date   

    Note: I can not change table schema in any way to create new index comment = commentid, postid Comment = commentid The primary key of the indexed colums

    The comment type is of the string < / P>

    There is now a list of comments type and type a comment_action_data category I need to find all the posts that have been commented like that.

    A simple, very incompetent solution will be done Select from Post P *, Comment C where c.post_id = p.post_id where c.comment_creation_date> ? And c.comment_creation_date & lt; ? And p.posttype IN (some list)

    How can I optimize this query? What if the comment was the same thing instead of the last_modited_date, comment_date Note:

      last_modified_date is not indexed and comment_date is   

    Once the query is successful, then I should get all comments for a post together. Example if C1, C2, C3 with Post 1

    PS: I am not good at designing questions. I know that is not good for performance.

    I'm not sure it will save time, but maybe move your comment section to a subquery Will help:

      SELECT * FROM Post by Join (from select * comment WHERE comment_creation_date & gt;? And comment_creation_date & lt ;? and 'stringlist' like '%' || comment_type | | '%') Sea on C. post_id = p.post_id    

    sql server - How to flatten tree leaves sequence in SQL -


    I have a table S that has 2 columns: name For ID and one XML column
    This table shows a tree data.

      S ----- + ----- ----------- name. XmlCol ----- + ---------------- A | & Lt; E & gt; & Lt; BID = 'B1' type = 0 / & gt; BTID = 'D' type = 1 / & gt; BTD = 'B2' type = 0 / & gt; & Lt; / E & gt; D | & Lt; E & gt; & Lt; BID = 'B3' type = 0 / & gt; & Lt; BID = 'G' type = 1 / & gt; & Lt; / E & gt; F | & Lt; E & gt; & Lt; BID = 'B4' type = 0 / & gt; & Lt; / E & gt; G. & Lt; E & gt; & Lt; BID = 'B5' type = 0 / & gt; & Lt; / E & gt;   

    In the given order the data appears Order cases here.

    Note XML structure.

    Type = 0 means that the entry type is the address.
    Type = 1 means that there is a line with the same name in the table, so there is no node and no leaf.

    5 cards, B1, B2, B3, B4, B5.

    The sequence I want is to obtain a table of all the leaves in sequence , like this:

      Leaves -------- B1B3B5B2B4   

    When the start node 'A'

    This is the XML parsing snippet, but this is just the beginning. [S] Cross applied from [XmlCol

      SELECT [id] = xTree.b.value ('@ id,' varchar (10) ') ]. Nodes ('/ E / B') xTree (B)   

    Can anyone suggest how to do this in SQL?

    Try something like this:

      Announcement @ source table (Name VARCHAR (10) PRIMAR Y KE, XMLCL XML NOT NULL) DECLARE @Root VARCHAR (10) = 'A' Source value ('A', Convert (XML, '&  gt; & lt; / E & gt; ')), (' D 'N' & lt; E & gt; B = B = "B3" type = "0" /> ; B id = "g" type = "1" /> gt; & lt; / E & gt; ',), (' F ',' h E ',' N ' DECLARE @ Temp1 Table (ID Identification Priority key key, name VARCHAR (10) No, INT not type zero, type zero, Value VARCHAR (10) No Taps) INSERT @ Temp1 SELECT Name, xTree.b.value ('@ type', 'int') Type AS, xTree.b.value ('@ Id', 'varchar (10)' ) @ SourceCrossing the value [XmlCol] Nodes ('/ E / B') ASTE (B) DECLARE @ TEMP2 table (ID int main key, name VARCHAR (10) No, tap, INT not zero, value Enter the VARARAR (10) No, tap space zero) in @ Temp2 SELECT *, ROW_NUMBER (), (As per the name division by name) AS status @ Temp1 DECLARE @ Temposition table (Name VARCHAR (10) No T-null, Type INT is not zero, value VARCHAR (10) No zero, position float zero, level INT no zero, primary key (name, position)) as CTE (select name, type, value, conversion (float, position) As a condition, from the 0AS level @ Temp2 WHERE type = 0 union all Select t1.Name, t2.Type, t2.Value, t1.Position + t2.Position * Power (converter (float, 0.1), 1 + t2. Level), T2. Level @ 1s level @ Temp 2 T1 Inner GTT2T2OnT 2.Name = t1. Type Volume T1 = 1) Select @tpx * Include CTE selection value (selection value, 0 As an additional, tapfone from where the name = @ Root Unius all select value, 1AS additional, @ tempus from the position where the value is not (where the float @ float from the selection price) name, / Code>  

    Some overview:

    • In XML, feature Value should always be quoted

    • It is not very clear in which order you want the value outside the given root tree (in this example, only B 4 is not a part of the beginning of the tree; A; If there were many such values, in many other trees, this is not a desired order, which is not clear)

    • Using a table variable is one more Using complex CTE can be avoided, but I think they

    • I took up to 10 sub-nodes per level; If there are more sub-nodes, then you can change between 0.1 to 0.01, for example

    java - How to get listview item string? -


    How to get an item list How do I click in the list-view?

    Here is my code:

      Public Class Main Class Activity {ArrayList & lt; String & gt; ListItems = New ArrayList & lt; String & gt; (); ArrayAdapter & lt; String & gt; Adapter; See list view list; @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); SetContentView (R.layout.main_layout); Adapter = new array adapter & lt; String & gt; (This, Android .R.Lite.Simple_L_Lightime, LISTEATIM); ListView = (ListView) findViewById (R.id.listView1); ListView.setAdapter (adapter); ListItems.add ("item 1"); ListItems.add ("Item 2"); ListItems.add ("Item 3"); Adapter.notifyDataSetChanged (); ListView.setOnClickListener (New View. OnClickListener) {@Override Public Zero onClick (see arg0) {// TODO Automatic Created Method Stub Toast.makeText (getApplicationContext (), listView.getItemAtPosition (0) .toString (), Toast LENGTH_LONG) .show ();}}); }}   

    But this force closes

    Change:

      listView.setOnClickListener (New View. OnClickListener) {@Override Public Zero onClick (see arg0) {// TODO Automatic Created Method Stub Toast.makeText (getApplicationContext (), ListView.getItemAtPosition (0) .toString (), toast.langtha_long) show ();}});   

    :

      listView.setOnItemClickListener (New OnItemClickListener () {@Override Public Zero onItemClick (AdapterView & lt; & gt; arg0, see ARG1, integer ARG2, long arg3) {toast.makeText (getApplicationContext (), listView.getItemAtPosition (aRG2) .toString (), Toast.LENGTH_LONG) .show ();}});    

    objective c - Building an app with an electronic signature feature for ios possibly using mono touch? -


    This is just a quick question because I have found gog and ipod which already has this feature - but I How to go to create an application that has the ability to hold electronic signatures ... Is it possible?

    XMERIN's component store is a component that does this

    I also Written from scratch - it is not particularly difficult code will look something like this:

      Public class draw: UIView {DrawViewController dvc; // Clear Canvas Clear Public () {drawpath.Dispose (); DrawPath = new CGPath (); FingerDraw = false; SetNeedsDisplay (); } // Pass in the context of the nearby controller, though I can not use it anytime and it can possibly remove the public drawing (Rectangle frame, DrawCentron Root): Base {frame} {dvc = root; This.drawpath = new CGPath (); this. Background color = UIColor.White; } Private point touch location; Private Point FTT location; Personal CGPath drawPath; Private bull finger draws; Public Override Zero Toosbagan (Mono TouchFoundation.Nentent Touch, UIEvent evt) {base.TouchesBegan (touches, EVT); UITouch Touch = Touch Any object in the form of a UIT; this. Finger Draw = True; This.touchLocation = touch.LocationInView (this); This.prevTouchLocation = touch Previous Location: View (this); This .customline display (); } Public override zero tote mode (mono touch. Foundation.Nentent touch, UIEvent evt) {base.TouchesMoved (touch, ESP); UITouch Touch = Touch Any object in the form of a UIT; This.touchLocation = touch.LocationInView (this); This.prevTouchLocation = touch Previous Location: View (this); This .customline display (); } Public UIImage GetDrawingImage () {UIImage returnImg = null; UIGraphics.BeginImageContext (this.Bounds.Size); (Using CGContext context = UIGraphics.GetCurrentContext ()) {context.SetStrokeColor (UIColor.Black.CGColor); Context.SetLineWidth (5f); Context.SetLineJoin (CGLineJoin.Round); Context.SetLineCap (CGLineCap.Round); Context.AddPath (this.drawpath); Reference. Doppath (CGPit drawing mode. Stroke); ReturnImg = UIGraphics.GetImageFromCurrentImageContext (); } UIGraphics.EndImageContext (); Refunding IMG; } Public Override Zero Draw (Rectangle F. Ricketts) {base.Draw (rect); If (this.fingerdraw) {(CGContext reference = UIGraphics.GetCurrentContext ()) is used {reference.SetStrokeColor (UIColor.Black.CGColor); Context.SetLineWidth (5f); Context.SetLineJoin (CGLineJoin.Round); Context.SetLineCap (CGLineCap.Round); This.drawPath.MoveToPoint (this.prevTouchLocation); This.drawPath.AddLineToPoint (this.touch location); Context.AddPath (this.drawpath); Reference. Doppath (CGPit drawing mode. Stroke); }}}}    

    Music streaming service for iPhone app -


    I'm working on creating an iPhone music app. I am thinking that their music stream from apps like Songza, Pandora And how can I implement such music streams in my app. Any help is greatly appreciated.

    If you are interested in HTTP streaming then take a look at the resources of Apple.

    There is a sample project on GitHub for a streaming audio player.

    Error in 3D rendering with xtk on Remote Desktop -


    We are trying to implement WebGL for a 3D user interface. We have some users who need access through a remote desktop connection, however, WebGL is disabled while loading a page with WebGL on a remote desktop, the error "Oh ... sorry, experimental-webling The reference is not supported on this machine ...! " Appears and 3D rendering fails. 2D rendering works We were thinking that there is a way around this problem. OpenGL does not work with remote desktops because the remote desktop opens another desktop and connected to it. There is no hardware performance, so I suppose that WebGL has similar limitations. You have to do a different kind of remote desktop, maybe VNC or even be included in it.