Thursday 15 April 2010

c# - WCF Service, how to get the web site URL from within a class library? -


I have a WCF service running in IIS, which functions in a class library where httpContext is available. How can I get a web site URL dynamically, it can also be a virtual directory?

You can create a ServiceHostFactory that launches your service host manually, then your application Here is a simple example:

(in your myService.svc):

  & lt;% @, store the endpoint address in a static category used by Servicehost service = "MyNamespace.MyService" factory = "MyNamespace.MyServiceHostFactory" & gt%;  

(in your MyServiceHostFactory.cs):

  /// & lt; Summary & gt; Increases ServiceHostFactory to allow access to /// ServiceHostFactory. /// & lt; / Summary & gt; Public category MyServiceHostFactory: ServiceHostFactory {/// & lt; Summary & gt; /// Creates a new ServiceHost using the specified service and base address /// & lt; / Summary & gt; /// & lt; Param name = "service type" & gt; & Lt; / Param & gt; /// & lt; Param name = "baseAddresses" & gt; & Lt; / Param & gt; /// & lt; Returns & gt; & Lt; / Returns & gt; Protected Override ServiceHost CreateServiceHost (Type Service Type, URI [] baseAddresses) {ServiceHost host; Host = new service host (service type, baseadress); MyGlobalStaticClass.Address = baseAddresses [0]; // Assume that you want to know the endpoint first; return host; }  

(in your MyGlobalStaticClass.cs):

  public static string address = "";  

compilation - Error in compiling a Linux kernel -


आप त्रुटियों को कैसे पढ़ते हैं?

/ Home / aal / build / kernel पर config -file।

  /usr/src/linux-2.6$ हे बनाम ओ / होम / एलाल / बिल्ड / कर्नल /   

मुझे मिल

  ... cut ... सीसी [एम] ड्राइवर / मंच / go7007 / s2250-board.o /usr/src/linux-2.6/drivers/ मचान / go7007 / s2250-board.c: 24: 26: त्रुटि: s2250-loader.h: ऐसा कोई फ़ाइल या निर्देशिका /usr/src/linux-2.6/drivers/staging/go7007/s2250-board.c: फ़ंक्शन में 'Read_reg_fp': /usr/src/linux-2.6/drivers/staging/go7007/s2250-board.c:264: चेतावनी: असंगत सूचक प्रकार /usr/src/linux-2.6/include से 'down_interruptible' का तर्क 1 पास करना /linux/semaphore.h43: नोट: अपेक्षित 'स्ट्रक्चर सिक्वॉर *' पर तर्क तर्क प्रकार का है जो 'स्ट्रेट म्यूट x *' /usr/src/linux-2.6/drivers/staging/go7007/s2250-board.cailand73: चेतावनी: असंगत सूचक प्रकार से 'अप' का तर्क 1 पास करना /usr/src/linux-2.6/include/linux/semaphore.h:47: n Ote: अपेक्षित 'स्ट्रक्चर सिक्वॉर *' लेकिन तर्क 'प्रकार' स्ट्रेट म्यूट x * /usr/src/linux-2.6/drivers/staging/go7007/s2250-board.c की है: फ़ंक्शन के '2250_इनिट ': / usr / src / Linux-2.6 / drivers / staging / go7007 / s2250-board.c: 670: त्रुटि: फ़ंक्शन '2250 लोडर_इनिट' /usr/src/linux-2.6/drivers/staging/go7007/s2250-board.c:676 के अंतर्निहित घोषणा: त्रुटि: फ़ंक्शन '2250 लोडर_क्लानुप' के गर्वित घोषणा: '[4]: *** [ड्राइवरों / स्टेजिंग / go7007 / s2250-board.o] त्रुटि 1 बनाओ [3]: *** [ड्रायवर / स्टेजिंग / go7007] त्रुटि 2 मेक [2]: *** [ड्राइवर / मंच] त्रुटि 2 बना [1]: *** [ड्राइवर] त्रुटि 2 बनाते हैं: *** [सब-मेक] त्रुटि 2  

अपने .config से उस ड्रायवर के संदर्भ को निकालें और समस्या दूर हो जाएगी। वैकल्पिक रूप से यदि आपको ड्रायवर को स्रोत के लिए उपयुक्त चाहिए।

ये सभी त्रुटियां गायब हैंडर के कारण होती हैं।


DB Operations in asp.net with c# -


I have a question from an interviewer:

If two users open the same page, then One person is adding 105 records and one person is removing the same record, what happens in this scenario?

How do I answer?

This is a bit strange, because records have not been destroyed yet, if it was reached together anybody Also, I'm sure they are seeing constitutionalism, and possibly probably.

Take a look, it is showing how to apply optimist conductor with ASP.NET.


JQuery Navigation Menu Animation with Wordpress Page List -


So I'm using Jquery to display a pop up menu on my existing site. HTML is a WordPress wp_list_pages output for all your kind WordPress types. For all your non-wordpress types, this means that WordPress nested ul & amp; According to the architecture on the page below the line elements, I want the Java code to be compatible with WordPress, so if I change the pages, the code handles it.

