Monday 15 August 2011

java - How to implement a JPanel that shows/hide content depending on its width? -


I am trying to apply a JPanel which displays more or less information based on available size.

In fact, the idea is such a default content:

image Enter details here

This can be reduced when the space is reduced:

 Image Description Here

My code is such as:

  import net.miginfocom.swing.MigLayout; Import javax.swing *; Class Panel Dimos JPanel {Private Final JLabel Title = New JLab (); Private Final JLab Counter 1 = New JLABEL ("00"); Private Final JLAB counter 1 label = new JLab (); Private Final JLab Counter 2 = New JLABEL ("00"); Private Final JLab counter 2 label = new JLab (); / ** * An new ABS App Cadre message blocks the panel panel * / Public panelmedom () {this.SsetOpaque (wrong); InitGUI (); } Private Final Zero initGUI () {// 1Â °) Final Miglaut migLayout = New MigLayout ("fillx, hidemode 2, debug", "[growprio 0] []" // defined 4 columns); SetLayout (migLayout); // 2 °) // add (title, "spanx"); Plus (counter 1, "newline"); Add (counter1Label); (Counter2); Add (counter2Label); } Public static zero main (string [] Args) {Final JFrame jFrame = New JFrame ("test 4"); JFrame.getContentPane (). SetLayout (new megallout ("Phillix, debug")); Final panel dimo item 1 = new panel demo (); Item1.title.setText ("Element 1"); Item1.counter1Label.setText ("First LBL"); Item1.counter2Label.setText ("Second LBL"); JFrame.getContentPane (). Add (item 1, "groupex, gpx 110"); Final panelDimo item 2 = new paneldomain (); Item2.title.setText ("Element 2"); Item2.counter1Label.setText ("First LBL"); Item2.counter2Label.setText ("Second LBL"); JFrame.getContentPane (). Add (item 2, "groupux, gpx100"); JFrame.pack (); JFrame.setVisible (true); }}   

I tried to hide / hide my secondary labels, but I was not successful, tried to add a component listener and override component risized ().

Is anyone aware of implementing such behavior that increases preferences of well-being with Migelout increases?

Update1: I was wondering ... what if I set the minimum 1 + 1 label counter, and the maximum size for counter 2 + label 2 and then the operations Will the mechanization work to change the shape and change the size of the minimum or its maximum?

How about:

  public static JPNL panel (string ) {Jepynel Panel = New Zygel (New Miglite ("Inset 0, Rap 4, Philix, Debug", "[] [] 200 Shrink) [200 Decrease, Increase 200]"); Panel.add (new jlabel (name), "span x 4"); Panel.add (new JLab ("00")); Panel.ed (new jlabel ("first lbl"); Panel.add (new jlab ("01"); Panel.add (new JLABEL ("second LLBL")); Return panel; } Public static zero main (string [] algs) {Jepynel panel = new zipeline (new mangleout ("Inset 10, gap 10, Philix, debug")); Panel.add (panel ("element 1"), "w (50% - 15)!"); Panel.add (panel ("Element 2"), "w (50% - 15)!"); Jeffre Frame = New Gefram (); Frame.setContentPane (panel); Frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Frame.pack (); Frame.setVisible (true); }   

I had difficulty in shaping the two main columns equally; I had to do by setting the width on the components instead of columns. I'm not sure why this is so.

r - fit an xtable to a pdf file -


I am creating a sweat document that uses the extensible to make the test and puts it in the PDF file. It works but the table document is not suitable and some text is missing. Is there a way to align the text in a PDF file? / P>

This is my data:

  dput (x) structure (list = structure (c (3l, 2l, 1l), label = c ("apersver" , "Db", "web"), class = "factor"), group = structure (c (2l, 1l, 1l) owner = structure (c (1l, 1l, 1l), label. = "Infrastructure", class = "factor"), server = structure (1: 3, .ll = c ("servera", "serverb", "serverc"), class = "factor"), numberconp = c (64 L, 120 L, 120 L), Description = Structure (C (1 L, 3L, 2L), .Label = C ("Front end server for server web traffic", "They B "to create dynamic content", "Customer data and login information"), class = "factor"), cost = structure ("AP", "group", "owner", "server", " Server "," number "," number "," description "," cost "), (" $ 200,000 "," $ 400,000 "," $ 500,000 ", class =" factor "))) , Class = "data.frame", line.Name = c (na, -3l))   

This code is to insert the table into PDF: print (ext. (X, caption = paste ("summary of application"), table. Placement = "! H", caption.placement = "top", align = c ('l', 'p {1.5in}', representative ('c', 6)))

I recommend checking out, many examples are useful, in fact, if you reduce the wire If you do not want to adjust your table, I get two options:

  1. Use small fonts.
  2. Use landscape mode.

    Here, I use a combination of both:

      \ documentclass {article} \ usepackage {rotating} \ begin {document} & lt ; & Lt; Data, echo = FALSE & gt; & Gt; = Library (ext.) X & lt; - Structure (list (app = structure (C (3L, 2L, 1L), .lLL = C ("apserver", "db", "web"), class label = structure (c (2l, 1 L, 1L), .Lale = C ("back", "front"), class = "factor"), owner = structure (C (1L, 1L, 1) LLL = C ("server A" "Serverbie", "serverc", class = "factor"), LLL = "infrastructure", class = "factor"), server = structure (1: 3, number cpu = c (64l, 120l, 120l ), Description = Structure (C (1L, 3L, 2L), .Lll = C ("Front and Head for Server Web Traffic" "," Web Templates To Generate Dynamic Content "," Cost = Structure "(1: 3, .LL = C (" $ 200,000 "," $ 400,000 "," $ 500,000 ", Consumer Data and Login Information Name = c ("app", "group", "owner", "server", "number cpu", "description", "cost"), class = "data.frame", line = name = c , -3 L)) @  gt; = print (ext. (X, caption = paste ("summary of applications"), caption Placement = "top", align = c ('l', 'p {1.5in}', representative ('c', 6)), size = "footnotesize" Floating.environment = "sidewaystable") @ \ & {document}   

    Note that you have to use latex package rotation this should give you something like this :

    Output

python - Best practices for Querying graphs by edge and node attributes in NetworkX -


Use Network X for new social network analysis queries, and new in the library. By query, I mean choose / create subclients based on the properties of the nodes of both sides, where the edges are made, the nodes have attributes, the graph is using a multidi graph of the form

  G2 = nx.multiDiGraph () G2.add_node ("UserA", {"type": "Cat"}) G2.add_node ("UserB G2.add_node (" UserC ", {" type ":" mouse G2.add_node ("Like", {"type": "feeling"}) G2.G2.add_edge ("UserA", 'Hates', statementit = "1") G2.add_edge ("Hates" , 'UserB', Statement = "1" ("Hate", {"Type": "Experience"}) G2.add_edge G2.add_edge ("UserC", 'Hates', statementit = "2") G2.add_edge ("Hate", 'UserA', Statement = "2") G2.add_edge ("UserB", 'hate' G2.add_edge G2.add_edge ("Hate", "User", Statement = "3 G2.add_edge ("User C", 'Like', Statement = "3") G2.add_edge ("Like", "User B", Statement = "3")   

Inquiries with nodes for

 , data in G2.nodes_iter (data = true): if (data ['type'] == "cat"): # All edges from these nodes Removing # Then using a filter for a specific statement_id # or all with a specific statement ID Receive the edges # Find from node et "cat" reboot   

Is there a better way of query? Or is it best practice to create custom iterations to make a subfraph?

Alternatively (and a different question), the graph can be simplified, but I am not using the graph below because the object of type "Hate" will be with predecessors whether it is easy to ask ? G3 = NX G3.add_node ("UserA", {"Type": "Cat"}) G3.add_node ("UserB", {G3.add_gege ("UserA", "UserB", "UserB", "User", "User", "UserA", "UserA", "UserB", Statement = "1", label = "Hates"}), label = "Hates")

Other notes:

haskell - Returning True for only 1 Function out of the list of 3 -


Since I'm sure to use global variables in Haskell, I'm thinking that anyway I get the following Can i

  - There are elements in the list that are the odd list HasOdd :: [integer] - & gt; Bool - There are elements in the list that are even in the list of HASEven :: [integer] - & gt; Boole - The list has a length & gt; 5 long list :: [integer] - & gt; Boole - Function in Map [Bool] - This function can not be modified to fix the problem. Checklist :: [integer] - & gt; [Bool] checkList xs = map (\ y - & gt; y xs) listChecker where listChecker = [listHasOdd, listHasEven, longList]   

Anyway, I can make sure that in them Only a true return from?

For example, [1,2,3,5], I just want to return to the list which is true [true, false, false] (evaluation from top to bottom ).

Another example, [2,4,6,8,10,12,14], should be returned [false, true, false]

In other words, the checklist [1,2,3,5] returns [true, false, false], checklist [2,4,6,8,10,12,14] returns [false , True, false]

** The last task will always be wrong in my example, because it is not inaccessible

I know that I have an if statement I can do that to check that the last one is true but it seems like a very dumb idea. Or is this really the way to do it? (Recalling the results of "previous ceremony" while keeping Haskell in mind)

This is the best I can come together in It is relatively painless to handle the number of potential pockets of a poker hand, for example.

  Data Results = ListHasOdd | List HASEven | Longlist | Non-Eddy Result Forum List :: [Integer] - & gt; Result resultFelllist XS | Any strange xs = ListHasOdd | Any xs = ListHasEven | 5 & ​​lt; Length x = long list | Otherwise = noop list HasOdd = (ListHasOdd ==). Results lightlist listSeven = (List HASEven ==). The result is a long list = list (Longlist ==) but it is also stupid: instead of creating a  [bool] , why not use only the  result ?  

Edit: or we can pay attention to what mean

 < Code> listHasOdd xs = a strange Xs listHasEven [] = incorrect listingHess xs = all also xs - if they are not all, then at least one should be strange, and `true 'will give' true 'long _ = false - If there are at least 5 elements in the list - then there is at least one strange element in the list - (and 'list' will be 'true') - or there are also at least five elements in the list - (and 'catalog' TRUE`)    

java - Generate API docs with Javadoc -


I am writing Javadox for a project, on which I am working, and @link each endpoint is linked to linking to Javadock for each method.

Ideally, I want to do something like this:

  POST / API / resource call {@link resource # getAll () resource @ getAll} received / api / Resources / {id} call {@link resource # getById (int) resource # getById}   

I am open to any solutions that are similar.

There is a feature in Maven that gives you the HTML markup to src / main / javadoc / overview. Html and it will process all the tags and write the output on the main Javadoc page.

This works very well when you use MarketDown Overview.html Page

jQuery $(window).resize not firing within jQuery plugin -


I have created a custom jQuery plugin and having problems getting a window-sized function to fire inside the plugin I was broken down to do the basics of obtaining it, I did not know why he was not firing:

 ; (Function ($, window, document, undefined) {$ .fn.test = function (option) {$ (window). Reset (function () {warning ('sdsd');})}}}}}) JQuery); $ (Function () {$ ('. Element'). Test ();});    

In your case the window is undefined because you can not Passing it in the function.

 ; (Function ($, window, document, undefined) {$ .fn.test = function (options) {$ (window). Resize (function () {warning ('sdsd');});};}) , Window, document); // & lt; --- Make changes here    

sharepoint - Xstl global variable set in for each and used after foreach -


First of all, I am new to XSLT. I am working with the Sharepoint list and receive a link to show me There is a need to do if data exists in specific quarters. If there is no data in a certain quarter, then I should have a label that says so.

So what have I done that I created a foreach loop for every data of the same month of a given year. I know that I can not open a variable in XSLT, but I do not know how to do it I need it. Here is a sample of my code as I am working with SharePoint, so I do not have access to XML. I: /

    & lt; xsl: variable name = Select "DataQ3" = "'Incorrect" /> & Lt; Select xsl: variable name = "DataQ4" = "'false'" /> & Lt; Xsl: each selection = "../ line [Generate-ID () = Generate-ID (key ('month', subdiver (date @ 6, 7)) [substring ('@ date', 1, 4) = $ VarYear)] [1])] "& gt; & Lt; Select xsl: variable name = "currentMonth" = "number (substring (date @ 6,7)" /> & Lt; XSL: Select & gt; & Lt; Xsl: when testing = "$ current mont & gt; = 1 and $ current churn $ lt; = 4" & gt; & Lt ;! - Set $ ​​DataQ1 right - & gt; & Lt; / XSL: When & gt; & Lt; Xsl: When testing = "$ current churn> = 4 and $ current churn $ lt; = 7" & gt; & Lt ;! - Set $ ​​DataQ2 correct - & gt; & Lt; / XSL: When & gt; & Lt; Xsl: when test = "$ current churning = 7 and $ current churn $ lt; = 10" & gt; & Lt ;! - Set $ ​​DataQ3 correct - & gt; & Lt; / XSL: When & gt; & Lt; XSL: otherwise & gt; & Lt ;! - Set $ ​​DataQ4 correct - & gt; & Lt; / XSL: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / XSL: for-each & gt; & Lt; Div & gt; & Lt; XSL: Select & gt; & Lt; Xsl: when test = "$ DataQ1 = 'true'" & gt; & Lt; A & gt; & Lt; Xsl: attribute name = "href" & gt; & Lt; Xsl: Select the value = "www.example.come" /> & Lt; / XSL: Specialty & gt; & Lt; Xsl: Select Value = "'Linked DotDefault Q1'" /> & Lt; / A & gt; & Lt; / XSL: When & gt; & Lt; XSL: otherwise & gt; & Lt; Xsl: Select the value = "'There is no data for this quarter.'" /> & Lt; / XSL: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / Div & gt;    

You use the key function in your code You did not post the announcement of your key but I think you can get it from the following code:

  & lt; Div & gt; & Lt; XSL: Select & gt; & Lt; Xsl: When test = "../ line [substrings (date, 1, 4) = $ varYear and substrings (date, 6, 2) & amp; gt; = 1 more substring (date, 6, 2) & Amp; 4; "& gt; & Lt; A href = "http://www.example.com/" & gt; Linkotodonta Q1 & lt; / A & gt; & Lt; / XSL: When & gt; & Lt; Xsl: otherwise & gt; There is no data for this quarter. & Lt; / Xsl: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / Div & gt;   

Some other notes:

  • In your testing for Q1, you entered $ currentMonth & lt; = 4 is written. I think what you want $ currentMonth & lt; 4 . substring (@Date, 6, 7) has been used to remove @ date from the month
  • . The third argument for substrings is the length of the sub-row, not the end index. You might want to suborg (date, 6, 2) .
  • and , you can just type string .

javascript - Handle stuff after dom changes -


For example:

I found a page with some javascript / jQuery stuff:

  (Function ()) ($ ('. Tip'). Tooltip (); $ ('test'). Click (function () (warning ('clicked!')})}} ();   

On the page I insert some HTML with jQuery so that the changes in the DOM. For example, I insert an additional element with class "tip" or "test". Do not do jQuery because of non-header Working with DOM and not just the elements that were cast, I searched for this solution for "click":

  $ ('body'). (' Click ',' click ', function () {warning (' clicked! '}});   

I do not understand, but doing this like this The manipulative dom and jQuery stuff work on new inserted elements. So my first question is, why does this work and not just the click () function Land? And second question, I "body"?

Finally, my third question is, how did it with live and Tooltip?

I know that there is so much information about this subject (I've read the previous rep (and) the live () function) but I could not find any explanation about it.

Additional question:

/ P>

4) Is it always to focus on "body" for such situations Is advised? It always happens there but for potential performance issues?

So my first question is, why does it work and just click () function is not?

Because the event handler is now handed over to a basic element, so it remains even after replacing / manipulating child elements.

Old articles for your observation on event delegation - but the concepts are the same:

  • And the second question Why do I have to "body" to indicate

    You do not do, what any appropriate parent will do? For example, any direct parent (for example an ep rapper who does not get)

    Finally, my third question is how is this tooltip done?

    You have to restart your tooltip plug-in on newly entered elements. For example:

      $ Get ("foo.html", function (html) {$ ("# someDiv"). Html (html); $ ("# someDiv"). (".tip"). Tooltip ();});    

javascript - Console error when drawing to canvas -


I have a main javascript file that is trying to attract a tilemap to the canvas for a game, and I have an included file that actually maps etc, but im pulls this error in firebug:

Writing Error: HTMLImageElement, HTMLCanvasElement, HTMLVideoElement: None of the values ​​can be changed . [Break this error]

  ctx.drawImage (mapiles [map [x] [y]], x * tilixes, y * tilkses);   

The main JS, which calls my level.js file, looks like this:

  $ (document) .ready (function ( ) {Var canvas = document .getElementById ("TBG"); var reference = canvasgate contact ("2D"); var ui = new GUI (); var level = new level (); // ---- ------ Login / Register Gui -------------- $ ('# TBG') Hide (); $ ('# load-new') Hide () Hide $ ('# reg') ($); $ ('# login'); .. login_but is clicked function $ ('# login_but') by ui.login // if click (ui .login); // If reg_but is clicked ui do .register function $ ('# reg_but') Click (ui.register); .. $ ('# new_but') (function () {game_settings ("new");}); $ ('# load_but') Click (function () { Game_settings ("load");}); // login_sumbit button was clicked ("# login_submit") and click the ui.login_ajax function $ (ui.login_ajax); $ ("# reg_submit") .click ( Ui.register_ajax); $ ("Welcome") ("click on", "#logout_but", ui.logout) ;. // ____________________________________________ // game function game_settings (state) {if initialisation (state = = "load") {ui.load_game (); // do aja to finally load the user x call //level.level_init(0,1); Attract (); } Else {// set start parameter // change screen ui.new_game (); Alert ("new game"); }} Function draw () {context.clearRect (0,0, canvas.Wide, canvas.height); Level.draw (reference); SetTimeout (Draw, 30); } // End Loop});   

And where this line of file (level.js) looks like this:

  function level () {var tilesize = 32; Var map = 0; Var mapTiles = []; // var saved_level = level; // var saved_location = location; Map = [[1,1,1,1,1,1,1,1], [2,2,2,2,2,2,2,2]]]; For (x = 1; x & lt; = 256; x ++) {var imageObj = new image (); // New example for each image image, obz. Src = "picture / prototype" "+ x +". Jpg "; mapTiles.push (imageObj);} This.draw = function (ctx) {(plus x = 0; x & lt; = 31; x ++) for {(y y = 0; y & lt; {Ctx.drawImage (mapTiles [map [x] [y]], x * tilselas, y * tilyses);}}}}}   

for {0} Have you ever encountered this error?

And how will I fix this issue, thank you Tom

Forget about the canvas and everything else and use the map array and the code that uses it. Check the array access with any and console.log () calls:

  map = [[1,1,1,1,1, 1, 1,1,1,1], [2,2,2,2,2,2,2,2,2]]; Console.log (map.length); Console.log (map [0]. For length (; var x = 0; x & lt; = 31; x ++) {for (var y = 0; y & lt; = 31; y ++) {console.log (x, y Map [x], map [x] & amp;; and map [x] [y]);}}   

Do you see the problem? You can see it by looking at it That those console.log () calls will be printed. If not, then paste that code into the Chrome Developer Console and see what it does. (BTW, where in the last logic is the map [x] and map [x] [y] , it is essentially the same as map [x] [y] But this prevents the code from crashing when the map [x] is undefined as you would see in the log.)

Now when we < Code> Map [x] [y] is undefined some time, go back to the drawImage () call, which uses it as image logic :

  mapTiles [Map [x] [y]]   

when The [x] [y] to undefined , will evaluate the expression?

smartcard - Reading big file from a javacard applet -


I am writing an applet that stores 5 kb, 7 kb and 11 kb in 3 different sizes. I have no problem storing the files inside the applet. But when I try to read them back, I can only read the first two (small files). The third file throws an exception:

  javax.smartcardio.CardException: could not receive a response to the sun. Security. Smartcardio Sun.security.smartcardio.ChannelImpl on ChannelImpl.Dotrmansmit (unknown source). Sent (unknown source)   

I have tried to detect this problem and I have found that it has to do with file size. So I created a test file size of 7 and extended this file bit by bit. By the time I reached 7905 byte, I worked. This means that the maximum number of bytes 795 bytes can be read from applet. I'm handling responses using the sample code:

  public void readFile (APDU apdu, short [] offset, short selectFile, short MAX_APDU_SEN, byte OFFSET_SENT) {byte [] file = GetFile (selectedFile); If (file == null) {+ ISOException.throwIt (ISO7816.SW_FILE_NOT_FOUND); +} // How many bytes work to send at this time and how much will remain = (small) (file.length - offset [OFFSET_SENT]); Boolean chain = staying & gt; MAX_APDU_SEN; Less sendLen = Chain? MAX_APDU_SEN: stay; Apdu.setOutgoing (); Apdu.setOutgoingLength (sendLen); Apdu.sendBytesLong (file, offset [OFFSET_SENT], sendLen); // Check to see if more APDU is to send if (chain) {+ offset [OFFSET_SENT] = transmitted lane; // bytes were sent to ISOException.throwIt (ISO7816.SW_BYTES_REMAINING_00); // indicate that there are more bytes to come} and {+ offset [OFFSET_SENT] = 0; // to send and no bytes}}   

I have tried two different types of cards i.e. Jesse 2.2.1 (36 KB) and Jesse 2.2.2 (80 KB) ) Compatible cards, but they all behave the same.

Any help please?

Generally chaining is not used by reading a file, because the host application is easily Specify offset starting at P1 / P2 - as specified in ISO 7816-4 in at least one read binaries command. I believe, even for a chain reaction, the card wants to prepare data in the buffer, whose limited size I consider the cause of your problem.

sql - Sqlite Transaction - When Does Reserve Lock Take Effect -


I was thinking at the point after issuing a current transaction, () the call attach to the reserve lock and write Starts to stop?

Does the reserve lock match the actual start transaction call, or is it done only after the name of the commute and running the transaction?

I ask B / C to take advantage of my current data access layer, and not everyone has the need to write a custom transaction to stop the status of a race, I started Do not want to call (), and then call any combination of existing selection / insert / update wrapper to solve any problem, while having unique write access, eventually call a commute. I am trying to avoid the circumstances of the race, I want the reserve lock on the transaction to be active for the transaction that starts "immediately" (i.e., before it comes back).

If more explanations or details are required, please let me know and I will be happy to make them available. Thanks for your expertise please.

say:

first read operations against a database Creates a stock lock for and creates the first writing operation reserve lock

When all changes are completed in the page cache, then the first actual writing operation committ . . To force a force to apply a lock while executing BEGIN , get started :

After an initial time, No other database connection will be able to write to the database or it can get a quick one or BEGIN exclusivity. However other processes can continue to read from the database.

If you want to stop reading (which should not be necessary because all transactions are properly sorted in any case), BEGIN Explore .

jsp - dojotype="dijit.form.FilteringSelect" causing 'options.length' is null or not an object javascript error -


While executing the code below, I'm getting a Javascript error 'options.length' is zero or not an object When I remove "dojotype =" dijit.form.FilteringSelect "in jsp within the selection tag, this correct value is working fine. Warning Print when the dojotype attribute is not in the code, but displays empty when the dojotype attribute exists ... I'm sure the cause of the problem is of your valuable help. Thank you

  .jsp & LT; Select the name = "shoppingCategoryCode1" id = "shoppingCategoryCode1" onchange = "RatePlan.onchangeShoppingCategory (); RatePlan.updateStatus (true), "dojotype =" dijit.form.FilteringSelect "if there is =" RatePlan.shoppingCategoryIsValid1 "invalidMessage =" & lt; Spring: Message code = 'rateplan.validation.shopping.category.validation' / & gt; "& Gt; .js on sel = dojo.byId (" shoppingCategoryCode1 "); For alert (sel.options.length); (Var I = 0; I & lt; sel.options.length; i ++) { If (sel.options [i] .Value == "full") {sel.selectedIndex = I; break;}}    

This is when you select shoppingcategoryCode1 in a widget select, it is now a because of the

ios - How to add a decimal button -


How to add numbers to a decimal button My code:

  Number = Number * 10 + (integer) [sender tag]; Display2.text = [NSString stringWithFormat: @ "% .10g", number];   

And my code for the decimal code.

  NSString * currentText = display2.text; If ([current text limit offsetting: @ "" option: nsbuckers search] .length == 0) {display2.text = [display2.text stringbifting string: @ "."]; }   

How does this work ?! Enter 12 and press Decimal. And press number 3 = 123: (

The reason is that you are getting 123 instead of 12.3 The code for the other button (not the decimal button). However I will go with the limit. Location == To add a border instead of NSNotFound, range.length == 0, this problem is not.

The problem is That you are doing the number * 10 + [sender tag] Now you say that you enter 1, then 2, decimal. "Number" is 12, which is 12. Now, when you multiply it by 10 Add 3, your O 12 * 10 + 3 = 120 + 3 = 123.

The actual number you want to get (12.3) Instead, use it:

  Display2.text = [display2.text stringByAppendingFormat: @ "% i", [sender tag]];   

At the beginning of this string to get rid of zero, you can do this If: ([display.text isEqualToString: @ "0"]) {display.text = [NSString stringWithFormat: @ "% i", [sender tag]];} and { Display2.text = [displa Y2.text stringByAppendingFormat: @ "% i", [sender tag]]; }

list - Copy the last three lines of a text file in python? -


I'm new to the dragon and the way it Handles the variable and the array of variables in the lists is quite strange for me. I usually read a text file in a vector and then by determining the shape of the vector by making a copy of the new array / vector in the last three, For a final function with loop, copy the copy function to a new array of all three.

I do not know how loop works in Pathathan, so I can not do this.

I still have:

  #read line file number OpLex Inket = 3 text_file = Open ("output.txt", "R") lines = text_file. Readlines () text_file.close () write linens = [] if lane (lines)> gt; NumberOfLinesInchat: i = 0 while ((numberOfLinesInChat-i) gt =): written line [i] = lines [(lane (line) - (numberOfLinesInChat-i)] i + = 1 # writes what people are reading The file is called text_file = open ("output.txt", "w") text_file.write (writeLines) text_file.close ()    

To efficiently obtain the last three lines of a file, import decks with import from deck :

  Use ('somefile') as wings: last 3 = deck (wings, 3)   

I remember so that you really do not want to.

Note - Your full code will be:

  Open the import deck from the archive ('some files') in the form of wings, open ('outputfile', 'w') As fout: fout.writelines (deque) (wings, 3))    

cocoa - Custom insertion point for NSTextView -


I am changing the entry point size by override - (zero) drawInsertionPointInRect: (NSRect) aRect color :( NSColor *) aColor turnOn: (BOOL) flag , but it does not handle the first wink (when you move the insertion point, it goes back to normal)

I For the first time snoozing the method, take a nap. - (zero) _drawInsertionPointInRect: (NSRact) Color of one color: (NSCLOR *) acolor .

But this is not a solution from overriding for me. The personal methodology results from the App Store. I want to put the app in the app store. I see that apps like IAre and Writer have a custom entry point and they are in the App Store.

Do anyone know how they managed to do this rather than override the personal method, or better way?

Thank you.

  - (zero) _drawEnsertionPointInRect: (NSRact) Color color: (NSCLOR *) aColor {aRect.size.width = 3.0; [One color set]; [NSBZ; Paid Fill: ARC]; } - (Zero) Drawerspointpoint Protect: (NSRact) ARACT COLOR: (NSCLOR *) A collar is on: (BUL) flag {if (flag) {aRect.size.width = 3.0; [One color set]; [NSBZ; Paid Fill: ARC]; } And {{Self-Setances: Exhibit Protective: [Extra addition to avoiding Self-SafeSecurity]: No]; The problem is that the clipping path is effective when the drawInsertionPointInRect is called.  
  - (zero) drawInsertionPointInRect: (NSR) Rect Color: (NSCLOR *) Color has changed: (BOOL) flag {rect.size.width = 8.0; NSBZier Path * path = [NSBZAR path beatsed: context]; [Path setclip]; // Hardly set the clipping area (test only!) [Fill the path]; }   

Note that the above code will skip the artifacts (in my test, Diencetertujiencontact is not called to empty the merge point, to attract only). Use SetDrawsBackground: YES in a quick and dirty way to clean artifacts.

jquery - ko foreach not working -


I have reviewed all related artifacts which I have found, and others seem to be able to work this simple code

I am using jquery-1.9.1, jquery-mobile-1.3.0, and Knockout-2.2.1. I am providing it because I have found that many times these libraries may be incompatible. I have not got a good resource which tells which one of these libraries should be used together.

My problem is that I can tie a persuasive array using the template, but the knockout container can not be found without working for the foreach.

This works:

  & lt; Ul Data-roll = "List View" Data-Insert = "Right" Data-Bind = "Template: {name: 'OfficeTemplate', Foreign Language: CampaignTame, like: 'Team'}" & gt; & Lt; / Ul & gt; & Lt; Script Type = "Text / html" id = "OfficeTemplate" & gt; & Lt; Li & gt; & Lt; Span data-bind = "text: team name" & gt; & Lt; / Span & gt; & Lt; / Li & gt; & Lt; / Script & gt;   

This does not work:

  & lt; Ul & gt; & Lt ;! - Forwarding: Campaign Training - & gt; & Lt; Li & gt; & Lt; H1 & gt; & Lt; Span data-bind = "text: team name" & gt; & Lt; / Span & gt; & Lt; / H1> & Lt; / Li & gt; & Lt ;! - / ko - & gt; & Lt; / Ul & gt;   

This is going to be more complex and I intend to use nested templates, clean in-line binding is very popular.

I have seen debugging on it. When using Containerless Syntax, FREEBinding (VM) fails.

View Model: No. 0: // Campaign Campaign: Ko.SourceWebLay (empty)}; // Office summary $ .exax ({type: "GET", url: "/ api / salesteamdata / getofficesummary /? Campaign =" + campaign, datatype: "Jason", data: "", success: work { Vm.CampaignTeams = ko.observableArray (data); ko.applyBindings (vm); $ ('li- [data-role = collapsible]'.) Compressed ({theme: 'c', refresh: true});}, Error: function (XMLHttpRequest, textStatus, errorThrown) {warning ("Error:" + Error Instant);}});

  var vm = {// data campaign tm: Ko.SourceWeb [])}; Ko.applyBindings (VM); // Office summary $ .exax ({type: "GET", url: "/ api / salesteamdata / getofficesummary /? Campaign =" + campaign, datatype: "Jason", data: "", success: work { Vm.CampaignTeams ($) ('li [data-roll = compressed]'). Compact ({Theme: 'C', Refresh: Correct});}, Error: Work (XMLHttpRequest, textStatus, errorThrown) { Warning ("Error:" + error appears);}});    

java - text from JSpinner to JTextArea -


How can I move text from a JSpinner to a JTextArea Am I I .getText (); Thoughts of , but it is not working dobDate = new JSpinner (new spinnerata model (today, blank, zero, calendar. MONTH)); DateEdit = New JSpinner.DateEditor (dobDate, "dd / MM / yy"); DobDate.setEditor (dateEdit); DobDate.setBounds (215,270, 120, 25);

You can use from you or you can use

batch file - Dos command and its output -


All,

Please guide me, how to print the O / P given below in the DOS window Do you? Being new to DOS command, I do not know what's the string below?

Set ts =% Date: ~ 4,2 %% Date: ~ 7,2% -% Time: ~ 0,2%% Time: ~ 3,2%

Thank you in advance

Welcome CMD Prompt

echo command that will display a value on the screen (ex: echo% date% )

set TS one variable ( ts < / Code>) that can later be called in such a way: % ts%

% date% is a variable that is The system will return the date. % date: ~ 4,2% month (numeric) and % date: ~ 7,2% returns the day of the month (numerical).

% time% is also a variable, but it gives time (24 hours). % time: ~ 0,2% gives hours (24 hour style then 1 noon 13). Returns the % time: ~ 3,2% minutes.

How do I prevent "r 'library' or 'require' calls not declared" warnings when developing a package? -


I am developing a package that depends on the package foo , and in my package code Call the exported code from foo I have included the package name in the NAMESPACE in the Import (Af) declaration, and import Under: line description file However, I get the following warning when RCM check :

  r 'library 'Or' require 'call can not be declared Yes: 'foo'   

What am I missing?

There is a similar question, but it does not discuss this specific warning.

() or library (& lt ); Pkg & gt;) . The error message is a little confusing - it's telling you that you have placed the requirement or library in your code, but in reality (properly) those calls are not declared In your DESCRIPTION file.

If you intend to use code from those packages in your package, you should call this library / call ; Rather, you need to declare them properly (and how you're using them) in your DESCRIPTION file.

Mostly, you want to import 'package and some, or all, for export functions / symbols available for your package. You can add such packages to your DESCRIPTION file in the Import: field - e.g.

  Import: & lt; Pkg & gt;   

And likewise, announce that you want to write all in the NAMESPACE file using the symbols exported from that package ,

Import

By doing this, & lt; Pkg & gt; All functions in the namespace are automatically provided and therefore it is not necessary for requirement anywhere in your code.

In the context of a package, the main use of is that which you want to make only conditionally, for example, suppose that you write the function that Handles a very specific conspiracy arrangement, which requires foo , but foo is not required in your package otherwise, if you include code Want to do the conditional package foo Depending on it, you can write something in this form:

  (if required ("foo")) {#do stuff}   

And then you can include foo under DESCRIPTION instead of sequence: import: . Another example is a package that is not required by the users of your package.

In short: If you are importing packages to use only those packages exported to the namespace of that package, then you can send your package to Library or is not needed anywhere in the code.

EDIT: In newer versions of R, the RCM check if you use , , warns it, And instead you suggest that you use requireNamespace . In that case, you can follow the pattern:

  ## Use the 'bar' function from the package 'Foo' (if required requires "name" ("foo", quietly = TRUE)) {foo :: Bar ()}    

.net - Maintain list data when appending C# -


I have written that there is a problem with the function, I realized this problem but the 'fix' only worsened the situation . / D>

This function connects to my DB and does a selected query, then it's list & lt; List & lt; String & gt; & Gt; , returns the desired behavior back to List & lt; String & gt; for each line and since there are several columns on each line, I can access them with the list list.

  try {///} connection connection before reading data. Open (); /// reader = dataCommand.ExecuteReader () Ready to Read; Read the // call before reaching the data (reader.Read ()) {myTestData.Clear (); For (int i = 0; i & lt; howManyColumns; i ++) {/// add myTestData.Add to Maritast data list (reader.GetValue (i) .toString ()); } /// MyTestData add data to DataRao data. Add (Mattextadata); }} Hold (SqlException exSql) {Program.displayExError (exSql, true); }   

The problem is in line:

  myTestData.Clear ();   

I tried to clear the list, so next time I added a list to my list list, there would be no element in it and all the rows included in the same list. I have to avoid, but instead I myTestData.Clear (); The list list is wiped out and all of its contents in the list is also lost, to keep data without any idea included in the first list?

PS: Fix I did myTestData.Clear (); was causing the problem to be added, but if I take it then all the rows are added to the first list and it is not even used. If the problem is not clear please tell me to try and clarify

Thx guys!

Instead of clear in the current list, you need to create a new list mydata.Clear () to myData = new list & lt; String & gt; () .

css3 - CSS - Cropping Image Height To Match Text Length -


I have found a section to share 2 things - a top title of text, I should always have a width of image 308px , And its length is cropped according to the length of the text. I am not interested in setting a certain height for the location, because the length of the material can change, how can this be done? (Thanks!)

HTML:

  & lt; Section class = "location" & gt; & Lt; Img src = "http://evinwolverton.com/img/disc.jpg" & gt; & Lt; Header & gt; & Lt; H2 & gt; This is a title & lt; / H2 & gt; Also for branded messaging & amp; Br / & gt; Maurice Eusemode Deuce Molis & lt; Br / & gt; If this is not a commodity label, then & lt; Br / & gt; Bretttor Laguula, Egget Lacenia Audio & lt; Br / & gt; Bean Neck Elite & Lt; / Header & gt; & Lt; / Section & gt;   

CSS:

 . Location {boundary: 2px solid # ccc; Hidden flurry; Width: 620px; Color: # 666; Margin: 40px 0; }. Place title {float: left; Padding: 25px; Width: 258 pixels; }. Place H2 {margin: 0 10px 0; Font size: 1.2mm; Color: # 333; }. Location IMG {Float: Correct; Width: 308px; }    

Optional solution to use background image, if you call it the actual & Lt; Img & gt; tag to . Place in the relative position, hide overflow here; Give the image a complete status

  .location {status: relative;   

hidden flurry; }. Location img {status: complete; Top: 0 pixels; Correct: 0 pixels; }

windows - heroku postgresql odbc connection error -


I installed the 64-bit ODBC client (PostgreSQL x64 9.01.02.00) on Windows 7 SP1 and configured the system DSN

  Connection test failed SQL ## f - SqlState:   

28000, Error code: 210, error message: communication was closed during authentication; The socket has been closed

I have tried to close the Windows firewall, but it does not resolve it.

Do I need to run / configure in Bracken Databases

Thanks in advance

EDIT: When setting up DSN, I used SSL for 'requirement' Was set to '

There was a similar problem and I did not see the pg_hba.conf entry of' md5 ' Instead changed into 'trust' and it solved my problem.

c# - Remove item click event handler for single items in GridView -


मेरे विंडोज स्टोर ऐप में मैं GridView का एक ItemClick ईवेंट हैंडलर: <प्री> & lt; GridView ग्रिड। कॉलम = "0" ग्रिड। रो = "1" चयनमोड = "कोई नहीं" IsItemClickEnabled = "True" ItemClick = "ClickOnItem" & gt; & Lt; / GridView & gt;

आइटम GridView के साथ ItemsSource के लिए बाध्य हैं। क्या ग्रिडव्यू के लिए बाध्य किया गया एकल आइटम के लिए क्लिक इवेंट को निकालने की संभावना है?

I यह सुनिश्चित नहीं है कि यह आपके परिदृश्य के लिए कितना उपयुक्त है, लेकिन ऐसा करने का एक तरीका यह है कि आइटम के आधार पर क्लिक ईवेंट को अनदेखा करना है:

  शून्य ClickOnItem (ऑब्जेक्ट प्रेषक, ItemClickEventArgs ई) {var आइटम = (नमूनाडेटाइम) e.ClickedItem; // एक विशिष्ट वस्तु को अनदेखा करें - यहां हम अद्वितीय आईडी का उपयोग करते हैं, लेकिन यह // कोई विशेषता हो सकती है ... यदि (स्ट्रिंग। कॉम्परेयर (आइटम। यूनिकइंड, "समूह -1 आइटम -1") == 0) वापसी; // सामान्य प्रसंस्करण यहाँ ... ...}   

अपडेट - एक क्लिक ईवेंट को प्रोग्राममैटिक रूप से जोड़ने के लिए, आपको अपनी ग्रिड (< कोड> एक्स: नाम लाइन):

  & lt; GridView ग्रिड। कॉलम = "0" ग्रिड। पंक्ति = "1" x: नाम = "myGridView" SelectionMode = "कोई नहीं "IsItemClickEnabled =" True "ItemClick =" ClickOnItem "& gt; & Lt; / GridView & gt;   

और फिर पीछे कोड में, पेज के निर्माता में हैंडलर जोड़ें:

  सार्वजनिक पेज कन्स्ट्रक्टर () {this.InitializeComponent (); MyGridView.ItemClick + = ClickOnItem; }    

c# - How can I pass a collection of objects from VB6 to .NET? -


I have to pass a collection of key / value pairs of .NET from VB6. In VB6 code they exist in a basic collection. But I'm not sure how I can accept the parameters of a method in my own way in the collection in my .NET project.

I tried to add a reference to the Visual Basic for Applications but came back

The text "itemprop =" text ">

You type something like this in C #:

  [Guid (" fb5e929a-2f8b-481e-9516-97edf5099df4 " ) [ComVisible (true)] public interface myInterface {public zero addObject (string key, string value);}   

and in your class, you can do it Private collection public addObject (string key, string value) {collection.Add (key, value);}

This will allow you to addObject Give permission to call and pass on your data Then .net will add it to a collection, so instead of passing your entire collection from vb6 to .net, you can pass them one by one.

You

More information about .com is an example of a code between

c# - How to separate img tags in description of xml (RSS FEED) -


I am unable to retrieve images from the RSS feed, that is, in the description

I am using the following code to get information. L

  var rssFeed = doc.Elements ("RSS") Elements ("Channel"). Value, link = el.Element ("title") value, link = el.Element ("link", "link", "element" ("item"), gradual date time (L. element (value, description = el.Element ("description" PubData = Date Time (L. Element ("Pubadet"). Value);}   

When the description is being displayed, both the text and the image are being displayed So I want to separate the text and the image in the description. Could you please tell me how to proceed

used RSS feeds:

}

  protected string regex (st Ring source) {var reg1 = new reggae ("src = (?: \" | \ ')? (? & Lt; imgSrc & gt; [^ & gt;] * [^ /]. (? Jpg | BMP | GIF | PNG)) (?: \ "| \ ')?"); Var match1 = reg1. Match (source); If (match 1.Success) {Uri UrlImage = New Uri (1 match. Group ["imgSrc"]. Man, Uricand.Assolute); Return UrlImage.ToString (); } And {return tap; }   

}

javascript - Jquery UI Elements Not Showing in a Facebox -


I am making a Rail App 3.1. In that app I am using Faceboxes which are working great, unfortunately I am unable to create a jquery UI element in the Face box. If I navigate the page inside Facebox, then the JKI UI works perfectly.

Even so, whatever I have tried, I put it on the page, which contains a Facebox link

  $ (document) .ready (function ( ) {$ ("#progressbar"). Progressbar ({value: 37});});   

I also tried the exact code on the page inside the Facebox

I also tried to do it

  $ (("Value", "#progressbar", function () {$ ("# progressbar"). Progressbar ({value: 37});});});   

The ARB code in the Facebox is

   & Lt; Div id = "progressbar" & gt; & Lt; / Div & gt;   

and the facebox is called like this

  $ (document) .ready (function () {$ ("# userform2"). (Function () {JQuery.facebox ({Ajax: '/ user / award'});});});   

Thanks in advance.

I got a solution, but not good one I just went with creating a separate page in which Only jquery UI element is that then I am loading that page into an iframe inside a faceboxed page.

jquery - Graphically link the principal nav bar with the secondary one -


I am tryig to create a sensitive website. I am in the first stage, in which according to "material first" metodology, Small mobile layout should be considered. Homepage (under construction) is something like this:

my homepage

When a user clicks, for example, a secondary NAV bar on the first icon appears below the principal. View this image (Do not see icon, images are random and temporary):

Secondary NAV Homepage with bar

I want to add two bars in a linear way. I do not know, perhaps with an image like these examples:

Example of a link between Bars  Example of a link between bars

Is this a correct way ? And, this was also a good practice, in this case, how can I keep "link image" independently from screen width? The situation should be based on the status of other elements or perhaps, percentage. It can not be based on a full position. In this case, in fact, changing the size of the screen will cause a glitch in the image below:

</ P> <Pre> <code> & lt ;! DOCTYPE HTML PUBLIC gt; top & gt; & gt; meta http-equiv =" content-type "content =" text / html; Charset = UTF-8 "> gt; Title & gt; Responsive Site & lt; / Title & gt; & lt; link rel =" stylesheet "type =" text / css "href =" css / reset.css "& Gt; link rel =" stylesheet "type =" text / css "href =" css / princstyle.css "& gt; & gt; script type =" text / javascript "src =" js / jquery- 1.9.1.min.js ">

There is a basic messaging system on my site that will send a message in the queue / float at the top of a page. Each message should be faded after the volume of X, but if you rotate that message, it will expire, then it should start again on the mouseover.

That's why I'm trying to attach and attach a diva to erase a timer, but it will get distracted on the mountaineer that it will resume at the fade and mouseover, besides a close button It is also that which will disappear immediately.

I have tried delay () but there is no way to control it and I can not wrap my head setTimeout () To use around because I did not know how to add a timer for that device.

Allows you to specify timer ID in an object within a global radius such as window.timers and You must add it to the mouseover, you want to iterate over all active timers, clear timeout () and a timeline value - the DOM ready timestamp and the timestamp of that mouseover event The difference is the save can save. On mouseout, you set all timers with the timeline value instead of the initial time value.

mysql - Searching Across Multiple Tables -


मेरे ऐप में कुछ पन्ने है, जिसके पास कुछ < em>> गुण पेज एक साथ लिंक किया हो सकता है मैं लिंक के लिए सबसे अच्छा समर्थन खोज करने के लिए अपना डेटाबेस संरचना चाहूंगा जिसमें गुण पन्ने । लिंक्स पृष्ठों का एक संग्रह है और पृष्ठ में कई लिंक्स हो सकते हैं।


इस समय मेरे डाटाबेस स्ट्रक्चर निम्नानुसार है

  पेज: आईडी शीर्षक सामग्री  < ATTRIBUTE: id page_id नाम मान   

-

  LINK: आईडी शीर्षक  

-

  / Code>  

-

  PAGE_LINK: page_id link_id   

तो कहें कि मेरे पास कोई नुस्खा है पृष्ठ नामित 'मैश आलू' और एक सामग्री पृष्ठ नामक 'आलू' जो कि लिंक नामक 'आलू लिंक' में शामिल हैं। 'मैश आलू' में निम्नलिखित गुण हैं - भोजन: डिनर, स्वाद: दिलकश, कठिनाई: आसान, और 'आलू' में विशेषताएं - सीजन: शरद ऋतु, मूल्य: सस्ता है।

मैं एक लिंक खोजना चाहता हूं जो कि सस्ते, दिलकश और शरद ऋतु में मौसम और बदले में मिलता है ' आलू लिंक'


मैं एसक्यूएल में उस प्रश्न को कैसे लिख सकता हूँ और क्या ऐसा कुछ करने के लिए सबसे अच्छा डेटाबेस संरचना है?

आपकी विशेषताओं को पृष्ठों से जुड़ा हुआ है इसलिए, आप उन पृष्ठों की खोज कर सकते हैं जिनके पास विशिष्ट विशेषताओं हैं, यह जांच कर कि उन विशेषताओं को एक पृष्ठ के लिए मौजूद है या नहीं। पन्नों को ढूंढना इस प्रकार दिखाई देगा:

  पृष्ठ से चुनें पृष्ठ.आईडी जहां पर मौजूद है (जहां से * पृष्ठ विशेषताएँ * पेज_आईडी = पेज। आईडी और ((नाम = 'सीजन' और मान = 'शरद ऋतु ') या (नाम =' स्वाद 'और वैल्यू =' सेविरी ') ... आदि ...)   

यदि आप लिंक ढूंढना चाहते हैं, तो आप इस में शामिल हो सकते हैं PAGE_LINK (और यदि आप चाहें तो लिंक के लिए भी)।

  पृष्ठ से चुनें। पृष्ठ से। पेज से जुड़ें। लिंक पर पीएल.पीजी_आईडी = पेज। आईडी लिंक पर जुड़ें लिंक। आईडी = पीएल। लिंक_आईडी जहां (* नाम = 'सीज़न' और मान = 'शरद ऋतु') या (नाम = 'स्वाद' और मान '' सब्ज़री '') ... आदि ... विशेषताएँ से * चुनें।    

jquery - Adding .toggle() to cell content -


I would like to ask, is it possible to attach a toggling () function to a specific and specific cell in jqGrid? It is possible to change the contents of the cell using SetCell, but whatever I have tried, it only changes its CSS properties.

  grid.jgGrid ("setCell", cellId, colName, "", {visibility: 'hidden'});   

Do I have to show / hide / blink my text inside the cell on the grid's comptables?

Thanks in advance.

OK, you can change the color of text on a cell click. It is

It toggles every cell data. You can customize according to your need

jqgrid oncellselect function:

  onCellSelect: function (line, iCol, cellcontent, e) { Var td = $ ("#" + queued) .Find ("TD"); Var reqTd = td [iCol]; If ($ (reqTd) .attr ("class") == 'transp') {$ (reqTd) .removeClass ("transp"); } And {$ (reqTd) .addClass ("transp"); }}   

CSS

  .transp {color: transparent; };    

function - I have two scala projects - basically the same - one works and one does not. Can someone tell me why? -


For the class, we have to make a test-based game in which we walk like the gigantic rooms of old school text games. .

I started by defining the function for different rooms so that it can easily be switched when typed in the room.

This time, the following code works best in REPL, but I want to work all the time:

  def roomOne (): unit = {println ("you Println ("Which door do you want to go through?") Println ("2 doors are: north and west") Var input = readLine ("& gt; & gt;") Subchair match {case "NORTH" => RoomFor () Case "West" = & gt; Roumanine () case "East" => {Println ("You can not go there.") Room one ()} case "south" = & gt; {Println ("You can not go there.") RoomOne ()}}} def roomFour (): unit = {println ("You are currently in cell 4.") Println ("There are two doors: East and South Println ("Do you want to go through the door?"}} Def roomNine (): unit = {println ("you are currently in cell 9") println ("3 doors: north, east and south" ) Println ( "would you like to go through what door?"}} Def startGame (): Unit = {var input = readLine ( "& gt; & gt;") Kupprkas match {case "YES" = & gt; Room one () case "no" => gt; {println ("when you start If you are ready to do, please type \ "yes \".) StartGame ()}}}}}}}}}} "(" ********************************************************************** ************************** **************************************************************** *******) "println (" ************************************************************************************* ************************** **************************************************************** ***************************************** println For some parts? ") StartGame ()   

and the following code does not work at REPL:

  def roomOne (): Unit = {Println ("You are currently in cell 1.") Println ("There are two doors: Short and west ") println (" Which door do you want to go through? ") Var input = readLine (" & Gt; & Gt; ") Ktouprkas match {case" North "= & gt; Rumfor () Case" West "= & gt; Rumnin () Case" East "= & gt; {Println (" you can not be there. " } Room one ()} "south" => gt; {Println ("You can not go there.") RoomOne ()}}} def roomFour (): unit = {println ("You are currently in cell 4 are. ") Println (" two doors: East and South ") Println (" would you like to go through what door? ") Var input = readLine (" & gt; & gt; ") Kuprap case match {case "NORTH"> & gt; {Println ("You can not go there.") RoomFor ()} Case "West" => gt; {Println ( "You can not go there.") Rumfor ()} Case "East" = & gt; Rumfiv () Case "South" = & gt; RoomOne ()}} def roomFive (): Unit = {println ( "You current cell 5 in. ") Println (" three doors: East, South and west ") are println (" which door do you want to Println ( "north, east and south") println ( "how do you door Would you prefer? ")" Diff Roomman "(): Unit = {println (" Are you currently in cell 9 "to go through?")} Def startGame (): Unit = {var input = readLine () "& Gt; & Gt; "). Case Case Match {Case" Yes "=> Case One () Case" No "=> (Println (" When you're ready to start, please type \ "Yes \". ) StartGame ()}}}}}}} println "(" ***************************************************************** "(" *********************** ************************************************** ********************************************** **************************************************************************************************** ************** ************************************************************************************ ************) println ( "Hello Mr. Doafensharmats. what parts to make what Super Dome Inketr are willing to look for it?") StartGame ()   

Can anyone help me? I am trying different things throughout the day and I can not seem to do this work. Why does some work first and does not always? Why does not the second work?

Thank you.

By looking at the pastebine, Pasting your code in REPL. Try it out:

  Scala> Enter paste / paste mode (ctrl-D to end) ... Paste stuff ... ... Ctrl-d    

bash - Reading delimited value from file into a array variable -


I want to read data.txt which has a 2x2 matrix number, is delimited by tab like this:

  0.5 0.1 0.3 0.2   

If this file is to be read in bash, then submit it to an array, then process a little bit and export the file again. Do you? For example in matlab:

  a = dlmread ('data.txt') // To read the file in the array variable i = 1: 2 for j = 1: 2 b [i ] [J] = one [i] [j] +100 end and dlmright (b, 'data2wt') // X-ray x-ray xrayentase value    

< If you have a limited range of processing like adding 100 in each entry, such a simple awk command can be:

/ P>

  awk '{for (i = 1; i & lt; = nf - 1; i ++) {printf ("% .ff% s", $ i + 100, OFS); } Printf ("% .1f% s", $ NF + 100, ORS); } '& Lt; Matrix.txt   

This is only the thief through each line and adds 100. It is also possible to do more complex operations, but better equipment (such as python numpy or octave ) if you really want the top rotation matrix. It is also possible to use bash arrays, but to do any, you have to use an external program, because bash floating point arithmetic Does not handle

sms - iOS MessageUI.h not found -


I want to use an MFMessageComposeViewController to send an in-app SMS and I import messageUI frameworks in my project. But when I use

  #import "MessageUI.h"   

, I told that: MessageUI.h was not found. I do not know why and how can I fix this?

Thank you very much.

frameworks

 error

This syntax: Use this syntax:

  #import & lt; MessageUI / MessageUI.h>   

When you use this syntax, the compiler knows where to look for the header in the question.

xml - Sql server XQuery sql:variable and bit data type -


निम्नलिखित क्वेरी ; & gt; गलत & lt; / s & gt; हालांकि मुझे उम्मीद है कि यह देता है क्या ऐसा करने का एक तरीका है?

  घोषित @b बिट = 0 घोषित करें @ xml xml = '& lt; x & gt; & lt; / x & gt;'; @ Xml.query ('& lt; s & gt; {sql: variable ("@ b")} & lt; / s & gt;' 'चुनें    

<पूर्व> घोषित करें @ बी बिट = 0 घोषित करें @ xml xml = '& lt; x & gt; & lt; / x & gt;'; @ Xml.query ('& lt; s & gt; {xs: int (sql: चर ("@ b")}} & lt; / s & gt;' ') चुनें

< / div>

@Function Annotation in Mule -


I want to use comment in the code @ function {/ code>]. I only know about it

But I can not get good results.

I created a new project, added a Java component, created a new class and copied this code

But I have many errors, I think I have to configure other things but I do not know Neither how do I use the @function And I can.

You need to manually declare an annotation parser in your configuration, so that the annotation is processed Can go

Consider this POJO:

  package com.acme; Import org.mule.api.annotations.expression.XPath; Import org.mule.api.annotations.expressions.Function; Import org.w3c.dom.Document; Public class annotated PO {public expedition (@expath ("/ envelope") final document document, @ function ("uide") last string id) {return "envelope text:" + Doctor.gate document element (). GetTextContent () + "- ID:" + ID; }}   

You can use it with this mule configuration:

  & lt; Spring: Bean class = "org.mule.config.endpoint.RegistryBackedAnnotationsParserFactory" / & gt; & Lt; Flow name = "test annotated pozzo" & gt; & Lt; Http: inbound-endpoint address = "http: // localhost: 8080 / pozzo" exchange-pattern = "request-response" /> & Lt; Component class = "com.acme.AnnotatedPojo" /> & Lt; / Flow & gt; Example call:  
  $ curl -H "content-type: app / xml" http: // localhost: 8080 / pojo -d '&' Lt; Envelope & gt; Foo & lt; / Envelope & gt; 'Envelope text: foo - id: 9133fc7d-a07f-11e2-b560-4d5f883736c4    

Using awk if condition together with in an array condition -


मेरा उदाहरण इस तरह चला जाता है:

  FILE_A एबीसी वसंत 14 60 FILE_B एबीसी   

मैं FILE_A प्रिंट करना चाहता हूं यदि पहले कॉलम मिलान करता है तो FILE_B पहले कॉलम & amp; amp; दूसरा स्तंभ "वसंत" है <पूर्व> awk 'एनआर == एफएनआर {एक [$ 1] = $ 1; अगला}; {If ($ 4 == "वसंत" और एक में $ 5) {प्रिंट $ 0} 'FILE_B FILE_A

यह ठीक काम करता है, लेकिन अगर मैं शर्त जोड़ना चाहता हूं यदि 60- (14-60) & gt; 0 मुझे यह नहीं मिल सकता है

मैंने कोशिश की यदि ($ 4 == "वसंत" और $ 4 - ($ 3- $ 4) & gt; 0 & amp; amp; amp; & amp; amp; amp; amp; $ 5 में) , लेकिन मैं कर सकता हूँ इसे काम न करें

मेरा प्रश्न यह है कि: "सरणी में" स्थिति के साथ awk अगर स्थितियां कैसे करें?

आप सही क्षेत्र संख्याओं का उपयोग नहीं कर रहे हैं और अपने बूलियन तर्क को अस्पष्ट छोड़कर, बस सही क्षेत्र संख्याओं और पैरामान्ज़ेज़ का उपयोग करें: <पूर्व> awk 'एनआर == एफएनआर {एक [$ 1]; अगला} (1 डॉलर में) & amp; amp; ($ 2 == "वसंत") & amp; amp; ($ 4- ($ 3- $ 4)) & gt; 0) 'FILE_B FILE_A

जाहिर है $ 4 - ($ 3- $ 4) कम किया जा सकता है!

security - remember me functionality with specific server topology -


I am implementing the "remember me" functionality for the customer of my product and some stuck with it. Here's what we have:

  • 3 different servers that do not meet each other.
  • A customer whose "Remember me" functionality is required and that is 3 servers in one log.
  • An example that redirects users, does not know anything about authentication or user credentials.

    So can you, please give me how can I "remember me" in my case? Adding passwords in cookies is acceptable, but not desirable

    If you want more information about something, please ask, and I will try to provide it.

    Thanks for everyone for your suggestions!

    This is usually done by all three servers using a normal session storage backend , Such as databases or memcatch

    If you can not easily apply normal sessions, you can adjust the code on the redirect server to store the server's server ID, it was selected to redirect to a cookie. Do not keep a password in any cookie. For example:

      A new hit arrives in the cookie: Next to the cookie indicated in the other server: Choose a random server set cookie with the server ID you chose The code was forwarded to that server    

How do I find the exception type of an exception that gets thrown in C#? -


I am using a library that does not document exceptions. This library is used to communicate with the company's product. I want to be able to differentiate between the exceptions that throw, but I do not know the names of exceptions (for example, between the time period or the under-voltage status of communication).

Use all of their examples only Hold (Exception) What do I need to use to get rid of personal errors, how do I get it? When I do ex.toString () I get something like this:

  System Option: C: \ users \ adam.siembida \ Desktop \ copley_cmo_test \ copley_cmo_test \ MainWindow.xaml.cs: line 41 (time object at CMLCOMLib.EcatObj.Initialize) at copley_cmo_test.MainWindow.btnConnect_Click (Object Sender, Routing Avenger, ARG)  

this:

  System.Exception: timeout   

It shows that they are just throwing a bare System.Exception , for example

  if (we Haveno API Design Skills) {New Exception ("Timeout"); }   

It is possible that such some exceptions that are designed better, but that which you have been shown is not a promise: (

always is a bad idea) you are trapped. Is it possible to ask the authors of the library whether they can improve matters for future releases.

java - How to get file size in KB and MB in android -


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

  • 13 उत्तर
  • 3 जवाब

    मुझे लगता है कि मैं फ़ाइल का आकार प्राप्त कर सकता हूं और इसे KB और MB में बदल सकता हूं

      562 KB = 562 KB 1024 KB = 1 MB 2152 KB = 2.15 MB   

    आपको पहले से धन्यवाद।

    यहां यह है:

      सार्वजनिक स्ट्रिंग आकार (पूर्णांक आकार) {स्ट्रिंग एचआरसिज़ = ""; डबल एम = आकार / 1024.0; दशमलवफल डीक = नया दशमलवफल ("0.00"); अगर (एम & gt; 1) {hrSize = dec.format (मी) .concat ("MB"); } Else {hrSize = dec.format (आकार) .concat ("KB"); } रिटर्न एचआरसिज़; }   

    स्रोत:

c# - stream.read gives corrupted bytes -


  एचटीटीपी वेब रिस्पांस प्रतिक्रिया = (एचटीटीपी वेबबेंस) अनुरोध। गेटरेस्पॉन्स (); स्ट्रीम स्ट्रीम = प्रतिसाद। गेटरेस्पॉन्सस्ट्रीम (); Int sizeToRead = (int) response.ContentLength; Int sizeRead = 0; इंट बफर = 1; बाइट [] बाइट्स = नया बाइट [आकार टयोराइड]; जबकि (आकार रीडर & gt; 0) {int rs = sizeToRead & gt; बफर? बफर: साइज रीडर; स्ट्रीम। बाइट (आकार, आकार, रीड, आरएस); SizeToRead - = आरएस; SizeRead + = आरएस; } स्ट्रीम। बंद करें (); System.IO.File.WriteAllBytes ("c: \\ tmp \\ b.mp3", बाइट्स);   

मेरे पास कोड का उपरोक्त भाग है इसका उद्देश्य किसी एमपी 3 फाइल को कहीं से डाउनलोड करना है और उसे c: \ tmp \ filename में सहेजना है। और यह पूरी तरह से काम करता है।

हालांकि, अगर मैं बफर आकार को कुछ नहीं 1 में बदलता हूं, तो 512 कहें। डाउनलोड की गई एमपी 3 फाइल लहराती होगी। मैंने अपने प्रोग्राम द्वारा ब्राउज़र द्वारा डाउनलोड किए गए फ़ाइल से डाउनलोड की गई फ़ाइल की तुलना की है, मुझे पता चला कि मेरे प्रोग्राम द्वारा डाउनलोड की जाने वाली एमपी 3 फाइल के कुछ बाइट्स 0 पर सेट होते हैं (उनके फ़ाइल आकार समान हैं)।

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

तो, मुझे लगता है कि समस्या स्ट्रीम रीडर या पढ़ने की प्रक्रिया के अंदर है क्या किसी को पता है कि ऐसा क्यों होता है? और बफर आकार को 1 के बिना सेट किए बिना इसे कैसे हल किया जाए?

एक वापस आ जाता है जो आपको बताता है कि कितने बाइट थे वास्तव में पढ़ें यदि आप किसी धारा से काम कर रहे हैं तो आप उस जानकारी में बेहतर ढंग से लेते थे और उस पर कार्य करते थे।

इसे किसी अन्य तरीके से रखने के लिए, सिर्फ इसलिए कि 2 बाइट के लिए पढ़ें, इसका अर्थ यह नहीं है कि आपके बफ़र में 2 वैध बाइट्स हैं।

यदि आपको एक विशेष संख्या में बाइट्स प्राप्त करने की आवश्यकता है (जो आप जानते हैं), तब तक आपको लूप चाहिए जब तक कि आप उस नंबर को प्राप्त नहीं करते बाइट्स।

sql - Conditional DataGrid formatting Colors -


Ive got a Datagrid population with a figure. I want to change the display font color for a whole line where the fifth column (in the column name is SQL = DDLS_NIM) is greater than 3.

  Using Conn as SqlConnection = New SqlConnection (ConnectionString) Con. Open () using SQL Commands = New SQL Commands (SQLite, Conn) Diamond RS SQL Contributor = com. Exeter Reader DMTT Datatable = New Datatile DT. Load (RS) dataGDX Datasource = DT 'if the 5th column [or column name] is value & gt; = 3 then 'Data Grid View 1. ROS [5] [or column name?]. Default sealestyle.ar caller = color. ' I think you have to do this in a process called 'End and End'. Conne & Technology / Div> 

P>

  Private Sub DataGrid View 1_ROPrint (ByVal System, as byVal E. System.Forms.DataGridViewRowPrePaintEventArgs), if DataGridView1.Rows (e.RowIndex). DefaultCellStyle.Fo ReColor = Color.Red End if End Sub    

c# - printdocument printing issue only prints first page -


The list should be able to print all the items in the view, so that with the column name:

start : (Date) expiration: (date) shift: (change number) sales: (sale)

and it prints completely what I want, but this is only the first page (or the first 12 listings Lines of view. However, if I send a notification in a message box, it sends all the list view content, I do not understand this due to the print but I can not understand it.

  Private Zero btnPrint_Click (Object Sender, EventArgs E) {PrintDialog PD = New PrintId (print), print Document MyPrintDocument = New Print Document (); MyPrintDocument.PrintPage + = New PrintPageEventHandler (this.PrintPageEvent); pd.PrinterSettings.PrintRange = PrintRange.AllPages; MyPrintDocument.PrinterSettings.PrintRange = PrintRange.AllPages; MyPrintDocument.Print ();}} Private Zero PrintPage Event (Object Sender, PrintPageEventArgs ev) {string text = null; For (int i = 0; i & lt; listView4.Items.Count; I ++) {text + = "Start:" + listView4.Items [i] .ext + Environment.NewLine + "End:" + listView4 Items [i] .SubItems [1]. Text + Environment.NewLine + "Shift Number:" + ListView4.Items [i] .SubItems [2]. Text + Environment. NewLine + "Total Sales:" + List View 4. ITEMS [i] .SubItems [3]. Text + environment. NewLine + "---- ------------------------" + Environment. new line; MessageBox.Show (text); Font mifant = new font ("ariel", 12); Ev.Graphics.DrawString ("------------------------------------" + Environment. NewLine + Text + EnvironmentalNewLine + "------------------------------------", MyFont, New SolidBrush (system Droping color black), (EvePabons. Left), Eve PagesBonds.Tap); }    

Assigning you to PrintPageEventArgs.HasMorePages = true Should print multiple pages, therefore, in your case, you just have to do this

  ev.HasMorePages = true;   

PrintPageEventArgs.HasMorePages property -

  • Indicates whether any additional pages should be printed or not.
  • returns true if any additional pages should be printed; Otherwise, the false
  • is the default false .

Visual Studio treat custom extension as CSharp -


I have files with a custom extension. MSCX which is actually a CSRP file, I have to complete these files in Visual Studio 2012, but these files are considered as plain text when I call them VS. I open in

I have tried to create custom MEF extensions, which allow me to treat files as content-type based on CSSRP, but I do not have autocomplete or code formatting for these documents Are getting. I may need to open a custom CSHP classifier for my custom content type, but I'm not sure. Can anyone help?

The custom content type is below:

  Fixed class ContentType {public const string name = "cscript"; [Export] [Name (name)] [DisplayName ("CSHRP script")] [BaseDefinition ("CSHRP")] Public Static Content Type Definition CSharpContentType = null; [Export] [Content Type (Name)] [File Extension (".mcsx")] Public Static File ExtensionTontent Definition CSharpFileExtension = null; }    

Thank you for 'ego' on VS forums:

You can add custom extension file through the following way:

For more information about registering language services, please see:



What does .between? method means in Ruby? -


I have a school practice and I can not solve it. Can you help me? The problem is:

Try using a method that takes two arguments - use the middle? The method of determining whether the number is between 2 and 1.

I tried to know that .between? What is the method? I know this is a method

method, and you can use it like this:

  2.between? (1, 3) # = & gt; True    

java - android.os.NetworkOnMainThreadException error even when running in AsyncTask -


While trying to connect me to the Internet, Android met. NetworkMonthandThreaded Expression error is occurring. I know that the above versions of Android (after Honeycomb) do not allow you to do Network IO on the UI thread, so I am using Ascot on the code. There is no error, but when it runs, then Android OS. Networks Onthatus Exception Error Code: Public Zero (Bundle Saved InstantState) on Creating {super.onCreate (SavedInstanceState); SetContentView (R.layout.mainactivity); New GetProductDetails () carry about (); } Class GetProductDetails asyncTask and lt; String, string, string & gt; {/ ** * Show progress dialog before starting background thread * * / @ Override Preserve Zero on PreExecute () {super.onPreExecute (); PDialog = new progression Diolog (main activity.); PDialog.setMessage ("Please wait while loading product details ..."); PDialog.setIndeterminate (wrong); PDialog.setCancelable (true); PDialog.show (); } / ** * Get product details in background thread * * / protected string doInBackground (string ... parameter) // // Update OD from background thread run ONUTHHADD (NEW RUNNABLE) (public wired run) {// success For Tag Ent Success, // {} Building Parameter List & lt; nameValuePair & gt; Parameters = New Array List & lt; nameValuePair & gt; (); params.add (New BasicNameValuePair ("pid", pid) ); // Receiving product details by requesting HTTP note that the product The URL will use the GET request JSONObject json = jsonParser.makeHttpRequest (url_product_details, "GET", params); // Check your log for json feedback logs ("Single Product Details", json.toString ()); // Json success tag success = json.getInt (TAG_SUCCESS); if (success == 1) {// successfully get product object before product description JSONArray product Obj = json .getJSONArray (TAG_PRODUCT); // JSON Array // JSON Array JSONObject Product = Products Obj.GadgetsSONObject (0); TCTNM = (Edit Text) FindUBID ( Rkaid.ankprogram); TSTPRICR = (edit text) Find VVBIID (R.I.InProp.); TxtDesc = Find (edit text) VVBIID (RIDINPDC); Product data displayed in // EditText txtName.setText (product.getString (TAG_NAME)); TxtPrice.setText (product.getString (TAG_PRICE)); TxtDesc.setText (product.getString (TAG_DESCRIPTION)); } Else {product with pid not found}} hold (JasonXExation E) {E.PintstacksTrace (); }}}); Return tap; } / ** * Dismiss progress dialog after completing background work ** ** / Protected void onPostExecute (string file_url) {// Dismiss dialog once all pDialog.dismiss () got found; }}

I have read that its possible solution is using the Strictcode policy, but I am reluctant to use it because it is only recommended in the development environment. What is the problem here?

What's the problem here?

From runnab to runOnUiThread () .

, RunOnUI and Fread () and Runnabal . Place the network code in doInBackground () . Update your code to onPostExecute () . You pass data from doInBackground () to onPostExecute () from doInBackground () return value (which is OnPostExecute () < / Code>) or data member from inside asyncTask .

c - Change stack space -


Currently, I am trying to implement the shared stack in the cluster system. This system has two address spaces, shared between a private and all processor.

How can I change the start and end of the stack in C programming?

That is, I stack in a shared space and use it to change the flow of the program.

My advice is: If you do this by stacking objects based on all objects from the point of view, If you do, the thread that sends you is never required to return to the function, which is the probave already created a shared object that another thread has created that object anyway now Is not going to reach. It is a) next to impossible, and b) will need to kill performance locking. The consequences of failure to do it correctly will be totally immoral bugs! Do not do this!

I advise the Molok all objects that leave the context of a thread and use the thread on it to use the safe reference count. You can also look at a look at threaded secure shared data structures like queue, two linked lists, etc.

Java reflection with unique id -


I am trying to create a hashmap that its keys are unique IDs and the value is the name of the squares found by reflection is.

My problem is to create those unique IDs. How can I be strong that each class has unique ID, and this ID will never change. I mean, if I create a new class, it will never replace old class ID.

UPDATE
I need that the ID will be an integer number. (Sorry I have not mentioned this: P)

It guarantees to be completely unique But using the fully qualified class name should be enough. The full path of the string , such as java.lang.Math will be a good "unqiue" id, and should rarely be a hash collision.

Example

  map.put (MyClass.class.toString (), MyClass.class);   

Edit: If you need required , this is an integer, you can always use string hashod

  Map.put (MyClass.class.toString () .hashode (), MyClass.class);    

cordova - How to upgrade Android Phonegap 2.7.0 to 2.8.1 -


In the past, the upgrade of PhoneGap was created to create a new project and duplicate various files. Now the instructions say "Cordoba source Run bin / update with the project path listed in the directory. " Okay, how can I do this?

I have tried to:

  cd / path / to /phonegap-2.8.1/lib/android/bin.//Path/ to / MyProject / Cordova: File exists an unexpected error:     Mkdir "$ PROJECT_PATH" / Cordoba 1    

I was not working on Windows 7 and the update script was working for me - so I did it manually as it did with 2.4 .0 & gt; 2.5.0 (which is the last known manual update details). Does it work.

Hope it helps. There is a link to update the guide.

PS I was updating from 2.5.0 to 2.8.1.

Java regex possesive quantifiers -


इस regex को देखते हुए:

  x [^ x] * + x   

और मिलान करने के लिए यह इनपुट स्ट्रिंग:

  xbbbx   

परिणाम मिलान टेक्स्ट है xbbbx इंडेक्स 0 से शुरू होने और सूचकांक 5 पर समाप्त होता है।

लेकिन, केवल regex और स्ट्रिंग दोनों में अंतिम अक्षर x से Z को बदलकर, हमें यह regex मिलता है:

  x [^ x] * z   

और यह इनपुट स्ट्रिंग:

  xbbbZ   

और इसका नतीजा यह है: कोई मेल नहीं मिला

एक पत्र में बदलाव व्यवहार में यह परिवर्तन क्यों दिखाएगा?

इसका कारण यह है कि आप "स्वैच्छिक" क्वांटिफ़ायर का उपयोग कर रहे हैं जो कि जितना प्रतीक प्रतीक होगा कर सकते हैं।

तो इस मामले में xbbbZ के साथ regex x [^ x] * + लाइन के अंत तक सभी गैर एक्स वर्णों से मेल खाता है, जहां यह बंद हो जाता है यह पहले से ही इनपुट xbbbZ के अंदर "Z" का सेवन किया है। यह regex, x [^ x] * + x , के साथ काम करता है < कोड> एक्सबीबीबीएक्स क्योंकि x तक पहुंचने पर रोक देने के लिए "स्वैच्छिक" क्वांटिफ़ायर है । आपके इनपुट के अंत में एक x होता है, और इसलिए स्वत्वशील क्वाण्टिफायर बंद हो जाता है। यह regex x के अंतिम भाग को x से मेल खाने की अनुमति देता है।

जावा के अंत में, आप एक अन्य उदाहरण देख सकते हैं स्वैच्छिक क्वांटिफायर।

Using VIM effectively with Ruby/Rails -


I've recently been using VIM as my preferred editor, but still I'm still on Sublime Text 2 Much productivity has not been found. I have read half of the book "Partial Vim" and have obtained the OT at that point where I am in almost normal mode instead of inclusive mode. Sometimes using visuals.

My Vime Plugins are as follows:

  one ???? Depot-app Git: (master) ls -l ~ / .vim / bundle Total 84 drwxrwxr-x 5 Richard Richard 4096 Jun 9 17:31 bufexplorer drwxrwxr- x 4 Richard Richard 4096 Jun 8 23:48 jacinto.vim drwxrwxr-x 5 Richard Richard 4096 Jun 8 23:41 nerdcommenter drwxrwxr-x 9 Richard Richard 4096 Jun 8 23:39 nerdtree drwxrwxr-x 8 Richard Richard 4096 Jun 8 23:43 syntastic drwxrwxr-x 6 Richard Richard 4096 Jun 8 23:51 vim- bundler drwxrwxr-x 11 Richard Richard 4096 Jun 8 23:47 vim- coffee script drwxrwxr-x 5 Richard Richard 4096 Jun 8 23:30 vim- commentary drwxrwxr- x 4 Richard Richard 4096 Jun 8 23:35 vim- along drwxrwxr- X 5 rich r Chard 4096 Jun 8 23:39 vim- eunuch drwxrwxr-x 8 Richard Richard 4096 Jun 8 23:46 vim-haml drwxrwxr-x 6 Richard Richard 4096 Jun 8 23:45 vim-markdown drwxrwxr-x 6 Richard Richard 4096 Jun 8 23 : 51 vim- rail drwxrwxr- x 4 Richard Richard 4096 Jun 8 23:36 vim- repeat drwxrwxr-x 13 Richard Richard 4096 Jun 8 23:50 vim- ruby ​​drwxrwxr-x 8 Richard Richard 4096 Jun 8 23:52 Vim-ruby -refactoring drwxrwxr-x 6 Richard Richard 4096 Jun 8 23:35 vim-SpeedDating drwxrwxr-x 5 Richard Richard 4096 drwxrwxr-x Jun 8 around 23:37 vim- 6 Richard Richard 4096 Jun 8 23:53 vim-textobj-rubyblock Drwxrwxr-x6 Richard Richard 4096 8 Jun 23:51 vim-textobj-user dr Wxrwxr-x 5 Richard Richard 4096 8 Jun 23:38 Vim-unused   

In classic text 2, I could suppress Alt +. To quickly close any html tag, there is also a binding to enclose a line with quotation marks, or lift;% =%> And keep the cursor in the middle so I do not have to write the ERB tag myself, then there is a lack of autocomplete, but I can stay at least without it.

How can I accomplish these things in Vima?

Note: The latest version of VIM from the Ubuntu repositories

Vim has a complete completion mechanism with different requirements: keyword-completion, line-completion , Filename-integer | | And Omni-perfection, what you probably want. VIM auto --completion does not, but there are several plugins that provide functionality: ,, |? | | | |

Before trying those plugins, D suggest that you read : New omni-completion (and related pages) and learn how to use the built-in mechanism Please. & lt; C-x & gt; & Lt; C-O & gt; Obviously neither auto -matic nor very comfortable, but it is easy to reprint for some more work.


You are already around: this is what gives you around (hint) with text quotes and more what you want, now, is in read this is the shortcut that you use to surround the current line with double quotes:

  yss "  iabbrev etag & lt;% =%> 
left & gt;
  The object can be done relatively easily with condensation ( : Support Notation ):   

Omni-above mentioned Can be used to close the HTML tag but it is not really optimal. I use SnipMate to insert tags, but there are a lot of tag-closing plugins in it. / P>

As a matter of fact, that problem and attachment can be easily solved by the same plugin.

Good luck.

javascript - how to prefetch / cache iframe content? -


I have an iframe and the content takes some time to come back. I can not use iframe, so I am thinking that if I can do some way:

  1. Cache the content, so that when I come back to the page, it is very fast Will load from.
  2. Prefetch the page on which it has IFrame. Here I go to & lt; Link rel = "prefetch" href = "... ..." /> , but it seems that there is no effect on iframe

    Any ideas how to solve this issue? Can a Front End or Back and Solution be?

    Loading the iframe content creates the browser cache in it, if you load it later , The browser will easily fetch it from the cache, as long as your server is always set to not load new content. I suspect that if you are seeing it every time you reload the page of the iframe again, then you have either forgotten to indicate that the page should be cached for how long, or your server Not set to say "This page has not been modified since ..." The browser does not attempt to reload the page, or the page is served with a header indicating that it does not cache Or can be.

    (If you want to preload the material for the first time, it is that same thing as if it is loading in the iframe, iframe is hidden, and Showing when the IFrame content is created.)

ruby - Retrieve comments and replies with Koala gem -


Maybe this is a stupid question, but how to get comments and replies from the Facebook profile page (last 50)? For example: api.get_connections ("depechemode", "posts") (or feed ) give me comments only. Do I really have to make another request for every comment to get the answer? What's the better way to get all the responses (comments + answers) from posts?

I tried FQL with "googled" instances, but without success ...

UPDATE: I can get comments with + post api.get_connections (Post_id, "comments" ,: filter = "stream") but what is the other option?

I will answer

By itself:

graph.get_connections ("askdotcom", "posts" ,: fields = & gt; "message, id, created_time, comments.fields (comments.fields ( Message, from) message, from)) ")

had to play with the bus

python - Why do Flask Extensions exist? -


Take SQLAlchemy as an example.

Why should I use the flask SQLLM extension instead of normal SQLAlchemy module? What is the difference between them? Is not it possible to use normal modules in your flask app?

Extensions are present Increase the functionality of the flock, and for the typical use patterns, Reduce the volume, such as solidifying your application with SQLLame in flask-skeletalmi, or login with flask-login. Generally, only clean, reusable ways to do general things with web applications

but I see my point with Flask-Squalmy, it's actually a lot more code to use Not a saver, but it automatically gives you a scaled session, which is essential for you in a web environment with SQLite.

Other extensions like flask-long actually save you a lot of boilerplate code