Friday, 15 April 2011

c - test if strstr return a valid pointer -


I am trying to use the strstr function like this:

  const char * PInicio = Strust (original, bite); If (pInicio! = NULL) ...   

Unlike expected, when I perform "if" the compiler throws an access status violation exception. It happens every time, I try to get some key words that do not exist from the string.

The call stack is:

  ntdll.dll! 779315de () [OS Quadros Abaixo podem estar estretos E / ou ausentes, Nenhum Sambolo Foi Carregado ntdll.dll] ntdll.dll 779315de () ntdll.dll para 7792014e ()>! ! Msvcr100d.dll _output_l (_iobuf * stream, const char * format, localeinfo_struct * plocinfo, char * argptr) Linha 2361 + 0xA bytes C ++ cccccccc ()   

was produced: Exceçà £ O Primeira chance them 0x0f8620a7 (msvcr100d.dll) No TestesApp.exe: 0xc0000005: Violaçà £ ode acesso Ao ler o Local 0x00000001 Exceçà £ o sem-tratamento them any TestesApp.exe 0x779315de: 0xc0000005: Violaçà £ ode acesso Ao ler o Local 0x00000001 Before the exception, the variable values ​​were:

  1. chave: 0x00196f64 "$ GNGSA" type: char *
  2. Origem: 0x00196840 "$ GPRMC, 0,00,651.082, 191,210 ,,,,,,,, ,,,, * 4F $ GPGGA, 000652.0 9 1 ,,,,,,,,,, M, 0.0, M, , 0000 * 5F $ GPGSA, A, 1 ,,,,,,,,,,,,,,, 1 e "type: const char *
  3. pInicio: 0x00000000 illegal & gt; Type: const char *

    The linker is the command line:

      / OUT: "c: \ user \ lindro \ document \ visual studio 2010 \ projects \ TestesApp \ debug \ TestesApp.exe "/ INCREMENTAL / Nologo" kernel32.lib "" user32.lib "" gdi32.lib "" winspool.lib "" comdlg32.lib "" advapi32.lib "" shell32.lib "" ole32 lib "" oleaut32.lib "" uuid.lib "" odbc32.lib "" odbccp32.lib "/ MANIFEST /ManifestFile:"Debug\TestesApp.exe.intermediate.manifest" / ALLOWISOLATION / MANIFESTUAC: "class = 'asInvoker' uiAccess = 'False' / debug / PDB: "C: \ Users \ Leandro \ Documents \ Visual Studio 2010 \ Projects \ TestesApp \ Debug \ TestesApp.pdb" / Subsystem: Console / Pig Eedi: "C: \ Users \ Leandro \ Documents \ Visual Studio 2010 \ Projects \ TestesApp \ Debug \ TestesApp.pgd" / TLBID: 1 / DYNAMICBASE / NXCOMPAT / MACHINE: X86 / ERRORREPORT: queue   

    There is also a C / C + command line

      / zi / Nologo / W3 / WX- / OD draft / Oy-/ D "WIN32" / D "_DEBUG" / D "_CONSOLE" / D "_UNICODE" / D "Unicode" / GM / Iacssi / RTC 1 / GS / fp: precise / Jesse: Wchar_t / Zc: ForScope /Fp"DebugTestesAppkpch "/ FA" debug \ "/ Fo" Debug \ "/Fd"Debug\vc100.pdb" / Goals Difference / analyze- / errorReport: Queue   

    After this, I want to test the pointer Try if it is clear that it is my problem, how to solve it?

    Best regards!

    Your bug can not duplicate what I've tried here:

     < Code> int main (int argc, char ** argv) {char * chave = "$ GNGSA"; Constant four * origem = "$ GPRMC, 000651.082, 191,210 ,,,,,,, ,,, n * 4F $ GPGGA, 000652.0 9 1 ,,,,,,,,,, m, 0.0, m ,,,, 0000 * 5 F $ GPGSA, A, 1 ,,,,,,,,,,,,,,, 1E "; Const char * pInicio = strstr (original, bite); If (PINCIO! = Null) {printf ("got it \ n"); } Return 0; }   

    This Visual Studio 2010 compile and runs without error. It does not match in any way. I'm open to making instructions for making bugs to adjust it.

    - Edit -

    Set the compiler command line to: / ZI / nologo / W3 / WX- / OD / Oy- / D "WIN32" / D " _DEBUG "/ D" _CONSOLE "/ D" _UNICODE "/ D" Unicode "/ g / EHsc / RTCl / GS / fp: precise / Zc: wchar_t / Zc: forScope /Fp"Debug\odt.pch" / FA " Debug \ "/ fo" debug \ "/Fd"Debug\vc100.pdb" / Goals difference / analysis- / errorReport: line

    linker command line: / OUT: "E: \ code \ odt" \ Debug \ odt.exe "/ INCREMENTAL / Nologo" kernel32.lib "" user32.lib "" gdi32.lib "" winspool.lib "" comdlg32.lib "" advapi32.lib "" shell32.lib "" ole32.lib "" Oleaut32.lib "" uuid.lib "" odbc32.lib "" odbccp32.lib "/ MANIFEST /ManifestFile:"Debugoodt.exe.intermediate.manifest" / ALLOWISOLATION / MANIFESTUAC: "level = 'a SInvoker 'uiAccess =' ​​false '"/ debug /PDB:"E:\code\odt\Debug.odt.pdb" / subsystem: console / pgd: "e: \ code \ odt \ debug \ odt.pgd" / TLBID : 1 / DYNAMICBASE / NXCOMPAT / Machine: X86 / ERRORREPORT: Queue

    Even with both the command line basically the same, I'm still getting no error. I do not know what to say, sorry.

wpf - Visual Tree Finder is returning null while searching for Data Grid -


I have a tab control in which there are several tab items, I calculate the data grid item while closing tab gates. For the first time it works fine (I mean walk first). After closing a tab item, DTG is zero in selling second frequency. Does anyone know why this is happening? I am in the subject that this UI is a problem, layout is not being refreshed. Please help me or show directions.

  while (tc.HasItems) {TabItem ti = tc.selectedItem TabItem; If (Tiwari == "Ð ?? Ñ ?? оÐ'Ð ° жР°") {Microsoft.Windows.Controls.DataGrid sellDtg = FindChild & lt; Microsoft.Windows.Controls.DataGrid & gt; (TC, "SellDataGrid"); If (sellDtg.Items.Count> gt; 0) {Sell sl = new Sell (); If (Sell.basketfromSellDateListBox == incorrect) {sl.ClearBasket (sellDtg); Sell.ClearFromSellBasket ((int) sellDtg.Tag); }}} If (TI! = Null) TC ITEMS. Rev. (TI); }   

Thanks advance!

I did LogicalTreeHelper in a simple analog for FindHildLogical The function is written:

  Public Fixed T FindChildLogical & lt; T & gt; (DependencyObject parent, string childName) where T: dependency object {if (parent == zero) returns to the return; Var kids = LogicalTreeHelper.FindLogicalNode (parent, childName); Return (t) children; }   

And you say it in this form:

  Microsoft.Windows.Controls.DataGrid sellDtg = FindChildLogical & lt; Microsoft.Windows.Controls.DataGrid & gt; (Ti, "SellDataGrid");   

I hope you will be there where you want to.

Outputing backslash in a C++ macro -


Is macro possible to write in C ++, which will return the after extension backslash?

I am currently using a code:

  # SOME_ENUM (XX) \ xX (first value), \ xX (second value), \ xX (some Other value = 50) \ XX (OneMoreValue, = 100) \   

But I want to write a macro, which will generate the above code, so I want to be able to write:

  ENUM_BEGIN (name) // It should be output: # DEFINE SOME_ENUM (XX) \ ENUM (ONE) // It should be output: XX (ONE,) \ // ...   

but I'm not able to write a macro like ENUM_BEGIN Was it because it should finally expand to something with backslash, is it possible in C ++?

No, this is not possible. According to the translation phase 2, described in ISO / IEC 14882: 2011 (E), this will be § 2.2.1.

The example of each backslash character () is immediately removed after a new line character is removed, separating the physical source lines to create logical source lines. Only the last backslash on any physical source line will be eligible to be part of this kind of sacrifice. If, as a result, a character sequence that matches the syntax of a universal-character-name, is produced, behavior is undefined. A source file that is not blank and that does not end in a new-line character, or that ends immediately after a backslash character of such type of partition that ends in the character of a new line, processed it As if an additional new line line was added to the file.

