Sunday, 15 February 2015

php - Data is not being passed with redirect -


Below route is the code of the redirect. I am trying to use $ success to achieve successful success, but it is giving the "irreversible variable: success" error. I also tried to pass the data in the array format with the method. How can I fix this?

  If ($ data-> Save ()) Redirect redirect ('/ cases / ppost / notification') - & gt; ('Success', 'your case has been posted'.) - & gt; Together ('case number', $ data-> ID);  

According to the documentation redirect () -> With () method does not specify any data in your view, but it flashs in session:

Flash data with a Redirection

Redirection on a new URL and flashing data in session is usually done at the same time. Therefore, for convenience, you can create redirection examples and flash data in sessions in a method series:

Redirect ('user / login') -> ('message', 'login fails ');

This means that you have to access it in your view. This would probably be something like this:

  @if (session :: is ('message')) & lt; Div class = "alert alert-info" & gt; {{Session :: Mill ('Message')}} & lt; / Div & gt; @endif  

visualforce - Salesforce Missing Headers Puzzle -


I am trying to access the Salesforce header with a visualforce, as well as inline visualforces page. Both headers are different. My aim was to get the IP address from within the Visualforce page. I was able to get it from the VF page, while not inline VF page - what could disappear. Paste both headings below for reference:

Header page as an independent VF:

{accept = text / html, application / xhtml + xml, application / xml; Q = 0.9, image / webp, / ; Q = 0.8, Accept-Encoding = gzip, air extract, sdch, accept-language = en-America, n, cue = 0.8, cache-control = maximum-stale = 0, cipherSuite = AES256-SHA TLSv1.2 256 bits , Connection = survive, host = maseratispaceq.ap1.visual.force.com, referrer =, user-agent = Mozilla / 5.0 (Windows NT 6.1; WOW64) AppleWebKit / 537.36 (KHTML, like Lizard) Chrome / 41.0. 2272.89 Safari / 537.36, X-Bluecoat-Via = 02e34aac1d4420b1, X-Salesforce-Forwarded- to = ap1.salesforce.com, X-Salesforce-SIP = 65.116.212.3}

Inline VF page as < P> Header:

{CipherSuite = AES256-SHA TLSv1 256b Finalists, core.apexpages.framework.ApexViewServlet.getContentReflectError = true, core.apexpages.framework.ApexViewServlet. GetContentRequest = 1, host = maseratispaceq.ap1.visual.force.com, user-agent = Mozilla / 5.0 (Windows NT 6.1; WOW64) AppleWebKit / 537.36 (KHTML, like Lizard) Chrome / 41.0.2272.89 Safari I / 537.36, X-Salesforce-PDF = AAAAUUJBBRAVAAAAAAAAAAAAAAGIASAASAAAAAAAAAIAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAFTAA 128LLJJ8V 43LSJCERIPIPIIAMMAGS5SAKFPivaLHG4YBIP_AHxZWR6DMC4BJette4Oo =}


java - Replacing Restlet Error page -


त्रुटि पृष्ठों को दुबारा बनाना इस तरह दिखता है:

क्या कस्टम टेम्पलेट के साथ पुनर्स्थापना त्रुटि पृष्ठों को बदलने का एक तरीका है और / या किसी अन्य पृष्ठ पर पुनर्निर्देशित (त्रुटि HTML पृष्ठ)?

इसके दो तरीके हैं:

  • एक कस्टम स्थिति बनाएं सेवा
  • 2.3 रिस्टलेट से, एनोटेशन अपवादों का उपयोग करें

आप या तो कस्टम HTML, टेक्स्ट या संरचित सामग्री JSON leveraging Restlet converters जैसे वापस कर सकते हैं।

इस लिंक से आप इसे लागू करने के तरीके के बारे में संकेत दे सकते हैं:।

आशा है कि यह आपकी मदद करेगा थियरी


python 2.7 - take user input and activate and de activate a function at specified times -


OK, so I'm building a time-lapse program to run my pie. I have used a typewriter entry widget for one time and one time to get another entry widget and then save them to a list.

The problem is that I am looking for a way to compare these variables against one clock and one incident triggers and is idle at fixed time.

Actually the user enters the logic and the action is activated for the camera at 13:00, and then at 7:00, then it becomes inactive at 13:00 A simple boolean can be turned on and off to activate the code for the camera.

Everything else is working, but it is not the best way to compare variables against time, badly.

Any help please

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

Update:

First of all thank you for your reply, I have made this test app and how it works, how do I want to do it now

>  import time, as a teak camera Tanker = Fault on_time = '17: 48 'off_time = '07: 55' class app (): def __init __ (self): itself .root = tk.Tk () self.root.geometry ("50x50") self. Label = tk.Label (text = "") self.label.pack () self.checkTime () self.root.mainloop () def check time (auto): time_en = time.strftime ("% H:% M") Self.root.afte R (1000, self.checkTime) if time_now & gt; = On_time and time_now & lt; = Off_time: camera = true self.label.configure (text = camera) print camera and: camera = wrong self.label.configure (text = camera) print camera app = app ()  

It works fine if on_time is less than off_time but not in other way, so if I want the camera to be closed at 7:00 and at 17:00, the job is fine but if I do it at 17:00 I want it and it will not work at 07:00.

I need to know just one better way to compare the variable Thank you

Thanks

The best thing I can suggest is a background Thread should be in which there is an infinite loop which is checking time and setting boolean values ​​in proper form.


Django annotate with extra field display -


I have a model from which I am trying to comment on the average difference between 2 datetime fields.

<> & gt; & Gt; & Gt; X = MyModel.objects.all ()> & gt; & Gt; & Gt; Additional (select = {'average': average ('date (order_order_directory) - date (order accepted)') ')}) = ('> gt; & gt; Y [['quantity__sum': 1, '' Product__category__category_name ': u'badges', 'product__model_name': u'Non SIDA '}, {quantity__sum}: 6,' product__ category = category_name ': u'business', 'product_model_name': u 'SIDA'}]

But the above question does not display the average value in the list. How can I take this additional area?

You can try doing something like this:

  x.an Notate (sum = sum (sum = sum), average = average ('order__queue__checkin_time', field = 'date__order_date) - date (order__queue__checkin_time)')  

field keyword overrides the fields in the AVG-section. You also have the possibility to override the function using the keyword function .


Fastest way to convert Python List with dictionaries to one dictionary -


I have parsed data in large amounts in the dictionary, which contains dictionaries. [123123: [0.45, 0.4]}, {2332: [0.1, 09]}]

I have around 800,000 records in this list, And I want to get a dictionary from:

  my_dict = {} for i in dict_list: for k, i.iteritems in v: my_dict [k] = v < / Code> 

There is one fast way to do this

Understand, like

  & gt; & Gt; & Gt; Dict_list = [{123123: [0.45, 0.4]}, {2332: [0.1, 9]}]> gt; & Gt; & Gt; {Key: Item [key] for key for item in dict_list}} {123123: [0.45, 0.4], 2332: [0.1, 9]}  

Since compiling with C Code is done, it should be sharply sharp with Python and then by changing the dictionary object.


Using JavaScript and PHP to create a Button -


I am trying to create a button after a list. It is to see that the selection has been done and then there is a need to examine the preparation of a new list based on the selection

 `Select a horse:" $ table_header_horse_type; $ array_of_horses = ["horse_type = "" Horse type "]; $ user_horse_type_options = array (" mh_maintenance "=>" mature horse, maintenance "," mh_mare_late_gest "=>" mare - late pregnancy period "," mh_mare_early_lac "=>" mare - early milk " , "Mh_mare_late_lact" => "mare - late milk", "w_light" => "work, light", "w_mod" => "work, medium", "w_heavy" => "work, intense", "yh_nurse_foal" = > "Nursing Colt, 3 Months", "yh_wean_foal "Yah_long_year" => "long salting, 18 months", "yh_two_yrs" => "two years old, 24" "milk colt, 6 months", "yh_year_foal" => "shock of the year, 12 months" Month "); // Array for horse type - the user has selected a $ selector_horse_type = ''; {$ selector_horse_type foreach ($ unique_name => $ user_horse_type_options as $ human_readable =) = '' $ human_readable '' '..} $ Selector_horse_type. = ""; Echo $ selector_horse_type; // list picker displayed page` 
to

A good way is doing this with javascript. If the selection is done you are not making the button, but the selection was made after you will be displayed button. There is a good javascript plugin that is highly used Jquery UI will use the show () function: Here is a link if you add your code to this question, we can help further.


SQL Azure Premium tier is unavailable for more than a minute at a time and we're around 10-20% utilization, if that -


We run a web service that receives 6k + requests per minute during every hour and about per minute during close hours 3k requests about 3 party web services and many data feeds compiled from custom generated images Our service and code are mature, we have been running it for years. A lot of work has gone by the good developers in our service code base.

We are relocating to Azer, and we are seeing some serious problems. For one, we are seeing that our premium P1 SQL Ezur databases are unavailable for 1-2 full-time full minutes. I'm sorry, but it seems absurd. How do we want to run a web service with requests waiting for 2 minutes to access our database? It's going to happen many times in the day. It is low after switching from standard level to premium level, but we are not near our DB's DTU capacity and we are often messing up very difficult.

Our SQL Ezur DB Premium P1 and our load is generally less than 20% according to the new Azure portal, which has some spikes reaching 50-75% each hour. Of course, we can not even trust AZUR's Portal Metrics. The old portal does not give us any data for our SQL, and the new portal is very clearly wrong on time (our DB was not for 1/2 hour, as Graph suggests, but it was down for more than 2 full minutes):

SQL Ezur Use

esior our db In the size of a bit more than 12 GB (in our own SQL server installation), the DB is under 1GB - this is another question, why is it described as 12GB on Azure?). We have done a lot of tunings and good indeses in the last few years.

Our service runs on two D4 cloud service examples Our DB library is waiting 2, 4, 8, 16, 32, and 48 seconds after it completely fails, try again Applying the logic. Controllers are all ASCs, most of our various external service calls are asynchronous. DB access is still largely synchronous but our most heavier queries are ASCIN. We make heavy use of in-memory and redesign caching. The most used of our DB is 1-3 records for each request (those tables are only asked once to check error levels every 10 minutes)

Including logging of those requests Apart from doing, there is not really much in our app's DB access code. We are not anywhere near our DTU allocation at this database, and our DB is still available to be allocated like the server 2000 DTU. If we do not have to be available every day without a 1 + minute period, then we are going to leave Azure.

Is it the best?

In order to show that we are nowhere near our resource limits, at the premium level we should be given second and second guarantee of our DTU level. But, again, we become more than a full solid minute without being able to get a database connection. What is happening?

db stats

I can also say That's when we feel the delay in any of these times, our stats seem to be reset. The above image was just a few minutes before the 1 minute + delay, and it's a few minutes later:

Statistics Reset

We are in touch with the technical staff of AZU and confirm that this is a bug In our platform, our database becomes the reason to go through multiple failures in a day. He said that he will deploy the fixes starting this week and will continue till next month.

Actually, we are having trouble understanding how anyone can run the web service on Azure reliably, our pool of websites randomly goes down for a few minutes in a month, our Takes down public sites if there are more than 500 responses to our cloud service, cutting some traffic in front of it and 502 (as fully undocumented behavior we can tell) . SQL Azure has a very limited performance and obviously it is not ready for prime time.


Parse RESTFul API in C# / .NET -


I have ASP restored to use in windows applications. I have no idea that I can get the proper output How can i parse {"Id": "8", "name": "ravi", "email": "ravi.com", "time": "11- 12 "," appointment_date ":" 2015-04-02 00:00:00 "}]," success ": true}