I think the code should be light, but there is a bit below Junky. Any better ideas? Also, I see the pop-up menu only on the UL element for 1000ms (1s), but not otherwise. idea?

  jquery (document) .ready (function () {jQuery.fn.pauseit = function} {jQuery (this). Value ({dummy: 1}, duration); return it ;};}); JQuery (document) .ready (function () {jQuery ("div # access li.page_item ul"). CSS ({display: "none"}); // Opera Fix jQuery ("div # access li.page_item") Fade (':' 'none').) Fadeine ('fast');}, function () {jQuery (this) .find ('ul: first'). CSS Feeds ('sharp');});});  

So I searched hoverIntent that resolved my problem.


javascript - Using onComplete Event and Pages.xml -


I have a "a4j: commandButton" which runs some JavaScript on . " Event A " Action " is also calling a method.

    

I am using pages.xml in the seam to change a different page when that method is called.

  & lt; pageview-id = "/ web pages / page1.XML"> gt; Navigation from-action = "# {Bean. Method ()} "& gt; See redirecter- id =" / webpage / page 2.xml "/>   

Problem:

In order to call me when page 2 is loaded, the complete method should call "thisJavaFunction ()". However, because it is a separate page, but not a complete event.

I can use an open event in the body of page 2, but I can not use it because the page 2 uses the template which uses other pages (Like page 1), this means that when other pages are called from an on-loading event, it is called.

Is there a way to get around this ?


python - Can I combine two 'findAll' search blocks in beautifulsoup, into one? -


Can I combine these two blocks into one:

EDIT: Loops like Yacoby No other method was in response to the combination of. Soup.find all (['script', 'form'] for tags in

  tag: tag.extract () for tag in soup.find all (id = "footer") : Tag.extract ()  

In addition to this, I can do several blocks from one:

soup.findle (id = "footer" ): Tags for tags in Soup.findAll (id = "content"). Extract (): tags for tags in soup.find all (id = "links") .extract (): tag.extract () < / Code>

or there may be some lambda expressions, where I can check in the array or in some other simpler method

In addition to how can I get the tag with the attribute class, as is the class reserved keyword:

Edit: This part is solved by soup. Attrs = {'class': 'noprint'}):

  for tag in soup.findAll (class = "noprint"): tag. Extract ()  

Yo You [

I have an XML that contains the 'interface' sub tag, IAM converted to XML to use the sample XMLDiCoder do. The compiler did not allow me to reach the value of the trustobject's trusted 'Antifex'.

  var xml: XML = event.result as XML; Var xmlDoc: XMLDocument = New XMLDocument (xml.toString ()); Verde decoder: Simple XML code = new simple XML code (true) var result object: object = decoder dxodexml (XMLDOC); Var o: object = new object (); O.someprop = resultObj.maintag.item.interface;  

Can the interface be treated as a keyword? Can someone tell me the solution for this? Thanks in advance

  o.someprop = resultObj.maintag.item ["interface"];  

email - Use PHP mail to send via smtp -


Do you know that you can configure php's mail () command, so instead of just local SSML Will you use SMTP server?

Our server is running RedHat 5 Enterprise.

I know about different PHP libraries that work as a SMTP client but I want to configure PHP so much mail () instead, a SMTP server is used directly. According to

, it is possible only on Windows.


sql server 2005 - Optimising DATEDIFF -


I just want to check my logic.

Let's say I want to find all the new products in the last 30 days My current process is:

  Choose the product name from the manufacturer DATEDIFF (d, CreateDate, GETDATE ()) & lt; 30  

However, I understand that a function like DATEDIFF will not use the non-clustered index created on CreateDate . Therefore, my query is of the following process Will run quickly using:

  select product from product name WHERE CreateDate & gt; = DATEADD (d, -30, GETDATE ()) and CreateDate & lt; BTW, I do not have a SQL server, from where I am so much that I can not test using the execution plan. 

Yes, you are right, the second question will be fast because it is available which is available on CreateDate Can use index


c# - SqlBulkCopy problem -


I use SqlBulkCopy to insert data from OleDbDataReader (contains data from xls) to mssql-2005 There is a client on IleDbDataReader (in Xls)

The number stored in the form of the number is included when I look at the mssql data, in that column I see nonsense all the other columns move right.

You need to map the code into columns like ... < / P>

 using  (SqlBulkCopy bulkCopy = new SqlBulkCopy (destConnection)) {bulkCopy.ColumnMappings.Add ("ID", "ID"); BulkCopy.ColumnMappings.Add ("Email", "Email"); BulkCopy.DestinationTableName = "tableName"; BulkCopy.WriteToServer (ExcelReader); }  

asp.net - Problem with LoadViewState after F5 page refresh - Failed to load viewstate -


I'm having trouble with a veststate and F5 page refresh in my ASP.NET application.

Once you navigate to and I immediately hit F5 to a page, I get the following error:

  System.InvalidCastException "Type 'System.Web to type. unable to cast object of UI.Triplet '' System.Web.UI.Pair '. " 

displayed on this page is the following exceptions:

  HttpException (0x80004005): Viewstate failed to load control tree in which the viewstation being loaded should match the control tree whose sub Yoga was done to save the viewstation during the previous request. For example, when control dynamically adding, type added during back control and match more control of the situation during the initial request.] System.Web.UI.Control.LoadViewStateRecursive (object savedState) 310 System. Web .UI.Control.LoadChildViewStateByIndex (ArrayList childState) 136 System.Web.UI.Control.LoadViewStateRecursive (object savedState) 224 System.Web.UI.Control.LoadChildViewStateByIndex (ArrayList childState) 136 System.Web.UI.Control. LoadViewStateRecursive (Object Reserved Static) +224 System Web. UI. Control LoadChild ViewStateByIndex (ArrayList child state) +136 system. Web. UI. Control Load vevastet reverse (object saved) +224 system Web. UI. Control. Landshield ViewStateByIndex (ArrayList childState) 136 System.Web.UI.Control.LoadViewStateRecursive (Object savedState) 224 System.Web.UI.Control.LoadChildViewStateByIndex (ArrayList childState) 136 System.Web.UI.Control.LoadViewStateRecursive (object savedState) 224 System .Web is .UI.Page.LoadAllState () is +439 S ystem.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 1092  

the point at which it failed, override a custom label control in LoadViewState method when it tells parents LoadViewState

  System.Web.UI.WebControls.Label.LoadViewState (ByVal savedState in kind)  

savedState object one page Appears to re different control (a drop-down list), which is required by System.UI.Pair object label control Sistmkaibikuai. Triplet, instead.

If I really use the same thing in a single application, then a separate page, the page load is fine after the postback F5 postback. Two web pages are successors from the same base category and use the same custom control. There is no dynamically added control in the page causing the problem.

After debugging this process, it seems that the LoadViewState event is not being removed after the F5 postback to control the page that successfully loads. SaveViewState has been removed in both cases.

Any ideas why the LoadViewState event will be removed for one page, but not the other? I'm quite new to ASP.Net and I'm still seeing my head how the viewstate works.

It is difficult to say a lot without seeing your code, however, there are some things that can help: / P>

  1. You might want to see the HTTP Exchange during failing to use Web debugger like Frederor; There is a good chance that the answer will get out on you.
  2. Remember that F5 issues the final request again. If you are navigating from one page to another, there should not be any viewstate, unless you are posting a cross-page.
  3. If the viewstate is not being sent with the request, then the nature of the failure is the way in which you are encoding it, what is there with anything?
  4. The LoadViewestate () should be called only when the incoming request contains the viewstate that should be loaded in the respective control.
  5. To continue the state of control in SaveViewState () in the hidden area of ​​the page, each page is requested for a request, so that it is available during a postback.

asp.net - UpdatePanel Exception Handling -


Where I am implementing in the AppNet Web application in UpdatePanels, where I am creating, they cause javascript Error on page with some high level error output available in the warning. It is fine for development, but as soon as the system is in production, it is clearly not good for many reasons. I try to control the javascript error, I can pass troublesome activities with catch etc. But in some cases, I want to take action on main page etc. to support the user experience.

How can I be proud to provide an uninterrupted and javascript error free implementation in the update panels?

You can use a combination of

here are some resources that you can use You have to help. In order to solve this problem, the AsyncPostBackError event on the ScriptManager (Server Side) and EndRequest event on PageRequestManager (client-side) to handle the side-side errors of the server completely. Here is a simple example:

  // server-side protected void ScriptManager1_AsyncPostBackError (Object Sender, AsyncPostBackErrorEventArgs E) {ScriptManager1.AsyncPostBackErrorMessage = "There was an error during the request:" + e.exception.Message; } // client-side & lt; Script type = "text / javascript" & gt; Function Pageload () {Sys.WebForms.PageRequestManager.getInstance () add_endRequest (onEndRequest); } Function on endurext (sender, args) {var lbl = document.getElementById ("Label1"); Lbl.innerHTML = argsget_error (). message; Args.set_errorHandled (true); } & Lt; / Script & gt;  

c# - Correct way to remove M:M in PLINQO? -


Suppose you have this table structure:

Patient -> Patient Tag -> Tag

A typical N: M relationship between patients and tags, pettag is both intermediate unit with FK. (Petit Id and Tag Id)

I want to remove a specific tag, I have its ID. I am doing this, but I would like to know if there is any better way, because this is the first method I am writing using Paleikuo, I do not want to start bad behavior from the beginning.

  (MyDataContext DC = Data Contextifier. Gate DataContact ()) using the {var option = new DataLead Option (); Options.LoadWith & lt; Paciente & gt; (P = & gt; P. privataglistlist); Options.LoadWith & lt; PacienteTag & gt; (Pt = & gt; pt.Tag); Dc.LoadOptions = Option; // Get deleted tag from DB Var tag = dc.Manager.Tag.GetByKey (idTag); // Remove every patient from the association Foreach (tag in pagente pac.PacienteList1) {// We need to retrieve it, we will not let us use the 'PAC' object. Var pax = dc.Manager.Paciente.GetByKey (pac.IdPaciente); Pax.TagList.Remove (tag); } // Now Tag D. Remove the manager.Tag.Dil (tag. TIGID); // Change the DC Submit (); }  

Thanks for any information on the topic.

About using a foreign key with cascading delete, then deleting tags and Take care to remove all references in the database. If you want to make sure that it was not in use, then you can check that no patients are connected before, although you may need to wrap it in a transaction, if other processes access to the same database Is doing. / P>


.net - Creating a Wizard for Plugin project development -


My DotNet application allows for plug-in DLL by third party developer. I facilitate the process by offering these plug-ins to a set of tools that create empty projects and new standard classes Essentially, I need to create a special class library project that includes DLL references and some postbuilding events. Are there. Apart from this, it would be nice to set up some basic classes through the wizard UI.

I know that it is possible to create add-ins for Visual Studio, but is this really the preferred mechanism? I can also create a standalone application instead, which can make all the files (* .sln, * .csproj, * .csproj.user, * .cs) on the disk. In this way I am not dependent on Visual Studio. Is it worth the freedom?

Find the following link for the Custom Project Wizard:

I think you do not need a custom project subtype and as Clobesvik has said you can use a simple project template to perform this task. But if you want more control over this project, you will have to create a project subtype, as such, check this link:


html - Inserting Chinese Meta Tags -


I have a multilingual site and I'm having trouble inserting the Chinese meta tag. They are replaced in question marks.

Is there any way how can I get it?

- Thanks -

- Editing -

The SEF URL storage table is in the Latin 1_swedish_ci character set without breaking the URL How do I change this single table to utf8_general_ci Can i

Many thanks!

Be sure to:

  • the character you are using Encodings include those characters (UTF-8 is protected)
  • Your editor is configured to use that character encoding
  • Your database (if these details are stored in one Is configured to use that encoding
  • output a charset parameter to your webserver content-type header (And uses the right encoding)
  • Your browser is not configured to ignore the specified encoding

iphone - Memory leaks with UIWebView and NSURL: already spent several days trying to solve them -


I have got a lot of information about how to solve memory leaks for iPhone ob c code. The last two leaks are troubling me, I'm probably ignoring some that you can see it.

CGRectMake (0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height - LOWER_VERT_WINDOW_MARGIN)]; (2) webView.scalesPageToFit = Yes; (3) webView.dataDetectorTypes = UIDataDetectorTypeNone; (4) (5) NSDRAEL * URL = [NSUr file URLWithPath: self.fullPathFileNameDirectory: NO]; (6) NSMutableURLRequest * urlRequest = [[NSMutableURLRequest alloc] initWithURL: url]; (7) [Webview LoaderWeost: urlRequest]; (8) [urlRequest release], urlRequest = zero; (9) [self.view addSubview: webView]; (10) [Webview release], webview = zero;

The device claims that 128 bytes are leaking in line 1, as well as 256 bytes in line. No idea if it means line 3 or row 5.

What is a clue what I see?

1) Make sure you are leaking tests on any device and not a simulator

2) If not, try setting the URL cache by adding it to your app representative:

  NSURLCache * sharedCache = [[NSUrCatch Alloc] InitWithMemory Capacity: 0 Disk Capacity: 0 disk path: zero]; [NSURLCache setSharedURLCache: shared cache]; [Shared cash release];  

vb.net - Fire an event every second -


QUICK QUESTION:

I need an event that takes fire every second, like

Dispatch timer of timer 1_temer () event VB6 A good option for storyboard timer is:


iphone - Delayed UIImageView Rendering in UITableView -


After

OK, I've found a UITableView custom UITableViewCell Together they have a UIImageView whose picture is being downloaded asynchronous by a NSURLConnection . All the beautiful standard stuff ...

The issue is, when the table scrolls, new images are downloaded in the background correctly but not rendered until the table stops moving.

How do I even take table to present my content when it is growing? . Thank you

- Update -

After looking closely, I'm finding that NSURLConnection representative methods are closed until the table stops being active . not sure why. Any help would be great.

"itemprop =" text ">

cause connection delegate messages are active until you have to stop scrolling because during scrolling, run loop is in UITrackingRunLoopMode . By default, the program in NSURLConnection is the only NSDefaultRunLoopMode , while you do not get any message while scrolling.

How to set connection time here in "normal" mode, in which UITrackingRunLoopMode :

  NSURLRequest * request = ... NSURLConnection * Connection = [[NSURL allocated connection] initWithRequest: Request Rep: Auto Start Import: No]; [Connection Schedule Infinite Roll: [NSRunLoop currentRunLoop] forMode: NSRunLoopCommonModes]; [Connection start];  

Note that you have to specify startImmediately that: not is the operator, which shows the documentation of Apple that you also run it after the loop mode It seems to have started to run counter to start.


WCF Linq to SQL Table - System.Data.Linq.Table cannot be serialized -


I can not understand this because I go through the demos that start working. I have a WCF service that I was trying to use to SQL from Linux. However, I never get the error error. System.Data.Linq.Table can not be serialized. So I started with my own class, I can back up until I get this error. The problem is also trying to use an empty square. Just using my method "System.Linq.Table (XXX)" gives me this error.

Type 'System.Data.Linq.Table`1 [LinqADMRequest2b]' can not be sorted, consider marking it with the DataContractAttribute attribute, and marking all its members Do the ones you want to be sorted with the DataMemberAttribute attribute. See the Microsoft .NET Framework Document for other supported types.

  Import System.ServiceModel Import System.ServiceModel.Activation Import System.Runtime.Serialization Import System.Collections Generic Impressions Lynch & Lt; Service contract (namespace: = "")> _ & lt; Service Levière (Exposition Dictive Influences: Include = Trues)> APNnet Compatibility Values ​​(Requirements Mode: = AssetNetTatilityUurraymentsMod. Validate)> _ Public Class Compilitrack WCFS Service_Public Function GetTestRequests () as System.Data.Linq.Table (LinqADMRequest2b) '' Rich queryresults = ct.ADMRequests 'ct.ADMRequestGetListByUser ("", "155")' Retrieve queryresults ending function of the class 'lynx' as new Linq2.ComplyTrackDataContext & lt; DataContract ()> _ & lt; Serializable ()> _ Public class LinqADMRequest2b implements the ISerializable Private _firstName string_public property FirstName () Get the string return as the firstname-set (set byVal value string) _firstName = Go value end set end property public sub GetObjectData (ByVal information as System.Runtime.Serialization.SerializationInfo, ByVal implements System.Runtime.Serialization.StreamingContext) as the system.Runtime.Serialization implements ISerializable.GetObjectData End Sub End Class  

As you can see GetTestRequests () does nothing, then it says that this system is returning. Data.Linq.Table (of LinqADMRequest2b)

I can not order LinqADMRequest2b.

Type 'System.Data.Linq.Table`1 [LinqADMRequest2b]' can not be serialized. Consider marking it with the DataContractAttribute attribute, and mark all its members that you want them to be serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework Documentation for other supported types.

don do not return from your service table & lt; T & gt; This is a complex query type that relies on its datacentext and is not an in-store archive.

Return List ; & Gt; , you can see the table & lt; T & gt; a list & lt; T & gt; By calling System.Linq.Enumerable.ToList ()


python - Django creating a form field that's read only using widgets -


My form field looks like the following:

  class FooForm (ModelForm): somefield = Model.Carfild (widget = form.TestinPoint ({atton = {'readonly': 'readonly'}) class meta: model = foo  

with the code as an error like the following Receiving up: init () found an unexpected keyword argument 'widget'

I thought it is legitimate use of a form widget?

You must use a form field and the model field should not be:

  somefield = model.carfield (widget = forms TextInput (attrs = {'readonly': 'readonly'})  

with

  Somefield = forms.CharField (has been replaced with widget = forms.TextInput) Attrs = {'readonly': 'readonly'}))  

This should be corrected.


wordpress - Test for posts matching specific category and not belonging to exclusion category -


I have a function whose purpose is to list the posts where each post has the specified category "Top-menu". However, I first want to exclude all those positions where the range is "hidden" ...

How can I edit this code to do this?

  global $ post; $ Cat = get_cat_ID ('top-menu'); If ($ cat & gt; 1) $ myposts = get_posts ('numberposts = 5 & amp; class ='. $ Cat); And $ myposts = get_posts ('numberposts = 10'); Forex Currency ($ myposts as post):? & Gt; & Lt; Li & gt; & Lt; A href = "& lt ;? php the_permalink () ;? & gt;" & Gt; & Lt ;? Php the_title (); ? & Gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt ;? Php endforeach; ? & Gt;  

This is what you should do. Not sure if you had a if statement, you are free to join again, feel free if you need it, feel free to You can always use category and replace it with an ID instead of category_name because I'm using it as a shortcut here.

  $ exclude_cat = get_cat_ID ('hidden'); $ Include_cat = get_cat_ID ('top-menu'); $ Myposts = get_posts (array ('numberposts' => 5, 'category__in' = & gt; array ($ include_cat), 'category__not_in' = & gt; array ($ exclude_cat));  

Edit: category_name can not be associated with category__not_in , so I have both code Will be turned slightly changed.

I have tested this and it works in WordPress 2.8, just supply the name of the actual class in the get_cat_ID call and slug crash To


php - I need to extract email addresses from yahoo full headers and need help matching them -


I have saved several thousand emails in a directory. These emails have been opened with file_get_contents. Needed: How can I email them to these headers?

Similar questions from my equal answer - I believe that e-mail It is surprisingly painful:


Some mail send libraries can parse raw emails, while passing Zend_Mail should be able to do this Your raw email for a Zend_Mail_Message object (Note: I have not seen reading a raw message.)

  $ message = new Zend_Mail_Message (array ( ), $ Filename); $ Sender = $ Message- & gt; GetHeader ('answer-to');  

If you need all the sender, then better to use a good RegEx, however, if you will test other headers / body / mime parts, then one The library will be worth it.


asp.net - Calling javascript from code behind -


Trying

I have a C # asp.net 3.5 app I open the back window of the code after a certain event Am I have it, but it is not working and there is no error in firebug

  protected override void OnPreRender (EventArgs e) {base.OnPreRender (e); If (opencredentialsWindow) {if (opencredentialsWindow_ClientId! = Guid.Empty) {this.Page.ClientScript.RegisterStartupScript (this.GetType ()), "openCredentials", Stringkformet ( "Rdopen ( 'Services.aspx? ClientId = {0 }, Window-Services') ", Open Credentials Window_ClientId.ToString ())); }}}  

Any ideas?

RegisterClientStartupScript method calls to pass an additional parameter.

  Page.ClientScript.RegisterStartupScript (this.GetType ()), "Open credentials", Stringkformet ( "Rdopen ( 'services. Aspaks? Claintaidi = {0}, Vindo_srvisej')" , Open Credentials Window_ClientId.ToString ()), is true;  

iphone - Using libraries in XCode and sharing them via Subversion -


We include mySettings library in our iPhone application to provide a settings dialog inside the application. The description of the installation details in the wiki of the projects is how to include the library (see).

After following these instructions, compile and run in the desired simulator when the developer shares the project via our SVN and any other The developer checks that does not compile on any other machine because the referenced files are lying the folder outside the project .

Should not we put all the necessary files in the project folder?

How is it usually done in an xcode when a subvivision repository is used?

Thank you for your help!

Yes, all the files needed to create and run the project should be available in the repository. You can specify how additional files should be checked with the project and what kind of repositories they live in.


xml - What settings storage format to choose? -


I am writing a QT application and I will need to store settings for the program. I want them to be easily editable by non-advanced users but are flexible enough for advanced users (thus allow easy automated editing by other programs, scripts, whatever). QSettings provides two formats, native format, which is the registry for Windows, and INI format, which is original for most other platforms. INI is fine, but seeing Qestring (...) or other QT stuff is not really readable and it is a little error prone.

The registry is not great either, it was not designed to disturb and was not exactly right for editing or advanced use; This resolves the problem of synchronization between threads and multiple QSettings objects (so I can not erase everything, although I can only use a global object, protected by a read-write locker). I am looking at XML, but it is very clear and it is necessary to write a quotes format (not really an issue), but it is very flexible.

I know that other options of XML are present, but I'm not really familiar with them;

Update - Attention: I will not leave the Q settings at all, I will just write one format for it - it seems that this is just two function pointers And for a writing job) are passed in a constant function and then I can use my format.

Update 2: I'm also worried about Linux servers, which are not usually GUI .. I want people to be nanotech or something similar Easy to edit the configuration, without using the manager (yes, I will have a daemon server and remote GUI manager).

For any reason except for QSettings and your configuration file Consider XML, I suggest you look at JSON or YAST, depending on how you like available Libs.

As a sidenote, if you do not intend to ever edit the file M on one side, choose the easiest ( QSettings ?) For you and your life Proceed with, because the choice of format will not make any difference to each bit.


sql server - Identify individual sql user in SQL profiler And activity monitor -


We are using SQL 2005 and we want to identify individual users so that we know the performance of our SQL But we can use SQL 2005 with connection pooling so that every user's activity monitor should be the same user. The name of their NT user is not set - perhaps because we are not using SQL Server users, we are also using CITRX so that no IP address is set. How can you identify a different user in this (very common) environment?

If all the same users are using the same username and come from the same IP you tell them different MSSLQL will not even be told if the user is not using the authentication of windows, then what is the name in the user's connected windows?

Have you considered changing your setup so that it uses Windows authentication? It seems like a logical solution to the problem either, or setting up different logs for everyone on SQL, but it must duplicate your Active Directory user list ...


How to add a customized method to determine the number of words in an input box with Jquery form validation plugin? -


I am developing a website that is similar to stackoverflow.com. A poster is required to enter 1 to 3 tags for your problem or work. If there are more than one word in a tag, - Multiple words are used to combine in one-word, the location is used to isolate the tag. Jquery form validation for validating the form I use the plugin. I need to add an optimized method to validate the tag input box.

$ .validator.addMethod ("tagcheck", function (value, element) {return more than 3 words to set the value.}, "Input on maximum 3 tags. ");

How do I write a customized method?

  $ Validator.addMethod ("Tagcheck", Function (Value, Element) {Return Value & amp;; value.split (""). Length & lt; 4;}, "input to maximum 3 tags.");  

how to open multiple files in vim after vimgrep -


I am using gvim *. Using vimgrep on current directory to get text in Sql files. When searching for files, it only shows me the file name at a time and finally opens a file

Is it possible to open all the files in tabs? Actually I want to open all the files because I want to change the 'vimgrepped' pattern with any other text to automate action on QuickFix list places, I've written a command like : bufdo

or : windo which executes a command for each item.

  command! Call the -nargs = + Qfixdo QuickFixDo (& lt; q-args & gt;) function! For buffnam = {} for QuickFixDo (CMD) Q, go to bufnam [q.bufnr] = bufnr (q.bufnr) for k in n (bufnam) exe 'buffer' n exe a: endfunction for cmd update end  

Using one of the following files, you can open all the files mentioned in the QuickFix list.

 : Qfixdo tab sp  

Additionally, the replacement can be repeated in the same way.

 : Qfixdo% s / pattern / string /  

c# - Knowing the point location of the caret in a Winforms TextBox? -


I should know the precise point location in my window where the current is still carpet so that I can pop a small window down The text (similar to Intelligence or Spellchecker) is that the GetPositionFromCharIndex does not seem to work on the text box. This is what I am trying to do:

  point pt = mtextbox Pt.Y = (int) math. Ceiling (mTextBox.Font.GetHyight ()); MListBox.Location = pt;  

However, GetPositionFromCharIndex always returns (0, 0) for TextBoxes (apparently it is not implemented for the Recharge box). Although this function (and this code) works fine for RichTextBoxes, I do not want to migrate my remaining code from Rich Textbox to text box, while RichTextBox / TextBox as a full LAST resort There are so many inconsistencies with that I have to rewrite the big part of my code lot in order to do this.

Is there a Winforms magician who knows how to do this?

If you do not mind using Win32-API to get the correct position.


c# - How does one set text of two labels with two different cultural/region format options? -


How does the text of two labels with two different cultural / region format options set? For the first code, ar-EG: Arabic - Egypt and the other one en-US: English - United States ?

This is done for number / date / time / currency formats.

Use the culture explicitly in the ToString () method. For example:

  datetime DT = date time.Now; CultureInfo Arabic = Culture Info GatecultureInfo ("AR-EG"); Label1.Text = dt.ToString (Arabic datetime format); CultureInfo English = CultureInfoGetCalcherInfo ("N-US"); Label2.Text = dt.ToString (english.DateTimeFormat);  

Use CultureInfo.NumberFormat for format numbers.


How to add a tool tip to control in window application (win32 API) using Visual C++ 2008 -


I have a window application (Win32 API) in Visual C ++, in which I have to add device tips to the control button. Can anyone help me in getting the above mentioned work? thank you in advanced.

See if you do not use the MFC class

here's a < Code> CToolTipCtrl is an example using the class,

  // log in a tooltip window m_ToolTipCtrl = New CToolTipCtrl; M_ToolTipCtrl- & gt; Create (this); // 'this', usually a cdialog window m_ToolTipCtrl- & gt; SetMapsTipWidth (300); // If you need multiline messages then m_ToolTipCtrl- & gt; Settep beaker roller (0x000000); M_ToolTipCtrl- & gt; Settep Reader (0xe0e0d0); // A CListBox control attached (we can attach many controls) m_ToolTipCtrl- & gt; AddTool (plstbox, "hey, I'm a tooltip message!"); To use Touloges (MFC 4.0 and later), // ... // (*) we have to use the following BOOL MyDialog :: PreTranslateMessage (MSG * pMsg) {if (NULL! = M_ToolTipCtrl) m_ToolTipCtrl- & Gt; RelayEvent (PMSG); // & lt; - Listen mouse message! Return CDialog :: PreTranslateMessage (pMsg); }  

mobile - Android id naming convention: lower case with underscore vs. camel case -


I'm currently programming an application for Android. Now what I have found is that you can not add resource items, say, an image in the docs folder and name it like "myTestImage.jpg". This will give you a compiler error because the camel case syntax is not allowed, so you have to give it a name like "my_test_image.jpg".

But in the XML file you define, say that you have the following definition

  & lt; TextView Android: id = "@ + id / myTextViewFirstname" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: text = "Firstname" / & gt;  

This is a valid definition, compile and works fine on my Android emulator - however as you see - I am specifying IDs in camel case syntax.

Now, Android samples always use lower case and underscores. Is this just a naming convention that uses a short case with an underscore for the ID or can it cause problems on the actual device?

Thx

if you use camel-case ID names I will not complain for my first application I have written all the ids in the case of camel because I think it is better in Java code, and it works fine.

I am gradually changing my mind on the camel-case, however, because you end up with two different naming conventions - for example:

  // Naming constrictions due to setContentView (R.layout.my_long_layout_name) it should be undescored; // Now it looks a bit out of place ViewById (R.id.myLongSpecificId);  

I also think about the standards here. Google is incompatible with their examples; Sometimes they use all lowercase, sometimes they put underscores, and sometimes they use camel-case.


.net - Does Math.Round(double, decimal) always return consistent results -


Of course, floating point value should never be understood, which results from calculation for equality, but always a Use small tolerance, like:

  double value1 = ... double value2 = ... if (Math.Abs ​​(value1 - value2) & tolerance * Math.Abs (Value1)} {... values ​​close enough}  

But if I use the monastery. Round can always be sure that the resulting value will be consistent, i.e. will always be successful on the following targets, even if the spherical value is a value? A double

  public static void TestRound (double value 1, double value 2, decimal int) {double roundedValue1 = math.Google (value 1, decimal) can not be displayed exactly ; Double round value 2 = Math. Round (value 2, decimal); String format = "n" + decimal. Toasting (); If (round value 1.ToString (format) == was rounded 2. 2. toaster (format) {// They had round, roundness accurate for the same value? Debug Asset (rounded velay = 1 == round value 2); }}  

If not, please provide a counterexpression.

Edit

Thank you for a counter code created by anger, the force which proves the results is not "consistent" in the normal case. In this counting example, there are 16 important digits in the result of the goal - it also fails in the same way when it is scaled:

  double value1 = 10546080000034341D; Double Value 2 = 10546080000034257D; Int decimal = 0; Test-round (value1, value2, decimal);  

Although I would also be interested in more mathematical details. More mathematical Stackoverflowers upvotes bonuses for anyone who can do any of the following tasks.

  • A counterexample where find 16 significant digits compared to the round result

  • Identify the range of values ​​for which

  • Give an algorithm method to generate the answer

I placed a breakpoint at">

and it entered with the following value

  value1 = 1.0546080000034341 value2 = 1.0546080000034257 decimal = 15 roundedValue1 = 1.0546080000034339 roundedValue2 = 1.0546080000034259 roundedValue1.ToString (format) = 1.054608000003430 roundedValue2.ToString (format) = 1.054608000003430  

I think the answer to this question was looking for you?

If not, please let me know, so I can do more tests.


java - How to run a Maven JME project in netbeans? -


I created a maven project using net4bans with j2me-archetype. It creates a project with a default MIDLet (SampleMIDlet.java). But when I try to run the project, it says that no main class has been found. Can someone tell why the main middle class is going instead of the current middlelet?

Actually, I'm not sure what you actually say "how to make a Maven JME project NetBeans to run ". I'm not a JME expert, but to run such a project, for your knowledge, you will need Java ME MIDP Platform Emulator Do you have that emulator installed is? Take a look at this.


spell checking - Lucene using Snowball and SpellChecker brings back strange values -


I'm trying to use the SpellChecker setup to Lucene.NET, it works fine except for all similar situations Does:

I have the satellite in the index in the text, I analyze it using snowball.

Then I create a spell-checker index and get its suggestions. After passing in "SatLite" I get a suggestion "Satellite"

I am assuming this because snowball has made the satellite a satellite and therefore the spellchecker is returning, as a suggestion.

Is there even this around, so than comparing an additional field for the other non-stamped word, just because the spell checker can test it? Like Shashikant has mentioned above:

Above:

You are right, This happens due to unfortunately, strong words are not only for search and outdoors, they can be meaningless. Even I do not know any other technique than storage it many times. That extra area can be configured to keep as little information as possible to reduce the burden - Shashikant Koraye on December 2 at 14:08


mysql - latin-1 to utf-8 data porting -


I have an old site whose database is in Latin-1 encoding. I duplicated a Drupal site on the old site by default, the DPL database is in UTF-8 encoding by default, now how do I port the database from Latin-1 to UTF-8. I tried myself and I got unwanted charcharchs. How should I do this.

Here's the possible solution:

  Http: // www. Oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html  

Hope that helps :)


iphone - What does the touch/untouch do in xcode? -


In XCode, if a right click on a class file or .xib file, then there are two menu items: "Touch" and "Untouchable".

What do they do?

If a file is touched, the next time you create a target, it will be related is.

In this way, the touch file is being modified (and thus need to be compiled) - easy to open file, delete space, delete location, and then save it.

The opposite makes the opposite - does not mark the file needed to compile (usually a bad thing because the build can exit the sync sources say, but if you have done that , That date was edited in a comment in a header file, which contains everything that can prevent you from fully rebuilding).


flash - play multiple flv file in single swf object -


I have a SDF object in my site.

I have to get data from the database data of the video names,

I have to play those videos in one single SDF object one by one, that means that the first video is complete After the second video will start.

Thanks in advance. postprice "itemprop =" text " P>


php - Calling java program dependent on external library -


I am trying to call a Java program to use with the Java interface.

The Java program is dependent on external libs: commons-cli-1.2.jar

So basically I need to export it before calling the Java program; But if I export it for the first time:

  shell_exec ('Export Classes: $ CLASSPATH: ~ / lib / commons-cli-1.2.jar');  

Then call the Java program like this:

  shell_exec ('java computegearank -i $ para_i -d $ para_d -e $ para_e -o $ Para_o ');  

I think it makes different shells for each call; There is no effect of export on the Java program. Or am I wrong?

Otherwise, it should output a file to the server. But just this is not so, what is wrong? Any ideas?

Edit: However this may be because some parameters like parameters stand for the input filename, so should I specify the full path for this? Because I think the input file is in the same work directory, then there will be no problem, right?

Edit-2: It outputs properly when I use the command line;)

You are right, each shell_exec creates a separate shell.

  env CLASSPATH = whatever java-suites  

php - Mysql Query doubt -


मेरे पास तीन टेबल हैं, जैसे test1, test2, test3

  test1 डेटा ==== ======= आईडी test_id q_id 1 25 2 2 27 2 परीक्षा 2 डेटा =========== आईडी test_id q_id 1 25 2 2 34 2 परीक्षा 3 डेटा ========== डेटा को दोहराए बिना इन तीन तालिकाओं से  q_id = 2  के साथ  test_id  मान कैसे मिलता है?  

P>

यह 25, 27, 34

यदि आप वास्तव में छुटकारा नहीं पा सकते हैं तीन संरचनात्मक समान तालिकाओं में से दो ऑपरेटर पर एक नज़र डालते हैं। डिफ़ॉल्ट व्यवहार यूनियन DISTINCT है, जो परिणाम से डुप्लिकेट को निकालता है।

  test1 से test_id का चयन करें WHERE q_id = 2 यूनिअस डायस्टिक्स SELECT test_id test2 WHERE q_id = 2 यूनिअन डिस्टिंक्ट Test3 से test_id चुनिए WHERE q_id = 2  

What does Python's builtin __build_class__ do? -


In Python 3.1, there is a new built-in function that I do not know in the builtins module:

__ build_class__ (...) __build_class __ (funk, name, * chairs, metaclass = none, ** kwds) - & gt; Classes used by the statement of the square Interior Assistant Function.

What does this function do? If it is internal then why should it be in the buildings? What is the difference between the type (name, base, dict) function?

PAP proposes that class statement accepts keyword logic, * arguments ,

and **. There is something wrong to compile and execute it, but of course, it is already in the code to make regular calls.

So I think that this is a new hidden in a call) created code, name __ build_class __ . Then the definition of the class:

  class C (A, B, MetaClass = M, Other = 42, * more_base, * more_kwds): ...  
< P> will be translated into:

  c = __build_class __ (& lt; func & gt ;, 'c', a, b, metaclass = m, other = 42, * more_base, * More_kwds)  

Where & lt; Func & gt; is a function object for class body.


LaTeX floats and consecutively numbered equations -


I have some equations that appear in a floating shape. Unfortunately, the same equation number is assumed that the float (and therefore the equation) are visible in the condition that the float was defined. Conceptually, a page will look like this:

  equation # 1 data equation begins # 2 figure equation # 3 ends  

but If latex is at the top of the figure page, then I want to count it like this:

equation equation begins # 1 equation # 1 ends equation # 2

Is latex possible to do this?

In a way, it will only be used for countless use of the equation inside the float, and then this "shape See the equation in: {fig: foo} "


php - Change the whole content of site depending on monitor resolution -


In my site, I am applying a stylesheet based on the viewer's monitor resolution. I do this by using the screen.width in javascript. But now I suspect that I can use the same technique to change the entire contents of the site on the basis of resolution, i.e. for higher resolution more content and less, less Or please suggest me some other techniques to do this.

You can find the resolution and use it for a class of your page body Apply and use it to show / hide CSS in some columns. I can provide sample code if you tell me which framework / any framework you are not working with.

Here is the basic example in plain javascript:

  window.onload = function () {var resolution = 'res' + screen.width; Document.getElementsByTagName ('body') [0] .className = Resolution; }  

The advantage of this is that any page will always be displayed whether Javascript is enabled or not. If Javascript is enabled, you can create the page at a resolution, if the user will still see your content.


php - Why is Zend Framework so popular? -


I am not a troll and my goal is not to start a flame war; Neither do I insult the writers of the Zend Framework: It's a great job but ... I have a job to work with and I have to work hard with ZF's popularity against the reality of making apps with it. . I want to know from others why they use the Zend Framework

I am quite new to PHP world, but I have done many programming in many languages. After reading many tutorials and making some apps in it, some Core Zend Framework features look like alpha codes for me, the following fundamental weaknesses for me, among others, would be very much to consider the deployment of apps with it- But more ZF is recommended, if is not a leading framework.

First let me know that I do a lot of zf work. This routing should work a lot, the layout feature is useful (though very different from templatesetting systems like JSP / ASP), cash facility, etc. Too many models appears to be a trend in the community (for example verification) and see the argument (for example $ -> headscript () - why should my controller keep in mind that my jc file needs my view Is it?) In the controllers but it may be a matter of use and not necessarily the structure's fault

Now I have really experienced the serious (IMO) weaknesses in my short time with it. If I continue to build with it in the future, then there will be tremors to imagine other areas. .

1 form layout
Many people are unhappy with the lack of control over the form layout. How can you create a popular framework where building a simple form requires a lot of discussion? And.

2 Authentication / Authorization
Anyone really thinks about how regular authentication / authorization works. In addition to implementing simple access control, people [actually including games], the approach depends on the serialization of persistence rather than traditional database storage of users and permissions. It's a lot of people who work!

Is not my alleged vulnerabilities real or any kind of problem? why or why not? Why did you choose the Zend Framework (or not)? Are there other areas that have found you so painful that you want to dump a ZF for a different perspective? Thanks for your opinion.

Because they are good in marketing

< / Blockquote>

and they are one of the most complete frameworks for php.

P> When you think about it; It's like saying:

"This can not be done as an executor in our language, so we have created a framework with caching that makes it fast".

  • Most of the offer of the Zend can be done without jade too.
  • But the package of Zend is a very good "all one" distribution.
  • They provide certifications and training.

c# - How to catch on a winform when the TAB key is pressed -


I have developed a grid control and I want to say that when the tab is pressed, Jumps from The issue is that no matter what the issue I suspect or when I press on the tab, it is overridden under control, it is never called a phone. I also try to hold the tab at the form level, but this is the same, any key responds to the event tab. Any suggestions?

Have you tried to override?


.net - Is there a way to do TRUE bidirectional communications over a single TCP connection in WCF? -


I have a WCF server that unveils an interface that has a call-back interface that sends events to the client Uses for

I do not mark all the methods in the form of "one-way" on call-back interface, because it does error tracking and hard logging.

The client is written in WinForms, so call-back will not process, until the server returns after calling. (This is the behavior that I want)

I make all calls back with Asynchronous Eg StartMyMethod (...), so the server is waiting for the client is not blocked .

However, if the call-back is sent to the same client as the request has been sent to the server, then the TCP channel delivers it to itself, because the customer has to send the feedback back to the customer. It does not seem to be able, before the customer has sent back the call-back response to the server on the same channel.

"itemprop =" text ">

You can do this if both the server and the client both a server and the client (such as that makes sense) acks

This will work like this:

  • When the customer starts the call to the server and registers itself
  • The server knows where the client is and can contact the client through the services displayed by the customer.

Another, simple addition Re Paddy channels will not be used, thereby avoiding deadlock.


Deleting multiple lines based on serach conditon python -


I am working on a DHCP editor to add, delete, and search a host. I have a code that will search and add the host I thought I would add some to delete a host somehow and it will not work. What I want to do, I can make a list of Elements Index of f.readlines () , then use the values ​​of my MyDedax and then run lines.remove (myindex)

For example, I would like to search for foonode or any node and remove the following format:

  host burnload {option hosts} -name "birod"; Option root-path "0.0.0.0:/barnode"; Option subnet-mask; Option router; Hardware ethernet; Fixed address; } Host foonode {option host-name "foonode"; Option root-path "0.0.0.0:/foonode"; Option subnet-mask; Option router; Hardware ethernet; Fixed address; } Host foobarnode {option host-name "foobarnode"; Option root-path "0.0.0.0:/foobarnode"; Option subnet-mask; Option router; Hardware ethernet; Fixed address; }  

