Tuesday 15 February 2011

List tables in a PostgreSQL schema -


When I do a \ dt in psql, then I get a list of tables in the current schema ( public by default).

How do I get a list of all the tables in all schemas or any particular schema?

In all schemas:

  = & gt; \ Dt *. *   

In a particular schema:

  = & gt; \ Dt public *   

It is possible to use

  \ dt (public | s). (S.T.T) List of Relationship Schema | Name | Type | Owner -------- + ------ + ------- + ------- Public S | Table | CPN Public | T | Table | CPN S | T | Table | CPN   

An advanced user can use regular expression notes such as character classes, for example [0- 9] to match any number, all regular expressions Special characters, 9.0. Which is taken as a separator in the form of the above, which is translated into regular expression. ,? Which is the translation, and $ which is literally matched, can you simulate these pattern characters by writing? For, R for (R + |), for R , or (R |) R?. $ Is not required as the character of regular expression because the pattern should match the whole name, in contrast to the regular interpretation of regular expression (in other words, $ automatically associated with your pattern). Writing * In the beginning and / or at the end if you do not want to anchor the pattern, note that within the double quotation marks, all the regular expression special characters lose their special meaning and match it literally. Also, regular expression special characters are literally matched in operator name patterns (i.e., \\ the argument).

c - Programming assignment says test program will only #include .H file, not .CC file. Can someone clarify -


So I have two files for which I need to turn, call them: example.cc and example.h < / P>

We have been told that their test code will only contain "example.h". I usually include the example # example "example.cc" because it will already include example example.h is.

When I run the test code, I just get "an unspecified reference for example: Example ..", whenever I mention the example in the test code, it is clearly because the test The code can only see my delcarations in example.h, not their actual implementation.

What am I missing? I have included example.cc in Example #, but this is clearly not correct.

It appears that your professor has some other type of file, called Professor_man.cc , And they will compile this project like this:

  g.+ example.cc professor_main.cc -o project   

in their professor_main.cc One line will be

  #include "example.h"   

and also use some of your functions, and potential tests that they are doing the right thing Are:

  std :: cout & lt; & Lt; (Example_add (2,3) == 5)? "Good": "Bad" & lt; & Lt; Std :: endl;   

Now, if they do not include #home.h, or if you have not created that file correctly, they will get a compilation error at professor_main.cc, Because it is not about example_add (int, int), the important line header should be in the file and it removes this error:

  int example_add (int a, int b);   

This is called Function Declaration.

If everything has been done properly, but your professor has made a mistake and tried to compile the project without an example. In this way:

  G ++ Professor_man.cc-o project   

Then they should have an "undefined reference" about a linker < / Em> error will be found "example_add ().

What is missing definition :

  int example_add (int a, int b) { Return a + b;}   

This should be in your example.cc file, and if the professor also includes that on their compilation command line, everyone should be well.

However, if you enter # example "example.cc" in your header file Effectively, you then copy and pasted example example.cc in professor_main.cc, because it's #included in but it's clearly still in your file, example.cc so if Your professor tried to do this:

  g ++ example.cc professor_main.cc -o project   

make them a several definitions < Error from linker / em>, because function example_add () is defined by twice << p> Generally, then, what you probably should do in your source file (.cc) Definitions and all your functions in your header file (.h) announcements someone other. Try compiling it with a cc file and use it to see how it works.

ios - load images in tableview ios6.1 -


मैं uitableview ios6.1 में छवियों को कैसे लोड करूँ?

मैं वर्तमान में SDWebImage का उपयोग कर रहा हूं और यह काम करता है। लेकिन कभी-कभी यह छवि को लोड नहीं करता है

क्या कोई अन्य लाइब्रेरी है जो मैं उपयोग कर रहा हूं? मैं आईओएस में शुरुआत कर रहा हूं और इससे मुझे बहुत मदद मिलेगी।

अग्रिम धन्यवाद।

यह वह कोड है जो मैं अब के लिए उपयोग कर रहा हूं:

  - (UITableViewCell *) तालिकादृश्य: (UITableView *) तालिका दृश्य सेलफोराअटइंडपैथ: (NSIndexPath *) सूचकांकपथ {स्थिर NSString * MyIdentifier = @ "MyIdentifier"; UITableViewCell * सेल = [टेबलव्यू डेक्यूवर पुन: योग्य CellWithIdentifier: MyIdentifier]; अगर (सेल == नीला) {सेल = [[[यूआईटीबलव्यूजेल आलोक] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: MyIdentifier] autorelease]; } // यहां हम नए प्रदान किए गए सेट इमेज वाईथ URL का उपयोग करते हैं: वेब छवि को लोड करने के लिए विधि [cell.imageView setImageWithURL: [NSURL URLWithString: @ "http://www.domain.com/path/to/image.jpg"] प्लेसहोल्डर छवि: [UIImage imageNamed: @ "प्लेसहोल्डर पेज"]]; Cell.textLabel.text = @ "मेरा पाठ"; रिटर्न सेल; }    

मैं इसे एक उत्तर में डाल रहा हूं क्योंकि यह टिप्पणी के लिए बहुत लंबा था :

SDWebImage पैकेज इसकी कैशिंग के लिए मजबूत है - विशेष रूप से ऑन-डिस्क कैशिंग जो आईओएस (विभिन्न ओएस संस्करणों के विभिन्न स्तर / कैशिंग के प्रकारों के समर्थन के साथ) में दर्द का एक सा हो सकता है। SDWebImage बहुत अच्छी कार्यक्षमता भी प्रदान करता है - आप अपने गीथहब पृष्ठ पर मुख्य बिंदु देख सकते हैं (यह शीर्ष पर बुलेट सूची है)।

अगर यह केवल UIImageView की श्रेणी है जो आप के बाद है (जो setImageWithURL: placeholderImage: विधि) तो कुछ (मैं 'सबसे ज्यादा' कहना चाहूंगा, लेकिन मैं डेटा / आंकड़ों के साथ इसे वापस नहीं कर सकता) लोगों को पहले से ही नहीं होने की संभावना से AFNetworking का इस्तेमाल होता है उस का उपयोग करके उनके नेटवर्क स्टैक के रूप में। हमारे उत्पादन ऐप एएफएनेटवर्किंग का उपयोग करता है + SDWebImage क्योंकि हमें व्यापक वायुसेनात्मक कार्यक्षमता की जरूरत है लेकिन डिस्क-कैशिंग पर भी।

ओह और छवियों के संबंध में डाउनलोड नहीं करना - संभव है कि यह एक नेटवर्क समस्या थी तथ्य यह है कि आपको कोई त्रुटि नहीं मिली है और एप को दुर्घटना नहीं हुई है, यह कार्यक्षमता का बहुत अधिक है, जो SDWebImage जोड़ता है। इसी तरह की विधि को कार्यान्वित करने के लिए त्रुटि मामलों (नेटवर्क त्रुटि बनाम अनधिकृत बनाम गलत यूआरएल) और मुख्य थ्रेड को अवरुद्ध किए बिना यूआईएमएजेव्यूयूई को भी अपडेट करने की आवश्यकता होगी, जो सभी लागू करने के लिए काफी जटिल हो सकते हैं न कि सिर्फ शुरुआत के लिए बल्कि मध्यवर्ती प्रोग्रामर के लिए भी । कार्यक्षमता सरल दिखती है - एक छवि डाउनलोड करें, प्लेसहोल्डर का उपयोग करें, और छवि आने पर अपडेट करें - लेकिन यह निश्चित रूप से एक तुच्छ कार्य है।

c# - Dynamically set UserControl as Listbox DataTemplate body -


मेरे पास निम्न सेटअप है:

  & lt; ListBox ItemSource = "{बाध्यकारी लक्ष्य} "& gt; & LT; ListBox.ItemTemplate & gt; & LT; DataTemplate & gt; & Lt; दृश्य: देखेंनाम / & gt; & Lt; / DataTemplate & gt; & LT; /ListBox.ItemTemplate> & Lt; / ListBox & gt;   

मैं जो काम पूरा करने का प्रयास कर रहा हूं वह गतिशील रूप से तय करना है कि रनटाइम पर किस दृश्य का उपयोग करना है, यह DataContext में ListBox कोड>। सरल शब्दों में, मैं & lt; दृश्य: ViewName & gt; को एक डेटा बाइंडिंग के साथ बदलना चाहता हूं जो उचित दृश्य देता है।

मैं अपने ऐप के लिए प्लग-इन्स प्रदान करने के लिए MEF का उपयोग करता हूं उचित होने पर आइटम प्रदर्शित करने के लिए कस्टम दृश्य प्रदान करने की आवश्यकता हो सकती है डिजाइन समय पर मुझे सभी संभावित दृश्य प्रकार (वे गतिशील रूप से डीएलएल से लोड किए जा सकते हैं) नहीं जानते हैं, इसलिए एक सरल DataTemplateSelector ऐसा नहीं करेगा।

मैंने समाधान शोध किया है लेकिन खाली आ चुका है।

DataTemplateManager से आप कुछ ऐसा कर सकते हैं:

  डेटाटाइमप्लेटमैनैजर। पंजीयकडेटाप्लेट & lt; ViewModelType1, ViewType1 & gt; (); डेटाटाइमप्लेट प्रबंधक। पंजीयकडेटाप्लेट & lt; ViewModelType2, व्यू-टाइप 2 & gt; (); डेटाटाइमप्लेट प्रबंधक। पंजीयकडेटाप्लेट & lt; ViewModelType3, ViewType3 & gt; ();   

तब आप लिस्ट बॉक्स से ItemTemplate निकालना चाहते हैं:

  & lt; लिस्ट बॉक्स आइटमस्सोर्स = "{बाध्यकारी लक्ष्य}" / & gt;   

और लिस्ट बॉक्स दृश्य मोडेल में आप यह कर सकते हैं:

  सार्वजनिक शून्य AddTargets () {लक्ष्य। जोड़ें (नया ViewModelType1 ()); लक्ष्य। जोड़ें (नया व्यूमोल्डटाइप 2 ()); लक्ष्य। जोड़ें (नया दृश्यमॉडलटाइप 3 ()); }   

फिर, प्रत्येक DataTemplate स्वचालित रूप से प्रत्येक संबंधित ViewModel को प्रस्तुत करने के लिए WPF द्वारा उपयोग किया जाएगा।

यह भी ध्यान रखें कि आप DataTemplateManager.RegisterDataTemplate () सूची बॉक्स को दिखाने से पहले किसी भी समय, ताकि आप सैद्धांतिक रूप से ऐसा कर सकते हैं जब एमईएफ भागों को लोड करते हैं।

संपादित करें:

आपकी टिप्पणी के आधार पर , आप व्यू मॉोडल में किसी संपत्ति के अनुसार चयनित व्यू को प्रदर्शित करने के लिए एक सामग्री प्रस्तुति के साथ एक एकल डेटाटामप्लेट बना सकते हैं:

  & lt; डेटाटाइमप्लेट डेटाटाइप = "{x: स्थानीय टाइप करें: लक्ष्य दृश्यमॉडेल}" & gt; & Lt; ContentPresenter x: name = "MainContentPresenter" सामग्री = "{बाध्यकारी}" ContentTemplate = "{बाध्यकारी आपकी प्रॉपर्टी, कनवर्टर = कुछ कनॉन्टर}" / & gt;   

और SomeConverter के अंदर आपको एक ही तकनीक का उपयोग करना चाहिए जैसा कि पोस्ट में दिखाया गया है, ताकि डेटाटाइमेट को गतिशील रूप से जनरेट किया जा सके।

php - mysqlworkbench giving version error on exporting database -


When I try to export my database from mysqlworkbench away from local level,

I'm getting some lower version error

  mysqldump version mismatch [content] mysqldump.exe is version 5.5.16, but the MySQL server has to be abandoned version 5.6.10-log. Since the version of mysqldump is older than the server, some features can not be backed up correctly. It is recommended that you upgrade your local MySQL client program, with mysqldump equivalent to the target server or with the newer version. Dump tool's path preference - & gt; Administrator - & gt; The path of the Mysqldump tool   

I am trying to find a solution, I searched for a solution on Google but could not find a good answer to solve this problem.

Does anybody know how to fix this problem in mysqlworkbench?

ya eta © edit - preferences - admin - path Mysqldumptool: (procure o mysqldump.exe without pasta MysqlServer clique nele e de ok), apso


Go to Edit - Preferences - Administrator - Path to Mysqldumptool: (For this, see Mysql / bin / then file mysqldump.exe in your MySQL server installation folder And then click OK), then try to backup it.

iphone - willSendRequestForAuthenticationChallenge not called -


I am trying to validate the server certificate in an iOS application. There is a problem with

:

  - (zero) connection: (NSURLConnection *) connection will be the Sandroquestfertification challenge: (NSURLAuthenticationChallenge *) challenge   

When I put this method on

However, when I put it on my production server (Government Ca), this method does not just call.

This proof, I suppose, can be considered as a self-signed certificate, because if you do not have GOV serials installed, you receive the message "This Connection Unreliable" in the browser.

What is the ISENDRequestForAuthenticationChallenge called for enforcement of force in any way and can check self-signed certificates?

Thank you!

The question was asked some time ago, but I thought I would give an answer for people to come Would like to

As I unders the challenge of the sleepiness certification, only every 10 minutes per host is called accordingly. The result of the challenge is being cached for the performance. Cash expires in 10 minutes ()

Good insight is given here by jblack , which is a reference to the Apple forum:

When I had a similar question and a problem, the thing that slipped me was that I had used the same host for many operations in the app, so the challenge has been accepted elsewhere, but my Exclude from NSURL connection Halley has not expired, so I never got a challenge (no need).

Try to separate this request to the host and then you should get a callback.

Hope this will be helpful.

c++ - Pipe erratic behaviour in linux / MSVC 2012 -


I have a particle system for which I basically track coordinates. So far I was output all the coordinates in the files, then do it with a Gnuplot script and using FFPAP to make a video from PGG. To leave all file I / O, I did not take any advantage before OpenGL, so I thought of installing a pipe for Gnuplot.

I like it in MSVC 2012: FILE * gnuplotpipe = _popen (GNUPLOT_NAME, "w"); Setwuf (Gnuplotipipe, Faucet, _IONBF, Faucet); // Setbuff (GnuplotPipe, Faucet); Fprintf (gnuplotpipe, "set word png \ n"); Fprintf (gnuplotpipe, "size size 720, 480 \ n"); Fprintf (gnuplotpipe, "set size ratio -1 \"); Fprintf (gnuplotpipe, "unset \ n"); Fprintf (gnuplotpipe, "set xrange [-% d:% d] \ n", RANGE + 100, RANGE + 100); Fprintf (gnuplotpipe, "set yrange [-% d:% d] \ n", RANGE + 100, RANGE + 100); For calculating fprintf (gnuplotpipe, "% f% f \ n", particle [//] for the (time-phase) // Doo Stuffprint (gnuplotpipe, "plot" - '\ n "); (all particles) I] - end for ffush (gnuplotpipe, "e \ n"); // fflush (gnuplotpipe); _pcloce (gnuplotpipe); <-> <->, x [i] -> y); end for fprintf; gnuplot -persist instead of popen and instead of

Pclose , and setbuf instead of setvbuf . It was already with much testing and error.

This is very consistent in Linux I plot '-' command and after that can read unreadable text. Nothing opens in Windows This is amazing in Windows, as sometimes it will work and I will be able to do data streaming on the GnuPlot "MS Windows" window (I mean the console is not output and it is amazing for me because I am not using wgnuplot_pipes.exe). Nothing has been plotted. The window is closed for some time-period for a second time W Lot will, but in separate windows for each time-step. Occasionally, it will crash or it will work but send unpleasant text.

I am working with 100 particles most of the time. I can have more than 10,000 time-consuming steps. I do not know that this is a lot. I suspect cut-offs in windows or some things, though I'm setting buffer with a tap. I am working in WinXX64 and QT in MSVC in Linux Mint X64 in versionbank I am using gnuplot 4.7 (win) and 4.6.0.8 (linux). I have seen very much in SO and only one problem I have found is that -persist is not actually released in windows. Any help would be appreciated.

This question is not unanswered. Puts a single window with a silly animation.

However, I would not be surprised that some other drivers try to open a window for each frame

  import subprocessation F = subprances. Popen (['/ usr / bin / gnuplot', '- persist'], stdin = subprocess.PIPE, shell = falls) f.stdin.write ('set term x11 \ n') f.stdin (I) == 50: d * = -1 i + = 1 If IRCTET = 1000 IT = = d f.stdin.write ('plot' '\' points with lines 4 PS2 \ n ') in range Range (0,500): F.stdin.write ('% f% f \ n'% (float (j), math.sin (float (j) / float (abs (i) +1)))) f.stdin.write ('e \ N ')    

sql server - Conditional reuse of subquery -


This can not be detected ...

There is an alternative argument in the SQL stored procedure, say id (int) . For the sake of simplicity, say, I have to return a result set with the extra ... and id = @ id , if the argument is not null. If I do not only return the result set

How do I avoid writing the 'core' of the query twice? CTE in rescue?

You can try: < @id If the null query compares your ID column then <> iTool (@id, id)

for yourself, which is always true, otherwise The parameter is used.

c# - MVC4 with EF sample code with Unit of work, generic repository pattern? -


Are there any MVC 4 code samples that use the Entity Framework, the unit of work and the normal template < / Div>

I used this 2 tutorial to do this:

and



Can Silverlight Pivotviewer handle 3 levels of semantic zoom? -


I can get the PivotViewerItemTemplate 2 level to work properly, but not three

If I set a template on MaxWidth = 130, then there is no maxvidth on MaxWide = 400, and the second level is converted to approximately 170 pixels in 3G and now it is not visible at all only 280 pixels

Any suggestions on what I am doing wrong here?

TIA

32, 64, 128 etc. requires the powers of your MaxWidth. As the powers you can have so many levels I :) We have written a post explaining it in more detail