above is my JSON output Please remove this problem Help me out

Thanks in advance!

You can use NewtonSoft here is an example of a document

Has a class account

  public class account {public string email {get; Set; } Public Bull Active {get; Set; } Created public date time {receive; Set; } Public IList & lt; String & gt; Roles (get; set;}}  

and want to make json in the bottom of an account object:

  string json = @ "{' Email ':' james @ example com ',' active ': true,' created date ':' 2013-01-20 to 00: 00: 00 ',' roles': ['user', 'admin']} " ; Account Account = JsonConvert.DeserializeObject & lt; Account & gt; (json); Console.WriteLine (account.Email);  

Newtonsoft with JSON See the following questions about parsing json.

Newtonsoft JSON Jason Net for Realization But there are several options.


javascript - Disabling non 'selected' options in multiple select elements except for one using jquery -


Using jQuery, I am trying to disable all non-selected items in addition to one of several select elements I am I was trying to exclude a selection element based on my name attribute: name = "tloStatus" .

  $ (document) .ready (function () {if ($ ("select [name! = TloStatus]")) {$ ('option: not (: selected)') ('Disabled', true);}});  

How do I apply only:

  $ ('option: no (: selected)'). Ether ('disabled' is true);  

On each selection element but name = "tloStatus" ?

The reason for this was not working, because you all unselected < Regardless of code> option elements select element name without regard to parent.

You can simplify it in the following so that only the unselected option element lineage

  $ ("select [name! = TloStatus] option: no (: selected)"). ;  

r - Comparing distribution of two vectors -


I have 5 different vectors and then a vector I want to compare them to. I need to get the most common vectors from 5 different parts.

The vector is quite long, so I will show it a little bit:

  To compare with # vectors: v1 & lt; - c (0.2500, 0.4375, 0.1250, 0.3125, 0.0000, 0.5625, 0.1250, 0.1875, 0.1875, 0.1875, 0.1875) # one of the vectors v2 and lt; - c (2, 1, 0, 1, 1, 1, 1, 0, 2, 1, 2) To compare # vectors: v3 & lt; -c (5, 0, 3, 1, 1, 2, 1, 2, 0, 1, 2)  

What I need to do in practice is given by those vectors A statistical test to compare the distribution of the histogram and tell me which one is closest I tried to use the ks.test , but there was a problem with the duplicate value in the vector and returned P-value was like 0.0000000000001. Any idea how to do it (except blind)?

It is not clear to me that what you want to do to all, / Em> Why the exam is needed, which is the closest I just compute the histogram and compare their distance.

Generate Data:

  v1 < -c (0.2500, 0.4375, 0.1250, 0.3125, 0.0000, 0.5625, 0.1250, 0.1875, 0.1875, 0.1875, 0.1875) v2 & lt; -c (2, 1, 0, 1, 1, 1, 1, 0, 2, 1, 2) * 0.1 v3 & lt; -c (5, 0, 3, 1, 1, 2, 1, 2, 0, 1, 2) * 0.1  

Note that I changed vectors 2 and 3 a bit , So that their distribution actually overlaps the comparison vector

  vList & lt; - List (v1, v2, v3) brkvec & lt; - seq (0,0.7, by 0.1) hList & lt; - Lapply (vList, function X) Hist (X, plot = FALSE, breaks = brkvec) $ calculation)  

This is slightly disabled because it all and then throws most of them ...

  dmat < - dist (do.call (rbind, hList) dvec & lt; - as.matrix (dmat) [- 1.11] ## 2 3 ## 7.874008 6.000000  

The second option ignored the warning from ks.test () Nly does not calculate distance estimates, affects hypothesis)

  ks.dist & lt; - sapply (vList [-1], function (x) suppressWarnings (ks.test (v1, x) $ stats)) ks.dist ## DD ## 0.6363636 0.4545455  

Results matching (I.e. v3 is v2 closer to v2)


javascript - Angular performance issue with ng-repeat and directives -


I am currently working on a table with 500 rows, each cell has 5 cells. Each cell is an instruction, it takes about 3 seconds to reproduce this table and it locks the browser.

timeline

99% time in the "Pars HTML" function Which I parsed HTML for instructions. (When I scroll down, the parse HTML function is very much estimated at around 2500, there is no way to calculate it).

A plnkr link where you can see this issue using Chrome Dev Tool (spend most of the time in pars HTML):