I can search the file using the following code:

  def delete_host (): host = raw_input ('Please enter that host What you want to remove: '); Start = wrong; F = open (infile, 'r') myfile = str () myindex = list () mystr = str () count = 0 lines = f.readlines () For lines in lines: If re.search (host, line) : Start = true if start: print line myindex = [lines.index (line)] if re.search ('}', line): break  

and get this output: / P>

  host fansos {option host name "afonod"; Option root-path "0.0.0.0:/foonode"; Option subnet-mask; Option router; Hardware ethernet; Fixed address;  

I wanted to create and index list in the search code for elements of f.readlines () element index values. Then using those values, to get the output out of a lines.remove (myindex.index ()) , I get it when I run the code, in fact, how do I search for any node and Remove them from the file? Perhaps creating an index is not the best way to solve this problem, I'm just going out of the expression to search in Google.

I know I have to do newfile = open ('/ var / tmp / foodhcp' 'w') but I want to correct the argument before starting to write the file.

Note that by removing items from a list you are looping the way you expect You can. I recommend that

  a = [1,2,3,4,5] del a [2: 4]  

a == [1 , 2], 5]

You are already able to find the start and finish line, so run Dell after finding those people.


html - Is it required to use thead, tbody and tfoot tags? -


क्या मैं वास्तव में thead , tbody और tfoot टैग हर बार जब मैं table टैग का उपयोग करता हूं? क्या यह मानक की आवश्यकता है या नहीं?

