Posts

Showing posts from May, 2013

c# - Performance problems for WCF Services on Windows Phone 8 -

i'm going make windows phone 8 app gets data wcf services. i'm starting wp 8 development , i'm begging wonder if wcf best choice. after wsdl services send lot of xml data , formatting every response not best thing phone app. question is: ok use wcf big xml responses or should try else, maybe httphandlers return json data maybe dynamic gzip responses? not sure if work wp8, said i'm wondering right direction point self to. thanks help. decided go wcf , json responses connect windows phone 8 app.. didn't choose wcf kind of part of assignment, going use build in authentication , authorization system of wcf user credentials.. i'm going serialize response every time in json format , gzip when returning it. modest testing turns out quiet fast. if else wondering here sample code (i'm using json.net): private string getsupplierslite() { // objectcontext data source service. northwindentities context = this.currentdatasource; ...

jQuery out of key-value pair send key to servlet while show value on webpage -

i have replace <select> tag jqueryui autocomplete so code like <select id = "product" name = "product"> <option value = "m0001">mercedes</option> <option value = "b0001">bmw</option> <option value = "f0001">ferrari</option> </select> so when form submitted servlet value m0001 or b0001 etc. depending on whether mercedes or bmw now have replace jquery ui autocomplete. such when type on <input type = "text" name = "product"/> on webpage result mercedes or bmw etc. once bmw selected. on servlet doing request.getparameter("product"); give me b001 how can ??

html - How to force tds to get max width from the corresponding th? -

i've got table in every th has following style: width: 100px; max-width: 100px; and ok 1 td has long e-mail adress without - , th more 100px width. there way force tds max-width corresponding ths ? edit: jsfiddle: http://jsfiddle.net/cx7t9/ if free add styles tds, can apply styles related with, tds ths, plus add word-break:break-all; read more here i have edited fiddle http://jsfiddle.net/cx7t9/1/

java - Android - Creating txt file in sdcard -

this question has answer here: how create text file , insert data file on android 4 answers ~no need anymore, thanks~ i have been looking answer on site, none of code worked. here function: public void onclicktemp(view view) { } using function, want write code creates *.txt file in sdcard text in it. happy examples how read , change *.txt file well, let's start creating one. i have permission write external storage, , checked file explorer ddms. edit: succeed creating txt file (: the problem was: emulator didn't have sd card. solution: android emulator - accessible storage space? edit2: figured out reading files (: solution: how can read text file in android? edit3: understood editing aswell( found guide in google, don't have link sorry) at moment, don't have anymore questions, help! edit: succeed creating txt file ...

What's the easiest way to check if a javascript variable is a number and greater than zero? -

this question has answer here: validate decimal numbers in javascript - isnumeric() 46 answers i coded this: isnumbernotzero: function (num) { // return false if num null, empty string or 0 if (num === null || typeof num === "undefined" || (typeof num === "string" && num.length === 0) || num == 0) { return false; } return true; }, but there easier way this. code have not seem clean. you doing lot of checking things not, when care if number greater zero. just: return typeof === "number" && > 0

c# - Error: Mutex to check, if the application is already running -

hey guys i've got following problem: declared mutex check, if application running. if file need in project missing, there error message , method, closes application before initializecomponent(). everytime file missing, error due following line: w.show(); here is, i've got far: startup="application_startup"> public void application_startup(object sender, startupeventargs e) { bool absicherung; mutex mutex = new mutex(true, this.gettype().guid.tostring(), out absicherung); if (absicherung) { window w = new mainwindow(); w.closed += (sender2, args) => mutex.close(); ; w.show(); } else { messagebox.show("die anwendung läuft bereits. eine mehrfache ausführung dieser ist nicht vorgesehen.", "hinweis: anwendung läuft bereits", messageboxbutton.ok, messageboximage.information); mutex.close(); application.curr...

plsql - oracle sql dynamic query to select column in cursor -

i've declared below cursor , variables: l_level varchar2(100); l_level_value varchar2(100); l_select_clause clob; cursor l_data select level1, level2, level3 levels; then loop through cursor: for c1line in l_data loop case when c1line.level1 null l_level := 'c1line.level2' when c1line.level2 null l_level := 'c1line.level3' when c1line.level3 null l_level := 'c1line.level4' else l_level := null end case; end loop; l_select_clause := 'select ' || l_level || ' l_level_value dual;'; execute immediate l_select_clause; and have other statements execute depending on selected variable l_level_value my problem when execute procedure following error: ora-00904: "c1line"."level2": invalid identifier ora-06512: @ "my_procedure", line 110 ora-06512: @ line 2 does know have done wrong? thanks about actual error c1line.level1 , open curs...

asp.net mvc - Return 404 if parameter type is wrong -

i interested know if there general way resolve issue. lets of actions expect id parameter passed, @ point user may try assign string id parameter url. result our action not fired , 500 exception thrown in base class. there way resolve , throw 404 exception instead? you can put contraints on route. can find tutorial here http://www.asp.net/mvc/tutorials/controllers-and-routing/creating-a-route-constraint-cs then putting string instead of id not match route. the alternatives create exception filter in mvc/webapi handle exceptions , condition, or create custom route handler.

sql - Incorrect Count with Multiple Joins -

i'm getting incorrect count when use multiple 'joins'. should show 3 total it's returning 134 total. what's proper way use count multiple 'joins'? select r.field1 , total = count(r.field1) location1.dbo.table1 r ( nolock ) join location2.dbo.table2 ( nolock ) on r.field1 = i.field1 join location3.dbo.table3 rt ( nolock ) on rt.field1 = i.field1 , rt.field2 = r.field2 r.field3 = '40' , r.field4 = 'h' , r.field1 = '516' , convert(char(10), r.timestamp, 101) = convert(char(10), getdate(), 101) group r.field1 that's how joins work. total number of results result of joins. if original table has 1 row matches criteria, count join have hundreds of results due one-to-many relationship. can see why changing query: select * location1.dbo.table1 r ( nolock ) join location2.dbo.table2 ( nolock ) on r.field1 = i...

Python expected one argument, found three, what is the proper syntax? -

for example... day=1 question=int(input("how many cookies did eat on day number", day, " ?")) and in loop, i've got day=day+1 so, when repeats, asks day 1, 2, 3... i understand not correct syntax, obviously, because python keeps refusing saying expected 1 argument , got three. how set up? use string formatting: input("how many cookies did eat on day number {}?".format(day))

javascript - Maintaining Scroll Position With Back Button and Ajax Dom Manipulation -

i loading results in ajax infinite scroll, however, when click item in list , navigate away page, click button, @ top of list. i can't figure out how make user return position left off. see site working on: https://www.studenthouses.com/search/manchester/ scroll down few times, click property, click , see mean. i can't remember result position , load them in because take long, need browser remember dom when comes page, or cache how. is there solution this? many thanks sure there , it's piece of cake. well, it's cookie, :) you don't need solve problem. first, cookie here: cookie api second, you'll have encode data in cookie somehow. if have multiple pages one, you'll have separate them somehow or use key-value pair , store this: manchester=3522 whenever enter page, load cookie, wait page unrolled (you use ajax or similar, you'll have wait page being unrolled , window.onload won't do). if there no cookie, skip ste...

ios - Flex Degrafa's bezier spline under AIR 3.9 -

i have mobile flex project running on ios has been using degrafa's library in order use bezierspline class. purpose able draw directly on screen, collection of points given user gesture converted bezier curve using library. however, app has been crashing displaying page containing @ least 1 of these curves. don't error, stacktrace or anything, app killed , i'm taken ios desktop. apparently error occurring somewhere inside .draw() function of bezierspline class. also, i've noticed occuring on release versions of app, either through appstore (looks didn't notice it) or through release package deployed on ipad. working fine in emulator or debug package directly on device. since haven't made release packages time, i'm not sure modification may have caused this. thing know i've updated flash builder 4.7 , air 3.9 (which required other features of project). so have 3 questions: in case can app crash in release mode , not in debug mode? code remain...

cut - Bash script builds correct $cmd but fails to execute complex stream -

this short script scrapes log files daily create simple extract. works command line , when echo $cmd , copy/paste, works. breaks when try execute script itself. i know nightmare of patterns improve, missing simple execute correctly? #!/bin/bash priorday=$(date --date yesterday +"%y-%m-%d") outputfile="/home/cchcs/da14/$priorday""_prod_message_processing_times.txt" cmd="grep 'processed inbound' /home/rules/care/logs/rootlog* | cut -f5,6,12,16,18 -d\" \" | grep '^"$priorday"' | sed 's/\,/\./' | sed 's/ /\t/g' | sed -r 's/([0-9]+\-[0-9]+\-[0-9]+)\t/\1 /' | sed 's/ / /g' | sort >$outputfile" printf "command execute:\n" echo $cmd printf "\n" $cmd ouput: ./make_log_extract.sh command execute: grep 'processed inbound' /home/rules/care/logs/rootlog.log /home/rules/care/logs/rootlog.log.1 /home/rules/care/logs/rootlog.log.10 /hom...

android - Cannot build cordova project successfully error while executing ant debug command -

i having error camera not successful invoked on first try (click) tried solution on stackoverflow phonegap(3.0.0) camera not successful on first try . followed steps mentioned in answer removed android cordova platform remove android run second command cordova platform add android ; now when use netbeans run cordova application on cordova android decvice error occurs: exec: ant debug -f "/var/www/mobile/platforms/android/build.xml" [ 'ant debug -f "/var/www/mobile/platforms/android/build.xml"', { [error: command failed: build failed /var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:720: following error occurred while executing line: /var/www/adt-bundle-linux-x86_64-20130917/sdk/tools/ant/build.xml:734: compile failed; see compiler error output details. total time: 8 seconds ] killed: false, code: 1, signal: null }, 'buildfile: /var/www/mobile/platforms/android/build.xml\n\n-set-mode-check:\n\n-set-deb...

c# - Make webservice client compatible to newer servers -

we have .net client uses proxy class (derived system.web.services.protocols.soaphttpclientprotocol ) generated wsdl file wsdl.exe. up have compatibility between client , webservice webservice changes. old client (with old proxy generated old wsdl file) not call new webservice methods. problem extension of enum type (xsd.enumeration). special enum used in many get... calls. example wsdl <xsd:simpletype name="colors"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="red"/> <xsd:enumeration value="blue"/> <xsd:enumeration value="unspecified"/> </xsd:restriction> </xsd:simpletype> proxy code generated wsdl [system.codedom.compiler.generatedcodeattribute("wsdl", "2.0.50727.3038")] [system.serializableattribute()] [system.xml.serialization.xmltypeattribute(namespace="urn:archive.admin.services.ecm.opentext.com")...

css - Google Maps API v3 autocomplete text width -

https://developers.google.com/maps/documentation/javascript/places-autocomplete#style_autocomplete describes how deal searchbox. in old maps version when using directions suggestions appear in full (so text width wider actual box). have not been able find anyway accomplish , using https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete?csw=1 code. thanks in advance. the autocomplete generates div .pac-container class, can add css rule , add priority using !important option. in css add: .pac-container { width: 200px !important; } replace 200px desired width. believe should job.

winforms - VB.NET events handling in deep -

anybody know how events works in vb.net doubt happen if event code doesn't finish of handle event , new 1 happen. i.e.: have doubleclick event , user make repeatedly , insistently double click lot of times fast. the event code calls sub routines , functions in same form(not multi threading) the event code restart form top or wait until finish , re enter when code executed? today catch following 2 errors error 1: error al crear identificador de ventana. en system.windows.forms.nativewindow.createhandle(createparams cp) en system.windows.forms.control.createhandle() en system.windows.forms.control.createcontrol(boolean fignorevisible) en system.windows.forms.control.createcontrol() en system.windows.forms.control.controlcollection.add(control value) en system.windows.forms.tabcontrol.controlcollection.add(control value) en system.windows.forms.tabcontrol.tabpagecollection.insert(int32 index, tabpage tabpage) en commands.form1.datagridviewalarms_cellmousedoubleclick(ob...

javascript - Cannot call method indexOf undefined -

i'm getting error, cannotcall method indexof 'undefined' when using ko utils array filter . . . view model: viewmodel.people = ko.mapping.fromjs(people); self.filter1 = ko.observable(); self.filteredsystem = ko.computed(function () { var filter1 = self.filter1(); return ko.utils.arrayfilter(viewmodel.people(), function (people) { return ((people.name.indexof(filter1) !== -1)); }); }, self); because used mapping plugin, name property going observable , have unwrap ( people.name().indexof... ) value.

REGEX - match the Nth word of a line containing a specific word -

i'm trying correct regex task: match nth word of line containing specific word for example: input: this first line - blue second line - green third line - red i want match 7th word of lines containing word « second » desired output: green does know how this? i'm using http://rubular.com/ test regex. i tried out regex without success - matching next line (.*second.*)(?<data>.*?\s){7}(.*) --- updated --- example 2 input: this foo line - blue bar line - green test line - red i want match 4th word of lines containing word « red » desired output: test in other words - word want match can come either before or after word use select line you can use match line containing second , grab 7th word: ^(?=.*\bsecond\b)(?:\s+ ){6}(\s+) make sure global , multiline flags active. ^ matches beginning of line. (?=.*\bsecond\b) positive lookahead make sure there's word second in particular line. (?:\s+ ){6} matches 6...

How to send emails in python as other email? -

i've been trying create contact page on website send email using google smtp can manage that. able send message confirming have received message. send message email use has used sent message, can send myself myself, prefer come users email in sender field rather email can click reply send them message back. possible. in advance #kvemail email , senderemail users email #this email sending user s.sendmail(kvemail, senderemail, confirmmsg.as_string()) #this email sent self s.sendmail(senderemail, kvemail, adminmsg.as_string()) gmail isn't going let spoof sender, you're trying do. spammers , scammers that. web host have smtp server? try that. an alternative approach might put user's address reply-to header. it'll appear come you, when reply it'll @ least go original user. gmail might ok that.

c++ - Create QAction with shortcut, without inserting in menu -

#include "mainwindow.h" #include "ui_mainwindow.h" #include <qdebug> #include <cassert> mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); qaction* = new qaction(this); back->setvisible(true); back->setshortcut(qkeysequence("ctrl+m")); bool cres = connect(back, signal(triggered(bool)), this, slot(myslot())); assert(cres); } in code tried catch ctrl+m key event. don't want put action in menu. connect returns true myslot never called. when action inserted in menu, shortcut works well. have done wrong? qaction dormant until insert somewhere. vahancho has suggested, use qshortcut . need instantiate shortcut each top-level widget (window) want active. if have 5 top-level windows, you'll need 5 shortcuts, each having 1 of windows parent. there no way use qshortcut global shortcut without gui. qshortcut active when associa...

html - CSS div not moving to the middle -

i making own website, reason can't move black box middle of screen please guys me out. have make on jsfiddle because don't have enough rp show screenshots on here. please see link view code: http://jsfiddle.net/xiijamiie/lfwbn/4/ #white_box { position:absolute; margin:auto 0; min-width:80%; max-width:100%; height:85%; top:0%; background:black; z-index:1; width:80%; } thanks in advance! if width 80% offset left half of restant width: left:10%; check demo http://jsfiddle.net/lfwbn/7/

java - timeout errors from Tomcat talking to MongoDB in Azure -

my system tomcat 7 server running on ubuntu talking mongodb cluster running in centos. have on aws , working fine. i brought exact same thing on azure , having constant, seemingly random timeouts when tomcat app tries query mongodb. typical error is: jan 31 08:13:54 catalina.out: jan 31, 2014 4:14:09 pm com.mongodb.dbportpool goterror jan 31 08:13:54 catalina.out: warning: emptying dbportpool xxx.cloudapp.net/xxx.xxx.xxx.xxx:21191 b/c of error jan 31 08:13:54 catalina.out: java.net.socketexception: connection timed out jan 31 08:13:54 catalina.out: @ java.net.socketinputstream.socketread0(native method) jan 31 08:13:54 catalina.out: @ java.net.socketinputstream.read(socketinputstream.java:146) jan 31 08:13:54 catalina.out: @ java.io.bufferedinputstream.fill(bufferedinputstream.java:235) jan 31 08:13:54 catalina.out: @ java.io.bufferedinputstream.read1(bufferedinputstream.java:275) jan 31 08:13:54 catalina.out: @ java.io.bufferedinputstream.read(bufferedinputstrea...

c# - ASP.net Authorization issue -

i have application uses active directory authenticate users login website. i have table in database user types. based on user type, users can see different views. ex: normaluser can see 3 views (about - contact - view data) manageruser can see 5 views (about - contact - view data - delele data - update data). how ever , view works fine have problem when example normaluser change url manualy updatedata.aspx see page of manageruser. how can prevent users accessing other pages ? please note have stateview code in site.master we use same authentication/authorization setup in several of our web apps, using windows authentication, , custom sql table authorization. you have few options: recommend option 1 or 2. since have custom table stores user roles/types, write custom roleprovider ( http://msdn.microsoft.com/en-us/library/8fw7xh74.aspx ), , add web.config authorization rules restrict access pages based on user roles. have done in our application. use ...

Error when trying to insert a variable from C# into MySQL -

this question has answer here: parameterized query mysql c# 6 answers here code i'm using insert values database. public void callsql(string partnumber, string total, string numofpacks, string dunsnumber, string serialnumber, string lanenumber) { mysqlconnection myconnection = new mysqlconnection("server=localhost;database=testing;uid=root;password=********;"); try { myconnection.open(); console.writeline(lanenumber); mysqlcommand mycommand = new mysqlcommand("insert test (part_number, total, number_of_packs, dunsnumber, serialnumber, truck_number) values (" + partnumber +","+total+","+numofpacks+","+dunsnumber+","+serialnumber+","+lanenumber+")", myconnection); mycommand.executenonquery(); console...

bash - Crontab apparently not calling sudo -

tl;dr bash script requires sudo works fine when called manually, not work when called crontab, though add crontab using sudo crontab -e i trying automate connection vpn proxy such vpn connection turned on @ midnight , off @ 7:15am. in order automate it, wrote following bash script, located @ /usr/local/bin/cloak.sh . #!/bin/bash log_file=/home/declan/log/cloak.log logentry() { while read data echo "$(date "+%y %m %d %t") ; $data" >>$log_file 2>&1; done } echo "---------------------" | logentry if [ $1 -eq 1 ] echo "turning cloak on" | logentry /etc/init.d/openvpn start proxpn.miami | logentry else echo "turning cloak off" | logentry /etc/init.d/openvpn stop | logentry fi echo "---------------------" | logentry echo " " | logentry my vpn working , have confirmed script executable , works checking ip address before , after calls s...

Get the ROI of two binary images and find difference of the mean image intesities between 2 ROI in python -

i have 2 binary images (uint16, [512,512]) there roi @ exact center, how can roi of both binary images(image1.dat , image2.dat) , calculate difference in mean intensities between 2 roi , save pdf in python. please me out. thanks you should use [numpy][1] .loading , saving images can done different modules. here using numpy, there other possibilities : import numpy np #load image using numpy shape = (512, 512) im1 = np.fromfile('image1.dat', 'uint16').reshape(shape) im2 = np.fromfile('image2.dat', 'uint16').reshape(shape) #extract roi im1_roi = im1[100:400,150:350] im2_roi = im2[100:400,150:350] #get difference , save bmp im_difference = im1_roi-im2_roi result = image.fromarray(im_difference) result.save('out.bmp') #get mean of intensities , compute difference im_mean_difference = np.mean(im1_roi)-np.mean(im2_roi) print im_mean_difference

.net - Can I develop a windows 8.1 app using visual studio 2013 in windows embedded 8.1 industry pro -

i have account in microsoft dreamspark student, have opportunity download , install windows embedded 8.1 industry pro ( french link ) ( english link ) i know if can develop applications windows 8.1 using visual studio 2013? features of windows 8.1 pro not present in windows embedded 8.1 industry pro? problem use version of windows knowing i'm developer? you can use visual studio 2013 develop applications windows 8, both "metro"/"modern ui" apps native applications. however, windows embedded not standard, normal windows version, rather version of windows that's used on appliances point-of-sale machines etc. if want normal windows apps, don't bother embedded stuff.

ruby on rails - How to query a polymorphic relationship -

i have jobs table , activities table. 1 job can have many activities. relation polymorphic. tables: job activities ----------- ------------- id id ... target_id target_type ... models pseudo-code: class job < activerecord::base # ... has_many :activities, :as => :target, :dependent => :delete_all # ... end class activity < activerecord::base # ... belongs_to :target, :polymorphic => true # ... end the state of given job determined state of last activity relates to, below (the last in case last created, can safely order id). job +-> activity 1 - state: new | +-> activity 2 - state: submitted +--> job state approved `-> activity 3 - state: approved | how query jobs on given state, using activerecord , rails 3/4? it (just) occurred me idea to, instead of doing query altogether, use "counter caches" uses , denormalize relationship. store state on jobs t...

c++ - Width constraint of the output lines to the console -

class prints string console. how make width of output lines equal characterwidth = 40, ie after 40 characters transferred new line? #include <string> #include <iostream> class stringprocessing { public: stringprocessing() : characterwidth(40), texttobeformatted("null") {} inline void stringprocessing::initstring() { texttobeformatted = "text text text text text text" "text text text text text text" "text text text text text" "text text text text text text" "text text text text text text"; } inline void displaystring() { std::cout << texttobeformatted << std::endl; } private: int characterwidth; std::string texttobeformatted; }; i have idea here words in console cut off, need transferred next line , per...

python - Numpy Genfromtxt slower than pandas read_csv -

i'm loading csv file (if want specific file, it's training csv http://www.kaggle.com/c/loan-default-prediction ). loading csv in numpy takes dramatically more time in pandas. timeit("genfromtxt('train_v2.csv', delimiter=',')", "from numpy import genfromtxt", number=1) 102.46608114242554 timeit("pandas.io.parsers.read_csv('train_v2.csv')", "import pandas", number=1) 13.833590984344482 i'll mention numpy memory usage fluctuates more wildly, goes higher, , has higher memory usage once loaded. (2.49 gb numpy vs ~600mb pandas) datatypes in pandas 8 bytes, differing dtypes not difference. got near maxing out memory usage, time difference can not ascribed paging. any reason difference? genfromtxt way less efficient? (and leaks bunch of memory?) edit: numpy version 1.8.0 pandas version 0.13.0-111-ge29c8e8

Pylint: "locally defined disables" still give warnings. How to suppress them? -

i work software framework has couple of classes method names containing capital letters (due c++ wrappers). of course not pep8 , pylint shows corresponding error c0103 . added c0111 list ignore missing docstrings methods, this: def configure(self): # pylint: disable=c0103,c0111 it works, warnings because of local disablings: class: i0011 -> locally disabling c0103 class: i0011 -> locally disabling c0111 how should suppress them? ok, 1 has ignore ignore-warning explicitly. 1 can in pylint config file: if don't have one, generate standard configuration via pylint --generate-rcfile > pylint.rc and uncomment line disable=... , add i0011 list. suppresses warnings regarding "locally defined disablings". the other method add following line beginning of file (or block, whatever), if don't want suppress warning globally: #pylint: disable=i0011

php - Magento Block Class Rewrite In Config.xml - Second Guessing My Methodology -

Image
so have written module works quite well. however, trying make sure write of modules conflict-free possible. short: module displays reviews associated products of grouped , configurable products on parent product page , listings. in catalog/product/list.phtml there 3 lines of code if parent product has no reviews, though children products have reviews, not satisfy if condition in order display summary html. <?php if($_product->getratingsummary()): ?> <?php echo $this->getreviewssummaryhtml($_product) ?> <?php endif; ?> so, goal add data each element in collection before reached template file. $_productcollection=$this->getloadedproductcollection(); so, did rewrite of mage_catalog_block_product_list , rewrote method below. protected function _getproductcollection() actually, copied exact method on , added simple code bottom of , indeed want do. protected function _getproductcollection() { if (is_null($this->_productcollection)) { ...

ios - Aligning a UIImageView with Auto Layout -

Image
what want add image subview, align centered along x axis , 10 points bottom of superview. need use auto layout only, , preferably visual formatting language. - (void)viewdidload { [super viewdidload]; self.imageview = [[uiimageview alloc] initwithframe:cgrectzero]; [self.imageview settranslatesautoresizingmaskintoconstraints:no]; [self.imageview setimage:[uiimage imagenamed:@"06-arrow-south"]]; self.imageview.contentmode = uiviewcontentmodescaleaspectfit; [self.view addsubview:self.imageview]; [self addconstraints]; self.imageview.layer.bordercolor = [[uicolor redcolor] cgcolor]; self.imageview.layer.borderwidth = 1.0; } - (void)addconstraints { nsdictionary *viewsdictionary = @{@"arrowimage":self.imageview}; [self.view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|-[arrowimage(==40)]-|" options:0 ...

javascript - Pass select value to controller without refreshing the page (AJAX, RAILS, JS) -

i'm newbie using ajax , i'm trying work on group of select boxes when user selects value first, second updates values. i'm trying use ajax, jquery , ror, far, can't fetch value first box , pass controller in order filter results of second. this code index.html.erb <%= form_tag(posts_path, remote: true, :method => 'get', class: "forma") %> <%= select_tag("box", options_from_collection_for_select(@posts, :content, :content), :prompt => "select") %> <p> <%= select_tag("nbox", options_from_collection_for_select(@listposts, :content, :id), :prompt => "select") %> <p> <%= submit_tag "show", class: "btn btn-info" %> <% end %> this index.js.erb $(document).ready(function() { $(".btn").on("click", function() { $('.table').fadetoggle(); }) $('#box...

ajax - JSONP with Jquery 1.9 and Jersey 2.5.1 -

i've googled lot , found nothing suits needs. found these similar threads here , here , here , don't solve problem or don't understand correctly. read jersey documentation couple of times. i'm developing server side application jersey 2.5.1 , client side html/css/javascript. worked out great, no i'm stumbling. i'm using media-moxy java2json mapper. @get @jsonp @path("search") @produces({mediatype.application_json, "application/javascript"}) public string findbytagsandboundingbox(@queryparam("topleftlat") double toplat...) { // work return json.tostring(); } if curl on command line (see accept header request jersey documentation) curl -x -h "accept: application/javascript" "http://localhost:8181/xxxxx/xxxx/search?topleftlat=59.93704238758132&topleftlon=10.68643569946289&bottomrightlat=59.890573111743336&bottomrightlon=10.806941986083984&tag=restaurant&callback=?" jersey...

javascript - Trying to only allow 4 numbers in a field -

i trying make sure validate 4 digits can numbers in field, , letters cannot accepted. field. <tr> <td id="exam_number">exam number</td> <td><input type="text" name="exam_number" /></td> </tr> helpful answer here specifically, you'd want change input element to: <input type="text" maxlength="4" pattern="[0-9]{4}" title="four digit test number" name="exam_number"/> and use jquery allow digits shown here $("#myfield").keyup(function() { $("#myfield").val(this.value.match(/[0-9]*/)); });

ios - Mutating NSDictionary inside NSArray -

is there quick way of mutating nsarray of nsdictionaries? have big nsarray , want update value particular key inside nsdictionary. there quick way of mutating inner dictionaries update them. assuming original array contains immutable dictionaries 1 way create new array mutable copies of of original dictionaries. nsmutablearray *newarray = [nsmutablearray arraywithcapacity:oldarray.count]; (nsdictionary *dict in oldarray) { [newarray addobject:[dict mutablecopy]]; } now of work on newarray .

ios - How do I make this little twitching go away? -

Image
so have update method in spritekit game project , in according leaders following direction position of other following characters decided: -(void) update { if (_followingenabled == yes || _isleader == yes) { switch (currentdirection) { case up: self.position = cgpointmake(self.position.x, self.position.y + speed); // making line of characters if (self.position.x < _idealx && _isleader == no) { self.position = cgpointmake(self.position.x + 1, self.position.y); } else if (self.position.x > _idealx && _isleader == no) { self.position = cgpointmake(self.position.x - 1, self.position.y); } break; case down: self.position = cgpointmake(self.position.x, self.position.y - speed); // making line of characters if (self.position.x < _idealx && _isleader == no) { self.position = cgpointmake(self.position.x + 1, self.position.y); } else...

javascript - fetch data and show it in textbox with ajax -

Image
as can see current code doesnt work , need guys...i want filter in search(textbox) , show data filtered in there corresponding textboxes...can make code work?? i've been looking in google hours same idea of program works cant find me please. example expected output: html code: <form method="post"> search batchcode: <input type="text" id="query" /><br /> <table> <tr> <td> id: <br /> <input id="result" type="text" name="id1" /> <br /> <input id="result" type="text" name="id2" /> <br /> </td> <td> name: <br /> <input id="result" type="text" name="name1" /> <br /> <input id="result" type="text" name="name2" /> <br /> </td> <td> score 1: <br /> <input id="result" type="text" name=...

javascript - How can I mark a parameter as containing a DOM node in JSDoc? -

i want indicate parameter should dom node, can't seem find information how indicate jsdoc. use {object} , rather ugly. rather have {node} or {domnode} , can't find examples point me in direction. so, how mark parameter expecting dom node? from usejsdoc.org @type annotation: a type expression can include jsdoc namepath symbol (for example, mynamespace.myclass); built-in javascript type (for example, string); or combination of these. can use google closure compiler type expression, several other formats specific jsdoc. [...] each type specified providing type expression, using 1 of formats described below. appropriate, jsdoc automatically create links documentation other symbols. example, @type {myclass} link myclass documentation if symbol has been documented. so can link symbols. htmlelement (and inheriting objects htmlimageelement ) symbols. therefore, if follow spec, should allowed do: @type {htmlelement} to indicate type of htmlelem...

html - How to add PHP variables to a href url -

im trying add php variable href url this code: php $uid= $_session['userid']; html <a href=http://example.com/uid= <?php echo ".$uid."?> /a> how add, when it, redirect too: http://example.com/uid= . try this, <?php @session_start(); $uid= $_session['userid']; ?> <a href="http://example.com/?uid=<?php echo $uid; ?>" >your link text</a>

javascript - CSS/Jquery Fade in background -

just wondering best way approach this. have nav menu white. when page scrolls down becomes sticky. when becomes sticky want background color fade white (let's say) blue. i'm using jquery plugin "waypoints" , thought use toggle this, can't figure out want fade background not entire div (as cause menu titles fade) any ideas? here js $('#megamenu-sticky-wrapper #megamenu.ubermenu-sticky').waypoint(function() { $('#megamenu-sticky-wrapper #megamenu.ubermenu-sticky').toggleclass( 'animate' ); ----what js when #megamenu-sticky-wrapper #megamenu.ubermenu-sticky reaches top of screen (becomes "sticky") toggle class .animate (this css go blue background, , animation stuff) i've used animate keyframes. ex. specify keyframes , in class .animate include keyframe animation animate whenver part of page. let me know if more info needed. just looking guidance or direction how can target background fade in thanks! ...

swing - Show a message in a message window in Java -

i want show message window displaying string value, don't know how write it. have code: for (bufferedimage bimage : lineimage1) { int trafficsection[] = analysis.colorshare(screencapturing.getmaptrafficonly(), bimage); string trafficstring = trafficsection[0] + " - " + trafficsection[1] + " - " + trafficsection[2] + " - " + trafficsection[3]; joptionpane.showmessagedialog(this, trafficstring, joptionpane.information_message); } but doesn't work. can me please how write code message window? thanks here error: java: no suitable method found showmessagedialog(<anonymous cege.controller.screencapturecontroller.screencapturelistener>,java.lang.string,java.lang.string,int) method javax.swing.joptionpane.showmessagedialog(java.awt.component,java.lang.object,java.lang.string,int,javax.swing.icon) not applicable (actual , formal argument lists differ in length) method javax.swing.joptionpane.showmessagedialog(j...

php - While loop doesn't outputs correct result -

i've been working on application has table named funds , funds table maintains incoming , outgoing of funds user account. here's database design :- name type default null recordid int auto_increment no parentemail varchar(255) no funds int no is_locked varchar yes no ok, suppose there 4 entries in table, 2 of them having status yes , 2 of them having no status, i'm using query sum , locked status table. select sum(funds) funds,is_locked status funds parentemail = '" . $email . "' group is_locked and i'm using code put value of locked funds (funds status (is_locked) yes) , unlocked funds (funds status (is_locked) set no) different variables; $query3="select sum(funds) funds,is_locked status funds parentemail = '" . $email . "' group is_locked"; $...