I have to manually How to customize it without including the HTML string.

  / / code here comes angular. Module ('app', []). Directive ('cellon', function () {return}: {data: '='}, templateUrl: 'cell.html'};}) directive ('cell to', function () {return: {data: 'data : '='}, Template: 'cell 2.html'}}}. Directive ('line', function ($ compilation) {return} function compile () {returns {pre: function prelink (scope, element) {var html = ''; html + = '& lt; cell-a data = row [0] & gt; & lt; / cell-one & gt; Html == '& lt; cell-2 data = line [1] & gt; & lt; / cell-two & gt;' html + = ' & Lt; cell-a data = line [2] & gt; & lt; / cell-one & gt; Html = = '& lt; cell-2 data = line [3] & gt; & lt; / cell- Two & gt; 'html + =' & lt; cell-2 data = line [4] & gt; & lt; / cell-2 & gt; Var el = angular.element (html); var linkFunction = $ compilation L); element.append (L); linkFunction (scope);}}}}}}. Controller ('defunct Fill the data map with random data {$ scope.data = []; // scope.refresh = function () {for (var i = 0; i & lt; 500; ++ I) {$ scope.data [i] = {}; for (var j = 0; j & lt; 5; ++ j) {$ scope.data [i] [j] = Math.random (); }}} $ Scope.refresh ()});  

This is quite well There is a known fact that when you have more then angular performance related problems start happening. ~ 2000 watchers (who are responsible for handling your data binding) in your case Not, you at least 2500 meet.

Reducing the number of data binding will definitely help Angelor have recently introduced data binding that you can take advantage of if the data being compelled is not completely dynamic .

I suggest taking a look for more information.


ffmpeg video compression / specifc file size -


Currently I have 80 MB movies, which I want to use the FMPG so that below 10 MB or 15 MB Say in I know that there will be a quality loss but they will need sound what I've ever done before, plus there is no way to specify file size or high compression

  ffmpeg -i movie Mp4 -b 2255k -s 1280x720 movie.hd.ogv  

They are currently 25 MB one piece

If you are targeting a certain output, the best way to file size H.264 and two-pass encoding Is to use.

Here's a great example but its copy is too big - Paste:

You can calculate your target bitrate by bitrate = file size / duration And you launch ffmpeg twice: analyzes a nearby media and the other does the actual encoding:

  ffmpeg -y -i input -c : V libx264 -preset medium -b: v 555k -pass 1 -c: a libfdk_aac -b: a 128k -f mp4 / dev / null & amp; Amp; \ Ffmpeg -i Input -C: v-libx264 -preset Medium-B: V 555k -pass 2 -c: a libfdk_aac -b: a 128k output.mp4  

Edit: H .265 (HEVC) is better in compression (in some cases 50% of H.264 size), but so far the support is not yet comprehensive, so now paste it with H.264.


jquery - Where is there a missing semicolon? -


claims that a semicolon is missing here:

  Onshash '); & Amp; (Docomed === undefined || docmode> 7)) {window.onhashchange = expandFromLocation; } // does not support IE 7 hashang event so we come back to standard voting technology {poll = window.setInterval (checkHash, 500); // Clean-up Objects such as IE 7 have a horrible display window. Download = function () {window.clearInterval (poll); }}  

"missing semicolon"? where?

here:

  window.onunload = function () {Window .clearInterval (polling); } & Lt; --------  

javascript - logOnce higher order function -


I want to implement a function that takes another function as argument, and a new version of that function Which can only be called once.

The first thing does, but the second does not work.

Why does another function not work, but anyhow a function like this one inside the first one?

  var logon = once (console.log) function once (fn) {var call = true; Return work (word) {if (call) {call = false; Return FN (word); }}} Function once (fn) {var call = true; If (call === true) {call = false; Return FN; }} Logon ("foo"); ---- & gt; "Foo" logon ("blue"); ---- & gt; "Blue"  
= "post-text" itemprop = "text">

Your second method does not work because it's the same fn . In fact, this is equivalent to

  function (fn) {return fn; }  

Therefore, one time (console.log) is just console.log , and you can call it

The first approach works because you return a different function, which will be the original one or call on the basis of a value.


python - Nominal/categorical axis on a scatter plot -


कैसे एक मामूली / स्पष्ट अक्ष (जैसे a, b, c

B 10.0 c 5.0

मैंने निम्नलिखित की कोशिश की:

  आयात bokeh.plotting bk # output को स्थिर HTML फ़ाइल bk.output_file ("scatter.html ", शीर्षक =" स्कैटर प्लॉट उदाहरण ") x = ['a', 'b', 'c'] y = [0.5, 10.0, 5.0] p = bk.figure (शीर्षक =" स्कैटर ") p.circle ( X = x, y = y) bk.show (p)  

हालांकि, यह एक खाली भूखंड उत्पन्न करता है यदि x डेटा को x = [1, 2, 3] में बदल दिया जाता है सब कुछ अपेक्षित के रूप में हो जाता है।

मैं < कोड> ए, बी, सी x अक्ष पर

आपको x_range या y_range स्पष्ट रूप से श्रेणियों की सूची। देखें:


fiware - Cosmos installation on localhost -


I try to establish the universe, on the local host, but I get a problem, I follow these steps Do not know how to do First I made a Srts and PEM, but in step 4 have to move I do not know that PEM is run .pem two PEM I and I openssl verify -Capath / etc / pki / tls / certs I try to confirm

  Step 3: Creating and Installing a Certificate of Master Node The certificate for a valid CA signed master node is required for the platform to be shown as an authentication proof. Has been installed for. Thus, this certificate should be made by generating a Certificate Signature Request (CSR); Do this once in the master node: $ openssl req -newkey RSA: 2048 -New --Cavity newkey.pem-newreq.pem The above command will prompt for some information; The most important information about the universe platform is the name of the server (that host name was selected for the Cosmos Master Node) where the certificate is being established, and the challenge password must be empty. Allegedly PEM must be empty pass phrase (otherwise, httpd server automatically will not start), will fill it at this stage and will be removed later by executing: $ openssl rsa -in Nikeepam-out Nikijm. At the point, you can choose two options to sign the certificate: Use a valid CA in the Internet Use the contents of the SCR (NurekPM file) generated to retrieve the final certificate. Should be done within, which is commonly called certnew.cer CSR is different in the way that each CA is managed. Self-Signature on Certificate In this case, you'll need to command: $ openssl req -new -x509 -key newkey.pem -out certnew.cer In any case, once the certificate (certificate), Key (Newkeykpem) and CSR (My_environment & gt; / certificate / & lt $ cp newkey.pem [COSMOS_TMP_PATH] / puppet / modules / universe / files / home / & lt: newreq.pem) has got the name of the files according to this (in all machines) ; Universe Master Node & gt; _kekpem $ Cup Kernevksr [Cosmos_tmp_pth] /ppet/modls/cosmos/fails/anvironments/<may_anwayrnment>/karts/<cosmos-mastr-nod>_srkpem $ Cup Newrek Kpem [Cosmos_tmp_pth] / puppet /modules/cosmos/files/environments/<my_environment>/certs/<cosmos-master-node>_req.pem Step 4: certificate of CA installation should be installed as a certificate of CA. Download from the proper link (If you have a certificate of self-signed master node, then this type of certificate is also CA certificate) and tax the master master node in the following: CA's certificate (common name is & lt copy; ca_cert & Gt; .pem) To do this, shop the local certificate and change directory: $ mv & lt; Ca_cert & gt; Make a symbolic link to the certificate of .pem / etc / PKI / TLS / certificate $ CD / etc / PKI / TLS / Certificate CA. An 8-digit-number-based file will be created. It is very important that this file has the extension '.0': $ ln -s & lt; Ca_cert & gt; .pem `openssl x509 -hash -noout-in & lt; Ca_cert & gt; Verify the .pem`.0 certificate successfully installed Ben: $ Openssl Verify -path / etc / pki / tls / certs & lt; Ca_cert & gt; .pem xxxxxxxx.0: OK, you will see an 8-digit hash..0 file which will then "OK". Alejandro, Cosmos is an annabelar which is highly recommended to use through previously employed frequency.  

In the FIWARE lab please login to create an account and start working with it refer to.


mysql - PHP pdo - to many Connections -


I have a Mozilla Js application, which is used with many views of the use of PHP-PDO data from a MySQL database. In addition, a nodjs application is bringing data every 30 seconds. From the same MySQL database.

While launching IIS to run angular and node apps on a Windows server, TCP connections are increasing for more than 100, with all the status "TIME_WAIT".

Is there a chance to reduce the waiting time to reuse connections or destroy the socket connection completely?

Connecting to each request is slow, you want constant connection and use of a connection pool In this way, the connection can be reused from one request on the next. There are fewer connections and faster response times than this.

There is more information about this.


.net - Where to place the C# code for checking internet connection in App.xaml.cs #Windows phone 8.1 Development? -


I am a starter in the development of 8.1 phones. In my app, the first page will have to check the internet connection if it is correct then it should be taken to the next page otherwise the app should be closed. I have trouble with the way to add code. Please help me!

Microsoft needs your app to start (leaves the splash screen) within 10 seconds You should load your app to the minimum required during the start-up process, then check the internet after the program loads. You can show a spinner or floating dot image, if you want to inform the user that they need to wait for your app to do something.


PHP - How to create/change value of environment variables -


I do not know what is possible to create environment variables in php. The method is not used because the docks are called At the end of the request the environment has been restored in its original state. Any help?


node-webkit won't run project file -


I started experimenting with nwjs (node-webkit). But I think something is going wrong, I have 2 files in a folder: index.html

   & Lt; / Body & gt; & Lt; / Html & gt; "Myapp.helloworldapp", "version": "1.0.0", "description": " 

package.json

  {" name " A test app "," main ":" index.html "," script ": {" test ":" echo \ "error: no test is specified \" & amp; amp; amp ;, "license" : "MIT"}  

I zip those two files (I do not zip the folder) and I rename the .nw to .zip by ext name but nothing When I try to open it with the NWJS app

If I'm gonna have to do something with that?

I follow the steps outlined by them

From the command line:

  • La CD / Projects / my_app
  • Run zip-r on your project directory .. / $ { PWD ## * /} .nw *
  • Your fully-generated NN file will be located outside of your project directory
  • Cake!
< / Div>

sql server - sum volume per day in SQL -


मेरे पास तीन कॉलम के साथ यह SQL तालिका है,

  स्टार्टडेट एंडेड वॉल्यूम 2015-01- 05 2015-01-12 50 2015-01-10 2015-01-15 20  

अब मैं प्रति कैलेंडर दिन कुल मात्रा जोड़ना चाहता हूं, मैंने सोचा कि मैं एक कैलेंडर तालिका का निर्माण और फिर

  पाने के लिए  
  वॉल्यूम समूह के रूप में राशि (मात्रा) चुनें  
  तारीख वोल्ट 2015-01-01 50 2015-01-02 50 ... ... 2015-01-10 70 ... ... 2015-01-15 20  
< P> लेकिन मुझे नहीं पता कि दो तालिकाओं में कैसे जुड़ें। कोई भी विचार?

धन्यवाद!

आप कैलेंडर तालिका का उपयोग करना चाहते हैं तिथियों के स्रोत और कैलेंडर तालिका से सभी तिथियां प्राप्त करने के लिए एक बाएं जुड़ने का उपयोग करें, भले ही उस दिनांक के लिए मात्रा के लिए कोई डेटा न हो। ऐसा करें:

  कैलेंडरडेट चुनें, योग (वॉल्यूम) कैलेंडर से वॉल्यूम के रूप में कैलेंडर_डेट पर अपने_टेबल टी जुड़ें; = t.startdate और calendar.date & lt; = t.enddate कैलेंडरडेट द्वारा समूह  

यदि आप कैलेंडर तालिका से लौटाई गई तारीखों को सीमित करना चाहते हैं तो आप जहां खंड जोड़ सकते हैं:

  जहां calendar.date & gt; = (your_table से MIN (स्टार्टडेट)) और calendar.date & lt; = (अपने_table से अधिकतम (एंडेड) चुनें)  

vici - Ringback ViciDial via SIP Gateway -


I am using the latest version of ViciDial for my inbound / outbound call center and Asterisk 13 for my SIPGW. Calling from my Vici server, Ringback works for my agents on initial calls through my SIP gateway. If and when the agent has to call to call or the caller is kept on hold and dials the second call, the agent is not heard about the call through a ringback SIPGW.

I modified the context of the trunk in the following way:

  [SIPGW] type = friend host = 192. XXX Qualification = Yes from reference = to-internal peercontext = to 

Itemprop = "text">

Campaign 3 in conference prefix, keep 88 as dialprints.

Then go to Ext. Conf and edit the dialplane that starts with 88 according to your trunk dialing and puts the option in the form of TtoR.


url - Python: Replace URLEncoded characters in String with what they represent -


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

  • 5 जवाब

मैं अपनी पीट कर रहा हूँ थोड़ी देर के लिए इस के साथ दीवार के खिलाफ सिर। मैं अजगर के खूबसूरत सूप के साथ एक आरएसएस फ़ीड को पार्स करने की कोशिश कर रहा हूं, और हर अब और फिर मुझे ऐसी त्रुटियां मिलती हैं:

  मुझे नहीं पता कि मैं किस बारे में बात कर रहा हूँ  

मुझे कोई अजगर लाइब्रेरी नहीं मिल सकती है जो कि उन अक्षरों को प्रतिस्थापित करेगी कि वे क्या हो, इसलिए परिणामस्वरूप स्ट्रिंग इस तरह दिखती है:

  मैं नहीं  
  urllib.unquote (post_content) .decode ('utf-8')  
 

के बारे में क्या बात कर रहा हूँ < / कोड>

लेकिन यह अभी भी url एन्कोडेड वर्ण को 'के साथ नहीं बदलता है' क्या किसी ऐसे एर्सी अक्षरों में उन यूआरएलकेन्ड वर्णों को प्रतिस्थापित करने का कोई अच्छा तरीका पता है? & amp; # 40; और & amp; # 41;

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

उन अजीब तार को HTML संस्थाएं कहा जाता है आप इस यूआरएल द्वारा वर्णित अनुसार उन्हें डीकोड कर सकते हैं: यह मॉड्यूल html.parse

से फ़ंक्शन unescape का उपयोग करने के लिए कहता है

javascript - GWT - onClick not triggered -


I am having a very strange behavior on a farm.

With many text fields in-line verification, if the content is invalid, then there is an error message below the field. Verification stigma has started with.

At the bottom of the page there is a "Next" button, a verification is done and, if everything is okay, the form is submitted.

Now, if the focus is on the empty field, when I click on the button, the following happens:

  1. OnBlur has been triggered and the in- Line verification is performed
  2. An error message is displayed
  3. The rest of the page "error" / li>
  4. OnClick action is not triggered on this button

I initially thought that onBlur was somehow stopping on onClick. Then I have seen that when the page goes down, the mouse pointer does not remain on the button because it is pushed. If I click on the button in lesser states, such as the "moving" indicator is still on the button, then onClick has been triggered.

I changed onClick with onMouseDown and the problem is fixed, but I'm really surprised by this reason.

onClick does not trigger because there is no click - one The click is a mousedown , then there is a mouseup on the same element if the mouse is not more than the same element, then the browser can not consider clicking one of it - I believe this fails in some cases even when the mouse moves (try a link and move the mouse, see why It is now also follow the link), although less than scrolling with the mouse in my test still it as a click if you scroll back.


From:

A click event occurs when pointing device button is clicked on one element, one click on a single mouse screen in a MouseWave and Mouseview Is defined as.

In your case, while the mouse is not running, 'A' element is not being 'click', or if there is only one element inside the mouse, then its body element Is not, and not what was in your mind.

As far as deciding, you have several options:

  • Do not scroll the page when the mouse is down - it is almost certainly for the user Confused / stunning, regardless of who they are clicking on
  • One click event may not be required, but use it as a mousewood (as you think you are doing now) < / Li>
  • Slowly scroll to the new location, perhaps due to delays and an animated scroll So that a quick click is not affected Keep in mind that the button is considered to click the button , allowing the user to capture the mouse and before moving the mouse before release Can change his mind.

postfix mta - How to beat Hotmail/Live/Outlook and AOL spam filters? (custom dedicated mail server) -


I am trying to set up a mail server for my client's web app.

The CentOS / Postfix-based mail server runs on a dedicated VPS from Digital COS.

SPF Record: Check DKIM (Open DKIM): Clear IP: Check Domain: Check

Gmail, Yahoo, Zoho Mail, GMX / Mail.com, Yandex Mail - There is absolutely no problem, all emails are delivered in the inbox.

However, it is junk when sending to AOL and Live / Outlook / Hotmail users. I tried all types of content: plain text emails with some words, HTML-rich email and everything in between This issue is not related to e-mail content.

Microsoft's support does not help much because our servers are basically feeling OK and there is something that they do not have to trigger their smartcrycurity protection.

This new mail server is available before appropriate DNS entries, Reverse DNS entry was promoted from Obviously it blocked the mail server by those providers. Therefore, the reverse DNS entry does not guarantee any error because of today's investigation.

In addition to what I have learned on this occasion, this provider re-server all restricted fairs. Once you are on the blacklist, you will be there for a long time. As our first mail server can be fortunately restored, we can periodically check what AOL and Yahoo will do with a new (second MX). The mail server was blocked for two months, as long as we did not formally apply to the blacklist, until the mail server was configured with DKIM etc.

With AOL you should make proper use of this application to remove it from your blacklist; Let's say Hotmail has something similar.


vb.net - What does this comparison of hexadecimal (If ((&H7F And &H80) = &H80)) means ? -


मुझे एक मुक्त स्रोत से यह कोड मिला

  निजी उप सेटफ़िल्ड (ByRef FieldByte as Byte ) यदि ((फील्डबाइट और & amp; H80) = & amp; H80) तो फ़ील्डटाइम = True Else FieldTime = गलत अंत यदि यदि ((FieldByte और & amp; H40) = & amp; H40) तो FieldOpenInterest = True Else FieldOpenInterest = False End यदि यदि (फ़ील्डबिट एंड एंड एच 20) = & amp; H20) फिर फ़ील्ड ओपनप्रिस = ट्रू एल्स फ़ील्ड ओपनप्रिस = असत्य अंत यदि यदि ((फ़ील्डबिट और एच 10) = और एच 10) तो 'निश्चित नहीं है कि उच्च या निम्न फ़ील्डहॉल = ट्रू एल्स FieldHigh = False End यदि यदि ((FieldByte और & H8) = & amp; H8) तो 'सुनिश्चित नहीं है कि कौन से उच्च या निम्न फ़ील्डओल = ट्रू एल्स फ़ील्ड नीचे = गलत अंत अगर अंत उप  

फ़ील्डबिट के मूल्य भेजा गया है & amp; H7F, यह मान फ़ील्डटाइम को छोड़कर सभी क्षेत्रों को सक्षम करता है

फ़े का मूल्य क्या होना चाहिए सभी क्षेत्रों को सक्षम करने के लिए ldByte? और क्या कोई यह समझा सकता है कि यह तुलना क्या करता है?

पहले से धन्यवाद

बेस 16 वैल्यू और एच 7 एफ आधार 01111111 के बराबर है। 2. आधार 16 मान और एच 80 बेस 2 में 10000000 के बराबर है।

तो बिटवा ऑपरेशन के लिए

  0111111 और (& H7F) 1000000 = (& amp; H80) ------------ 0000000  

परिणाम शून्य है और आपका फील्डटाइम है

किसी भी अन्य मूल्य से कम & amp; H80 जब bitwise ऑपरेटर के साथ प्रयोग किया जाता है और इसके विरुद्ध & amp; H7F हमेशा एक ही मान वापस करेगा

उदाहरण के लिए

< पूर्व> 0111111 और (& H7F) 0100000 = (& amp; H40) ------- 0100000 (& amp; H40)

आपको अधिक विस्तृत लेख मिल सकता है

  1111111 और (& amp; एचएफएफ) 1000000 = (& amp; एच 80) - अपने फ़ील्डबिट वैरिएबल को & amp; एचएफएफ सेट करने के लिए आवश्यक सभी फ़ील्ड को सक्षम करने के लिए  

----------- 1000000 (& H80)


c++ - error C3861: 'getGaborKernel': identifier not found -


I am trying to create the following code, but failed due to the following error

  error C3861: 'getGaborKernel': identifier not found  

I have included the required header files and Lib files What could be the problem?

  #include "stdafx.h" #include & lt; Opencv2 / core / core.hpp & gt; #include & lt; Opencv2 / imgproc / imgproc.hpp & gt; #include & lt; Opencv2 / highgui / highgui.hpp & gt; # Include & lt; Math.h> Using namespace cv; using namespace std; Int main (int argc, char * argv []) {mat in = imread ("1.jpg", 0); // load grayscale Mat dest; Mat src_f; In.convertTo (src_f, CV_32F); Exxon ostream care; Int kernel_size = 31; Double sig = 1, th = 0, lm = 1.0, gm = 0.02, ps = 0; Cv :: Mat kernel = getGaborKernel (CV :: size (kernel_size, kernel_size), signature, th, LM, GM, PS); Cv :: filter2D (src_f, dest, CV_32F, kernel); Serie Lieutenant; & Lt; Dest (riket (30,30,10,10)) & lt; & Lt; Endl; // Peeping in Fig Mat; Dest.convertTo (that is, CV_8U, 1.0 / 255.0); Imshow ("k", kernel); Imshow ("d", i.e.); WaitKey (); Return 0; }  

When C ++ misses a prototype, then this issue of an error is. Your source does not explicitly include header files with proper prototype or prototype #ifdef s.

  • Find the hidden header file that you expect it to be the prototype of getGaborKernel .
  • Include show to see the header file actually included. Verify the header found in the first step is in the list.
  • Check the preprocess option in a file to see what preprocessor output happens after all the # processes. In the .i file generated from ifdef s, check that the prototype is not in the output.

  • Unless you encounter a problem, uncheck the two options .i instead of .obj to get the file Pre-process file is important for the option.


algorithm - Huffman Tree for frequencies of i'th alphabets is 2^i? -


I am ready to test on DS. I read my notes. None of these problems have been created properly. Can I describe it for me?

Looks in a text, I'th is the frequency of the English letter 2 ^ i (^ means the power). What is the height of Huffman tree for these characters?

I need somebody's help ...

height is n - 1 , where n is the size of the alphabet (let's call it h ).

Proof:

  1. The base case n = 2 , the height is one.

  2. Step: 2 ^ n> 2 ^ 0 + ... + 2 ^ (N-1) . Thus, the tree looks for an alphabet of size in this way: There are two children of a root: n -the character (most often one) with a leaf and a tree for the alphabet of size The root of n - 1 means that its height is h (n) = h (n - 1) + 1 = (n - 2) + 1 = n - 1 Is.

I think the height is the number of edges in the longest path of a leaf. If we define the height as many numbers, then the answer is n .


javascript - convert json object to serialized string for server side processing? -


I am trying to convert a generation object into a serial string which is something I want to do with some PHP server side code I can process further with:

Returned object looks like this:

  object {id: "123456787654321", email: "some-email @ gmail I can convert the object to a string in the following: , first_name: "first", gender: "male", last_name: "last"}  

  var paramString = JSON s Tringify (feedback); Console.log (paramString); // does not work // var params = paramString.serialize ();  

How do I change the string to a serialized string which I pass through my client with the following client side call

I would expect something like this:

  id = 123456787654321 and email = somemail@gmail.com& First_name ...  

My server side code:

  $ Post ("/ functions / test_functions.php", {params: params}, function (data) {...}, "json");  

I handle the parameter array like this server side:

$ vars = $ _SERVER ['REQUEST_METHOD'] === "Received"? $ _GET: $ _POST; $ Params = array (); Released ($ wars ['params'])? Parse_str ($ vars ['params'], $ params): zero;

You can pass JSON-string to server and it will be json_decode () Can decode with See for details.


ios - In didFinishLaunchingWithOptions method, I can not set index of tabbar -


  - (BOOL) अनुप्रयोग: (UIApplication *) आवेदन किया FinishLaunchingWithOptions: (NSDictionary *) launchOptions {... if (स्थिति) {UITabBarController * टैबबार = (UITabBarController *) self.window.rootViewController; [टैबबार सेटसैक्टेड इंडैक्स: 4]; } ...}  

में किया गया FinishLaunchingWithOptions विधि, मैं चयनित टैबबार के चयनित अनुक्रमणिका सेट नहीं कर सकता UITabbarController मेरे प्रोजेक्ट में प्रारंभिक दृश्य नियंत्रक है।

मैं विशेष स्थिति के लिए एक अन्य टैबबार सूचक सेट करना चाहता हूं, जब उपयोगकर्ता मेरे ऐप को लॉन्च करेंगे।

मैंने ios7, ios8 का परीक्षण किया है। क्या कोई अन्य तरीका है?

मुझे लगता है कि आपके कोड में समस्या यह है कि कोई भी पहचान नहीं UITabBarController ... यदि आप स्टोरीबोर्ड का उपयोग कर रहे हैं तो यह कनेक्शन बनाना आसान है -

<पूर्व> UIStoryboard * storyboard = self.window.rootViewController.storyboard; UITabBarController * टैबबीआरयूवीयूआई नियंत्रक = (UITabBarController *) [स्टोरीबोर्ड इन्स्टिटियेट वीआईयूआई कंट्रोलरविथइडिटिफ़ायर: @ "टैबबार"]; // स्टोरीबोर्ड में इस पहचानकर्ता को सेट करें [टैबबारदृश्य नियंत्रक सेट चयनित ऑक्सएक्स: 1];

php - Radio button inside two foreach loops not getting checked -


My code works like this if a parent product has two variants, it creates two div (one hidden) When I click on the radio button, its relevant div & amp; Hides the other.

Now on page load, the property checked by default does not work on any radio button.

Here's my code:

  $ PID = 2; ($ Line ['id'] = $ pid] {? & Gt; Style = 'e-mail' Do not display anything; ' & Lt ;? Php}? & Gt; & Gt; "; ['Name']; $ version = $ db- & gt; queries (" SELECT * FROM products where pid = $ pid "); ($ $ Pid == $ r ['id']); { // I have checked it, the condition is right echo "input type = 'radio' checked & gt;" $ r ['name'];} Else {echo "& lt; Input type = 'radio' & gt; ". $ R ['name'];}}}  

In addition, when I click on other radio buttons, its relevant div And hides the other, but there is no radio button again.

Any help will be appreciated.


android ProgressBar setProgressDrawable is not working properly -


postproduct "itemprop =" text ">

When I use Android: progressDrawable =" @ drawable / barcolor ", it works properly, but when I Use setProgressDrawable, it looks wrong My Layout:

  & lt; XML version = "1.0" encoding = "utf-8" & gt; & Lt; RelativeLayout xmlns: android = "Http://schemaskandroidkcom/apk/res/android" android: orientation = "vertical" android: Layout_width = "Fill_parent" Android: layout_height = "fill_parent" & gt; & Lt; ProgressBar Android "Android: attr / progressBarStyleHorizontal" id = "@ + id / firstProgressBar" style = Android: layout_width = "300dip" Android: layout_height = "30dip" Android: layout_centerHorizontal = "true" Android: layout_above = "@ + id / Text_first "Android: Max =" 300 "Android: Progress =" 0 "/> Android: Android: Layout_height = "Wrap_content" Android: Layout_alignParentBottom = "True" Android: Layout_marginBottom = "L0dp" Android: Android: Left_margin = "android: gravity =" center "/ & gt; & Lt; / RelativeLayout & gt; < / code> 

and my Java code:

  Prthampradrshnbar = (progressbar) Khojwubiaiaidi (RID 4); Resid = getResources () getIdentifier ( "barcolor", "drawable" , PackageName). Rectangle border = taking first progress. progressive (). GetBounds (); firstProgressBar.setProgressDrawable (. getResources () getDrawable (Resid)); firstProgressBar.getProgressDrawable () setBounds (limit).  

and barco Lor.xml:

  & lt ;? xml version = "1.0" encoding = "UTF-8"? & Gt; LayerList xmlns: android = "http: // schemas.android.com/apk/res/android "& gt; & Lt; before android: id =" @ android: id / background "& gt; & Lt; nine patch Android: src =" @ drawable / Prgti_bar_bg "& Gt; & lt; / nine patch & gt; & lt; / item & gt; item android: id = "@ android: id / progress" & gt; & Lt; Clip & gt; & Lt; Nine patch Android: src = "@drawable / progress_bar" & gt; & Lt; / Nine patch & gt; & Lt; / Clips & gt; & Lt; / Item & gt; & Lt; / Layer-list & gt;  

Thank you all!

Try it:

  Be the first program. ViewTreeObserver (). AddOnGlobalLayoutListener (New ViewTreeObserver.OnGlobalLayoutListener () {@Override Global Layouts on Public Zero (Rectangle Segment = First Display Bar.GetprogressDearable). GetBounds (); Drawable Drawable = getResources (builder); Drawable.Setbound (front); First display bar .capturable (drawable); if (build.VERSION.SDK_INT> = Build.VERSION_CODES.JELLY_BEAN) {first program burgate.Witry Observer (). ExtractOnLealLabeloutOutator (this);} Other {Firstprogressbar.getViewTreeObserver (). RemoveGlobalOnLayoutListener (this); }}});  

string.split and string.join in Python 2.7 -


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

  • 12 जवाब

मैं पुस्तक से पढ़ रहा था एक कंप्यूटर वैज्ञानिक की तरह सोचें: पायथन के साथ सीखना जब मैं निम्नलिखित प्रश्न पर आया:

एक अभ्यास के रूप में, string.join (string.split (song)) और गीत के बीच संबंध का वर्णन करें। क्या वे सभी तारों के लिए समान हैं? वे अलग क्यों होंगे? (गीत "स्पेन में बारिश ..." के रूप में परिभाषित किया गया था)

इसे जांचने के बाद, हालांकि, मैंने पाया कि दोनों अलग-अलग स्ट्रिंग हैं। मैं string.join (string.split (song)) का उपयोग करने की कोशिश की है और f गाना है जहां f को मान स्ट्रिंग सौंपा गया था। Join (string.split (गीत) )) और दोनों के लिए मूल्यांकन गलत ऐसा क्यों है?

आप तुलना कर रहे हैं तारों के वास्तविक मूल्य क्या हैं?

यदि दोनों एक समान हैं, तो यह पहचान ऑपरेटर है और समानता ऑपरेटर == के बीच के अंतर के कारण है।

संक्षिप्त में , है पैदावार true जब वस्तुओं समान हैं क्योंकि आपके उदाहरण में एक नई स्ट्रिंग बनाई गई है, यह झूठी का उत्पादन करती है।

यदि आप == का इस्तेमाल करते हैं तो स्ट्रिंग्स की एक गहरी तुलना हो जाएगा और true लौटा जाएगा।

अगर तुलना स्ट्रिंग्स समान नहीं हैं, न तो == या है चाहिए true


c++ - Write the math expression in C ++ -



c++ - Write the math expression in C ++ -

there problem mathematical look written below:

cin >> value; dividend = tan(fabs(2*value*value + 5 * value - 31.15)) + log(fabs(value*value - 2.5)) / log(5.0); divider = pow(fabs(pow(sin(value*value*value), 2) + fabs(0.33*(log(fabs(value*value - 2.5) / log(5.0))))), 1 / 5.0); result = dividend / divider;

result invalid value. problem?

although have balanced parentheses denominator, or divider if wish, not correctly placed. yves daoust observed, misplaced partition log(5.0).

spacing out subexpression , parenthesization on different lines should help see this:

pow( fabs( pow(sin(value*value*value), 2) + fabs( 0.33 * ( log( fabs(value*value - 2.5) / log(5.0) ) ) ) ) , 1 / 5.0);

also, why represent one-third 0.33, unless casual precision? partition 3 portable...

c++ math

spring - Numbers in kotlin is not serializable -



spring - Numbers in kotlin is not serializable -

i found numbers in kotlin not serializable.

first problem

device.kt:

package test.domain import javax.persistence.* entity public class device { public id generatedvalue var id: long = -1 public var name: string = "" ... }

devicerestrepository.kt:

package test.domain import org.springframework.data.repository.pagingandsortingrepository import org.springframework.data.repository.query.param import org.springframework.data.rest.core.annotation.repositoryrestresource repositoryrestresource(collectionresourcerel = "device", path = "device") public trait devicerestrepository : pagingandsortingrepository<device, long?> { public fun findbyname(param("name") name: string): list<device> }

i error when seek compile code, because kotlin.long not serializable:

error:(14, 72) kotlin: type argument not within bounds: should subtype of 'java.io.serializable?'

second problem

i same error when seek utilize java.lang.long:

devicerestrepository.kt:

package test.domain import org.springframework.data.repository.pagingandsortingrepository import org.springframework.data.repository.query.param import org.springframework.data.rest.core.annotation.repositoryrestresource repositoryrestresource(collectionresourcerel = "device", path = "device") public trait devicerestrepository : pagingandsortingrepository<device, java.lang.long?> { public fun findbyname(param("name") name: string): list<device> }

warning:(14, 72) kotlin: class shouldn't used in kotlin. utilize kotlin.long instead.

error:(14, 72) kotlin: type argument not within bounds: should subtype of 'java.io.serializable?'

as-of kotlin 1.0 beta 1 primitive types serializable:

int serializable

now type int , other basic types serializable on jvm. should help many frameworks.

from: http://blog.jetbrains.com/kotlin/2015/10/kotlin-1-0-beta-candidate-is-out/

therefore no longer have issues.

spring serialization kotlin spring-jpa

iphone - Making a rubbing screen gesture in iOS? -



iphone - Making a rubbing screen gesture in iOS? -

basically, want create mobile game using custom hand gesture. gesture kind of rubbing screen, left right , right left.

if gesture moves left right, phone call method , add together point. , 1 time gesture rubs right left, user can 1 point.

but problem is, when utilize swipe gesture recognizer, have release finger screen, in order phone call method. if rub gesture, unable phone call method add together points.

instead, seek touchesbegan, touchesmoved method observe finger's position. however, touchesmoved create many points compare starting point, leads calling methods many times instead of once.

override func touchesbegan(touches: nsset, withevent event: uievent) { touch: anyobject in touches { self.touchstartpoint = touch.locationinview(self.myview).x } } override func touchesmoved(touches: nsset, withevent event: uievent) { touch: anyobject in touches { self.touchoffsetpoint = touch.locationinview(self.myview).x - touchstartpoint if temptouchoffsetpoint < touchoffsetpoint { var xvalueincreasearray: nsmutablearray = [] xvalueincreasearray.addobject(touchoffsetpoint) var maxvalue: double = (xvalueincreasearray anyobject).valueforkeypath("@max.self") double println("\(maxvalue)") if maxvalue - double (self.touchstartpoint) > 50 { println("right") } println("right") } else if temptouchoffsetpoint > touchoffsetpoint { /* var xvaluedecreasearray: nsmutablearray = [] xvaluedecreasearray.addobject(touchoffsetpoint)*/ println("left") } else if temptouchoffsetpoint == touchoffsetpoint { println("remain") } temptouchoffsetpoint = touchoffsetpoint }

are there ways observe rubbing gesture? , every time finger turns direction, phone call method 1 time add together score user? give thanks much!

this works me:

let deadzone:cgfloat = 10.0 var previoustouchpoint: cgfloat! var ismovingleft:bool? = nil override func touchesmoved(touches: nsset, withevent event: uievent) { allow point = touches.anyobject()?.locationinview(self) if allow newpoint = point?.x { if previoustouchpoint == nil { println("started") previoustouchpoint = newpoint } else { // check if have moved beyond dead zone if (newpoint < (previoustouchpoint - deadzone)) || (newpoint > (previoustouchpoint + deadzone)) { allow newdirectionisleft = newpoint < previoustouchpoint // check if direction has changed if ismovingleft != nil && newdirectionisleft != ismovingleft! { println("direction changed: point") } println((newdirectionisleft) ? "moving left" : "moving right") ismovingleft = newdirectionisleft previoustouchpoint = newpoint } } } } override func touchescancelled(touches: nsset!, withevent event: uievent!) { previoustouchpoint = nil ismovingleft = nil } override func touchesended(touches: nsset, withevent event: uievent) { previoustouchpoint = nil ismovingleft = nil }

ios iphone swift uigesturerecognizer gesture

php - how to generate a row for every date inserted and add a attending slot for every member added -



php - how to generate a row for every date inserted and add a attending slot for every member added -

i have easy table

http://gyazo.com/4ef60f33b16b43884ab64d9db23f18e3

this simple mysqli html table

basically im struggling adding rows/columns every date added

i have 2 dates

gyazo.com/f6d7020842e1cbafa75f9295340ad49b

i have attendance table

gyazo.com/f88659eef625a14ee41fbe1f4ed30ab2

attending = 1 meaning person @ event

http://gyazo.com/c4bc3fdbc85c642bf45ec173019b7b60

i want , every fellow member added generate same columns , rows dates

current code

<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <title>attendance system</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <body> <h1>attendance system</h1> <?php // connect database include('connect-db.php'); // records database if ($result = $mysqli->query("select * players order case when rank = 'colonel' 0 when rank = 'lieutenant-colonel' 1 when rank = 'major' 2 when rank = 'captain' 3 when rank = 'lieutenant' 4 when rank = 'ensign' 5 when rank = 'serjeant major' 6 when rank = 'colour serjeant' 7 when rank = 'serjeant' 8 when rank = 'corporal' 9 when rank = 'lance corporal' 10 when rank = 'private' 11 when rank = 'recruit' 12 end, rank")) { // display records if there records display if ($result->num_rows > 0) { // display records in table echo "<table border='1' cellpadding='10'>"; // set table headers echo "<tr><th>id</th><th>alias</th><th>historical name</th><th>rank</th><th>company</th><th>attending</th>"; echo "</tr>"; // close table headers while ($row = $result->fetch_object()) { // set row each record echo "<tr>"; echo "<td>" . $row->id . "</td>"; echo "<td>" . $row->firstname . "</td>"; echo "<td>" . $row->lastname . "</td>"; echo "<td>" . $row->rank . "</td>"; echo "<td>" . $row->company . "</td>"; echo "<td> attending </td>"; echo "</tr>"; } echo "</table>"; } // if there no records in database, display alert message else { echo "no results display!"; } } // show error if there issue database query else { echo "error: " . $mysqli->error; } // close database connection $mysqli->close(); ?> </body> </html>

did seek utilize n:m relation between attendance , date table?

this solve problem in best way guess. should create table attendance_has_eventdate (in case tables named way) table has 1:n relation both of tables.

i recommend mysql workbench. tool can design db quite , it's free.

php html mysqli

javascript - VS 2013 find and replace document.getElementById("elementId").value with $("#elementId).val() -



javascript - VS 2013 find and replace document.getElementById("elementId").value with $("#elementId).val() -

i trying replace all

document.getelementbyid("elementid").value

with

$("#elementid").val()

where id of element varies.

what should find what , replace with syntax?

press ctrl+shift+f come in "find , replace" dialog. alter "replace in files" tab , tick checkbox "use regular expressions"

in "find what" textbox enter:

document\.getelementbyid\(\"(?<elem>\w+)\"\)\.value

and in "replace with" textbox enter:

$("#${elem}").val()

javascript jquery regex replace visual-studio-2013

How to define a rectangle with a circle at the end using Android XML definitions -



How to define a rectangle with a circle at the end using Android XML definitions -

is possible define shape shown on next image:

i tried layer-list not find solution close looking for.

i want utilize resulting shape background image relativelayout transparency.

any hints appreciated! give thanks you.

here shape asked for:

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <size android:width="250dp" android:height="100dp" /> <solid android:color="#ffffff" /> </shape> </item> <item android:top="0dp"> <shape android:shape="line"> <stroke android:width="25dp" android:color="#000000" /> </shape> </item> <item android:right="0dp" android:left="150dp"> <shape android:shape="oval"> <solid android:color="#000000" /> </shape> </item> </layer-list>

screenshot:

android android-shapedrawable

ruby on rails - How to escape this redirect loop? -



ruby on rails - How to escape this redirect loop? -

i'm trying create user's illicit attempts see other users' show page redirect instead own show page.

none of attempts in else section of code job though.

class userscontroller < applicationcontroller def show if params[:id] == current_user.id.to_s liked_bookmark_ids = current_user.likes.pluck(:bookmark_id) liked_bookmarks = bookmark.where(id:liked_bookmark_ids) liked_topic_ids = liked_bookmarks.pluck(:topic_id) @liked_topics = topic.where(id:liked_topic_ids).order('topics.name') else # redirect_to :controller => 'users', :id => current_user.id # gives screwy url # redirect_to user_path, :id => 6 # causes redirect loop # redirect_to :back # causes redirect loop end end end

what's right way go it?

redirect_to user_path(current_user)

ruby-on-rails

arraylist - Java with JPanel -



arraylist - Java with JPanel -

i'm building form in user can come in in employee info , display in textarea field have display or "see all" button cant work. \

i saving each submission saved array called resultshold , array saved array called line both arrays hold 1 submission instead of multiple - tested , each time display contents of array 'line' shows lastly submission meaning not storing mutiple submission each time calculate button clicked - ive added counter line array set position of store "text" variable saves 1 , not mutiple- can help or guide me in right direction - below code.

public class container extends jframe { arraylist<string> resultshold = new arraylist<>(); arraylist line = new arraylist<>(); //private string[] resultshold; private final jlabel employeenamelabel; private final jlabel hoursworkedlabel; private final jlabel department; private final jlabel emptycell; private final jlabel wagelabel; private final jlabel departmentresultslabel; private final jtextfield employeenametexfield; private final jtextfield hoursworkedtextfield; private final jtextfield wagetextfield; private final jtextarea resultsscreen; public jbutton seeall; public jbutton myexitbutton; public jbutton calcbutton; public jbutton clearbutton; jpanel centerpanel; jpanel buttonpanel; jpanel textfieldpanel; jpanel myresultspanel; public container() { super("payroll program"); string[] departments = {"choice 1", "choice 2", "choice 3", "choice 4", "choice 5", "choice 6"}; final jcombobox<string> departmentsv = new jcombobox<string>(departments); departmentsv.setvisible(true); getcontentpane().setlayout(new gridlayout(4, 5, 8, 8)); //creating text fields, labels , buttons emptycell = new jlabel(""); departmentresultslabel = new jlabel(); employeenamelabel = new jlabel("first name"); hoursworkedlabel = new jlabel("hours worked"); wagelabel = new jlabel("wage"); section = new jlabel("department"); employeenametexfield = new jtextfield(5); hoursworkedtextfield = new jtextfield(5); wagetextfield = new jtextfield(5); resultsscreen = new jtextarea(20, 50); myexitbutton = new jbutton("exit"); myexitbutton.setsize(new dimension(10, 10)); calcbutton = new jbutton("calc"); calcbutton.setsize(new dimension(10, 10)); clearbutton = new jbutton("clear"); clearbutton.setsize(new dimension(10, 10)); seeall = new jbutton("see results"); seeall.setsize(new dimension(10, 10)); //adding labels centerpanel = new jpanel(); buttonpanel = new jpanel(); textfieldpanel = new jpanel(); myresultspanel = new jpanel(); centerpanel.setlayout(new gridlayout(0, 4, 8, 8)); centerpanel.add(employeenamelabel); centerpanel.add(hoursworkedlabel); centerpanel.add(wagelabel); centerpanel.add(department); // adding text fields textfieldpanel.setlayout(new gridlayout(0, 4, 8, 8)); textfieldpanel.add(employeenametexfield); textfieldpanel.add(hoursworkedtextfield); textfieldpanel.add(wagetextfield); textfieldpanel.add(departmentsv); //adding buttons panel buttonpanel.setlayout(new gridlayout(0, 4, 8, 8)); buttonpanel.add(seeall); buttonpanel.add(myexitbutton); buttonpanel.add(calcbutton); buttonpanel.add(clearbutton); myresultspanel.setlayout(new gridlayout(0, 1, 8, 8)); myresultspanel.add(emptycell); myresultspanel.add(resultsscreen); myresultspanel.add(emptycell); myresultspanel.add(emptycell); getcontentpane().add(centerpanel, borderlayout.north); getcontentpane().add(textfieldpanel, borderlayout.north); getcontentpane().add(buttonpanel, borderlayout.north); getcontentpane().add(myresultspanel, borderlayout.north); //clear button action event listener clearbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { employeenametexfield.settext(""); wagetextfield.settext(""); hoursworkedtextfield.settext(""); resultsscreen.settext(""); } }); //end clear listener calcbutton.addactionlistener(new actionlistener() { private int counter; @override public void actionperformed(actionevent e) { string mymy[]; counter++; string hoursc; string name; double total; string wagec; name = employeenametexfield.gettext(); wagec = wagetextfield.gettext(); hoursc = hoursworkedtextfield.gettext(); total = double.parsedouble(hoursc) * double.parsedouble(wagec); departmentresultslabel.settext((string) departmentsv.getselecteditem()); string text = name + "'s" + " weekly pay is: $" + total + "..." + "department: " + departmentsv.getselecteditem(); // resultsscreen.append( // name +"'s"+" weekly pay is: $" + total + "..." + "department: "+departmentsv.getselecteditem()); resultshold = new arraylist<>(); resultshold.add(text); //resultshold.set(counter,text); // line= new arraylist<>(); line.add(counter, resultshold); // system.out.println(line.size()); // if(resultshold.size()>0){ system.out.println(resultshold.size()); resultsscreen.append(resultshold.tostring()); // } system.out.println(counter); employeenametexfield.settext(""); wagetextfield.settext(""); hoursworkedtextfield.settext(""); resultsscreen.settext(""); //resultshold.add(name); //resultshold.add(wagec); // resultshold.add(hoursc); // resultshold.add(total.tostring()); // resultshold.add((string) departmentsv.getselecteditem()); //line.set(i, resultshold.get(i)); // line.add(resultshold); // system.out.println(line); resultsscreen.append(line.tostring()); } }); //event listeners myexitbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { //exit programme system.exit(0); } }); seeall.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { (int = 0; < line.size(); i++) { resultsscreen.append(line.get(i).tostring()); system.out.println(line.get(i)); //system.out.println(line.size()); } } }); } public static void main(string[] args) { container guiwindow = new container(); guiwindow.showwindow(); } public void showwindow() { this.setdefaultcloseoperation(exit_on_close); this.setbounds(100, 100, 400, 300); this.setvisible(true); } }

resultshold = new arraylist<>(); resultshold.add(text);

so, every time button clicked, you're recreating new list , store text inside. don't want create new list. want add together existing list.

note code awful: public fields, utilize of raw types, code commented out, java conventions not respected @ all, meaningless variable names...

java arraylist jpanel

java - AspectJ unmatched type warning: how to interpret? -



java - AspectJ unmatched type warning: how to interpret? -

my goal 'around' equals methods of subclasses of type. so, wrote next aspect.

i'm using aspectj-maven-plugin, , i'm telling weave code in dependency jar file, since that's equals methods are.

i rewarded with:

warning:(22, 0) ajc: not match because declaring type java.lang.object, if match desired utilize target(com.basistech.rosette.dm.baseattribute+) [xlint:unmatchedsupertypeincall] warning:(22, 0) ajc: advice defined in com.basistech.rosette.dm.admequals has not been applied [xlint:advicedidnotmatch]

i puzzled. plenty of types in hierarchy of baseattribute declare equals, should not looking @ object. adding &&target(baseattribute+) not seem create error go away.

what missing, and/or how should go tracking down?

package com.basistech.rosette.dm; /** * see if can't create aspect spy on equals ... */ public aspect admequals { // narrow subclasses ... boolean around(object other): call(public boolean baseattribute+.equals(java.lang.object)) && args(other) { boolean result = proceed(other); if (!result) { system.out.println(this); system.out.println(other); system.out.println(result); } homecoming true; } }

ok, lite dawned. aspectj phone call specs describe method defined @ base of operations of class hierarchy, apparently, not overridden. next purports necessary dirty work.

public aspect admequals { // narrow subclasses ... boolean around(object other) : call(public boolean object.equals(java.lang.object)) && args(other) && target(baseattribute+) { boolean result = proceed(other); if (!result) { system.out.println(this); system.out.println(other); system.out.println(result); } homecoming true; } }

java aspectj aspectj-maven-plugin

sql server - SQL UPDATE saving expression NOT updating -



sql server - SQL UPDATE saving expression NOT updating -

i have should simple statement in stored procedure increment value +10. however, if run sp more 1 time value not alter after first call. when modifiy increment value +20 resulting table values +20 original values set in table.

use [db] go set ansi_nulls on go set quoted_identifier on go alter procedure [dbo].[spupdatecareerrankfrominterviewbyid]( -- add together parameters stored procedure here @studentid int ) begin delete studentcategoryranktable studentid = @studentid insert studentcategoryranktable (studentid, occupationalcategoryid, categoryweightedtotal) select studentid, occupationalcategoryid, sum(weightedresponse) weightedresponsetotal dbo.weightedinterviewresponsesview grouping studentid, occupationalcategoryid having (studentid = @studentid) order weightedresponsetotal desc -- determine whether pupil wants pursue declare @certificateonlyquestionoptionid integer = 250 declare @highmathquestionoptionid integer = 43 declare @highreadingquestionoptionid integer = 47 declare @highwritingquestionoptionid integer = 51 declare @certificateonlyoptionanswered integer = null declare @highmathquestionoptionanswered integer = null declare @highreadingquestionoptionanswered integer = null declare @highwritingquestionoptionanswered integer = null -- returns 0 if exec @certificateonlyoptionanswered = dbo.chosequestionoptionid @studentid = @studentid, @questionoptionid = @certificateonlyquestionoptionid exec @highmathquestionoptionanswered = dbo.chosequestionoptionid @studentid = @studentid, @questionoptionid = @highmathquestionoptionid exec @highreadingquestionoptionanswered = dbo.chosequestionoptionid @studentid = @studentid, @questionoptionid = @highreadingquestionoptionid exec @highwritingquestionoptionanswered = dbo.chosequestionoptionid @studentid = @studentid, @questionoptionid = @highwritingquestionoptionid -- determine if pupil wants certificate / non-degree if @certificateonlyoptionanswered != 0 begin insert dbo.testertable (testcolumn) values ('certificate true') -- high math, add together weight scores -- 3: business -- 5: computer technologies -- 7: engineering science technology -- 18: sciences , math if @highmathquestionoptionanswered != 0 begin insert dbo.testertable (testcolumn) values ('high math') update dbo.studentcategoryranktable set categoryweightedtotal += 10 studentid = @studentid , occupationalcategoryid in (3, 5, 7, 18) end -- high reading/writing, add together weight scores -- 4: communications -- 10: humanities -- 19: social , behavioral sciences if @highreadingquestionoptionanswered != 0 or @highwritingquestionoptionanswered != 0 begin insert dbo.testertable (testcolumn) values ('high reading/writing') update dbo.studentcategoryranktable set categoryweightedtotal += 10 studentid = @studentid , (occupationalcategoryid = 4 or occupationalcategoryid = 10 or occupationalcategoryid = 19) end end else begin insert dbo.testertable (testcolumn) values ('failed certificate only') end end

the procedure posted first removes entries in studentcategoryranktable inserts new ones. new records updated. if run procedure again, delete updated records , started.

sql sql-server

excel - Calculation in SSAS Cube not working for zero data values -



excel - Calculation in SSAS Cube not working for zero data values -

i working ssas 2008 r2 cube , interrogating info through excel 2010. in cube have calculation conditionally format data. logic if measure contains specific value fact beingness viewed, fact should colored red, follows:

calculate; scope ( [measures].[data value] ); if([fact base].[confidentiality status].[confidential]) fore_color(this) = 255 end if; end scope;

when have [data value] of 0 (zero) fore_color doesn't render reddish in excel. if alter info value other zero, , reprocess cube renders red. there i'm missing, or there improve mdx script work values of zero?

effectively have following:

if([fact base].[confidentiality status].[confidential] = 1) fore_color(this) = 255 end if;

(... wouldn't expect 0 render red?)

does next mean info 0 red?:

if([fact base].[confidentiality status].[confidential] = 0) fore_color(this) = 255 end if;

excel ssas mdx olap

Windows sets invalid shortcuts -



Windows sets invalid shortcuts -

i have os - windows 8.1 installed on c:, every application installed on d:.

when install application , shortcut created, shortcut start in field set d:\programs... , right path, target field gets set c:\program files(x86)... invalid path, because programme not installed there.

windows shortcut

android studio newrelic proguard not reporting data -



android studio newrelic proguard not reporting data -

i'm working android studio. i've exported signed apk new relic , proguard implementation. gradle.build file:

repositories { mavencentral() } apply plugin: 'com.android.application' apply plugin: 'newrelic' android { compilesdkversion 19 buildtoolsversion "20.0.0" defaultconfig { applicationid "com.myapp" minsdkversion 9 targetsdkversion 19 } buildtypes { release { runproguard true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-android.txt' } } } dependencies { compile 'com.newrelic.agent.android:android-agent:4.87.0' }

the required premissions:

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" />

this called application initializer:

newrelic.withapplicationtoken(configurationmanager.getinstance().getnewrelictoken()) .start(mainapplication.getappcontext());

in proguard-android.txt (which used called progaurd-project.txt):

-keep class com.newrelic.** { *; } -dontwarn com.newrelic.** -keepattributes exceptions, signature, innerclasses

and have newrelic.properties in same level proguard-android.txt:

com.newrelic.application_token=aab1405bc1f2e2************************

an of import thing mention when run code unobfuscated see info beingness reported. problem when export , sign apk it's not reporting data.

android android-studio proguard newrelic

html - Selected affects horizontal position in Chrome -



html - Selected <option> affects horizontal position in Chrome -

i have 2 <select> boxes in sliding <div> within <div> overflow:hidden. if no <option> selected, chrome renders fine. when alternative selected, chrome slides inner <div> on bit. ff33 , ie11 render fine.

i used able slide inner div jquery show 1 <select> or other. chrome starts off positioned incorrectly.

seems chrome bug. reported in chrome help > study issue. until prepare it, have workaround?

see http://jsfiddle.net/dqq38kbk/ or same thing below

class="snippet-code-html lang-html prettyprint-override">selected <div style='overflow: hidden; height: 100px; width: 100px; border: 1px solid black;'> <div style='height: 100px; width: 500px;'> <select style='background: yellow;' size='6'> <option>option1</option> <option selected>option2</option> <option>option3</option> </select> <select style='background: pink;' size='6'> <option>option1</option> <option selected>option2</option> <option>option3</option> </select> </div> </div> not selected <div style='overflow: hidden; height: 100px; width: 100px; border: 1px solid black;'> <div style='height: 100px; width: 500px;'> <select style='background: yellow;' size='6'> <option>option1</option> <option>option2</option> <option>option3</option> </select> <select style='background: pink;' size='6'> <option>option1</option> <option>option2</option> <option>option3</option> </select> </div> </div>

html css google-chrome

php - Trying to setup lamp and wordpress on kitematic for docker -



php - Trying to setup lamp and wordpress on kitematic for docker -

i using next github repositoryies setup images on kitematic docker.

https://github.com/tutumcloud/tutum-docker-lamp

https://github.com/tutumcloud/tutum-docker-wordpress

i have them both installed imags. docker-lamp gives me hello world cant connect local mysql server, , wordpress doesnt work @ all.

here logs each in order

lamp logs

https://gist.github.com/anonymous/ad9c56cb817dd619caf8

wordpress logs

https://gist.github.com/anonymous/225fad3840327dec39ea

the tutum images should work out of box.

open kitematic, , search tutum images using tutum keyword. find lamp , wordpress images, , click create create containers.

they should run.

hope helps!

php mysql wordpress docker

comments - Stata delimit in command line -



comments - Stata delimit in command line -

i working on .do file created else. person used semicolon delimiter in entire file. trying go through file , see going on. selecting portion of code , hitting "execute selection (do)" button. however, delimiter seems messing this. there workarounds me?

suppose do-file looks this:

#delimit ; set obs 10 ; gen x = _n ; gen y = x^2 ; gen z = x ^3;

anytime highlight selection , press "execute selection (do)", stata creates temporary, self-contained do-file, default delimit @ cr , runs that:

"when do-file begins execution, delimiter automatically set carriage return, if called do-file set delimiter semicolon."

it not sequentially run commands console. therefore, if select first 2 commands in do-file above, temporary do-file includes phone call #delimit whereas if selected lastly 2 commands, temporary do-file not have phone call , throw syntax error 2 line commands.

one solution copy-paste selections fresh do-file had #delimit command @ beginning, , run that.

you write script rid do-file of semicolons. if line not end in semicolon, append next line end of current line, , check line again. depending on how complex syntax in do-file, more or less difficult.

comments stata

Restricting Notepad++ operations to occur in a range of lines -



Restricting Notepad++ operations to occur in a range of lines -

with notepad++ , find/replace tool, there regexp or way restrain operation within range of lines?

for example, let's want find string, replace string in lines 40 50.

you can manually select range replace strings using flag alternative "in selection"

notepad++

php - SQL switch statement -



php - SQL switch statement -

( don't know if right asking if possible , how )

so want when page index.php select something, , when jobs.php select else if possible.

i trying execute sql statement, not work.

$sql_q; $path=$_server['php_self']; $page=basename($path); switch("$page") { case 'index.php': $sql_q = 'select * jobs title '%news%'" '; break; case 'jobs.php': $sql_q = 'select * jobs title '%jobs%'" '; break; }

and here:

$getquery = mysql_query("$sql_q limit $p_num, $per_page");

is possible somehow ?

thanks.

you can this:

switch ($page) { case 'index.php': $toselect = '%news%'; break; case 'jobs.php': $toselect = '%jobs%'; break; } $query = sprintf( 'select * `jobs` `title` "%s" limit %s, %s', $toselect, $p_num, $per_page );

also, consider using mysqli* functions, mysql* deprecated.

php select switch-statement

sql - C# SqlCeConnection not updating .sdf file, no data in the file -



sql - C# SqlCeConnection not updating .sdf file, no data in the file -

i have next code:

string dbfile = "c:\\users\\ralph\\documents\\visual studio 2012\\projects\\workstimes\\workstimes\\database.sdf"; sqlceconnection connection = new sqlceconnection("datasource=" + dbfile); connection.open(); dataset info = new dataset(); datatable dt = new datatable("table2"); dt.columns.add(new datacolumn("id", typeof(int))); dt.columns.add(new datacolumn("name", typeof(string))); data.tables.add(dt); sqlcedataadapter adapter = new sqlcedataadapter("select * [table2]", connection); if (data != null && data.tables.count > 0) { system.diagnostics.debug.writeline("test"); datarow dr = data.tables["table2"].newrow(); dr["id"] = 0; dr["name"] = "jan"; data.tables["table2"].rows.add(dr); data.tables["table2"].rows.add(new object[] { 1, "jan" }); system.diagnostics.debug.writeline(data.tables["table2"].rows.count);//returns 2 adapter.fill(data); adapter.update(data); connection.close(); }

when check database file still empty. why isn't code adding rows database file?

the update command update existing rows - seem seek insert new rows task of .insert method (not .update() ) .... – marc_s 16 mins ago

thanks, looks using wrong things seek rows in database.

c# sql dataset sqlconnection

Scope of Variables in Java -- issue -



Scope of Variables in Java -- issue -

okay i'm having problem scope of object. i'm using jsoup right , here's code:

//website /001.shtml, adding count string wouldn't work. //this why have ifs if (count < 10) { document site = jsoup.connect(url + "00" + count).get(); } else if (count < 100) { document site = jsoup.connect(url + "0" + count + ".shtml").get(); } else { document site = jsoup.connect(url + count + ".shtml").get(); }

okay create document object called site, , need add together amount of zeros because of how person made website, no problem. when seek utilize site.select(anything), can't because object defined in if construct.

also, can not initialize outside if, not work because duplicate error thrown. please tell me there prepare because have searched , searched no avail, , don't want have set rest of programme 3 times different ifs...

move declaration outside if else if chain, like

document site = null; if (count < 10) { site = jsoup.connect(url + "00" + count + ".shtml").get(); // missing shtml. } else if (count < 100) { site = jsoup.connect(url + "0" + count + ".shtml").get(); } else { site = jsoup.connect(url + count + ".shtml").get(); }

or might build url , connect 1 time like,

string urlstr = url + string.format("%03d", count) + ".shtml"; document site = jsoup.connect(urlstr).get();

java

msbuild - Access ProgramFilesFolder from Visual Studio post-build events -



msbuild - Access ProgramFilesFolder from Visual Studio post-build events -

when building c# project in visual studio, in post-build events need phone call programme situated in c:\program files\\myprogram.exe. how can access "c:\program files" folder post-build events?

at link: http://msdn.microsoft.com/en-us/library/42x5kfw4.aspx there several macros can used in post-build events section of visual studio. there macro or there way access default programfilesfolder path?

don't macro, none provided since can utilize environment variables in pre/post-build steps. can .bat file, way these build steps execute. looking %programfiles% environment variable. run program, use:

"%programfiles%\myprogram.exe"

visual-studio msbuild post-build-event

bash - Iteration over strings contain white spaces -

This summary is not available. Please click here to view the post.

xcode - Calculate distance between annotation and user -



xcode - Calculate distance between annotation and user -

i trying calculate distance between user , selected (clicked) annotation. code seemed ok me, exc_bad_instruction error @ var distance = ... line. why?

fatal error: unexpectedly found nil while unwrapping optional value @ var distance line

var locationmanager = cllocationmanager() var userlocation: mkuserlocation! func mapview(mapview: mkmapview!, didselectannotationview view: mkannotationview!) { allow location = cllocation( latitude: view.annotation.coordinate.latitude, longitude: view.annotation.coordinate.longitude ) println(location.coordinate.longitude) var distance : cllocationdistance = locationmanager.location.distancefromlocation(location) println(distance) } func locationmanager(manager:cllocationmanager, didupdatelocations locations:[anyobject]) { var latvalue = locationmanager.location.coordinate.latitude var lonvalue = locationmanager.location.coordinate.longitude allow location = cllocationcoordinate2d(latitude: latvalue, longitude: lonvalue) allow span = mkcoordinatespanmake(1, 1) allow part = mkcoordinateregion(center: location, span: span) mapview.setregion(region, animated: true) }

xcode swift locationmanager

linux - Beanstalkd for CentOs 7 -



linux - Beanstalkd for CentOs 7 -

due misconfiguration i've migrated vps centos 6 centos 7 fresh start. among other things had beanstalkd service installed on centos 6.

at time i've followed tutorial http://viewsfromtheside.com/2014/06/12/install-beanstalkd-centos-6/ , worked me.

but now, can't install beanstalkd on centos 7 version.

i used line epel repo :

# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm # rpm -ivh epel-release-7-2.noarch.rpm

then tried :

# yum install beanstalkd --enablerepo=epel-testing

and :

# yum --disablerepo="*" --enablerepo="epel" list available | grep 'beanstalkd'

and :

# yum search beanstalkd

but still : no matches found for: beanstalkd ...

i new centos , epel repos, maybe missed ? anyway, how can install beanstalkd on centos 7 ?

yes, can instal via git , re-create systemd script:

step 0. install git

yum install git

step 1. clone repository

git clone git://github.com/kr/beanstalkd.git cd beanstalkd create cp beanstalkd /usr/bin/beanstalkd mkdir /var/lib/beanstalkd

step 2. create startup script

create file /etc/systemd/system/beanstalkd.service content:

[unit] description=beanstalkd simple, fast work queue [service] user=root execstart=/usr/bin/beanstalkd -b /var/lib/beanstalkd [install] wantedby=multi-user.target

step 3. finally, run

systemctl enable beanstalkd , systemctl start beanstalkd

step 4. check

ps ax | grep beanstalkd

linux beanstalkd centos7 epel

r - xtable adding a title on top and a caption under the table -



r - xtable adding a title on top and a caption under the table -

i want set caption title on xtable in rnw document. here's code. unfortunately, i'm not able add together caption under table. i've tried \caption{} function, won't print pdf.

i've seen r: xtable caption (or comment), it's not working table created lm() function in r. have clue?

<<yoman,echo=false,results=tex>>= library(xtable) pop5lm <- lm(mpg ~ wt, data=mtcars) #my linear model print(xtable(pop5lm, caption = c("estimates of linear model father muro cb"), label = "tab:one", digits = c(0,2, 2, 2,3)), table.placement = "tbp", caption.placement = "top") @

caveat: not frequent user of either xtable nor latex.

i couldn't see quick alternative in xtable add together text bottom of table (that doesn't mean there isn't one) have used thought here , link in question. rather rough prepare big drawback need specify width of text add together (equal width of table) - if create long stretches final column (to see alter 8.5 10).

\documentclass{article} \usepackage{array} \newcolumntype{l}[1]{>{\raggedright\arraybackslash}m{#1}} \begin{document} \sweaveopts{concordance=true} <<yoman,echo=false,results=tex>>= library(xtable) mod <- lm(mpg ~ wt, data=mtcars) #my linear model print(xtable(mod, caption = "estimates of linear model father muro cb ", #label = "tab:one", digits = c(0,2, 2, 2,3)), table.placement = "h!", caption.placement = "top", add.to.row = list(list(2), "\\hline \\multicolumn{5}{l{8.5cm}}{\\textbf{note: } description, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah} \\\\")) @ \end{document}

i assume there many alternatives in latex accomplish might started.

r latex sweave caption xtable