उन टैग्स की आवश्यकता नहीं है यदि उन्हें डेटा का प्रतिनिधित्व करने के लिए तालिका का उपयोग किया जाता है, तो इसका उपयोग करने के लिए यह अच्छा फॉर्म माना जाता है, जो कि तालिका के लिए उपयोग किया जाना चाहिए। यदि एक तालिका को सामग्री बिछाने के लिए उपयोग किया जाता है, तो उसे आमतौर पर छोड़ा जाता है।

डेटा की तालिका


c# - How to generate properties in underlying class mapped to elements with x:Name attribute -


I have DataTemplate behind which some code is required This template contains ListBox with attribute x: name = "myListBox" . This template is located in ResourceDictionary , which contains the attribute x: Class = "MyNamespace.MyClass" . How can I get the MyClass from the myListBox example code?

try it

  ContentPresenter contentPresenter = FindVisualChild & lt; ContentPresenter & gt; (MyListBox); DataDataDate your templatetemplate = contentPresenter.ContentTemplate; Text box txtName = yourDataTemplate.FindName ("vidList", content presentation) as text box; If (txtName! = Null) {// do something with txtNamehere}  

java - Kafka high level consumer -


I am trying to use a high level consumer for batch to read messages. During reading this batch, my thread must stop at some point.

Either when all messages end in the subject or get the maximum offset at that point when reading and stopping the messages, until the maximum offset is reached.

I tried to use the code but the KafkaStream seems to be a blocked call and waits until another message arrives.

So 3 questions,

  1. How do I know that there is no other message than the subject has read?

  2. If there is an answer to the question given above, how can I stop listening to this topic now?

  3. What is the way to find the maximum offset when the batch reads start (I think simple consumers can do this) and at that time the high level consumer has to stop?

  4. You have the option to decide when a specified message No new messages have been sent to you, so all messages have been read. This consumer property can be set using consumer.timeout.ms . After being passed without any new messages coming without this specified value, the consumer user will throw an exception at the same time and you can get more out of that user.


python - The meaning of key function in sort() and the meaning of np.argsort() -


I want to sort a list and want to get its index returns.

So I did it in two ways, but both of them gave me wrong results. I do not know what's the problem in it

For example:

  myList = [2, 1, 7, 3, 6]  

My goal is to get the result: [1, 0, 4, 2, 3]

then the first method:

  np.array (myList) .argsort  

But I found the wrong result:

  out of the array ([1, 0, 3, 4, 2])  < / Pre> 

The second method:

  index = category [5] IndiesSortort. (Key = myList .__getitem__)  

I found the same wrong result:

  outside: [1, 0, 3, 4, 2] < / Code> 

I do not know why this happens?

here sorts your original list by myList your expectations list You have two results:

Discounts:

  & gt; & Gt; & Gt; Results from your solutions: [1, 0, 4, 2, 3]] [1, 2, 6, 7, 3]  

