Monday, 15 June 2015

python - Recursive definitions in Pandas -


I have a time-series A holding multiple values ​​in a series B which is algebraically defined as:

  b [t] = one * a [t] + b * b [t -1]  

Where we can assume B [0] = 0 and a and b Are real numbers

Is there a way to calculate this type of recursive list? Or do I have no choice, as suggested in loop in Python?

As an example of input:

  & gt; A = pd.Series (np.random.randn (10,)) 0 -0,310354 1 -0,739515 2 -0,065390 3 0,214966 4 -0,605490 5 1,293448 6 -3,068725 7 -0,208818 8 0,930881 9 1,669210  

As I have a comment As noted in, you can use. In this case (there is a one-dimensional numerical chaos assuming A ), you only need it:

  B = lfilter ([a], [1.0, - b]], a)  

here's a complete script:

  import numpy scipy.signal import lfilter np.random.seed (123) a Calculate the recycling using NP.random.randn (10) a = 2.0 b = 3.0 # lfilter in the form of NP. # [A] and [1, -b] coefficient of fraction and filter transfer function # of the rot, resp. B = lfilter ([a], [1, -b], A) Print B # Compare with a simple loop B2 = np.empty (lane (a)) range (0, lane (b2)) in Kashmir For: K == 0 if: b2 [k] = one * a [k] rest: b2 [k] one = * a [k] + b * b2 [k-1] print b2 print "maximum difference : ", np.max (np.abs (B 2 - B))  

the script:

  [-2kl7l26l2le +00 -4k5l909273e +00 -lk299l32l2e + 0l + 0l -4kl9865530e -lk27ll6859e -3k78047705e +02 +02 +03 -lkl3899647e - 3k4l784725e -lk025l0099e +03 +04 +04 -3k0754763le] [-2kl7l26l2le +00 - 4k5l909273e +00 -lk299l32l2e + 0l + 0l -4kl9865530e -lk27ll6859e +02 -3k78047705e +02 -lkl3899647e + 03 -3k4l784725e -lk025l0099e +03 +04 +04 -3k0754763le] maximum difference: 0.0 < / Code> 

one more Examples IPython, using a panda DataFrame instead of a numpy array:

If you have

  [12]: df = pd.DataFrame (in [1, 7, 9, 5], column = ['A']) in [13]: DF out [13]: A1 1 7293 5  

