Posts

Showing posts from January, 2015

jquery - How to check status of Django generated multiple checkbox? -

i know how use jquery save names of selected options django based multiple checkbox? seems not able select group of checkbox... can give me suggestions on code? thanks! jsfiddle example html code <table class="tab_model"> <tbody> <tr> <th> <label for="id_model_0">model:</label> </th> <td> <ul> <li> <label for="id_model_0"> <input type="checkbox" name="model" value="a" id="id_model_0">model a</label> </li> <li> <label for="id_model_1"> <input type="checkbox" name="model" value="b" id="id_model_1">model b</label> ...

delphi - Update existing Google calendar entry using TMS Cloud component -

i use following code add new entry google calendar using tms cloud component have new entries in table in database , added ok able update entry also, cant find about. demo supplied controls has option, don't want load entries calendar , select 1 edit there. want save sort of entryid given , use update. devexpress has option lets sync table , outlook calendar (works nice) think should possible tms the question is: how id of calendar entry when creating can store record in table , use afterwards updating? var ci: tgcalendaritem; begin advgcalendar.app.key := settings.google.key; advgcalendar.app.secret := settings.google.secret; advgcalendar.logging := true; if not advgcalendar.testtokens advgcalendar.refreshaccess; if not advgcalendar.testtokens advgcalendar.doauth else connected := true; ci := advgcalendar.items.add; advgcalendar.getcalendars(); ci.calendarid := settings.google.calendar; ...

android send intent to specific contact (whatsapp, sms, hike, etc.) -

i have implemented app in can pick contact , list custom information contact in tablelayout. in each row of tablelayout have column (button) should send message specific user using sms, whatapp, hike, etc. on click event, action_send intent should open instead having pick contact want put contact or contact id not have choose contact list in whatsapp/sms/hike intent. possible or have implement send picker on own , start specific intent each app? cheers magnus you have implement send action different messaging apps hike whatsapp hike etc. can't tell these apps send message specific contact database protected. reason you never know contact has id in these apps may "foo" can else in whatsapp database. so have put data , package name. hike - com.bsb.hike whatsapp - com.whatsapp intent i=new intent(); i.setpackagename(""); startactivity(i); hope helps.

tsql - How can I convert this INT field to a usable date field? -