javascript - how can i get rid of duplication in this code -


I have $ (this). CSS () There is a lot in my code ... I am new to JS therefore I am $ (".btn-pvPanels") What is the best way to remove this break is, ). ('Click', function {var selected; selected = $ (this) .val (); if (selected === "on-panel") {$ (this) .css ({'background': 'Orange', 'color': 'white'}); $ (this) .parent (). ('.btn-off'). CSS ({'background': '# F1F1F1' 'Color': '# 8E8D8D'} $ ('.aon_poff'). Feidin ('slow');} and if (selected === "off-panel") {$ (this) .css ({'background ':' ('.' '' Color ':' white '}); $ (this) .Parent (). (' BTN-on '). CSS ({' background ':' # F1F1F1 $ '(' .aon_poff ') .Fedhat (' slow ');} and if (selected === "on-access") {$ (this) .css ({ 'Backgro Und ':' orange '("btn-on"). Css ({' background ':' # F1F1F1 ',' color ':' # 8E8D8D '});} And if (selected === "on-exchange" & amp; "over-panel") {$ (this). CSS ({'background': 'orange', 'color': 'white'}); $ (This) .Parent () Find ('.btn-on') .css ({'background': '# F1F1F1', 'color': '# 8E8D8D'}); Warning ('O')}} ); $ (".btn-stuff"). ('Click', function (event) {var selected; selected = $ (this) .val (); If (selected === "on-acquisition") {$ (this). CSS ({'background': 'orange', 'color': 'white'}); $ (This). Parent (). ('.btn-off') search. Css ({'background': '$ F1F1F1', 'color': '# 8E8D8D'}; $ ('.aoff_pon'). Feidin ('slow');} and if (selected === "off-accessories" ) {$ (This) .css ({'background': 'orange', 'color': 'white'}); $ (this) .Parent (.). ('.btn-on') .css ({ 'Background': '# F1F1F1', 'color': '# 8E8D8D'}) $ ('.aoff_pon') .Fedot ('slow');}}); Use CSS class names in style:

     

Now .css () Instead of setting you can use it:

addClass ('selected') and removeClass ('selected') for orange background.

addClass ('unselected') and removeClasS ('unselected') for gray background.

php - I have one select list, which should send data with a few forms -


I have such a site: (set of form)

  & lt; Select ID = "Group_dropdown" name = "selection input" & gt; & Lt; Option value = 0> All & lt; / Options & gt; & Lt; Option value = 1> 1 option & lt; / Options & gt; & Lt; Option value = 2> 2 options & lt; / Options & gt; & Lt; / Select & gt; & Lt; Form method = "post" class = "form-inline" id = "form11" & gt; & Lt; Input type = "text" name = "1forminput" placeholder = "0" & ​​gt; & Lt; / Label & gt; & Lt; Button type = "submit" class = "btn btn-success ml40" & gt; Save & lt; / Button & gt; & Lt; / Form & gt; & Lt; Form method = "post" class = "form-inline" id = "form22" & gt; & Lt; Input type = "text" name = "forminput" placeholder = "0" & ​​gt; & Lt; / Labels & gt; & Lt; Button type = "submit" class = "btn btn-success ml40" & gt; Save & lt; / Button & gt; & Lt; / Form & gt;   

I want to send data from this selection (which is "mutual" for both of these forms) when any of these forms are sent (such as an additional field withind sender form ). Is this a simple solution for that?

Add a hidden information and valid markup with the initial label tag etc.

  & lt; Select ID = "group_dropdown" name = "selection input" & gt; & Lt; Option value = "0" & ​​gt; All & lt; / Options & gt; & Lt; Option value = "1" & gt; 1 option & lt; / Options & gt; & Lt; Option value = "2" & gt; 2 options & lt; / Options & gt; & Lt; / Select & gt; & Lt; Form method = "post" class = "form-inline" id = "form11" & gt; & Lt; Label & gt; & Lt; Input type = "text" name = "1forminput" placeholder = "0" /> & Lt; Input type = "hidden" name = "selection_name" /> & Lt; / Labels & gt; & Lt; Button type = "submit" class = "btn btn-success ml40" & gt; Save & lt; / Button & gt; & Lt; / Form & gt; & Lt; Form method = "post" class = "form-inline" id = "form22" & gt; & Lt; Label & gt; & Lt; Input type = "text" name = "forminput" placeholder = "0" /> & Lt; Input type = "hidden" name = "selection_name" /> & Lt; / Labels & gt; & Lt; Button type = "submit" class = "btn btn-success ml40" & gt; Save & lt; / Button & gt; & Lt; / Form & gt;   

Then fill out the selected input when the value of the selection changes:

  $ ('# group_dropdown'). ('Change', function () {$ ('[name = "select_value"]'). Val (this.value);}) Trigger ('change');   

and selection values ​​will be sent with both forms when they are submitted, and will be accessed:

  $ _ POST ['select_value' ];    

asp.net mvc - JQuery Post data to MVC Action Method? -


All I am trying to do is pass the MVC action method to the array of strings / ints. But the data always comes back empty, what am I doing wrong?

MVC Controller

  [HTTP Post] Public Functioning MyAction (list & lt; string & gt; id) {// Do something with array // but it is empty See Return (); }   

JQuery

  $ Post ("/ MyController / MyAction", JSON.stringify (id), function () {warning ("woohoo");}, "app / jsan");   

Posting in the data action result

  ["156"]    

Try:

  ... JSON.stringify ({id: id}), ...   

I'm pretty sure that the model binder is not sure that the list / array must also be bound.

Consider:

  [HttpPost] Public action result menu (list & lt; string & gt; id, list & lt; string & gt; blah) {}   

If JSON has been passed as an array of values, then which parameter is also binded? JSAN can be more complex than FormMS submissions, so it requires a bit more definition too. For example, the following ideas will work for the previous idea.

Update / Strong>

To send Jasonson properly, the following AJAX call will be required:

  $ Ajax ({type: "post", url: "/ home / index", data: json.stringify (id), content type: "app / jason; charset = utf-8"});   

The last parameter in the post (you specified application / json ) is expected to return from the server. By default, $ The post is an encoded ( application / x-www-form-urlencoded ) contentType that appears to have worked hard in shortcut method. To set up ContentType, you must use long arm version $ .jax

android - Enumerate all elements in Selenium Python bindings for Appium -


I am trying to get started with an API to test my company's mobile applications. I want to use Python binding to write scripts, and I have to start with the Android app.

I have an appium example that all are working, I can run chunky Android and test work, and I run the sample app android.py Can i

But I'm a total newbie and in my company's app I do not have a clear picture to identify the controls. I have experience with Python, so I thought I would just make a list of control elements. And I will introspect them.

I'm stuck! All methods like driver.find_elements_by_tag_name () require a specific identifier (or at least I do not get any wildcard that works).

How can I self help an appium tree represent the Android app under testing of the elements? How can I calculate all the elements so that I can introspect them? Can I run a tree to find all the elements in the app?

I was hoping that I could capture the elements without getting the source code for the applet, I could create the app in Eclipse. But I can do this if necessary.

PS I like to use Python, but if it works better then it will open to do some more introspection. I can still write the actual tests in Python Other languages ​​may not be quite better

Supports APIs of the WebDriver's "Page Source" method so you can:

  # Assume that you have the driver object imported json source = driver.page_source source = json.loads (source) # You can now work with the sources of dragon object  < / Pre>  

java - Can't run yui jar file - missing variable name and missing } after function body -


I'm trying to run this command in CMD:

  java -jar Yuicompressor -2.4.2.Jere "C: \ Users \ ehad \ Desktop \ Test \ dist \ js \ js.js change" -o "C: \ Users ehad \ desktop \ test \ dist \ jjs" --CoserSet UTF-8 - Verbose - Presce-Cm   

My OS is Win 7 64 bit, Java is installed on my machine, and I'm running this command with DIR The funny thing is that it works fine in a different machine, why can not I get this error:

[Error] 34: 20 Missing Variable Name

[Error] 34: 20missing after work body} [error] 34: 20missing function after body

Because I have to runnig for this Girth has not seen anything pure, I can see it is just wrong with some jar file?

Thank you for your advice!

These sounds are more like errors that have got yuicompressor in your .js file and its magic Unless the syntax errors are resolved. For example:

For example:

Go through the right-to-the-right comb with your .js file (or javascript editor that marks the syntax errors) and see if you have Can find the problem.

javascript - Get Json from asp.net errors -


& lt; स्क्रिप्ट & gt; ... डेटा: [
& lt;% = ser% & gt ;, 1 , 1, 1, 1, 1, 1] ... & lt; / script & gt;

पीछे कोड

  सूची & lt; int & gt; सूची = नई सूची & lt; int & gt; (); Ser = serializer.Serialize (सूची);   

चर सेवा 1 नंबर मैनुअल इनपुट की तरह काम नहीं कर रहा है, क्यों?

OUTPUT

  ser = "[0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, 26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49] ";    

अंतिम बार प्रयास करें

  [& lt;% = Ser% & gt;]   

कोड के अंदर

  ser = ser.Substring (1, ser.Length - 2);   

मदद के लिए धन्यवाद!

php - workaround for tinymce utf8 bug -


Background: I have a web site that uses tinnies to edit HTML non-breaking space and ; HTML entities like x22c4; Tinymce is converting to UTF-8 characters, even if I am using entity_encoding: "named" option. I store it in a MySQL table which is UTF-8 when the same HTML is retrieved for editing again, multi-byte characters are separated by tinxes in individual characters. Tinymce has verified that this is a bug.

The question is: how do I convert all multi-byte UTF-8 characters into HTML entities without breaking the HTML?

I tried to have the following in PHP, but multi-byte UTF-8 characters have been deleted:

  $ encoded_string = histimens ($ utf_string, ErikHTML5, UTF-8 ', incorrect); $ Html_ent_conv = htmlspecialchars_decode ($ encoded_string, ENT_COMPAT | ENT_HTML5);   

I also tried mb_encode_numericentity, but I could not figure out what should I use for the parametric parameter.

Update: I have PHP 5.3.17, which is not supported ENT_HTML5, so I removed it. Now it works for non-breaking space, but not for other multi-byte UTF-8 characters.

A few years ago, I went to the section of this code in PHP documentation: < Pre> function utf8_to_html ($ data) {back preg_replace ("/ ([\\ xC0 - \\ xF7] {1,1} [\\ x80 - \\ xBF] +) / E", '_tf8_to_html ( "\\ 1"), $ data); } Function _utf8_to_html ($ data) {$ ret = 0; Foreach ($ str =) ($ ($ data {0})% 252% 248% 240% 224% 192) + 128) Substr ($ data, 1)))) $ k = & gt; $ V) $ ret + = (ord ($ v)% 128) * Pau (64, $ k); Return "& # $ ret;";

java - how can i send information from broadcast receiver back to my main activity without restarting it -


  यदि (messages.length & gt; -1) {int अवधि = toast.LENGTH_SHORT; टोस्ट टोस्ट = टोस्ट। मेकटेक्स्ट (संदर्भ, "संदेश प्राप्त हुआ:" + संदेश [0] .गेट ऑरिजिटिंग अकादरी (), अवधि); toast.show (); स्ट्रिंग मूल्य = "संदेश प्राप्त हुआ:" + संदेश [0] .getOriginatingAddress ();   

मेरे कोड को एक एसएमएस मिलता है। मैं इसे अपने मुख्य गतिविधि पर वापस लेना चाहता हूं, लेकिन मैं उस इरादे का उपयोग करने और उस गतिविधि को पुनरारंभ (प्रसारण रिसीवर एक पृष्ठभूमि सेवा है और लोगों को इस दौरान ऐप का उपयोग करना होगा) का उपयोग करना चाहते हैं। गतिविधि (मेरे पास केवल एक मुख्य एक है)।

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

दूसरी ओर, यदि आप यह देखना चाहते हैं कि क्या प्रसारण को भेजा गया था गतिविधि अग्रभूमि में वापस आती है, भले ही गतिविधि पृष्ठभूमि में थी, फिर भी आप एक प्रसारण रिसीवर का उपयोग कर सकते हैं, लेकिन आप को जोड़ने की आवश्यकता है जिसे बाद में प्राप्त किया जा सकता है।

प्लस: इन का उपयोग करें संसाधनों को सहेजने का आदेश।

oauth - Does the User ID returned by https://www.googleapis.com/oauth2/v2/userinfo changes over time -


We want to use the returned user ID as a unique identifier in an application.

Does it change the user id over time? For example, if the email address changes (Google Apps for Business)

User ID is a stateless identifier It is not affected by the change of email address, so it should be used as a key (no email address).

c# - Finding the intersection of a line -


So I'm beating my head on this relatively simple algorithm. I'm not sure what's wrong with my code, I still can not find the point of intersection where they are actually intersecting.

I am using Unity 3D and I am trying to find the point where two rows give each other a holes, in X, z aircraft, though not in X, Y plane. I'm assuming that the algorithm that works for X, y should work for X, Z.;

My code:

  Vector3 thisPoint1 = thisCar.position + (2 * thisCar.); Vector 3 This Point 2 = The Carbatition + (20 * Corporation); Debug. Drone (this point 1, this page 2, color. White, 2); Vector 3 Other Point 1 = Threatened Carbation + (2 * Threatened Forward); Vector 3 Other Point 2 = Threatening Kirsh. + (20 * Threatening Cor.); Debug. Drainline (other page 1, other page 2, color. White, 2); Float A1 = thisPoint2.z - thisPoint1.z; Float b1 = this point 1.x - this point 2.x; Float C1 = A1 * thisPoint1.x + B1 * thisPoint1.z; Float A2 = other point 2.z - other point 1.z; Float b2 = other point 1.x - other point 2.x; Float C2 = A2 * other point 1.z + b2 * other point 1.z; Float date = A1 * b2 - a2 * b1; Float x = (b2 * c1 - b1 * c2) / et; Float z = (A1 * C2 - A2 * C1) / et; Return new vector 3 (x, this.Tansform.bizai.a., z);   

Is anyone telling me what I am doing wrong?

Thanks in advance

================================ =========================

This car Further and Threats CAR.forward usually [0,0,1], [0,0, -1] or [1,0,0], [-1,0,0]

You can clear the parents object in the game car and put it forward in front of it (in IDE or at the beginning ). In this way you can securely draw two points to draw a line.

java - Can I hide the file extensions in an SWT FileDialog filter? -


I have a SWT FileDialog (style: SWT.OPEN) with several filters with many file extensions I want to include a "all known format" filter with which the application recognizes. This list is very long and will not fit on the screen. On Mac, the File Dialog filter combo box gives the width of the broad filter string. Control is easily usable because the string is very extensive to fit on-screen and the text is centered so that you can not read the filter description in the beginning.

I can hide the file extension in the FileDialog filter combo box has been dragged on-screen but still connects the extension with the filter? Anyone have alternative suggestions?

Screenshot of problem

on Mac All known format filters  Available filters for files that are recognized by the app < P>

FileDialog requires that you provide a list of details and a list of extensions to define a set of filters. I ignored the fact that my code added a description and extension list to create a more descriptive label. It was at that time when the number of supported file types was small. The answer is to provide a situation where the extension list is not associated with "all known formats". It's embarrassing ...

Thank you for the people who answer.

c# - Kendo TabStrip: Passing the Parent Model to the ChildAction in MVC 4 -


मेरे पास MVC 4 में एक केंडो यूआई टैब पट्टी है:

  @model SearchUserModel @ (एचटीएमएल। केंडो ()। टैबस्ट्रिप () .नाम ("टैब मैने")। वस्तुओं (आइटम = & gt; {आइटम। जोड़ें ()। पाठ ("खोज") .सामग्री (HTML.एक्शन ("फ़ॉर्म", "खोजउज़र ("इंडेक्स", "प्रबंधन उपयोगकर्ता");}) .अनिमेशन (गलत))   

चाइल्डएक्शन "फॉर्म" उसी नियंत्रक "खोजउज़र" पर है जो कि माता-पिता के रूप में है।

प्रश्न: मैं माता-पिता के SearchUserModel को "फ़ॉर्म" / "खोजउज़र" चाइल्ड एक्शन से कैसे पारित कर सकता हूं?

आपको Html.Action () सहायक के मार्ग वाले पैरामीटर का उपयोग करके मॉडल को पास करने में सक्षम होना चाहिए:

  Html.Action ("फ़ॉर्म", "खोजउज़र", नया {मॉडल = मॉडल})   

तब आपको बस अपने नियंत्रक की कार्रवाई को संशोधित करने की आवश्यकता है मॉडल को एक पैरामीटर के रूप में स्वीकार करें:

  सार्वजनिक कार्यप्रणाली फ़ॉर्म (खोजउज़र मॉडल मॉडल) {}    

java - Algorithm need assistance -


I have some problems with the algorithm for my problem. I will try to explain to you the best I can. This is just an example.

Then say 3% people click on 3% link.

So I need an algorithm which will randomly expand one click on more than 1000 scenes.

It's easy to spread equally, eg: 1000 * .03 = 30, so every 30 ideas will click on a link.

Example:

 For  (i = 0; i    

  list & lt; Boolean & gt; WasClicked = new ArrayList & lt; Boolean & gt; (); (Int i = 0; i & lt; NUM_CLICKS * 0.03; i ++) {wasclicked.add (true); } (Int i = 0; i & lt; NUM_CLICKS * 0.97; i ++) {wasclicked.add (false)} collection. Shuffle (useless);   

You now have a random list of booleans, exactly 3% are true.

python - How to set color of text using xlwt -


I can not find a document about how to set the color of text. How will the following be done in axle vault?

  style = xlwt.XFStyle () #Bold font = xlwt.Font () font.bold = True style.font = font # Background color pattern = Xlwt.Pattern () pattern.pattern = Xlwt.Pattern.SOLID_PATTERN Pattern. Pattern_fore_colour = xlwt.Style.colour_map ['pale_blue'] style pattern = pattern # color color ???   

Another way I have tried, where I am able to set the font color, but not the background color:

  style = xlwt .easyxf ('font: bold1, color red;')    

This is the job :

  style = xlwt.easyxf ('Pattern: Pattern Solid, Edge Light_blue;' 'Font: Color White, Bold True;')    

jsp - Cookie sharing across application deployed on same server -


I have two applications that are outside the Stropes 1.3 frame and are positioned on Glassfish Server 3.1.2 < P> Your URL for app -1 http: localhost: 8080 / app-1

and

App-2's url for your URL: http: localhost: 8080 / app-2

Functionality: App-1 & amp; App-2 supports different languages ​​The user is logged in through App-1 and a cookie is setup for the selected language.

Later, there are many ARRs in app-2's AP-2. Href is more common, depending on the language selected on App-1, various pages are displayed after reaching AP-2.

The issue is that AP-2 is the language chosen in AP-1? How many cookies are set up in App-2 by App-To? Or is there any other option?

set the path attribute in the cookie / Servlet 3.0 application provides APIs to set cookie attributes when creating cookies.

If the path (the application reference root) is set, the cookies are sent only when the URL starts with that path by setting it to / Will be able to send cookies to all applications in the domain.

Java Doc: Setpath ......

Public Zero Setpath (java.lang.String uri)
That cookie Specifies the path to which the client should return the cookie on which the client should return the cookie.

The cookie is visible All pages in the directory that you specify and all pages in the subdirectory of that directory should include the servlet set to cook cookies in the path of the cookie, for example, / catalog, Which makes cookies visible on all the directories under the / catalog on the server.

Contact RFC 2109 More information about setting path names for cookies (available on the Internet).

parameter: uri - A string that specifies the path

sql server - SUM Function For 2 Tables Produces Wrong Value -


Using: SQL Server 2008 R2

To calculate one percent of the total, Then there is a problem when running a total query (SUM) on two different tables individually, it produces the right amount; When the query is included in both, it comes with a huge value, so I did not know where it came from. Code, plus code that I'm running to create another table.

  Make a selection from the top 100 field table in the table SUM (t1.Field), TableOne T1 from SUM (t2.Field), TableTwo T2   

Tablet two has been obtained from ten percent of TableOne (which you can see in the first part of the query above). Note that personally, they produce the correct value:

  from the SELECT SUM (t1.Field) table a t1 SELECT SUM (t2.Field) table with two T2   

Is SQL Server the top query above, or am I clarifying something here?

  to Tableon T1, tablet to T2   < P> is a cross join. TED will be linked to  every  record  every one  record, which passes the required records to 10x (if T1 has 10% of T2 records).   

How do I send file name with file using sockets in Java? -


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

  • 2 जवाब

    मेरे पास निम्न कोड है सॉकेट्स के माध्यम से फ़ाइल स्थानांतरण मैं सॉकेट सॉकेट = नया सॉकेट ("लोकलहोस्ट", पोर्ट); // मशीन का नाम, पोर्ट नंबर फ़ाइल फ़ाइल = नया फ़ाइल (फ़ाइलनाम);

      // लंबे लम्बाई फ़ाइल का आकार प्राप्त करें; file.length (); यदि (लंबाई & gt; पूर्णांक.एमएक्स_एवीएनए) {System.out.println ("फाइल बहुत बड़ी है।"); } बाइट [] बाइट्स = नया बाइट [(इंट) लंबाई]; FileInputStream fis = नया FileInputStream (फ़ाइल); BufferedInputStream bis = नया BufferedInputStream (fis); BufferedOutputStream आउट = नया BufferedOutputStream (socket.getOutputStream ()); पूर्णांक संख्या; जबकि ((count = bis.read (बाइट्स)) gt; 0) {out.write (बाइट्स, 0, गिनती); } Out.flush (); out.close (); fis.close (); bis.close (); socket.close ();    

    आप अपने सॉकेट के लिए अपने प्रोटोकॉल का आविष्कार कर सकते हैं। यदि आपको सभी की जरूरत है एक फ़ाइल नाम और डेटा है, तो DataOutputStream.writeUTF सबसे आसान है:

      BufferedOutputStream आउट = नया BufferedOutputStream (socket.getOutputStream ()); प्रयास करें (डेटाओटपुटस्ट्रीम डी = नया डेटाओटपुटस्ट्रीम (बाहर)) {d.writeUTF (fileName); Files.copy (file.toPath (), डी); }   

    सहकर्मी को एक ही प्रोटोकॉल का उपयोग करना चाहिए, निश्चित रूप से:

      BufferedInputStream में = नया BufferedInputStream (socket.getInputStream ()); कोशिश (DataInputStream d = नया DataInputStream (में)) {स्ट्रिंग फाइलनाम = डी.्रेडूट एफ (); Files.copy (डी, पथ .get (फ़ाइलनाम)); }    

How to remove a char from a string, and return a number from the new string - Javascript -


I have some functions that change a user input as a binary number in the form of a string. This is part of a basic 'assembler' program on which I am working. Here is my code:

  Function GenerNinBurnerNumber (InputWall) // only works for hash! {Var number; If (hash (input value) in it! = -1) {number = getNumberFromString (inputValue); } Return Decimal Tokyo (number); } Function hash (number) // functioning! {Var n = number.indexOf ('#'); Return n; } Function getNumberFromString (mixed input) // work! {Return (mixed input. Location ('#', '')); } Function Decimal Tutorial (Decimal) // Working! {Decimal = parsih (decimal); Return decimal Two string (2); } For example, if a user enters the value of '5', then the function returns NaN - although if they specify that # 5 works - 101 returns. I'm new to programming and javascript, if someone could point me in the right direction which would be great. Thanks!  

if any #

  function Generate BinaryNumber (inputValue) // only works for hash! {Var number; // if the number is not set (hash (input value) in it! = -1) {// the number is set here, but only if if statement is true number = getNumberFromString (inputValue); } // If, then hash was false, the number is undefined decimal decimal number (number); }   

You only want to say var number = inputValue when you declare it

As a side note, Your paraset does not look like a radius argument (something like parseInt (decimal, 10) ) otherwise it will input as hex digits such as "010" and it will Will parse incorrectly.

Cannot display XML in my JavaScript dropdown menu. Why is this not working? -


  & lt; script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7 .2 / jquery.min.js "प्रकार =" टेक्स्ट / जावास्क्रिप्ट "& gt; & lt; / स्क्रिप्ट & gt; & Lt; स्क्रिप्ट प्रकार = "टेक्स्ट / जावास्क्रिप्ट" & gt; $ (Document) .ready (function () {$ .ajax ({type: "GET", url: "XML / Website.xml", डेटाटाइप: "xml", सफलता: फ़ंक्शन (xml) {var arr = new Array (); $ (Xml) .find ("बोर्ड")। प्रत्येक (फ़ंक्शन () {var विकल्प = $ (यह) .फंड ('ब्रांड')। पाठ (); अगर ($ .inArray (विकल्प, arr) ऐडेंड ('& lt; विकल्प & gt;' + विकल्प + '& lt; / option & gt;'); arr.push (विकल्प);}} );}}};}); & Lt; / स्क्रिप्ट & gt; & LT; प्रपत्र & gt; & Lt; चुनें आईडी = "ड्रॉपडाउन" & gt; & LT; विकल्प & gt; & lt; / विकल्प & gt; & Lt; / चयन & gt; & Lt; / प्रपत्र & gt; & Lt; script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" प्रकार = "टेक्स्ट / जावास्क्रिप्ट" & gt; & lt; / स्क्रिप्ट & gt; & Lt; स्क्रिप्ट प्रकार = "टेक्स्ट / जावास्क्रिप्ट" & gt; $ (Document) .ready (function () {$ .ajax ({type: "GET", url: "XML / Website.xml", डेटाटाइप: "xml", सफलता: फ़ंक्शन (xml) {$ (xml)। पाठ (); var नाम = $ (यह) .फंड ('नाम')। पाठ () ; Var ब्रांड = $ (यह) .फंड ('आकार')। पाठ (); var ब्रांड = $ (यह) .फंड ('कैम्बर')। पाठ (); var मूल्य = $ (यह) .फिंड (' एपेंड ('& lt; tr & gt; & lt; td & gt; & lt; img width = "250px" src = "' + + + + +" /> & gt; & lt; / टीडी & gt; & lt; td & gt; '+ + नाम +' & lt; / td & gt; & lt; टीडी & gt; '+ ब्रांड +' & lt; / td & gt; & lt; टीडी & gt; '+ कीमत +' & lt; / td & gt; & lt; / tr & gt; );})}}}})}}; & Lt; / स्क्रिप्ट & gt; & Lt; तालिका आईडी = "तालिका" सीमा = "1" कोशिकाक्षेत्र = "5" सेलपैडिंग = "20" वर्ग = "केंद्र" & gt; & LT; टीआर & gt; & lt; टीडी & gt; & lt; / टीडी & gt; नाम & lt; / वें & gt; & lt; वें & gt; केम्बर & lt; / वें & gt; & lt; वें & gt; मूल्य & lt; / वें & gt; & lt; वें & gt; आकार & lt; / वें & gt; & lt; वें & gt करें & lt ; / टीआर & gt; & Lt; / तालिका & gt; & Lt; / body & gt; & Lt; / html & gt;   

मेरा एक्सएमएल डेटा पृष्ठ पर प्रदर्शित किया जा रहा है, लेकिन जब मैं ड्रॉप डाउन का इस्तेमाल करता हूं, तो यह चुनने के लिए कि मैं कौन-से विशिष्ट चयन करना चाहता हूं, यह कुछ भी बदलेगा नहीं। मुझे नहीं पता कि मैं क्या कर रहा हूं।

मेरा एक्सएमएल टैग सभी सही हैं, मैंने इसे सुनिश्चित कर लिया है।

आपके द्वारा पोस्ट किए गए कोड में, मुझे नहीं पता है कि जब आप ड्रॉप डाउन में कुछ चुनते हैं, तो आप इसे बदलने के लिए कहां करते हैं। आप इसे क्या करने की उम्मीद करते हैं? आपको ड्रॉप डाउन में एक बदलाव श्रोता जोड़ने की आवश्यकता होगी, और यह बताएं कि जब यह बदल जाएगा, तो ऐसा क्या होगा ...

  $ ("# ड्रॉपडाउन")। परिवर्तन (फ़ंक्शन () {// डॉप डाउन बदल जाने पर आप क्या करना चाहते हैं। // आप इस तरह ड्रॉप डाउन का पाठ प्राप्त कर सकते हैं ... var चयनित = $ ("# ड्रॉपडाउन विकल्प: चयनित")। पाठ ( );});   

इसके अलावा, एक साइड नोट के रूप में, अपने कोड को रिफैक्टर करने का प्रयास करें ताकि आप केवल एक बार AJAX कॉल कर सकें, और दोनों के लिए आउटपुट का उपयोग करें। ऐसा लगता है कि आपके समान सेवा के लिए दो बार उसी कॉलिंग को बुला रहे हैं जो बिना किसी कारण के अतिरिक्त कार्य है।

unicode - UnicodeDecodeError in SQLite -


I am trying to get a list of 2-element tuples and give them a SQLite table .

The first element of a tupal is a string (encoded in Unicode UTF-8 ) and the second element is a murmurhash3 hash utf -8 string

This violation line is: result

  self.dbc.primaryCursor.executemany ("Enter value in table" (?,?); Last_insert_rowid () select as lastowid ; ", ListOfTermsAndHashesTuples)   

Error UnicodeDecodeError : 'ASCI' codec can not decode byte 0xc3 in position 4 : In the serial no category (128).

What is the reason for this error?

Your input is very likely not in the valid UTF-8 format. On Linux and Mac, you can easily see your string by putting it in a file:

  iconv -f UTF-8 -t UTF-8 & lt; Your_filename_goes_here & gt;    

bash - How can I print out all lines of a file containing a specific String in unix -


I know how to print the line of the first occurrence of the string, but I'm not sure how to print Events have to do To print the first occurrence of my string I have used

  grep ", 1," my_course   

I think all events Something looks like print:

  while grep (the next line of the file), 1, "my_course   

I'm not sure how to To do this while loop though. How can I test if the file is the next line.

EDIT: Sorry, I think grep only matches the first event. When I ran away, it only corresponds to 1 line. I did not know that only 1 line matched

In addition to this, the bonus question is if someone wants to answer ... if all the lines in my file (Mycorsy) "number, name, Credit hours, grades ", how do I get all the grades in the file and store it in an array?

grep <

grep, egrep, fgrep - Print lines match a pattern

/ P>

python - Sub matrix of a list of lists (without numpy) -


Suppose I have a matrix from a list of lists:

  & gt; & Gt; & Gt; For category = [category (category (10)) (10)]> gt; & Gt; & Gt; Lol [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1] , 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4 , 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [ Let me assume that I have a narrow matrix of the same structure, which is  0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]   

Lola :

  & gt; & Gt; & Gt; Using a sample, I can get a submatrix of this matrix in such a way:  
  & gt; & Gt; & Gt; Lola [1: 4,2: 5] array ([[2, 3, 4], [2, 3, 4], [2, 3, 4]])   

I The pattern matrix can make the piece as pure Python:

  & gt; & Gt; & Gt; R = (1,4)> gt; & Gt; & Gt; S = (2,5)> gt; & Gt; & Gt; [L [L] [R] [R] [1]] [[2, 3, 4], [2, 3, 4], [2, 3, 4]]   < P> Which is not the easiest thing to read and is not the most efficient: -)  

Question: Is there an easy way to piece an arbitrary matrix (pure Python) in the form of pure matrix? "post-text" itemprop = "text">

 [7] [7]: [[2, 3, 4], [2, 3, 4], [2] 2]  list :  
  By defining the subclass of the square you can copy the syntax of NumPy:   

List (list): def __init __ (self, * args): list .__ init __ (auto, * args) def __getitem __ (self, items): try: return list .__ getitem __ (auto, item) Excluding TypeError: Rows, Cols = item row [row] [for rows] [row]] lol = LL (for category in the list (category (10)) (10)] Print (y G [1: 4, 2: 5])

also yield

  [[2, 3, 4], [2, 3, 4] , [2, 3, 4]]   

Lol will not win any speed test using the subclass: [85] In: [time] [row] [2: 5] [1: 4] for the line in the X 1000000 loops, the best 3: 538 in the NS loop [82]:% Timeit lol [1: 4, 2: 5] 100000 loops, the best 3 : 3.07 per loop per

But speed is not everything - Sometimes readability is even more important.

javascript - How to check if a property contains a property -


I should know if property is property or not, I just like the examples, if I < P> is an example object

  var foo = {"bar": {"foobar": {"barfoo": 1}}}   

and I have to check whether barfoo is present, but first I have to check that there are all other properties, because it can happen or not if any other function is running. I can not really reduce the level of this structure, so there is no alternative.

Currently I am doing something like this:

  var d = Foo; If (D) {d = d.bar; If (d) {d = d. Fobar; If (D) {d = d.barfoo; If (d) {console.log (d); More Strong Solution: Check  any type of object    

  var Foo = {"Bar": {"foobar": {"barfoo": {"ddd": 1}}}}; Function Checkpops (OBJ) {var ref = obj, arg, i; (I = 1; i & lt; arguments.length; i + = 1) {arg = argument for [i]; If (ref.hasOwnProperty (arg)) {ref = ref [arg]} and {return false; True} true; } // function takes the object to search the first parameter and any other properties [, prop1, prop2, ...] as console.log (checkProps (foo, 'bar', 'foobar', 'barfoo' , 'Ddd'));    

javascript - Create a setter that updates a dom element with the new value? -


Is there a way to create a setter that changes the property of any object when a DOM element updates it?

I do not believe this. Without making a setter, then x will hang a simple Jane property object, when there will be no change in knowing. Why do you want to avoid Setter? This is a very clear way to accomplish your goal.

But there is a small thing to keep in mind, object.definproperty , although more verbose is more supported, and win set and Get :

  a = {}; Object.defineProperty (a, 'x', {get: function}} set this return._x;} function: (newX) {this._x = newX; $ ("# my_element"). Html (newX); }});    

c# - CommandBinding in ContextMenu -


I have a tree view and I have created a basic tree eTem type. Each tree has headers in ITEM, a collection of toys for children and a collection of potential reference menus. There are those items in the Tryitum class:

  public representative zero dexactec (tree item); Public Dextech Execute target {receive; Set; } Public Object Tag {get; Set; } Public String Header {get; Set; } Public listing & lt; TreeItem & gt; Children {receive; Set; } Public listing & lt; TreeItem & gt; {Get Context Menu; Set; }   

Use the context menu again to display a hierarchical data template to display TreeItem objects (I use the TreeItem class for the items in the preview and in the context menu). The context menu looks like this:

  & lt; ContextMenu DataContext = "{Binding placement targets. Detacontekst, relative Sors = {relative Srs Self}}" visibility = "{Baining Socontekst menu}" items Source = "{Binding ContextMenu}" & gt; & Lt; ContextMenu.ItemTemplate & gt; & Lt; Hierarchical data items source = "{binding child}" & gt; & Lt; Text block text = "{binding header}" /> & Lt; HierarchicalDataTemplate.ItemContainerStyle & gt; & Lt; Style TargetType = "MenuItem" & gt; & Lt; Setter property = "command" value = "{binding execution}" /> & Lt; / Style & gt; & Lt; /HierarchicalDataTemplate.ItemContainerStyle> & Lt; / HierarchicalDataTemplate & gt; & Lt; /ContextMenu.ItemTemplate> & Lt; / ContextMenu & gt;   

is provided as a context menu because I want it to be. I have created a context menu which I attach to some of my objects in the tree view. This is its content

  public list & lt; TreeItem & gt; Contekstmenu ({list & lt; Tryaitm & gt; list = new List & lt; tree item & gt; (); Tree Itam TI = new Tryitm ( "some action") {ExecuteTarget = targetMethod}; list.Add (ti) ; t = new tree items ( "test"); Ti.Children.Add (new TreeItem ( "foo") {ExecuteTarget = targetMethod}); Ti.Children.Add (new TreeItem ( "bar") {ExecuteTarget = targetMethod} ); Ti.Children.Add (new TreeItem ( "foo") {ExecuteTarget = targetMethod}); Tryaitm TI 2 = new Tryitm ( "inner") {ExecuteTarget = targetMethod}; ti.Children.Add (ti2); Ti2. Children.Add (New TreeItem ("foo") {ExecuteTarget = targetMethod}); list.Add (ti); return list;}}   

The context menu looks like this.

context menu provided

It seems that it should be. I want to add something to XML, but I do not know where to go, when I click on "some action". is.

  & lt; ContextMenu DataContext = "{Binding placement targets. Detacontekst, relative source = {relative Srs Self}}" visibility "" {Binding Dikhaaacontekst menu} "Aitmssors =" {Binding context menu} "& gt; & LT; ContextMenu.ItemTemplate & gt ; & Lt; Pdanukrmitdeta item before source = "{binding Children}" & gt; & Lt; Tekstblok text = "{binding header}" / & gt; & LT; HierarchicalDataTemplate.ItemContainerStyle & gt; & Lt; TargetType style = " MenuItem "& gt; Setter Property =" Command "value =" {Binding Mr. execution} "/ & gt; & Lt; / style & gt; & LT; /HierarchicalDataTemplate.ItemContainerStyle> & Lt; / HierarchicalDataTemplate & gt; & LT; /ContextMenu.ItemTemplate> & Lt ;! - This is what you Sasa - & gt; & LT; ContextMenu.ItemContainerStyle & gt; & Lt; style TargetType = "MenuItem" & gt; & Lt; setter property = "command" value = "{binding performance}" / & gt; & Lt; / style & gt; & lt; /ContextMenu.ItemContainerStyle>); / ContextMenu & gt;    

Official Google Translate API v2 (Android) -


How do I use official Google Translate API v2 on Android? Please help! Any examples?

I paid for this service and I tried with that informal API and did not work. Examples of Java in that informal API are not an example in Java in the official API because RES (HTTP requests) uses and returns JSON. Is that complicated?

If you ask me how to get access to Google Translate API v2, This is a paid service and it can be purchased. Otherwise, if you want to use it, it means that the examples given on the same website are given in the "Getting Started" section

However, I think that you may be looking for.

map - Google Earth Pro Alternatives -


Is there alternative free application like Google Earth Pro? My main thing is that the shape files should be imported as a layer in the map.

Depending on you are exploring that. If you really want to see a file of size, then use a few things or Uddig.

If you want to see a road map or a size frame above the satellite base layer, I'm not sure there is something that will work out of the box for you. Open Street Map has data; Because of such a service, a limited area of ​​open street map data can be exported as a size file.

You want to familiarize this page with the Open Street Map Wiki:

linq - C# Removing Duplicates from a List Containing a List -


Say we have a list of "A student", and there is a list of "B Students". Then we add both lists to a more general list, which are called "students", then someone has decided to make our life complex by adding a duplicate list of "A student" to the generic "students" list. What is the most effective way to remove one of the "A student" duplicate lists? Note that this includes two custom classes.

The list of generic students in the code is called lstStudents. This is the list that I would like to remove from any duplicate.

(I tried to come up with a better example, but this is the best I can do now.)

I do not need to use LINQ, but it is available is. MoreLinq is also available.

Here are my classes:

  Students of public class {public student (string _name, int_ _age, exam_sticks) {name = _name; Age = _age; Last xx = _last xm; } The name of the public string {get; Set; } Public int age {get; Set; } The last examination of the public examination {received; Set; }} Public Class Exam {public exam (int _correct, int _possible) {true = _correct; Possible = _possible; } Receive the public int right {}; Set; } Received P {}; Set; }}   

Here's the code to create mess:

  list & lt; List & lt; Students & gt; & Gt; LstStudents = New list & lt; List & lt; Students & gt; & Gt; (); & Lt; Students & gt; LstAStudents = New list & lt; Students & gt; (); & Lt; Students & gt; LstDuplicateAStudents = New list & lt; Students & gt; (); & Lt; Students & gt; LstBStudents = New list & lt; Students & gt; (); // List some students lstAStudents.Add (new student ("Alex", 14, new exam (98,100)); LstAStudents.Add (new student ("Kim", 13, new exam (96, 100)); LstAStudents.Add (new student ("Brian", 14, new exam (9 2, 100))); LstStudents.Add (lstAStudents); // Create a duplicate list of a student lstDuplicateAStudents.Add (new student ("Alex", 14, new exam (98, 100))); LstDuplicateAStudents.Add (new student ("Kim", 13, new exam (96, 100)); LstDuplicateAStudents.Add (new student ("Brian", 14, new exam (9 2, 100))); LstStudents.Add (lstDuplicateAStudents); // Create a list of some B. students lstBStudents.Add (New Student ("John", 13, New Examination (88, 100)); LstBStudents.Add (New Student ("Jenny", 13, New Test (80, 100)); LstBStudents.Add (new student ("Jamie", 15, new exam (81, 100))); LstStudents.Add (lstBStudents);    

Use both of you for both student and Exam can : Public class student: iQquable & lt; Students & gt; {... Public Child Samata (Student Other) {Return Name == Other.name & amp; Age == other. And & amp; Amp; LastExam.Equals (other.lastExam); } Public override bool equivalent (object obj) {student student = obj as student; Return equal (student); } Public Override Int Hashcode () {Return Name. GatehashCode () ^ age.GetHashCode () ^ The last axem. GetHashCode (); }}

Examination :

  For public class exams: IEquatable & lt; Exam & gt; {... Public Bowl Equal (Examination) {Return Examination Correct == right & amp; exam. Possible == possible; } Public override bool equivalent (object obj) {exam exam = exam obj; Return equal (examination); } Public override intoshashcode () {returns correct. GetHashCode () ^ Possible. GetHashCode (); }}   

Then a custom IQualityComparer & lt; T & gt; list for & lt; Students & gt; :

  Public class student list compactor: iCuality Compterper & lt; List & lift; Students & gt; & Gt; {Public Bull Equals (List; Lit; Students; & gt; x, list & amp; lift; student & gt; y) {return x.OrderBy (a => a.name) .equenceEqual (y.OrderBy (b = & Gt; b.name)); } Public intoshashcode (list & lt; student & gt; obje) {return obj.Agregate (0, (current, t) => current ^ t.getHashCode ()); }}   

You can then distinct to get results:

  var results = lstStudents.Distinct (new StudentListComparer ());    

splitting values to a column with case statement in sql server -


The columns need help in the divider values. This is what I have achieved so far. When the future06 '% 418%' then (Books case when future06 '% 421%' then (Video) Other Schema.dbo.table1 False endings from / pre>

book and videos are under two main products, the future06 column, as the third column future06 Instead of being , I would like to do recordid with both books and video and product name . < / P>

Does the life see output:

  record id yield The name books of the name    

You were almost:

 Select  Select RecordID, ProductName, Books = case when future06 like '% 418%' then future 6 and null end, video = case when future '061' 421% '', then future In, the 06 schema ends with the Doubtable 1.    

android - Html(jquery) drag and drop not working in AndroidEmulator -


I'm a new Android. I created a project in HTML ... it's running completely whatever I need .. to run this HTML project in Android emulator..I do not know what the reason is ... design has come in Android emulator ... but drag and drop is not working in Android emulator only ..I want to run the PhoneGap HTML code..If you want Nte that Piels Tell Me .. Thanks in advance .. This is my HTML (jquery code)

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" & gt; & Lt; Title & gt; - By JSField demo scalery & lt; / Title & gt; & Lt; Script type = 'text / javascript' src = 'http: //code.jquery.com/jquery-1.4.4.min.js'> & Lt; / Script & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "/ css / normalize.css" & gt; & Lt; Script type = "text / javascript" src = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js" & gt; & Lt; / Script & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "/ css / result-light.css" & gt; & Lt; Style type = 'text / css' & gt; .ui- layout-center {width: 400px; Height: 300px; Limit: 1px solid black; } .ui-state-hover {background-color: # f9ffff; } & Lt; / Style & gt; & Lt; Script type = 'text / javascript' & gt; // !! [CDATA [$ (window) .load (function) {jQuery (function) {jQuery ("component"). Draggable ({// Use a supporting clone that adds to 'body', then a panel assistant '' Not included '': function () {back to jQuery (this) .clone () .appendo ('body'). CSS ({'zIndex': 5});}, cursor: 'move', prevention: Document "}); jQuery ('.ui-layout-center'). Dropspace ({activeClass: 'ui-state-hover', accept: 'component', drop: function (event, UI) (if (! Ui.draggable.hasClass ("left")) jQuery (this) .append (jQuery (ui.draggable) .clone () AddClass ("left ") .draggable ());}});}}}}); //]> gt; & lt; / script & gt; & lt; / head & gt; & lt; body & gt; & lt ; Div class = "component"> element 1  gt; div class = "element"> element 2  

Unfortunately, the jQuery UI does not work properly with the touch event. However, the jQuery UI has many plugins to enable touch, touch punch is one:

You should consider updating the jQuery version you are using ... v1.4.4 3 years Is old now

c++ - How to check if CD drive is open or closed in linux? -


I am creating an application for which it is necessary to know that the CD drive is open or closed.

Remove opens the CD drive, and checks how long it will take to open it (a small amount of time says that it is open, and long, Well ...), but I can not use this technique because the application actually opens the drive (and I do not want to reopen the drive, if it is closed, then I want to turn off the drive if it Is open).

How do I do this on Linux? I saw it is possible to do this under Windows (although it might be wrong), but I have not seen a way to do it on Linux.

If it is not possible to use this Linux API call, is it possible to implement this low-level function that can do this?

For example code to work, you should do it like this:

  #include & lt; Sys / ioctl.h & gt; #include & lt; Linux / cdrom.h & gt; Int results = ioctl (fd, cdROM_DRIVE_STATUS, CDSL_NONE); Switch (results) {Cases CDS_NO_INFO: ... break; Cases CDS_NO_DISC: ... break; Case CDSTTROPOAPO ... ... break; Case CDsIDiv_ONRADY: ... break; Cases CDS_DISC_OK: ... break; Default: / * Error * /}   

i.e. The result is returned as the ioctl () function result, not in the slot argument.

c# - Size of image increases after cropping -


I have the C # code to crop images.

When I crop the image (size: 191 KB, my C # code), the resulting result increases the image (dazzle) (size: 2.44 MB)

Please tell me That's why the size increases after the crop .. ???

  bitmap source = new bitmap (@ "F: \ images \", "+ +" kernel "+ + + j +" .jpg "); Rectangle section = new rectangle (new point (0, 0), new shape (1362, 761)); Bitmap croped image = crop image (source, section); Cropped image. Save (@ "File Path \" "+ i +" Colonel "+ j +" .jpg "); Public bitmap crop image (bitmap source, rectangle volume) {// An empty bitmap which will keep crop image bitmap BMP = new bitmap (section with section, height); Graphics G = Graphics. Frame Image (BMP); // Draw the given area (section) of the source image // at 0,0 on empty bitmap (BMP) g.DrawImage (source, 0, 0, article, GraphicsUnit.Pixel). Return BMP; Telepathic power: You are talking about the size of the file on the disk and are comparing the original compressed; File (potential JPG) with the saved version in non-compressed format (potential BMP)  

Correct: Save the baked image in compressed format.

2 arguments lets you specify the format i.e. in contrast to a logic version that you use in your sample).

Example from the article:

  // Create a bitmap from the button image processing. Bitmap BMP1 = new bitmap (typef (button), "button.bmp"); // Save image as a GIF Bmp1.Save ("c: \\ button.gif", system, drawing.imaging.imageformat.gif);    

regex - regular expression pattern in PHP -


Please help find the correct pattern of the following matter

There are simple strings: < Pre> pdf / 20120102 / A1_standard.pdf pdf / 20130431 / 1.pdf pdf / 20110506 / abcde.pdf pdf / 20131201 / fff-01/02/12 / -A1.pdf

For the object I need to match A1standard PDF, 1. PDF, ABCDDPDF, FFF-01/02/12 / -a PDF. I /// *. Pdf / as pattern but this is not working, case 4 is more difficult because file name has '/', if it can not be left now, then incorporate this case. Thank you.

Try this:

  $ str = 'pdf / 20120102 / A1_standard.pdf '; Preg_match ('? / (P & lt; file & gt;; w [\ -] \ pdf) $ /', $ str, match $); Echo "& lt; east & gt;"; Print_r ($ match); Echo $ match ['file'];    

c# . MySql. "INSERT". error -


अनुरोध निष्पादित नहीं किया गया है:

  mycmd = new MySqlCommand (); Mycmd.CommandText = "उपयोगकर्ता नाम, यूज़रनेम, पासवर्ड, आईपैड, पोर्ट, चैनल, इनबॉक्स, इनबॉक्सएडम, ऐक्सेस, अन्य) मूल्यों (शून्य, 'उपयोगकर्ता नाम 2', 'पासवर्ड 2', नल, शून्य, 'चैनल 2' , नाउल, नल, 'एक्सेस2', नल); "; Mycmd.Connection = mconnection; Mycmd.Parameters.AddWithValue ("username2", message.Login); Mycmd.Parameters.AddWithValue ("password2", message.Password); Mycmd.Parameters.AddWithValue ("channel2", "चैनल"); Mycmd.Parameters.AddWithValue ("access2", 0); Mycmd.CommandType = CommandType.Text; mycmd.ExecuteNonQuery ();            

`उपयोगकर्ता` (` उपयोगकर्ता आईडी`, `उपयोगकर्ता नाम`,` पासवर्ड`, `आईपीडीआर`,` पोर्ट`, `चैनल`,` इनबॉक्स`, `इनबॉक्सएडीएम`,` पहुंच`, `अन्य`) मूल्य (शून्य, 'मैक ',' मायपास ', शून्य, शून्य,' प्रशासक वाई ', नल, नल,' 9 ', नल);

ठीक से बल्ले से, मुझे विश्वास है

  INSERT INTRO उपयोगकर्ता '  

होना चाहिए

  उपयोगकर्ता में प्रवेश करें    

c# - Is Azure TableStorageMembershipProvider really suitable to handle millions of users? -


Background - I understand so far - Since all the membership data will be in the same division, this may be the reason for the table for a long time.

Currently, I only register the user in my system based on e-mail and password. I also have a user table on the Azure SQL, and I have the obligation between the two at the application level. The "foreign key" is the e-mail address.

URIID / Key is not emailed for the search of users using a subscription provider

Next to the homepage, it is necessary to certify another site, so I hope the use of membership will be important, but not too big, because after the authentication the user is cached for a few minutes. / P>

Do you think membership-based table-storage is usually a good practice for millions of users?

What specific issues would you recommend to me?

Subscription provider is a 2005.net 2 residue that should be kept out of their misery There is no room in modern web architecture The application should work with claim-based authentication and offload the identity in the service which is more capable.

If you are serious about being able to scale millions of users, then you feel that really tough about identity ??? Because it is important to use a membership provider, you can paint in the corner of an architecture that is at odds with your ambitions.

floating - How do I get a float value when dividing two integers? (PHP) -


Hi, I am trying to divide two integers: 12/13 but I do not always get a full number 1 decimal number.

I have tried to cast values ​​to float before hand with success.

Actually I want to have decimal decimal result like: 0.923 ...

  $ x = 12; $ Y = 13; Echo $ value = $ x / $ y; // 0.923 no 1    

  resonance $ value = $ would like to see x / (Float) $ y;   

If you float the variable $ y , then the interpreter should use the floating point division instead of the integer division.

Because it is the default espionation to use the integer division on two integer variables.

If you used $ y = 13.0 (a float variable as a divisor) then it was different: the result is always a float number < / Div>

java - The this keyword in classes -


I am learning Java, and going through the document.

There is a line I am not able to understand -

... In addition, class methods can not use this keyword because of mentioning it There is no frequency for. ...

I thought it was only static class methods that could not use the this keyword.

To test this, I writes the following, which compiles. import java.math. *; Square point {public int x, y; Public point (int x, int y) {this.x = x; this. Y = y; } Public double getDistanceFromOrigin () {math.Sqrt back (this.x * this.x + this.y * this.y); }}

I have a class correct, in which a method refers to this .

Am I doing things wrong in some way?

Stabilized methods of class are A "class method" is a method that is class oriented (using the static keyword), in contrast to the object / example methods that you write, so that you can call those items You build on the basis of that class.

There are two object / instance methods in the code that you write, and there are no class methods. If you want a class method in Java, you make it static, and then you This .

c - When is it necessary to allocate dynamic memory using malloc on pointers? -


I'm having difficulty understanding the malloc () function in C, more accurately when using it

When I declare a global structure like this indicator,

  struct position * currentPositionPtr;   

Do I need to use dynamic malloc to start using malloc? Or is it a good practice to allocate it to an indicator of the structure later, such as when it is necessary

  current PositionPtr = getPosition ();   

Where getPosition () returns an indicator on "indicator status".

What does getPosition () ?

If it returns a valid indicator for the struct state , then surely you do not need to assign memory to twice the structure. I hope your no look like this:

  struct status * getPosition () {struct position p = {x, y}; Return and p; }   

Because it will display undefined behavior (by returning a pointer to a block scope automated object) Generally, you instead of already malloc () Returns the pointer on the screen:

  struct position * getPosition () {struct position * p = malloc (sizeof (* P)); P-> x = 42; P-> Y = 1337; Return p; }   

Then, then you do not need to call additional at malloc () .

If, however, this is not a function to be said which is responsible for allocation, then, well ... it is a collar:

  zero getPosition ( Struct position * p) {p-> gt; X = 42; P-> Y = 1337; }   

And in the latter case you have to call it this way:

  struct position * p = malloc (sizeof (* p)) ; GetPosition (P);   

If the function returns you need your structure to survive, or

  struct position p; GetPosition (& amp; P);   

If you do not.

javascript - Efficient way to convert units from one system to another -


I have to face a difficult time so that different types of units can be converged to different types.

Switch cases will work, but IMO is not in an effective manner. I have 3 different systems (SI, Imperial and US).

My converter (inside my app) will always be converted from SI to some or some of the SI, it's like less complexity, but still I still have advice on how to make a clean code.

I had defined that my input parameter for the conversion would be the value (the number) and the unit (string).
I will have 2 functions

The unit is defined because I am changing the length, weight, quantity etc.

What would you suggest?

/ P>

How about:

  Var converter = {'SEMO': function (val) {// implementation, some return}, 'kilogram': function (val) {// execution, make some return} //, etc.}}, 'Cetus': {'cm': function (val) {// implementation, some return}, 'kg': function (val) {// execution, return something} //, etc.}, 'USToSI': { 'Cm': function (val) {/ * ... * /} // etc}, etc} SIToSomething (value, unit, system) {return converters ["Sito" + system] [unit] (value ); } Var meter inmapial = sitosome (100, 'cm', 'imperial'); Var panna kilkoscience = sitosoming (50, 'kg', 'US');    

Q. Is there a way to create Foursquare user account via Foursquare API? -


I am creating a mobile app that requires creating a foursquare user account from the app's registration page. Is this option in the square API?

Your response is appreciated. Not in the form of

And this is very unlikely it will be added someday.

Read the document:

.htaccess - Rewriting Subdomains to Subdirectory without redirection -


मुझे आभासी उपडोमेन बनाना है:

  user1.domain.com/anythging & gt; ; & gt;  

RewriteBase / RewriteCond% {HTTP_HOST} ^ (। *) \। डोमेन \ .com। * $ [एनसी] पुनर्लेखन नियम ^ (। *) $ Http://domain.com/users/%1/$1 [पी, एल, नेकां, क्यूएसए]

लेकिन जब मैं उपयोग करता हूँ: DirectorySlash off मैं फिर से लिख सकता हूँ: user1.domain.com/anythging/ & gt; & gt; Domain.com/users/user1/anything

स्लैश के साथ (/) अंत में (anythging /), लेकिन यह

  user1.domain.com/anythging & gt; & gt; त्रुटि 403: निषिद्ध आपके पास इस सर्वर पर / users / user1 / anythging तक पहुंचने की अनुमति नहीं है। दूसरे मामले में, जब मैं उपयोग करता हूं:  
  डायरेक्टरी स्लैश ऑन   

यह:

पूर्व> user1.domain.com/anythging & gt; & gt; रीडायरेक्ट्स & gt; & gt;

कोई भी विचार कहां समस्या है?

/ Div>

सुनिश्चित नहीं है कि क्यों निर्देशिका स्लैश आपके लिए काम नहीं कर रहा है, लेकिन आपको इसकी आवश्यकता बिल्कुल नहीं है आप जो चाहते हैं वह प्राप्त करें यह .htaccess भी काम करेगा मैं मान रहा हूँ कि यदि कोई गिरावट की जा रही है तो कोई भी अनुगामी स्लैश चाहते हैं।

  RewriteBase / RewriteCond% {HTTP_HOST} ^ (। *) \। डोमेन \ .com $ [NC] RewriteRule ^ (। *?) /? $ Http://domain.com/users/%1/$1 [एल]   

इसके अलावा, प्रॉक्सी की कोई ज़रूरत नहीं है [P] , क्वेरी स्ट्रिंग append [QSA] (यह डिफ़ॉल्ट रूप से चालू है) और कोई भी मामला नहीं [NC] (क्योंकि, पुन: लिखना regex में केवल वाइल्डकार्ड शामिल हैं)। < / P>

If the client and server use the same certificate file for a secure connection over SSL? -


I am tring to figure out whether a secure connection is established between the client and the server. I Promotion: Tried the SSL example provided by the ASIO Library. My question is about the certificate used by the client and the server, to be specific, I generated a private key (mykey.pem). Then I used this private key to generate a signed certificate (mycert.pem) and I followed these files:

server side:

1) Context_.use_certificate_chain_file ("Mycert.pem", error);

context_.use_private_key_file ("mykey.pem", boost :: asio :: ssl :: context :: pem, error);

context_.use_tmp_dh_file ("DHPARMAPM", error);

Consumer Points:

2) ctx.load_verify_file ("mycert.pem", error);

Handshake is done with this code completely. My question is how do both servers and customers use the same certificate ("mycert.pem") in commands 1 and 2? With this approach a customer can easily pretend to be a server. Right? Do you think I missed something here?

The certificate is public information.

This is a private key that allows the entity to prove its identity, guaranteed by the client's SSL / TLS handshake that the server certificate contains the private key corresponding to the public key, along with the other master May be with the appropriate master secret, to be able to understand communication. This problem shows that the remote party is actually the one on which the certificate was issued. (This is like checking that the picture on the photo ID matches the person in front of you.)

The certificate of the client (and not the private key) tells you which certificate you have The problem is whether or not the certificate trusts (specifically what it says about the identity of the server). It is usually done using a PKI, so that the trust can be built through 3 parties (CA). (It's like checking that the photo ID is actually real, and it can trust you what it says.)

What you did by believing this specific server certificate is CA To bypass is an exception and indicates that you were willing to rely on this particular certificate to be real. (This is somewhat okay for certificates, but by using the CA your confidence structure can be more manageable and can add other features, such as the ability to cancel the certificate.)

Block elements take full width when text wraps on to two lines -


I am basically only curious about this because I see it all the time and any person told me to know There is a solution that does not happen.

Usually when I see it for a fancy-looking button around it and displays block or inline blocks.

The issue is: Say you have a button inside the divas that have a specific width, say 160px, and you have inside the display blocks or inline-blocked, if inside the cante Let's fit the text on one line, it wraps on two according to your expectation, but now it is on two rows, now it does not need to take the full width of the div, but it does! I do not really believe that this happens, but I was wondering if anyone knew about CSS or even JS solution that resolves this?

  

What works for you? & lt; Div style = "width: 160px; padding: 10px; background: blue;" & Gt; & Lt; A href = "#" style = "background: red; display: table; width: 1%" & gt; A long-range test & lt; / A & gt; & Lt; / Div & gt; & Lt; Span style = "padding-left: 130px" & gt; ^ Where the element & lt; / Span & gt;

ruby - Validate Rails model just when some method is called -


किसी कारण से मुझे इस मान्यता को चलाने की आवश्यकता है

  validates_presence_of: user_id   

जब कुछ विधि कहा जाता है

  def # प्रकाशित करें यह विधि सहेज नहीं जाती है और न ही रिकॉर्ड को अपडेट करता है # तो सत्यापन चल नहीं रहे हैं ... अंत  < / Pre> 

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

  # मॉडल validates_presence_of: user_id, if:: go_to_publish attr_accessor: go_to_publish # पोस्ट को प्रकाशित करते समय post.going_to_publish = true post.publish   

क्या उस फ्लैग वेरिएबल को निकालने का कोई तरीका है?

मैं डॉन

यदि आप कोई पोस्ट प्रकाशित करते हैं, तो पोस्ट ओजज को लगातार होना चाहिए। तो प्रकाशित करें विधि को बनाने / सेव विधि को अंदर कॉल करना होगा।

यदि ऐसी विधियां बुलाती हैं, तो सत्यापन नियम होंगे के रूप में भी जाना जाता है।

जोड़

सत्यापन भी के लिए अद्यतन के लिए काम करता है

एक नया रिकॉर्ड बनाना और सहेजना होगा एक एसक्यूएल INSERT ऑपरेशन डेटाबेस के लिए मौजूदा रिकॉर्ड को अपडेट करना इसके बजाय एक SQL UPDATE कार्रवाई भेज देगा। इन आदेश डेटाबेस से पहले भेजे जाने से पहले मान्यताओं को आमतौर पर चलाया जाता है। यदि कोई मान्यताओं असफल हों तो ऑब्जेक्ट को अमान्य और सक्रिय रिकॉर्ड के रूप में चिह्नित किया जाएगा INSERT या UPDATE ऑपरेशन निष्पादित नहीं करेगा।



java - Is setting a hashmap thread safe? -


I have a hampp in my program that is accessed by several threads, and sometimes set by a thread .

For example: Maps & lt; String, string & gt; MyMap = New Hashmop & lt; String, string & gt; ();

This is accessed by several threads. Once an hour, call a thread:

  myMap = myRefreshedVersionOfTheMap;   

So my question is whether this thread is safe or not. If both the map is always the key "important key" , then what is possible is that once the "important key" is not present for the reading thread, the map Can access?

Edit:

Thanks for the reply, I have realized that it is actually free from the Hashmap. This object had more questions about reference assignments.

This thread is not secure even after the point of publication no letter is written for the map (From publication of thread publication), and reference assignment is atomic, new map & lt; & Gt; is not safely published This specially, there you write on the map during your construction - either in the constructor or after, how do you add those elements , And what they write can be seen or not by other threads, even if they are intuitively before the maps are published on other threads, it is not formally according to the memory model. .

To safely publish an object, it should be communicated to the outside world using a mechanism, that is, before relations between object creation, reference publication and context , Or to install it, or use some narrow methods that are guaranteed to be secure for publication:

  • An object from a constant initiator Start the reference.
  • Store a reference in this last field.

    If you have declared my map instability then be safe, more information about secure publication (highly recommended), or on this topic can be found. .

processing - ProcessingJS fails to draw images produced by PImage.get -


Here are some code that works great in Java and Android mode but does not work in Javascript mode. It uses PImage.get to remove a new PImage in the sub-region of the original image. I can attract the original image and any sub images in java and android mode, but javascript mode drawing fails all the image. Here's a very basic demo of the problem, replace your own image file or just download a zip of sketch.

  // Announce two images PImage fullImage, subImage; Zero setup () {size (640, 480); // Load an image from a file Full image = Load image ("smurf_sprite.png"); // Load a new image to the upper left queue of the original image in all image = full image (0, 0, full image. Width / 4, full image .hit / 4); } Zero draw () {background (0); ImageMode (middle); // Drag the entire image into the background image (full image, width / 2, height / 2); // Draw the sub image where the mouse is the image (all the image, mousex, mousse); } I tried to keep it simple I know if you know how it works for JavaScript mode  

Thank you,

~ Chuck

I realize It is necessary that ProcessingJS.org has different content in their context than the .org.If you can see, then you can see that you have to include it as a command:

  / * @ Pjs preload = "yourimagename.jog, yourimagename2.png"; * /   

so that the images can be preloaded. In my case, I believe I Image sub-rules before loading pixels Ratilipi was made.

c# - It's possible signalR client web to connect a server on a different PC? -


I have a console application that is a signal server on my PC.

I have html that is the signal r client on the internet but I try to connect to the server but I have a bad request 400 error. If the server is down, then I have another reponse.

Is it possible to signal signal clients to connect to a server on PC?

(Sorry for my English)

My page

  & lt; Input type = "text" id = "msg" value = "" /> & Lt; Input type = "button" id = "send" value = "send" /> & Lt; Ul id = "message" & gt; & Lt; / Ul & gt; & Lt; Script src = "scripts / jquery-1.6.4.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "scripts / jquery.signalR-1.1.2.min.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Open the connection to $ (function () {jQuery.support.cors = true; // remote connection var connection = $ .hubConnection ('http: // MyIpAddress: 8080'); var chat = connection.createHubProxy ('chat' '' Chat ', function (message) {$ (' # message '). APPEND ('   

My server code

  using Microsoft.Owin.Hosting; Using the system; Using System.IO; Using System.Net; Using System.Net.Sockets; // install-package Microsoft.Owin.Hosting -pre // install-package Microsoft.Owin.Host.HttpListener-former namespace test server (class program) {static zero main (string [] args) {LocalIPAddress (); String url = "http: // localhost: 8080"; (WebApplication.Start & lt; startup & gt; (url)) using {Console.WriteLine ("Server is running {0}", url); Console.ReadLine (); }}}}   

startup.cs

  using Microsoft.AspNet.SignalR; Use of ovine; Namespace Tester {public class startup {// This method is named Important Public Zero Configuration (IAppBuilder App) {var config = new HubConfiguration {EnableCrossDomain = true}; App.MapHubs (config); }}}   

chat.cs

  using Microsoft.AspNet.SignalR; Using the system; System usage threading. Task; Namespace Test Server Hobbs {Public class chat: hub {public override work on connect () {console. Videoline ("On-Connected" + Connection ID); Return basis.onconnect (); } Send Public Zero (String Message) {Console.WriteLine (string.Format ("Get: {0} by {0}", Message, Context.ConnectionId); Clients.All.send (message); What is this as the first line in your JS initial form:    

$ Connection.hub.url = "Your URL";

jquery - Lazy Load Collection Images in Shopify -


I'm trying to load lazy, as seen here:

< / P>

Password: iclabe

So far I did the following:

1.) In my header it is called jquery.lazy.js

2.) Edit the loop HTML of my product, adding the placeholder URL and the "lazy" class to the source attribute, by changing the tag to include the data-basic attribute.

3.) Added script before closing body tags.

The browser is loading only the placeholder images

Any ideas why?

The example of a shopify store with sluggish load has been implemented properly here:

You have a mistake '}' on line 1427. You can see it using your browser's error console. You can also check to make sure your markup is good.

.Net 4.0 C# When loading SHA256 key SignatureAlgorithm changes to SHA1 -


I am struggling together this week and hope someone can help me. I need to sign the XML using i SHA256 and xmldsig for that I use the SignedXML class. When viewed in this class, I see the signature of the loaded key to use which type of loading it uses the algorithm value.

No matter how I load the key (through loading the certificate store) show SHA1 as SignatureAlgorithm when I see the details of my certificate in the MMC certificate It shows SHA256 as signature algorithm.

I tried both opensl and makecart to create a SHA256 certificate key, but both will load as SHA1. Net and hence signXml.ComputeSignature (); SHA1 as a SignatureMethod

Does Net 4.0 require correct support for SHA256?

It was revealed that I was probably using the wrong class.

Instead of using Microsoft.Web.Services.Security.SignedXml System.Security.Cryptography.Xml.SignedXML does not use the SignatureAlgorithm key used to determine whether the key Use algorithms. Now I can set myself algorithm with 'SignedXml.SignedInfo.SignatureMethod' and use a SHA1 key.

javascript - Ember.js computed property with ArrayController -


I have an Ember.js ArrayController which is with people's models. I am trying to create a calculated property I am creating an average weight of people, it seems that it should be quite easy, but I am stuck. Here's my code.

  App People Controller = Amber Array Controller Extension ({// "weight" property in the array in each model is average: function () {// I do not know what to do here} .property ('@ each. Weight')});   

Handlab code. {{each controller}} {{name}} {{each}} average weight: {{weight}}

Understand that for some reason you need to access the model data within the calculated property to use 'every content to' '.

  averageview: function (val) {var weight = this.get ('content. @ Every.weight') toArray (); // This is the important part! Weight. ForEach (function (val)) {// calc average here} return average; } .property ('@ each.weight')    

php - AJAX chat - Personal alerts for users (commands) -


So I have an Ajax chat that I am programming, and a command system for it.

Actually, I want the system to warn a user if he does not use any command, and is only posting slash ('/'), and it only Be seen by user as seen who posted it. > But I'm not sure how this works. This is my load message method, in chat:

  Public function loads ($ username) {$ this-> fetch = $ this- & gt; Pdo- & gt; Ready (Date, time ASC limit 30 by "SELECT * messages"); $ This- & gt; Fetch- & gt; Executed (); While receiving ($ line = $ this- & amp; fetch- & gt; (PDF :: FETCH_ASSOC)) {if ($ line [isAlert '] ==' 1 ') {echo'   

If you can see in the statement for the first time, see if the message was a global warning, if so, then paint it in red < / P>

But how can I create a message that will only be able to see the alert user?

Any thoughts?

Keep div hidden on the page, then javascript Check whether to use for example:

  & lt; Div id = "invalidChatCommand" style = "display: command is valid, if  div  none" & gt; & Lt; P & gt; The order you entered is invalid & lt; / P & gt; & Lt; Div & gt; & Lt; Script type = "text / javascript" & gt; Var chatCommand = document.getElementById ("command"). Values; If (chatCommand.length == 1and chat command. Substring (0, 1) == "/") {// Invalid input detected, div var invalidCommand = document.getElementById ("invalidChatCommand"); InvalidCommand.style.display = "block"; } And {// send commands to server} & lt; / Script & gt;