Results from your solutions:

  Gt; & Gt; & Gt; [1, 0, 3, 4, 2]] [1, 2, 3, 6, 7]  

I think your solutions are correct and your required list is incorrect.

Update

On the interpretation of the expected result, the base is actually the "rank" of each item in the input, the solution here: [2, 1, 7 , 3, 6] def get_rankings (list): return [sort (list). Index for each of the listings (each)] print get_rankings (MyList) # [1, 0, 4, 2, 3]


Using wmi to trigger query OIDs in NDIS driver -


I want to create a wmi query in cs to trigger the NDIS OID.

For example, to check hardware status (OID_GEN_HARDWARE_STATUS) I can use the ManagementObjectSearcher ("root \\ WMI", "SENDED * FROM MSNDIS_HardwareStatus")

I need to make some other requests, but I do not know any way to find the name of the wmi class for the OID (assuming it is OID_802_3_RCV_OVERRUN, there is no explicit relation like OID_GEN_HARDWARE_STATUS -> MSNDIS_HardwareStatus No, at least I have not got one).

How can I find the connection between WMI class names and NDIS OID? Is there any document for this?

specific example that you quote, OID_802_3_RCV_OVERRUN , corresponding to WMI class Is not

  1. kernel debugger command ! Ndiskd.miniport -wmi & lt; SomeHandle & gt;
  2. P> If you do not want to use a kernel debugger, or if you want to see some more examples,


