Sunday, 15 March 2015

mysql - How to make Redirection PHP -


I am trying to check the database for a varchar "race" and if it is a redundant redirect on the page it is mine Code is ive, it ensures that the var is empty, yet it does nothing on reloading how I redirect php

     

You are not fetching any records, therefore Maybe use mysql_fetch_assoc first?

  $ line = mysql_fetch_assoc ($ check_bone_query); if (is_null ($ line)) {// or blank () use ('Location: / bone'); go out;}   

Using the PS MySQL _. * function PDO Or MySQLi

ruby on rails 3 - Applying Angular.js FilterBy to nested json attributes -


I am using angular.js as a way of handling the ordering and searchable lists of data.

and then went through the example of the filter

When I was walking in minutes and sorting in minutes, I was scared. That's why I see an ideal approach to displaying column columns, which is sortable and searchable by filtering in every column ...

Until I realized that the filter Jason Nested Atstrut Does not appear to work on, 'Signing example is the owner of all my clients and I want to display my email address and sort and hide from this field - the main parts of my code look like this.

  & lt; Tbody ng-repeat = "Customer Clients In | Order: Sort-B: Reverse Filter: Search" & gt; & Lt; TR & gt; & Lt; TD & gt; {{Name}} & lt; / TD & gt; & Lt; TD & gt; {{Owner.email}} & lt; / TD & gt; & Lt; TR & gt; & Lt; Input ng-model = "search.name" & gt; & Lt; Input ng-model = "search.owner.email" & gt;   

owner.email is sung and can be sorted but this filter will not be. I have a functioning: only one attribute is included: only the association and the search on the association. Explorers Filters on the owner's email because I have all this allowed in Jason. It seems like a hack should be reasonably elegant way of doing this. what is this?

As mentioned in the above comments, you might have a custom filter search.owner .email or other criteria / input that you want.

How do you find greatest number among 5 with vb.net? -


This is the code to look for in maximum 3, but I want the code to find the maximum 5 amoung: integer like oval, a, b, c, like a = input box ("enter number 1") = input box ("enter second number") c = input box ("enter number." ) If A & gt; B then if A & gt; If the MSBBX ("A Greater") is MSBBC ("C is Big" then MSBBC ("B Greater") is the MSBB box ("C is Greater") and end if

As suggested by David, keep your values ​​in the list This is easier than uncompressing different variables and requests Can be extended to many values ​​(up to millions of values).

If you have different variables for some reason To do this, then do this:

  Integer as a dim max = a dim name string = "A" if B> max then max = b name = "b" end If if C> max is max = c name = "c" end if d> max then maximum = d name = "D" end if MsgBox (name and "big") ...    

c# - MSpec replacement for BDD style unit test in winrt app -


Is there a good tool, which I can use to test the BND style unit instead of MSPC, which is the Winrt application Is in

As we know, MSPC has not been placed in PCL

Depending on this, you are trying to complete several solutions: If you have to test the code in PCL, you can create an old old .NET (test) class and reference the PCL library.

If you are trying to test, I would like to see Win81 & amp; On using BDDFy to test; WP81 app using BDDIFY

Create and handle an exception in R -


I have to do a task where he throws a special exception and returns a message, and then just check What is the return that is returned is one of my defined 'exceptions', for example, say I have a function:

  divideByX & lt; - If functional (x) {# if x then NA throws is an exception (if.na (x)) {return (exception ('x' (n '')} # # If x is the exception, skipping exception (if X == 0) Returns ('Exception can not be divided by zero')} {return (10 / x)}}  / Pre> 

So if x is 0, then this option Returns the returns of 'Can not divide by zero', if X is NA, then this exception returns 'x' and for all the other values ​​of x, the expression of x Then I can run something like this:

  tempList <- list ('a' = 2, 'b' = 0, 'c' = 5, 'D' = A) Loppie (Temple List, Function (X) {If (Exception (X)) {Return (X)} and {Y & LT; - DIWIDEBX ) Returns (Y ^ 2)}})   

So it first checks that the value is one of my defining exceptions and if it gives such a message, it squarees my values , So should return to

  $ a [1] 25 $ b [1] 'zero Sector '$ c [1] 4 $ d [1]' X NA '  

What is the best way? Please tell me that nothing is unclear.

Thank you in advance

Function exceptions to generate an exception A linear hierarchy Which may extend the simple error class

  exception  - Function (class, message) {cond & lt; - Simple error (Message) Category (R) & Lt; - c   

This is your function

# if x is 0, then the exception throws (length (x)! = 1) {exception ("non (Except ("isa" "x is na")} and if (x == 0) {exception ("divibiziro" , "Beed to zero")} 10 / x}

and to generate output you (

  alt (tempList, function) pre> 

or to make exceptions differently from others

  & Gt; Touch (list (NA, 3: 5), function (x) ({+ divideByX (x) +}, isa = function (mistake) {+ warning (error) # warning signal, return NA + NA +}, NonScalar = function (error) {+ stop (err) # fail +})) Error: x is not length 1 Additionally: Warning message: x is    

QT - overriding QToolButton paint event -


My own widget is MyToolButton which comes from QToolButton . In the paint event, I should draw only "background" from the original QToolButton . I mean, I just need to draw style (clicks, hover, etc.), but without text and image. I want to attract these things through my own (with custom formatting etc.) when I call on QToolButton :: paintEvent (ev) everything is painted. How to separate image and text from painting? I think I should use the drawControl () , drawPrimitive () and drawComplexControl () but can not understand all these states < / P>

The source code for zero is QToolButton :: paintEvent (QPaintEvent *) : < / P>

  QStylePainter p (this); QStyleOptionToolButton opt; InitStyleOption (& amp; op); P.drawComplexControl (QStyle :: CC_ToolButton, Opt);   

QStylePainter :: drawComplexControl call QStyle :: drawComplexControl , which is a pure virtual function, and its implementation depends on a style Is, you are using. You need to go to the source code of Concrete Surplus (like QWindowsXPStyle or QGtkStyle ), find the drawComplexControl () implementation and use it for your < Code> paintEvent . For a simple control like QPushButton , you can rewrite your drawing quite style-freely- Redrawing QToolButton independently will work a bit more difficult a good Will use the source code of the option QCommonStyle .

sed - print field number and field -


I want to print the field number and field like this ... what is the best way to awk? if so, how? The fields in the input line may vary. Expected result: 1A2B3C4D

I am able to print the field , But there is a need to print field numbers. Here's what I have

  echo "a | b | c | d" | Awk -F "|" '{For (i = 1; i & lt; = NF; i ++) print $ i}' abcd    

You can use awk commands like:

  echo "a | b | c | d" | Awk -F "|" '{I (i = 1; i & lt; = NF; i ++) print I, $ i}'    

Google maps v3 - Draw a polygon to show photo take angle -


I'm displaying Google Maps (v3) markers in a situation where the picture was taken and the status of the subject and Line to show the direction in which the photo was taken I have also measured the distance and angle from the position of the camera.

What I am trying now is to show the scene with the camera with a triangle, which says 30 degrees towards the subject. I think there is a third grade math, but can not be detected after 25 years, I know how to draw a polygon / triangle, but in fact it is not that at the distance of the subject 30 degrees in both directions How to calculate the digits, remember the title angle.

Almost there ...

The formula below was used to use the formula (I found it necessary to change: Lat1, Lon1 and mathematics before radians.
I change this function every time to calculate a marker of pause 1 and pause 2 triangle and change the path to redraw it. / P>

The thing is now that the triangle

the question is now:

Google has the right in the West Positive and negative for the western countries.Previously (-180/180) and think that the formula needs beering in 360 degrees? Now the camera captures (75) correctly , But I have left 15 degree view instead of 15 degree angle to 15 degrees, and 15 to the right).

  function getVertex (brng) {var r = 6366.707; Var d = parseFloat (getObj ('GPSDestDistance'). Value) * 1.5 / Distance on field field / camera carrier's position lat1 = deg2rad (markerCam.getPosition (). Lat ()) var lon1 = deg2rad (markerCam.getPosition) ( ) .lng ()) var lat2 = Math.asin (Math.sin (lat1) * Math.cos (d / R) + Math.cos (lat1) * Math.sin (d / R) * Math.cos (Brng )); Var lon2 = lon1 + Math.atan2 (Math.sin (brng) * Math.sin (d / R) * Math Kos (Late 1), Math Kaos (D / R) - Math. Sin (lat1) * Math Sin Lat2)); Lat2 = rad2deg (lat2) lon2 = rad2deg (lon2) var pos = new google.maps.LatLng (lat2, lon2) return pauses; } Function camera view (angle) {var brng = deg2rad (parseFloat (getObj ('GPS dashbearing').)); // Get the title from the form if (brng & lt; 0) {// brng = Math.round (-brng / 360 + 180)} var pos1 = markerCam.getPosition (); Var pos2 = getVertex (beng-angle); Var pos3 = getVertex (beng + angle); Var path = [pause 1, pause 2, pause 3]; Poly.setPath (path); } Function deg2rad (x) {return x * (Math.pi / 180); } Function rad2deg (x) {return x * (180 / Math.PI); }    

To get an endpoint latitude and longitude (latitude 2, loan 2) Formula initial position (lat1, lon1) (also in radians), range (d), radius of earth (r) and bearing (brandy): in radians

  lat2 = Math .asin (Mathematics sin (lat1) * math kos (d / r) + math kos (lat 1) * math.sein (d / r) * math kos (brng)); Var lon2 = lon1 + Math.atan2 (Math.sin (brng) * Math.sin (d / R) * Math Kos (Let1), Math Kaos (D / R) -Math. (Let1) * Math Sin ( Lat2));   

Your starting point will be one of the points of the triangle polygon. The second two can be found using this code snippet, which is your effect +/- 15 degrees (for example 30 degree triangle) and a boundary which is completely dependent on how big you want the triangle.

c# - How to capture keystroke(s) pressed in certain time period for DataGridView keypress event? -


I have to catch the keystrokes pressed in a certain time period, for example 300 ms when I ' A and press ' B ' within 300ms, then I need the string " ab ". But if I press the key ' c ' after pressing 300 ms after ' b ' then I need " c ".

I need to quickly jump for the DataGridView's cell which starts with the quick pressed key (s).

I'm not completely sure that I understand your question, but I believe Is that if you press two keys, or if you press three keys, you want a way to execute a block code on the second block of code. Additionally, you want each key to be pressed within 300ms of each other. If I understand, then you should do this code:

  Private Systems Diagnostics Look at the port = new system Diagnostics Harbour (); Private string _ keyed; Public string key pressed {get {return_keys; } Set {Watch.Stop (); If (see Apple Milliseconds & lt; 300) _Keyspressed + = Value; Else _Keyspressed = Value; Watch.Reset (); Watch.Start (); }} Private Zero keyUpEvent (Object Sender, KeyEventArgs e) {Keyspressed = e.KeyCode.ToString (); If pressed (key == "AB") lblEventMessage.Text = "you have pressed ABC"; Else if pressed (key == "ABC") lblEventMessage.Text = "You have pressed ABC"; Else lblEventMessage.Text = "C-C-C-Combo BREAKER !!!"; }   

This code identifies a label, lblEventMessage, and something to trigger a KeyUp event (I went with a text box).

Apache Jena: What is a RDF Dataset? -


I am new to the semantic web and I have a very basic question about Jena RDF Dataset. I read it from the documentation That's a collection of dataset graphs (or models in the Java API). If I see the graph as an RDF alternative for the 'table' of relational DB, can I see the dataset as 'database'?

If so, then I should be able to with TDB multiple datasets, although in the documentation it says, 'Each dataset is received through TDBFCC. Content dataset (location) is a dataset within a JVM. ' (). I also remember that the document has said somewhere that TDB does not support many JVMs. Does this mean with TDB I can only create a dataset?

This is Andy's answer to my question, thanks to Jena's user mailing list, Andy.

Hello, everyone

I am new to the semantic web and I have a very basic question about Jena RDF dataset, I have read it from the documentation that the dataset graph (Or model in Java API). If I see the graph as an RDF alternative for the 'table' of relational DB, can I see the dataset as 'database'?

Yes - of type.

If so, I should be able to create multiple datasets with TDB. However in the documentation it says, 'Every dataset is received through TDBFCC. Content dataset (location) is a dataset within a JVM. ' ().

... for the same "location" argument ...

TDBFactory.createDataset ("DB1"); TDBFactory.createDataset ("DB2");

There are different datasets

I also remember that the document has said that TDB no longer supports many JVMs. Does this mean with TDB I can only create a dataset?

The TDB is the core database engine, and when used directly, you are using in a way embedded mode.

You can use Jena Fuskeki to share a dataset among applications (like you can share an ASQL database between apps, besides this it is not HTC JDBT).

Andy

ios - Prevent UIWebView from showing UIPopoverController for tel links -


I am working on an iPad application with UIWebView (Deployment Target iOS 5.0 +).

UIWebView should nothing while tapping my user, email, address, and phone number.

I have a problem with phone number if the HTML page contains links like this: & lt; A href = "tel: 555-555-5555"> 555-555-5555 & lt; / A & gt; When UIPopoverController appears when the user taps this link

I've tried the following:

  • Turn off identification in the xib file for UIWebView < / Li>
  • webView.dataDetectorTypes = UIDataDetectorTypeNone;
  • Call JS - document.documentElement.style.webkitTouchCallout = "none";

    UIWebView Representative

    Do you have any ideas?

    This is the reason The special phone number link is not disabled that it is not an detected phone number, it is just a regular old & lt; A href = foo & gt; The link, which is a telephone link for its href attribute, is the correct way to disable phone code detection, as you set up the data type type Want to So if you have a phone number somewhere, somewhere in the web page text and you want to prevent links from being created, then webView.dataDetectorTypes = UIDataDetectorTypeNone; Keep using .

    If you want to disable all links that look like a phone number, you will need to execute the JavaScript after the page is loaded. Use the webViewDidFinishLoad method in your UIWebView [webView stringByEvaluatingJavaScriptFromString:] and pass in JavaScript to change the offending link. Here's an example JavaScript, which is all your Telephone style will replace the link by showing the phone number instead of the text number. You want a bit different, or you may want to completely remove the link from the dom.

      var links = document.getElementsByTagName ('a'); (Var j = 0; j & lt; links.length; j ++) {var href = link [j] .getAttribute ('href'); Var prefix = href.substring (0,4); If (prefix == "tele:") {var parent node = link [ja]. Prentanod; Var replacement node = document. CreateTextNode (href.substring (prefix.length, href.length)); ParentNode.replaceChild (replacement node, link [ja]); }}    

separating text and image regions from an image code -


Separating image and text areas from an image is a very old problem and many papers have been written about recent people One of them can be found

but I did not find any existing code for this. Before implementing one, I thought that if someone is aware of an existing one then such a community might be a good idea to ask.

Please give me an existing code (especially Java) Point to if you know

I have not read your pdf completely, but i Whatever you have seen, you can get a similar algorithm applied. Weight in C #. Changing Net Code to Java should not be a big deal.

View and

mysql - PHP echo code not working -


The PHP code is trying to print the following few statements, but this prints the following error:

Parse error: syntax error, unexpected T_STRING in C: \ Program Files \ Apache Group \ Apache2 \ htdocs \ chat_status.php on line 8

Code:

  & Lt ;? Php session_start (); $ Thor = mysql_connect ("localhost", "hi", "hello"); Mysql_select_db ("my_db", $ thief); $ Check_table = mysql_query ("SELECT * FROM $ $ row [studentid]". "To". "$ _ GET [id]`); if ($ check_table! = FALSE) {$ asd = "No Suggestion"; echo $ Asd;} and {$ result1 = mysql_query ("select students from where email = '$ _ session [user_name]' '); $ Line = mysql_fetch_array ($ result1); $ Create_table = "Create tab '$ line [studentid]". "$" (IDANDTN) Not Auto_InCran, Primary Key (Post_Number), Data Text (20000)) "$$ _GET [ID]"; $ Result = mysql_query ($ create_table, $ con);}? & Gt;    

Change to the following line:

  $ check_table = Mysql_query ("SELECT * FROM $ $ row [studentid]". "To". "$ _ GET [id]`);   

Close "

Also comment on Note

apart from @ jamie0726 (thanks), please do not use $ _GET in your query under any circumstances. This is a serious security mistake (SQL injection, for example, it is easy to delete your code.) You can easily avoid it

GeoServer not returning correct JSON for WFS using OpenLayers.Protocol.Script -


I am trying to get the Jason feature from GeoServer 2.3.0. I have repeated the code from an example and it works as expected, however, when I set the URL on my GOVERver and the desired layer, the returned format is not the same and the result of this error is: "Unwanted syntax error: unexpected Token: "

The example server returns the JSN feature in this format:

Open Layers. Protocol. Script Registry 1 ({"Type": "Feature Collection", "Feature": [{"Type": "Feature", "ID": "Cities .2", "Geometry": ...

My GeoServer offers JSN feature in this format:

{"type": "Feature Collection", "FEATURES": ["Type": "Feature", "id": "poi.1", "Geometry": ...

My server is not returning to Jason wrapped in the callback function from the geographic server. There may be a server config problem, but as a Geosarver Nob, I can tweak To find the right settings for Unable to find the solution. JSONP is disabled by default in the server.

Environmental Variables ENABLE_JSONP = Setting up the truth and requesting the format "text / javascript" gives expected results. It is still not certain that the example server gives correct jsnp with the requested format of "json".

c++ - How to read and write .ini files using boost library -


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

  • 4 जवाब

    कैसे पढ़ा और लिखना ( या संशोधित) .i बूस्ट पुस्तकालय का उपयोग कर फाइलें?

    बूस्ट.प्रॉपर्टीट्री आप पेड़ को पढ़ और अद्यतन कर सकते हैं, फिर एक फाइल में लिख सकते हैं (देखें load और save फ़ंक्शंस।

    देखें। आप निश्चित रूप से जोड़ सकते हैं नई संपत्ति या मौजूदा एक अद्यतन करें। यह उल्लेख है कि कंटेनर पर मिटाएं भी है, इसलिए आपको मौजूदा मान को हटाना चाहिए। boost (ऊपर दिए गए लिंक) से उदाहरण:

      ptree pt; pt.put ("a.path.to.float.value", 3.14f); // मूल्य pt.put overwrites ("a.path.to.float.value ", 2.72 एफ); // नया मान के साथ दूसरा नोड जोड़ता है। Pt.add (" a.path.to.float.value ", 3.14f);   

    मुझे लगता था कि आप एक वृक्ष को एक फ़ाइल में लिखेंगे, या तो एक नया या मौजूदा एक को अधिलेखित करेंगे।

    संपादित करें: इनआई फ़ाइल के लिए यह विशिष्ट जांच करता है।

    उपरोक्त उदाहरण यदि आप इन-इन को इनi_परर्स के साथ सहेजने का प्रयास करते हैं तो आप प्राप्त करते हैं:

    1. ptree बहुत गहरी है
    2. डुप्लिकेट कुंजी <पूर्व> #include & lt; boost / property_tree / ptree.hpp & gt; # शामिल करें & lt; boost / property_tree / ini_parser.hpp & gt; Void save (const std :: string और filename) {boost :: property_tree :: ptree; // pt.put ("a.path.to.float.value", 3.14f); // pt.put ("a.path.to.float.value", 2.72f); // pt.add ("a.path.to.float.value", 3.14f); Ptree pt; Pt.put ("a.value", 3.14f); // मूल्य pt.put overwrites ("a.value", 2.72f); // नया मान के साथ एक दूसरा नोड जोड़ता है Pt.add ("a.bvalue", 3.14f); Write_ini (फ़ाइलनाम, पीटी); } Int main () {std :: string f ("test.ini"); सहेजें (एफ); }

      test.ini फ़ाइल:

        [a] value = 2.72 bvalue = 3.14   

      प्रयोग करने में असमर्थ।

Get company name that is opened in Quickbooks using QBFC -


I can get companyfilm using QBFC but could not get the proper class in the name of the open company in the QuickBook.

Any thoughts will be highly appreciated.

I know that this is an old question after searching for other answers related to QBFC, I thought I would post an answer. It can help anyone starting this.

There is an excellent resource for this type of question, it is a bit cumbersome to use, but it will give you a sample code for either test in VB.NET or C #. You need to know what you want to know about the request. In this situation, you are searching for CompanyQuery \ ICompanyQuery . The generated sample code shows how to make a request and parse the response. In the sample code named BuildCompanyQueryRq , the function has some invalid code that you will need to change for your solution.

CompanyQueryRq.IncludeRetElementList.Add ("ab");

Change it to:

Add CompanyQueryRq.IncludeRetElementList ("Company Name");

He will only request the property of the company name if you wanted to add more assets, then you will use the property name to add it to the list. If you delete the line completely, you will retrieve all the fields. Only recommended what you need

Note: I have read that according to the documentation, this matter is sensitive.

Then you need to look at the WalkCompanyQueryRs function to see how to get the value. The sample will retrieve as much data as possible from the response. You will need to trim the code back in the requested areas.

FYI: The OSR has the ability to change the version of the SDK specification, as well as used when generating references.

cocoa - How to create custom Object Library items? -


I have written a custom view class that has two sub-views, similar to that of NSSplitView. When I am used in the interface builder, I want to show my new class with two sub-ideas. Two subviews can be any NSView, but need to be specified by the developer.

How can I add my class to the object library?

How do I specify for IB that he has two essential sub-views (IBilllets) in my class?

Thank you in advance, which

Without creating IBuottle properties, Expex 4 is not possible to customize the way the interface builder offers a custom class. It is possible before the ExDod 4 (standalone) interface builder, but this functionality was removed.

qt - How to build Quazip 0.5.1 on Windows 7? -


I was trying to create quiz library (version 0.5.1) on Windows 7 (32-bit) with QT 5.0 I am.12-beat LGPL installed.

When I run in QT-command prompt:

  Qmeak Mingwaw 32-made   

with the folder in which I Quazip ( C: \ Qt \ quazip-0.5.1 \ quazip) was set on that directory removed, I get the following error log:

  c: \ qt \ quazip -0.5.1 \ Quazip> mingw32-make mingw32-make -f makefile. Release mingw32-make [1]: Enter the directory 'C: /Qt/quazip-0.5.1/quazip' g ++ -wl, -s -shared - Mthreads -Wl, - out-implib, release \ libquazip .a -o release \ qua zip.dll object_cript.quasip Release -elsi: \ Qt \ qt 5.0.1 \ mingw47_32 \ lib -lQt5Core ./release\unzip .o: unzip.c :(. Text + 0x1008): `crc32 'undefined reference to ./release\unzip.o : Unzip.c :( .text + 0x10aa): Undefined reference to `inflate './release\unzip .o: unzip.c :(. Text + 0x10da): Undefined reference to' crc32 './release\unzip .o: unzip.c :(. Text + 0x1110): Undefined reference to `crc32 './relea Se \ unzip.o: unzip.c :(. Text + 0x1327): Undefined context for` fulaway' ./ the release \ unzip.o: unzip.c :( .text + 0x1727): reference undefined for 'get_crc_table' ./ release \ unzip.o: unzip.c :(. text + 0xl86f): `footage Inter 2_ ' Ltd Undefined context ./release\zip.o:zip.c :( .text + 0xac7): Undefined context for `Crack 32 './ release \ zip.o: zip.c :(. Text + 0xb7c):` Deflate Undefined reference to ./release\zip.o:zip.c :( .text + 0xcdf): Undefined reference to `deflate './ release \ zip.o: zip.c :(. Text + 0xef5): Undefined reference to `deflateEnd './release\zip.o:zip.c:(.text+0x13a8): Undefined context for' get_crc_table './ release \ zip.o: zip.c :(. Text + 0x1af9): 'deflateInit2_ ./release\quaadler32.o:quaadler32.cpp undefined reference to' :(. Test + 0x2e): 'Adele undefined reference /release\quaadler32.o:quaadler32.cpp to R32': (text + 0x61): `Adlero ./release\quaadler32.o:quaadler32.cpp undefined reference to the 32 ':(. text + 0x11):' Adele r32 undefined reference 'K/release\quaadler32ko:quaadler32. Cpp :(. Text + 0xb1): Undefined reference `Adle r32 'c: / qt / qt5 / tools / mingw / bin /../ lib / gcc / i686-w64-mingw32 / 4.7.2 /... .. /../ i / 686-w64 - Mingw32 / bin / ld.exe: ./release\quaadler32.o: `bad reloc section address 0x0 'Rdata $ _ZTI13QuaChecksum32 [__ ZTI13QuaChecksum32]' collect2.exe: error: ld 1 Get out of The situation has been made Makefile. Release: 106: The recipe for target 'release \ quazip.dll' failed mingw32-make [1]: *** [release \ quazip Dll] error 1 mingw32-make [1]: The directory ' C: /Qt/quazip-0.5.1/quazip 'except Messiefile: 34: The recipe failed for' release 'mingw32-make: *** [Release] Error 2   

But in my Zlib-folder (C: \ QT \ QT5 \ 5.0.1 \ Src \ qtbase \ src \ 3rdparty \ zlib) all these listed files are installed.

.

As I tried to solve this problem, I have added in quazip.pro and in quazip.pri:

  include + = $$ [QT_INSTALL_PREFIX ] / Src / 3rdparty / zlib   

, how it is suggested.

So far I have found that not all solutuons present on Google are helping.

I hope someone of you can help me out.

Greetings, LVR

The problem is that the QuaZIP zlib library can not be found . When you run Kashmir, you should include the path of the header in one of the libraries:

  qmake "INCLUDEPATH + = C: /Qt/Qt5/5.0.1/Src/qt/bt /5k0kl/srk/ktbase/srk/3rdparty/ Zlib "" lib + = - luck: /kt/kt5/5k0kl/srk/ktbase/srk/3rdparty/zlib-lz "Mingv32-make   

I have a complete explanation in the blog if you want to see it:

jsf 2 - Edit word documents with JSF RichFaces rich:editor? -


I have rich in JSF Richface: the editor is running and I am able to upload and open documents or just send them to the editor I can stream in The point is that .doc or docx or other rich text documents will show a lot of things, which are not visible in the actual document, when I open it with Office, and the only form that I can actually get I get it from an HTML file

My questions are:

Is there a way to open documents online and have they edited like Google Docs?

Is there any way to recharge Richfas: Do I have to do the editor component to do that?

Note: If I copy and paste from .doc, its work is fine, but here you will have to get it from streaming

You have to convert DOC (HTML) into HTML for editing originally and after saving, HTML DOC (X) is what Google Docs originally did. Used to be.

Your next question might be the most, "How do I change from DOC (X) to HTML and back?". You can use it for others, or alternatively, like a library on top of it, you can parse DOC (X) itself with the help of low level API and then based on the information gathered in the Java object Can generate the desired HTML

No, it's not trivial to act. You need to have a good understanding of the DOC format (this question alone already shows that you do not have it) and limits during the conversion phase I personally recommend using Google Docs only.

java - JPA vs JDBC vs NoSQL for MMORPG -


We are developing a 2D MMORPG space shooter using Libgdx / Netty and we had to face a question Which we can not solve concerning the data.

  • If we use JPA and RDBMS, we can get ACID and reduce the data management code
  • If we use the JDBC width of spring If we use support then we can take advantage of the speed but complexity data management code
  • We have no experience in NoSQL development, but speed advantage (which is important) Should be omitted

    In our help to fix please.

    1. You realize, that JPA uses JDBC.
    2. Spring can achieve ACID as easily as JPA can not do. I do not know what speed are you taking advantage of the speed of development? Transaction speed? Why Spring Data Management Code Is Complex? This is another false statement.
    3. What speed are you asking for NoSQL? development? Runtime? There is no acid with no SQL, if it is important for you, then why are you thinking about it? NoSQL means "Not Relative" Is Your Data Relational? If so, why are you considering NOQL?

      You can not decide on performance related issues by talking about technology and guessing. Its the only way to benchmark them and to get some real data for transactions that you really care about.

      Write the interface-based DAO, using the technique of each candidate, and to measure the actual results, how to decide on the extent to which technology is to be used.

      Which well do you know? If no one knows, do not use it. If you do not know JPA, do not use it. Spring JDBC template lets you write custom SQL with a transaction. If you already know the relational database and the spring, why would not you use it?

c# - How to change Lightswitch App language at runtime -


I followed this article to create localization inside Visual Studio LightSwitch 2012 App

Automatically change the language based on the language set in the computer running the app app.

Active Windows Language Pack determines which language will be displayed.

Is there a way to convert code to run-time?

I think that if I can set the language by code then I have a button that switches the language!

Although there are no answers, you can give an idea about how to implement it in LS.

>

You most likely need a cultural specific resource file for all the text inside your app, and then either all those loaded or attached videos Like these, drag these resource files temporarily.

Cheers

css - Google Chrome cutting off jpeg when resized to a height taller than 65535px -


I have an image that contains 187 frames from the video placed on top of each other, each frame is 320px wide and 180px tall As a result, an image can be 320px wide and 33660px tall. Link to Image:

I want to use this image to show one frame at a time, and in order to complete each frame to double the width and height, Inside the div , 640 px times 360px with overflow: hidden , and it completely relies on a negative top The price at which I want to show (To show the first frame, The value is <0,0>, and in order to show the fifth frame, the head value is set to -360 * (5 - 1) = -1440 pixels. For Bella:

This works fine until I reach the frame number 183, the image cut to image by top Price-65520px: Chrome 65535 pixels cut Is being given, so that frame is not being shown to me fully - and the rest frames Ilkul not:

I see that the maximum height of the JPG image 65,535 pixels (), but are able to scale on both Firefox and Safari image high altitude this.

  • Is it the behavior expected in Chrome and is there any way around it?
  • Is there a place where this "border" is documented?
  • What should I expect in other browsers?

    In my trial I am using Google Chrome 25.0.1364.172 on OS X 10.8.2

    I think your best option is to be on the original dimension (not double), clip it to clip original resolution, and then result 2x scaling, maybe it can also give you better performance.

    I think the internal implementation of the property will be a little, but I do not have any documents about it.

sql server - Split and concatenate values in SQL -


I have two separate tables below and there is a specific requirement for SQL queries.

  Table 1: Name rule number Tom 1,2 Pete 1,3 Table 2: Rule number Description 1 Rule 1 2 Rule 2 3 Rule 3   

How can I get a SQL query result?

  Description of the name Tom Rule1, Rule2 Pete Rule 1, Rule 3    

You need the first custom partitioning function to separate the delimited list, and then to combine the details for the XML path . Here is your last query

  select t1.Name, STUFF ((SELECT ',' +2 as the description, select T2 WHERE t2.ruleNumber in (dbo.fn_split) (t1.RuleNumber , ',')) For the XML path ('')), 1, 1, '' by the rule number, from table 1 t1 to 'description' as part of the   

partition function Code for [Fn_Split] (@ string varchar (8000), @dailymeter varchar (10)) begins as @ttable table (s type (1000)) @ i int, @j int select @i = 1 while @i & Lt; Select = len (@ string) Select @J = Charindex (@ Delimiter, @ string, @i) if start by selecting @J = 0 @J = Lena (@string) + 1 end Enter @tbl Select substring (@ string , @E, @JE - @i) Select @E = @Jey + Lane (Delimiter) End End End

iphone - How to hide documents folder to 3rd party apps like PhoneView? -


I am downloading a demo version of the phoneview app today and for my surprise I am able to change the contents of that file With this phone-view app in the Documents / Library folder.

Do I want to prevent users from accessing files in my app and make these files invisible in these third party tools? Is there any way to achieve this?

It is not possible to limit access to files. But if you want to prevent people from viewing the file, you can encrypt them. Can be useful (Commoncrypt part) You will need to generate an encryption key (I think you can use CFUUIDCreate for it) and store it in your app's chicane.

python - Value prints correctly in function, but when returned is None -


I'm just trying to brush on my dragon, so I'm sure I made a basic mistake here. My code is just a toy app that finds the largest item in a circuit-sorted array.

This is my code:

  def listIsSorted (l): if l [0] & lt; L [-1]: return 1 return 0 def findLargest (L): listLength = len (L) if (listLength == 1): Return L [0] if (listLength == 2): if (l [0] Return [L] [0] Returns L [1] Halfway = int (listLength / 2) firsthalf = l [ Int (half way)] Second week = l [int (halfway):] If (the first half) and list (second half) were moved to the list: Return Maximum (L [Semi-1], L [-1]) Find the biggest (secondhand) to find Alif (first place on the list): Sabas Larger (Lifes) L4 = [5,1,2,3] Print (Find Largest (L4))   

and it outputs to: < My question is why is it being returned as none when it is only Printed as 5?

I think it should be modified in this way because you have to return the result of the recursion call Forgot in:

  def findLargest (l): listLength = len (l) if listLength == 1: return L [0] if listLength == 2: If l [0] Gt; L [1]: Print "OMG I found: {0}". Format (L [0]) Return [0] Returns L [1] Halfway = int (listLength / 2) firsthalf = l [: int (First half to return halfway): First to return (half Returns: The second list (first-half) and Listed first (Second half): Return Maximum (L [Semi-1], L [-1] Other: Return Search Largest (First Alf)    

c# - How to have Entity Framework navigation property query filter in database by default? -


The DBKnext API has set the navigation properties in the iSelloplege (for the * expiration of the association). The usual way to get a queryable object (like you want a count) seems like

  int count = dbcontext.Entry (entry). Collection (c => c.navprop). () .ount ();   

But it is uncomfortable if you want to filter in DB more often. More importantly, it is also easy to forget. If someone has said accidentally

  int count = entry.navprop.Count ();   

Then it receives all data on the server and counts there, which is slow.

The same thing is true for EntityCollection type, which uses ObjectContext by default.

  int count = entry.navprop.CreateSourceQuery (). Calculation ();   

Is there a way to set in a model or elsewhere that the default collection type for the navigation property is an IQueryable or ObjectCag or any type of queryable type?

Note that this is just a real problem for navigation properties and in context the real object and the DBST item are queryable

I have come up with a solution that solves most of my problems What I was doing, object Konnect was using API and my model and navigation property which was private (received And for setting) Was taking a long time for the gram. You can do this in the ADMX file by right-clicking on the Nm property.

Then I created a partial class file for that class which had a private navigation property and added anything to it.

  Public object & lt; Neopropypeed & gt; NavPropName {if (privateNavProp! = Null) // Lazy Loading or some PersonalNowProp when idle Cretesource (); And tap return; }}   

Any user of the class can now try to pull up all the Navprop items, which are many. And instead of remembering to call CreateSourceQuery every time, it's easy to do a query on AOV Props.

I did not add a setter because that navigation property is read only in my application. I'm sure there is a way to fit this method, but I do not have enough information about the Object Project API, to say how to do it.

I had just finished doing this for the navigation properties, which could be a tonne figure behind them, because the performance has not had any effect except the other ones.

EDIT: There is a drawback to making it private that I later went on is that I can not do now

  db.EntryTable.OrderBy (e = & Gt; e.privateNavProp .Count ())   

Even if it was smart enough not to get all things

jquery ui - Plone Dexterity RelationChoice widget clashes with jQueryUI? -


मेरे कस्टम प्रकार में रिलेशनशॉइस विजेट ठीक काम करता है जब तक कि collective.js.jqueryui autocomplete सक्षम नहीं हो और तो यह काम बंद हो जाता है यानी रिश्शन लुकअप कर रहा है; जब आप फ़ील्ड में टाइप करते हैं तब कुछ भी नहीं होता है।

(साइट के दूसरे भाग में मैं Google मानचित्र API के साथ collective.js.jqueryui autocomplete का उपयोग करता हूं ताकि उपयोगकर्ता के रूप में पते के सुझावों को वापस किया जा सके एक पता फ़ील्ड।)

जब मैं RelationChoice विजेट का उपयोग करना चाहता हूं (और बाद में फिर से सक्षम)

वर्तमान परिमाण को सामूहिक। Js.jqueryui autocomplete को अक्षम करना है। एक अच्छा समाधान नहीं।

  • Plone 4.2.1.1
  • सामूहिक.जिसज्यूरीयी 1.8.16.9 (यह भी 1.10.0.1 की कोशिश की - एक ही संघर्ष)
  • Plone.app.dexterity 1.2.1

    स्वतंत्र:

    • अगर मैं केवल plone.formwidget.autocomplete / jquery.autocomplete.min को सक्षम करता हूँ .js मेरा गूगल मानचित्र लुकअप फायर नहीं है (नीचे कोड देखें) लेकिन रिलेशनशिप विजेट काम करता है
    • अगर मैं केवल सामूहिक.जिस.ज्वूरीयूआई स्वत: पूर्ण को सक्षम करता हूं तो मेरा गूगल मानचित्र लुकअप काम करता है लेकिन RelationChoice विजेट आग नहीं है

      कोड का नमूना:


        $ (दस्तावेज़) .ready (function () {initialize (); $ (कार्य () (// Google नक्शे लुकअप $ ("# पता")। स्वतः पूर्ण ({// यह सा पता मूल्यों को प्राप्त करने के लिए जियोओकोड का उपयोग करता है: फ़ंक्शन (अनुरोध, प्रतिक्रिया) {geocoder.geocode ({'address': Request.term}, फ़ंक्शन (परिणाम, स्थिति) {...   
        ...   

      क्या यह संभव है मैं इसके बजाय ऊपर कोड में plone.formwidget.autocomplete / jquery.autocomplete.min.js का पुनः उपयोग कर सकता हूं? मुझे नहीं पता कि यह मेरे Google मानचित्रों को लुकअप कैसे लाएगा ...? ( सामूहिक। Js.jqueryui autocomplete सक्षम होने पर उपर्युक्त कार्य को सफलतापूर्वक सक्रिय करता है।)

      < P> ठीक है, मैंने इसे किया है कम से कम प्लोन 4.3

      पहला भाग था, पैकेज में jQuery के यूआई प्रभाव को पूरी तरह सक्षम करने के लिए। एक नामस्थान की समस्या है और एक गायब फाइल है, जिसके परिणामस्वरूप .effects () फ़ंक्शन नहीं है

      सबसे पहले, इसे सही jQueryUI संस्करण सीडी डाउनलोड करें और <पूर्व> jquery = / buildout_dir / भागों / आमलेट / सामूहिक / जेएस / jqueryui सीपी jquery.ui.effect.min.js $ jquery / js / jquery.ui.effect.core.min.js

      फिर $ jquery निर्देशिका में सीडी और नेमस्पेस को सही करने के लिए सभी प्रभाव संकुलों को कनवर्ट करें। उदाहरण: <पूर्व> एमवी जेएस / jquery.ui.effect-highlight.min.js js / jquery.ui.effect.highlight.min.js

      फिर प्रभाव के साथ प्रभाव $ jquery / config.py के सभी घटनाओं को बदलें। वीआईएम उपयोग में

       : 1, $ s / effects / effect / g   

      दूसरे, jQuery आधारित स्वत: पूर्ण विजेट को सक्षम करने के लिए, सीआरडी निर्देशिका में सीडी आपके बिल्डआउट का और <प्री> git क्लोन https://github.com/plone/plone.formwidget.autocomplete.git plone.formwidget.autocomplete git चेकआउट jqueryui-autocomplete

      फिर अपने versions.cfg को संपादित करें। मेरे लिए

        plone.formwidget.autocomplete & gt; = 2.0   

      काम करता है फिर अपना buildout.cfg संपादित करें और zcml और विकसित करें के अंतर्गत पैकेज जोड़ें। मैंने एक बिल्डआउट किया था, लेकिन यह ज़ोपे को पुनः आरंभ करने के लिए पर्याप्त हो सकता है। जाहिर है, पोर्टल इंस्टॉलर पर जाएं और उत्पाद को पुनर्स्थापित करें।

      अपडेट

      जैसा कि टिप्पणियों में वर्णित है, यह पूरी तरह कार्यात्मक नहीं था। मुझे आगे एक .js फ़ाइल को संशोधित करना था, अर्थात् autocomplete.js से plone.formwidget.autocomplete पैकेज। यहां परिणाम है

      यह सब एक साथ रिलेशनशिपविजेट और स्वत: पूर्णतया विजेट काम को एक साथ बनाता है। मुझें यह पसंद है।

      मैंने भी jQueryUI पैकेज के लिए गिथूब पर एक बग रिपोर्ट दायर की है।

javascript - check value of $(this.el) in backbone -


I'm just starting with the spinal cord, javascript, jquery and the like. I am looking at a backbone that, from this post, it seems that I have to demote my schedule My Event ID is bound to an element with #createBtn ID, so I tried to do it:

  $ (this.el) .undelegate ('# createBtn', 'click');   

When the visualization of my spinal cord begins, this event registers it:

  Event: {click on #createBtn ":" CreateNewTemplate ",   

I'm still talking about my usual button. I'm guessing that is not working in any way and I know what $ (this.l.) is actually indicating. Whole JS this and everything is still misleading to me, so I'm not sure whether $ (this.L) will also work in the method that I am trying to do or something else How do I need $ (This.el) behavior, or how can I see that object, any debugging signal of it will be super helpful thanks!

Try console.log to output the value of this and it is right before your undelegate . This way ...

console.log ("this is it", this)

console.log ("This is it. L ", this.L)

Then see the output in the browser console.

c++ - Best way to compile (a type of cpp program) that has lot of parameters -


I'm learning OpenGL these days and I'm compiling it from the command line (I do not want to use the IDE because I 'Used for VIM). It may be a hassle to compile the OpenLeal files, say that I have a file named hello CPP to quickly compile and run:

  G ++ - Framework GLUT-Fraimaker OpenGL - FrameMarkCoCo Hello .cpp & amp; ./a.out   

Since I'm learning OpenGell, I will test with several different files and it is not possible for me to type the above command all the time. Everything I need is something:

  some_command% & amp; ./a.out   

some_command is some of the most commonly used (like G ++, make), and% filename, is the best.

I think Macfill is a possible solution, so I went ahead and learned about makefiles, but it works for a specific name; There are but still it seems very difficult for me (I have to type manually - ARGUMENT = filename in the part).

In addition to this, I think the shell script can be a good solution. The only fallback is that I have to self-define a name for shell-script.

I want to know that there is a better way for me to compile and run OpenCL CPP files quickly

Thanks a lot.

I think you want to be able to do something like this:

  create foo   

(say, from vim ), where foo is the basis of the source file that you are using Varies on

For example:

  CFS = G ++ CFFSFGS  

= - Framework GLUT-Framework OpenGL-Framework Cocoa%:% .cpp $ (CXX) $ (CFGFLAGS) -o $ @ $ & lt; ./$@

You should allow to run Hello and it will be:

  • An executable to In the current directory (if Hello.cpp has changed).
  • Run Hello for you, if it has been decided to compile and the compilation is successful.

c# - Regular expression in .net to get a special tag -


नीचे एक नमूना HTML कोड है:

  & lt; div & gt; & lt; span & gt ; span1 के & lt; / span & gt; & lt; / div & gt; परीक्षण के लिए & lt; b & gt; & lt; / b & gt; & LT; अवधि & gt; span2 के & lt; / span & gt;   

क्या सभी स्पैन टैग डिवेलट टैग्स में नहीं हैं (इस नमूने में: span2)

इस पोस्ट के अनुसार यह मेरा पैटर्न है लेकिन यह काम नहीं करता। पैटर्न: ((?: (?! \ B & lt; div & gt; \ b)) *) ((| | \ n) *?) & Lt; span & gt; ((। | \ N) *?) & Lt; / स्पैन & gt; ((। | \ N) *?) ((?: (?! \ B & lt; / div & gt; \ b)) *)

आप वास्तव में HTML को पार्स करने के लिए नियमित अभिव्यक्ति का उपयोग नहीं करना चाहते हैं आप इस स्टैक ओवरफ़्लो प्रश्न के कई कारणों के बारे में और पढ़ सकते हैं:

आपको एक HTML पार्सर का उपयोग करना चाहिए, या यहां तक ​​कि एक सरल XML पार्सर जैसे

c++ - how to wait effectively on a set of semaphore? -


I am using Sakers with shared-memory to communicate between multi-producer and multi-client There are two main types of semaphores in the system, which are "stored semaphores" and "processed semaphores"

The system is running as following: Producers constantly put data in shared-memory, and then stored Increase the value of SACAFORE, while consumers are in the loop To wait for such stored Simantikarn. Consumers will process such data after receiving data from the manufacturer, and then, the increase in the value of processed semaphores will result in producers waiting on "processed semaphore"

Manufacturer Code:

 for  (int i = 0; i & lt; nloop; i ++) {sleep (100); Strcpy (shared_mem [i], "data for processing"); Sem_post (& amp; shared_mem [i] .stored_semaphored); If (sem_timedwait (& msg_ptr-> processed_symph, & amp; ts) == - 1) {// wait for the result if (error == ETiIdutty} {} break; } Else {// success}}   

Consumer Code:

 for  (int j = 0; j & lt; MAX_MESSAGE; j ++) {If (Sem_trywait (& amp; (shm_ptr-> Message [j]. Stored_semaphore)) == -1) {if (errno == EAGAIN) {} else {// success ==> Process data // post results in shared memory, and increased // ProSide by StraCopy (shared_mum [j] .output, "processed data"); Sem_post (& amp; (shared_mem [ja] .processed_semaphore)); }}}} MAX_MESSAGE   

My problem is that almost 100% of CPU is being wasted for loop in the consumer code because there is no data from the manufacturer, this loop To run continuously.

My question is that there is no other way to wait on the set of SACPSAR (which can be similar to the waiting mechanism by selection, pole, or EPOL), which does not ruin the CPU time.

Hope you see your answer. Thanks a lot!

As far as I know there is no way to wait on a set of semaphores. This means that all accesses should be done online through a single semaphore. You are looping on a set of sakers, so they can become collectively an object. The need to know the consumer when any semaphores are indicated, to use an additional sem_post on a new semaphore to indicate that the set of semaphores has changed.

Your manufacturer code becomes something like this:

  .... sem_post (and shared_emam [i]. Stored_semaphored); Sem_post (& amp; list_changed_semaphore); / * Consumers wake * / ....   

and consumer:

  / * Unless a user has indicated that he changed the Sackfire list / / (If! Sem_wait (& amp; list_changed_semaphore)) at least one manufacturer has changed a signal * / for (int j = 0; j & lt; MAX_MESSAGE; J ++) { If (sem_trivite (and (mmtp-> message [ja] .store_symer)) == -1) {}}}   

list_changed_semaphore for one Instead of using semaphore you need to have something in your set of sigma You can use a pthread_cond_t position variable for the prompting of the logging list_changed_semaphore as the example shown here does not need to be a counter, to indicate it There is a need to be only a bit that a manufacturer has revised the list.

Django model utf8 with legacy database -


I have a legacy database with Latin 1 encoding. I do not have the access to convert it to utf8 when I read value from the model I am getting distorted text.

I tried to use name.decode ('utf-8') but it is throwing a Unicode error:

 < Code> 'ascii' can not encode characters in codec position 4-12: not in sorted range (128)   

name.encode ('utf-8') either does not work Does.

If you have access to your 'settings.py' file, you can say that Your database is using 'latin1'.

The following is an example of the 'database' configuration in the 'settings.py' file.

  DATABASES = {'default': '' engine ':' django.db.backends.mysql ',' NAME ':' test_db ',' USER ':' root ',' password '', 'HOST': '', 'PORT': '3306', 'Option': {'charset': 'Latin 1', 'use_onikoda': true,},},}  / Pre> 

I had a similar problem, check the link here

ruby - anemone print links on first page -


wanted to see what I was doing wrong here.

I have to print the link on the original page, even to the other domain. And exit.

  Expected 'anemone' url = ARGV [0] Anime Crowel (URL, Depth_Limit => 1). Anemone | Anemone.on_every_page | Page | Page.links.each do | Link | Say link end end end   

Am I not doing right?

Edit: Outputs nothing.

This worked for me

  needed 'anemone' Is 'optparse' file = ARVV [0] file. Open (file). Url | Url = URI.parse (URI.encode (url.strip)) Anemone.crawl (url ,: discard_page_bodies = & gt; true) what to do. Anemone | Anemone.on_every_page | Page | Links = page.doc.xpath ("// a / @ href") if (link! = Zero) links.each do | Link | Say link.to_s end end end and end    

c++ - Passing and storing lambda function as callbacks -


I was thinking that this would be an acceptable approach to writing callback:

collecting callback :

  straight event holder {std :: function & lt; Void () & gt; call back; EventTypes :: EventType type; }; Std :: vector & lt; Events: EventHolder & gt; EventCallbacks;   

method definition:

  at zero (EventType OnEventType, std :: function  & amp; amp; and callback ) {Event :: Eventholler NewEvent; NewEvent.Callback = std :: move (callback); NewEvent.Type = OnEventType; EventCallbacks.push_back (std :: move (NewEvent)); }   

Binding event:

  button-> (Event type :: click, [] {// ... callback body});   

My biggest question will be about passing through the callback value. Is this a legitimate approach?

This event is a perfectly valid approach to storing handlers.

However, I tell some details about the signature of your function to add callback. You pass it by making a reference from the context. In your example, you currently have:

  at zero (EventType OnEventType, std :: function & lt; void () & gt; & amp; amp; and callback)   

It is good, unless you only tie it for attitude. However, unless you want to reject it for certain reasons, then I suggest that you always have a method that accepts criteria from the value or the lavalu context and is considered necessary, as a supplement Add Ravelu Reference Edition.

There is no method that refers to a new value, which means that your code will currently fail to compile it:

  std :: function & lt; Void () & gt; Func ([] () {/ * some clever /}); // do something necessary with func, perhaps debug logging or debug buttons- & gt; On (Event Type :: Click, Function);   

For simplicity, whenever you choose to pass a value, you can follow these guidelines in general:

  • If you need a copy or intends to modify the sent value without the desire to change the actual object: Passed value.
  • If you intend to modify the value you send, and want to make these changes affect the actual object: pass by reference.
  • If you do not want to pass the object, but believe that it is beneficial to avoid copying: pass from context.
  • If you take the criteria from the value, context or const context, and believe that there are valuable customizations which can be achieved by using the knowledge that the input parameter is a temporary one: it also passes from the rvalue context Allows to

How to override regular binary operators such as +, -, *, / in Ruby? -


मैं सामान्य ऑपरेटर्स जैसे कि + , - को ओवरराइड कर सकता हूँ, * , / , & lt; , == , & gt; , आदि एक वर्ग के लिए?

इन्हें ओवरराइड कैसे किया जाता है इसके आधार पर, वे जरूरी बाइनरी नहीं हैं।

 < कोड> कक्षा Foo def +; : प्लस एंड डीईफ़ -; : माइनस एंड डेफ *; : तारांकनिक अंत डीईएफ /; : स्लैश एंड डिफ & lt ;; : लेफ्टिनेंट एंड डीईफ़ ==; : ईसीसी अंत डीएफ़ & gt;; : जीटी एंड एंड फू.न्यू। + # = & Gt; : Plus Foo.new.- # = & gt; : शून्य Foo.new। * # = & Gt; : तारांकन फू.न्यू। / # = & Gt; : स्लेश Foo.new। & Lt; # = & Gt; : Lt Foo.new। == # = & gt; : Eq Foo.new। & Gt; # = & Gt; : Gt    

nsstring - Finding non-spacing characters in Objective-C -


How do I check if a letter in my NSString is a non-spacing character?

For example:

  NSString * string3 = @ "A" ?? Answer ¥ à A² "; // 12345678 & lt; - only takes 8 spaces   

NSString is a length 11, but the location that actually is on it is 8

In Java, they can check the character type using the code given below:

  is a stable boolean mark (four f) {int type = Character.getType (ch); return type == character. NON_SPACING_MARK || == type character. Ansielosaisoaisaisaiaarsi || == type character. COMBINING_SPACING_MARK;}   

of about objective-c Or? Thank you for bdash.

  NSCharacterSet * characterSet = [NSCharacterSet for nonBaseCharacterSet]; (Inti = 0; string3.length> gt; i; i ++) {NSString * string = [string 3 Uppriwartk range: Ansmkerenj (i, 1)]; Ansarenj Ptrrekha = [string Simaofchractorformset: Critrsat]; if (letterRange.location! = NSNotFound) {Anselog (@ "non-base characters Set ");} and {NSLog (@" normal ");}}   

You will know which character is not in space. Another way, you can find the code below to the following non-spaces

  NSString * newString = [[string 3 Gtksiyrikritbakractors Inset: [[Anssiarsiaractorsnet Garbajhkaractorsat] Inwartedset]] to couples : @ ""];   

So for this example, the new string length is 3. That's what I'm looking for. Thanks guys.

You can use to retrieve the set of characters in Unicode Symbols category. NSCharacterSet that it provides the ability to set provides a member of the character set, and NSString ability to find special characters within a string (or No) Members of the given NSCharacterSet .

popup - Window.open Invalid Argument in Javascript -


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

  • 14 उत्तरों

    मैं कोशिश कर रहा हूँ एक पॉप अप के रूप में दिखाने के लिए यह विंडो प्राप्त करें जब मैं हाइपरलिंक पर क्लिक करता हूं, तो मुझे चरित्र 4 पर "अमान्य तर्क" देता है।

      window.open ("notifMsg.htm", "मेरा सूचना", "स्थिति = नहीं, ऊंचाई = 545, चौड़ाई = 433, आकार बदलने योग्य = नहीं, उपकरण पट्टी = नहीं, मेनूबार = नहीं, स्क्रॉलबार = नहीं ");   

    window.open ("notifMsg.htm") काम करता है, लेकिन एक बार जब मैं अधिक पैरामीटर जोड़ता हूं तो यह अमान्य तर्क देता रहता है। मैंने 3 स्कूलों को देखा है और यह प्रारूप दिखता है।

    किसी भी मदद की बहुत सराहना की जाएगी! धन्यवाद।

    इंटरनेट एक्सप्लोरर का कहना है कि विंडो नाम मान्य पहचानकर्ता हैं। आपके नाम में इसमें एक स्थान है। इसके बजाय "My_Notification" की कोशिश करें।

npm - Why does Grunt go into devDependencies? -


The grunt documentation states that this (and any plugins) should be included in the devDependencies section package.json . I might see something obvious, but why can not I see if I want to deploy the production version of my app, then I need to make it. And if I'm not making it, why do I need to be raucous?

In other words, by dragging my repo, I say:

  npm install --production   

Code> devDependencies section How do I create my app?

What are you using for the hoarse?

Kadhi is usually listed in devDependencies because whenever you are deploying it for production, you will still need to compile things like coffee scripts, SASS, etc.

In our case, it looks like this: we check latest changes in the sitemap, and then log into our deployed script server, pulls the latest code from GitHub Master

Then we are building a clean production of the site on the server.

javascript - event.preventDefault behaving weirdly in Firefox on keydown -


The code below is effective in preventing browser defaults by firing in Chrome and Safari. For some reasons, however, my code does not run even after pressing the arrow key in Firefox

  $ (window) .keydown (function (e) {switch (e.which) {case 39: // right arrow key e.preventDefault (); $ ('body') ScrollLeft (scrollNow + z (10); break; Case 37: // left arrow key e.preventDefault (); $ ('body' ScrollLeft (scrollNow - z (10)); break;}});   

I tried return false; Instead of e.preventDefault (); Also, but I have no effect in e.preventDefault (); Also tried to put after the scrollLeft line, but is it not working either any ideas?

try this -

  code = e.keyCode || E.which; Switch (code) {   

excel - given a martix, use its row/column headers to find the corresponding value -


छवि प्रविष्ट करें यहाँ विवरण

तो यह कैसे एक उदाहरण है कि कैसे मेरे डेटा शीट में दिखता है अब मैं एक मैक्रो लिखना चाहूंगा जो करता है: पंक्ति शीर्षलेख लेता है (जैसा कि शीट 1 में मान 1 है) ले जाता है कॉलम हैडर (शीट 1 में ए 2 हैडर 2 है) तो ए 3 का मूल्य 1 9 18768 शीट 1 में होना चाहिए।

मुझे लगता है कि जब तक कोई निश्चित हेडर / मान नहीं मिल जाता है और उस पर पता होता है, देखने का आसान तरीका?

यहां छवि विवरण दर्ज करें

यह लगता है कि INDEX और MATCH कार्यपत्रक फ़ंक्शन एक समाधान हो सकता है उदाहरण के लिए, आपकी दूसरी स्क्रीन कैप्चर में, सेल सी 1 में सूत्र, = INDEX (शीट 1! $ B $ 2: $ F $ 6, मैच (ए 1, शीट 1! $ ए $ 2: $ ए $ 6,0) जैसे कुछ हो सकता है , मैच (बी 1, शीट 1! $ बी $ 1: $ एफ $ 1,0))

php - [SOLVED]Kohana 3.3 relationships work locally but not on server -


I took my website from the local host to the real host .... and started the problems.

Relationships work on my windows machine, but my host throws it on the Koh

My These links are in the Model_User class

  safe $ _has_many = array ('klinikas' = & gt; array ('model' = & gt; 'klinika', 'through' = & gt; Klinikas_users '),' roles = = & gt; array ('model' = & gt; 'role', 'through' = & gt; 'roles_users'););   

The question is, what does it work and how can I fix it?

As it turned out, let me get my module name from user.php User.php and need to work successfully!

internationalization - How to enable localization support in Apportable UIKit? -


Currently, I'm trying the Apportable Starter Kit. I know that there is limited UIKit support in it, but it feels a lack of internationalization / localization feature.

These are my questions.

  1. How to display a non-Roman Unicode letter? (East Asian script)
  2. How to input non-English characters with the system keyboard? (East Asian IME) In my device, keyboards are enabled and displayed, but when I input some letters with the keyboard, it only inputs English characters instead of expected IME compositions (I try to change user settings

    There is currently a problem Apportable SDK NSString non-ASCII continuous With the initials.

    You can walk in the forum bug that starts with the NSString constant.

    A solution would be something like this:

      #ifdef APPORTABLE imageCopyright = [NSString string withUTF8 string: "Image one © C"]; #else imageCopyright = @ "Image A © C"; #endif   

    I understand that the Android keyboard is not programmable configurable, it is controlled by user settings.

volume slider in windows phone 8 -


I am creating Volume Slider from my music player for Window 8, but throwing an exception by saying:

'System.ArgumentException' was done on Microsoft.Phone.ni.dll but the user code

was not in my code: < Pre> & lt; Slider X: name = "volume slider" horizontal alignment = "left" margin = "18,563,0,0" vertical alignment = "top" width = "245" randartransform.org = "0.467, -0.833" value changed = "changed media volume" /> ;

and

  // Change the volume of the media Private Zero ChangeMediaVolume (Object Sender, RoutingProperty Changed Event Events> Double & gt; Args) {{ BackgroundAudioPlayer.Instance.Volume = (Double) VolumeSlider.Value; }} Zero initializePropertyValues ​​() {BackgroundAudioPlayer.Instance.Volume = (Double) VolumeSlider.Value; }    

You do not set the extent of the slider. The default limit is 0 to 10, however, BackgroundAutoPlayer.Instance.Volume requires a value between 0 and 1, the default value is 0.85, as you can read

Use it

  & lt; Slider x: name = "volume slider" horizontal alignment = "left" margin = "18,563,0,0" vertical alignment = "top" width = "245" rendertransform = "0.467, -0.833" max = "1" value changed = " ChangeMediaVolume "/>   

And maybe you have SmallChange = "0.01" and LargeChange = "0.1"

Want to set up? Hope this helps

machine learning - What is a good metric for feature vector comparison and how to normalize them before comparison? -


background:

I work on a down-up approach to the image I am partitioning, where I first want to merge the image into small areas / super-pixel / super-voxels and then on the basis of some criteria, along with it in more divide areas. I am playing with a criterion, to measure how similar it is to appear in two areas. To measure the presence of an area, I use several measures - intensity figures, textures, etc. I count all the features in a long feature vector for an area.

Question:

Given the two adjacent segments, let R1 and R2, F1 and F2 be the same feature vectors. My questions are as follows:

- What are the good metrics for measuring equality between F1 and F2?

- How well should F1 and F2 improve metrics? (It is not possible to use any supervised approach of generalization because I do not want to add my algorithm to a set of images)

Solution in my mind:

In terms of equality (R1, R2) = dot_product (F1 / Norm (F1), F2 / Norm (F2)), I first used F1 and F2 I make generalizations to make unit vectors and then use the dot product to have a similar between two vectors In the form of a measurement.

I wonder if there are better ways to improve them and compare them with metrics. I would be glad that the community can tell me in some contexts and the reason why the reason is better than some similarity measure.

state of the art picture split algorithm conditional random field superpixel (IMO algorithm is the best option). This type of algorithm captures the connection between each superpixel (commonly using SSVM ) as well as the adjacent superpixel.

Generally take a bag of facilities for each of them, such as histograms, or the feature that you think can help.

There are several papers describing this process, here you have some of those that I get, however, there are not many libraries or software to deal with the CRF.

  • The best you can find.

  • osx - Xamarin.Mac app that is not visible in Dock -


    I have a Xamarin.Mac C # application that needs to run as a hidden daemon.
    How do I tell my app? Do not show its icon in OS X Dock?

    Thank you!

    EV

    You can edit the Info.plist file in your project , You can create a new property on the source tab of "Application Agent (UIElement)", and set it in a string of "1".

    It is similar to manually setting a LSUIElement from 1 to a text editor and asks OS X to launch the agent as an agent.

    geolocation - GPS emulator for .NET tracking application -


    I am currently working on a net application for which the tracking location of our position is necessary. I use an external GPS device that connects me as a location tracker through my disappearance COM port. My device is working, but I could not find a way to fake GPS signals. I do not know whether there is a GPS emulator capable of feeding GPS signals through a COM port

    If anybody has experience in this area, please give me some guidance. I would greatly appreciate thank you

    Here's a link to what you are trying to do, how to create test cases to get it

    This does not do on the COM port, but the REST API Is based on ..

    sql - EF pluralize table's name on generating database from model -


    I have some models and tables in EF that you can see one of them:

    option model

    Now when I want to create a database from the model, it's named after ' Adds tables in generated SQL:

      Make Table [DBO]. [Option] ([ID] IITIT (1,1) NULL, [Name] Encryption (50) Noel, [value] is not an integer);   

    I also disabled plural versions of its name, but nothing changed:

     Enter image details here

    Due to deployment of web application there are errors. How can I stop pluralism? "post-text" itemprop = "text">

    Just override the OnModelCreating method and remove "PluralizingTableNameConvention"? ??? the seminar. So you are telling the Antrim Framework that do not notify the names of the table, just

    upgrade

      safe override zero OnModelCreating (DbModelBuilder ModelBuilder) {modelBuilder.Conventions. Remove & lt; PluralizingTableNameConvention & gt; ); }   

    This will remove a polarized conference that is linked to all model builders by default

    In addition to this you must add a namespace

     < Code> System.Data.Entity.ModelConfiguration.Conventions;   

    Hope this will help

    python - How to update a plot in matplotlib? -


    I have issues highlighting this data. I will assign users to the units in the time scale (X-axis) And then call this recalculation and this function plots () . I just do not want to plot the plot, attach another plot to the figure <<> DEF plots (): global vlgaBuffSorted CNTR () result = collections.defaultdict (list) in vlgaBuffSorted d for:. Result [d] [result_list = result.values ​​() f = illustration () graph 1 = f.add_subplot (211) graph2 = f.add_subplot (212, sharex = graph1) For the items in the result_list: TL = [] vgsL = [] VDSL = [] isubL = [] For the word in the dictionary: tL.append (dict ['time']) vgsL.append (dict ['vgs' Graph1.plot (TL, VDSL, 'BO', label = 'one')) graph1.plot (TL, vgsL, etc.) 'RP', label = 'B') graph2.plot (TL, isubL, 'b -', label = 'c') plotCanvas = FigureCanvasTkAgg (f, pltFrame) toolbar = NavigationToolbar2TkAgg (plotCanvas, pltFrame) toolbar.pack Side = down) plotCanvas.get_tk_widget (). Pack (side = top)

    You have two options:

    1. Correctly what you are currently doing, but call graph1.clear () and graph2.clear () before replacing it with the most Slow, but the simplest and most robust option.

    2. Instead of copying, you can only update the data of plot objects. You will need to make some changes to your code, but every time you replace things, lots of It should be much faster though, the data you are plotting can not change the size, and if the limit of your data is changing, then you will need to manually reset the X and Y axis boundaries.

      To give an example of another option:

        import matplotlib.pyplot as plt import nppy np x = np.linspace (0, 6 * np.pi, 100) y = np.sin (x) # If you are embedding things in a tkinter plot you probably will not need this ... plt.ion () fig = plt .figure () ax = fig.add_subplot (111) line1, = ax.plot (x, y, 'r-') # gives a tube of line object, thus np.linspace (0, 10 * np. Pi, 500) in the comma for the line: line1.set_ydata (np .n (x + step)) fig.canvas.draw ()    

    Batch script checking file size methods? -


    I have the following code in one of my scripts, but it does not seem to be reliable, it seems that if the file is actually 1 If he is less then he may fail or at least did it for somebody, am I doing something wrong or is there a better way of doing this?

    In short, check that file.txt is & gt; Size = %% ~ zi rim has been added for 0: ~ = <%> i ("file.txt"): If defined size set size = 0 if% size% Gtr 0 (type file.txt & gt; & Gt;% FNAME%) Other (echo No Data Found> System Factor%)

    Edit: The code was created with code I changed the upstream Actually it was never possible to create such a file.txt file. I changed the name of the file, to repeat some issues like foobar.txt in the file. "If the defined size is not set size = 0" then it seemed to solve the problem.

    Only one thing can think that the file will not exist, in that case %% ~ Zi Nothing spreads (no 0). After deciding this size easily, the size is clearly set to 0 if the size is not defined. "Set = %% ~ set to zi" in / f% ("file.txt") for

      if defined size set size = 0 if% size% gtr 0 (type File.txt & gt; & gt;% FNAME%) Other (echo not found on system Data & gt; & gt;% FNAME%)    

    c# - AnonymousType cannot be serialized. Consider marking it with the DataContractAttribute attribute -


    I have a web API and I'm just trying to return some of the data to the calling client in XML format.

    I keep getting the following error:

      & lt; Exception Message & gt; Type '& lt; & Gt; f__AnonymousType7`9 [System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.Nullable`1 [System.Int32], system Ktring] 'not sorted Can be done Consider marking it with the DataContractAttribute attribute, and mark all its members that you want them to be serialized with the DataMemberAttribute attribute. If it is a collection, consider marking it with the Collection Datactact Attribute. See the Microsoft .NET Framework Document for other supported types. & Lt; / ExceptionMessage & gt;   

    Here is the controller code:

      Public class TribuneShowsController: ApiController {Personal read-only TVDataEntities db; Public TribuneShot Controller () {db = New TVData}; Db.configuration.ProxyCreationEnabled = false; } Public IEnumerable GetTribuneShows (String title = null, string style = null, string showTypeDescription = null, string directorName = null, string released = NULL) {var db.TRIB_LKP_ShowTypes.Where query = show (in db.TRIB_Shows from showTypes select v = & gt; v.ShowTypeCode == shows.ShowTypeCode) .DefaultIfEmpty () {new data source = "Tribune" or, shows.Title, EpisodeId = "", EpisodeTitle = "", style = shows.Category, ShowTypes.ShowTypeDescription, show. Director Name, Show Release YEAR, Season Episode = ""}; If (title! = Null) {query = query.Where (s => s.Title.Contains (title)); } If (style! = Null) {query = query.Where (s => s.Genre.Contains (genre)); } If (showTypeDescription! = Null) {query = query.Where (S = & gt; S. Sotaip details. Incorporated (Sotaip description);} If (directorName! = Null) {query = query.Where (s = & gt; s.DirectorName.Contains (directorName)) ;;} if (release year! = nULL) contains {query = query. where (S = & gt; s.ReleaseYear.ToString (). it (Rilijhiyr)); } return query. Tulist ();} protected override void Dispojh (bool Displeng) {db.Dispose (); base.Dispose (settlement);}}   

    This is my first question, I How can I define XML by return item (via API)? When a link goes on, it will get the XML.

    The second question is: How do I return the unknown type in the code as XML in my code above the client?

    After the text "itemprop =" text ">

    Name the type that is now anonymous:

      [DataContract] public class {public string Show Datasource {get} set;} public string title {get} set;} ... etc}   

    then

      new show {data source = "Tri Bune ", title = shows.Title, EpisodeId =" ", epistityle =" ", generator = show. Category, ShotipDiscription = Show Type Show Show, Director Name = Show. Director Name, Release Year = Show. Release Year, Season Episode = ""};    

    asp.net mvc 4 - Entity Framework data provider not found, entityclient -


    First of all, I have found many questions and many answers are related or considered as my problem, although anything Not working for me.

    I have a new templated MVC4 website, which is a new database in installing a new SQL Server 2008 R2. I ran the aspnet_regsql database and made all the tables I made. AMMM model which generated connectionstring in my web.config

      & lt; ConnectionStrings & gt; & Lt; Add name = "testEntities" connectionString = "metadata = re: //*/Models.Test.csdl | res: //*/Models.Test.ssdl | res: //*/Models.Test.MSL; provider = System.Data.SqlClient; Provider Connection String = & amp; quot; Data Source = WEBSRV \ SQLEXPRESS; Initial Catalog = Test; Continue Security Information = True; User ID = Test; Password = Test # 1337; Multiple Activism = True; App = EntityFramework & amp; quot; "Provider Name =" System.Data.EntityClient "/> & Lt; / ConnectionStrings & gt;   

    Creating a website gives me an error Unable to find the requested net framework data provider, it can not be installed.

    None of my machine.Cong stopped The same issue happens if I run the website locally. I have not installed any NuGet package in the Visual Studio Web Host or on the IIS of my webserver

    Why did I get this error?

    OK, I detected this problem.

    You can not use that connection string more than ADMX connection. The way I have this web In config, the website uses the same connection string for the membership item, which is not compatible with the system. Data Anti-client providers and systems in my case are needed. Add data.Sqlclient to the second connection string, reduce the unit framework in it and the web. All errors referenced by the membership provider features in the configuration are removed and allow the page to render and request the goods from SQL Server.

    Nightmare can come back to work on my website. O /

    winforms - How to add already existing ToolStrip Buttons to a ToolStrip Dynamically -


    I have a WinFormon API using MII form, on MDI form I have a toolstrip with a button (in the button Images), working as the main menu button of the application. So when the user clicks the button on the toolstreet, the child's form opens with the mdichild form of that button.

    That's why I have already made images and six buttons in the project but I want the user to select the button that appears on toolstrip. So the user opens the app and there is only one button on the toolstrip. The user clicks on that button and a child screen opens all available existing buttons which can be on toolstrip. The user chooses the buttons that want to appear on the toolstrip and then clicks on the screen to save the button on the screen.

    What I need is that as soon as the user should click that button to save the button, automatically appear on the toolstrip. Now I have to close the application with the user and then click the button To open it, it must be opened to display it on the toolbar.

    How can I get the button to automatically appear?

    Just create all ToolStripButtons , and each Visible property to false . When users select them to be shown, change the property of visible to ToolStripButton to true . They will automatically appear on the ToolStrip .

    I tested with Oxygen using RemObjects (formerly AKA Delphi Prism ) using VS2010.

    • Start a new WinForms application
    • Drop a ToolStrip on the window. Right-click on it and choose Insert Standard Item . Double-click the
    • new button ( newToolStripButton ), and add the following code to the newToolStripButton_Click handler:
       // Oxygen version: helpToolStripButton.Visible: helpToolStripButton.Visible; HelpToolStripButton.Visible! = HelpToolStripButton.Visible;  
      • Click the "code" newTooStripButton to run the application, and repeat the correct - most ToolStripButton ( help < / Code> View)> Button) appear by ToolStrip and disappear.

    c# - How to handle dependencies for custom Powershell Cmdlets -


    I am developing some PowerShell CMDlet which relies on third party libraries from Google, on my machine I have a CMDlet on one. I am able to compile the DL file and everything works, but when I try to load it on another machine, I can not get the assembly after running an import-module on my DLL file.

    How can I package my CMDlets into a DLL file so that dependence on another machine is established, then leave my DLL file somewhere, load it and do it?

    You will need to redistribute the third party library assemblies on which you depend. If you deploy ExCopy to your module, then you should be able to put those assemblies in the same directory as your CMDlet assembly. When you do an import-module on your module, those assemblies should load automatically with your assembly. You should consider creating a PSD1 file for your module.

    python - CSV delimiter that is read from a file -


    I have a JSON settings file that has the settings of my script, a part of the settings csv.writer () < / Code> is the delimiter for.

    When it is being read in variable settings and give it to me it: {'delimiter': u ','}

    When I try to use it in csv.writer (out, ** settings) I get the following error: TypeError: "delimiter" 1-character string Should be .

    To fix this now I do this: Settings ["delimiter"] = Settings ["Delimiter"]. Encoded ("UTF-8")

    ... but I am thinking that there is no way, I can read this file in the first place, it will mean that I do Have not been done for?

    Edit:

    The settings file is read as:

      Settings with open (file): Details = json.load ( Settings,    

    No, JSON uses standard Unicode whole (this is a good thing P> HTML>

    uiwebview - Can you get the UserAgent used by WebView in iOS without starting a WebView? -


    Is it possible to find that the user agent (and other headers, such as accepting) that would use a webpage First start a webview.

    I need to pass the User Agent and accept the header so that it can be ascertained whether a browser based connection is necessary or not. If a browser-based connection is required, then I will start a webview on a YouTube, the problem is that if the request does not match the user agent and accept the information that used to check the browser's need, the request failed It is possible .

    I do not want to start a webview, unless the browser connection actually needs service. If one is not needed, then the app can continue straight in the next step. I need to keep the UI as clean as possible, so a webview is not to appear to get header details.

    I have seen some answers from within the webview using javascript, but I do not want this webview to start just to get it. Is there any other way to find out what will happen before launching this header WebView?

    You should be able to get an HTTP header with an NSURLRequest

    < / P>

    javascript - What's the Node.js equivelent of the PHP hash function (including salt and raw output)? -


    My colleague has a database that stores account information; SHA256 is the account's head password and the value of salt is stored in the column as raw binary data (Blobs).

    Using PHP (PHP) is used (indicates true raw output):

      hash ("sha256", $ salt. $ Password, true);   

    I am trying to implement authentication on a node .js server which has the same head back password that is stored in the database from php, it does not seem to be :

      / ** * By agreeing with the hashed password stored in the database, validates the passwords sent by an end user. Node.js uses crypto libraries. * * @Param password passwords sent by end user. * @Hosted password stored in the ultimate dbPassword database. * @ Ultimate dbSalt encryption stored in the salt database. * / Function valid password (password, db password, dbset) {// What should be a buffer, hex, base 64, or what dBST? Var hmac = crypto.createHmac ("SHA256", dbSalt); Var Hashed = Hmac.update (password). August ('base64'); Console.log ("hazard user password:" + hashed); Console.log ("database password:" + dbPassword.toString ('base64')); Grab a return === dbPassword; }    

    With so many experiments, I found a solution. Encrypt a password using

      / ** * sha256 and a salt. Password * for @passam password hash * @ salt value for hash with absolute salt * / function SHA256 encrypt (password, salt) {var salty password = salt + password; Var sha256 = crypto.createHash ('sha256'); Sha256.update (saltedpassword); Return sha256.digest ('base64'); } / ** * Is stored in the database * Hashead accepts the passwords sent by the end user by comparing it with the password. * * @Param password passwords sent by end user. * Hashed password is stored in Base DBpassword database, encoded in base 64. * @ Ultimate dbSalt encryption stored in the salt database. It should be a raw block. * / Function valid password (password, dbPassword, dbSalt) {var hashed = SHA256 encrypt (password, dbSalt.toString ('binary')); Grab a return === dbPassword; }   

    Thanks to Traviso, however, he kept me on the right track.

    .net - C# mongo queries with json strings -


    It looks so basic that I'm convinced that I'm ignoring an orbit or a method, but For me, I can not find it

    I've got a Jason string like this:

      {SendId: 4, "Events.Code": {$ all: [2], $ nin: [3 ]}}   

    I can run this in a mongo shell against a find () or count () and what I find I am getting it. What is the easiest way to deal with this in C #?

  • BsonDocument has a good parsing method, but it is IMongoQuery
  • does not implement BsonDocument code>, and it implements IMongoQuery , but in it It does not have its own parsing method, and I take a BsonDocument [] from QueryDocument to BsonDocument
  • the aggregation framework, but Sometimes I just want to do a simple search or calculation work
  • Some of these questions are big and Gross, and I do not want to make them a line one line with query builder class

    , if the database works with json documents, and I get this stuff Can not run in the shell, is there any way to run it with the driver?

    It's ugly, but you can do this by doing this to BsonDocument and then wrapping in QueryDocument

      BsonDocument Query = MongoDB.Bson.Serialization.BsonSerializer. . Direct & lt; BsonDocument & gt; ("{SendId: 4, 'Events.Code': {$ all: [2], $ nin: [3]}}"); QueryDocument queryDoc = new query document (query); Var Results = Archive. FDAS & lt; Typeofferscent estimated & gt; (QueryDoc); // Simply use the search   

    If there is anything that you plan to do often, you can always wrap it in a method, or a like the following JSQueryDocument can create class:

      public class JSQueryDocument: QueryDocument {public JSQueryDocument (string query): base (MongoDB.Bson.Serialization.BsonSerializer.Deserialize.Deserialize & lt; BsonDocument & gt ; {Query}) {// Perhaps it is better to do this as a method instead of constructor / / debugging it queries Programming can not be formatted correctly}} /// ... var results = collection. Find (New JSQueryDocument ("{SendId: 4, 'Events.Code': {$ All: [2], $ nin: [3]}}"));    

  • c++ - Moving a lua table in C api -


    I am trying to move the table into another table using the LuaC API. For example, I have a table with this structure:

      a [b] [c] [d] [e] = value   

    I want to move the table to be below Table [B], which I can complete in Lua:

      a [b] [d] = a [b] [c] ] [D] a [b [c] [d] = zero   

    My current approach is to load a [B] [C] [D] table pile, so the stack Looks like:

      index value -1 d table-2c table-3b table-4 one table   

    then Load a [B] on the stack, so it looks like:

      index value -1 B table-2 one table-3d table-4c table-5b table-6 Then put the table on the pile, and the key of the insert D and table B is table B, so the stack is:  
      index Value-1d table-2d key-3b table-4 one table -5c table -6b table-7 one table   

    Then I have the lua_settable (L, -3) B to use [d] = D.

    This approach works for non-table keys, but for those who are in the table, fails for them, then something like this will fail:

      a [B] [c] [{}] [d] = value a [b] = a [b] [c] [[} [d]   

    note, I know that In the above it will fail in Lea given above because the key will be a new Lea table, I want to make it clear.

    I have tried to leave the parents of the table (without any such fate) [B] = B, Lava_System Global (L, A)) Does anyone know where I am wrong Am I

    EDIT: How to push keys / values ​​on the stack I have a small code snippet on it here to move a target table from one table structure to another (or as it is in the code)

    Solution:

    The issue was that there was some metatable function in the table that would prevent the change in the table (briefly) In, the person who created the script was a config table where no The composition was important, thus causing this problem.)

    If I understand your description correctly So what does this Lua code want for you:

      local ab = a [b]] al [d], ab [c] [d] = ab [c] [d ],   

    To apply in LuaC API, this machine is helpful with translation:

      enum {lc_nformalargs = 0}; Const int lc_nactualargs = lua_gettop (L); Const int lc_nextra = (lc_nactualargs - lc_nformalargs); / * Local AB = A [B] * / lua_getfield (L, LUA_ENVIRONINDEX, "A"); Lua_getfield (L, LUA_ENVIRONINDEX, "B"); Lua_gettable (L, -2); Lua_remove (L, -2); Emphasis (lua_gettop (L) - lc_nextra == 1); / * Ab [d], ab [c] [d] = ab [c] [d], zero * / lua_getfield (l, lu_neviron idx, "c"); Lua_gettable (L, (1+ LC_extractor)); Lua_getfield (L, LUA_ENVIRONINDEX, "D"); Lua_gettable (L, -2); Lua_remove (L, -2); Lua_pushnil (l); Lua_getfield (L, LUA_ENVIRONINDEX, "C"); Lua_gettable (L, (1+ LC_extractor)); Lua_insert (L, -2); Lua_getfield (L, LUA_ENVIRONINDEX, "D"); Lua_insert (L, -2); Lua_settable (L, -3); Lua_pop (L, 1); Lua_getfield (L, LUA_ENVIRONINDEX, "D"); Lua_insert (L, -2); Lua_settable (L, (1+ LC_extractor)); Emphasis (lua_gettop (L) - lc_nextra == 1); Return 0;   

    I have yet to develop a readable way of writing stack operations.