You want to create a column, B , such as B [k] = A [k] + 2 * B [k-1] ( b [with] For & lt; == 0 0), you can type in [14]: df ['B'] = lfilter ([1], [1, -2], df ['A'] in

  ']. [15]: DF out [15]: AB 0 1 7 7792 9 27 3 5 59  

c# - MVC 4.5 ignores value in model if a matching field is in URL or post data? -


I saw some unexpected behavior at the end of this week. I made MVC a super simple page to display to anyone learning someone.

The model contains an item, 'string text {found; Set up;} '' '

Find only two methods for the index ()' and '[HTTP post] in the index (string text) index (), I created a model, and "enter some text Do "and set the value of the text (model)

In the CSTML file, my two items were:

@html. Textboxfor (M => M.Test)

and

@models. Text

which will only display the value of the text.

And submit a submit button. (It has been sent back to the index)

Here it becomes weird in the post method, I created a new model, which is the "text" property "+" !!

I was hoping that if I set the text in 'A', and hit the button, it would be 'one !!' In the text box as well as 'a !!'

However, instead, the value of the edit box remains the same, and the value of the @model. The text changes!

It will also be if you execute the GET URL with the text = A - no matter what you pass in your model, it will leave the value used in the text box / text array and ' A 'will show! But, the value of the text from the @model. In the model passed to see the text, the values ​​will be displayed correctly.

It seems that they had to go out to break it - instead of this model url / post data.

Wtf?

Controller:

  Using the system; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.Mvc; Using TestApp.Models; Namespace TestApp.Controllers {Public class homeController: Controller {public performance index} {TestModel model = New TestDodel {text = "Enter your text here!} Return view (model);} [HTP post] Public ActionRashult Index (Testodel model) {Model.text = model.text + "!!"; Return View (model);}}}  

See:

  @ TestApp's usage Using model @modelTestodel @Usage (HTML.benform ("index "," Home ")) {@ Html.TextAreaFor (M => M. Test, 10,50, blank) 
type = "Submit" & gt; Save & lt; / button & gt;}

and complete System, using System.Collections.Generic; System.Linq; System.Web; Namespace TestApp.Models {Public Class TestModel {Public String Text {get; set;}}} using the system

   

This design is by request and / or view data ( The value is used in the ModelState object, and the values ​​from ViewBag are included in the Model; Model code in model code override values ​​in actual model data This is necessary for the values ​​posted to override.

For example, in which case a user posts a post, but there is an error which prevents data from being saved, the user is sent back to the form. What should be here now? Because the data was not saved, the model is still a basic value from the database, or whatever if the value of the model is preferred, then what was recorded by the user before it will be overwritten. However, if modelstate values ​​are used, then the user sees that form, as they submit it originally and can make the necessary modifications to resubmit. Obviously the latter option is ideal.


c - Printf before fork() is being printed twice -


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

  • 3 जवाब

मैं एक बहु- कांका () का उपयोग करने वाली प्रक्रिया कार्यक्रम और मैं एक समस्या में टकराया

नीचे समस्या का पुन: प्रस्तुत करने वाला एक नमूना कोड है (त्रुटि जाँच के किसी भी प्रकार के बिना):

  #include & lt; stdio.h & gt; # शामिल करें & lt; unistd.h & gt; # शामिल करें & lt; sys / types.h & gt; Int main () {printf ("हैलो दुनिया"); कांटा(); }  

यह कोड 2 "हैलो वर्ल्ड" स्टेटमेंट प्रिंट करता है (माता-पिता से एक और दूसरे बच्चे से) हालांकि यह ऐसा नहीं होना चाहिए क्योंकि printf फ़ंक्शन कॉल फोर्क () सिस्टम कॉल से पहले है। परीक्षण के बाद, समस्या निम्न द्वारा सुलझायी जाती है:

  #include & lt; stdio.h & gt; # शामिल करें & lt; unistd.h & gt; # शामिल करें & lt; sys / types.h & gt; Int main () {printf ("हैलो वर्ल्ड \ n"); \\ नई लाइन के चरित्र के अलावा / या fflush (stdout) का उपयोग करके; कांटा(); }  

मेरा अनुमान यह है कि printf बफ़र को नकल नहीं किया जा रहा है, जबकि इसे फ्लेवर नहीं किया गया है, इसलिए बाल प्रक्रिया इस बफर को बाहर निकलने से पहले ही खाली कर रही है। इसलिए अन्य printf दिखाता है

क्या कोई इस मुद्दे के बेहतर स्पष्टीकरण प्रदान कर सकता है? या इससे भी बेहतर, मुझे सही करें यदि मैं ग़लत हूँ या कुछ भूल गया हूं। फ़ाइल संभाल stdout (जो printf <द्वारा प्रयोग किया जाता है

) डिफ़ॉल्ट रूप से लाइन बफ़र है, जिसका अर्थ है कि printf का उपयोग करके आउटपुट को फ़्लश किया जाएगा (और कंसोल में दिखाया गया है) या तो जब कोई न्यूलाइन होता है या बफर पूर्ण होता है ।

के रूप में कांका मूल प्रक्रिया की एक सटीक डुप्लिकेट बनाता है, दोनों प्रक्रियाओं (गैर फ्लश) आउटपुट बफ़र में एक ही सामग्री होती है, और जब दोनों प्रक्रियाओं से बाहर निकलता है।

तो हां, आप अपने अनुमान लगाने में सही हैं।


node.js - How do I launch server for multiple mocha chai-http test files? -


I'm starting my node server before block on my Mocha Tea-HT check.

I am doing the right thing for single test files, however, when I try to run multiple tests in a single command then NODE_ENV = test mocha test / ** / *. Js I get an error.

I tried to keep the node, the server launches on different ports in the test file. It did not work, found node server start errors

Now I'm thinking that it would be great if I have a single MOA file that runs before running other servers before my other test files and Then after a second file that hits the other test files / stop the server.

How do I go about this?

Below I have some code:

Here is a test file for reference:

  var chai = require ('chai'); Var chaiHttp = Expected ('Tea-HP'); Chai.use (chaiHttp); Expecting Var = chai.expect; Var Seal = is required ('seal'); ('REST user API', function () {var app}, log in to the start and stop seal server before {Sails.lift ({port: 3001}: {level: 'error '}}, Function (_err, _sails) {if (_RR) {console.log ("error!", _RR); done ();} else {app = _sails.hooks.http};) () () ) () () () ();} ();}}};}}; Description ("user session", function () {var res; // http response var authenticatedUser; before (function (done) {chai.request app). Post ('/ user / signin') .set ('accept' Submit ('content-type', 'app / jason'). ({Email: 'admin@ test .com', password: 'secret'}) .end (function (_res) { Enter the response to the test = _res; // test. Authenticated user = JSON.parse (_res.text); // Save the response to user authenticated tested ();});}); It should "join with 200 position", function () {hope (rec) .to.have.status (200);}); This is ("must be a complete user session", function () {var userSession = authenticatedUser; hopefully (user session) .to.have.property ('firstName'); Hopefully (user session) .to.have.property (User session) .to.have.property ('gender'); expectation (user session) .to.have.property ('locale'); expectation (user session) .to.have.property ('Timezone'); hope (user session) .to.have.property ('picture'); expected (user session) .to.have.property ('call'); expect (user session) .to.have Property ('email'); hope (umm Door (user session); to.have.property (user session) .to.have.property ('confirmation'); Expected (user session) .to.have.property ('position'); Expected (user session) To.have.property ('authToken');});}); After (function (done) {sails.lower (function () {done ()})}); });  


C++: Converting stringstream to char* runtime error -


I'm trying to convert the string stream of "1.txt" to C ++ so that it's four * values Equals "1.txt". I need raw four * in the form of logic for the function, so it can not explain cells or anything else when I run it, I get an empty output, why I can, and how can I fix it ?

  #define SSTR (x) dynamic_cast & lt; Std :: stringstream & amp; & Gt; ((Std :: stringstream () & lt; std :: dec>  Argc; Std :: string arg; Std :: string arg3; While (streamstream> gt; & gt; arg) argv.push_back (arg); (Auto i = argv.begin (); i! = Argv.end (); i ++) argcpush_back (const_cast & lt; four *> (i-> c_str ()); Arg.push_back (0); Int arg4 = argc.size (); (Int i = 0; i & lt; arg4; i ++) for std :: cout & lt; & Lt; & Amp; Arg3 [i] & lt; & Lt; Std :: endl;  

It looks very complex, instead of an example

 < Code> studs :: ostringstream dew; OSS & LT; & Lt; Bookmanam & lt; & Lt; ".Text"; Std :: string s = oss.str (); Char * pString = New char [s.length () + 1]; Std :: copy (s.c_str (), s.c_str () + s.length () + 1, pString); YourFunctionThatTakesCharPtr (pString); Remove [] pString;  

Solr Query and Full String Matching -


I am currently working on a program that sends questions against a solar service and I hang on a problem I'm wondering how the solar matched string.

For example, when I am sending the Militrack type: This, it matches all the entries, even with the altitude = "book" and "eBook". Can anything be done to tell Solar that I want only one exact match (or should it match only those stars which starts with "Bekasi")?

Is this the Solter's configuration service?

Regards Tobias

How the match is made depends on your area Distinguished. You are probably interrogating with a TextField with an analysis series, which are the words of buc and ebuc in the same period (like EdgeNGramFilter < < P> You can use either directly StrField (which will only give you exact match, case sensitivity and all), or you use a wordplate with a keyword folder (which retains the whole word ) And apply a lowercase filter to make the case insensitive.

If you want to prefix the match, then you can add a "*" after your query to a struffle, or you can use an encramfilter and apply anagram to the beginning of the token only.

All these changes will need to be changed normally after your schema (schema.exml) and your content schema changes.


Sqlite3 select range of bytes\chars from blob -


I have hex drift line 12582912 bytes. I need a selection of bytes from this row category

I have tried:

  select substr (hex (line), 1, 5242880) from where id = id;  

where 1 byte starts, and 5424880 - the end byte works, but it is slow

whether to get several bytes from Hex Blob in the satellite Are there other ways?


javascript - Combining deferred responses -


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

  • 1 उत्तर

क्या यह संभव है, का उपयोग करते समय JQuery के डिफर्ड का $। जब एक सरणी में प्रतिक्रियाओं को संयोजित करने के लिए?

  var वादा = $। जब (ajaxRequest1, ajaxRequest2); promise.done (कॉलबैक);  

"कॉलबैक" फ़ंक्शन ऐसा लगता है कि फ़ंक्शन कॉलबैक (resp, विकल्प) । ध्यान दें कि यह केवल एक ही प्रतिक्रिया को स्वीकार करता है।

मैंने सोचा था कि निम्नलिखित काम कर सकते हैं, लेकिन नहीं।

  var वादा = $। जब (ajaxRequest1, ajaxRequest2); वादा। तब (कार्य (resp1, resp2) {वापसी [resp1, resp2];});  

समस्या यह है कि jQuery के तीन तर्कों के साथ इसके अजाक्स वादों का निराकरण किया जाता है, जो तब बन जाता है जब आप कई वादे पर $। जब का उपयोग कर रहे हैं तो मानों की सरणी केवल डेटा प्राप्त करने के लिए (प्रत्येक एजेक्स कॉलबैक का पहला तर्क),

  var वादा = $ का उपयोग करें। जब (ajaxRequest1, ajaxRequest2)। तब (कार्य (resp1 , Resp2) {वापसी [resp1 [0], resp2 [0]];});  

Custom link Site Action Menu SharePoint 2013 from SharePoint Designer -


Is it possible to add custom links to SharePoint Designer in the site actions (gear menu) in SahrePoint 2013?

I have found some solutions that use features and elements but I am not seeing those solutions in SharePoint 2010, how could I do it with SP 2013?


wordpress - Why functions.php doesnt work, blank page after reload -


After adding it to functions.php, I get an error (white page), I have open tag php and a Closed.

  & lt ;? Php add_theme_support ('Menu'); Function my-theme_add_scripts () {wp_enqueue_script ('google-map', 'https://maps.googleapis.com/maps/api/js?v=3.exp&special=false', array (), '3' , truth ); Wp_enqueue_script ('google-map-init', get_template_directory_uri (). '/js/google-maps.js', array ('google-map', 'jquery'), '0.1', true); } Add_action ('wp_enqueue_scripts', 'my-theme_add_scripts'); ? & Gt;    

try function my_theme_add_scripts () instead of function My-theme_add_scripts () . You can not use - in your function names.


sql server - Database tables optimized for both read and write -


We have a web service that pumps data into 3 database tables and a web application, in a data consolidated format Data reads Server + ASP.NET Environment

There is too much data to access the database tables and the data read by them and at such a high speed so that the system has failed.

is indexed on the tables, one of them is unique, one of the tables has billions of records and a few hundred gigabytes of disk space are staying; The second table is a small, only a few million records, it is emptied daily.

Do I have to end the obvious problem of reading and writing together - and in many database tables?

I am interested in every adaptation move, though we have tried every move.

We do not have the option of installing SQL Server Enterprise Edition and. Is able to use.

Edit: The system is used to collect fitness tracker data from thousands of devices and to display data in thousands on their dashboard in real time.

The path to the requirements and characteristics is very broad for a solid answer. But one suggestion will be to set up another database and log shipping for it. Then the original DB will be "write" and the new DB will be the "reading" database.

Opposition

  • Dispace
  • Read the length of time for the trailer will expire by DB

PRO - Maybe "Write" can drop some indexes on DB, it can increase / display - you can then summarize the table in the "Reading" database to increase the performance of the query


c preprocessor - What is the output of following program in C -


इस प्रोग्राम का आउटपुट क्या है और मुझे यह समझाएं?

  #include & LT; stdio.h & gt; #define foo (m, n) m ## n int main () {printf ("% s \ n", foo (k, l)); }  

जब मैंने इस प्रोग्राम को संकलित करने की कोशिश की तो मुझे यह त्रुटि मिली > [त्रुटि] इस दायरे में 'केएल' को घोषित नहीं किया गया था

असल में, ## ऑपरेटर दो अलग टोकन लेता है और एक टोकन बनाने के लिए उन्हें एक साथ पेस्ट करता है। परिणामी टोकन एक वैरिएबल नाम, वर्ग का नाम या कोई अन्य पहचानकर्ता हो सकता है।

तो यहां आप एक भी पहचानकर्ता "kl" को बिना किसी घोषणा के भी मुद्रित करने का प्रयास कर रहे हैं। अब बस इस लाइन को जोड़ें

चार kl [16] = "हैलो दुनिया!";

आपको आउटपुट नमस्कार दुनिया मिलेगी! < / Strong>


c# - Using Datatype as value in Dictonary -


मेरे पास यह संरचना है - यहाँ एक डमी कार्यान्वयन में:

  इंटरफ़ेस आईबीएसिक वावफॉर्म {डबल खोज एम्पल्यूमेंटफ़ैक्टर (एट सैम्पलपरसैकेंड); डबल वैल्यूएटफेश (डबल चरण); } अमूर्त वर्ग बेसवेविफॉर्म: आईबीसाइववेवफॉर्म {सार्वजनिक डबल खोजएम्पप्लीट्यूडफ़ैक्टर (एट सैंपलपरससेकॉन्ड) {नया नॉन इमिलेटेड एक्सप्शन (); } सार्वजनिक डबल वैल्यू एटफेस (दोहरे चरण) {नई नोटिफाइड अपेशन (फेंक); }} सील क्लास सॉवडाउनव्वैवफॉर्म: बेसवेवफॉर्म {} सीलबंद वर्ग सॉफ़्टव्वैवफॉर्म: बेसवेविफॉर्म {}  

मैं एक डिक्शनरी एक विवरण (एक स्ट्रिंग) और एक

  var myDict = नया शब्दकोश & lt; स्ट्रिंग, बेसवेवफॉर्म ** डेटाटाइप ** & gt; () के रूप में,    

{{"नीचे देखा", साउडाव्वोवफॉर्म}, {"साऊ अप", सॉफ़्टव्वॉफॉर्म}}

मैंने यह भी करने की कोशिश की है:

  var myDict = नया शब्दकोश & lt; स्ट्रिंग, प्रकार & gt; () {{"डाउ डाउन", (टाइप) साउडाव्वोवफॉर्म}, {"स्यू अप", (प्रकार) सॉफ़्टवेयरफ़ीम}};  

लेकिन यह मुझे एक संकलन त्रुटि देता है:

'WindowsFormsApplication5.SawDownWaveform' एक 'प्रकार' है लेकिन इसे 'चर' के रूप में प्रयोग किया जाता है

सवाल यह है कि मैं इसे कैसे सी # में कर सकता हूँ?

प्रकार का ऑपरेटर है कि आप कैसे प्रकार ऑब्जेक्ट जब संकलन समय पर एक प्रकार पहचानकर्ता देता है:

  var myDict = नया शब्दकोश & lt; स्ट्रिंग, प्रकार & gt; () {{"नीचे देखा गया", टाइपफ (सॉवडाउनवेवफॉर्म)}, {" अप ", टाइपफ (SawUpWaveform)}};  

node.js - Can I store SQL statements in a separate file in node js? -


Can I have all my SQL statements stored in a different ( .txt ?) File Would like to do This will show my code clean and more readable.

Example:

  router.get ('/', function (rick, race, next) {var sql = connection to a file .quire (sql, function (mistake, rows, field) {var row; if (! Mistake) {row = rows [0];} res.render ('index', {...});})}) ;  

PS

Thank you in advance

You can certainly do this but remember that working with files is "too much time" cost. Whatever you need is a layer that queries you

For example You can do something like this:

  myDBLayer.getNumber (function (id, country, name) {// Do stuff});  

But you have to define the getNumber function and you want to do a function for each query. Of course you can get the parameters and create a sort of abstract with it, but I think it's more efficient to read some files with all the files.


python - Compare pandas dataframes by multiple columns -


What is the best way to find out how two data frames differ based on the combination of multiple columns, so if I have The following is:

df1:

  ABC 0 1 2 3 1 3 4 2  

df2:

  ABC 0 1 2 3 1 3 5 2  

Want to show all the rows where there is a difference (3,4,2 vs) vs (3,5,2) from above example. I have tried using pd.merge () if I use all the columns as keys to join the outer column, then I end up with the dataframe which helps me in my desire. , But it does not turn in that way

Thanks to Adkum I was able to use a mask from a boolean difference as below, but first it was to ensure that the indexes are comparable.

  df1 = df1.set_index ('A') df2 = df2.set_index ('A') # gave me a good indicator using one of the keys #If I get null I have different rows I Df1 = df1.reindex_like (df2) df1 [~ (df1 == df2) .all (axis = 1)] # this gave me all the rows that are different.  

We use and pass axis = 1 If we can compare the line, then we can use this Boolean index to show those rows which are different from the index without the ~ mentioned:

  [43]: df [~ (df == df1) .all (axis = 1)] out [43]: ABC 1 3 4 2  

breaking it down:

In [pre-> [44]: DF == DF1 out [44]: ABC 0 True True True 1 True Falls In [45]: (DF == DF1). All (axis = 1) out [45]: 0 True 1 untrue DTP: Bull

Then we can pass df above as a Boolean index And it is ~


python - Matplotlib/Pylab installation issue and can not import in _tkagg? -


मेरे पास पाइलाब आयात करते समय त्रुटि आई है

  & gt; & gt; & gt; आयात पाइलाब ट्रेसबैक (सबसे हाल ही में कॉल अंतिम): फ़ाइल "& lt; stdin & gt;", पंक्ति 1, & lt; मॉड्यूल & gt; फ़ाइल "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/pylab.py", पंक्ति 1, & lt; मॉड्यूल & gt; से matplotlib.pylab आयात * फ़ाइल "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pylab.py", लाइन 274, & Lt; मॉड्यूल & gt; से matplotlib.pyplot आयात * फ़ाइल "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pyplot.py", लाइन 109, & Lt; मॉड्यूल & gt; _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup () फाइल "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/__init__ .py ", रेखा 32, pylab_setup वैश्विक (), स्थानीय लोगों () में, [backend_name], 0) फाइल" //anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx -10.5-x86_64.egg / matplotlib / backends / backend_tkagg.py ", पंक्ति 13, & lt; मॉड्यूल & gt; tkagg फ़ाइल के रूप में आयात matplotlib.backends.tkagg "//anaconda/lib/python2.7/site-packages/matplotlib-1.4.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/tkagg.py" , लाइन 7, में & lt; मॉड्यूल & gt; matplotlib.backends से _tkagg ImportError आयात: नाम आयात नहीं कर सकते _tkagg  

मेरे प्रणाली अजगर जानकारी पीछा कर रहा है: ओएस मैक ओएस एक्स Yosemite

  पायथन 2.7.9 | एनाकोंडा 1.6.1 (x86_64) | (डिफ़ॉल्ट, 15 दिसंबर 2014, 10:37:34) डार्विन पर [जीसीसी 4.2.1 (ऐप्पल इंक का निर्माण 5577)] अधिक जानकारी के लिए प्रकार "सहायता", "कॉपीराइट", "क्रेडिट" या "लाइसेंस" ऐनाकोंडा को कंटिन्यूम एनालिटिक्स द्वारा आपके पास लाया गया है कृपया देखें: http://continuum.io/thanks और https://binstar.org  

मैंने matplotlib- 1.4.1। स्थापित किया है और यहां भी टीके का नवीनतम संस्करण कोई सुझाव बहुत सराहना करेंगे? धन्यवाद।

पूर्वापेक्षित

कमांड को स्थापित करें लाइन उपकरण में मैकोज़ योसेमाइट पर

  कमांड लाइन उपकरण- sudo xcode select --install  

समाधान < / P>

यदि आप उन्हें स्थापित नहीं किया है तो pip स्थापित करें

  स्थापित करें pip-sudo easy_install pip  

के साथ जीसीसी स्थापित करें

अपने पसंदीदा लाइब्रेरी के साथ निम्न कमांड चलाएं

  स्थापित करें matplotlib-sudo pip install - U matplotlib numpy-sudo pip install -U numpy स्थापित करें (यदि आप पहले से ही स्थापित हैं तो अनदेखा कर सकते हैं) स्थापित करें scipy-sudo pip install -U scipy (यदि आप पहले से ही स्थापित हैं तो अनदेखा कर सकते हैं)  

java - use Jinq for hibernate -


I would like to be able to write linq-style specific queries in Java using jinq () and Java 8 streams. However, in the set-up section it says that you have to use the JPA Unit Manager (). In my project I am using Hibernate and sessionFactory. Does this mean that I can not use anybody or some solutions? Simply seeing Javadok for "Jenquoo" shows that he takes a JPA "emf". , Then you have to use JPA to use it

I have no shortage of using JPA

when you really need and still If you use JPA for a majority, you can easily drop into enough vendor lists.

sql server - Importing flat files in SSIS, error handeling missing delimiters -


I am importing flat files to a SQL Server DB. I have a dataflow task for each loop in which there is a flat file source, OLEDB destination and flat file destination for errors. I have set the error output settings to redirect the rows, I know that one of the flat files is the fault delimiter in the row (rows). The quote and the comma are the reason it's hanging. I have found similar solutions but they always have Do not have to work, like always.

Thank you!

foreachloop

row with error


Trim a HTML text in a div with CSS -


समाचार हेडर की एक सूची प्रदर्शित करने के लिए, मुझे div एक निश्चित अधिकतम-ऊँचाई

उस टेक्स्ट को कट-ऑफ करना चाहिए, यदि टेक्स्ट डिवि को ओवरफ्लो करता है, और कटे-ऑफ के मामले में एल्िप्सिस के साथ समाप्त होता है ...

  #lipsum {overflow: hidden; पाठ-ओवरफ्लो: अंडाकार; सफेद-अंतरिक्ष: अब्रॉप; अधिकतम-ऊंचाई: 75px; ऊंचाई: 75px; चौड़ाई: 100%; }  
  & lt; div id = "lipsum" & gt; & Lt; p & gt; Duis eget sapien leo विविम के लिए अलग-अलग शैलियों का चयन, मार्शल आर्ट्स के आकार में लचीलापन इस तरह के लिए, शल्य चिकित्सा के लिए मील एसी, आसान सूजन अब नाम से पता चला है कि, यहां तक ​​कि एक यात्रा के लिए, एक मनोरंजन के बारे में जानने के लिए, मुफ्त डाउनलोड करने के लिए मॉरीस सोडाल्स ईयूआईमोड ऑर्सी, एक टेंसिडुंट मसा फेलमेटम एसएडी। मौरिस के बारे में क्या है Phasellus भाप से भरे स्थान पर काम कर रहे हैं सबसे महत्वपूर्ण बातों के बारे में आपको बताएं फ्यूस कोर्स, रिक्त स्थान पर उपलब्ध नहीं है मुक्त समय में कोई समय नहीं है और इस समय के मौसम में कुछ भी नहीं। मैकेनस ऑटक्टर ईगेट मॉरिस नॉन यूसुस्वाड वह कहता है कि, आसान तरीके से पता चला है, निशानेबाज और निदान के परिणामों के बारे में पूछताछ & Lt; / p & gt;  

मेरी समस्या यह है कि मौजूदा व्यवहार ठीक है अगर केवल एक पंक्ति , लेकिन मुझे एक सिग्नल लाइन की जरूरत नहीं है, लेकिन अधिकतम अधिकतम-ऊंचाई ...

आप निम्न पोस्ट का उल्लेख कर सकते हैं:

ऐसा लगता है कि किसी ने भी विषय पर एक लेख पोस्ट किया है। हालांकि, समाधान समस्या के लिए थोड़ा स्पर्शरेखा लगता है:

अंत में, यहां एक .js समाधान है:

संपादित करें : संसाधनों की इस सूची में जोड़ने के लिए, यहां एक शुद्ध सीएसएस समाधान है।

* सलाह दीजिए कि पाठ-ओवरफ्लो: एलाईपसिस; हर ब्राउज़र में समर्थित नहीं है, फिर भी अंत में, इस मुद्दे पर .js समाधान है:


java - Android Out of Memory error -


I am using the answer to help me get out of the memory problem. I resolve all the drawables to the Asset folder Insert IOException (Reference Reference, String Filename), Public Assignment - GetResources () getAssets () .; InputStream buffer = new BufferedInputStream ((asset.open ("DOSUABLE /" + + FILENAME + ".PNG"))); Bitmap bitmap = bitmapfinder Aodestream (buffer); Return a new bitmap drawer (reference .greatresource (), bitmap); }

My question is how do I use this function under my operation? Is there an example of this work?

How do I use this function under my activity?

OK, as is the function public static bus:

  className.getAssetImage (this, yourDrawableName);  

ex:

Examples of name (utilities) P> < Code> Draft mDrawable = Utils.getAssetImage (this, "my_drawable_image_name");

Where mDrawable is drawable return the image.


Crontab - Python -


I'm starting in Python and Linux. While trying to schedule a Python script on the cronat file, I have some problems. Even like simple commands:

30 16 * * * root python - version> / var / log /test.txt

Not working: The file "test.txt" is actually created but it is completely empty.

Can you please help me identify the causes of such a problem?

I may be getting things here, but you can see the root Why are you putting it? Try Juts

  30 16 * * * Python - version & gt; /var/log/test.txt 2 & gt; & Amp; 1  

I just skipped the root part (it seems unnecessary) and 2> & Amp; 1 prints any errors in test.txt . In this way you can see what's going on with your program


Parsing 2D array in JSON using Java -


I have a json file with the following format. I am having trouble parsing the "Location" segment, which is a value of a double [] [] array, what is the best way to parse it? Also, I do not understand how to read the file, I, json.simple but it is required to cast every JSONObject or JSONArray used which is inconvenient to use a little bit

  [{"id":. 123456, "Location": [[37.785220, -122.4,04,378], [37.786661, -122.4,04,571], [37.7, 86, 356, -122.48, 99 2] "," Time ": 1426510324," test failed ": [" T1 "," T2 "," T5 "]}, {" id ": 123456 , "Location": [[37.793450, -122.422616], [37.78286 9], -122.4, 62, 613], [37.772, 964, -122.45857 9], [37] 7, 62787, -122.458, 922]], "Time": +1426510325, "Failed in Test": ["T3", "T5", "T6"]}, {"id" : 123456, "location": [[37.778689, -122.5,14,214], [37.782,75 9, -122.5, 11, 63], [37.8] , 05,187, -122.4,68, 9 24], [37.771611, -122.4,68,66 ], [37.7.5 9, 05, 9, -122.47736]], "time": 1426511324, "test failed": ["T1", "T5", "T7"]}]    

you double [] [] as < The / p array can be simplified using

  string input = "[\ r \ n" + "\" id \ ": 123456, \ r \ n" + "\" location \ ": [\ R \ n "+" [37.785220, - 122.404378], \ r \ n "+" [37.786, 661, -122.4,04,571], \ r \ n "+" [37] .7,86,356, -122.4,08, 99 2] \ r \ n "+"], \ r \ n "+" \ "time \": 1426510324, \ r \ n "+" \ "trial Failed \ ": [\" T1 \ ", \" T2 \ ", \" T5 \ "] \ r \ n" + "}]"; // Parse the input as an array JSONArray jArr = new JSONArray (input); // get the required place object JSONObject jObj1 = jArr.getJSONObject (0); // Get location string location = jObj1.getJSONArray ("location"). ToString (); // Use paras GSO Double [] [] DAR = New GSON () J. Jason (location, double [] []. Square); // Print to the array (double [] d: dArr) {System.out.println (Arrays.toString (d)); }  

Output:

  [37.78522, -122.404378] [37.786661, -122.404571] [37.786356, -122.408 992]  

Extend python function to handle sympy symbols -


Considering an existing function written for numerical values, is Simimp has given a suggestion to handle signals ? For example: Import

as np def foo (ax, ay, az): A = NP matrix ([[1, ax, 0], [0, 1 / Back to the Fu (1, 2, 3) # We also want to work as: SPEED-AX imports as a sympege, AE, Ez = spymes ('0'), [0, 0, NP CUSS] Foo (F, AE, AG)

How to extend foo () to handle CMP needed? Symbols ax, ay, az and therefore return a symbolic matrix a ? Are there any facilities to help with this in sympy? Unfortunately you can not control sympy symbols in a numpy function.

Unfortunately you can not control sympy symbols in a numpy function. For a dirty solution, to check the type of variable and decide which function to use. Import

  np import as sympy as spy def foo (ax, ay, az): a = np. Matrix ([[1, ax, 0], [0, 1. / Ay, 0], [0, 0], if detective Chaos (es) then detective.Simbol other NP Chaos (az print) foo (ax, ay, az) & gt; print) foo (1, 2, 3) ax, ay, az = spy.symbols ('ax', 'ay', 'az')) Print & gt; & Gt; [[1. 0. 0.] [0. 0.5 0] [0. 0. -0.98 99 925]] [[1.0 ax 0] [0 1.0 / a] [0 cos (az)]]  

c# - What is the the Correct way of sending DateTime data for SNMPV2 using SNMPSHARPNET? -


What is the correct way to send datetime to UTC in SNMPV2 event using SNMPSHARPNET?

We are using the TimeTex ASNTP type but have been running data issues for 29 and half days.

This is the code for reference:

  asnType newMIBValue = null; If (! String.InsalOreactString) {switch (datatype) {case MIBDataType.DateAndTime: // newMIBValue = newTyTyX (MIBValueString); NewMIBValue = Conversion DataToOctatString (MIBValueString); break; Case MIBDataType.SnmpAdminString: newMIBValue = New OctetString (MIBValueString); break; Case MIBDataType.TimeTicks: newMIBValue = New TimeTeX (MIBValueString); break; Case MIBDataType.IPAddress: newMIBValue = new IPA (MIBValueString); break; Case MIBDataType.Integer: newMIBValue = New Integer32 (MIBValueString); break; Default: Break; }}  

Use OCTET STRING for routine items. The timetix is ​​a non-negative integer, which specifies the time elapsed between two events, units of one hundredths of a second.


ruby on rails - ActiveAdmin: Select nested Attributes based on the user's previous selection -


I would like to provide an easy interface to select information based on the hierarchy of information.

In my example the user needs to enter his county.

A county is placed in a state and the state is a part of a country. So this is my rail model:

  # country country country < ActiveRecord :: Base has_many: End of states # State class state & lt; ActiveRecord :: Base is_to: Country has_many: counties end # County square county & lt; ActiveRecord :: Base is_to: state end  

Then the user should select the country first in my user interface, the list of related states is presented based on the country and based on selected state The list of counties is presented.

Is it possible to deal with an active admin


xmlhttprequest - Javascript - read data from multiple files in sequence -


I have a function ReadFromFile that reads from a file on the server how do I get a function Write, which can read from multiple files on the server and save data from each file in different variables in the sequence?

Update Measurement Data from ReadFromFile (filename) {if (window.XMLHttpRequest) {// code for IE7 +, Firefox, Chrome, Opera, Safari xmlhttp = New XMLHttpRequest (); } Else {// code for IE6, IE5 xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); } Xmlhttp.onreadystatechange = function () {if (xmlhttp.readyState == 4 & xmlhttp.status == 200} {dataset_01 = xmlhttp.responseText;}} Xmlhttp.open ("GET", file name, true); Xmlhttp.send ();}


html - Element h4 not allowed as child of element ul in this context? -


I am trying to debug my footer, but I like the type of bugs (Element H4 Because the element is not allowed in the context of UL)

Can someone explain that I can put HTML because it does not work for some reason. Probably because there are some mistakes in the code that are linked to my website

and then inspect the element on the footer of the page.

& lt; Ul & gt; & Lt; H4 square = "footer" & gt; Support & lt; / H4 & gt; & Lt; Br> & Lt; A href = "http://timberlife.nl/contact/" style = "color: RGB (255255255);" & Gt; Contact & lt; / A & gt; & Lt; Br> & Lt; A href = "http://timberlife.nl/faq/" style = "color: RGB (255255255);" & Gt; FAQ & lt; / A & gt; & Lt; Br> & Lt; A href = "http://timberlife.nl/disclaimer/" style = "color: RGB (255255255);" & Gt; Disclaimer & lt; / A & gt; & Lt; Br> & Lt; / Ul & gt;

It starts with this.

  & lt; H6 class = "text-white copy-text" & gt;  

Many thanks!

Donation

According to the HTML5 imagery, you can and Ul / gt> , you can not tag it as and lt; Li & gt; & Lt; / Li & gt; ; , then insert your content into your lists:

  & lt; Ul & gt; & Lt; Li & gt; & Lt; H4 square = "futher" & gt; Support & lt; / H4 & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "http://timberlife.nl/contact/" style = "color: RGB (255255255);" & Gt; Contact & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "http://timberlife.nl/faq/" style = "color: RGB (255255255);" & Gt; FAQ & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "http://timberlife.nl/disclaimer/" style = "color: RGB (255255255);" & Gt; Disclaimer & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

I have also noticed that you have wrapped entire blocks of content in the header tags, try to avoid it as this can also contain invalid HTML. Instead use divs.

Reference:


Three.js - Stereo Effect - Picking -


I had the possibility to test stereo effects on an image, which was using side-by-side images . It works fine.
The only problem occurs when I have to choose something: The chosen point is wrong

To debug, I draw the line's top bar of the eye.
I picked up a point in 3D mode (with TV in glasses and TV mode).
Then I turned off the TV 3D mode with 2 lines. J. S. See images selected from eyes. The result is: The selected point is not a blue face: Enter image details here

It may be necessary to say that the html page is such as:
- First there is a line to write debug notifications.
- This line has a line of buttons below.
- Three below the button. Js is the scene.

The selection works well in normal mode.

Should work in 3D? Does this work for you?

To answer: It is not possible to select in 3D using the mouse pointer because the mouse pointer 2 images There is a 2D thing from the side. It's not something that appears in 3D.


angularjs - Adding new dependencies to yeoman angular-fullstack project -


I have started working on a new project in node js and I used this machine's angular fullstack generator using the project Have prepared And now I would like to add a new lonely dependency and a new node dependency. What is the best way to do this? Should I just add dependency to bower.json and package.json or should I run a specific command?

You do not need a male to install those dependencies for you. Provides an environment in which conveyors like Tienjen, NPM, Grunt etc. can be used. You can add additional dependencies like you would normally use NPM or conveyor.

For cursor () -

  Installed BOVER - S & LT; Name-own-dependency & gt;  

That command downloads the code for you, and it adds a reference to node () in your bower.json

NPM installs-S & LT; Name-own-dependency & gt;

mysql - how to increase a search variable by 1 in sql query -


The task is: Find the smallest navigator in each rating level

-

My table: Sailor (sid: Integer, Sn: String, Rating: Integer, Age: Actual) Reserve (SID: Integer, Quote: Integer, Day: Date) Boat (Quote: Anything possible:

  select min (age):   

With novices where rating = (1 ++)

< Pre> Select rating, SID, S from age to age (age, rating) in S (rating minimum (age), Ratings from sailor group by rating)

Edit:

Depending on the rating, you can select rating, minimum (age) from sailor group; To get the minimum age in the rating level but you will not get the details of the sailor. It is the minimum age .. .. Check where you can see that the SID is returned, the rating is 4 for 4 instead of 8 In the form of ... ... where it correctly corrects


Spring batch job to process a dynamic set of files parallely -


I am trying to create a job for a spring batch, which I would like to process a dynamic set of files evenly Want to When the batch job has started, then the number of files to be understood is not known - files are dynamically available

I have gone through the Spring Batch project page, and I think It shows that, whenever a new file arrives, the job should be run and the files should continue to be processed. The multi-threaded phase is suitable for my case. But what I am not sure about, can it support the dynamic availability of files to process?

Any input will be highly appreciated thanks and relation,

Here are some options:

  1. - It wraps like motherderer a madrofo as flatfileItemReader and expression Through the resources provided through it.
  2. Partition - This option is better for parallel processing of files. Using MultiResourcePartitioner , you can execute files in parallel with all the restartivity etc., which you usually get with a spring batch.

You can read more about the partition here in the document:


ASP.Net MVC Empty - CSS won't be applied -


Currently I'm trying to learn some HTML and ASP.NET and I'm already confused.

I have created a new blank project with MVC settings and I can not style to work with CSS files.

My index-file uses a layout-page which uses itself (CSS) -file. I am using the following "syntax":

  & lt; Link href =@Url.Content ("~ / visible / normal / style.css") rel = "stylesheet" />  

At this point, I do not know that you need farer information (I do not really know what information you may need) - please tell me.

Presenting styles in MVC, using bundle config is best.

In your solution, you should have a folder startup

if you open the BundleConfig.cs file, And see the style bundle.

Something like this:

  bundles. Add (New Style Bundle ("~ / Content / CSS"). ("~ / Content / STYLE.css"););  

Above is the name of your bundle: "~ / content / css" .

To insert style sheets from this bundle, in the header / footer or anywhere in your scene.

  & lt; Head & gt; @ Styles.render ("~ / content / css") & lt; / Head & gt;  

If you do not want to use the bundle, you can Url.Content

  & lt; Head & gt; & Lt; Link href = "@ Url.Content (" ~ / content / STYLE.css ")" rel = "stylesheet" /> & Lt; / Head & gt;  

Or you can use simple HTML:

  & lt; Head & gt; & Lt; Link href = "~ / content / STYLE.css" rel = "stylesheet" /> & Lt; / Head & gt;  

Edit:

If you do not have an App_Start folder, then you can use it:

  1. Create an application_start folder

  2. Make this a new class name: bundle config.css

      public class bundle config {public Status blank registerbundles bundle compilation bundles) {bundle. Add (New Style Bundle ("~ / Content / CSS"). ("~ / Content / site.css"););  

    }}

  3. Add this line to the end of the Application_Start method in your Global.asax.cs file

    << / P>


.net - Impersonating a user on a different domain. ASP.NET -


I am trying to impersonate a user on a different domain (which I have been added through VPN) And I'm getting the following error: Could not create a Windows user token from the specified credentials in the config file. Error on Operating System 'Security database on the server does not have a computer account for this workstation trust relationship.

Does anyone know how to impersonate a user from a different domain?

I am using the cloning tag:

  & lt; Authentication mode = "windows" /> & Lt; Identity impersonation = "true" user name = "myUsername" password = "myPassword" />  

And the code where it will break and give me the error is as follows:

  file. OpenRide (pathToMyFile);  

This code works if I'm on another domain. So I'm pretty sure that I need to build a token and a trust relationship but I do not know how to do it.

Thank you.


i need to give value for database from java code,for details see the code below -


I need to insert that value into the database in the "name" variable goes. So far, I have tried to lower the code, but it is not working.

string name = "eswini";

  string query = "INSERT student" + "values ​​(1239, 'name', 'IT')"; Statement.executeUpdate (Quer);  

Can anyone help me in this, thanks in advance?

Modify your string and then

  string query = " Include student "+" value (1239, '"+ +' ',' IT ')";  

javascript - How to remove edit option in context menu using jstree? -


I have to remove the edit option in the context menu, using the "jstree" jquery plugin. Please tell us how to remove it.

My code is:

var contextual menu = function () {

  $ ("# tree_3"). Jstree ({"core": {"themes": {"responsive": false}, // so that "check_callback" is created: true,}, "type": {"default": {"icon": "fa {"Key": "FA-file icon-state-alert icon-LG"}}, "state": {"key": "FA-folder icon-state-alert icon-LG"}, "file": { "Icon": "Demo2"}, "plugins": ["contextmenu", "dnd", "state", "type"], "contextmenu": {"item": {"edit": wrong}}} );}  


database - C# connection with MS access is not working? -



database - C# connection with MS access is not working? -

when start debugging , add together clients, can add together them, update them , read them. newly added clients won't save in database. i've checked if i'm using right file location , am:

public class dbaccess { private static string connectionstr; static dbaccess() { string mdffile; mdffile = @"c:\users\rik\documents\visual studio 2010\projects\week-2-opdracht\database\clienten.accdb"; connectionstr = @"provider=microsoft.ace.oledb.12.0;data source=" + mdffile + ";"; } public static dataset getwaardenquery(string sqlstr) { dataset ds = new dataset(); console.writeline(sqlstr); oledbconnection con = new oledbconnection(connectionstr); oledbdataadapter dap = new oledbdataadapter(sqlstr, con); dap.fill(ds); homecoming ds; } public static int uitvoerenquery(string sqlstr) { int resultaat = -1; console.writeline(sqlstr); oledbconnection con = new oledbconnection(connectionstr); oledbcommand cmd = new oledbcommand(sqlstr, con); seek { con.open(); resultaat = cmd.executenonquery(); } grab (exception exp) { string x = exp.message; } { if (con.state == connectionstate.open) { con.close(); } } homecoming resultaat; } } }

at first check connection string right or not making manual connection. help follow given link http://www.c-sharpcorner.com/uploadfile/b8d90a/connect-oledb-database-in-c-sharp-in-easy-steps/

c# database windows

qt - Customizing shape of bounding rect -



qt - Customizing shape of bounding rect -

i drawing line using mouse clicks. line drawn using paint function as:

painter->drawline(start_p, end_p);

the bounding rect of line defined as:

qrectf line::boundingrect() const { // bounding rectangle line homecoming qrectf(start_p, end_p).normalized(); }

this shows line painted. bounding rect shown:

i want have bounding rect according shape of item, like:

how accomplish this?

edit

while selecting of overlapping lines, 1 bounding rect on top selected(see figure below). making utilize of setzvalue won't work here. want implement minimizing bounding rect shape of line.

if have item not shaped rectangle, or rotated rectangle utilize qgraphicsitem::shape.

this function should homecoming qpainterpath. should able create path using qpainterpath::addpolygon.

here little example:

qpainterpath item::shape() const { qpainterpath path; qpolygon polygon; polygon << qpoint(0, 0); polygon << qpoint(5, 5); polygon << qpoint(width, height); polygon << qpoint(width - 5, height - 5); path.addpolygon(polygon); homecoming path; }

you of course of study should calculate points within path in different way, point. when click on item, select if click happened within shape defined qpainterpath.

if ever need create curvy lines, can utilize qpainterpathstroker::createstroke suggested cmannett85.

qt bounding-box qgraphicsitem

c++ - Added pe executable section corrupting .text section -



c++ - Added pe executable section corrupting .text section -

i trying add together section pe executable, when add together section corrupting memory of first 40 bytes of .text section. wanted know if knows why function corrupting .text section?

when check in cff explorer offsets right including new sections. has happened repeatedly different files.

here code create added section:

int addsection(char* sectionname, dword size){ int pos = ntheader->fileheader.numberofsections; firstsection[pos].virtualaddress = align((firstsection[pos - 1].virtualaddress + firstsection[pos - 1].misc.virtualsize), ntheader->optionalheader.sectionalignment); firstsection[pos].misc.virtualsize = (size); firstsection[pos].pointertorawdata = align((firstsection[pos - 1].pointertorawdata + firstsection[pos - 1].sizeofrawdata), ntheader->optionalheader.filealignment); firstsection[pos].sizeofrawdata = align(size, ntheader->optionalheader.filealignment); firstsection[pos].numberoflinenumbers = 0; firstsection[pos].numberofrelocations = 0; firstsection[pos].pointertolinenumbers = 0; firstsection[pos].pointertorelocations = 0; ntheader->fileheader.numberofsections++; ntheader->optionalheader.sizeofimage += align(firstsection[ntheader->fileheader.numberofsections-1].misc.virtualsize, ntheader->optionalheader.sectionalignment); homecoming 0;

}

i've found solution there not plenty space @ end of section headers add together section header overwriting section straight after .text. need find out how increment header space in file can add together section header without overflow.

c++ pe

eclipse - how to synchronize the java file with dynamically generated file? -



eclipse - how to synchronize the java file with dynamically generated file? -

i have created eclipse plugin dynamically generate text file. when user right click method bundle explorer generate new file class construction , method body. want synchronize these 2 files. when user create changes in method within java file. must updated in generated file.

consider scenario have java file 2 methods

public class calculator{ public int add(int ,int b){ int c=a+b; homecoming c; } public int sub(int ,int b){ int c=a-b; homecoming c; } }

the user right click add together method bundle explorer , generate file. file follows

file name generated based on class name , method name.

calculator_add.txt:

public class calculator{ public int add(int ,int b){ int c=a+b; homecoming c; } }

if user changes logic in method must reflected in generated file. how can accomplish in eclipse. please give suggestion. much helpful.

i'm not sure should done way; describe sounds more buildstep alike thing mark methods want included/processed

so bit restructure original problem , seek give hints that

when user selects method; method added list of tobecopied things add custom builder or "generate outputs" menu item process can launched when runs, iterates on list of tobecopied , reads methods

i hope helps

java eclipse eclipse-plugin eclipse-jdt

xcode - Display a view for few seconds (custom push from NavController) -



xcode - Display a view for few seconds (custom push from NavController) -

i started master-detail application. seek add together custom view (default uiviewcontroller simple label) displayed seconds (like loading view) before detail/master views accessible. problem if add together viewcontroller appdelegate , force navigationcontroller empty view. see here:

i didn't alter adding 1 line of code appdelegate:

func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. allow splitviewcontroller = self.window!.rootviewcontroller uisplitviewcontroller allow navigationcontroller = splitviewcontroller.viewcontrollers[splitviewcontroller.viewcontrollers.count-1] uinavigationcontroller navigationcontroller.topviewcontroller.navigationitem.leftbarbuttonitem = splitviewcontroller.displaymodebuttonitem() splitviewcontroller.delegate = self allow masternavigationcontroller = splitviewcontroller.viewcontrollers[0] uinavigationcontroller allow controller = masternavigationcontroller.topviewcontroller masterviewcontroller controller.managedobjectcontext = self.managedobjectcontext // +++ custom viewcontroller displayed here +++ navigationcontroller.pushviewcontroller(viewcontroller(), animated: true) homecoming true }

i not problem is...

with line in code

navigationcontroller.pushviewcontroller(viewcontroller(), animated: true)

you instantiating new, empty view controller, whis not want.

get reference storyboard (i.e masterviewcontroller) create view controller , force 1 on navigation stack. example:

if allow myvc = controller.storyboard!.instantiateviewcontrollerwithidentifier(...) { navigationcontroller.pushviewcontroller(myvc, animated: true) }

xcode view swift push navigationcontroller

ios - stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) returns Optional in Swift -



ios - stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) returns Optional in Swift -

i trying solve next issues using swift:

1) optional? instead of returning "1%20market%20street,%20san%20francisco,%20ca%2094107" like, why next code returning "optional("1%20market%20street,%20san%20francisco,%20ca%2094107")"

println("\(address.stringbyaddingpercentescapesusingencoding(nsutf8stringencoding))")

2) how replace commas %2c?

you can utilize

allow tempstring: string? = "1%20market%20street,%20san%20francisco,%20ca%2094107" if tempstring != nil { allow newstring = tempstring!.stringbyreplacingoccurrencesofstring(",", withstring: "%2c", options: nsstringcompareoptions.literalsearch, range: nil) }

it returns optional,because method homecoming nil.

ios swift

asp.net - Youtube api V3 nuget error visual studio 2012 -



asp.net - Youtube api V3 nuget error visual studio 2012 -

i'm trying install youtube api v3 using nuget bundle manager console

i'm typing there install-package google.apis.youtube.v3

but got error

install-package : 'microsoft.bcl 1.1.9' bundle requires nuget client version '2.8.1' or above, current nuget version '2.6.40627.9000'. @ line:1 char:1 + install-package google.apis.youtube.v3 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (:) [install-package], nugetversionnotsatisfiedexception + fullyqualifiederrorid : nugetcmdletunhandledexception,nuget.powershell.commands.installpackagecommand

is there way solve that?

i need because i'm getting error when i'm including:

using google.apis.auth.oauth2; using google.apis.youtube.v3; using google.apis.services; using google.apis.youtube.v3.data; using google.apis.upload;

error 2 type or namespace name 'apis' not exist in namespace 'google' (are missing assembly reference?)

you need update version of nuget installed visual studio.

go tools menu , select "extensions , updates", find "nuget bundle manager" (at to the lowest degree that's assume it's called, based on see in vs2013) should offered alternative update it. updated version should fine utilize install dependencies need.

asp.net visual-studio-2012 youtube youtube-api

c++ - Exception handling and recovering from non-fatal errors -



c++ - Exception handling and recovering from non-fatal errors -

i'm writing c++ application needs deal error codes c api, winsock2 api. i'm not sure of best way handle fatal errors vs non-fatal errors.

for example, if phone call send() fails error code wsaeconnaborted, want homecoming error caller, go on programme execution. in case caller mark connection terminated , carry on. if fails error i'd consider fatal, such wsaenetdown, want application terminate.

i know exceptions used "exceptional" situations, makes sense utilize exceptions handle fatal error case. i'm questioning how handle non-fatal error cases.

should homecoming error code in non-fatal cases? if need homecoming value, i'll need homecoming both code (potentially success) , value. or should create 2 exception classifications, fatalerror , nonfatalerror classes, , effort recovery when handling nonfatalerror exceptions? or there other/better ways this?

[updated] clarification there seems confusion i'm getting @ original question. understand how exceptions handled, happens when they're not, rethrowing exceptions, , performance characteristics.

i'm asking techniques/best practices handle situations aren't "exceptional". in case, errors may occur cause connection become unusable, not impact rest of server.

preferably i'd avoid having exception class per error code, since create lot of useless exception classes.

you can utilize exceptions if want propagate error callstack. create custom classes, inherit std::exception, , grab them if want apply specific treatment.

try { my_function_which_throws(); } grab (const fatalerror& e) { // something, or rethrow } grab (const nonfatalerror& e) { // log or nil }

exceptions take time handle if thrown. if function don't throw anything, won't impact performance.

c++ design exception-handling

find place multiply a matrix in cell array with string and matrix -



find place multiply a matrix in cell array with string and matrix -

i have cell array

<n*n*n cell>

this array contain matrixs , string . illustration n=4, array has form :

val(:,:,1) = columns 1 through 2 'string1' 'string1' 'string2' 'string2' 'string3' [16x16 double] 'string4' [16x16 double] columns 3 through 4 'string1' 'string1' [16x16 double] [16x16 double] 'string3' [16x16 double] [16x16 double] 'string4' val(:,:,2) = columns 1 through 2 'string1' 'string1' 'string2' 'string2' [16x16 double] 'string3' [16x16 double] 'string4' columns 3 through 4 [16x16 double] [16x16 double] 'string2' 'string2' 'string3' [16x16 double] [16x16 double] 'string4' val(:,:,3) = columns 1 through 2 'string1' [16x16 double] [16x16 double] 'string2' 'string3' 'string3' [16x16 double] [16x16 double] columns 3 through 4 'string1' [16x16 double] 'string2' [16x16 double] 'string3' 'string3' 'string4' 'string4' val(:,:,4) = columns 1 through 2 'string1' [16x16 double] [16x16 double] 'string2' [16x16 double] [16x16 double] 'string4' 'string4' columns 3 through 4 [16x16 double] 'string1' [16x16 double] 'string2' 'string3' 'string3' 'string4' 'string4'

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

i want multiply matrix in array , matrix should not multiplied in strings , should determine each reply done multiplying on cell array؟ right code or approach?

arrays string matlab matrix cell

opencv - skimage's rgb2gray in python: AttributeError: Nonetype object has no attribute ndim -



opencv - skimage's rgb2gray in python: AttributeError: Nonetype object has no attribute ndim -

i using code (with skimage version 0.10.0) far can remember without issues:

from scipy import misc import scipy.io sio skimage.color import rgb2gray img = cv2.imread(myfile) img = rgb2gray(img)

but i'm getting error:

traceback (most recent phone call last): file "c:\work_asaaki\code\generateproposals.py", line 48, in <module> img = rgb2gray(img) file "c:\anaconda\lib\site-packages\skimage\color\colorconv.py", line 635, in rgb2gray if rgb.ndim == 2: attributeerror: 'nonetype' object has no attribute 'ndim'

what problem perchance be? how can prepare able convert image grayscale?

given error message problem imread phone call fails, means imgis none.

reason why imread phone call fails path file wrong.

python opencv image-processing grayscale

ember.js - How to pass API keys in environment variables to Ember CLI using process.env? -



ember.js - How to pass API keys in environment variables to Ember CLI using process.env? -

how pass environment variables bashrc ember cli. imagine situation need stripe api keys or pusher api-keys , have them in environment variables in bashrc. how pass api-keys ember cli.

i tried using node.js process.env in both brocfile.js , environment.js, when seek access in ember js controller, property null.

in environment.js file added,

app: { apikey: process.env.key }

in ember js controller tried accessing with:

import config '../config/environment';

and setting controller property lkey shown below, didn't work:

lkey: config.app.key

next in brocfile.js, added:

var limakey = process.env.key; var app = new emberapp({key: limakey});

this still didn't work.

i resolved issue. faced 2 options. alternative 1 utilize xhr fetch api-keys end-point on server. alternative 2 api-key straight environment variables using nodejs process.env. prefer alternative 2 because saves me doing xhr request.

you can alternative 2 using ember-cli-addon depends on nodejs dotenv project

https://github.com/fivetanley/ember-cli-dotenv https://github.com/motdotla/dotenv

in case take without addon.

first add together api-key .bashrc if ubuntu or approapriate place own linux distro. export api_key=nwpyhl5 reload .bashrc file, setting picked up: source ~/.bashrc in ember cli add together property env object in config/environment.js. default looks this module.exports = function(environment) { var env = { moduleprefix: 'rails-em-cli', environment: environment, baseurl: '/', locationtype: 'auto', emberenv: { } }

now env object, can add together new property myapikey this:

module.exports = function(environment) { var env = { moduleprefix: 'rails-em-cli', environment: environment, baseurl: '/', locationtype: 'auto', myapikey: null, emberenv: { } //assign value myapikey if (environment === 'development') { // env.app.log_resolver = true; env.myapikey = process.env.api_key; } }

note process.env.api_key fetching setting added .bashrc , assigning myapikey. need have nodejs installed on server process.env work.

finally access variable in controller do

import config '../config/environment'; import ember 'ember'; export default ember.controller.extend({ yourkey: config.myapikey, });

that's it.

ember.js ember-cli ember-router

c - Structure data written into file is not being read correctly -



c - Structure data written into file is not being read correctly -

printitems() printing first entered item. when take update item details have been updating in file printitems() not displaying updated ones.

struct canteen { char itemid[15]; char name[15]; int price; }; void printitems() { file *fp1; fp1=fopen("items.txt","r"); struct canteen c; printf("\t%-15s%-30s%-5s\n","item id","item name","price"); while(fread(&c,sizeof(struct canteen),1,fp1)!=null) { printf("\t%-15s%-30s%-5d\n",c.itemid,c.name,c.price); } fclose(fp1); } int updateitem(char id[]) { file *fp; int pos=0; fp=fopen("items.bin","r+"); int found=0; struct canteen b; while(fread(&b,sizeof(struct canteen),1,fp)!=null) { pos=ftell(fp); if(strcmp(b.itemid,id)==0) { found=1; fseek(fp,-sizeof(struct canteen),1); printf("enter new item id: "); scanf("%s",b.itemid); printf("enter new item name: "); scanf("%s",b.name); printf("enter new item cost : "); scanf("%d",&b.price); fwrite(&b,sizeof(struct canteen),1,fp); fclose(fp); break; } } fclose(fp); if(found==1) homecoming 1; else { homecoming 0; } } void main() { file *fp1; file *fp2; char s[1]; char choice[1]; char id[15]; int n,i,j; printf("enter number of items\n"); scanf("%d",&n); fp1=fopen("items.bin","w"); struct canteen c; for(i=0;i<n;i++) { printf("enter item %d id : ",i+1); scanf("%s",c.itemid); printf("enter item %d name : ",i+1); scanf("%s",c.name); printf("enter item %d cost : ",i+1); scanf("%d",&c.price); fwrite(&c,sizeof(struct canteen), 1, fp1); } fclose(fp1); printf("item details stored file items.txt\n"); printitems(); while(1) { printf("do want update items?\n come in y or n : "); scanf("%s",s); if(s[0]!='n') { printf("enter item id: "); scanf("%s",id); if(!updateitem(id)) printf("no item found id: %s",id); else { printf("item detials after updation.\n"); printitems(); } } else break; } getch(); }

printitems() printing first entered item. when take update item details have been updating in file printitems() not displaying updated ones.

c

c# - Intercept webapi json formatting errors -



c# - Intercept webapi json formatting errors -

i'd have way intercept exception occurs when send in malformed json webapi endpoint, can homecoming semantic error code opposed 500. (e.g. "fix broken json or go hell")

you can create custom validation filter attribute deriving actionfilterattribute:

public class validationfilterattribute : actionfilterattribute { public override void onactionexecuting(httpactioncontext actioncontext) { if (!actioncontext.modelstate.isvalid) { actioncontext.response = actioncontext .request .createerrorresponse(httpstatuscode.badrequest, actioncontext.modelstate); } } }

now, may either decorate actions it:

[httpget] [validationfilter()] public string dosomethingcool()

or register globally via config:

config.filters.add(new validationfilterattribute());

c# .net json asp.net-web-api

matlab - how to use mxNumericArray -



matlab - how to use mxNumericArray -

my goal homecoming uint32 number:

i have been using mexcreatedoublescalar , alter mxcreatenumericarray

the old code is

const int all_good 0; plhs[0]=mexcreatedoublescalar(all_good);

the new code want

const int all_good 0; int dim[2]; dim[0]=dim[1]=1; plhs[0]=mxcreatenumericarray(2,dims,mxuint32_class,mxreal);

how can set value all_good in plhs[0], or batter way homecoming uint32 mex?

you can utilize mxcreatenumericmatrix more simple general mxcreatenumericarray create container mxarray, utilize mxgetdata pointer actual memory of allocated scalar , assign value it.

const int all_good = 0; // need assignment here... plhs[0] = mxcreatenumericmatrix( 1, 1, mxuint32_class,mxreal); // create scalar unsigned int* ptr = (unsigned int*)mxgetdata( plhs[0] ); ptr[0] = all_good; // assign value plhs[0]

matlab mex

ios - Swift - NSDictionary optional value crash -



ios - Swift - NSDictionary optional value crash -

let dataarray = jsondict["results"] nsarray; item in dataarray { allow obj = item nsdictionary var destination:string = obj["destination"] string! println(destination) }

above have nsarray looping through obtained parsing json file.

my problem is, can see output println successful application crashes whilst looping through. i'm pretty sure because of how i'm handling nsdictionary optional values i'm not sure how around it.

do need check optional value or along lines before printing it?

any ideas?

let dataarray = jsondict["results"] nsarray; item in dataarray { allow obj = item nsdictionary if allow foundname = obj["destination"] { println("name: \(foundname)") } }

checking optional value before printing fixed problem.

ios xcode swift xcode6

Apache status is 200 but the content length is zero -



Apache status is 200 but the content length is zero -

in apache (version 2.2.15) when send request, response status 200, content empty.

not response empty, sometimes.

any suggestions or know reason or give me suggestion?

apache

actionscript 3 - [AS3][Nape Physics] How to access associated object of a Nape body in a InteractionListener? -



actionscript 3 - [AS3][Nape Physics] How to access associated object of a Nape body in a InteractionListener? -

i need help physics engine nape in as3. have class rectangles (nape bodies) fellow member variables. have interactionlistener reacts when these rectangles interacts circles (also nape bodies) in scene. however, need access class instance rectangle part of when handling collision within of interactionlistener. class instance has methods need call. how can this?

public function foodinteraction(callback:interactioncallback):void { food.list.remove(body(callback.int1)); universe.space.bodies.remove(body(callback.int1)); // callback.int2 part of class organism, // need access organism , phone call organism33.eat(); }

i have dynamic amount of organism instances. each organism has dynamic number of rectangles. it's first rectangle in interacting. solution can see right have interacting rectangles in separate list along list of organism instances, , access organism via index of rectangle in other list. much faster able access organism via userdata in rectangle body... couldn't extend body because it's final class. please help!

i hate when finding solution seconds after asking it. if else interested in solution:

store instance this: body.userdata.organism = organism;

then access it: callback.int2.userdata.organism.foo();

actionscript-3 collision-detection nape

android - how to update a fragment from another fragment -



android - how to update a fragment from another fragment -

i have fragemnt in several buttons layaut , picture. in creating fragment on top of loaded data. in lower part of site other fragments. 1 of fragments contains list. when click on item list, need update info on fragment contains fragment. hr create new fragment parent new parameters derived list. think it's not right. tell me how update fragment.ie update info , set desired form elements, how update gui itself

example may easier

using interfaces interfragment communication should job you.

https://www.youtube.com/watch?v=vyygp_d0ia8&index=8&list=plonjj3bvjzw4lmlphgl7unqsgmercdzho

look below video, might help you.

android

javascript - Verify Textbox Names -



javascript - Verify Textbox Names -

how verify text boxes? jsp page created take in information.

first name should no have numbers in there, can come in name "103249" , text box takes it. also, how prepare lastly name well?

var btn = ""; function validate(myform) { if (btn == "submit") { //validate form on 'submit' button (not 'clear' button) var num = 0; var message = ""; if(myform.firstname.value == "") { message += "- first name must completed \n"; num = 1; } if(myform.lastname.value == "") { message += "- lastly name must completed \n"; num = 1; } if(myform.dateofbirth.value == "") { message += "- date of birth must completed \n"; num = 1; } //radio button validation var g = ""; //loop thru each radio button, verify if "checked" (var i=0; i<myform.gender.length; i++) { if (myform.gender[i].checked) { //changes value of "g" if value selected g = myform.gender[i].value; } } //if no radio button selected, "g" still = "" if (g == "") { message += "- gender must completed \n"; num = 1; } if(myform.gpa.value == "") { message += "- gpa must completed \n"; num = 1; } //dropdown if(myform.education.value == "") { message += "- education must completed \n"; num = 1; } //dropdown if(myform.job.value == "") { message += "- occupation must completed \n"; num = 1; } //radio button validation var g = ""; //loop thru each radio button, verify if "checked" (var i=0; i<myform.married.length; i++) { if (myform.married[i].checked) { //changes value of "g" if value selected g = myform.married[i].value; } } //if no radio button selected, "g" still = "" if (g == "") { message += "- married must completed \n"; num = 1; } //if(myform.spouse.value == "") { //message += "- spouse must completed \n"; //num = 1; //} //radio button validation var g = ""; //loop thru each radio button, verify if "checked" (var i=0; i<myform.children.length; i++) { if (myform.children[i].checked) { //changes value of "g" if value selected g = myform.children[i].value; } } //if no radio button selected, "g" still = "" if (g == "") { message += "- children must completed \n"; num = 1; } //dropdown //only require if previous field children marked "yes" if(myform.numchild.value == "0" && g == "yes") { message += "- number of children must completed \n"; num = 1; } if(myform.childsupport.value == "") { message += "- kid back upwards must completed \n"; num = 1; } if(myform.creditscore.value == "") { message += "- credit score must completed \n"; num = 1; } if (num == 1) { alert ("please finish or right next required fields: \n\n"+message); homecoming false; } else { homecoming true; } //end if } //end if submit button if (btn == "delete") { //confirm if want delete var result = confirm("are sure want permanently delete survey?"); homecoming result; } //end if delete button } //end func //=============== disable ccards , number of children dropboxes ================== function handleselect(myradio){ if(myradio.value == "no"){ document.getelementbyid("cc_use").selectedindex = 0; //reset initial default value document.getelementbyid("cc_use").disabled = true; } else { document.getelementbyid("cc_use").disabled = false; } //end if } //end func function handleselect1(myradio1){ if(myradio1.value == "no"){ document.getelementbyid("numchild").selectedindex = 0; //reset initial default value document.getelementbyid("numchild").disabled = true; } else { document.getelementbyid("numchild").disabled = false; } //end if } //end func //=============== populate occupation dropdown based on industry dropdown selection ================== function configuredropdownlist(industry, occupation) { //params: id's of sending dropdown & dropdown alter //categories: create string value of list items in java arraylist of categories //it translates string opening , closing brackets: [], need delete brackets string var categoryliststring = "<%= lstcategories %>"; categoryliststring = categoryliststring.replace("[",""); categoryliststring = categoryliststring.replace("]",""); //split category string new javascript array of categories var categoryarray = new array(); categoryarray = categoryliststring.split(", "); //make sure it's comma + space //occupations: create string value of nested list items in java arraylist of arraylists: occup names each category //it translates string opening , closing double brackets: [[]], need delete brackets string var occupbycatsstring = "<%= loccp %>"; occupbycatsstring = occupbycatsstring.replace("[[",""); occupbycatsstring = occupbycatsstring.replace("]]",""); //split string new javascript array var occupationsarray = new array(); occupationsarray = occupbycatsstring.split("], ["); //loop thru array , break farther individual nested arrays occup names in each category (var = 0; < occupationsarray.length; i++) { occupationsarray[i] = occupationsarray[i].split(", "); //make sure it's comma + space } //alert("new occup name array index 0: "+occupationsarray[0]+", index 1: "+occupationsarray[1]); //alert("individ occup names in index 0, name 0: "+occupationsarray[0][0]+", name 1: "+occupationsarray[0][1]); //categories array (categoryarray) & nested occup names array category (occupationsarray) //are parallel arrays in order match category names appropriate grouping of occup names //loop thru list of categories find selected 1 //and create dropdown list of matching occup names category (var = 0; < categoryarray.length; i++) { if (industry.value == categoryarray[i]) { //call method create occupation dropdown list values //send array of category's list of occupation names parameter, , 'occupation' id value of select createoccupationitems(occupationsarray[i], occupation); } } //end } //end function function createoccupationitems(occuparr, occupation) { //parameters in: array of category's list of occupation names, , 'occupation' id value of select document.getelementbyid(occupation).options.length = 0; (var = 0; < occuparr.length; i++) { createoption(document.getelementbyid(occupation), occuparr[i], occuparr[i]); } } //end function function createoption(ddl, text, value) { var opt = document.createelement('option'); opt.value = value; opt.text = text; ddl.options.add(opt); } //end function </script>

here actual code validate:

<div class="sameline"> <label for="firstname">first name:</label> <input type="text" name="firstname" value="<%=surv.getfname()%>"> </div> <div class="sameline"> <label for="lastname">last name:</label> <input type="text" name="lastname" value="<%=surv.getlname()%>">

upd:

if(myform.firstname.value.search(/[^a-za-z]+/) != -1) { alert("only characters"); }

javascript jsp

javascript - Jquery array.length is shorter than the real array length -



javascript - Jquery array.length is shorter than the real array length -

i'm new jquery , i've got problem mentioned in title. controller code looks like:

[httppost] public jsonresult getprojectlist() { list<project> projectlist = new list<project>(); foreach (iml.projectinfo pr in getprojectarray()) { project x = new project(pr.name, pr.id, pr.ownerid, pr.createdby, pr.createdat, "", pr.deleted, pr.closed); projectlist.add(x); } homecoming json(projectlist.toarray()); }

when check projectlist under debugger mode has 6 elements. in webpage have next ajax call:

$.ajax({ url: '@url.action("getprojectlist")', type: "post", //enumerowanie projektów success: function (data) { projekty = data; var wyswietl ="<table><tbody>"; var tabelka = ""; var wybranyprojekt; alert($.data.length);//this alert tells me data.length 3 (i = 0; < 6; i++)//even if $.data.length 3 data[i].name holds values 6 elements { tabelka += "<tr class=\"enumeracjaproj\" id=\"" + + "\"><td class=\"projekty\" id=\"" + + "\"> " + data[i].name + " </td></tr>" } wyswietl += tabelka; wyswietl += "</tbody></table>"; $('#projekty_div').append(wyswietl);

})

even if post array of 6 elements ajax result tell me length 3. if go on in loop 6 iterations hard-coded displayed name.

small correction, should alter alert($.data.length); alert(data.length);

$.data jquery function , data response result

javascript jquery asp.net asp.net-mvc

java - Aspectj ltw aop.xml -



java - Aspectj ltw aop.xml -

how can utilize aop.xml define pointcuts in plain java code? sample code in trying define pointcut in aop.xml-> 1)this java class

package testaop; public class helloworld { public static void main(string[] args) { helloworld app = new helloworld(); app.say("hello world!"); app.add(11, 22); } private int add(int i, int j) { homecoming + j; } public void say(string message) { system.out.println(message); } }

2)my aspect class

package testaop; abstract aspect myaspect { protected abstract pointcut publicmethod(); object around() : publicmethod() { system.out.println(thisjoinpointstaticpart); homecoming proceed(); } }

3)have created meta-inf folder in main project directory folder i.e. in bundle testaop->meta-inf consists of aop.xml

<?xml version="1.0" encoding="utf-8"?> <aspectj> <aspects> <concrete-aspect name="testaop.concreteaspect" extends="testaop.myaspect" > <pointcut name="publicmethod" expression="execution(public * testaop.helloworld.*(..))" /> </concrete-aspect> </aspects> <weaver options="-verbose"> <weaver options="-showweaveinfo"/> </weaver> </aspectj>

have added metainf folder having aop.xml java build path , in run configurations aspectj load-time weaving have set next properties:

in main tab project->helloworldplainjava ,main class->testaop.helloworld in arguments tab vm arguments->-javaagent:"d:\eclipse_fldr\eclipse\plugins\org.aspectj.weaver_1.7.3.20130613144500-a.jar" in ltwclasspath tab in user entries have added helloworldplainjava.

what did miss? why not recognizing pointcuts?

was able solve problem, aop.xml missing in bin folder , there version mismatch aspectjrt , aspect-weaver

java eclipse

python - Multiple step histograms in matplotlib -



python - Multiple step histograms in matplotlib -

dear python/matplotlib community,

i having issue within matplotlib: can't seem plot multiple overlaid histograms in same plot space using following:

binsize = 0.05 min_x_data_sey, max_x_data_sey = np.min(logoii_oiii_sey), np.max(logoii_oiii_sey) num_x_bins_sey = np.floor((max_x_data_sey - min_x_data_sey) / binsize) min_x_data_comp, max_x_data_comp = np.min(logoii_oiii_comp), np.max(logoii_oiii_comp) num_x_bins_comp = np.floor((max_x_data_comp - min_x_data_comp) / binsize) min_x_data_sf, max_x_data_sf = np.min(logoii_oiii_sf), np.max(logoii_oiii_sf) num_x_bins_sf = np.floor((max_x_data_sf - min_x_data_sf) / binsize) axscatter_farright = fig.add_subplot(gs_right[0,0]) axscatter_farright.tick_params(axis='both', which='major', labelsize=10) axscatter_farright.tick_params(axis='both', which='minor', labelsize=10) axscatter_farright.set_ylabel(r'$\mathrm{n}$', fontsize='medium') axscatter_farright.set_xlim(-1.5, 1.0) axscatter_farright.set_xlabel(r'$\mathrm{log([oii]/[oiii])}$', fontsize='medium') axscatter_farright.hist(logoii_oiii_sey, num_x_bins_sey, ec='0.3', fc='none', histtype='step') axscatter_farright.hist(logoii_oiii_comp, num_x_bins_comp, ec='0.3', fc='none', histtype='step') axscatter_farright.hist(logoii_oiii_sf, num_x_bins_sf, ec='0.3', fc='none', histtype='step')

it seems axes class can not handle multiple histograms? please right me if and/or have gone wrong.

my overall plot 1 row, 3 column plotting space. utilize grid spec give plots layout.

this plot looks far:

this want histogram portion of figure in terms of step type histogram overlays (with legend):

i have datasets 3 different tuple type arrays generated csv file. i.e., using x, y = np.genfromtext(datafile.csv)

if able explain how done appreciative.

what you're doing should work perfectly. possible 1 of distributions in x-range of -1.5 1 you've set couple of lines before? (i.e. seek removing manual set_xlim statement , see if other distributions show up.)

as quick, stand-alone illustration demonstrate things should work:

import numpy np import matplotlib.pyplot plt num = 1000 d1 = np.random.normal(-1, 1, num) d2 = np.random.normal(1, 1, num) d3 = np.random.normal(0, 3, num) fig, ax = plt.subplots() ax.hist(d1, 50, ec='red', fc='none', lw=1.5, histtype='step', label='dist a') ax.hist(d2, 50, ec='green', fc='none', lw=1.5, histtype='step', label='dist b') ax.hist(d3, 100, ec='blue', fc='none', lw=1.5, histtype='step', label='dist c') ax.legend(loc='upper left') plt.show()

(if want legend show lines instead of boxes, you'll need utilize proxy artist. can add together illustration if you'd like. that's outside scope of question, though.)

python matplotlib plot histogram

sql server - when was the last time Ansi_warning was set -



sql server - when was the last time Ansi_warning was set -

in our production database there sp working fine till 2nd nov 2014 , started giving warnings warning : null value eliminated aggregate or other set operation because ansi_warning on in our production database resolve had marked set ansi_warning off in origin sp

so can tell me there way can check when lastly time or whom ansi_warning set

you can see configuration changes using t-sql

declare @stracepath varchar(1024) select @stracepath=convert(varchar(500),value) fn_trace_getinfo(default) property=2 select textdata,hostname,applicationname,databasename,loginname,spid,starttime,eventsequence fn_trace_gettable(@stracepath,1) textdata '%configure%' , spid<>@@spid order starttime desc

this of cource based on have default trace enabled on server.

sql-server

objective c - Trouble getting delegate working in ios -



objective c - Trouble getting delegate working in ios -

i'm starting larn objective-c , i'm not 100% on syntax yet, , think might i'm having trouble, 1 time again i'm not sure. i'm trying 1 view controller send message parent/callee view controller. have set this:

//parentviewcontroller.h #import "subviewcontroller.h" @interface parentviewcontroller : uiviewcontroller <subviewcontrollerdelegate> - (void) sendmessagetoparent:(nsinteger)num; @end

this implementation:

//parentviewcontroller.m @implementation parentviewcontroller - (void) sendmessagetoparent:(nsinteger)num { nslog(@"message %d", num); } - (void) buttonpushed { [self performseguewithidentifier:@"subview" sender:sender]; } @end

here's other view controller setup:

//subviewcontroller.h @protocol subviewcontrollerdelegate <nsobject> - (void) sendmessagetoparent:(nsinteger)num; @end @interface subviewcontroller : uiviewcontroller @property (nonatomic, weak) id <subviewcontroller> delegate; @end

and implementation:

//subviewcontroller.m @implementation subviewcontroller @synthesize delegate; - (void) { [self.delegate sendmessagetoparent:4]; [self.dismissviewcontrolleranimated:yes completion:nil]; }

appreciate help, thanks.

you need add together parentviewcontroller:

- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"subview"]) { subviewcontroller *vc = [segue destinationviewcontroller]; vc.delegate = self; } }

ios objective-c

python - Django - source in serializers leading to too many database calls -



python - Django - source in serializers leading to too many database calls -

i trying create song-artist-album relationship in django. have next models:

class artist(models.model): gid = models.charfield(max_length=63, blank=true) name = models.charfield(max_length=255, blank=true) begin_life = models.charfield(max_length=31, blank=true) end_life = models.charfield(max_length=31, blank=true) type = models.charfield(max_length=1, blank=true) gender = models.charfield(max_length=1, blank=true) class song(models.model): gid = models.charfield(max_length=63, blank=true) title = models.charfield(max_length=255, blank=true) artist = models.foreignkey('artist', related_name='songs_artist') album = models.foreignkey('album', related_name='songs_album') length = models.integerfield(default=0)

i have created artistserializer can retrieve songs of artist when info of particular artist. serializer have created:

class artistserializer(serializers.modelserializer): songs_artist = songserializer(source='songs_artist') class meta: model = artist fields = ('name', 'type', 'gender', 'begin_life', 'end_life', 'songs_artist') class songserializer(serializers.modelserializer): artist = songartistserializer() album = songalbumserializer() class meta: model = song fields = ('id', 'title', 'artist', 'album', 'length') class songartistserializer(serializers.modelserializer): class meta: model = artist fields = ('id', 'name')

a quick profiling on method of artist revealed troubling facts. next results of profiling ordered time , number of calls: http://pastebin.com/bwcksn2i.

but, when removed songs_artist field serializer, next output of profiler: http://pastebin.com/0s5k4w7i.

if read right, database beingness nail 1240 times when utilize source!

is there other alternative doing this?

thanks in advance.

django rest framework not optimize queries you, it's decide how best remove n+1 queries. should follow guidelines covered in the django documentation handle performance issues.

in case of foreignkey relationships, should utilize select_related in query, pre-fetch objects in original query.

in case of manytomany , genericforeignkey relationships, should utilize prefetch_related. i've written quite bit in another stack overflow answer, gist utilize similar select_related.

you should override query in get_queryset on view best results, don't need worry django rest framework incorrectly cloning queryset when used attribute on class.

python django django-rest-framework

Qt WebKit On Mobile -



Qt WebKit On Mobile -

i trying render web page. qt says qtwebkit available mobile since 4.8 here

if want target mobile devices should consider using qgraphicswebview instead of qwebview.

both of them under qtwebkit. missing?

if talking android , ios, it's no-no. citing digia release page of qt 5.2:

qt webkit not supported on android , working on providing cross-platform api integrate web content mobile apps. if you incorporate web content qt application, need utilize native web component. create interacting native contents easier, providing qt android extras module jni convenience api.

the same goes ios apple explicitly forbids usage of other webkits, apart their.

digia working on new web engine should available on android platform (and embedded linux) , available in qt 5.4 beta. same policies issues of qt webkit applies web engine, w.r.t. ios.

to ease developers work, in same new release qt 5.4, digia provides technology preview of qt webview; citing 1 time again blog:

for platforms not allow distribution of qt webengine utilize cases full-blown web engine not needed qt 5.4 introduce technology preview of new module called qt webview. supports embedding native web engines of underlying operating scheme qt, , available android , ios. because of this, qt webview gives convenient light-weight solution simple web document integration. qt webview available qt 5.4 final separate add-on.

qt mobile qtwebkit