ember.js - Observe change on any attribute of an Ember Data -


Is this possible? .observes ('_data') , but no.

In the case of use, I have a Dicker mixture that has been done since some of the CPs that say how long a model has been updated since I have been To be able to update these CPs if none of the models of the model has changed. isDirty will not work as my use uses store.push to update the case model.

I do not think there is a built-in method to do this, but it is not very difficult to create one Just create a base class for all of your models and override the set function. Something like this:

  var betassodel = DS.Model.extend ({set: function (keyName, value) {var ret = this._super.apply (this, argument); var properties = Ember.get (this.constructor, 'attributes'); if (attributes [keyName]) {this.trigger ('attchangeChanged');} return ret;}}); After that, you can listen to changes in any of the attributes like this:  
  model.on ('attribute', 'function' (function } {});  

I think you can do anything like this in the case of a controller or similar object (although I did not test it):

 < Code> controller.extend (amber.miscellaneous, {modelPropertyChanged: function () {} .on ('model.attributeChanged')});  

javascript - Web Audio API, setting treble and bass -


I'm trying to learn how to use and how to fix our audio AP and I'm running into some confusion. / P>

In my project, I click on the link to see an old 1 9 82 of'm trying to replicate the functionality (Photo) < / P>

In this receiver there are separate dials for treble and bass control. I am going to deal with treble in this question. I'm sure I can understand the bass equivalent after being pointed in the right direction.

