Tuesday 15 March 2011

sql - Conditional limit in mySQL query possible? -


I am facing a decree about handling threaded comments in our project ... I have a simple All the comments which have the MySQL table There are two types: Parents and children children represent one answer to one parent or another child.

My problem:

- Comment (depth 0)
- Answer Children (Depth 1)
Answer to previous child Give (depth 2)
-Tiping (Depth 0)

Imagine the structure above and a MySQL query with my Linux 2. This is the last answer (depth 2) Actually I say something like this Would you like to try: Limit up to 2, if the child does not go to the next parent. Tried many questions with no luck ...

What I have just followed is as follows:
Select from SQL_CALC_FOUND_ROWS * Comments where comment_post_id = '{$ _REQUEST ["id "]} 'Comment_id by ORDER, comment_date DESC serious 10"

Important table fields are:
comment_id (index) | comment_parent_id (note of guardian or null is _ID) | comment_date

I'm very grateful

MySQL does not have any ideas!

< P> Work to parse structures like a tree. In the simplest scenario (the child's parent has an ID), you can revisit the program in an introductory manner to find all the sub-nodes in a given node. Maxwellwell wants to point you to the depth it decreases with each recurring call so that you end up with 0, which will stop the recurrence.

For example (Pseudo-code)

  findNodes (string par EntId, int maxLevel) (select from * positions, where parent = parent underwork (results ...) {if (maxLevel & gt; 0) {findNodes (result.nodeId, maxLevel-1)} doSomethingWIthAResult}} To do this in a more concise way, there are several techniques, all of which are indexed in some way The path in which the path of the current post is included, the path may look something like this: TopNode: Child1: Child2: Child3 ... in which you can do such a selection * Choose from the posts where the path like "TopNode%" and Depth = 2. 


Am I reinventing the wheel? PHP/Mysql User reigstration and payment processing -


I'm about a php / mysql platform code that does the following:

  • Admin panel
  • PayPal payment processing
  • Paypal subscription handling through the API so that the user should not have a PayPal account

Is anything like that before Exists from what I can use?

If nothing is like this, then I'm going to refresh it in the Zend Framework, which I have never done before. If I go this route, then I do not want to search for some parts of what I am doing?

EDIT: Certainly this should be posted first:

Why do I need this forum just a basis for me to create a PHP web-based business application For customers who have to use monthly subscription. I'm looking for something very lightly, it's the only platform to register and manage membership and payers, not on the entire website. It will not have a store in an Oscars meaning.

Integrate with an Object-Oriented PHP5 Framework Engineer from PayPal to Website Payment Pro API Easily To do DoDirectPayment, SetExpressCheckout, GetExpressCheckoutDetails and DoExpressCheckoutPayment in only 3 rows or less.


optimization - PostgreSQL: How to optimize my database for storing and querying a huge graph -


I am running PostGrace SQL 8.3 with 1. GHG RAM and 1.83 GHz Intel Core Duo Mac Mini with Mac OS X 10.5.8 . . I have stored a huge graph in my PostgreSQL database, which has 1.6 million nodes and 30 million edges. My database schema is similar:

  Make Table Nodes (ID Integer Primary Key, Title VARCHAR (256)); Create table edges (ID integer, link integer, primary key (id, link)); Create index id_idx current edges (ID); Create index link_idx Create edges;  

Data is visible in table edges

  ID link 1 234 1 88865 1 6 2 365 2 12 ...  

So it stores the ID for each node, which is the link to exit from id y.

The time to find all outgoing links is fine:

  = # Analyze select links from edges where id = 4620; Question Scheme ------------------------------------------------ --------------------------------- Index scan ID_idx on edges (cost = 0.00..101.61 rows = 3067 width = 4) (real time = 135.507..157.982 rows = 1052 loops = 1) Index Conduit: (id = 4620) Total runtime: 158.348 ms (3 lines)  

However, if I come Searching for links in the node, the database is 100 times slower (although the resulting number of incoming links is only 5-10 times the number of outgoing links):

  = #in Analyze identity ID from where the link = 4620; Question Scheme ------------------------------------------------ ---------------------------------- Heap scan on bitmap edges (cost = 846.31..100697.48 rows = 51016 width = 4) (real time = 322.584..48 9 83.478 lines = 26887 loop = 1) Check again: (link = 4620) - & gt; Bitmap index scan link_ idx (cost = 0.00..833.56 rows = width of 51016 = 0) (real time = 298.132..298.132 rows = 26887 loop = 1) Index link: (link = 4620) Total runtime: 49001.936 MS (5 lines ))  

I tried not to use PostGrace with a bitmap scan

  = # set_autm_mapscan = false;  

But the speed of the query for the incoming link did not improve:

  = # Select ID from the edges where the link = 1588; Question Scheme ------------------------------------------------ ------------------------------------------- Using link_idx on index edges Scanned (cost = 0.00.4.4777.63 rows = 1143 width = 4) (real time = 110.302..51275.822 rows = 43629 loop = 1) Index link: (link = 1588) Total runtime: 51300.041 ms (3 lines) < / Code> 

I have increased my shared buffers from 24MB to 512 MB, but this did not help, so I wonder if the outgoing and incoming links My query to show an asymmetric behavior of this kind? Is anything wrong with indexed my choice? Or would I want to make a node with an ID ID better by creating a third table for all incoming links? But this would be quite a waste of disk space. But since I'm new to SQL Database, maybe I'm missing something fundamental?

I think that's right.

You can use it after filling the table. Now the second query should be sharp, and should be slow down first.

To keep both questions fast, you must denormalize using a second table, as you have proposed. Just remember the cluster and analyze this second table after loading your data, so all the examples associated with the node will be physically grouped.

If you will not be able to ask it all the time and you do not want to store and back up this second table, you can make it temporarily before you can inquire:

  Create a temporary table eg_des_backwards as the link, from the order of the edges ID; Create index edges_backwards_link_idx on edges_backwards (link);  

You do not need to cluster this temporary table, because it will be ordered physically directly on creation. This does not make any sense for a query, but can help for many queries in one line.


Azure CTP signup -


I am trying to signup in the Ezore CTP but the whole process is looking for real non user friendly. This web page gives me a link to get a token, but when I click it does not appear to do anything it takes me to another page but I do not know whether the token was sent Or I have to do something else

On the Microsoft connect's dashboard, it tells me that what is my position in Ezur 'Participating', what does that mean? I am not participating because I do not have tokens. The whole process is very disappointing!

Is it possible to contact a real person?

It looks like you've already submitted a request for a token. I tried to sign up a week ago and I have not got anything yet. However, I have received my SQL Exxoor license and it is working well.

Besides, you are perfectly right, their website is messy and things are very difficult to understand. I hope they will clean it soon!

And I do not think they have any support setup.


How to handle script timeout error in classic ASP? -


In my classic ASP application, I am trying to generate web reports that are more than 7K and 14K records, but this "script timeout" error after 10 to 15 minutes

IIS setting is already The default value is more than that. And I have also written the following code in the personal page:

    

Please suggest me how to manage it.

You can not create an app that hangs up to 15 minutes by thread for HTTP requests Are there. It is destined for failure, no matter whether you should request a report to the people, prepare it in the background and inform the user that the report is still progressing / prepared by email or / or queue.

To support this, you will need to edit the user's registry:

This is not just a good design.


oop - Php abstract class site configuration -


I have a config class which is an abstract class. I want to set it so it automatically detects it That's what the server on the site and then assigns the appropriate constant. Let me line ten $ this-> hostName = $ _SERVER ['SERVER_NAME']; What is the correct way to do this rather than 'T_FUNCTION' and what is the better way to do it? Here is the first part of my class

  Abstract class config {public $ hostName; Public $ hostSlices; Public $ domain; Copy $ _SERVER ['SERVER_NAME']; // Exits "www" by the server name, but only then does it have the name $ -This-> Hostname = $ _SERVER ['SERVER_NAME']; $ This- & gt; Hostslites = Explosions (".", $ This-> Hostname); If ($ the-> hostSlices [0] == "www") {array_shift ($ this-> hostSlices);} $ this- & gt; Domain = join (".", $ This-> Hostslips); // Depending on the usage of this domain, different configuration setup is used. Switch ($ this- & gt; domain) {case "localhost": * / const HOST = "localhost"; // will http: // localhost / work also In that case, then this and SITE_ROOT can be the same variable and I can set them primarily on the basis of the host that the site is running Const. USER = "root"; Const. PWD = "xxxxxxx"; Const NAME = "hurunuitconz"; // database name // public $ name = "hello from config class"; // You can not access the variable from an abstract class, which you should define constants and then can be used anywhere #### ####### The location of the file groups ###### ## const SITE_ROOT = "http: // localhost"; Const ADMIN_IMAGES = 'http: // localhost / images / user_images / admin_images'; break; Case "charles.hughs.natcoll.net.nz": const HOST = "charles.hughs.natcoll.net.nz"; // will also be http: // localhost / work as well. In that case, then this and SITE_ROOT can be the same variable and I can set them primarily on the basis of that location on the site that the site is current Const USER = "Charles_Andrew"; Const. PWD = "xxxxxxx"; Const NAME = "charles_hurunuitconz"; // Database Name ########### Status of File Groups ######## const SITE_ROOT = "http://charles.hughs.natcoll.net.nz/ _Assignments/Indo/World "; // It is just the way natcoll confuses us in doing this. Const ADMIN_IMAGES = 'http://charles.hughs.natcoll.net.nz/_Assignments/Industry/www/images/user_images/admin_images'; break; }  

An abstract class should not allow you to set personal data (only one Heritage concrete square).

Also, take a look at the stack overflow for an interesting discussion on SERVER_NAME vs. HTTP_HOST

.

php - Preg matching and counting the resulting match in a short string -


I have a function that calculates the number of items in a string ($ paragraph) and tells me how many results There are letters, that is, spoon and spoon present 7, I can use it to complete the percentage of the string.

I need to reinforce it with preg_match because 10tsp should be calculated as 5.

$ letters = stellon ($ paragraph); $ Items = array ("toss", "tbsp", "tbs"); $ Count = 0; Calculate the number of formatting in foreign currency ($ item $ items) {// parameter $ countitems = substr_count ($ paragraph, $ item); $ Countlength = (strlen ($ item) * $ countitems); $ Count = $ count + $ countlength; } $ Composite = (($ 100 / $ character) * $ count);

I know that something like preg_match ('# [d] + [items] #', $ paragraph) will be something correct?

Sorry for the curve ball edit but there can be a place between numbers and $ items, can an example hold preg_match?

It's not quite clear to me that what you're trying to do with regex, but If you are just trying to match for a particular number-measurement combination, then it may help:

$ count = preg_match_all ('/ \ d + \ s * ( Tbsp | tsp | tbs) / ', $ paragraphs);

This will return the number of times, where a number-measurement combination occurs in the $ paragraph .

EDIT

  $ paragraph = "5tbsp and 10 teaspoons"; $ Charcnt = 0; $ Matches = array (); {Preg_match_all ('/ \ d + \ s * (tbsp | tsp | tbs) /', $ paragraph, $ matches) & gt; {foreach ($ matches [0] $ match) {$ charcnt + = Strlen (match $); }} Printf ("Total number of characters:% d \ n", $ charcnt); 


Error deleting project in TFS -


I created a "test" project that I want to delete using the following command: TfsDeleteProject / server: xyz \ sqlserver2008 Receiving this error "Test": TF30076: You can not solve the name of the typed server or the Uniform Resource Identifier (URI), xyz \ sqlserver2008, Team Foundation Server if you type the name of a server Match it with the name that is typed in the Embedded Team Foundation Server dialog No need. If you type URI, then it should use the following syntax: http [s]: //: The server example is valid. (TFS is an app level and DB is on separate boxes) but what can be done?

xyz is the server name eht, sqlserver2008 db example, for example i access dbname using xyz \ sqlserver2008 using the SQL Server Management Studio Client app.

Specify full server URI in which http: // and: port include these error numbers in MSDN watch too.

EDIT: Follow the first link, Andrew posted, where I found my information :)


php - How to extract an email address from multiple text files -


I have approximately 96 text emails for which I want to remove the sender's address. I believe that I can do this for domdoc I can use, but someone needs to start me Can someone please advise that there is a better way of doing this?

Thanks, Jim

There is no reason for PHP to do this. .. files are in some form of flat text, copy the file (s) (for example) email / directory, then

  cat * | Grep "From:" | Egrep -oi '\ b [A-Za-z0-9 ._% -] + @ [A-Za-z0-9 .-] + \. [A-Za-z] {2,4} '| Sort | Uniq & gt; Mail.list  

If you do this in PHP

  1. Copy file / mail to a directory < / Li>
  2. Get the list of files
  3. Read the file
  4. Split the header into a different string
  5. Two an email address on this string To find and put it on $ email_arr
  6. , array_unique () on $ email_arr.

bash - identify error in if statement -


This is a complete code ..

What am I trying to do ->

I am trying to find the average of values ​​in the second column of files. If the file has 2.54 names in it, then I want to get the file from average in files related to the file. File 054_even.xls and file_2.54_odd.xls. If there is no 2.54 on the name of Faynm, then just the average of the file is revealed. For example: file_1.60.xls

  #! / Bin / bash file in pmb_mpi tau xhpl mpi_tile_io fftw; For 2.54 1.60 800, if $ $ {f} = "2.54"] then $ {file} _ $ {f} _even_v1.xls esk 'yoga = $ 2; Ed {print "avg =", $ sum / nr> $ {File} _ $ {f} _avrg.xls} '$ {file} _ $ {f} _even_v1.xls resonant $ {file} _ $ {f} _odd_v1.xls awk' sum + = $ 2; END {print "average =", $ yoga / nr> gt; $ {File} _ $ {f} _avrg.xls} '$ {file} _ $ {f} _odd_v1.xls else echo $ {file} _ $ {f} _v1.xls awk' sum + = $ 2; END {print "average =", $ yoga / nr> gt; $ {File} _ $ {f} _avrg.xls} '$ {file} _ {f} _v1.xls foo  

Because your awk command is inside a single quotes, the shell variable file and f will not be be extended. That's why you are getting awk errors.

I will use the following script:

  #! PMBMP Tau XHPP MPI_Tile_OFFTV for file in / bin / bash; 2.54 For 1.60 f; If [[$ {F} = "2.54"] ;; Then flist = $ {file} _ $ {f} _even_v1.xls $ {file} _ $ {f} _odd_v1.xls and flists = $ {file} _ $ {f} _v1.xls fi $ {flist} | Awk 's + = $ 2; $ {File} _ $ {print "average =", $ s / nr} '& gt; Use $ {file} _ $ {f} _avrg.xls # or awk ... '$ {flist} & gt; F} _avrg.xls # If you are very worried about the efficiency of the procedures  f   2.54      < / Code>    / code> or not, then push the list of files through a single  awk  script. 


c# - Maintaining xml hierarchy (ie parent-child) information in objects generated by XmlSerializer -


For some time now I am trying to solve the following problem and I am starting to run away from ideas:

I have prepared a set of C # classes using Xsd.exe tool from XSD schema and dysfunctioning xmi files works fine. The problem is that besides the convenience and security of using auto-generated classes, I need information about the XML hierarchy, that is, I need to establish parental relationships between objects created during deserialization. Note that I want to avoid keeping a separate XML hierarchy structure (like a DOM tree), but keep track of the generated objects to keep track of your parents and children.

I have been able to shut it down in JAXB:

  1. Define a common base class for all deserialized objects in this base class And the reference to the guardian object (if any) are included.

  2. Using Unmarshaller. Listener Functionality Provides Callback on Full Object Deserialization This callback recently provides a reference to the parents of the deserialized object, which establishes maligning the parent's relationships.

How do I do this in C #? I have taken a look at the MSDN docs and made many goalkeepers, but there is no useful information available.

I wrote about this article some time ago, maybe it can help you.


linux - Display socket options -


How can I see from the shell how the socket options are set? Especially I find it interesting to know if SO_BROADCAST is set up?

You can use if the PID is the process id and < Code> FD is a file descriptor number of the socket of your interest, so you can:

  LSOF-A-P PID-D FD-T F /  

To list all IPv4 sockets of a process:

  LSOF-A-P PID - I 4 -T f  

this will print the socket option with a SO = , other go Note the officer that you do not set any options, you will be an empty string, so you'll see something like SO = PQLEN = 0 etc. To test for SO_BROADCAST , just type SO = after the string SO_BROADCAST for grep, for example

  If lsof -a -p PID -d FD-T f | Grep -q 'SO = [^ =] * SO_BROADCAST'; So #Socket is SO_BROADCAST and #, it is not  

oracle - How to insert data in partition table which is not defined in partition? -


Anyone can tell me how to insert data into the partition table, which is not satisfactory to the condition of the partition.

You will get an error of ORA-14400:

  SQL & gt; ; Table T (id number) 3 by 2 range range (id) (split T1 value at least (100), 4 percent less than T2 values ​​(200) 5); Table sql and gt; Insert T values ​​(1); 1 line sql and gt; Put it in T values ​​(201); Insert in T values ​​(201) ~ ORA-14400: The split key entered does not map any partitions  

To avoid this, you low THAN (MAXVALUE) < / Code>:

  SQL & gt; Rank 3 (less than the T1 values ​​of less than (100), less than 4 part T2 values ​​(200), 5 part tmax values ​​(MAXVALUE) 6; Created table  

c# - Database operation via Threadpool or Asyn programming -


I have a database with a large number of records. (Database value is updated through a webservice)

Each record / line type (ID, xmlfilename, operation, parameter, operation ID, status) means that the parameters of the operation specified by "parameter" With "xmlfilename" as specified in the 'xmlfile' operation as 'operation.' The part of the position is "intially" free as updated as reqd.

I want to use these (each line) operation threads .. The number of entries per 'id' per one thread. As long as there are 'id' rows in the DB bringing and "operation"

How can I do it efficiently with maximum equality and / or concurrency.

Is there any better way?

What is the best Threadpool or Custom Threads or ASIN programming?

Edit added: Here is the pseudo code that I tried

  string operation id = zero; While (operationId = DBWorker.getNextFreeOperationId ()) // How do I check this? Another query? Unless the position is operated with "Free" /, select Operation / Note DB. Updating Asynchronous {// Operation Id = Get all the rows with Operation ID eg: 800 1 thread / qid ??? ? And // condition = "free" ... // There are several operations with the same operation IDS DataRowCollection dbRows = DBWorker.retrieveQueuedEntries (operationId); MyWorkItem workItem = New DBWorker.MyWorkItem (); WorkItem.DataRows = DBRO; WorkItem.Event = new AutoResetEvent (wrong); //MyWorkItem.DoWork will require "Operation" ThreadPool.QueueUserWorkItem (New WaitCallback (workItem.DoWork), workItem); } -------------- MyWorkItem.DoWork (obj x) {// Summary for each DataRow row in this. DataRows {performOperation (line); // Usage line ["Operation"] ..} --------------- Display Bool Operation (date line) {string operation = (string) row ["operation"]; // Recover the other similar switch (operation) {Add Case Operations: // Add call operation .. ...}} ------------  

Using Code 2.2.0 .. does not receive multithreading .. The scenario may be that the database is updating asynchronously from one end, while the above code is running as a window service at the same time Will happen.

thx
Amit

If you do not use .NET 4.0 Use Threadpool - I'll create a function that will get the line (if you change the rows, it would be better to type correctly for typed objects), and what to do with it -

  Using the system; Using System.Threading; Namespace SmallConsoleAppForTests {Class Program {Personal Static AutoResetEvent [] Events; Fixed zero main (string [] args) {int dataLength = 3; // Processing AutoResetEvent [] Events = New AutoResetEvent [dataLength] that has been made to create an array of AutoResetEvent; // Start the AutoResetEvent array in "no-set" values; For (int i = 0; i & lt; data lenthheth; i ++) events [i] = new autorsecurity (falls); // Processing for data (Int i = 0; i & lt; data length; i ++) {var data = new MyWareIT {event = events}, data = new MyDataClass ()}; Try ThreadPool.QueueUserWorkItem (x = & gt; {var dataItem = (MyWorkItem)}} {// Process on Data} {Exception E} {// Exception Handling} Finally {workItem.Event.Set ();} }, Data); } // Wait until all threads are finished. Wait. Wait (all); }} Public class MyWorkItem {public AutoResetEvent event {get; Set; } Public MyDataClass data {get; Set; If you are using .NET 4.0 - Check in Tasks and Parallel Extensions  

You can also use DatRov for public class {// data // }}

/ P>


functional programming - Clojure: How to create a function at runtime -


I want to generate a fn entirely on the sequence (i.e. name and RGR symbols are ordered in sequence, Not in code) What is the best way to achieve this?

How can I implement the following functions?

  (defn gen-fn [name arg-symbols body] ... ...  

will be used like this:

  (Jean-FN "my-throw-name" (symbol "x") (symbol "y") (println "this  x =" x ")  

Note that the name, arg and body of the function are not coded, but the runtime can be decided

  (defn gen-fn [n as b] (let [n (symbol n) (vec as the map symbol)) fn-  

Some more uses:

 

Code> User => (Jean-F N "EFU" ["X"] '(print (XMP)) (printline (Ink))) #' User / FU user => (FU5) 5 6 void

However, I do not really like this approach. It really works harder: eval Why do you want to make global in runtime? On growing namespace and other ugly hiccups on the horizon. ..


c++ - Is it OK for an abstract base class have non-abstract methods? -


In an abstract base class (interface class) it usually has all its function summary. However, I have many such issues Where the member who calls the intangible methods of the interface works. I can apply them to a derivative-only-still intangible class, or I can implement methods in the form of non-abstract, non-virtual methods of the interface class.

Is any problem implemented according to the design design in the interface class?

For example

  class IFoo {Public: Is this a bad style, and if so, why?  

Virtual ~ IFoo (); Virtual Double Calc (InputType p) const = 0; Virtual Double CalThat (Input Type P) const = 0; Double calcefructure (Inup type P) {calce it (P) / calcite (P); } Fixed BarType Bar (InputType p); }; Class MyFoo: Public IFoo {Public: // IFoo virtual double calc it (InputType p) const; // IFoo virtual double calceat (InputType p) const applies; };

vs

  class IFoo {public: virtual ~ IFoo (); Virtual Double Calc (InputType p) const = 0; Virtual Double CalThat (Input Type P) const = 0; }; Class FooBase: Public IFoo {Public: Virtual ~ FooBase (); Double calcefructure (Inup type P) {calce it (P) / calcite (P); } Fixed BarType Bar (InputType p); }; Class MyFoo: Public Phobbs {Public: // IFoo Virtual Double Calc It (Input Type P) CONST; // IFoo virtual double calceat (InputType p) const applies; };  

if you call it an interface (i.e.) Which you seem to be using your naming convention "IFU"), then it should not be a pure interface (no implementation).

If this is only an abstract class, then the combination of pure virtual and implemented methods is absolutely reasonable.


Using a C++ dll in C# -


I am trying to consume a DLL written in the C # application from C ++. For C ++ DLL (Cyclone Physical Engine) I have 3 party source code and manually do not want to turn it off at C #.

In the C ++ project
I changed it to DLL output. I changed it to use the CLR flag I changed it to use multi-threaded debug DLL (/ MDD) because it is only one / compatible with CLR and also compiled.

In C # Project I added a reference to DLL. I am using a cyclone namespace.

At first there was nothing under the namespace. I think this is because in C ++ code, all classes were declared no access modifiers and default is private. Therefore, for this class "particle" I have changed this definition:

  public square particle {// ...}  

I have successfully changed Types of particle types from C # code However, the intellesense and object browser report declares a bunch of methods after having a struct (?) And there are no ways in it. C ++ code after "public": "Access modifiers so I do not know the problem What is it."

For example,

  public: zero integrated (actual duration);  

What am I doing wrong?

The particle class is not a managed class, so it is considered as a structure, it is ref To use keywords, it needs to be managed and collected for garbage collection. You also have to do it for every other class which gives context which can be a problem. The best solution I think, is to create a managed wrapper class which internally uses particle orbits. This wrapper class can then be referred to by .net.

See:


Inversion of Control or Dependency Injection -- anyone doing it in C? -


For example, see here

to remind yourself For that IoC and

the questions and answers are here

Suggestion that he does not need oo language.

Now, my question: is anyone doing this in C?

I am asking because we write embedded C and are considering implementing these methods without changing our programming language.

The signal to do this all the time in C is given in the reply given to Eder in your second link:

"When you give a Windows API function an indicator for the callback function, you give them control of the call with your parameters in your function."

This approach From, the concept has been used previously in the standard library for functions in qsort () and bsearch ().


jquery - .ajax will not POST, but will GET with no problem -


I am trying to submit a form using jQuery's .jax () function. It seems that it should be very easy, but for some reason I can not find: "Post" to use the type to work correctly: "GET" is not a problem, but in fact " Post "does not post anything to accept my PHP PHP script. When I do a print_r ($ _ POST), I give an empty array that I have tried to use both input type and input "input" on the input of input but it does not seem to change anything

Edit for clarification
If I do this, print_r ($ _ GET) when I use Type: "GET", it prints all the correct data But if I change the ".jax" option to type: "POST" and print_r ($ _ POST) Try it, it shows an empty array, no content.

JS code:

 var dataString = 'reply_text =' + test + '& post_id =' + post_id; $ .ajax ({type: "post", url: "process.fp", data: datestring, cache: incorrect}); return false; 

Form Code:

 & lt; Form action = "" method = "post" & gt; & Lt; Textarea id = "textboxcontent" name = "reply_text" /> & Lt; Input type = "submit" name = "reply_submit" value = "submit comment" /> & Lt; / Form & gt; 

This can work better:

  var text = .. var post_id = ... $ .ajax ({type: 'post', url: 'process.php', data: {reply_text: text, post_id: post_id}});  

php - Memcache Vs. Memcached -


संभव डुप्लिकेट:

कोई मुझे PHP वातावरण में Memcache और Memcached के बीच अंतर समझा सकता है? दूसरे पर एक के फायदे क्या हैं? क्या आप यह भी सुझाव दे सकते हैं कि एक या दूसरे के बीच चयन करने के लिए क्या इस्तेमाल किया जाने वाला मापदंड?

(आंशिक)

मुझे लगता है कि दोनों कार्यात्मक रूप से एक ही हैं, लेकिन उनके पास अलग-अलग लेखकों की है, और एक को दूसरे से उचित रूप से अधिक नाम दिया गया है।


यहां नामकरण सम्मेलनों में एक त्वरित पृष्ठभूमि है (उन अपरिचित लोगों के लिए), जो प्रश्न पूछने वाले की हताशा को बताता है: कई * निक्स ऐप्लिकेशन के लिए, जो बैकएंड काम करता है वह टुकड़ा "डेमन" (विंडोज-भूमि में "सेवा" लगता है), जबकि इंटरफ़ेस या क्लाइंट एप्लिकेशन है जिसे आप डेमॉन को नियंत्रित या एक्सेस करने के लिए उपयोग करते हैं। डेमन को अक्सर क्लाइंट के समान नाम दिया जाता है, जिसमें उस पत्र को "d" जोड़ा जाता है। उदाहरण के लिए "आईएमएपी" एक ऐसा ग्राहक होगा जो "आईएमएपीडी" डेमन से जुड़ता है।

इस नामकरण सम्मेलन को स्पष्ट रूप से मेमकाश द्वारा पालन किया जा रहा है, जब आप मेम्काशेड मॉड्यूल के परिचय को पढ़ते हैं (memcache के बीच अंतर देखें और इस अंश में मेम्कैच):

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

PHP एक्सटेंशन के लेखक, जिसे बुरी तरह से मेम्कैच नाम दिया गया था, क्योंकि यह मेम्कैच नामक वास्तविक डेमॉन के समान नाम साझा करता है। सूचना भी है कि मेम्कैचड (पीएचपी मॉड्यूल) के परिचय में, यह libmemcached का उल्लेख करता है, जो साझा लाइब्रेरी (या एपीआई) है जो कि मेमिकैटेड डीमन को एक्सेस करने के लिए मॉड्यूल द्वारा उपयोग किया जाता है:

मेम्कैचड एक उच्च-प्रदर्शन, वितरित स्मृति ऑब्जेक्ट कैशिंग सिस्टम, सामान्य प्रकृति में है, लेकिन डाटाबेस लोड को कम करके गतिशील वेब अनुप्रयोगों को गति देने में उपयोग के लिए किया गया है।

यह एक्सटेंशन संचार के लिए एपीआई प्रदान करने के लिए libmemcached पुस्तकालय का उपयोग करता है Memcached सर्वरों के साथ यह एक सत्र हैंडलर (मेमकैच) भी प्रदान करता है।

libmemcached के बारे में जानकारी »पर पाया जा सकता है।


tsql - Diff b/w time in two rows in sql server -


I have a place where I need to compare time to two different rows, like this

Item_id Group Date 1 10 ABC 2008-03-07 03:02:00 1 35 BCD 2008-04-03 10:03:00 2 13 CD 2008-03-13 07:18:00 2 40 Seed 2008-03-13 08:41:00 2 44 CEF 2008-03-13 09:41:00

I have to find the time difference for row one line 2 - they fall under a cat ... and this is the continuation of it and cat 1

try it (recent Which has not been tested)

  Dated selection (day, TDAT, DDT) from diff @td Join @tt on de carrebad = T series and T. Atimid & lt; & Gt; D.itemid and datediff (day, t.date, d.date) & gt; 0  

text - Tokenize from a textfile reading into an array in C -


How can you find out when you read from a file in C

Textfile:

PES 2009; Kanami; DD3; 500.25; 6

Ascin cult; Ubisoft; DD; 598.25; 3

Inferno; EA; DVD 2; 650.25; 7

  char * tokenPtr; FileT = fopen ("DATA2.txt", "r"); / * This * / tokenPtr = strtok (file T, ";") will not work; While (tokenPtr! = NULL) {printf ("% s \ n", tokenPtr); TokenPtr = strtok (NULL, ";"); }  

Would like to print it:

PES 2009

Konami

.

Try it:

  main () {FILE * f; Four S 1 [200], * P; F = fopen ("yourfile.txt", "r"); While (fgets (s1, 200, f)) {

  while (fgets (s1, 200, f)) {p = strtok (s1, "; \ n"); Do {printf ("% s \ n", p); } While (P = Stroke (NULL, "; \ n")); }  

activerecord - Rails has_many through singular association -


This is probably quite simple, but I am still unable to wrap my head around the problem.

I have 3 tables ... (better than that), but 3 in this scenario is this thing.

Placement Bookings and Ratings

Places have_many bookings

Each booking has a rating (because the user only rates one time) and related_ from (A) Place < / P>

Ratings are related (A) Booking

So even though there is only one rating in the booking, places have locations due to ratings through booking, there are many more booking places too.

But does it seem to work? All the rest seem to be.

There is a place_ID in the booking and booking_id in the ratings, and I have been successful through all the other organizations ... is not it just? any idea? Thanks

Apart from this: If I change the booking to a hotmee: Ratings do this ... but booking will be a rating for only one booking ... so this is not a good thing.

  Invalid source reflection macro: has_one has_many: ratings, via = & gt; : Bookings. Use: Source  

is to specify the reflection of the source: medium: By means of joining this model ; See the following railway tickets for details:

  • If possible, the best solution is to modify your relationships. > Has_one instead of rating a booking related_to one rating.


    asp.net mvc - Event Calendar in MVC -


    I want to complete this functionality: Calendar's calendar pops up with calendar names written on the calendar in the calendar One day

    Please tell me where I will start

    thanks Ritz

    widgets You can make almost all calendars related to it.


    how to duplicate a mysql table along with data using phymyadmin -


    कैसे phymyadmin का उपयोग कर डेटा के साथ एक mysql तालिका डुप्लिकेट करना

      बनाओ टेबल को कॉपी करें का चयन करें मूल नाम से  

    PHPMyAdmin भी एक सपाट फ़ाइल में तालिका डेटा निर्यात करने के लिए अंतर्निहित कार्यक्षमता है।


    WPF ComboBox DropDown Placement -


    I have a content control that is on the right side of a button, partitions and a combo box from left to the combo box dropdown. I want to line up with the left side of the control as opposed to the left side of the boxbox. Documents can not be found on relative placements, etc. Has anyone dealt with this? TIA

    I did something before - I ended up with the combo box, taking part of the popup Control to control it and use it. Something like this ...

      class MyComboBox: combo box {public override zero OnApplyTemplate () {base.OnApplyTemplate (); Var popup = (popup) template.findname ("PART_Popup", this); Popup.placement = PlacementMode Custom; Popup.CustomPopupPlacementCallback = placePopup; } Private custom popup place [] place popup (size popup size, size target size, point offset) {var placements = new [] {new custom poppling ()}; Placements [0] Points = // status drop down here! Return placement; }}  

    c++ - WM_ENTERSIZEMOVE / WM_EXITSIZEMOVE - when using menu, not always paired -


    To prevent your application from changing window contents, when the user is moving around its window, I WM_ENTERSIZEMOVE / WM_EXITSIZEMOVE and I stop the application between messages. However, sometimes it happens that I get WM_ENTERSIZEMOVE but no WM_EXITSIZEMOVE not at all.

  • Click on the size
  • Instead of resizing the window, click on the window
  • WM_EXITSIZEMOVE not received notice.

    While examining how it works, I have also tested the Microsoft DirectX sample and I have seen the same problem. Once you have followed the revised steps above, the sample application appears to be frozen (I have now tried to do it with a basic HLSL sample from March 200 6 SDK).

    How is the application expected to react to this? Are there some other conditions that "transferring or shaping modal loop"

    Should end?

    I know that it's too late, but it still can help you - and there is a possibility to help other people to do it like I did.

    It seems that in the case you mentioned, a WM_CAPTURECHANGED message is sent when the resizing is "Canceled". After extensive testing it seems that it is always sent before WM_EXITSIZEMOVE (or should!), And there is no other stage between WM_ENTERSIZEMOVE / WM_EXITSIZEMOVE.

    The WM_CAPTURECHANGED message is also sent at several other times, so if you have sent a WM_ENTERSIZEMOVE message, you only need a response to it, but the following is not WM_EXITSIZEMOVE.


    iphone - How can I determine whether my UIButton's event is Touch Down? -


    How can I determine if my button's event is down?

    I want to do this as a function:

      if (users click on touchdown event) {NSLog (@ "a"); } And if (users click on Touchpinse Event) {NSLog (@ "B"); } 

    Ether You set up two different IBAction methods in Interface Builder or you have two different targets By determining:

    - (zero) addTarget: (ID) Goal action: Control events for (SEL) operation: (UIControll events) Control Avent

    button.


    Distributed DataBase with NeoDatis ODB -


    I am using Nodatis ODB database in my new system. Everything works fine, but I would like to create a distributed database.

    Does someone know how I can use the nodatis database (a database master server and their slaves in different computers)?

    You can view NeoDatis V2 which can be configured to run as a distributed database :


    version control - Sharing git between different users -


    I currently have a git setup where git is a user in my Linux box / home / git and / g / There are many git repositories in git: Git user has / usr / bin / git-shell if a user needs access to the repository, then I take his SSH DSA public and / home / git / it. Embed in ssh / authorized_keys and they will be able to work with the repository.

    The problem is now that I need a second repository which needs to support a different group of users. I do not want to create a new account for each repository I created.

    What is the best way to work with SSH? (The easiest way of all sharing techniques I have seen is that git supports)

    The main advantages are:

    • Only one SSH user (one can be damaged)
    • Users identified by SSH keys
    • Users on the fly using the GIT and repo were created

    ole - Why would an ocx control not register properly? -


    I am writing an app for which third party OSX control must be used in my INO setup script I include the line I am:

    Source: C: \ aPath \ aControl.ocx; DestDir: {AP}; Flags: Restart Location Shared File Reserves

    It seems that the control is registered, but the installed app tells me EOLSISR that the control is not registered while working in Win2000. Any ideas about what's going on here, or how to fix it?

    Thank you, as always!

    p.s I am working with admin level control I think that it is always necessary when an ActiveX control is registered. (Is this true?)

    If the problem is only on Windows 2000 but in subsequent OS versions No missing dependencies, such as DLL or other OCX files that are not part of the standard Windows 2000 installation, may be due to. Versions of the Microsoft Sea Runtime Library come to mind. You should use free to track these types of problems, copy it to the problematic machine and use it to open the OCX file, then any missing library entry points or libraries will be shown.

    You can also use the tool as a debugger to run your app. It will show a lot of information about loaded modules and similar stuff that can help solve the problem.

    And yes, you need an administrator or a power user account to register an OCX.


    visual studio - MSBuild AfterPublish Target -


    I have to copy a special file with the published output of my web project, I to content and change the to copy the code to the output directory. to always copy it works fine except that it is below it in a sub folder As is left in the project.

    I do not want to be buried in a sub-folder I want it to sit next to all the published outputs. I thought I could handle this problem by using the After Publish target instead.

    Can someone show me how I can do this? I think I would need to know the path that someone was selected in the published dialog. The publishing feature is unfortunately buried inside deep within the visual studio, due to this you can do the expansion of the process, what you can do is very limited Because of this That's not as simple as a simple task you've told here, at least from your project file If you need to get better control of your web deployment then I can suggest that you have a look and / or I will add it to a web development project, which will prepare your web app for deployment with this custom file copy. , And then allow MSDeploy to do actual deployment for you.


    java - what kind of data structure do i need to implement a hashlist for storing coordinates? -


    I need to create a status manager class, tell me if the situation is available.

    Tried to do this:

      Enter the code here  

    Public Class Status Manager {

      hashtable current positions = new hashtable (); Zero occupied post (int x, int y) {this.currentPositionsput (new integer ("4"), new integer ("5"); This.currentPositionsput (new integer ("1"), new integer ("5"); This.currentPositionsput (new integer ("11"), new integer ("3"); This.currentPositionsput (new integer (" 42 "), the new integer (" 55 "); This.currentPositionsput (new integer (" 11 "), new integer (" 53 "); set key = this.currentPositions.keySet (); // Setter.teater = keys.Director (); System.out.println ("The map contains the following teams:"); while (keyIter.hasNext ()) {Object key = keyIter.next (); // Next key Obtain object value = this.currentPositions.get (key); // Get the value for the key System.out.println ("(" + key + "," + value + ");}} Public static zero main (string [] args) {New position manager (.) Captured The post (3, 3);}  

    }

    Of course this is just an exam, which I try to do I am getting it all the same again, it is used again, the problem is that if I can not duplicate the keys, then what kind of data structure should I use? New? Thanks in advance.

    A collection of a set model object that can only be done once a map structure key / The value stores a set of associations. From my studies of my question, I think that a fixed structure makes most sense. Depending on what you want to do with

      // status, you can use the current point. Class status {int x; Int y; The implementation of Hashod () + is equal to ()}}  

    You need to implement Hashod () so that the objects can be evenly divided into sets and equal () So that objects can be compared to that. See for more information.

     set  & lt; Status & gt; Status = New Hashet & lt; Status & gt; (); Positions.add (new position (3,4)); Positions.add (new position (5,6)); // and so on  

    Be sure to define equals / hashounds (there are lots of links to this)

    Now you can check that someone Whether the point is in the set or not using the method such as:

      post cadence (new point (2,1)); // returns false conditions (new point (3,4)); // Return Correct  

    PostgreSQL In Memory Database -


    The reason I want to run my PostgreSQL database server from memory is because on my new server, I have 24 There is memory of GB, and hardly any one is used.

    I know that I can run this command to create a RAM disk:

      mdmfs -s 1024m md2 / mnt  
    < P> And I theoretically store its data to PostgreSQL. But the problem with this is that if the server crashes or reboots, then the data will end.

    Actually, I want to load the database all the time in memory so that it does not need to go to the hard disk drive to read every record, because I have tons of memory and since the memory is fast Compared to the hard disk drive,

    Is there a way to do this when postgrescuclo is write to disk then do not lose any data in case I go to server Land? Or is there any way to cache all the data in memory?

    I am now using streaming replication async This means that my master is running in all memory, using a traditional disc with a different slave example.

    A machine restart involves stopping slave, copying postgrascill data back into RAMDisk, and then restarting the master and followed by slave. This is an interesting possibility which compares something like REDIS, but with the benefit of redundancy / hotstandi / backup / SKL / rich toolset etc.


    64bit - Is there a 64-bit Ruby? -


    It seems that people are compiling MRI Ruby (1.8.7) for 64-bit platforms. I have been searching and reading for a while, in fact without the answer I want, without it. What do I know if any of you actually used more than 4GB of memory in Ruby? Is Ruby really 64-bit if you compile it like this?

    I have indicated that comments in source code have not been tested on 64-bit. For example, it says that "BigDiskm has not yet been compiled and tested on 64 bit integer systems."

    It will also be interesting to know how to make other implementations in Ruby's 64-bits.

    MRI (both 1.8.x and 1.9.x lines) can be compiled as 64 bits is. For example, Snow Leopard has been compiled as bundle with 1.8.7 as 64 bit. This activity can be viewed in the monitor, or by asking irb , for example 42.size . If you have been compiled in 64 bit, 4 (byte) otherwise, you will get 8 (bytes).

    Ruby will be able to use more than 4g of mem. For example:

      $ irb> & Gt; N = (1 <29) & lt; + 8 = & gt; 536870 920 & gt; & Gt; X = Array.New (n, 42); X.size = & gt; 536870921 # bigger than one because it contains 0 to n inclusive elements  

    If you do not exceed 4G or RAM then getting the last line will take some time because the OS will swap too much, but Even works with 4 GB on my machine. The size of the virtual RAM for this process was 4.02G.

    I updated the comment to the large DCMML file which was outdated (from March 2003 ...)


    javascript - How do I give an HTML canvas the keyboard focus using jquery? -


    I am implementing a game using javascript, jquery, and canvas tags. How can I prevent the browser from processing keyboard shortcuts when the canvas tags have a focus? I have tried event.stopPropagation () and it has no effect.

    I can select keyboard events However, when the user presses the space bar, the web page scrolls down in Firefox. The same problem is with the arrow keys

    The basic problem is that by default the browser canvas is not "focusable" Does. Setting up tabindex on the canvas is best done:

      $ ("# canvas") // Keep the tab index to ensure the canvas keeps focusing .attr ("Tabindex", "0") // Keep the mouse override to prevent default browser controls from appearing. Footprint (function) ($ (this). Focus (); return returned;}) .keyword (function () {/ * ... game logic ... * / incorrect return;});  

    If for any reason you can not set to tabindex , you can make the canvas "focusable" by setting up contentEditable Can add edit material to help ensure that the canvas retains the focus $ ("# canvas"). Ether ("content editable", "true") $ ("# canvas") [0] .contentEditable = true;

    This is basically the solution I came across, but in my opinion it is a little less than the tabindex option.

    One more thing to consider is that the browsers outline the content editable elements along the border. This can be closed to some users. Fortunately, you can get rid of this bit of CSS:

      #canvas {outline: none; }  

    I tested both solutions in Chrome 3/4/5 and Firefox 3.0 / 3.5 / 3.6 on Windows XP, Mac OSX and Linux. Here's an example:


    dojo - Overriding dijit validator function and using regExp attribute -


    I'm new to dojo and actually can use some help in the following 2 field validation examples.

    In the following example of a dijit.form.ValidationTextBox area, the use of regExp seems to override the validator property. (Ie the area no longer follows regExp rule). How do i do it

    & lt; Input dojoType = "dijit.form.ValidationTextBox"
    type = "password"
    name = "password2"
    id = "password2"
    maxLength = "50"
    trim = "true"
    regExp = "[\ w] +" required = "true"
    validator = "return.value == dijit.byId ('password'). Value"
    invalidMessage = "Confirmation password matching password Should eat "/>

    I have another similar example where one field is the value of another, but I do not have the correct syntax.

    & lt; Input dojoType = "dijit.form.ValidationTextBox" type = "text"
    name = "homephone" style = "width: 20%"
    maxelag = "10"
    trim = "true"
    essential = "false"
    regExp = "[\ D] {10}"
    validator = "return (dijit.byId ('preferredContactMethod') value ==" Home ") & amp; amp; amp;; (this.value! = Null)"
    invalidMessage = "Home phone is required (i.e. 9 1988887777)" />

    correct; The default implementation of Dijit.form.ValidationTextBox.prototype.validator () is to match this. Check with ARXXPP, as well as against other such constraints. Take a look at the source to see how it is done. If you override it, then you have your own to provide the implementation. You can choose to assign your implementation prototype method and you can also override the result with 'and' your own tests, Wide, I think.


    ASP.NET get windows username outside of page -


    I have an existing ASP.NET reporting application that is using Windows authentication. The report is a very different class of generation code and has a core error logger that I have not written, error logger I believe that Windows was built for applications because it uses WindowsIdentity.GetCurrent (). In the case of ASP.net I believe that it will return the account running the ASPNNet page on the server.

    I believe the user Using Identity. The page on the name will be the way to do this correctly but this is not available within the Report Generation Classes on the page, is it a way to get the missing error logger class as an additional parameter

    There are hundreds of reports sections, so I have to be afraid that each parameter has to be added.

    If you can use cloning in your web.config:

      .... & lt; Authentication mode = "windows" /> & Lt; Identification impersonation = "true" />  

    Your report sections will find the right user.

    If your reporting classes system Can refer to the web assembly and you are willing to modify the code, you can also:

      httpctx Present. User. Identity .name  

    But make sure the caller comes from an ASP.NET request or throw it a null.


    terminology - What is Cloud computing? -


    Does cloud computing work, can anyone explain in plain words? I have read, but it is still not certain how I understand how the cloud actually works.

    Marketing period?

    Basically all the needs of your program are organized "elsewhere" on the Internet. You interact with them through a defined service agreement; Depending on the SOAP, REST, POX or whatever and what happens after the service provider.

    If, for example, you want to store files, you can choose to use Amazon's S3 Cloud System, you have no idea how your information is stored or how the service Is provided. . You join the service and upload your files; You do not know where or where the files are stored, that's the only place for the entry point for that service.

    If you have any application then it can also be run in the cloud, suppose it is appropriate. For example, Live Mesh is a virtual machine that can code against you and run your software locally and in the cloud, so your user goes to the URI only and finds your program, you do not care that it is anywhere Not available on the cloud.


    entityspaces - Stored procedure execution problem -


    IAM was able to implement unit spaces in the C # application and successfully execute the questions given below.

    Coll.query.where (coll.prodlineid.equal ("id") if (coll.query.load ())

    However, with all the processes I have processed Code is needed to change. I used this: coll.Load (esQuerytype.storedprocedure, "testproc", ultimate)

    At this point, Iam 'error as EntitySpaces.Core.esEntityCollection.Load (EntitySpaces.DynamicQuery.esQueryType, String, Paramaze Object []) 'is inaccessible due to its security level

    esEntityCollection is a metadata file, so I have access to the access modifiers Nick can not be protected by Nick.

    Help: -)

    Your custom partial In class (which you have generated), add a method like the following:

      Public Zero GetProducts {Entitleid} {this.Load (... & lt; put your stored proc call Given earlier & gt; ...); }  

    Then you can call your stored procedure:

      ProductCollection coll = new ProductCollection (); Coll.GetProducts (lineID);  

    linux - how to find the owner of a file or directory in python -


    I need the function or method in Python to find the file or directory owner.

    The function should be like:

      & gt; & Gt; & Gt;  

    I'm not really / remove ("/ home / somedir / somefile" one Many of the dragon man, but I was able to whip it: PWD Import from getpwuid def find_owner (filename) from OS import state

     : return getpwuid (state (filename) .st_uid). Pw_name  

    iis - log in asp.net mvc -


    In my MVC application I need to check a situation in action and throw it into the log.

    How can I add an information to log information?

    To use the event log:

      System.Diagnostics Look at a library like .ventLog.WriteEntry ()  

    or like.

    Kindness,

    Donation


    javascript - Getting cell value from table in jQuery -


    I do not have an ID or name inside a table. How do I read values ​​from the desired table cell in jQuery? For example:

      & lt; Div id = "myDiv" style = "padding-top: 0px; height: 60px;" & Gt; & Lt; Width of table = "264" cell field = "0" cell padding = "0" range = "0" & ​​gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; Td width = "80" height = "20" style = "font-size: 10px;" & Gt; & Lt; / TD & gt; & Lt; Td id = "the_cell_i_want" align = "right" style = "color: RGB (102, 188, 41); font-size: 24px; font-weight: bold; background color: RGB (255, 255, 255); background - Image: None; "& gt; THE_VALUE_I_WANT & lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt;  

    I want to get the ID from "the_cell_i_want" ID and return it to "THE_VALUE_I_WANT".

    $ ("# the_cell_i_want"). Text ();

    This will do it for you.

    Since you have an ID, you can specifically select the element from the dome. And you can use cell value [internal text].


    actionscript 3 - how to efficiently track the use of space on a map, both objects and free areas -


    OK I start with an empty map, which is 512x512 = 262144 pixels / space.

    I need this to have a way of attracting some objects effectively, and then be able to find areas of vacant space, so that later in these free areas more and more different objects are added Can go I can not figure out the best way to store this data, or find algorithms to search for free areas.

    I had a working solution, but to calculate it was taken forever, I am working with AS3, if this effect is the best solution.

    Any advice? Thank you. There are many ways to work with bitmap in bitmap and bitmapdata classes.

    I have not done anything like that, but you can try, I believe that objects on the map Is the best way to attract. Then, use the method to get those fields bitmapData.getColorBoundsRect (), which are not free. These AS3 basic methods are very, very fast!

    These documents are:

    Cheers, Cathotians!


    sql - postgresql querying on multiple identical tables -


    Hello I have several databases, like mytable_2009_11_19_03 where the last 2 numbers identify hours : 00), now I want to query something from _00 to 2_2. It can be done this way but it is really clumsy select * mytable_2009_11_19_00 from where type = 15 select union * mytable_2009_11_19_01 from where type = 15 union .......... * * Select * type = 15

    from mytable_2009_11_19_23 How can I make it easier? It is related to

    The easiest solution will be to create a view of all the tables, then you can query them You can easily write a process to generate visualization easily. In addition, if you use "All Union", then it will be faster, if you want the result to be all the rows (as opposed to the separate rows) and you can select it separately and hold different rows If you ever need it, you sometimes need it.


    web crawler - where I to put file robots.txt? -


    मेरे पास डोमेन www.mydomain.com है और मैं apache mod-rewrite सेट करता हूं ताकि www.mydomain.com/ हो। myappl। मैं robots.txt फ़ाइल को कहाँ रखा जाना चाहिए? धन्यवाद!

    robots.txt को ग्राहकों के लिए सुलभ होना चाहिए। यह कैसे पूरा करें कि आपके मॉड-रीराइट कॉन्फ़िगरेशन पर निर्भर करता है कृपया अधिक जानकारी की आवश्यकता है, तो कृपया कॉन्फ़िग को पोस्ट करें।

    इसके अलावा विवरण के लिए देखें।


    .net - how to update product.wxs file dynamic -


    I want to create an application that includes a dynamic screensaver. Users can select multiple images from their PC and the SVF file Can generate So I dynamically want to include SVF files and images in the wix project. And want to create an MSI file. There is no way to dynamically add the image path and the SVF file

    Answer me soon

    Sameer

    < Div class = "post-text" itemprop = "text">

    A wxs file is just XML, you can edit it in your application with any XML API. In .NET, you can do the file by loading it in either.

    Alternatively, you can use the heat.exe tool to include "crop" (i.e., create a wxs file for) or in a complete folder it will give you a wxs file Does not allow editing properly, but this is not a problem because there can be multiple wxs files in a wix setup.

    From:

    Harvest a file

      Summer file - Item-template: Slice-out File. Wxs ". My Files \ File.dll"  

    This file will crop "File.dll" file as a piece in the file. The Wxs component guide will be set to "*".


    compiler construction - C++ CPU Register Usage -


    In C ++, local variables are always allocated on the stack. Stack is a part of the approved memory that can be captured on your application. That memory is kept in your RAM (if the disk is not swapped) Now, do the C ++ compilers always create a codec code that stores local variables on the stack?

    For example, the following simple code:

      int foo (int n) {return ++ n; }  

    In the MIP codeer code, it may look like this:

      foo: addi $ v0, $ a0, 1 ​​junr $ ra < / Code> 

    As you can see, I did not need to use the stack for n. Will the C ++ compiler recognize, and directly use the CPU's registers?

    Edit: Wow, thanks for your almost immediate and comprehensive answers! Function body of the foo return ++ n; , not back n ++; Must be . :)

    Disclaimer: I do not know MIPS, but I know some X86, and I think The principle should be same ..

    In the General Function Call Convention, the compiler will push the value of n to the function on the stack to pass foo . However, there is a fastcoll convention, which you can use to use GCC to provide value through registers. (MSWC also has this option, but I'm not sure what its syntax is.)

    test.cpp:

      int Foo1 Int n) {return ++ n; } Int foo2 (int n) __attribute __ ((fastcoll)); Int foo2 (Int N) {Return ++ N; }  

    compiled with the above G ++ -O3-fomit-frame-pointer -c test.cpp , give me the foo1 To get:

      mov eax, dword ptr [esp + 0x4] add eX, 0x1 rt  

    As you can see, from this stack Values ​​reads in.

    and here foo2 :

      lia ax, [ecx + 0x1] ret  

    now Makes the value directly from the register.

    Of course, if you inline the function, regardless of your calling calling conference, the compiler will do a simple extra work in the body of your large function. But when you can not underscore it, then this is going to happen.

    DISCLAIMER 2: I am not saying that you should constantly give a second guess to the compiler. This is probably not practical and necessary in most cases but assume that it does not prepare the correct code.

    Edit 1: If you are talking about plain local variables (not about function arguments), yes, compiler will allocate them to registers or piles In the form it sees fit.

    Edit 2: It appears that the conference is architecture-specific, and will pass on the first four arguments on the MIG stack, as Richard Pennington has said in his reply. So in your case you do not need to specify additional attributes (which is actually an x86-specific feature.)


    asp.net - Not getting into the callback url -


    I'm using oauth in my web application to access Twitter. My problem is that I can not find token secret and whenever I run my application it asks the user for authorization request. When the user clicks on "Allow", it does not return to the URL. Actually it shows a blank title page in which the URL has the Oath _ Talk value and the Oath_Verifier value. Nobody can put light on it.

    Before you send users to twitter.com to authorize the app, you will receive a token Need to save a secret request. Return to the callback URL you specify. Once you need to use Request token / Incognito to obtain an access token from Twitter that will allow you to request an API as a user.


    How to get PHP $_GET array? -


    Is it possible to have value as an array in $ _ GET ?

    If I http: //link/foo.php? Id = 1 & amp; Id = 2 & amp; I am trying to send the link to id = 3 , and I want to use the $ _ GET ['id'] on the PHP side, this value is an array how is it possible? Because now the resonance is $ _GET ['id'] back 3 . Its last id is in the header link. any suggestion?

    The usual way to do this in PHP is to replace id [] Just enter id in the URL:

      http: //link/foo.php? Id [] = 1 & amp; ID [] = 2 & amp; The id [] = 3  

    then $ _ GET ['id'] will be an array of those values, it is not particularly beautiful, but from the box Works out.


    c++ - C macro to transform a SVN revision to an integer -


    I'm looking for a C / C + + macro that reads "$ Amendment: 9 $" or "$ Amendment : 9999999 $ "in an integer or string

    I know that this is present to achieve simple tasks, but I want to do it at compile time.

    My wish is to write things like this: unsigned int rev = SVN_TO_INT ("$ revision $");

    I agree that you can use the macros or templates through the timing of the wire Can not work with So ... do not use the wire.

    This is an ugly hack, but I think it meets all your needs. I do not recommend it.

    #define $ modification structure REV_STR {unsigned foo #define $ * 64; }; $ Amendment: $ 4521 enum {REV = sizeof (REV_STR) / 8}; #undef $ Modification #undef $ #include & lt; Iostream & gt; Int main () {std :: cout & lt; & Lt; REV & LT; & Lt; Std :: endl; Return 0; } // $ g ++ -Wall -Wextra revision.cpp & amp; Amp; ./a.exe // revision.cpp: 4: WARNING: The width of `REV_STR :: foo 'is greater than that of / / 4521

    ruby on rails - render :partial with a manipulated :collection -


    Say I have a collection of @dogs, and I want to share the collection in one place and the rest in the other. . It's easy to spit all of them together:

      render: partial = & gt; 'Dogs / summaries' ,: archive = & gt; @dogs, as: = & gt; : Dogs  

    But is it possible to manipulate (refine) your collection, or is it better to make those definitions in your controller and do something like this: / P> % h2 Male Dogs: Render: Partial = & gt; 'Dogs / summaries' ,: archive = & gt; @ Mall_dogs ,: as in => : Dog% H2 Female Dog: Render: Partial = & gt; 'Dogs / summaries' ,: archive = & gt; @fimi_dogs, as: = & gt; : Dog

    thanks.

    The archive logic is just a list. There is no such reason why this will not work:

      Render: partial = & gt; 'Dogs / Summary', as in: = & gt; : Dog ,: collection = & gt; @ Dogs.select {| Dogs | Dog.gender == "M"}  

    Personally I like to make those lists in the controller. I think that looks better, and can be made very dry with nominated scope.

    IE:

    Model

      class dog & lt; ActiveRecord :: base named_scope: male, terms = & gt; {: Gender = & gt; "M"} name_scope: female ,: conditions = & gt; {: Gender = & gt; "F"} ... and  

    controller

      class dog controller & lt; ApplicationController ... DRF index if the consultation [: user_id] @ user = user.fid (paras [: user_id]) @ Male_dogs = @ user dag. Mall @ Foula_dogs = @ User Dags. Female and @mail_dog = dog.mail @female_dogs = Dog.female end end end  

    see

     % h2 male dogs = Render: partial = & gt; 'Dogs / Summary', as in: = & gt; : Dog ,: collection = & gt; @ Male_dogs% h2 Female Dog = Render: Partial = & gt; 'Dogs / Summary', as in: = & gt; : Dog ,: collection = & gt; @adriadogs  

    exception handling - In C++, is there a difference between “throw” and “throw ex”? -


    I also want to ask, but this time about C ++

    What is the difference between C ++

      Try {/ * to capture some code here (Myexception and prior) {ex EX;} / / bus Do not throw  

    and

      try {/ * some code is here /} (my expansion and pre) {throw;} // pre < / Code> 

    Is it simply stack trace (which is not standard in C ++ or Java in any case in C ++)?

    (If it makes a difference, then I use MSVS 2008.)

    Throw; The same exception recovers the object while throwing it ; throws a new exception, it does not make any difference other than the reasons for the performance of creating a new exception object. If you have an exception hierarchy where there are some other exception categories that are derived from the MyException class and throwing exceptions you thrown DerivedClassException; hold it it (MyException & amp;) . Now if you modify this captured exception object and have it throw; If the exception object is reused using then DerivedClassException will be. If you throw ; Object slice is done and new thrown exception type MyException .


    javascript - Backbone - Get model's idAttribute value from the collection? -


    I am creating a generic table view which can be used with different collections here which I am trying to do I'm an example of this:

      ... getModelIdAttribute: function () {this.collection return .__ proto ___ model.prototype.idAttribute; }, GetModelFromRow: function (HTMLrow) {this.collection.get Return (this.dataTable.row (HTMLrow) .data () [this.getModelIdAttribute ()]); }, ...  

    data () function returns an object with the attributes used to create the model, but I have different idAttributes.

    Currently, my method works - but __proto __ dislikes and it seems that I should be an easy way to remember?

    thanks


    performance - Are python lists row-major ordered or column-major ordered? -


    I read on Wikipedia that the dragon is a language that implements line-command But I'm trying to multiply 2 metrics where I reach a line-up approach and using a column-head approach. But when I execute the code, the column-main approach is sharp all the way. I will post a piece of my code here:

      Class metrics: self.num_lines = num_lines Self: #flag indicates the type of matf def __init __ (self, num_lines, NUM_COLS, flag). NUM_COLS = NUM_COLS if flag == 0: # First Matrix self.matrix = [1] * num_lines * NUM_COLS elif flag == 1: # second matrix self.matrix = [0] * num_lines * NUM_COLS to the range I (num_lines ): range (num_cols) J: self.matrix [i * num_cols + j] = i + 1 elif flag == 2: # results matrix self.matrix = self.matrix = [0] * num_lines * num_cols def setMatrixValue ( self, line, column, value): self.matrix [line * self.num_cols + column] = value getMatrixValue (self, line, column) def return self.matrix [line * self.num_cols + column] def multiplyMatrices (num_lines , Num_cols, flag): matrix_a = matrix (num_lines, num_cols, 0) ma trix_b = matrix (num_cols, num_lines, 1) matrix_result = matrix (num_lines, num_lines, 2) # column-key approach that flag == 0: I range start_time = time.time () (Matriks_salt. Num_lines): G in the limit (Matriks_salt. Num_cols): temp = 0 k (matrix_a category. NUM_COLS): temp + = matrix_a.getMatrixValue (i, k) * matrix_b.getMatrixValue (k, j) matrix_result.setMatrixValue (i, j , Floating) # row-key approach elif flag == 1: start_time = time.time () I range (matrix_result.num_lines): for range in K (matrix_result.num_cols) for range: Range To switch to J. (matrix_a.num_lines): matrix_result.setMatrixValue (i, j, matrix_result.getMatrixValue (i, j) to + (matrix_a .getMatrixValue (i, k) * matrix_b.getMatrixValue (k, i))) End_time = time.time () print matrix_result.matrix diffTime (start_time, end_time)  

    And I just realized that the matrix multiplication in Python was so slow n Java or C ++ Is there any reason?

    The behavior you are expecting is due to the benefit of access to sequential memory. So here you want to increase the column in the internal loop.

      Automatics [line * self.num_cols + column]  

    In pure Python there are some problems with this concept. Since all entries are objects- to reach them, you are already getting references (reference) in the list, but then you need to reach the memory of context (sequential) to get an object (bad). / P>

    Fortunately there are alternatives, such as numpy. In addition, the Matrix routine that has been thoroughly tested, can be used by you.


    types - How to pass the 'self' value of a method to another method? -


    I am trying to do something similar to: Pass the 'self' value in the hope of getting the method. Calling ( get_dot ) is a kind of mismatch for accessing values ​​like x and y and I'm not sure that I Difference or something is required here is an example in which I pass passport to @ or this and the second method is used by my values Programming is able to properly use:

      class Test Manufacturer: - & gt; @x = 10 doSomething: (value) - & gt; Return @ x * value X doSomething2: () - & gt; @doSomething (@) y = New Test () warning (y.doSomething2 ()) // 100  

    My real junk code looks like this:

      Struct Vec2 {x: f32, y: f32}} Encrypt Vec2 {// Other stuff fn get_dot (& self, right: Vec2) - & gt; F32 {self.x * right.x + self.y * right.y} fn get_magnitude (& self) - & gt; F32 {(auto .get_dot (auto)). Sqrt () // Problematic Line! }}  

    I get the following error:

      src / vec2.rs: 86: 23: 86:27 error: mismatch type: expected vc 2 `, has been found & amp; Vec2` (expected straight 'Vec2`, found & amp; -ptr) [E0308] src / vec2.rs: 86 (auto .get_dot (self)). Sqrt () ^ ~~~ Error: aborting 1-character due to previous code  

    < P> 1-character for your code is fixed:

      struct Vec2 {x: f32, y: f32,} impl vec2 {// other stuff fn get_dot (& amp; self, correct : & Amp; Vec2) - & gt; F32 {// Correct type self.x * right.x + self.y * right.y} Fn get_magnitude (& self) - & gt; F32 {(own .get_dot (self)). Sqrt ()}}  

    The problem is that your get_dot method instead assumes the second argument instead the context. It is unnecessary (because the method does not need to be the owner of that argument, just do not need to be able to access it), and if you want to call it, it really can not work. get_magnitude .


    visual studio 2010 - UTF-8 without BOM -


    I have JavaScript files that I need to save them in UTF-8 (without bombs), every time I I change them to the right format in Notepad ++ , when they open in Visual Studio, they are returned back to UTF-8 with BOM. How can I stop VS2010 from doing it?

    Another question is, UTF-8 is similar to UTF-8 without a signature in a visual studio?

    The BOM or byte order mark is sometimes quite annoying. Visual Studio does not change the file until you save it (Hans has said).

    And here's the solution to your problem: If you want to save the file with other encoding, save and save the Save button in the file dialog and save with "Encoding "Select" or if you want to get rid of this setting, open the file menu permanently and select "Advanced save option" and you should select "Not signed with UTF-8" (and that's it Also your end The answers to the question :) Yes "UTF" the unsigned 8 is not the same.


    javascript - Lost part of page after post page -


    After clicking on start, value is lost.

    What do I do, so that the page has to be reloaded manually?

      & lt; Button onclick = "start ()" & gt; Start & lt; / Button & gt;  

    Start: This is called when the user starts on the setup screen

      start the function (reuse) {reuse = (typeof reuse = == 'undefined')? True False; // User input number is readoff question = $ ("# zodiac"). Val (); Time = $ ("# time"). Val (); ShowError = $ ("# showError"). Prop ("check"); ShowCorrect = $ ("# showCorrect"). Prop ("check"); Fullscreen = $ ("#screen"). Prop ("check"); // Current index is the index of current query in the list whereas quiz current index = -1; // Reset correct question correct = 0; Var pred = {place: 1, time: 2, other: 3}; Var _numberOfQuestions = 0; If (reuse) {_data = filteredData; } And {_data = data; } // Filtered according to the screen of the data setup, after filtering it is a new list of questions after filtering [=]; ("($ (" ($ ("$ Ddcl-d1-i" + + ['pad']) PROP ("check"). (If ($ ("#ddcl-d2-i" pred [entry [Pred ']] .prop ("check") {_numberOfQuestions ++; entry [' a '] = _show (entry [' a ']); filtered data push (entry);}} if (_numberOfQuestions $ ("#quotions" ); Hide ($.); $ ("#include");; secondsSlite = time * number; question; doTimer (); Next question (); if (fullscreen end screen; Screening.) {Screenfull.request (document.getElementById ('Container'))}}  

    I call start with javascript.

    I try to add autopostback = "false" , but the result remains the same.

    You can add the type attribute to the button because they automatically submit forms.

      & lt; Button type = "button" onclick = "start ()" & gt; Start & lt; / Button & gt;  

    c++ - What is the correct way to obtain (-1)^n? -


    Many algorithms need to calculate the (- 1) ^ n (both integers) It is usually the factor in a series, a factor which is also odd for -1 and n for 1 in the C or C ++ environment, a Often sees:

      #include & lt; Iostream & gt; #to & lt include, cmath & gt; Int main () {int n = 13; Std :: cout & lt; & Lt; Std :: pow (-1, n) & lt; & Lt; Std :: endl; }  

    What is a better or general conference? (or something else),

      std :: pow (-1, N) std :: pow (-1, n% 2) (n% 2? -1: 1) (1-2 * (n% 2)) // (returns the wrong value for negative n)  

    Edit: Additionally, user @ sievenepeddude has another alternative ( A universal?) Is my version of Array Lookup, which is proposed:

      const int res [] {-1, 1, -1}; // Three elements are required for negative elements const int * const m1pow = res + 1; ... m1pow [n% 2]  

    you (n & amp; ; 1) instead of n% 2 and & Lt; 1 instead of * 2 If you want to be a highly educated, I mean optimized.
    Therefore, the fastest way to calculate in an 8086 processor is:

    1 - ((n & amp; 1) < / P>

    I have to make clear that where this answer is coming from, original poster Alfisi had an excellent job of posting several different methods to calculate (1) ^ n Some others compare Are fast in
    As fast as the processor is taking place today, we make readability of some CPU cycles from shaving with a lesser (even more insignificant) improvement from shaving to usually .
    There was a time when a pass compiler ruled the earth and the MUL operation was new and downgrade; In those days, the operation of 2 operations was an invitation to redundant optimization.


    .htaccess - https Redirection issue with whmcs -


    I have a whmcs installation in / whmcs and wanted to apply https to my whole website, so I have one. This code added to Htacess is at the root of my website below:

      RewriteEngine On RewriteCond% {HTTPS} Close RewriteRule (. *) Https: //% {HTTP_HOST}% {REQUEST_URI} [R = 301, L] The problem is that there are some issues of whmcs when some modify, and my clients could not attach the file to their ticket.  

    With their support, I was asked to add one. To override the instructions in Htaccess / whmcs root. I tried many times without success, so I'm asking for help here.

    I have two options:

    1- To ignore the redirection to the root. Adding an .htaccess to /hm Htacess

    2- Modify the route to ignore the / hmaccesscess / wmcs subfolder

    Any help is welcome.

    You can extract the / whmcs folder as your rule Prevented

      RewriteEngine RewriteCond% {HTTPS} = off RewriteRule ^ (?! WHMCS /) https: //% {HTTP_HOST}% {REQUEST_URI} [R = 301, NC, L] / Code> 

    plot - ggplot2 - trouble with legend when using geom_point() in (R) -


    I try to create a ggplot with two geom_line () S and two geom_point () s, all come from the same dataset (I currently get a data.table ). The data looks like this:

      & gt; Head (Data) Month High_Low_q1: 2009-03-01 0.048 9 4481 0.1462436 2: 2009-04-01 0.04910757 0.1452902 3: 2009-06-01 0.04871459 0.1471519 4: 2009-07-01 0.04938127 0.1489580 5: 2009-08 -01 0.04899900 0.1481020 6: 2009-09-01 0.04888317 0.1479808  

    Plot me against high_q and low_q month , both as geom_line () s and geom_point () s. So far, I have found:

    Enter image details here

    which is generated by using:

      requires the plot ('ggplot2'); - geom_line (data = data, aes (x = month, y = high_ q, (Data = data, AES X = month, y = low_q), size = 0.15, color = 'gray 40') + geom_point (data = data, color = 'headquarters'), shape = 0, size = 1.2) + GOM_LINE (data = AES (x = months, y = less_a, color = 'lq'), shape = 2, size = 1.2) + Scale_color_manual (values ​​= c ("skyblue4", "skyblue4")) + theme_bw () + theme Panel.grid.minor.x = element_blank (), panel.grid.major.x = element_blank (), panel.grid.major.y = element_line (color = '#CCCCCC'), panel.grid.minor.y = Element_line (color = '#CCCCCC'), axis.title.x = element_blank (), a Xis.title.y = Element_blank (), axis.text = elem linand.KIICE = unit (0.3, "cm") + scale_y_continuous (breaks = seq (0, 1, 0.02), limitations = c (0.04, 0.16) )  

    For my purposes, everything is recovering, how do I want to do it except for a small problem: legend entries 'headquarters' and For the 'LQ', the size of the triangle and the overlapping of each other over each other is as follows (as can be seen in the above plot). I can not understand why this is happening, but I want to show the appropriate size (class and triangle respectively) for the 'HQ' and 'LQ' I would like a legend.

    The data to reproduce it is as follows:

      is required ('data.table') # Not sure it is necessary , But in case & gt; Dput structure (list (month = structure (C (15584, 15614, 15645, 15675, 14 9 75, 15006, 15034, 15065, 1509, 15156, 15187, 15218, 15248, 15279, 15340, 15400, 15492, 15553, 15126, 15,371, 15522, 15,309, 15461, 15431), class = "date"), high_q = c (.0543422228029794, .0538360449888788, .0542576885322506, .0563374158664627, .051832022940258, .0511098243497093, .0516824037401732,. 0508625794149931, 0.0508129898329969, 0.0522992472796989, 0.0534593224542862, 0.053658852482904, 0.0527596522451362, 0.0536379383601105, 0.0537250634604839, 0.053270060949945, .0551497117304649, .05453991405068, 0.0514309991121669, 0.0528033236299854, 0.0556533741364405, 0.0575938660077188, 0.0536383751376219, .0540292765156109) , Low_q = c (0.150651382807563, .151678928161841, .152412405006079, .15434629712537, .148160747764117, .145711811622833, .146989273508668, .145807363651857, .146620317131406, .152241594600521, .154136431058451, .151915467273669, 0.1514212 12763034, 0.152599450134152, 0.149039642113193, 0.14629263019443, 0.149301086354786, 0.150844206416902, 0.148202127121, 0.152041900070419, 0.152751500401794, 0.147225953877478, 0.146177782497413) .. Name = C ("month", "high_k", "low_key"), line.Name = C (NA, -24L), square = C ("data valid", "data.frame"))  

    I understand that ggplot2 is in long I like the data in the format, so I always melts my data first:

      Library (recieve 2) df & lt; You can then plot it using:  

    It gives you the basis after that, that is, different shapes in mythology. Then you can add additional topics as you want.


    javascript - Setting value to datetime-local HTML input -


    मेरे पास type = "datetime-local" का एक HTML इनपुट ऑब्जेक्ट है जिसके लिए मैं चाहूंगा एक कस्टम मान सेट करने के लिए जो अब () + 3 घंटे हर बार इसका मान बदल जाता है

    इस तथ्य पर आधारित है कि सतर्क (object.value) एक स्ट्रिंग प्रकार YYYY-MM-DDTHH: MM देता है, मैंने सोचा है कि मैं स्ट्रिंग को ठीक से स्वरूपित करने के लिए भी (तिथि की गणना के लिए) की आवश्यकता होगी इसलिए मेरे पास है:

    एचटीएमएल

      & lt; इनपुट  

    घंटे जोड़ने के लिए जेएस दिनांक प्रोटोटाइप विस्तारित किया गया

      दिनांक.प्रोतिटिप .addhours = function (h) {this.setTime (this.getTime () + (एच * 60 * 60 * 1000)); इस वापसी; }  

    तिथियों को बनाया गया प्रतिक्रियाएं () फ़ंक्शन निम्नानुसार है

      फ़ंक्शन तिथिसक्रिया () {var adesso = new date; Document.getElementById ('निष्पादन दिनांक')। Value = parseDateToInput (adesso.addHours (3)); }  

    जहां स्ट्रिंग को पार्स करने के लिए निम्नलिखित सरल फ़ंक्शन द्वारा किया जाता है:

      फ़ंक्शन parseDateToInput (jsDate) {var jsDay = jsDate.getDate (); अगर (जेएसडीए & lt; 10) {जेएसडीए = '0' + जेएसडीए;} var जेएसएमोनथ = जेएसडीट.गेटमॉनथ (); अगर (jsMonth & lt; 10) {jsMonth = '0' + jsMonth;} var jsYear = jsDate.getFullYear (); अगर (जेएसइयर और एलटी; 10) {जेएसवाईअर = '0' + जेएसइयर;} var जेएसहोअर = जेएसडीट.गेटहोर्स (); यदि (jsHour & lt; 10) {jsHour = '0' + jsHour;} var jsMinute = jsDate.getMinutes (); यदि (jsMinute & lt; 10) {jsMinute = '0' + jsMinute;} जेएसइयर + '-' + + जेएसएमोनथ + '-' + जेएसडीए + 'टी' + जेएसएचउर + ':' + जेएसएमिन्यूट; }  

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


    scala - Running a scopt option with no values -


    I am writing a CLI in Scala using Scop.

    I would like to add to the ability to do call with or without command.

    For example:

      Claustibility -O & lt; Value & gt; & Lt; Price & gt; & Lt; Price & gt;  

    Send a value of values ​​to [string].

    I also want to be able to run -

      Clevelity -O  

    to send me an empty sq [string] Want to, but how can I see it?

    Thank you.

    to:

      arg [file] ("& lt; File & gt;.). Infinite () Optional () Action {(x, c) = & gt;  

    The following uses produce text:

      & lt; File & gt; ... Optional unrelated arguments are related to  

    and files: Config file within Secure Case [File] . Note the countless and alternate researchers do this, by which you can produce as much as you want, and this is not necessary. As you can see in the case code of the example, the default value of files is an empty signal, as you want.

    Last But at the least, let me tell you that to be a flag -o , like using the Gitub example - Verbose is.


    linux - Is it possible to allow a user to access a dir without making him the owner? -


    For my desktop machine, I want to be able to get files in my home directory in a browser.

    I have set Apache document to my home, but I get the logically forbidden page. I have www-data in my group Attempted to add user, with the same result

    I would not want to give full access to any user in my house.

    So how should I move Apache to read my home? $ ls -la / home | Grep gael drwxr-xr-x 44 gael gael 4096 mars 17 22:30 gael $ groups www-data; Error log: [176 22: 43: 06.5 9 2819, 2015] [authz_core: error] [www. Data] PID 4572] [Client 127.0.0.1 9 677] AH 01630: Customer Configuration Has Been Denied: / home / gael /

    Apache Conf:

      & lt; VirtualHost *: 80 & gt; DocumentRoot / home / gael / & lt; / VirtualHost & gt;  

    Make sure the user is running the webserver read All files are required to be viewed

    It seems that you have added the www-data user to you, it seems that they have < Code> execute will be required.

    Keep in mind that a new group membership is not effective immediately: Interactive users will have to re-enter, a daemon needs to be restarted (thus: restart Apache). The W32 method (simply reboot) will also work.

    BTW, exposing your home through a webserver looks like a strong bad idea: Anyone who can use webserver (usually anyone Same net) will be able to see your home directory. Make sure you add additional security (password protection, encryption, ...).

    BTW, do you know that ~ / public_html directory traditionally stores your web-browser ~ & lt; User & gt; (So if your login name is "GAIL", then you can access this directory via http: // localhost / ~ gael / ). If the directory does not exist, just create it and make sure that you set your group to www-data to share some data through the web For a more secure way.


    rust - Trait for enums convertible to isize -


    I have several enums, each of them numeric tags and can be converted into integer ( isize < / Code>). I have a special quality that defines everyone. But the examples of those attributes can not be convertible to any more integer, because the compiler can not prove all the methods, in fact the parasailable nanams are.

    Is there a feature which means that there is an enum with a parameter or it is variable for the integer (in any way) which I can use as an obstacle in generic, which receives numerical value need to?


    To be more specific, here is a code sample ():

      enum Foo {a = 1, b = 2, c = 3, } Enum bar {d = 4, e = 5, f = 6} attribute process: std :: marker:: markerat {Fn process (V: icize) -> String; } Input process for Foo {FN process (v: isize) - & gt; String {format! ("Foo {}", v)}} times {FN process (v: isize) -> input process string {format! ("Bar {}", v)}} / just for logic; In reality, something more complex is, of course, fn extern_call (v: isize) - & gt; Eyesz {2 * v + 211} FN process & lt; T: Process & gt; (V: T) - & gt; String {T: Process (Execution of Viscus)} FN Main () {printen! ("A: {}", Process (Foo :: A)); }  

    Obviously the problem is in the process ; failed to compile with v asize

    Error: non-scalar cast: T as isize

    So I would like to do something like this

     < Code> Process & lt; T: Process + Scalar & gt;  

    or

      process & lt; T: process + tofrimitive & gt;  

    Or something that will tell the compiler that the only type of permissible allowable, but I do not know how it might be.

    Add a method for your property which combines it with a iisize . After this, the compiler can verify that the object meets the necessary criteria:

    enum Foo {A = 1, B = 2, C = 3,} enum bar {D = 4, E = 5, F = 6,} Properties Process: {Fn as_isize (self) - & gt; Isize; FN Process (V: Isis) - & gt; String; } Foo {Fn as_isize (self) - & gt; Isaacs (F Isaac's) FN Process (V: Isaacs) - & gt; String {format! ("Foo {}", v)}} Process for the bar {fn as_isize (self) - & gt; Isaacs (F Isaac's) FN Process (V: Isaacs) - & gt; String {format! ("Bar {}", v)}} / just for logic; In reality, something more complex is, of course, fn extern_call (v: isize) - & gt; Eyesz {2 * v + 211} FN process & lt; T: Process & gt; (V: T) - & gt; String {T :: Process (extern_call (v.as_isize ()}} fn Main () {println! ("A: {}", Process (Foo :: A));}

    FYI, MarkerTradit is not required here (and it is non-idiomatic):

    The purpose of marker-practice is

    is used as a supertrate for those symptoms, in which there is no way