What will be actually \\\ n (where \ n is physically in the source, not an escape) Will be considered as a \ character, followed by a line benzene, the remaining \ can be in a syntax error (there may be situations where it is legal , But I no longer see it in any way), and during the subsequent translation steps the line is not treated as benzene (line different There is only a step # 2).

image - Is there a equivalent of Android's BitmapFactory.Options isDecodeBounds for TIFF in Java/JAI? -


I am trying to improve the performance of my system (a Java app running in Tomcat) and now a barrier In operation, we need the dimensions of TIFF images to read and read, so we use the JSD ImageDecoder and ImageDecoder decoder = ImageCodec.createImageDecoder ("TIFF", input, The ultimate); RenderedImage r = decoder.decodeAsRenderedImage (); Int width = r.getWidth (); Int height = r.getHeight ();

By sampling data, much time is spent in createImageDecoder. My assumption (without going to ImageCodec's source code) is it possibly trying to decode input stream

Coming from Android land, I'm hoping that BitmapFactory.Options Similar to the installation of .inJustDecodeBounds = true , there is a solution similar to the direct explanation, but there is no luck finding any other library so far. (I know that hard support on Android is missing in AOP, but it is a matter of another day.)

Anybody knows this library which does this? Or is there any way to achieve the same goal of using Jai / IdiIio?

It seems that the groups of this information together in a title, so that you Can read:

  Private static dimensions getTiffDimensions (InputStream tiffFile) throws IOException {readableByteChannel channel = Channels.newChannel (tiffFile); Bytebuff buffer = Bytebuffer.Olock (12); Balrade (channel, buffer, 8); Byte endian = buffer.get (); If (endian! = Buffer.get () || (endian! = 'I' and endian! = 'M')) (new iOxation ("not a quarrel file.");} Buffer.scer (endian == ' I '? Byteorder. LittelIne: Byteorder. BigADIN; if (buffer.Tet!) = 42) {New IOXation ("No Tiff File."); } // Go to the first image directory. Note that we have already read 8 bytes. TiffFile.skip (buffer.getInt () - 8); Int width = -1; Intensity height = -1; // The first two byte fields of IFD are the number of bytes. Balrade (channel, buffer, 2); (At field count = buffer.Tet (); field count & gt; 0 & amp; amp; amp; amp; amp; amp; amp; amp; amp; & amp; (width & lt; 0 height & lt; 0); -fieldcode) {forceRead (Channel, buffer, 12); Switch (buffer.at ()) {case 0x0100: // image width width = refill (buffer); break; Case 0x0101: // image "length", height of height = reading field (buffer); break; }} Return new dimensions (width, height); } Private stationary zero force reads (readable channel channel, byte buffer buffer, int n) throws IOException {buffer. (0); Buffer.limit (n); While (buffer HSrmaning ()) {channel.read (buffer); } Buffer. Flip (); } Private Static Integrated Field (byte buffer buffer) {int type = buffer.getShort (); Int count = buffer.getInt (); If (calculation! = 1) {new runtime expedition ("expected to count 1 for given field."); } Switch (type) {case 3: // word reffer buffer.tat (); Case 4: // Int Refer Buffer.GetInt (); Default: // char (not used here) Return buffer. Gate () & amp; 0xFF; }}   

I tested it with some different quarrel files (black and white color with transit, encoded length) and it works fine. Depending on the layout of your TIFF file, it needs to read a lot of streams before getting the size (one of the previously tested files, saved from Apple's preview, at the end of the file was this) Could.

Generating really big Java code -


I have to fill ~ 20k underlying function and constant with a list of CHM files. First of all I tried to list them, but deserialization takes 1500ms (too early to get code-complete, even on the first hit).

Tried the code generation using string templates, which generates valid code. But this will not compile because the "initEnums () method exceeds the size limit of 65536" (and my eclipse ends soon)

The generated method looks like this:

  Public XModelField [] initEnums () {New XModelField {New XModelField ("Aname", "aType", ...), ... // approximately 4'000 more entries}; }   

If this limit is limited to source code, then I can use another library to generate a class file (maybe codemodel) directly. I would like to keep my code, if possible, any suggestions without rewriting the output generator again from scratch?

I think you should reconsider your strategy, model your data structures and methods accordingly and You do not need to generate code. Instead of generating Java code for 4000 constants, store your data in a file or database and write that data to read that data in the initial time to fill a list with your data object.

Generating code is a powerful tool, but you should use it carefully. I do not think it is also necessary for your use case, but if you think that this is it, you can try to reduce the portion of the code so that to keep things simple, there is a minimum minimum Possible. Often you can extract a lot of generic codes in an intangible superclass so that you only have to code for some methods in subclasses. And generating codes for 4000 constants is really unnecessary, keep the data in the form of data and dynamically work on your data.

backbone.js - Should all Backbone on/off events be replaced with listenTo/stopListening? -


जहां तक ​​मैं बताता हूं, listenTo और stopListening क्रमशः पर और बंद को बदलना चाहिए। क्या मैं सही ढंग से समझता हूं? क्या listenTo / stopListening के बजाय पर बंद का उपयोग किया जाना चाहिए, जहां कोई भी स्थिति है < P> संपादित करें:

जैसा कि मैंने अपने कोड को रिफैक्टर चलाया, यह स्पष्ट हो गया कि पर के लिए कुछ कोड हैं listenTo । यह बहुत स्पष्ट है कि जब एक ऑब्जेक्ट अन्य ऑब्जेक्ट को सुनता है:

एक ऑब्जेक्ट को किसी विशेष घटना को अन्य ऑब्जेक्ट।

इसलिए, जब कोई संग्रह या मॉडल एक घटना को अपने आप सुन रहा है, तो हमें listento के बजाय पर

मान लें कि मुझे यह सही है ...

का पालन करने के लिए सरल नियम यह है: < / Strong>

किसी अन्य ऑब्जेक्ट पर ईवेंट्स को सुनते समय listenTo का उपयोग करें।

अधिकांश भाग के लिए पर का प्रयोग करें। आप इसे सही ढंग से समझते हैं इस मामले पर उनके गिथब रिपॉजिटरी से चर्चा है:

listenTo और stopListening राज्य का ट्रैक रखें यह थोड़ी सी कोड ओवरहेड की लागत पर आपके लिए सफाई का ख्याल रखेगा। बस के बारे में हर मामले में मैं सोच सकता हूँ कि आप अपने विचारों के लिए यह व्यवहार चाहते हैं, लेकिन आप खुद को / बंद कॉल को संभालने के लिए गलती नहीं करेंगे; वे को और बंद किसी भी समय जल्द ही नापसंद करेंगे।

PHP, regex, and capitalization -


I need to capitalize in my Rex Capture / matches, say that I want to capitalize the first letter after a hyphen, My Reggae will be something like this:

- (.)

And my replacement string should be something like this:

- In

preg_replace , I have something like this:

$ string = preg_replace ('/ - (.) / ',' - \ 1 ', $ string);

But this Preg_replace (and I do not think it helps in changing the case in a backfirst) Suggestion: < P>

You can use it like this:

  $ string = Preg_replace_callback ('# (? & Lt) ; = -) (.) # ', Create_function (' $ matches', 'return strtoupper ($ matches [1]);', $ string);   

Or, with an anonymous function (using PHP ver> gt; = 5.3.0):

  $ string = preg_replace_callback (' # (? & Lt; = -) (.) # ', Function ($ matches) {return to stropper ($ matches [1]);}, $ string);   

Live demo:

About javascript function -


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

  • 3 जवाब

    मुझे एक अजीब व्यवहार मिला जावास्क्रिप्ट:

      फ़ंक्शन () {वापसी 10; } ();   

    यह निर्माण सभी ब्राउज़र पर काम नहीं करता है क्योंकि इसमें एक वाक्य रचना त्रुटि है लेकिन यह निर्माण कार्य करता है (रिटर्न दस):

      + फ़ंक्शन () {वापसी 10; } ();   

    क्यों?

    + जेएस इंजन इस फ़ंक्शन अभिव्यक्ति और फ़ंक्शन परिभाषा के बीच का अंतर बना देता है।

    अधिक पठनीयता के लिए, हम आमतौर पर

      (function () {return 10}; ) ();   

    देखें

resources - Java closing/cleaning up -


I have a class in which there are some large objects:

  public class MyClass { BigObject bo; Public MyClass () {...}}   

Should I make a close approach like the following:

  public zero-off () {bo = Null; }   

I think this is good for garbage collection (?) Am I on the right track? How should I go for cleaning this class?

I think this is good for garbage collection

No, it just masers the code.

What is the catchover of the example of MyClass ? If you need an example of MyClass to stay alive but is not Big Object then - and only then - can you BO Setting should be bothering zero But at the same time, you should consider your design. Generally, all states of one class are important for its lifetime. There are exceptions to that rule, but they are relatively rare.

When the example of MyClass is eligible for garbage collection, its BO variable will be irrelevant to whether the BigObject Example of is eligible for garbage collection, so it does not matter if it is not empty or not ... but it does clean up after you manually To try, write a large difference in the context of the not code. They may have.

You should clear resources such as currents, country handles etc. - but usually you can handle the garbage collector with the memory.

Creating a startup daemon for a shell script in FreeBSD -


I am trying to create a file in rc.d / which I wrote a / bin / sh script initially Will do it. I've followed some examples found here:

  #! / Bin / sh -x # Available: copyfiles /etc/rc.subr name = copyfiles rcvar = copyfiles_enable pidfile = "/ var / run / $ {name} .pid" command = "/ var / etc / copy_dat_files.sh -f /var/etc/copydatafiles.conf "command_orge =" & amp; " Load_rc_config $ name run_rc_command "$ 1"   

It seems that I have a problem with the PDF file, should my script be one that creates a PID file, or is it automatically Is made from? I have tried both ways, and whether I make my script a PID file or not, I get an error that the PID file is not readable

if my script is about to make it , Then what is the correct way to create a PID file?

Thanks

For example, look at existing daemons (like / etc / rc .d / mountd). Then look at the sub-routine in /etc/rc.subr - there is a code to see the PID-file but nothing creates it.

In other words, you can declare the daemon-initially the script, the pid-file, but by making it depend on the daemon, speaking of daemon, you use daemon (8) utility If your demon is actually a shell script, utility will take care of creating a PID-file for you (if you have been typed in daemon C, you can use the daemon (3) function.)

BTW, Mary In health, even during the opening of the demons, PID-files, Em> Lock with them (the flock (3) or Fsiantiel (2) or Lokf (3)). In this way, if there is an instance crash (or killed) without removing the PID-file, then there will be no problem determining the next instance, the file is stale.

android - How to pass a Parcelable Extra to another activity -


I am trying to pass an additional parcel to use another activity, but when I make it my second If I get on the activity, then NullPointerExeception show up, can someone help me?

My portable eligible class:

  implements the public category metadados parcelable {Private Ent Codigone Institute; // . . Public Metadados (Int Codinistivio, int ANO, string offlineUUdid, string signals, string name inst., String start date, string name, string end, long size) {this.codigoInstituicao = codigoInstituicao; // . . } Public int getCodigoInstituicao () {return codigoInstituicao; } Public Zero Set Codexinstitico (It CodoInstikico) {this.codigoInstituicao = codigoInstituicao; } // Gates and Setters . @ Override Public Intents () {// Tudo Auto-Generated Method Stub Returns 0; } @ Override Public Zero Editor (Parcel Dest, Int Flag) {dest.writeInt (codigoInstituicao); // . . } Public stable final portlet worthy. Manufacturer & lt; Metadados & gt; Manufacturer = new parcelable. Creator & lt; Metadados & gt; {} Return to the new Metadados (Inn); Made of Public Metadados Fraamperesell (Parcel Inn); } Public Metadados [] Newer (integer shape) {Return new metadados [size]; }}; Private Metadados (in Parcel) {codigoInstituicao = in.readInt (); // . . }}   

How my Asynchronous introduces my other activity:

  ArrayList & lt; MetaDados & gt; Metadosophal = new arreelist & lt; Metadados & gt; (); ArrayList & LT; MetaDados & gt; Metadados = New Arrestist & lt; Metadados & gt; (); Intentional = new intent (activity, download selection activity category); It.putExtra ("metadosophic", metadascus); It.putExtra ("Metadosporters", Metadedosparse); Activity.startActivity (this);   

And my download activation, where I try to get it:

  ArrayList & lt; MetaDados & gt; Fulllist = (arrelisted & lt; metadando & gt;) getIntent (). GetParcelableExtra ("Metadascusful"); (Metadado Metadados: FullList) for {Log D. (Constants.DOWNLOAD_SELECTED_ACTIVITY, Metadados.Getnam ()); } ArrayList & lt; MetaDados & gt; PresList = (ArrayList & lt; MetaDados & gt;) getIntent (). GetParcelableExtra ("Metadosporters"); (Log D. for Metadados Metadado: Prestist) (Constants.DOWNLOAD_SELECTED_ACTIVITY, MetadataGetname ()); }    

Use Intent.putParcelableArrayListExtra () instead of putExtra (), and getParcelableArrayListExtra ( ) Instead of getParcelableExtra () you can also lose the stopper, so that's where it's flying.

twitter - PHP foreach how to access variable outside loop -


I have this code to tap in a Twitter feed ...

  // Output Tweets $ json = file_get_contents ("http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=false&screen_name=*********&&count=100 " , truth); $ Decode = json_decode ($ json, true); $ Count = count ($ decode); Calculating the number of conditions for // ($ i = 0; $ i & lt; $ count; $ i ++) {// echo $ decode [$ i] ["text"]. "& Lt; br & gt; & lt; br & gt;"; $ Text = $ decode [$ i] ["Text"]. ""; Repeat $ text; }   

I want to use $ text in another function. Can it be done?

There is only one array and insert it on each run of the loop, and then resonate it out or back.

  $ arr = array (); For ($ i = 0; $ i <$ count; $ i ++) {$ text = $ decode [$ i] ['text']; $ Arr [] = $ text; Resonate $ text ""; } Var_dump ($ arr);    

ruby on rails - How to set attribute from code and also insert text inside tag -


मेरे पास यह कोड है:

  span class == I18n.locale == locale_used? "निष्क्रिय": शून्य = लिंक_to (I18n.t ('locale_name', लोकेल: लोकेल_यूएस), \ url_for (लोकेल: लोकेल_यूएस))   

अगर मैं "वर्ग" भाग को हटा देता हूं, तो सब कुछ ठीक है। यह पतला में लिखने का सही तरीका क्या है?

वर्ग के भाग के बिना, त्रुटि है: वाक्यविन्यास त्रुटि, अप्रत्याशित कीवर्ड_सेंचर, $ end की उम्मीद

समस्या class विशेषता के अंदर आपके जटिल अभिव्यक्ति के साथ है

पतला इस पर भ्रमित हो जाता है ताकि आपको इसे () के साथ इसे सही ढंग से पार्स करने की आवश्यकता हो:

  span class == (I18n लोकेल == लोकेल_यूएस? "निष्क्रिय": शून्य) = link_to (I18n.t ('locale_name', लोकेल: लोकेल_यूज), \ url_for (लोकेल: लोकेल_यूएस))    

facebook graph api - FQL does not return all news feeds -


I used FQL to retrieve all my news feeds (as recently as 50 or 30-day documents) I am using. However, I can not get back only a few feeds for the past 30 days, is there any one problem? I use FQL to retrieve feeds:

  from SELECT filter_key in SELECT filter_key with stream WHERE filter_key created_time, updated_time, message, attachment, preferences, where shared number UID = me () and created_time & lt; = Now ()   

In addition, I have read that the graph API returns more results than FQL. I read some graph API examples, but do not understand what my query looks like if I want to just list the photos posted on my news feed?

I will start with easy:

to return only the posts There are photos, add and type = 247 in the WHERE section of your query, this is something that you can not do with the graph API.

For other questions you have, the stream is one of the toughest of the queries for the table and the result you want.

To not get enough results, the internal boundaries of Facebook do not work as an advertisement in my internal experience. If you explicitly request for many posts by adding LIMIT 100 at the end of your query, then you can usually get close to the actual number of items you expected.

The Facebook filtering algorithm works on your results followed by queries, so you can view on your newsfeed within the Facebook web app, ending with so few posts May be. It must be done with your friends having privacy settings enabled. And no, there is no way of testing for them.

See for more information.

Hiding my rails div using JS -


मेरे उत्पाद देखें:

  & lt; a href = "#" id = "show_metrics "& Gt; मेट्रिक्स दिखाएँ & lt; / a & gt; & Lt; div id = "मीट्रिक" वर्ग = "छुपा" & gt; & Lt;% = "प्राथमिक उत्पाद की संख्या: # {product.total_product_size (rating_set)। Count}"% & gt; & lt; br / & gt; & Lt;% = "अनुशंसाओं की संख्या: # {product.total_recommendation_size (रेटिंग_सेट)। Count}"% & gt; & lt; br / & gt; & Lt;% = "खराब सिफारिशों का प्रतिशत: # {bad} / # {total} = # {number_to_percentage (प्रतिशत_बाड़,: सटीकता => 2)}"% & gt; & Lt; / div & gt;   

products.js.coffee:

  $ - & gt; $ ("A # show_metrics")। क्लिक करें (ईवेंट) - & gt; Event.preventDefault () $ ("div # metrics")। टॉगल ()   

मेरे "मेट्रिक्स" लिंक से पता चलता है, हालांकि लिंक पर क्लिक होने पर कुछ नहीं होता है, फिर भी मैं अपने पृष्ठ के स्रोत को देखता हूं, मुझे मेरी मेट्रिक्स डिवेल को छिपी हुई मान के रूप में देखा जाता है मीट्रिक जानकारी दिखाने के लिए मुझे क्या करना चाहिए जब "मेट्रिक्स" लिंक पर क्लिक किया जाता है

उत्पन्न HTML:

  & lt; div id = "metric" class = "छिपा हुआ" & gt; प्राथमिक उत्पाद की संख्या: 5 & lt; br & gt; सिफारिशों की संख्या: 105 & lt; br & gt; खराब सिफारिशों का प्रतिशत: 0/0 = नाएन% & lt; / div & gt;   

उत्पन्न जेएस:

  (फ़ंक्शन () {$ (फ़ंक्शन () {वापसी $ ("a # show_metrics")। क्लिक करें (फ़ंक्शन (इवेंट ) {Event.preventDefault (); वापसी $ ("div # मेट्रिक्स")। शो ();});});})। कॉल (यह);    

मुझे लगता है कि आप यह कर सकते हैं:

  $ ("Div # metrics")। RemoveClass ("छिपा हुआ")   

तो इसे अपने कोड में जोड़ें:

  $ - & gt; $ ("A # show_metrics")। क्लिक करें (ईवेंट) - & gt; Event.preventDefault () $ ("div # metric")। RemoveClass ("छुपा")   

इसके विपरीत, यदि आप इसे छिपाना चाहते हैं तो आप करेंगे:

  $ ("div # मेट्रिक्स")। AddClass ("छुपा")    

python - xlwt write excel sheet on the fly -


I used to create spreadsheets in the following way:

  wbk = xlwt . Taskbar () Earnings_tab = wbk.add_sheet ('Earnings') wbk.save (filepath)   

There is no way to save the file in the file path, and instead of writing it to the file What is the best way for a downloading user? Or do I need to save it as a TMP file and then the user has to serve it?

quote:

This is a stream object with a writing method Also, as in StringIO , Excel data is written in the data stream

Modified example:

 < Code> import StringIO f = StringIO.StringIO () # Create an object like a file wbk = xlwt.Workbook () earnings_tab = wbk .add_sheet ('Earnings') wbk.save (f) # write stdout   

Some suggestions might be given that StringIO instead of cStringIO , but in the former Please note that cStringIO when I last checked that Unicode is not properly handled

It is also worth noting that StringIO has been changed to io in Python 3.

Combining two regular expressions in boost regex -


I have two regular expressions that look at the URL and determine that the URL is a watchlite video URL

  1. The URL should contain at least one of these extensions, where .isma, .ismv, .isml

    Regex: .ism (a | v | l) < / P>

    1. URL "string" / quality level ({bitrate) / pieces (audio = {start-time} ) Should be "

      Regex: / quality level (\ d +) / pieces (\ b (o) Dio | Video | Text) \ b = \ d +)

      How do I add these two stars in one and ensure that both the conditions are satisfied?

        is_silverlight_livestream_url (const char * url) {/ * * xxx.isml / QualityLevels (& lt; bitrate & gt;) / pieces ( = & lt; timecode & Gt;) "* On-demand stream has an extension" .isml "* / static boost :: regex regex (my_regex_str); Try (if (boost :: regex_match (url, regex) == true) {back to true ;}} Hold (std :: runtime_error e) {} return false;}   

      satisfaction

      You have to do something where you search for a string, after that (optional) additional characters (you can be more specific if you know that this How to see the URL) and then file extension at the end:

        / quality (\ D +) / pieces (\ b (audio | video | text) \ b = \ d + ) (. +?)?. Ism (a | v | l)    

c++ - Visual Studios (2012 pro mainly) file location of defaults for -


I always add _CRT_SECURE_NO_WARNINGS to all of my C / C ++ projects in the Preprocessor Definitions tab in the project properties. & Lt; Edit & gt; Is drop down for & lt; Parent or project by default. How do I change the value of the project default I think this is an XML file hidden somewhere, or does it need to create a file that knows any location?

see - & gt; Property Manager, then use a property sheet for that build configuration to expand a project and create the configuration. Right-click on the property sheet and select Properties to modify the property sheet. I do not recommend modifying the underlying asset sheet, although for this purpose there is a .user property sheet. You can also create your own property sheet that defines a preprocessor macro, then add your new property sheet to the list for each build configuration.

sql - Is it possible to rollback create_all in sqlalchemy? -


According to the question for some DBMS, it is possible that it is possible to prepare rollback table statements. Especially it is possible for SQLite (although it is undocumented).

So my question is, is it possible to rollback everyone in sub-section? I was trying to write some test codes, but it does not look like:

  & gt; & Gt; & Gt; Engine = Creating_Agin ('sqlite: ///: Memory:') & gt; & Gt; & Gt; Engine engine (sqlite: ///: memory :) & gt; & Gt; & Gt; Session = session maker (bind = engine) & gt; & Gt; & Gt; Connection = engine.connect ()> gt; & Gt; & Gt; Session = session (dam = connection) & gt; & Gt; & Gt; Engine.table_names () []> & Gt; & Gt; Transaction = connection.begin () & gt; & Gt; & Gt; Base = declarative_base ()> gt; & Gt; & Gt; Class test (base): ... __tablename__ = 'test' ... id = column (integer, primary_key = true) ... & gt; & Gt; & Gt; Base.metadata.bind = Engine & gt; & Gt; & Gt; Base.metadata.create_all () & gt; & Gt; & Gt; Engine.table_names () [u'TEST '] & gt; & Gt; & Gt; Transaction.rollback ()> gt; & Gt; & Gt; Session.close () & gt; & Gt; & Gt; Connection.close () & gt; & Gt; & Gt;  
  • Use Postgresql or SQL Server MySQL supports DDL for Oracle not transaction Although recent versions of SQLite have DDL support of transactions Python.

  • Simple recipe:

     with  engine. (Like) conn: metadata.create_all (conn)   

    If you increase an exception inside "with:", the transaction will be brought back.

  • Want to see it yourself, okay: to inspect sqlalchemy import from need to run 0.8 with the engine is. Conn: trans = conn.begin () metadata.create_all (conn) inspector = inspection (conn) table_names = to gain an understanding of the transactional scope, inspector.gate_table_name () trans. Rollback () inspector = inspection (con) rolled_back_table_names = inspector.get_table_names ()

    I recommend that you read

  • C# Acces functions within methods -


    I have created a method in a class and I want to get streamreader sr1 in one class by another method but I can not seem to gain access to the law!

      Public Zero Show SelectFile () {StreamReader sr1 = New Streamerdir (File. OpenRight (ReturnText)); Return Content RD = SR1 Readout (); } Can anybody explain to me how to reach / replace these methods in other ways?  

    sr1 local shoSched file () method; It returns to the workspace when the method returns if you want it to appear in another method, then you have to make it a member of your class:

      StreamReader sr1; Public Zero Show SelectFile () {sr1 = New StreamerDeader (File. Open Read (ReturnText)) Return Content RD = SR1. Readout (); } Public Zero Disposal SR1 () {}   

    If it is a matter of settling properly, then wrap it in the statement using :

      using the public Zero Show SelectFile () {Streamer sr1 = new streamminder (File. Open Read (ReturnText)) {ReturnContenctRD = sr1.ReadToEnd (); }}    

    WordPress Custom Post Type and Custom Template -


    I have created my custom post type on wordpress 3.5.1

    Therefore, under the dashboard, The post type on the left hand side, therefore, I had a new addition under this custom type.

    But I do not see any template page for this custom type.

    I will create a file called archive-customtype.php which is a template page and Puts in my themes folder.

    To change different templates on older WordPress, you select a

    meta box from the page attribute in the template & gt; Publish custom type and page.

    So my question, on this new 3.5.1, where do I select the template for this custom post type? Right now it is using the default one.

    Install custom post type plugin by iLocalize They have lots of tutorials on how to post a custom post on a page can add. This tutorial is best here but I have found more WP-type websites. How to create a new page template on WordPress Organize organization and code from tutorial to page template. Hope it helps.

    git - How to remove all remote tracking branches that still exist on remote but no longer in my fetch refspec -


    मैंने हाल ही में remote.origin.fetch के अपने refspec को पुनर्गठित किया है और अब केवल एक छोटा उपसमुच्चय प्राप्त करें रिमोट से शाखाएं हालांकि, git branch -a मुझे पहले से प्राप्त हुई बहुत सारी दूरस्थ शाखाएं दिखाती है, यद्यपि अब उन्हें अब नहीं मिले हैं git prune का उपयोग करने में मदद नहीं करता क्योंकि उन दूरस्थ ट्रैकिंग शाखाएं दूरस्थ में मौजूद हैं। "post-text" itemprop = "text"> < P> robrich के उत्तर में एक अच्छा संकेत है: आप केवल हर दूरस्थ-ट्रैकिंग शाखा (या रिमोट) को हटा सकते हैं, और फिर केवल उन लोगों को पकड़ने के लिए git fetch का उपयोग कर सकते हैं अब आप खरोंच से चाहते हैं।

    यदि आप एक साथ रिमोट को दूर करने का प्रयास करते हैं, तो आप अपना .git / config फाइल बैकअप ले सकते हैं, ताकि जब आप रिमोट बैक को बाद में जोड़ दें, तो आप ऊपर उठा सकते हैं बैकअप से प्रति-रिमोट सेटिंग।

    हालांकि, रिमोट को निकालने के लिए मेरे लिए दूरस्थ-ट्रैकिंग शाखाएं नहीं निकाली जाती हैं शायद मेरी स्थानीय रेपो खराब है किसी भी एक के लिए जिनके पास एक ही समस्या है, मैं क्या कर रहा हूं:

      # सभी रीमोट्स के लिए सभी दूरस्थ ट्रैकिंग शाखाएं हटाई जाती हैं तो सावधान रहें, अगर आपके पास कई रिमोट हैं जीआईटी शाखा-आर | Xargs -l 1 git शाखा -आरडी   

    इसके अलावा, मेरे पास रिमोट से बहुत सारे टैग हैं, जो चीजों को धीमा कर देते हैं I मैंने यह भी किया:

      सावधान रहें! यह हर टैग हटाता है! जीआईटी टैग | Xargs -l 1 git टैग -d   

    आप git fetch को अगली बार वापस उन सभी टैगों को नहीं लाने के लिए कॉन्फ़िगर कर सकते हैं, जो इस के दायरे से परे है प्रश्न।

    How to display all columns associated with duplicate emails in SQL server 2008 -


    I did some research on finding a way to filter duplicate emails, so all the columns connected to these duplicate emails But I can not find any answer to help me with it.

    I have currently pulled the data using the following code:

      Select Email, COUNT (email) AS email from dup_count [cem_farmers_masterinvitelist]. [Dbo]. Email by email (Email)> 1) Order by email   

    This gives me the xxxxxx amount of rows I then pull any data (column) I want to be able to connect to these duplicate emails - and only duplicate.

      SELECT * FROM [marks_party_MasterInvite] [Dbo]. [Invitation list] Where in the email (select [marks_party_MasterInvite] by email. [Dbo]. [InviteList] Email hosting COUNT (email)> 1)   

    I know that I'm doing something wrong, because

    thanks guys,

    post -text itemprop = "text">

    you window functions Want to use. The following combines the count in each row, then you can use a where to get all the columns filter:

      SELECT il. * FROM (select IL *, count (*) over (via email partitions) as [cem_farmers_masterinvitelist] to cnt. [Dbo]. Inverted list) IL where CNT & gt; 1 order by email does not count   

    , because when you receive each line, you are going to get a duplicate in the first query, you are getting specific emails.

    Regex for Valid Email address or Valid alpha numeric check -


    Hello, I have a field named Username in my MVC 3 model. This proposal may be a valid email address or be valid alphanumeric. How can I write Reggae Express to check both things (valid email or valid alpha numeric)

    The valid email expression I am using

      "^ [_ _A-zA -Z0-9 \ '-] (\ [_ one-zA-Z0 -9 \. '-]) * @ [one-zA-Z0-9 -.] + (\ [One-zA-Z0-9 -] +) *. (([0-9] {1,3 }} | ([A-zA-Z] {2,3}) | (name)) $ "  assuming that instead of an email address you want to match the alphanumeric string, It's actually just  AZ  

    0-9 , which you already have Only you can take ...
      ^ [_ a-zA-Z0- 9 \ '-] + (\. [_a-zA-Z0-9 \' -]) * @ [One-zA-Z0-9 -] (\ [one-zA-Z0-9 - ..] +) * (([0-9] {1,3}) | ([a-zA-Z ] {2,3}) | (name)] $   

    ... and wrap it in a bracket with a pipe to indicate it as an optional group ...

      ^ ([_ a-zA-Z0 -9 \ '-] + (\. [_A-zA-Z0-9 \' -] +) * @ [one-zA-Z0-9 -] (\ [one-zA-Z0-9 -]) * \ (([0-9] {1,3} ..) | ([A-GA-Z] {2,3}) | (name) | [A-GA-Z0-9] +) $   

    Which looks like a very simplified solution, give that which you have done so far, which makes me wonder if there is something on it ???

    perl - regex with variable part -


    How can I merge these 2 regex into a single regex string string (all available on the basis of the last 3 fields Captures parts) are optional in $ s and they should be captured if they exist)? I could not find any work solution using (? = ...)

      $ s = '1.2.3.4 - Example [10 / Dec / 2007: 21: 07: 20 +0100] "GET /x.htm HTTP / 1.1" 401 488'; $ Re = qr / \ A (\ d +) \. (\ D +) \. (\ D +) \. (\ D +) [] (\ S +) [] (\ S +) [] + \ [(\ d +) \ / (\ S +) \ / (\ d +): (\ d +): (\ D +): (\ d +) [] (\ S +) \] [] "(\ S +) [] (. *?) [] (\ S +)" [] (\ S +) [] (\ S +) \ z / x; Print "[" .join ('], [', $ s = ~ $ re]. "] \ N \ n"; $ S = '1.2.3.4 - - [13 / Jun / 2007: 01: 37: 44 +0200] "GET /x.htm HTTP / 1.0" 404 283 "-" "Mozilla / 5.0 ..." "- '; $ Re = qr / \ A (\ d +) \. (\ D +) \. (\ D +) \. (\ D +) [] (\ S +) [] (\ S +) [] + \ [(\ d +) \ / (\ S +) \ / (\ d +): (\ D +): (\ d +): (\ d +) [] (\ S +) \] [] "(\ S +) [] (. *?) [] (\ S + ) "[] (\ S +) [] (\ S +) []" (. *) "[]" (. *?) "[]" (. *?) "\ Z / x; print" [".join ('], [', $ s = ~ $ re].]] \ N \ n";    

    a lookahead (? =) You can match a non-capturing group (?) and zero or an event Are: $ re = qr / \ a (\ d +) \. (\ D +) \. (\ D +) \. (\ D +) [] (\ S +) [] (\ S +) [] + \ [(\ d +) \ / (\ S +) \ / (\ d +): (\ D +): (\ d +) [] (\ S +) \] [] "(\ 'S) [] (. *?) [] (\ S +)" [] (\ S +) [] (\ S +) (?: [] "(. *?)" [ ] ". (? *)?" [] "(. *?)") ?? Z / X;

    This will capture fixed-range boundaries of captures, but if the optional capture If the group does not match, then the last 3 eggs will be if you want to match between 1 and 3 optional fields, then each of your non-capturing groups has zero or more (? ) I also tried to do this, but it does not work:

      (?: [] "(. *?)") {0}}   

    It matches and occupies each of the previous three areas, but each capture caption overwrites the last position in the capture array, so after capturing it only The final area is there.

    Be careful that you are using a very strict expression that may not be suitable for all web logs: in particular, the IP address will not handle the IPv6 address for the IP address, and Based on the user agent for match user agents, the characters, how they survive (lighttpd 1.4.28, for example, does not save them).

    html - How to view your site with internet explorer if you have a mac? -


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

    • 7 जवाब

      खैर, शीर्षक कहता है सब। क्या कोई जानता है कि इसे कैसे करना है? और नहीं, मैं वीएम का उपयोग नहीं करना चाहता हूं।

      मेरे पास कुछ भी नहीं है लेकिन इसके बारे में कहने के लिए अच्छी बातें हैं

    using map in python 3 -


    Hi This code works on Python 2.7, but not in Python 3

      import Itertools def product (a, b): return map (list, iterolol. Product (a, repeat = b) print (sorted (product ({0,1}, 3)))   

    It outputs

      [[0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1] , [1, 0, 0] in Python 2.7, [1, 0, 1], [1, 1, 0], [1, 1, 1]]   

    but Python 3 It gives a map object at 0x028DB2F0, anyone know how it works for Python 3 So that the output should remain similar to Python 2.7.

    Just wrap it with a list: itertools def product (a, b): return list (map, list, itertools.product (a, repeat = b)) print (sorted (product ({0,1}, 3)))

    Find more

    In two words in Python 3 map

    Return an Iterator, which works in every object Implemented, provides results.

    In Python 2.7,

    Apply the job of every object and return a list of results.

    IOS In App Purchase: can I let the user buy again same product? -


    To successfully follow the guidance of some of the IAP tutorials for iOS, such as:

    > My problem is that: I want the user to buy the same product he has already bought - is this possible on the consumable method? (I am searching for 2 days for an answer for this, and so far nothing.)

    The target user has to buy from hundreds of products of the product (hence I do not want to make it. There are hundreds of product identifiers, so I'm using the same product ID for all products and internally support internal products (as far as Apple knows that using She has bought the same product again ...))

    Thank you in advance ...

    "post-text" itemprop = "text">

    OK After spending some time about this issue - I just realized that this is not an issue: Apparently Apple does not ask for an Apple ID or password if you buy the item immediately after the first purchase.

    You know what it means (actually you know - I did not:)), I will keep my son away from my son after buying something from now ...) / P>

    case closed

    c# - Input text control disappears on postback -


    I have some input controls (text) that have been created as part of the code-behind such a dynamic radiobutanist (So ​​that a textbox is next to Radiobootton):

      Radio button list radiooption = new radio button list (); Radiobuttonlist.Items.Add (new listing ITM (DT.ROS [I] [9] .restring () + "input id = \" + + + name + "\" runat = \ "server \" type = \   

    All controls are within the update panel.

    Every time there is a postback, " Text within the input

    Any thoughts? Very much appreciated!

    control tree Must be rebuilt on every postback, in which partial postbay - or allow it to be regenerated through the controlstate / viewstate. In this case, in the later postback

    For such cases, I will contact it like this:

    1. Enable ViewStat on the radio button list and make sure it does not add more than load 1 , or
    2. Container control Store a viewstate of a proper collection on it and then the consumer databa Nd G control - to set it see a clear way. I like this approach because it is consistent, easy to predict and control.

      1 it should work but it probably is not. I am generally confused about which control actually supports the viewstate, and to what extent does the use kill me as usual .. Incompatible. In any case, this will not be will not - remember that disabling the viewstrate for page (or parent control) disables ViewState all the way down Additionally, and should control and in the control with the same control path / id (usually init or load) in order to ensure that it works correctly.


      Any ideas for # 2:

      Save the visual control in that user control (this control should be vestostat enabled): < Pre> // ListItem is a proper serial and // works well for automatic binding for various list controls. & Lt; ListItem & gt; Name {// May receive return tap {return (list & lt; ListItem & gt;) ViewState ["name"]; } Set {ViewState ["name"] = Value; }}

      In the GenericDataSourceControl (if it is a good id, put the GDS in the markup) Select the event:

        Zero SelectEvent (Sender E, GenericSelectArgs Args) {args.SetData (name); }   

      Dynamically add a radio button list (say, in Control.OnLoad ):

        // Unless it Do not need to be dynamic, move it into declarative markup // dynamic control * should be added to the same place * it was before // postback or ugly invalid control tree construction will be exceptions. Var radio list = new radio button list ; SomeControl.Controls.Add (radioList); // This should be unusual for reducing the problem of making the control tree and // should be consistent for the dynamic control. Radio list.id = "radio list"; // The binding for DS "declarative" usually works better I've got a radio list. DataSourceID = "idOfTheGDS"; // You - Databank is required based on certain factors - I will usually call Databank in the prerenders, but generally the load is fine / liked. // If it already binds, do not call it manually radioList.DataBind ();   

      If databanding is working correctly, it is possible for the radio button to disable disable viewstate. But occasionally the use of the viewtest When the controlstate was supposed to be done, so make sure it works as desired.

    java - Recalling an Int from a method? -


    I need to return an int to use 4 random fraction points (any repeated) for the main method so that I can not use string methods for the rest of my work. I want to print it random number.

    It is what I have:

      public static zero main (string [] args) {int generatedSecretNumber; System.out.print ("Random number is:" + software generated;); } Public static int generateSecretNumber (int w, int x, int y, int z, int secretNumber) {random race = new random (); W = ran.nextInt (); X = Run Next (); Y = ran. NnextInt (); Z = ran.nextInt (); While (w == x || w == y || w == z) {w = ran.exit (); } While (x == w || x == y || x == z) {x = ran.nextInt (); } While (y == w || y == x || y == z) {y = Run. Nxit (); } While (z == w || z == x || z == y) {z = ran.exit (); } If (w! = X & x! = Y & y! = Z) {secretNumber = w + x + y + z; } Secret return number; }}    

    In your code, you really never have your generSecretNumber Calling () Method, you're declaring a variable then instead. Remove the announcement in your head, and change the printing line to System.out.print ("random number is:" + created number ("++"); .

    Next, Code> generateSecretNumber () must not have any argument in the method, because it determines what it is going to do entirely on its own, and no external data is required because logic remains , You need to declare it as int w, x, y, z; .

    Other , You are generating a random integer without the upper bound is not exactly what you want, instead, your upper limit for rand.nextInt () calls must be 10, resulting in Rand.nextInt (10) . It can choose a random integer anywhere from 0 to 9.

    And finally, you return the amount of digits instead of the actual four digit number Instead, return the sum of each of their points to their place For example, the fourth digit should be w * 1000 .

    Example of the result:

      public class RandUniqueFourDigits {public static zero major (String) [] Args) {System.out.println ("Random number is:" + Creator number ()); } Public static int generateSecretNumber () {random rand = new random (); Int w = 0, x = 0, y = 0, z = 0; // generate each digit until all of them are unique (w == x || w == y || w == z || x == y || x == z || y == z) { W = Rand.nextInt (10); X = rand.nextInt (10); Y = RAND Xxit (10); Z = rand.nextInt (10); } // Generate each digit until they are all exclusive = rand.nextInt (10); Do x = rand.nextInt (10); While (x == w) // add them to an integer and return return w * 1000 + x * 100 + y * 10 + z; }}   

    for a more efficient loop (each number is reproduced only when your initial code should be resized), this time with a completely loop Replace: w = Rand NXIT (10); Do x = rand.nextInt (10); Whereas (x == w); Do y = rand.nextInt (10); Whereas (y == w || y == x); Do z = rand.nextInt (10); While (z == w || z == x || z == y); Results in

    :

      public class RandUniqueFourDigits {public static zero major (string [] args) {System.out.println (GenerateSecretNumber ()); } Public static int generateSecretNumber () {random rand = new random (); Int w = 0, x = 0, y = 0, z = 0; // Generate each digit until they are all exclusive = rand.nextInt (10); Do x = rand.nextInt (10); Whereas (x == w); Do y = rand.nextInt (10); Whereas (y == w || y == x); Do z = rand.nextInt (10); While (z == w || z == x || z == y); // Give them an integer and return return w * 1000 + x * 100 + y * 10 + z; }}    

    c - Having trouble using if statement with for loop and arrays -


    I have a problem in one of my tasks here is the code:

      included & Lt; Stdio.h & gt; Include & lt; Math.h> Include & lt; Stdlib.h & gt; Int inputount (int i); Zero input (double data [], int j); Double Fartole (double data [], int j); Zero output fahr (double data [], int nuffar); Zero Output Allowed (Double Data [], Intimate Nuffarrs); Zero Output Highlight (Double Data [], Int Newfahar); Zero Outputgrad (double data [], int NFhurs); Int main (zero) {int i, j, numfahrs; Double data [i], * ptr = & amp; Data [i]; I = inputAmount (i); Printf ("% d \ n \ n", i); InputFairers (and data [i], i); Data [j] = fartosel (and data [i], j); Printf ("% 1f", data [j]); Return 0; } Int inputAmount (int i) {printf ("Please enter the amount of quantities to be used. \ N \ n"); Scanf ("% d", & amp; i); While (i and lt; 1 || i> 25) {printf ("Value is out of range, please enter other values. \ N \ n"); Scanf ("% d", & amp; i); } Came back; } Zero inputfrom (double data [], int i) {int j; Printf ("Enter the temperature values ​​in the range of -175 to 175 degrees F. \ n \ n"); For (j = 0; j  175} {printf ("the price of the temperature is out of range. Please re-enter"); Scanf ("% F", and data [ja]); }}} Double Fertosel (double data [], int j) {int i; Printf ("test"); {Data {i] = (((data (i)) - 32) * (5.0 / 9.0) for (J = 1; J & lt; = I; J ++); } Return figure [i]; }   

    Basically the issue in my code is that if I leave this code entirely if leave the statement I want to go to the program loop and If the user enters the value outside a certain range, then I want the if statement to start a statement inside a loop, but a statement of statement in the statement if If there is something wrong with it then I can replace the location of if has also tried to loop

    The problem is that you

    i

    j Using a subscript will work

    scanf ("% f", and data [j])

    if (data [j] 175)

    should work because the data [i] is not a possible subcript value, because I have the array size

    and why you use the line Have done

      data [i] = data [i];   

    ?

    c# - Fetching row from SQLite database consumes 100% of processor time -


    There is a DDL script that we found for a table:

      create table [ Stat_ping] ([lid] INTN CONFLICT is not at INNORE, [ping] NUMERIC (6, 2) MOU does not tap on MOU, [Tipping] DATETIME IGNORE is not a faucet on compromise;) Sample of data for the table: I »¿ 
      Lid ping tapping 2036 1 2013-02-26 10: 46: 27.000 2002 1 2013- 02- 26 10: 46: 27.000 2006 1 2013-02-26 10: 46: 27.000 2015 1 2013-02-26 10: 46: 27.000 200 9 1 2013-02-26 10: 46: 27.000 2000 1 2013-02 -26 10: 46: 27.000 2016 1 2013-02-26 10: 46: 27.000 2031 1 2013-02-26 10: 46: 27.000 2016 1 2013-02-26 10: 46: 27.000 2018 1 2013-02-26 10:46: 27.000 2012 1 2013-02-26 10: 46: 27.000 2008 1 2013-02-26 10: 46: 28.000 201 9 1 2013-02-26 10: 46: 29.000 2001 0 2013-02-26 10 : 46: 29.000 2005 1 2013-02-26 10: 46: 29.000 113 1 2013-02-26 10: 46: 30.000   

    We can use this type of query to Calculates a percentage of the availability of services by:

      rhythm (Logger._lockObj) {(SQLiteConnection sql = new SQLiteConnection (configuration Mandkkknekshn strings [ "SQLite"]. ToString ())) {sql.Open (); Foreign currency (different items in cake) {item.ping.stconn = 0; Select the string sqlquery = "stat_ping (sum (s.ping) * 100 / count (s.timeping)) where datetime ('+ DateTime.Now.ToString (" yyyy-MM-dd HH: mm: ss "+ '', '- 1 day') and day-time ('' + date time.Now toastring (" yyyy-MM-dd HH: mm: ss ") +" ') and s.lid = " + Item.lid; (SQLiteCommand comm = New SQLiteCommand (using sqlquery, sql)) {item.ping.stconn = convert toByte (comm.ExecuteScalar ()); }}}}   

    We use Devart SQLite data provider for contact, table stat_ping has approximately 100000 rows, so for 5 items it is calculated to be about 6- Takes 7 seconds and takes 100% processor.

    I know that we should use separate stored procedure to calculate percentages for all items for just one of the stored procedures / functions, but by using a real performance and opportunity experience Could? > Another person will use my project SQLite database as the container of SOAP message logging. I think that the database can take many place, because a couple of requests and the response takes 150KB.

    Thanks, guys!

    Have you tried to use some index to speed up your query? I also propose to use a prepared and parameter query because it is too heavy to generate new commands in the loop.

    In addition, from my experience, the SQLite database becomes very slow when there are many rows in it. We used to clean the SQLite database of old data, we used to store it in another database

    BTW, MS SQL Server CE (this is an embedded in-cock database, no setup required) only Behaves very accurately when there are so many data in the table We have used the Windows service as a caching database, which has been dealt with by thousands of clients. When the size of the database exceeds 1 GB, it starts slowing down.

    ios - Sort an NSArray of NSString by ignoring spaces -


    मेरे पास

      NSArray * foo = @ [@ "शिकागो एचटीएस, आईएल ", @" शिकागो हाइट्स, आईएल ", @" शिकागो, आईएल "];   

    मुझे इस तरह एक क्रमबद्ध सरणी प्राप्त करना है:

      @ [@ "शिकागो, आईएल", @ "शिकागो हाइट्स, आईएल", @ " शिकागो एचटीएस, आईएल "];   

    मैंने उपयोग किया

      [foo sortedArrayUsingSelector: @selector (स्थानीयकृत CaseInsensitiveCompare :),   

    जिसके परिणामस्वरूप

      @ [@ "शिकागो हाइट्स, आईएल", @ "शिकागो एचटीएस, आईएल", @ "शिकागो, आईएल"];   

    इस सरणी के बारे में 100k + प्रविष्टियां हैं, ताकि रिक्त स्थान पर आधारित स्ट्रिंग को विभाजित किया जा सके और इसे सॉर्ट किया जा सके और 'अनप्लिटिंग' के परिणामस्वरूप एक खराब पर्ोफार्मन हो।

    मुझे पता है कि खोजकर्ता जैसे ही 'स्थानीयकृत CaseInsensitiveCompare' जैसी फाइलें होती हैं, इसलिए मुझे लगता है कि मैं भाग्य से बाहर हूं।

    मैं पहले वर्ण 'ए' पर आधारित सरणी को विभाजित करने की ओर झुकाव कर रहा हूं, खाली पर आधारित स्ट्रिंग में शामिल हो रहा हूं अंतरिक्ष, इसे सॉर्ट करें और फिर उसे तालिका में प्रदर्शित करें। दृश्य और यदि उपयोगकर्ता पहले के परिणामों के पिछले सेट को स्क्रॉल करता है, तो 'बी' के लिए ऑब्जेक्ट्स का अगला सेट प्राप्त करें, रिक्त स्थान को छोड़कर, सॉर्ट करें, शब्दों और शो में शामिल हों।

    अपना तुलनित्र दें:

      NSArray * sorted = [foo sortedArrayUsingComparator: ^ NSComparisonResult (NSString * str1, NSString * str2) {// सभी स्थानों को निकालें NSString * s1 = [str1 stringByReplacingOccurrencesOfString: @ "" withString: @ ""]; NSString * s2 = [स्ट्रॉफ़ी स्ट्रिंग बिरा रीप्लीसिंग ओकुर्रेंसओफ़स्ट्रिंग: @ "" स्ट्रिंग के साथ: @ ""]; वापसी [एस 1 स्थानीयकृत सीएएसआईएनंसेंसिव कम्पेयरः एस 2]; }];    

    java - whats wrong with this code? -


    For some reasons I keep anything blank which I keep in empty lines, I try to create a program I'm reading the input, removes all the unnecessary white spaces but a place between each word. Then print all the lines

      import java.util.Scanner;  

    Do not use any sentinels to close. Import java.lang.Character; Import java.lang.String; Public class trim {public static zero main (string [] args) {string namename = ""; String sound = ""; Int i = 0; Int count = 0; Scanner scan = new scanner (System.in); While (scan.hasNextLine ()) {count ++; Scan.nextLine (); }; (; I

      while (scan.hasNextLine ()) {count ++; Scan.nextLine (); }   

    This will also read all the inputs before your program actually starts.

    After that (if the program also goes away, STDIN usually does not lock on the console) There is nothing else to read in the second loop in the scan.

    In addition, the names of lower-case class are confused as upper-case variable names. At least you are consistent here; -)

    python - 'variable' or 'variable is not None' -


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

    • 12 जवाब
    • 12 जवाब
        चर = कोई भी   

      क्या एक विशिष्ट परिदृश्य में इन तीनों के बीच कोई अंतर है? अगर कोई अंतर नहीं है जो उपयोग करने के लिए अधिक उपयुक्त है?

        यदि वेरिएबल: प्रिंट "हैलो वर्ल्ड"   

      और

        यदि परिवर्तनीय कोई नहीं है: प्रिंट "हैलो वर्ल्ड"   

      और

        यदि वैरिएबल! = कोई नहीं: प्रिंट "हैलो वर्ल्ड"   

      कोई भी वैरिएबल के मामले में एक ही है?

      क्या है किसी विशिष्ट परिदृश्य में इन तीनों के बीच कोई अंतर क्या है?

      पहले पूछता है कि क्या चर कुछ गलत है यह परीक्षा कोई भी â गलत , 0 , कोई भी रिक्त अनुक्रम, आदि के अलावा सभी प्रकार की चीजों के लिए असफल हो जाएगी।

      दूसरा पूछता है कि क्या यह जादू सिंगलटन स्थिर कोई नहीं है। यह केवल कोई भी के लिए असफल नहीं होगा।

      तीसरा यह पूछता है कि क्या वह कुछ है जो खुद को कोई भी के बराबर मानता है या नहीं। यह धारक (कोई नहीं) के लिए असफल होगा, जहां धारक एक आवरण वर्ग है, जिनके उदाहरणों में वे जो भी हो रहे हैं के बराबर हैं। या कम से कम कोड एक्सएमएपल देने के लिए:

        वर्ग बेवकूफ (ऑब्जेक्ट): def __ne __ (स्वयं, अन्य): लौटें गलत चर = बेवक़ूफ़ ()   

      पिछले एक शायद ही उपयोगी है; वास्तव में, यदि आप कभी भी सोचते हैं कि आपको == कोई भी या ! = कोई भी को चेक करने की आवश्यकता नहीं है, और आप विशेष रूप से पारदर्शी-आच्छादन कक्षाएं नहीं बना रहे हैं या ऐसा कुछ भी , आप शायद वास्तव में चाहते थे कोई नहीं या कोई नहीं है लेकिन अन्य दो बहुत ही उपयोगी और सामान्य दोनों हैं।

      अगर कोई अंतर नहीं है जो उपयोग करने के लिए अधिक उपयुक्त है?

      ठीक है, एक अंतर है, और जो अधिक उपयुक्त है वह विशिष्ट उपयोग पर निर्भर करता है।

      प्रश्न के अंत में, ऐसा लगता है कि आप पूछ रहे होंगे कि क्या विशिष्ट मामले में कोई अंतर है जहां परिवर्तनीय निश्चित रूप से कोई नहीं है। उस मामले में, निश्चित रूप से तीनों के बीच कोई कार्यात्मक अंतर नहीं है। * उनमें से सभी को झूठा होने की गारंटी है, और इसलिए कुछ नहीं करें। इसका अर्थ है कि तीनों में से किसी में भी कोई अंतर नहीं है और कोई भी कोड नहीं लिखता है। कौन सा बहुत आसान, अधिक पठनीय और तेज़ है।

      * एक प्रदर्शन अंतर है? पहले एक LOAD_CONST को कोई भी नहीं है , या एक तुलना ऑपरेटर को कॉल करें और, भले ही आपने किसी भी तरह से कोई भी रिबंड करने में कामयाब हो या कोई भी स्थिर (शायद ctypes ?), पहले एक अभी भी काम करने की अधिक संभावना है। लेकिन इनमें से कोई भी कभी भी बात नहीं कर रहा है और, यदि वे करते हैं, तो फिर, कोई कोड बिल्कुल भी तेज और अधिक विश्वसनीय नहीं होगा।

    c++ - Subtracting two chars and adding them to a string -


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

    • 3 उत्तर
        #include & lt ; iostream & gt; #include & lt; स्ट्रिंग & gt; Int main () {char s2; S2 = '1' - '0'; Std :: cout & lt; & lt; s2; Std :: cout & lt; & lt; std :: endl; Std :: cout & lt; & lt; '1' - '0'; Std :: cin & gt; & gt; s2; }   

      उत्पादन का उत्पादन होता है:

        एक ?? º 1   

      मेरा सवाल है, क्यों दो लाइनें अलग? मुझे उम्मीद थी और दोनों परिणाम 1 होना चाहते थे मेरी समझ से वे समान होनी चाहिए, लेकिन यह स्पष्ट रूप से गलत है, क्या कोई मुझे यह समझाएगा?

      दो लाइनें अलग क्यों हैं? < P> पहली अभिव्यक्ति का प्रकार ( s2 ) है char । दूसरे का प्रकार ( '1' - '0' ) है int

      यही कारण है कि उन्हें अलग-अलग ढंग से प्रस्तुत किया जाता है एक ही संख्यात्मक मान, 1 । पहली बार प्रदर्शित किया जाता है, जबकि दूसरा नंबर 1 के रूप में प्रदर्शित होता है।

      यदि आप सोच रहे हैं कि क्यों '1' - '0' देता है int , देखें

    paperjs - Hit test with a radius on a point -


    The following code in the paper.js structure performs a hit at the point of coordinate of mouse coordination. Function OnMouseUp (Events) {var hitOptions = {Stroke: Wrong, Fill: Correct, Tolerance: 2}; Var hitResult = project.hitTest (event.point, hitOptions); }

    I want to do this that I have to do this exam within the given radius of event.point (), but I have not found any way yet.

    Any thoughts?

    UPDATE

    I think the way I was setting the option should be ignored. The following code works:

      var hitOptions = {fill: true, stroke: true, Segment: true, tolerance: 200}; Var hitResult = project.hitTest (event.point, hitOptions); Alert (hitResult);  

    It seems that due to a bug the tolerance option is not read. You can manually change the tolerance by modifying the line 3631 (at night). For example, if you want a test radius of 200 points:

      Tolerance: paper.project.options.hitTolerance || 2   

    to:

      Tolerance: paper.project.options.hitTolerance || 200    

    c# - How to Convert ListView to Datatable in WPF? -


    कैसे ListView से DataTable को परिवर्तित करें < p> <कोड> XAML

     <कोड> & lt; ListView एक्स: नाम = "listViewUserHUD" ItemsSource = "{CollectionUserData बाइंडिंग}" ScrollViewer.HorizontalScrollBarVisibility = "अक्षम" IsSynchronizedWithCurrentItem = "सही" Util: GridViewSort.AutoSort = "True" मार्जिन = "16,59,15,61" & gt; & LT; ListView.View & gt; & LT; GridView & gt; & LT; GridViewColumn DisplayMemberBinding = "{बाइंडिंग FileNumber}" हैडर = "FileNumber" चौड़ाई = "125" util: GridViewSort.PropertyName = "FileNumber" / & gt; & LT; GridViewColumn DisplayMemberBinding = "{बाइंडिंग ShiftDate}" हैडर = "ShiftDate" चौड़ाई = "125" util: GridViewSort.PropertyName = "ShiftDate" / & gt; & LT; GridViewColumn DisplayMemberBinding = "{बाइंडिंग TimeCreated}" हैडर = "TimeCreated" चौड़ाई = "125" util: GridViewSort.PropertyName = "TimeCreated" / & gt; & LT; GridViewColumn DisplayMemberBinding = "{बाइंडिंग टिप्पणियां}" हैडर = "टिप्पणी" चौड़ाई = "350" util: GridViewSort.PropertyName = "टिप्पणी" / & gt; & Lt; / GridView & gt; & LT; /ListView.View> & Lt; / ListView & gt;   

    कोड नहीं काम कर रहा है:

      var listView1 = नया ListView (); डेटाटायल तालिका = नया डेटाटाले (); फोरहैच (सूची में सूची आईटम आइटम सूची 1। आईटम्स) {table.Column.Add (item.ToString ()); उपन्यास (आइटम में इसे अलग करें)। तालिकाएं। राक्षस। जोड़ें (यह। टू स्ट्रिंग ()); }   

    यह अब मेरे पास वाला कोड है, लेकिन मैं कोशिश कर रहा हूं, ऐसा है I मैं कैसे ListView कन्वर्ट DataTable हर बार जब मैं ListView पर एक आइटम प्राप्त होती है?

    <कर सकते हैं Div class = "post-text" itemprop = "text">

    तालिका बनाने के लिए बेहतर है आपके डेटा स्रोत ऑब्जेक्ट का स्वरूप:

      // अनुसार डेटाटाबल संरचना बनाएं आपके डेटा स्रोत के लिए डेटाटायल तालिका = नया डेटाटेबल (); तालिका। कॉलम। जोड़ें ("फ़ाइल संख्या", टाइपफ़ (इंट)); तालिका। कॉलम। जोड़ें ("शिफ्टडेट", टाइपफ (दिनांकटाइम)); तालिका। कॉलम। जोड़ें ("टाइम क्रेटेड", टाइपफ (डेटटाइम)); तालिका। कॉलम। जोड़ें ("रिमार्क्स", टाइपफ (स्ट्रिंग)); // डेटा स्रोत ऑब्जेक्ट के माध्यम से पुनरावृत्त करें और तालिका foreach भरें (CollectionUserData में var आइटम) {table.Rows.Add (item.FileNumber, item.ShiftDate, item.TimeCreated, item.Remarks); }    

    jquery - having trouble convert getJSON data to model -


    I can not seem to be working knockout when I get the storage from getJSON. Here is an example of my code

      function MyTestDodel () {this.modelProperty = ko.observable (); This.myCompute = ko.computed (function () {return "test";}); } MyViewModel () {var} = this; Self.myTestModels = ko.observableArray (); } Var vm = new MyViewModel (); Ko.applyBindings (VM); $ (Document) .ready (function () {$ .getJSON ("http://MyUrl.com/api/MyController", function (data) {var viewable data = to.mapping.fr JS (data); Var array = observation data (); Vm.myTestModels (array);});}); & Lt; Tbody data-bind = "foreach: myTestModels" & gt; & Lt; TR & gt; & Lt; Td data-bind = "text: model property" & gt; & Lt; / Td> & Lt; Td data-bind = "text: myCompute" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; [{"ModelProperty": "My Property 1"}, {"Model Property": "My Property 2"}]   

    What is the data for model property show, but chrome javascript The console says: Unacceptable error: Unable to parse binding message: ReferenceAir: My computer is not defined; Binding Value: Text: Microdoot

    It appears to me.mapping.fromJS is not converting it into MyTestModel. I'm thinking because Knockout does not know about my test model, but I'm not sure How is that to tell about my model?

    Still, thanks for everyone!

    You did not specify that array items should be converted to MyTestModel.

    It converts each array item into MyTestModel:

      $ (document) .ready (function () {$ .getJSON ("http: // MyUrl. Com / api / MyController ", function (data) {var array = ko Utils.arrayMap (data, function (item) {new MyTestModel (item.modelProperty);}); vm.myTestModels (array);});   

    I hope this helps.

    mysql - GROUP BY DAY(FROM_UNIXTIME) unexpectedly changes count -


    I am accumulating session IDs, IP addresses and timestamps of individual website visits, and all associated pageviews in the database. This includes more data, but related data has been removed from this query:

      SELECT page views .id, visitors.time, visitors, visitors. Pageviews on visitors coming from visitors. Session = Pageviews.session Order by visitors. Time ASC   

    There are some such results:

      ID time session IP 1048 1371473496 nhie5sh2tiufs2ufupcremc6c2 x88.xxx. Kskskskksksks 1050 1371474103 8hfphqvq5ri6muc84oidp7q195 X6xkkskskskkskskskksksks 1062 1371474 9 56 hhgssr4v26pjbilkg8d81olqj7 Xxxkks3xkkskskskksksks 1066 137147633 9 ic8iqd0a4mpoelni15n4tq3404 Xlxkkskskskkskskskksksks 1067 137147662 9 ockivrm61upk7ss5ni4n8muv23 X2xkkskskskkskskskksksks 1070 +1371477856 5tdj9rrd1qsvafovufnkgh8r26 Xxxkksksks . X7x.xxx 1068 1371477856 5tdj9rrd1qsvafovufnkgh8r26 xxx.xxx.xxx.x2x 1069 1371478229 5e82v29nuf2k46ir13i21msps5 xxx.x5x.xxx.x8x   

    The total number of visitors (different IPs), visits (different sessions) And the pageviews (separate pageview id), I ask the database like this:

      select count (differentiate (visitors.IP)) as 'visitors', count (individually) (Visitorship)), 'Visits' joins visitors with 'Pageview' in the form of Count (PageviewId). = Pageviews Session   

    which gives something similar to the following:

      Visitor Visit Pageviews 211 244 412   

    However, I Use archived timestamps for those years, months and days. To get that data, I wrote the following question:

      SELECT DAY (FROM_UNIXTIME (Visitors.time)) as 'de', MONTH (FROM_UNIXTIME (visitors.time)) 'Month' Year ('FROM_UNIXTIME' (Visitors.time)) as 'Year', Count as 'Visitors' (separate (Visitor.IP)), Count as 'Visits' (Separate (Visitorship) )), Count (Visitors on Visitors from Visitors to Pageviews 'Pageviews') = Pageviews C By year, month, year order of year, month, day DESC   

    This works very well, at that date, pageviews and visits are correct: Day Month Year Visitors Visits Page Views 20 6 2013 40 43 59 19 6 2013 80 90 112 18 6 2013 62 66 173 17 6 ​​2013 43 45 68

    As you can see, here the pageview reaches up to 412 and up to 244. What has kept me at night, however, is that of visitors Is not increased Nkya 211, as it should be, but instead of 225. I do not know why this is happening only for visitors

    Sorry for the long question Any ideas will be highly appreciated.

    Since you are counting a different IP, when you group groupings per month (months) The number of different IPs, i.e., if they travel in months, people can be counted more than once. For example: 12.123.456.78 visits in March and April, this is a specific IP counted each month, but if there is only one separate IP if the group is not from month to month, then you do not want to aggregate total COUNT (DISTINCT) Can not add results of a grouped COUNT (DISTINCT) only.

    This functionality can be helpful because it puts some light on repeat visitors.

    CodeIgniter redirect to another function when request is made by cURL -


    I have a function, "Function A", a codeigner controller that contains a function redirect, "Function B "to send an email when this data is collected to collect my problem is that when I enter the function A URL in the browser, the function works as expected and the redirect to function B works. .. But curl scroll to function a Is called by IV, and is it possible to redirect function in this scenario is used to do the function belongs but redirect function B does not work (when the request is made by curl)?

    Can you show your curl code? I think you use something like this:

      $ ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, $ url); Curl_setopt ($ CH, CURLOPT_HEADER, true); Curl_setopt ($ CH, CURLOPT_FOLLOWLOCATION, true); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, TRUE); $ Result = curl_xac ($ CH); Curl_close ($ ch);   

    Check this string (it must be set to true):

      curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true);   

    And you can use the next thing (in the example of topperren):

      function first_function () {ob_start (); // do stuff $ this- & gt; Second_function (); Ob_end_flush (); } Function second_function () {// send email}    

    python - Using Property to duck type two models -


    I have a dynamic model that can have one of two objects through its related foreign key (call them Click on object1 and object2 ). Two other classes are functionally nearly identical, but this involves a little different information, on the suggestion of another Stack Overflow question, I am setting up Python method property () and which I am also receiving the object that exists. It looks like the following:

      class master (models.Model): object 1 = model. Exotic (Object 1, Blank = True) object2 = Model Forwardkey (object 2, empty = true) def get_object (self): if self.object2_id: return self.object2 else: return self.object1 def set_object (self, example): if isinstance (example, object 2): self.object2 = Example self.object1 = None else: self.object2 = None self.object1 = Example Object instance = Property (get_object, set_object)   

    This is a simplified version of the class. I thought everything was working properly. I was able to set, and was able to get the information, and could display data organized in objectInstance on many of my pages. I am using django-tables2 to display information in tables, and it Was also able to show all the information. However, when I try to solve the data (using the provided convenient arrows) I get the field error:

      on field error / workflow / list / request / keyword u_objectInstance The farm can not be solved. The options are: Object 1, Object 2   

    What is happening with any idea? Or what is the code snippet for you to see what is the reason?

    EDIT:

    It seems that I am not the only one with this problem. This post seems to indicate that it is a problem with django-tables2

    It seems that when the table can display information placed in a property It has trouble troubleshooting

    If you want to use a decorator, see.

    But the best way

    Edit

    It may be that:

      class Master (models.Model): content_type = models.ForeignKey (ContentType) object_id = models.PositiveIntegerField () objectInstance = generic.GenericForeignKey ('content_type', 'object_id')   

    Therefore, you You can do this:

      & gt; & Gt; & Gt; T = Master (object instance = object2 ()) & gt; & Gt; & Gt; T.save ()> gt; & Gt; & Gt; T.objectInstance & lt; Object2: a_description & gt; & Gt; & Gt; & Gt; T.objectInstance = Object1 ()> gt; & Gt; & Gt; T.save ()> gt; & Gt; & Gt; T.objectInstance & lt; Object1: a_description & gt;   

    Hope it helps!

    c# - How to see the files of WorkingDirectory of QTAGent -


    I am running an automated test from MTM on a test agent controlled by a test controller. In my project folder, Bank Automation I have a folder called SQLQL and it contains a file named "EmployyeSearchQuery.sql". But when my project is from this data If Sql tries to read the file, it receives the following error.

    Could not find a part of the path 'C: \ user \ user name% \ AppData \ local \ VSec \ sqq \ employee \ search. SQL '

    I have the code:

      fileinfo file = new fileinfo (@ ".. .. .. .. .. .. \ Bankout \\ \" SQLScripts \ EmployeeSearchQuery.sql " ); String strRecQuery = file.OpenText (). ReadToEnd (); StrRecQuery = strRecQuery.Replace ("\ t", ""). ("\ N", ""). ("\ R", ""). Trim ();   

    What do I want to do, I need to see the file on the path: 'C: \ user \ user name% \ AppData \ Local \ VSEQT'.Where can I enable it?

    And the path is' C: \ user \ user name% \ AppData \ local \ VSEQT. "Changes every time or is it fixed? Is there a way we can change?

    I looked at QTAgent.exe.config but there is no such way. Is my relative path correct?

    If I understand you correctly, then you have added EmployeeSearchQuery.sql to your Visual Studio project and your property" copy in Output Set directory "to" always copy ", okay?

    If so, that means your file will be copied to the build output directory.

    If you need this file while you run your tests, then you have to assign it. Test Settings by using the file or [DeploymentItem] Using the attribute (especially if you apply this file for a specific test

    This article will help you: (It is AC visual studio while describing the test running but the deployment process is the same if you MTM .

    If you [DeploymentItem] attribute please check it :, it will save you a lot of time.

    c# - Getting a singleton instance using SimpleInjector for a class which implements a generic type, not actually returning a singleton -


    I have to face some strange code-issues, and in the end it has seen that as a singleton It is considered to be working in the form, actually there is not a singleton, it is a cash-class, so I'm ending multiple versions of the same cash. I have written some test codes below, and this should work in my eyes. Am I doing something wrong, or have I stumbled into a bug?

      Public Class GenericClassesNotRegisteredAsSingletonTest {Public Interface ICacheManager & lt; T & gt; {} Public Square SettingsData {} Public Category Settings Cache: CacheManager & lt; SettingsData & gt; {} Public Class Cash Manager & lt; T & gt; : ICacheManager & lt; T & gt; {} [Test] Public Zero Test () {var Container = New Container (); Var registration = Lifestyle. Signalton .CreateRegistration (typefacetch), typef (settingscatch), container); Container.Update registration (typef (ICK manager, & lt; settings data & gt;), registration); Container.Verify (); Var cache1 = container.GetInstance & lt; SettingsCache & gt; (); Var cache2 = container.GetInstance & lt; SettingsCache & gt; (); Bool sameRef = cache1 == cache2; Notice. That (sameRef == true); }}    

    You made the following registration:

      _container.AddRegistration (service type: type (ICacheManager , registration: registration);   

    And you are following the following solutions:

      _container.getInstance & lt; Settings cache & gt; ();   

    You have not explicitly registered SettingsCache , but only ICacheManager & lt; SettingsData & gt; Since SettingsCache is a solid square, the simple injector will solve it for you as a transient example.

    To resolve the solution either SettingsCache or ICacheManager & lt; SettingsData & gt; Instead, you can register another one using the same registration example, for example:

      _container.AddRegistration (service type: type (settingscatch), registration: registration);   

    will warn you about this.

    Eliminating part of arrays in matlab -


    Assume that we have a 100 * 4 array.

    We also have a 100 * 1 array, say 1 and 0, assuming that N1 is.

    We want to create an array * 4 from the array 100 * 4, where we include only those columns for which the second array is 1.

    One way to do this is through a double for the loop. Is there an easier way?

    Then, we have

      A = [332 44 33 22 33 55 33 211 ..... [823 44 12 98 1] 23 32 9 11. ... .... .... ....   

    and

      b = [0 0 0 0 0 0 ...]   

    and we want

      c = [[332 22 ... [823 98 ... ... ... .]    

    You should use:

      C = A (:, B == 1);    

    how to add a dynamic date filter to Access report -


    I am accessible and very new to VBA.

    I have created an access database and report. One of the columns in the report is a date column and I want to create a dynamic user filter where the user can enter the date range and the query can accept that filter.

    I am using Access 2013. On the property sheet I see a lookup section, where I can select a textbox, listbox or combo box. I also see a section 'input mask'. Do I need to use these, and if so, how? Do I need a VBA code anywhere?

    I usually make that form in which the user can keep any dynamic information Can be added. Even if this is only one date field, then it's okay.

    The query behind the report will be the date fields you use, and you can

      = [form] in the criteria! [MyFormName]! [MyTextBoxName]]   

    Where MyFormName is the name of the form mentioned above, and MyTextboxName is the name of the text box that the user adds the date.

    Then press a button that opens the report on the form!

    r - Shiny Binary Check boxes -


    I was thinking that for a glossy check box it is possible to inspect each other in the UI, if I One should be examined, the other should be unchecked, exactly the opposite.

    I came to the Function Updates checkbox but the example shown is used for server side, is it possible to check the check box between each other on the UI side?

    Thanks,

    How is this commonly used for radio buttons Is ? Watch RadioButtons Is there any reason that will not work here?

    standards - Does the top-level value in JSON have to be an array or object? -


    यह वस्तु सचमुच मान्य JSON है:

      {"foo": "bar"}   

    और इसलिए यह सरणी शब्दशः है:

      ["foo", "bar", 1, 2, 3, null]  < / Pre> 

    लेकिन स्वयं के द्वारा एक तार के बारे में क्या?

      "foo"   

    या स्वयं के द्वारा कोई संख्या?

      0    

    संक्षिप्त उत्तर हाँ है
    JSON को वस्तु के रूप में स्ट्रिंग के रूप में प्रतिनिधित्व करने के लिए और स्ट्रिंग को ऑब्जेक्ट में कनवर्ट करने के लिए प्रयोग किया जाता है।
    यदि आप स्ट्रिंग को ऑब्जेक्ट या एरे में बदलने की आवश्यकता नहीं है तो यह JSON से संबंधित नहीं है।

    asp.net - jQuery: adding a class to child elements x number of times -


    I have a Dave star performs the racquet which displays 5 graded-out stars. I have been given a number and depending on the number, I need to add a CSS class which turns the grade-out star into a colorful color. Is there anything that I can complete for a loop or with it? what?

    Here's HTML:

      & lt; Div id = "star rating" & gt; & Lt; Div class = "jquery-ratings-star" & gt; & Lt; / Div & gt; & Lt; Div class = "jquery-ratings-star" & gt; & Lt; / Div & gt; & Lt; Div class = "jquery-ratings-star" & gt; & Lt; / Div & gt; & Lt; Div class = "jquery-ratings-star" & gt; & Lt; / Div & gt; & Lt; Div class = "jquery-ratings-star" & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

    And this is what I am trying to do. It seems that I am engaging it.

      $ ('.jquery-ratings-star'). Each (function () {for (var i = 0; i & lt; nbrStarsVoted; I ++) {$ (this) .addClass ('.jquery-ratings-full');}});    

    Simple in this form,

      $ ( '#RarRetting Div: LT (' + NBR StarWit + ')' ' Adquass ('jquery-ratings-full');   



    php - Array_Push AutoComplete -


    I have a form that receives the "from" field for the flight:

     < Code> & lt; P & gt; & Lt; Label & gt; & Lt; / Labels & gt; & Lt; Input type = 'text' name = 'nerene' value = '' class = 'auto' id = "1" & gt; & Lt; / P & gt;   

    And I have the autocomplete method:

    $ return_arr = array ();

      if ($ conn) {$ ac_term = "%" Get $ _ ['word'] "%"; $ Query = "SELECT table2.CityName, table2.CountryName, table2.AirportName from Table 2 where CityName: word"; $ Result = $ conn- & gt; Ready ($ query); $ Result-> BindValue (": word", $ ac_term); $ Result-> Executed (); / * Retrieve and store results in the query. For $ / ($ i = 0; $ i & lt; 3; $ i ++) {if (get $ line = $ result-> (PDO: FETCH_ASSOC)) {Array_push ($ return_arr, array ( 'Label' = & gt; $ line ['cityname'], 'value' = & gt; $ line ['citcode'])); Array_push ($ return_arr, array ('label' = & gt; $ row ['CityName'] + "" + $ row ['AirportName'], 'value' = & gt; $ line ['citcode'])); }}   

    This code works fine when I exclude the + $ line ['airportname'] but as a dummy example to auto-complete it Want to show: Athens, Athens Airport

    Row names, connections are all right How can I do this?

    Thanks

    In PHP, this . , No + . The line ['airportname'], 'line', 'array_push' ($ return_arr, array ('labels' = & gt; $ line ['cityname']]. "" $ Line ['airportname'], '' lang-php prettyprint-override " Value '= & gt; $ line [' citcode ']));

    Java: read bytes from a utf-8 file -


    I have a file that contains UTF-8 data in this file for every Unicode word / line any BOM ( Byte order mark) and neither any length / size information.

    I have to read the offsets offset (yes bytes!) Length. If the functions of the API work offset by reading the bytes, reading bytes or reading bytes, it will really be helpful.

    Example Content - "100 degree information", the length of this material is 9, if I request to read 9 bytes, then he should read everything. Currently it is only reading 8. It seems that the API is treating the Unicode character as 2 characters.

    How to read the content correctly? Which API is used for the same API?

    But Unicode characters for the degree are actually two bytes when encoded UTF-8. A degree symbol is represented by bytes c2 b0 . If you really want to read bytes on a specific offset in a file, then you can use RandomAccessFile in Java, but I doubt what you really want. Perhaps the easiest way to do it seems that you want to use FileReader and either read an array of 9-letter characters, or a large Read only 9 characters in the character array. For example: Try

      (Reader Reader = New Input Strieder Reader (New File Inputstream (File Name), "UTF-8")) {char [] buffer = new Charge [1024 ]; Reader Read (buffer, 0, 9); }    

    jquery - Placing image in front of background -


    I have a section that slides with a blue background, I try to put a picture in the upper left corner I am doing it but it is hard to see and the blue background disappears.

    HTML part:

      & lt; Header ID = "Main" & gt; & Lt; A href = "#" id = "stackoverflow" class = "symbol" & gt; & Lt; / A & gt; & Lt; / Header & gt; & Lt; Section id = "stack" category = "news" & gt; & Lt; / Section & gt; Click (function () {$ ('# stack'). Toggle ('Slow')   

    , $ St); $ ('# Stack') CSS ({'background': 'url (stack.jpeg) no-repeat', 'position': 'absolute', 'z-index': '1'});});

    CSS:

      #stack {float: left; } .news {status: Completed; Z-index: -1; Width: 600px; Background color: # 0000FF; Padding: 10px; Range radius: 10px; Box-shadow: 3px 2px 3px # 000; }. A {status: absolute; Text-decoration: None; Color: #fff; }. News: Hover {Color: # DC-692e; } .news td {padding: 5px 10px; Border bottom: 2px #fff solid; }   

    By putting an image in the corner I do not try to: here Enter an image description

    When I try to add an image to the corner, here's a picture:  Enter image details here

    Thanks!

    Due to the blue back ground is disappearing, due to overwriting your background. What you can get after:

      $ ('# stackoverflow'). Click (function () {$ ('# stack') toggle ('slow' $ st); $ ('# stack'). CSS ({'background': 'url (stack.jpeg) No-racquet blue ',' Position ':' complete ',' z-index ':' 1 '});}); Apart from this, after placing the image in the background, I say that adding some padding at the top of the element means that the text does not eliminate your image. .  

    A better solution is to actually inject that image into a particular element. IE:

      $ ('# stack'). Prepaid ('& lt; img id = "theImg" src = "theImg.jpg" / & gt;')    

    linux - Fastest way to create animated gifs from mp4 -


    I get the batch process in animated GIFs in a very high number (200,000 +) small MP4 (less then 10s) have to keep. I think I have tried every possible command line to do this, but it still takes a lot of time to produce quality gifs. Currently I use FFPAP to open the image (JPG), and the image magikk converts them to collect. It creates a high-quality GIF, but takes a lot of time and uses a lot of memory and CPU, even with tile-to-memory storage and map boundaries.

    I have also tried to create animated GIF using FFPAG, but the quality is awesome in the best. Besides, I tried to use gifsicle, which appears to be fast, but It only takes gifs as input, and uses ffmpeg to produce poor quality gifs.

    Does anyone have some high quality command line dishes, GIF creation?

    For the first time you should create a maximum quality JPG image using the mplayer And jpeg option set 100 (jpeg: quality = 100).

      mplayer -ao null -ss 0:00:00 -endpos 10 mts .flv -vo jpeg: outdir = jpeg_dir: quality = 100   

    next , You need to convert by using convert to generate from JPG, just type:

      for i /Jpeg_dir/ * .jpg; Change "$ I" "$ {i% .jpg} .gif";   

    and finally use gifsicle Animated GIF:

      gifsicle --delay = 10 --loop ./jpeg_dir / * .gif & gt; Anim.gif   

    In addition, you can use the customizable level flag - customizable = 03 . File size may be helpful in reducing:

      gifsicle --delay = 10 --optimize = 03 --loop * .gif> In addition, Anim.gif   

    In addition, you can manipulate with the number of colors - color of the current color num and - color scheme < / Code> to determine the most suitable palette.

    < P> Apart from this, I try to manipulate with the described flag and found the most useful option to get better quality of GIF-image generated:

      gifsicle - delay = 3 - optimize Do = 03 - Color-mode mid-cut --loop * .gif & gt; Anim.gif   

    To be consistent with the animation speed, be accurate with - delay = NUM ​​, depending on the FPS of the original video.

    asp.net mvc - RESTful application -


    Roy fielding came with this idea and many applications have been made around this, but I am really confused Where is it called Representative State Transfer? In almost every application, we do not go from one page to another and when we go from one page to another, the application changes.

    After reading some articles, I know 1. The build is on HTTP, 2. Allows caching. 3. Resources can be accessed using URI.

    What are the other benefits of regular ASP.NET web form application? Please help why and where will i need cool application.

    BTW I have been programming ASP.NET web forming for a long time and in fact I do not know about new technologies.

    Thanks in advance.

    I see that this trend is:

    1996 - Classic ASP

    2002 - ASP.NET

    2009 - ASP.Net MVC

    2012 - ASP.Net Web API and Single Page App < Maybe you mean a single-page application through "restful application":

    This is where the trend is going, I believe - Instead of creating a UI and business logic on the server side, you can use the Rich Protocol Types can only create rich client side UI communicating with the server, through business logic and tragic closure on the server side), so that you can provide a better experience to your users. In addition, you can create multiple UIs for various platforms (web UI, iOS, Android, Windows Phone, Windows 8 app, etc.), all of which are consuming the same API service.