the db working in stores date values int . needing determine date difference between 2 date fields unsure how approach since int . dates stored follows: 20130101 - yyyyddmm . performing datediff results in arithmetic overflow error. any ideas on how either convert 2 date fields or find date difference between them? select cast( cast( 20130101 varchar(8) ) datetime ) so, if have following 2 values: 20130101 , 20130201 , might following: select datediff( d , cast( cast( 20130101 varchar(8) ) datetime ) , cast( cast( 20130201 varchar(8) ) datetime ) ) update if have values less 17530101 (the min value datetime), need use case expression validate data processed. in scenario, use of cast(0 datetime) result in 1900-01-01 our minimum date value. select datediff( d , case when value1 <= 19000101 cast(0 datetime) else cast( cast( value1 varchar(8) ) datetime ) end , case when value2 <= 19000101 cast(0 date...

hash - Are there any SHA-256 javascript implementations that are generally considered trustworthy? -

i writing login forum, , need hash password client side in javascript before sending on server. i'm having trouble figuring out sha-256 implementation can trust. expecting there kind of authoritative script used, i'm finding loads of different projects own implementations. i realize using other people's crypto leap of faith unless you're qualified review yourself, , there no universal definition of "trustworthy", seems common , important enough there ought kind of consensus on use. naive? edit since comes lot in comments: yes, more stringent hash again on server side. client side hashing not final result save in database. client side hashing because human client requests it. have not given specific reason why, overkill. the stanford js crypto library contains implementation of sha-256. while crypto in js isn't well-vetted endeavor other implementation platforms, 1 @ least partially developed by, , extent sponsored by, dan boneh , well-est...

ruby on rails - Active admin - checkbox doesn't make batch action enabled -

i install gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4' and works fine but.. when click on checkbox resources, batch action doesn't change enabled. have: index |description| selectable_column column :id column :user column :description default_actions end batch_action :destroy, :confirm => "delete ??", :plural_model => "descriptions" |selection| profile.find(selection).each { |d| d.reset_description! } redirect_to collection_path end and batch action :destroy. active admin works correct in rails 4? had same problem, first comment of op solved me: add //= require active_admin/base to active_admin.js

javascript - remove an .append() to return an element to it's original state -

i'm loading ul image slider need remove images ( ul ) , revert original state (before javascript manipulations) when slider closed because later need reload ul set of different images. here how i'm loading slider. var get_images = [ "show_1.jpg", "show_2.jpg", "show_3.jpg", "show_4.jpg"]; $.each(get_images, function(i,img){ $('#container ul').append('<li><a href="#" class="thumbnail"><img src="'+img+'"/></a></li>'); }); i think might looking for: var get_images = ["show_1.jpg", "show_2.jpg", "show_3.jpg", "show_4.jpg"]; var original = $('#container ul').html(); $.each(get_images, function (i, img) { $('#container ul').append('<li><a href="#" class="thumbnail"><img src="' + img + '"/></a></li>'); })...

c# - Windows Phone ListPicker selectedItem without databinding -

i have listpicker in windows phone 8 app, , wondering i'm doing wrong collect selected item in c#. here's xaml listpicker. <toolkit:listpicker x:name="brewmethodlist" horizontalalignment="left" margin="-2,24,0,0" verticalalignment="top" height="127" width="164" borderbrush="#ff162e3e" foreground="black" selectionchanged="brewmethodselectionchange" lostfocus="quantityinputlostfocus" background="#ff5c97bf" > <toolkit:listpickeritem x:name="manual_list" content="manual" background="#ff5c97bf"/> <toolkit:listpickeritem x:name="autodrip_list" content="auto drip" background="#ff5c97bf"/> </toolkit:listpicker> here's c# trying access selected item. private void brewmethodselectionchange(object sender, selectionchangedeventargs e) { if (brewmethodlist.selecteditem...

Create html tags using JQuery -

i need create option tags inside select tag using jquery, this select tag: <select id="tickets-room" style="height: 20px; width:200px; display: inline-block; margin-top:30px;" onchange="refreshrooms(this.value);"> </select> each option tag need id 1,2,3,4 each option tag should recieve "resp[].key" text. i don't know if makes sense, don't know how explain well, code have of elements need. resp.key name need text inside option tags, resp.value url need place on button outside select tag. function refreshrooms(city){ $.ajax('/services/tickets/<%= movieid %>?city=' + city).done( function(resp){ alert(resp.length); console.log(resp[0].key + " " + resp[0].value); } ); } use jquery.append() : function refreshrooms(city){ $.ajax('/services/tickets/<%= movieid %>?city=' + city).done( function(resp){ ...

c - Arbitrary code execution using existing code only -

let's want execute arbitrary mov instruction. can write following function (using gcc inline assembly): void mov_value_to_eax() { asm volatile("movl %0, %%eax"::"m"(function_parameter):"%eax"); // move value of variable function_parameter register eax } and can make functions 1 work on every possible register. mean - void movl_value_to_ebx() { asm volatile("movl %0, %%ebx"::"m"(function_parameter):"%ebx"); } void movl_value_to_ecx() { asm volatile("movl %0, %%ecx"::"m"(function_parameter):"%ecx"); } ... in similar way can write functions move memory in arbitrary addresses specific registers, , specific registers arbitrary addresses in memory. ( mov eax, [memory_address] , mov [memory_address] ,eax) now, can perform these basic instructions whenever want, can create other instructions. example, move register register: function_parameter = 0x028fc; mov_eax_to_memory(); ...

javascript - How to let <a href..> not refresh the page -

i have div, in link href tag: <a href="banana.html"><div id="somediv">some div</div></a> when click on div, entire page unloads , reloads banana.html. however, i'm using websocket , need part of page reload, there way change window url without refreshing page? thanks! probably want use ajax this, jquery has cool function pretty versatile: http://api.jquery.com/load/

How to get Chrome to allow mixed content? -

chrome browser default blocking mixed content. how adjust settings/configuration allow mixed content without making adjustments on ui every time? i have found 2 solutions neither of them work. 1) several articles can adjust under security section of "under hood" in options. option no longer seems exist. there no under hood tab , there no such dropdown adjust how chrome handles mixed content far can tell. 2) option add --allow-running-insecure-content flag command line. did so: "c:\program files\google\chrome\application\chrome.exe" --allow-running-insecure-content made no difference. if tried adding flag inside double quotes, windows complains saying invalid. so option have latest version of chrome? timmmy_42 answers on: https://productforums.google.com/forum/#!topic/chrome/orwppkwbknc in address bar @ right end should 'shield' icon, can click on run insecure content. this worked me in chromium-dev version 36.0.1933.0 (262849...

gmail - Google OAuth 2.0 Service Account vs Administrator Account -

this question specific google business/education accounts. couldn't find documentation on this. have server application needs access google mail inbox , check read/delete status of messages based on filters. need without requesting user authorization or involvement of user. should use administrator account or service account , what's difference between 2? there limitations on how many mailboxes can accessed , how can accessed administrator account or service account? eg: if need check 5000 mailboxes based on filter, how can using admin account or service account. you need use service account. admins have rights manage google apps authenticating gmail imap admin give access admin user's mailbox. there no limitations aware of in terms of number of mailboxes can accessed aware of gmail bandwidth limitations may come play depending on workload. these limits per-user, not per service account.

filtering - filter rows with dropdown using jQuery -

i'm having heck of time getting work. should simple, every route i've tried has not worked. here's jquery i'm using now: <script type="text/javascript"> $(document).ready(function () { //filter list year $(function () { $("#ddyear").change(function (evt) { var year = $("#ddyear").val(); $('tr').show(); $("td[id^='accessrequestid']").each(function () { alert("checking " + this.val); if ($(this).attr("class") == ".ar_" + year) { alert("hiding " + this.val); $(this).parent().hide(); } }); }); }); }); </script> and here's table i'm trying filter: <div class="index-header">select year view: <%:html.dropd...

javascript - Re-rendering Reloading Partial in Rails -

i have list of links posts on page. when clicked, link triggers lightbox partial showing post. my problem: 1.) user interacts lightbox , changes information post (favoriting, unfavoriting). 2.) user closes lightbox 3.) user reopens lightbox clicking on link again. lightbox information not updated changes user made. 4.) if user refreshes whole page ctrl+r , clicks on lightbox, lightbox reflect new changes. lightbox using fancybox. link lightbox <a class="fancyboxentry" rel="entries" href="#entryshow<%= thispost.id%>" onclick ="renderentry<%=thispost.id%>()"> <%= image_tag(thispost.content_2)%> </a> dummy div hold loaded partial. <div id="entryshow<%= thispost.id %>"> </div> renderentry function: <script> function renderentry<%= thispost.id%>() { $('#entryshow<%= thispost.id%>').html("<%=escape_ja...

How do I access values in a Perl Hash of Array of Arrays? -

i have built hash containing arrays of arrays, let's call %hash_multidim, such output data::dumper looks so: 'key1' => [ [ '-3.81', '-1.91', '-1.86', '-1.70' ], [ '1.35', '1.04', '-1.01', '-2.69' ] ], 'key2' => [ [ '-1.63' ], [ '-1.17' ] ], now, access , perform manipulations on bottom-most level in structure. example, 'key1' want find mean of in row 1 (aka mean of array @ [0]). using list::util qw(sum), have written subroutine called mean: sub mean { ...

c# - Deserializing an xml element in WCF with XML Declaration -

i have little wcf service has following signature: string processmessage(xmlelement xmlsource); when request without xml declaration, webservice works fine, xml declaration added, crash. the request works <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"> <soapenv:header/> <soapenv:body> <tem:processmessage> <tem:xmlsource> <clipped>elements here</clipped> </tem:xmlsource> </tem:processmessage> </soapenv:body> </soapenv:envelope> the request doesn't work <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"> <soapenv:header/> <soapenv:body> <tem:processmessage> <tem:xmlsource> <?xml version="1.0...

javascript - length of textbox contents returning only 1 when it should be more -

i have textbox check in jquery see if length less 11 chars long. in testing, 've entered ten chars length method returns one. this text box: <input type="text" id="txtmytext" name="mytext" value="testing" onblur = "chkinput()"/> my function chkinput called when exit box wasn't working expected. inserted alert length attribute: alert("text " + $("#txtmytext").length); the alert shows length = 1. you want length of text of textarea element : alert('text ' + $('#txtmytext').val().length);

Scala companion object with abstract class -

i'm reading book programming in scala (second edition) martin odersky , have problem examples in chapter 10. this file @ end of chapter: class element object element { private class arrayelement( val contents: array[string] ) extends element private class lineelement(s: string) extends arrayelement(array(s)) { override def width = s.length override def height = 1 } private class uniformelement( ch: char, override val width: int, override val height: int ) extends element { private val line = ch.tostring * width def contents = array.fill(height)(line) } def elem(contents: array[string]): element = new arrayelement(contents) def elem(chr: char, width: int, height: int): element = new uniformelement(chr, width, height) def elem(line: string): element = new lineelement(line) } abstract class element { def contents: array[string] def width: int = if (height == 0) 0 else contents(0).length def...

objective c - Unable to link a static C library in an Obj-C project (Xcode 4.6.3) -

i'm trying build basic ftp client using libftp. i've compiled , archived libftp.a , placed in /usr/local/lib . necessary headers i've placed in /usr/local/include/ftp . under build settings, i've set "header search paths" /usr/local/include , , i've set "library search paths" /usr/local/lib . "other linker flags", i've added -lftp . here shell of c++ class: connector.h: #include <stdlib.h> #include <ftp/ftp.h> #include <stdio.h> class connector{ private: ftpconnection *connection; public: connector(); ~connector(); bool connect(const char *hostname, const char *port); }; connector.cc: #include "connector.h" connector::connector(){ } connector::~connector(){ } bool connector::connect(const char *hostname, const char *port){ ftpgetaddresses(hostname, port); printf("connected!\n"); return true; } upon compil...

cassandra - What is the timestamp format of deletedAt entry when using sstable2json utility? -

i running sstable2json export existing cassandra cluster. encounter values such in created json object: 'deletedat': -9223372036854776000l, is flag cassandra sets mark entry deleted, or actual timestamp? if so, format of timestamp? thanks. long.min_value means "not deleted."

ubuntu - Can a server run Nginx for some sites and Apache Nginx Reverse Proxy for others? -

on server ideally i'd serve own static , wordpress sites using cloudflare > varnish > nginx since i'd hosting others sites testing such joomla , wordpress rely on multiple extensions use .htaccess , such, wouldn't able run sites through nginx. i'd run sites on same server cloudflare > varnish > nginx reverse proxy > apache. the server has 1 ip address , runs ubuntu , php-fpm , mysql. each site have own separate domain name. possible? server { server_name example.com; location / { # assuming apache on port 81 example proxy_pass http://127.0.0.1:81; # make apache detect host header proxy_set_header host $host; } # if have assets folders, can let nginx serve them directly, # instead of passing them apache location /images { # or /css or /js .. etc try_files $uri =404; } } note: in case of assets, sites serve assets through rewrites, or handled application self, can pass apache add...

javascript - How to set y-axis to fixed range in rickshaw? -

i have data of values in range 41-44, there peaks 150-350, y-axis automatically scaled 0-350 , chart unreadable. how set fixed min , max y-axis? know values "above" chart, not problem. here chart edit: alternatively want enable zooming in graph better, idea how this? edit2: or maybe can suggest other simple charting library enabling/disabling lines, zooming & panning? i have stumbled upon question multiple times looking solution, rickshaw supports setting min , max in graph constructor: https://github.com/shutterstock/rickshaw#rickshawgraph

jquery - Dismissing alerts created using an event of twitter bootstrap -

i trying learn jquery , twitter bootstrap. have 2 kinds of alerts: alert upon page load alert based on action (button click) in simple example. pressing 'x' on alert created page load clears it. same not happen 1 loaded button. missing in script? <div class="container"> <div class="row"> <div class="span12"> <div id="alert-section" class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">&times;</button> <h4>page load alert!</h4> alert displayed when page loads. </div> <button type="button" id="btn-alert" href="#">open alert</button> <div id="le-alert"></div> </div> </div> </div> $('#btn-al...

DynamoDB PHP getItem() - How to tell if item does not exist -

i writing "get or create" method attempts item, if doesn't exist, create fresh new version of it. obviously, want know item didn't exist when attempted it, never overwrites existing data. am correct in assuming $result["item"] === null if , if item did not exist in database @ time of request? is, if item existed prior request, condition evaluate false, regardless of api errors, etc.? or there else should check instead? $result = $this->client->getitem( array( "tablename" => $tablename, "key" => array( $keyname => array(type::string => $key), ) ) ); if ( $result["item"] === null ) { //item not exist; create , write dynamodb (code not shown) } return $result["item"]; i add 'consistentread' => true in order make sure read getting absolute, up-to-date data. you still going...

linux - What does an asterisk at the end of a mv command do -

so going along , moving bunch of files mv /source /dest & mv /source/* /dest/dest/ & ... ... then careless and mv /source/filena* /dest/dest/ * omg! ^c^c^c^c [no response terminal command] going on here? what happens when put * (asterisk) @ end of command instead of & (ampersand)? the shell expands wildcard * . mv command never sees wildcard, result of expansion. the wildcard * expands list of files in current directory in lexicographic order. if last file directory, preceding files ( /source.filenafoo , /source/filenabar , /dest/dest , hello ) moved subdirectory. if last file not directory, mv complains “target a.png not directory” (or words effect). see what mv ./* without specifying destination do? more detailed examples.

php - Insert multiple rows from array saved in a session into table? -

i'm passing multiple state values stored in session variable, mysql table via php using 1 insert command , i'm wondering if possible insert each state value different row. have id saved in variable insert each state. $campaign_id each state stored in session variable. print_r($_session['stateslist']); assuming have 2 states saved in $_session['stateslist'] (ny, ca) , campaign id 5, database this campaign_id state 5 ny 5 ca i know similar insert multiple rows via php array mysql having problems inserting each state saved in session campaign_id. here adopted version of want answer $tags = explode(',', $_session['stateslist']); $sql = array(); $counter=0; foreach( $tags $row ) { $counter++; $sql[] = '("'.$row.'", '.$campaign[counter].')'; assuming here have campaign array contains corresponding campaign ids } mysql_query('insert table (s...

c++ - Link mono in XCode -

i trying embed mono runtime in c++ os x console app (will used scripting logic in home-brew game engine, unity3d). using xcode ide , failing spectacularly @ linking mono libraries. come dark side (windows) , new mac libraries , xcode. i have built mono , referenced header folder slew of apple-moch-o linkers errors no matter .a add project. have built sample project https://github.com/inkdev/embedded-mono-sample windows. mono site on topic http://www.mono-project.com/embedding_mono confusing , of little use me. help hugely appreciated. edit: if remember correctly, followed these commands http://www.mono-project.com/compiling_mono_on_osx , got source here: https://github.com/mono/mono/tree/master/mono , , used make , make install. added /mono/include... folder xcode's "header search path" , resolved unfound includes. under /mono/lib/ have tried several different *.dynlib files ( drag them xcode ) none have worked. libmono-2.0.1.dylib says "..file built uns...

c - where to find select() source code in glibc source? -

i trying find select() source code (linux, i386 arch) in glibc source code, cannot find (related said architecture) could point me select() source code ? select() not function of libc, kernel function, need take kernel source. you can tell looking man page: if in section 2, it's kernel function, if it's in section 3, it's function of standard c library, in case glibc. edit: other people remarked correctly (thank you!), function described in section 2 officially called system call , call library wraps operating system's actual call interface.

Could one write an Android app in pure Go using no Java or XML? -

could write android app in 100% go or have use java , xml too? from go blog when go first-class language android development? andrew: great, don't have announce. if looking further, there explanation on quora

javascript - d3.scale.linear() not working -

i using d3.scale.linear() scale input domain output range. looked @ documentation http://alignedleft.com/tutorials/d3/scales and have far //here declaring domain , range passing max, min parameters var rscale = d3.scale.linear() .domain('min', 'max') .range('10', '250'); i pre calculating max , min , storing them in variables , passing variables parameters domain , range then passing rscale parameter attribute circle .attr('r',rscale) cant seem figure out doing wrong here fiddle http://jsfiddle.net/sghoush1/vn7mf/19/ 1) pass in domain , range scale, use array: var rscale = d3.scale.linear() .domain([min, max]) .range([10, 250]); 2) use scale: .attr("r", function(d) { return rscale(d.consumption_gj_);})

python - BeautifulSoup doesnt return all HTML -

so im trying extract value of line of html looks this: <input type="hidden" name="_ref_ck" value="41d875b47692bb0211ada153004a663f"> and value im doing: self.ref = soup.find("input",{"name":"_ref_ck"}).get("value") and working fine me gave friend of mine program beta , getting error this: traceback (most recent call last): file "c:\users\daniel\appdata\local\temp\rar$di85.192\invent manager.py", line 262, in onok self.main = gui(none, -1, 'inventory manager') file "c:\users\daniel\appdata\local\temp\rar$di85.192\invent manager.py", line 284, in __init__ self.inv.login(log.user) file "c:\users\daniel\appdata\local\temp\rar$di85.192\invent manager.py", line 34, in login self.get_ref_ck() file "c:\users\daniel\appdata\local\temp\rar$di85.192\invent manager.py", line 43, in get_ref_ck self.ref = soup.find('input',{'nam...

vb.net - Count in execquery for wql query -

i trying connect lenel , using wql fetch result. wql when runned in wmi explorer returns record. set objservices = getobject("winmgmts://./root/onguard") set cardset = objservices.execquery("select * lnl_badge id =11111") if not cardset nothing response.write("<br/>cardset has something") vcontinue = true else response.write("<br/>cardset set nothing") exit function end if response.write("<br/>count ") count = cardset.count response.write(count) the problem value of count coming nothing , program exit current function. idea wrong. "cardset has something" displayed though. edit: for checking syntax did following cim2v set objwmiservice = getobject("winmgmts:") set colitems = objwmiservice.execquery("select * win32_process") response.write(colitems.count) each colitem in colitems if not colitem nothing response.write("<br/>") response.write(colitem.proce...

android - Set listener on every word of sentence and add in layout dynamically -

i want set sentence in view, want set listener on every word of sentence , sentence added in view run time. add text views in horizontal linear layout how can if line ends add text views on new line or suggest other solution problem. you need textview.getoffsetforposition

flask - SQLALchemy filter_by() on a foreign key producting weird sql -

i'm attempting filter on foreign key , none of answers i've searched have lent results. where query statements. testing = comments\ .filter(comments.post_id==post_id) print(testing) testing = comments\ .query.join(post, aliased=true)\ .filter(comments.post_id==post_id) print(testing) here's class definitions looks like class comments(db.model): comment_id = db.column(db.integer, primary_key=true) post_id = db.column( db.integer, db.foreignkey("post.post_id"), nullable=false) class post(db.model): post_id = db.column(db.integer, primary_key=true) comments = db.relationship( 'comments', backref='post', lazy='dynamic') the actual sql queries being produced first , second case. both have weird :post_id_1 thing. in both cases i'm getting null set back. from "comments" "comments".post_id = :post_id_1 "comments"...

c# - Finger Print recognition system -

i m using vs2008 , sourceafis 1.1 m unable access of methods may me getting started they(sourceafis) gave following sample program.cs want develope application firstly enrolls users , identify them if enrolled user or not. namespace sample { public class program { // inherit fingerprint in order add filename field [serializable] class myfingerprint : fingerprint { public string filename; } // inherit person in order add name field [serializable] class myperson : person { public string name; } // initialize path images static readonly string imagepath = path.combine(path.combine("..", ".."), "images"); // shared afisengine instance (cannot shared between different threads though) static afisengine afis; // take fingerprint image file , create person object image static myperson enroll(stri...

iphone - Manually passing touches Began to a newly created instance -

i want object created when touch uiview. want new object able moved without finger having raised. tried passing touched event new object doesn't work. is there way it? you'll have derive subclass of uiview, serve holderview newly generated views. also, once new view generated, new view move along finger if not raised. following code it, tweak later per needs: @interface holderview : uiview @property(nonatomic,retain)uiview *newview; @end @implementation holderview - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // initialization code } return self; } -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; cgpoint touchpoint = [touch locationinview:self]; if (cgrectcontainspoint(self.bounds, touchpoint)) { cgrect r = cgrectmake(touchpoint.x-50, touchpoint.y-50, 100, 100); self.newview = [[[uiview alloc] initwithframe...

ajax - pop up window not closing -

i have popup window should close during submit.but not closing data adding in grid. script used $(document).ready(function(){ $("#dialog-form").dialog({ autoopen : false, height : 400, width : 700, modal : true, title: "currency details", close : function() { $(this).dialog("close"); } }); }); and ajaxsubmit function savecurrencyajax() { var str = $("#enumcurrency").serialize(); $.ajax({ type : "post", url : "../currency/saveenumcurrency.action", data : str, success : function(response) { $('#dialog-form').dialog('close'); }, error : function(e) { alert('error: ' + e); } }); }; this controller @requestmapping( value="/currency/saveenumcurrency.action", method=...

Aptana PHP Code Formatter - Doesn't work? -

aptana's code formatter straight-forward. not seem work? in cases formats nicely, in others, sticks code flat against left. i paste examples, overall horrible. is known fact or there exist upgrades of sort needed php formatting? well change ide, have never used aptana cant vouch it. netbeans feature rich if dont mind wasting few cpu cycles. otherwise there fabled text editors notepad++ (use under wine nix) or gedit nix or vim. i think there better ide's aptana. sorry couldn't muck more that. good luck

Proxy authentication error - python -

hi have written few simple lines of code. seem getting authentication error. can please suggest , credentials being looked python here ? code: import urllib2 response = urllib2.urlopen('http://google.com') html = response.read() error urllib2.httperror: http error 407: proxy authentication required ps: not have acces ie -->advanced settings or regedit as advised i've modified code : import urllib2 proxy_support = urllib2.proxyhandler({'http':r'http://usename:psw@ip:port'}) auth = urllib2.httpbasicauthhandler() opener = urllib2.build_opener(proxy_support, auth, urllib2.httphandler) urllib2.install_opener(opener) response = urllib2.urlopen('http://google.com') html = response.read() also have created 2 environment variables : http_proxy = http://username:password@proxyserver.domain.com https_proxy = https://username:password@proxyserver.domain.com but still getting error . urllib2.httperror: http error 407: proxy authentica...

php: about parsing and interpreting process -

i see parse or compile in tech articles. want know how php works . found out php interpreted language, not compiled. googled online parse , interpret , compile , still not clear on whole process. below example php code: <?php $str1="hello world!"; $str2="what nice day!"; echo $str1 . " " . $str2; ?> output: hello world! nice day! can explain whole process(parse, interpret...) source code output? thanks a high level , not complete overview of process: the source code tokenized , i.e. broken down individual parts , these parts "classified". $str1 variable, = operator, "hello world!" string literal, ; statement terminator etc. the tokens transformed abstract syntax tree , i.e. tokens "grouped meaning". we have expression = assignment operator first operand $str1 , second operand string literal "hello world!" . these 2 steps complete parsing . the individual parts in syn...

How to set the foreign key in sql server -

the query create primary key table is create table users ( id int identity (3000, 1), userid '08u1'+right('0000'+cast(id varchar(5)), 5) persisted, username varchar(50), lastname varchar(50), location varchar(50), constraint pk_users primary key (userid) ) and reference table is create table addre ( ids int, address varchar(50), ) i want userid primary key in users table reference table addre column ids foreign key how set that. know same data type used set foreign key. here how set data type ids... change userid this userid cast('08u1'+right('0000'+cast(id varchar(5)), 5) char(9)) persisted so char(9) datatype needed whichever way around want

actionscript 3 - What are the "Seams" in AS3? -

i'm reading "working legacy code", , thinking "fancy" seams discusses in chapter 4. since actionscript 3 doesn't have method overloading, wondering can used seam in as3 besides import statements , making subclasses? for clarity, seam defined : seam: seam place can alter behavior in program without editing in place. thanks.

ruby on rails - Devise path conflict with CMS path -

am creating rails app comfortable mexican sofa , devise gem, in devise path http://localhost:3000/users/sign_up it searching in cms_pages tables, how solve this? in routes.rb file, used comfortablemexicansofa::routing.admin(:path => '/cms-admin') comfortablemexicansofa::routing.content(:path => '/', :sitemap => false thanks in advance. make sure comfortablemexicansofa::routing.content defined last. has globbing route clobbers defined after it.

jquery - Buttons on bottom of a page when clicked, entire page is scrolling to top and then moving to next page -

i have following scenario mobile development using html5 (using html5 , jquerymobile) how restrict page scrolling top before navigates next screen? i have page1 , there button on bottom of page (it needs scrolled-down bottom find button). button, when clicked should navigate page- page2 . being on bottom of page, when click on button - page1 first going top , navigating page2 . there way restrict process? - navigation should happen page1 page2 directly bottom of page1 here's code follow -- <div data-role="page" data-theme="b" id="shopsmenupage"> <div data-role="content" > <h3>shops &amp; hangouts</h3> <ul data-role="listview" data-inset="true" data-theme="c" > <li id="restaurantslist" data-icon="info"><a href="#foodnbeverages" data-transition="slide"><img src="images/foodnbeverages.p...

sql - Is there a way to tuneup a complex count query against heavy data? -

Image
there 2 tables 1 empl having 545405 records , second pam having 1466320 records. task find count of pid according aid . acomplish task write following query. select pa.aid, count(pa.pid) empl join pam pa on empl.pid = pa.pid group pa.aid the indexes pam following: ix_pam_unique nonclustered, unique, unique key located on primary pid, aid ix_pam_aid nonclustered located on primary aid pk_paid clustered, unique, primary key located on primary paid the actual execution plan shows index scan: what can understand there estimated data size of 15 mb causing problem. is there way tuneup complex count query against heavy data? edit: the query empl filters: select pa.aid, count(pa.pid) empl join pam pa on empl.pid = pa.pid empl.del = 0 , empl.pub = 1 , empl.sid = 2 , empl.md = 0 group pa.aid and there nothing fancy in structures, basic datatypes int, bit, varchar , datatime used. there 65 columns...

c - Strange array initialize expression? -

what meaning of following code? code regression test suite of gcc. static char * name[] = { [0x80000000] = "bar" }; in c99 can specify array indices assigned value, example: static char * name[] = { [3] = "bar" }; is same as: static char * name[] = { null, null, null, "bar"}; the size of array four. check example code working @ ideaone . in code array size 0x80000001 (its hexadecimal number). note: uninitialized elements initialized 0 . 5.20 designated initializers : in iso c99 can give elements in order, specifying array indices or structure field names apply to, , gnu c allows extension in c89 mode well. extension not implemented in gnu c++. specify array index, write [index] = before element value. example, int a[6] = { [4] = 29, [2] = 15 }; is equivalent to int a[6] = { 0, 0, 15, 0, 29, 0 }; one more interesting declaration possible in gnu extension: an alternative syntax has be...

Running the development web server google app engine for php -

where can write following command following developer tutorial simple hello world script here google_appengine/dev_appserver.py --php_executable_path=pathto-php-cgi path-to-your-app when run application in google app launcher error message . have wamp install , running fine. the path specified --php_exectuable_path flag () not exist. php path - c:\php\php-cgi.exe i met problem, , has been solved. example, if php folder e:/sam/php/ if php site folder f:/mysite/facebook/ if dev_appserver.py under e:/whatever/ i'm not sure how change googleapplauncher.exe configurations, instead, have use cmd instead. think exe has config files did not find it. open command window , go folder e:/whatever/ run "python" command under folder. type in: python dev_appserver.py --php_executable_path=e:/sam/php/php-cgi.exe f:/mysite/facebook/ note: remember type "php-cgi.exe" use slash

xslt - Add additional xmlns:xsi attributes to XML element -

i have following xml defined: <?xml version="1.0" encoding="utf-8"?> <ns0:container xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:ns0="ns0.com" xsi:schemalocation="ns0.com ns0.xsd"> <ns1:elementa xmlns:ns1="ns1.com" xsi:schemalocation="ns1.com ns1.xsd"/> <ns2:elementb xmlns:ns2="ns2.com" xsi:schemalocation="ns2.com ns2.xsd"/> </ns0:container> the problem consuming application takes elements inside of container (unfortunately string cutting of container), , definition of namespace xsi missing. i add xmlns:xsi="http://www.w3.org/2001/xmlschema-instance to each sub element of container too - reduntant specification, should not cause problems. so result get: <?xml version="1.0" encoding="utf-8"?> <ns0:container xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:ns0="container.com...

stylecop - In Visual Studio 2012 - Keyboard suddenly stops working properly -

as stated in questions title, have issue vs2012. problem is, suddely keyboard-input in vs isnt executed properly, if @ all. when problem occurrs, able type in cahracters , numbers, neither able delete (backspace or del), nor use arrow key jump down line or next/previos caracter. overwriting text has been marked mouse working. i have found similar question hints stated there doesn't work here. are: hitting alt+enter closing , reopening editor windows closing toolboxwindow restarting vs pressing scolllock the problem seems related stylecop-addin. after deinstalling it, issue doesn't come anymore. there known workaround? in advance! apparently stylecop can used out resharper, didn't know. sorry. however, if @ documentation stylecop, if right click on project, click source analysis settings, presented dialog turn on or off of stylecops rules. here link actual documentation has images helps describe it. stylecop settings

multithreading - Does java.util.concurrent.ConcurrentHashMap.putIfAbsent need to be in a syncronized block? -

i trying track down race condition , signs seem pointing concurrenthashmap.putifabsent() . possible if 2 threads call putifabsent() on empty map same key both lookup see key not exist yet both threads try add it? reason when first started using putifabsent() did not think call need synchronized. can't see how prevent both threads adding values if timing right. have not been able reproduce outside of production. thanks none of operations concurrent collection needs use synchronized. this design , in fact locking collection has no effect on other operations. (unless locked well) in case make them slower. is possible if 2 threads call putifabsent() on empty map same key both lookup see key not exist yet both threads try add it? both can try, 1 succeed. not possible 2 threads appear have succeeded. for reason when first started using putifabsent() did not think call need synchronized. it doesn't. but can't see how prevent both threads ad...

Need to pull the item content from RSS feeds into new file in PERL -

i beginner perl.. item's listed under channel different output file. <rss version="2.0"> <channel> <title>xyz</title> <item> <title>item1</title> </item> <item> <title>item1</title> </item> </channel> <rss> in output file want item content listed within tag. like below : <items> <item> <title>item1</title> </item> <item> <title>item1</title> </item> </items> please or suggest ? i tried match operator well. match item , pull. nothing works.. please help use xml::feed ( docs here ) parse rss , item-elements , whatever want it.

jquery mobile - Show loader on document ready -

how show loader on document ready. code above not anything. $(document).bind("pageinit", function() { $.mobile.loading("show"); }); this might out! js fiddle help javascript code $(document).on('pagebeforeshow', '#index', function(){ }); $(document).on('pagebeforeshow', '#second', function(){ }); html code <!doctype html> <html> <head> <title>jqm complex demo</title> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densitydpi=device-dpi"/> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> <style> .ui-loader-default { opacity: 1 !important; } ...

c# - Windows phone app running out of memory -

currently view binds data in code behind, in order display pic, 2 subheadings, inside listbox. windows phone runs out of memory when load records. have made app load 10 records @ time, when user scrolls down, 10 more load etc. problem phone still runs out of memory when user loads 200 or more records, , there 2600 records. <listbox x:name="geklassifisseerd_list" verticalalignment="top" itemssource="{binding classifiedads}" selectionchanged="geklassifisseerd_list_selectionchanged_1" grid.row="1"> <listbox.itemtemplate> <datatemplate> <stackpanel margin="5"> <image source="{binding imageurl}" height="140" ...