In an initialization function I make reference and filter nodes.

  Window.AudioContext = window.AudioContext || Window.webkitAudioContext; Context = new audiocontent (); Source = context.createMediaElementSource (document.getElementById ('audio')); GainNode = context.createGain (); // filter nodes bassTurnoverFilter = context.createBiquadFilter (); TrebleTurnoverFilter = context.createBiquadFilter (); LoudnessTrebFilter = context.createBiquadFilter (); LoudnessBassFilter = context.createBiquadFilter (); TrebleLevelFilter = context.createBiquadFilter (); Basel Filters = Reference.CreatebiquidFilters ();  

I am currently using to control the dial. Dial work and when the dial starts from 0% to 100% I can get a limit for the "treble" variable between 0 and 1.

Dial is currently MouseMove function I'm using to treble:

  .on ( "MouseMove", function (event) {var Double = (event. target.rotation + 140) / 280, if (trebleLevelFilter undefined ==) {trebleLevelFilter !. disconnect ();} source.connect (trebleLevelFilter); trebleLevelFilter.type = "highshelf"; trebleLevelFilter.frequency.value = 200; trebleLevelFilter. Gain.value = treble; trebleLevelFilter.connect (context.destination);});  

My question is, or multi-part question ... 6 Which of the 6 types should I use? ( "lowpass", "highpass", "bandpass", "lowshelf", "highshelf", "allpass" "growing", "Mark",) I It is estimated that it is highpass or higher.

What frequency should I set?

What movement should be on when the dial is turned on? What is the price?

Am I going completely in the wrong direction?

I have the benefit. The value is set on the triple variable value, and it seems that this volume is increasing 100% ... but I do not think this is the right functionality which I am trying to accomplish.

I'm not sure why you are making six different filters - you only have two, treble For one more bass is a must.

I Think that H.K. Seeing there is no midrange control - which is a bit awkward, but okay. The possibility of bass filter is less shelf, and the treble is a high shelf; Remember what the cutoff frequency is for each button control, the shelling filter is flat response on zero profit - you can play with the filter to see how they will look. Select a low shelf, freq = ~ 200, and then play with the edge. Of

So, for example, you close with a triple filter, "treble" and "bass" gain values ​​shouldn except 'to T [0,1] - it [-makson + Maksgen] Should go between. "MaxGen" is probably 2-3? You have to play with it and choose a good category - I do not know that in the HK manual () It is also quite important to connect the filter in series, not parallel (otherwise you will have phase problems).

  // If the treble = 0 and bass = 0 you will have a flat response basfilter = reference. Cracketbiquidfilter (); Basfilter. Type = "loose"; Basfilter.fuquency.value = 200; // UI bassfilter switches gene from 400. Value = bass; // You will also need to hook the UI to trebleFilter = context.createBiquadFilter (); TrebleFilter.type = "highshelf"; TrebleFilter.frequency.value = 2000; // up to 6000 switches filter gear in UI Treble Value = treble; // You should also hook it to the UI. Connect (basfilter); BassFilter.connect (trebleFilter); TrebleFilter.connect (context.destination); In addition, there is no reason to disconnect the filter and reconnect it - you can make live changes in gain.value when adding it. 


php - How do you make javascript echo all the data whilst in a SQL while loop? -


So im trying to do a timer for my script but it only calculates the final result instead of all of them The results that come back from the query, show a countdown to the end result. Any help would be appreciated. Thanks

  & lt ;? Php $ q = $ handler- & gt; Prepare ("SELECT * FROM pending_payments WHERE user_id =? And condition =?"); $ Q- & gt; Bind para (1, $ session_id); $ Q- & gt; Baidam Parm (2, $ pending); $ Q- & gt; Executed (); If ($ q-> gtk gt; punctiquity () & gt; null) {? & Gt; & Lt; H4 class = "title" & gt; Pending payment & lt; / H4 & gt; & Lt; Div squares = "squiggly-boundary" & gt; & Lt; / Div & gt; & Lt; Table class = "table-table-index" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; # & Lt; / Th & gt; & Lt; Th & gt; Item & lt; / Th & gt; & Lt; Th & gt; Finishing up & lt; / Th & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt ;? Php while ($ r = $ q-> Fetch ()) {$ pending_payment_id = $ r ['id']; $ Pending_item = $ r ['item']; $ Pending_expiry = $ r ['termination']; ? & Gt; & Lt; Script type = "text / javascript" & gt; Var calculus = & lt ;? Php if ($ dateUNIX & lt; $ pending_expiry) {echo $ pending_expiry - $ dateUNIX; }? & Gt ;; Var counter = set interval (timer, 1000); // 1000 will run every 1 second function timer () {count = count - 1; If (calculation == -1) {clear interval (counter); Return; } Var seconds = Count% 60; Var minute = Math. Floor (count / 60); Var hours = Math.flur (min / 60); Min% = 60; Hours% = 60; Document.getElementById ("Pfephimer & lt ;? php echo $ r ['id']? & Gt;"). InnerHTML = hours + "hours" + minutes + "minutes"; // clock for spelling}} & lt; / Script & gt; & Lt; TR & gt; & Lt; Td class = "text" & gt; & Lt ;? Php; Echo $ pending_payment_id; ? & Gt; & Lt; / TD & gt; & Lt; Td square = "text" & gt; & Lt ;? Php echo $ pending_item? & Gt; & Lt; / Td> & Lt; Td class = "text" id = "pIfimer  & Lt; Td square = "text" & gt; & Lt; A href = "pending payment & lt ;? php echo $ r ['id'] ;? gt;" & Gt; & Lt; Button class = "BTN BTN-Success BTN-X" & gt; Proceed to pay & lt; / Button & gt; & Lt; / A & gt; & Lt; / Td> & Lt; / TR & gt; & Lt ;? Php} echo '& lt; / Tbody & gt; & Lt; / Table & gt; '; }? & Gt;  

Javascript functions are variables that execute some code, so basically the function Instead of making every row, the function you are working on is updating the function to track only the last element.

We should be clear from those places where each language works, PHP produces your HTML in the server, the HTML is parsed, the browser is executed in browser and client (client side) after that JavaScript is done.

It is being said, the best way to solve this is that you should store the data in HTML as a special data attribute, with the element of each row, retrieving it with Javascript , And then finish the one time that updates all the elements at the same time.


python - Appium multiple clicks no longer working -


I update API for version 1.3.6 today and for that part of my tests where multiple clicks are used is no longer working. I basically have an element that I want to click three times, like I would double click.

This is the code that was working before the update:

  Some_element = self.driver.find_element_by_name ('some_element') some_element.click () some_element.click () Some_element.click ()  

In an attempt to find out why it does not work anymore, I used to command embedded print between clicks and it was seen that being registered by three clicks applications Is not happening fast.

I found a solution, click instead of click:

incorrectly:

  some_element = self.driver.find_element_by_name ('some_element') some_element.click () some_element.click () some_element.click ()  < / Pre> 

Correctly:

(from epi.bb.re.re. touch_action import touch action)

  some_element = self.driver.find_element_by_name ('some_element ') Triple_click = To calculate UchAction (self.driver) # parameter parameter element, x-offset, y-offset, and triple_clicktap (some_editment, 0, 0, 3)  

jquery - return multiple value from function back to call -


I'm a noob ... and I'm sure what I'm trying to ask (better terminology) callback ?) But basically I want to know how to get calcuted values ​​in a function from which the function was called eg:

  $ (function () { SetValues ​​(); console.log (val1, val2, val3);}); Function set value () {var val1 = 10; Var Val 2 = 20; Var Val 3 = 30; }  

Try something like this:

  $ (Function () {var myvalues ​​= setValues ​​(); // stores the values ​​derived from these functions / you can now get some first value such as console log (myvalues.value1)}) ; Function set value () {var val1 = 10; Var Val 2 = 20; Var Val 3 = 30; Returns {value1: val1, value2: val2, value3: val3} // This data sends back the original location, where you called the function}  

I would suggest reading


php - Load Google ReCaptcha Without Composer -


PHP libraries usually provide installation instructions on how to incorporate their resources without relying on the music director. However, there are installation instructions for using only the musician, and I find it hard to find out how I can incorporate a library using another conventional method.

Can anyone please tell me how can I know about it? Thanks!

Why do not you want to use the musician, except this issue, I see two options For:

First clone the repository in your project and delete the version control information. (Alternatively you can use a git submodule or subtree).

  cd myProject git clone https://github.com/google/recaptcha.git CD Recap! RM -RF.git  
  1. Required each file individually

      $ recaptchaBase = '/ path / to / myProject / recaptcha / src'; Need_once $ recaptchaBase '/ReCaptcha.php'; Need_once $ recaptchaBase '/RequestMethod.php'; Need_once $ recaptchaBase '/RequestParameters.php'; Need_once $ recaptchaBase '/Response.php'; Need_once $ recaptchaBase '/RequestMethod/Post.php'; Need_once $ recaptchaBase '/RequestMethod/Socket.php'; Need_once $ recaptchaBase '/RequestMethod/SocketPost.php';    

    Then include it with your script:

      

    Need_once '/path/to/myProject/recaptcha/vendor/autoload.php'; In Law 2 you need a composer to create your own loader initially, but you do not need to rely on it for your entire app.

  2. >

jquery - Wrap text of one col to another col with an image in bootstrap -


I have a line and two kernel bootstraps, with a text block and with another image, but I want to The text wrap around the image, but I can not, it shows that 2 kernels have been divided. Less than basic, this is html:

  & lt; Div class = "row" & gt; & Lt; Div class = "colonel-LG-6 kali-MD-6 CO-SM-6-tomorrow-XS-12" & gt; & Lt; P class = "fecha-noticia" & gt; & Lt; Img src = "images / calendar-orange.png" class = "img sensitive calendar orange" alt = "responsive image 10" /> From 28th October 2014 & lt; / P & gt; & Lt; P class = "sumario" & gt; AJ Extramadura en La 56 Janard Corbesbase for Gran Presentation & Lt; / P & gt; & Lt; P & gt; Durante la inauguración, Maria Angeles Muñoz, consejera de Empleo, Mujer y Política Social del Gobierno de Extremadura, ha asegurado que "el Gobierno de Extremadura ha Trabajado Muy Duro Para que la RSE sea Una Realidad en la region, there Sólo siendo la Primera Comunidad Autónoma Q Hemos Derarolado a lei de Arsi (2010), that the "compact Comdom purse" which has been used for their promotions, & Lt; / p & gt; & Lt; p & gt; Munoz about relatives In order to give information about thirty of the RSE Sector was published as part of this information to bring any excluded homologoción of Accountants for financial information NA Aeplikeshian Oarsi La consejera de Empleo, Mujer y Política Social Avanzo que en breve "El Gobierno de Extremadura apoyará contratación D persona para la Integración de las RSE en la Empresa y que en el primer trimestre de 2015 el Consejo Autonómico de RSE aprobará La Primera strategy de Arsi D Akstramadura "& Lt; / p & gt; & Lt; p & gt; al Alkelde Day Bedujos, F. Ransisco Javier Fragoso, it is indicated that "we are responsible for all the responsibilities." Fragoso consideró que "la RSE en el case de Extremadura Ayuda a mejorar el Territorio Porque pymes act Las empresas, sobre, se implican con su desarrollo ". "You may be ready for RSE as a person responsible for the person responsible for you". & Lt; / P & gt; & Lt; P class = "lastp-single" & gt; El director de Fundecyt, Antonio Verde, aseguró que "promovemos La RSE Convencidos de que es un valor añadido para la Empresa y Sociedad" y que "Queremos service un referente en Extremadura en materia de Mprendianto, Inovashian RR SEC" After this the European Union participated with European countries. & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div class = "colonel-LG-6 kali-MD-6 CO-SM-6-tomorrow-XS-12" & gt; & Lt; Img class = "img-responsive" src = "picture / representacion.jpg" alt = "sight" /> & Lt; Img src = "images / compartir.png" class = "IMG-liability compartir" alt = "Responsive image 10" /> gt; & Gt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

JSFIDDLE:

Thanks.

combine columns, then do the following:

  .vision.pull -right {margin: 0 15px 15px; Width: 50%; }  


node.js - Prevent websocket flood loop -


I am developing an application that I use and nodes, the question is:

How can I protect myself from someone:

  var sockets = [] while (true) {sockets.push (new web site ("ws: // nodejsserver: port");}  

Is IP restriction possible only?

Thanks!

This is a security question. Repeat it again.

Do you prevent while (true) {htt P.request ('google.com');}

This DOS attack (violation of service) is called by flood with connection to the server.

Modern applications have to stop it.

  1. The browser does not allow more than 5 (?) To open connections with the same server.
  2. Something Some smart security dos and ddos ​​near cloud hosting providers (like CloudFlare, DigitalOcean, etc.).
  3. etc.

You try it for yourself And went to show us how it's done.


How to find the closest dates from MySQL table based on results of another SELECT statement -


I am trying to figure out what is a quick way to get the following results -

  • ID, calendar_date, my_value (some other columns are not relevant here) in Table 2
  • In the Table 2 ID, Event_date, (some other columns are not relevant here) / Ul>

    I want to write a query that selects all IDs and event_dates from Table 1, and table 2 for each event_date Sector is the get nearest Kailender_det like calendar_date event_date at least 30 days before the end, I would like my_value related Kailender_deta that meet your criteria.

    I hope it is clear that I am doing this because (event_date - 30 days) can not exist in Table 2, so it should return the closest available date.

    Even so I have done so far. This question works with hope, but I want to know that this is the fastest way to do this.