Posts

Showing posts from May, 2013

python 3.x - how to define decryption of caeser cipher -

ok missed class , trying work did in there. 1 of problems fixing caeser cipher. believe have fixed except last part of course part i'm stuck on. have. #change t lowercase in plaintext #add : end of if statement def encrypt(plaintext, alphabet, key): plaintext = plaintext.lower() ciphertext = "" ch in plaintext: idx = alphabet.find(ch) if idx >= 0 , idx <= 25: ciphertext = ciphertext + key[idx] else: ciphertext = ciphertext + ch #add return ciphertext return ciphertext #add def decrypt line def decrypt(ciphertext, alphabet, key): plaintext = "" ch in ciphertext: idx = key.find(ch) #add , idx <= 25 if statement if idx >= 0 , idx <= 25: plaintext = plaintext + alphabet[idx] else: plaintext = plaintext + ch return pl

Ceating a table in UNIX using tbl & troff -

i have create table in troff, have: .ts tab(:); c s s c | c | c l | l | n. custome pc specs = component:selection:price _ cpu:intel core i5-4690k 3.5ghz quad-core processor:$219.99 _ motherboard:msi z97-gaming 5 atx lga1150:$129.88 _ memory:corsair vengeance pro 16gb (2 x 8gb) ddr3-1866 memory:$74.88 _ storage:sandisk x110 128gb 2.5" solid state drive:free \^:western digital 1tb 3.5" 7200rpm internal hard drive:$38.77 _ video card:msi geforce gtx 970 4gd5t oc 4gb gddr5:$289.99 _ case:corsair graphite series 230t orange atx mid tower case:$73.46 _ power supply:corsaircx 750w 80+ bronze certified semi-modular atx:$59.99 _ optical drive:asus drw-24b1st/blk/b/as dvd/cd writer:$12.89 _ operating system: microsoft windows 10 pro oem (64-bit):free _ wan: tp-link tl-wn881nd 802.11b/g/n pci-express wi-fi adapter:$18.89 _ case fan: cooler master sickleflow 69.7 cfm 120mm fan:$9.99 _ monitor:monoprice 12178 144hz 24.0" monitor:$229.99 _ keyboard: corsair vengeance

ios - How to take Core Data and Filter it with NSPredicate Swift -

i learn , creating basic decision app. basics of app take user input category , things want fill category with. now wanting display results on table view works click on each individual category used , able see things placed under ever category. getting being save core data trying use nspredicate filter out need. when run app there nothing in table view. mainname have passed in different view controller capture , set name of category filter data. trying use in predicate filter. i don't know if doing right great. independent study project doing finish degree , know self taught far. if have wrong please tell me. 1 of hundreds of different ways have tried right. @iboutlet weak var tableview: uitableview! func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return whats.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwith

javascript - Understanding Basic Prototyping & Updating Key/Value pairs -

first time poster, long time lurker. i'm trying learn more advanced features of .js, , have 2 ojectives based on pasted code below: i add methods parent class in specific way (by invoking prototype). i intend update declared key/value pairs each time make associated method call. execmtaction seen in thesuper execute each function call, regardless. design. here code: function thesuper(){ this.options = {componenttype: "uitabbar", componentname: "visual browser", componentmethod: "select", componentvalue: null}; execmtaction(this.options.componenttype, this.options.componentname, this.options.componentmethod, this.options.componentvalue); }; thesuper.prototype.tapuitextview = function(val1, val2){ this.options = {componenttype: "uitextview", componentname: val1, componentmethod: "entertext", componentvalue: val2}; }; i execute (very simple): thesuper.executemtaction(); thesuper.tapuitextview("a"

python - Call a function when Flask session expires -

in flask application, saving files correspond user, , want delete these files when user's "session" expires. possible detect session expiration , call function? yeah kind of possible run loop see until session['key']==none , if condition becomes true call function. hope helps!!!

javascript - Updating D3 Axis Labels -

Image
i have 3 radio buttons change value on x-axis d3 line graph. have been able change scales, not x-axis label. everywhere see info tick labels, not axes label (in gif "minute"). i have been able update , re-scale axes code below, cannot figure out how change label. function updategraph(graphdata, timescale){ ydomain = d3.extent(graphdata, function(d){return number(d.amt)}); switch(timescale) { case 'min': xdomain = d3.extent(graphdata, function(d){return number(d.min)}); break; case 'hour': xdomain = d3.extent(graphdata, function(d){return number(d.hour)}); break; case 'day': xdomain = d3.extent(graphdata, function(d){return number(d.day)}); break; default: break; } //make scale graphs dynamic yscale.domain(ydomain); xscale.domain(xdomain); vis = d3.select('#visualisation').transition(); //add

ios - Can a UI class with different Obj-C and Swift names be used in Storyboard? -

i have uibutton swift subclass custombutton , expose prefixed name obj-c. @objc(prefixcustombutton) public class custombutton: uibutton { ... } this class exists in swift module custommodule . integrating module via cocoapods objective-c , swift apps test custombutton . when try use custombutton storyboard, following error: unknown class _ttc9custommodule17custombutton in interface builder file. i have tried using prefixcustombutton in storyboard , same error: unknown class _ttc9custommodule22prefixcustombutton in interface builder file. edit: @matt correct in prefixcustombutton has used in storyboard (for both swift , obj-c projects). additional part missing didn't need set module name. you said yourself: have exposed different name objective-c. class's name prefixcustombutton far interface builder concerned.

corona - Lua countdown timer for months and years -

below example of countdown timer corona sdk written in lua. how add days, months , years this? local function updatetime() -- decrement number of seconds secondsleft = secondsleft - 1 -- time tracked in seconds. need convert minutes , seconds local minutes = math.floor( secondsleft / 60 ) local seconds = secondsleft % 60 -- make string using string format. local timedisplay = string.format( "%02d:%02d", minutes, seconds ) clocktext.text = timedisplay end days (and hours) trivial, months , years? since have no timestamp telling of how many seconds left what, it's hard knowing how many months, depending on length of months (28, 29, 30 or 31 days). same years if consider leap years well. in case, here's might sufficient: local seconds_in_hour = 60 * 60 local seconds_in_day = 24 * seconds_in_hour local seconds_in_month = 30 * seconds_in_day -- assuming average of 30 days per month local seconds_in_year = 365 * seconds_in_day local years = math.flo

cypher - Finding friends with 2 common friends in Neo4j -

given relationship: (p1:person)-[:friend]->(p2:person) is there way find pairs of people eg. (p1,p2) have 2 or more friends in common? this should it: match (p1:person)-[:friend]-(friend:person)-[:friend]-(p2:person) p1, p2, count(friend) friend_count friend_count >= 2 return p1, p2, friend_count but keep in mind cartesean product of person nodes, collection grows, query have @ every combination of every pair of people. that's fine long don't care running query lot / running fast. also note common style labels uppercamelcase . see pretty style guide: http://nigelsmall.com/zen

c# - Uploading File/s to Gridview rows as needed and display in the same Column after uploading -

Image
i want upload files gridview , display file name/s after upload completed. below aspx file has generated gridview. how achieve file upload? thank in advance. <asp:commandfield showselectbutton="true" /> <asp:boundfield datafield="id" headertext="id" sortexpression="id" /> <asp:boundfield datafield="date" headertext="date" dataformatstring="{0:dd/mm/yyyy}" sortexpression ="date" /> <asp:boundfield datafield="name" headertext="name" sortexpression="name" /> <asp:boundfield datafield="address" headertext="address" sortexpression="address" /> <asp:boundfield datafield="phone" headertext="phone" sortexpression="phone" /> <asp:boundfield datafield="email" headertext="email" sortexpress

java - How to handle app links for a webview app -

i'm trying handle app links in webview app. means if user click on link example.com/example.html app should show open dialogbox. i've implemented this: <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="http" /> <data android:host="www.example.com" /> </intent-filter> and mainactivity.java contains code: public boolean shouldoverrideurlloading(webview view, string url) { ... ... if (uri.parse(url).gethost().contains("www.example.com")) { return false; } intent intent = new intent(intent.action_view, uri.parse(url)); view.getcontext().startactiv

unity3d - Share same Navmesh with Duplicated Scenes -

i had scene map (some buildings , roads) , baked navmesh, started duplicating same scene modifying objects inside (not map or world), scenes sharing same navmesh somehow, deleted navmesh accidentally, way seem find create new baked navmesh every scene increase build size much!, how can re-share same baked navmesh scenes since have same map inside ? using latest unity3d. before start: if have lot of assets in project changing serialization force text may take lot of time. may want copy target scenes new project, below mentioned steps , paste them back. :) there no way unity editor, there workaround: go edit > project settings > editor , change asset serialization force text (default mixed ) - makes sure assets, including unity scene files saved text documents now open scene file (the 1 baked navmesh) in text editor cmd+f or ctrl+f focus on search bar , type "navmeshsettings". in navmeshsettings last entree should m_navmeshdata:{fileid:1234 //

org.postgresql.util.PSQLException: ERROR: index row requires more memory than default(8191) -

i trying use postgresql in our existing project improve performance , make fiendly json. have done research on postgersql , trying integrate our application. facing problem when tried insert large json document table. working small set of json document fails large data. following error dispalyed in console when inserting data. org.postgresql.util.psqlexception: error: index row requires 11936 bytes, maximum size 8191 @ org.postgresql.core.v3.queryexecutorimpl.receiveerrorresponse(queryexecutorimpl.java:2284) @ org.postgresql.core.v3.queryexecutorimpl.processresults(queryexecutorimpl.java:2003) @ org.postgresql.core.v3.queryexecutorimpl.execute(queryexecutorimpl.java:200) @ org.postgresql.jdbc.pgstatement.execute(pgstatement.java:424) @ org.postgresql.jdbc.pgstatement.executewithflags(pgstatement.java:321) @ org.postgresql.jdbc.pgstatement.executeupdate(pgstatement.java:297) @ com.practice.practiceclass.main(practiceclass.java:28) org.postgresql.util.ps

Python and OpenCV - is there any way of making sure sliding at the trackbar of cv2.createTrackbar will give me an odd value? -

let have code: cv2.createtrackbar('kernal', 'window', 3, 21, callback) for time being, write code underneath check weather value got correspond cv2.gettrackbarpos odd or even, , if even, add 1 it. there other way using callback ? because irritating part way slider not represent value getting (it 1 value lower if set number).

javascript - Laravel 5.2 : How to post and delete data Using Ajax? -

i want post data using ajax , want delete data using ajax. problem while inputting data, data posted in database. ui faces problem, after saving data, save button clicked. i'm using ajax, shouldn't load or previous data should automatically vanish. same deleting also, while deleting data deleted, it's redirecting page? how solve problem? here usercontroller code: <?php namespace app\http\controllers; use illuminate\http\request; use app\http\requests; use illuminate\http\response; use app\user; use app\post; use illuminate\support\facades\storage; class usercontroller extends controller { public function postsignup(request $request) { $this->validate($request, [ 'name' => 'required|max:120', 'email' => 'required|email|unique:users', 'password' => 'required|min:4' ]); $user = new user(); $user->name = $request['name

javascript - Angular 2: HTTP Post Request with URL parameters and body type parameter -

i trying make http post request angular 2 below. saveuserselection() { var json = json.stringify({access_token: localstorage.getitem('access_token')}); var params = 'json=' + json; var headers = new headers(); headers.append({ 'content-type': 'application/json' }); return this.http .post('http://localhost:8080/user/selection', params, { headers: headers }) .map(res => res.json()); } but getting error below. angular2.dev.js:23877 exception: error during evaluation of "ngsubmit" original exception: syntaxerror: failed execute 'setrequestheader' on 'xmlhttprequest': '[object object]' not valid http header field name. does have idea what's wrong code ? , how can create http post request parsing body type parameter ? this should want: headers.append('content-type', 'application/json' ); headers.append('access_token', localstorag

Logstatsh help needed to write grok filter -

i new group. can please let me know how can write sample grok filter below log message ? 1458164618009,971866112000,samplehost.com memory pid=48653 1)unixtime 2)memory used in kbs 3)host 4)memory pid static text 5) 48653 process id thank you.

r - DeployR Open - Restrict file system access -

according deployr documentation each session locked down: "by default, r sessions executing on deployr grid not authorized access files or directories outside of r working directory" however, have been able upload simple script using user has basic_user role , reads file c:\ drive on windows. t <- read.table("c:\\myfile.csv") t how lock down access file system? seem have missed something.

visual studio 2015 - Fail load test when individual test cases fail -

i've implemented load test suite using mstest test cases visual studio 2015. can execute load test fine i'd fail load test run if there test failures. green success symbol text "test run completed results 1/1 passed" , have dig deeper load test report notice or test cases failed. is possible? update: i vague in describing setup. clarify there are: separate test project mstest classes (decorated testclass attributes) implemented can self-host wcf service or can use wcf service server, a visual studio web performance , load test project and a load test file (.loadtest) uses mstest classes. i understand typically load tests use web performance tests (.webtest) can recorded using browser. opted use mstest tests instead because system under test wcf service , not web page tests hard create couldn't use browser recording. i have setup , running , can see how system under test performs. problem if these mstest executions fail (e.g. assert.areequal fa

AngularJS directive for C3 chart not displaying all graphs -

i working c3 charts first time , came across angular directive of called angular_c3_simple. https://github.com/wasilak/angular-c3-simple i tried static data , worked fine json data through service not working expected. i trying display 2 different graphs displaying first graphs correctly second graph showing undefined value. please me out this, not sure missing. here plunkr: https://plnkr.co/edit/nyxgjwgrzj4xvzc5xjpg?p=preview <div class="row"> <c3-simple id="chart" config="chart"></c3-simple> </div> <div class="row"> <c3-simple id="chart1" config="chart1"></c3-simple> </div> i think missed bindto option in configuration, so, graph not shown correctly. example app.controller('analyticscontroller', function($scope, analyticsservice, c3simpleservice, $http, $q) { console.log("i have entered here"); var chart_size = { width: 48

PHP form not displaying anything in mySQL -

i trying figure out why php form doesn't put in data fields mysql database. have been trying figure out have come dead end. my insert $sql works fine when hard coded values each field not when try use fields entered php form. i dont't error when click on submit when check mysql see if added owner, nothing displays. if can me fix this, appreciate it. by way $sql insert statement correct quotes? <head> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { padding: 5px; } </style> </head> <body> <?php #index.php assignment 10 $page_title = 'assignment 10 marina database'; include('header.html'); require('dbconn.php'); echo '<h1> please enter following fields:</h1>'; if ($_server['request_method'] == 'post') { $ownernum=$_post['ownernum']; $lastname=$_post['lastname']; $firstname=$_post['firstname'];

java - How to handle a IOException by starting a new Activity in android -

i trying start main page activity when exception thrown. right when exception happens, app shuts down , starts main page. want seamlessly go main page app, not give user waring app shutting down. error gives me this: d/issue with http:: ioexception 04-19 13:57:31.518 27520-27570/myapp w/system.err: java.io.filenotfoundexception: webpage 04-19 13:57:31.518 27520-27570/myapp w/system.err: @ com.android.okhttp.internal.huc.httpurlconnectionimpl.getinputstream(httpurlconnectionimpl.java:238) 04-19 13:57:31.518 27520-27570/myapp w/system.err: @ myapp.httpmanager.myhttpget.httpdownloaddata(myhttpget.java:79) 04-19 13:57:31.518 27520-27570/myapp w/system.err: @ myapp.httpmanager.myhttpget.doinbackground(myhttpget.java:53) 04-19 13:57:31.518 27520-27570/myapp w/system.err: @ myapp.httpmanager.myhttpget.doinbackground(myhttpget.java:31) 04-19 13:57:31.518 27520-27570/myapp w/system.err: @ android.os.asynctask$2.call(asynctask.java:295) 04-19 13:57:31.518 27520-27570/my

objective c - AFNetworking post request fails due to nsdictionary value with double quotes -

when set nsdictionary request parameters, dictionary values special character added double quotes , cause post request failed when use same dictionary values using "rest client (chrome add-ons)" request post successfully. how fix issue? for example lat , long should float value because of special character double quotes added automatically. here nsdictionary log-> ** aptsuiteno = 20; buildingname = "the "; builtinyear = 2014; builtupareasize = 200; cityname = dhaka; countryname = bangladesh; createdate = "19-04-2016"; createdbycompanyid = 7746; createdbyuserid = 7915; currencyid = 1; description = "the "; lastupdatedate = "19-04-2016"; lastupdatedbyuserid = 7915; latitude = "23.832637"; localityname = cantonment; longitude = "90.416590"; neighborhoodname = "nikunja 2"; placeid = chijieh0al7gvtcrvmjqalwgyvc; postedby = owner; price = 200; propertybathroomnumber = 1; propertybedroomnumber = 1; p

laravel - htmlentities() expects parameter 1 to be string, array given, i have tried everything -

this blade file code- <select name="edu_name[]" class="form-control input-md" onchange="choosecontact(this)"> <option selected="true" style="display:none;">select degree</option> @foreach ($objmastereducation $dropdown) <option value="{{$dropdown->id}}" class="form-control">{{$dropdown->edu_name}}</option> @endforeach </select> </div> </div> </div> <div class="row-fluid"> <div class="col-sm-4"> <div class="form-group"> <input type="text" name="institute[]" id="institute" class="form-control input-md

asp.net mvc - How to use Object caching on View page MVC -

i working mvc project . having access of view page in 1 project load using view engine . now want use object caching on view page not want call service method every time. is there way this? appreciated. thanks. you can cache view : [outputcache(duration = 10)] public actionresult details(int id) { viewdata.model = _datacontext.movies.singleordefault(m => m.id == id); return view(); }

javascript - with node.js, how to post image (take it from some url) to server API? -

i'm trying image url, , post somehow(either formdata)... i've found usefull info here 1 , 2 , 3 ... i've tried several variants of code. still cant' load image server. code : var formdata = require('form-data'); var request = require('request'); var form = new formdata(); request.get(url, {encoding:null}, function (error, response, body) { form.append('my_logo', body); form.getlength(function(err,length){ console.log(length); var r = request.post(upload_url, { headers: { 'content-length': length } }, function(err, httpresponse, body) { if (err) console.log(+err) var res = (typeof body == 'string') ? json.parse(body) : body; console.log(res); }) r._form = form }); }) in response post request receive information, loaded und

docker - How do I make a comment in a Dockerfile? -

i writing dockerfile , want know if there way make comments in file? docker have comment option takes rest of line , ignores it? you can use # comment line . # on line comment

Solr arabic exact search -

i new solr , want add new field schema use arabic exact search. have searched lot in stackoverflow not find how it. here's schema.xml : field <field name="arsch" type="string" indexed="true" stored="true" required="true"/> type <fieldtype name="string" class="solr.strfield" sortmissinglast="true" /> i'm getting other words search word. example, if query arsch: "امام" following words: "امام" "الامام" "والامام" "الاماره" i want field exact, how it?

ruby on rails 4 - Windows 10: `require': cannot load such file -- spec_helper (LoadError) -

hi running rails on windows 10 , when running command rspec spec/ i receive following error c:/railsinstaller/ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- spec_helper (loaderror) c:/railsinstaller/ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' c:/railsinstaller/ruby2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1295:in `block in requires=' c:/railsinstaller/ruby2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1295:in `each' c:/railsinstaller/ruby2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1295:in `requires=' c:/railsinstaller/ruby2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration_options.rb:109:in `block in process_options_into' c:/railsinstaller/ruby2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.4.4/lib/rspec/core/config

android - Getting error in LocationManager -

i have been trying current address without mentioning latitude , longitude implicitly inside code using locationmanager using gps iam getting 1 error in locationmanager line in below program: package com.example.admin.getcurrentlocation; import java.io.ioexception; import java.util.list; import java.util.locale; import android.app.activity; import android.app.alertdialog; import android.content.contentresolver; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.pm.activityinfo; import android.location.address; import android.location.geocoder; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.provider.settings; import android.util.log; impor

css - I have a Single row within that I want to make 3 columns which are not related to each others height & width -

in second column, have read more button, on click of that, text expands & icons of 1st & 3rd column comes down not want... give me demo template in if click button, icon below text div should come down , should not affect position of other columns icons. i'm using code... <div class="grid"> <div class="row"> <div class="groups col-sm-4 col-xs-offset-4 career-description"> <h1>srv</h1> <button class="btn-link favorite glyphicon glyphicon-bookmark clbookmark"></button> <h3 class="nodata_msg" style="text-align: center;">sorry, data not available career.</h3> <p class="brief_desc_a"> </p> <p class="det_descf" ng-show="readmore"> </p&

scala - Silhouette authorization using request data -

i use silhouette , play 2.4 , i'd restrict actions if securedrequest body contains wrong. i know, should use trait authorization described official docs . i'm trying following: case class withcheck(checkcriteria: string) extends authorization[user, cookieauthenticator] { def isauthorized[b](user: user, authenticator: cookieauthenticator)(implicit request: request[b], messages: messages) = { future.successful(user.criteria == checkcriteria) } } and def myaction = securedaction(withcheck("bar")) { implicit request => val foo = ...// deserialize object request.body val checkcriteria = foo.criteria // else here } how can use checkcriteria value in class withcheck ? i found solution. somehow, blind see isauthorized has same request implicit parameter. so, check done entirely isauthorized . example, case class withcheck() extends authorization[user, cookieauthenticator] { def isauthorized[b](user: user, authenticator:

php - How to fix: Warning: mysqli_query() expects parameter 1 to be mysqli? -

i'm trying install arfooo on host. first got warning about: deprecated: mysql_connect() after fixing that, error: function executequerywithprefix($sql, $tablesprefix) { $sql = str_replace("create table `", "create table `" . $tablesprefix, $sql); $sql = str_replace("into `", "into `" . $tablesprefix, $sql); //echo $sql."<br>"; return mysqli_query($sql); } function dbconnect($server, $user, $pass, $dbname) { /* install database prefixed tables */ mysqli_connect($db_host, $user, $pass, $dbname); //mysql_connect($server, $user, $pass) or die('could not connect mysql');; mysqli_query($dbname, 'create temporary table `table`'); //mysql_query('create database if not exists ' . $dbname); mysqli_select_db($dbname) or die('could not select database'); } please help! thanks! $link = mysqli_connect($db_host, $user, $pass, $dbname); mysq

python - regex with optional block of text -

i'm using regex parse structured text below, caret symbol marking i'm trying match: block 1 ^^^^^^^ subblock 1.1 attrib a=a1 subblock 1.2 attrib b=b1 ^^ block 2 subblock 2.1 attrib a=a2 block 3 ^^^^^^^ subblock 3.1 attrib a=a3 subblock 3.2 attrib b=b3 ^^ a subblock may or may not appear inside block, e.g.: subblock 2.2 . the expected match [(block1,b1), (block3,b3)] . /(capture block#)[\s\s]*?attrib\sb=(capture b#)/gm but ends matching [(block1, b1), (block2, b3)] . where doing regex wrong? you can use (?m)(^block\s*\d+).*(?:\n(?!block\s*\d).*)*\battrib\s*b=(\w+) see the regex demo the regex based on unroll loop technique. here explanation: (?m) - multiline modifier make ^ match beginning of line (^block\s*\d+) - match , capture block + optional whitespace(s) + 1+ digits (group 1) .* - matches rest of line (as no dotall option should on) (?:\n

html - Button redirects to wrong page if clicked [PHP] -

i'm writing script write data html form database. want edit entry, it's possible search , clicking image should possible edit entry. function writeall($data, $pk) { echo '<tr>'; foreach($data $key => $value) { if(strcasecmp($key, "plz") == 0) { $key = "plz"; } else if(strcasecmp($key, "tel_handy") == 0) { $key = "mobiltelefon"; } else if(strcasecmp($key, "tel_festnetz") == 0) { $key = "festnetztelefon"; } echo ' <td>'. $value.' </td> '; } echo '<td><a href="edit.php?id='.$pk.'"><input type="image" src="button_edit.png" /></a></td></tr>'; } that's line of code creates button beside each entry, entry id connected it. but if click button/image,

android - The push notification Registration tab location in IBM Bluemix -

i tried following link push notification using ibm bluemix: http://www.ibm.com/developerworks/library/mo-cordova-push-app/#n101d0 however, stuck on step 6. verify device registered, go bluemix console. click push service application , navigate registrations tab. can see device within list. notice consumer id matches 1 gave when registering device. however, cannot find registration tab in ibm bluemix console. also, cannot find references following step: open ibm bluemix console , click application. under development services, click service mobile application security: please me find location of registration tab , mobile application security in ibm blumix. that tutorial outdated , referencing deprecated services why you're hitting issues (the registrations tab has been removed note example). please take @ https://github.com/ibm-bluemix-mobile-services/bms-samples-cordova-hellopush see how use new ibm push notifications service cordova https://console.ng.blu

javascript - Unable to redirect to html page after inserting form data into database -

$("#sub").click( function() { $.post($("#new_user").attr("action"), $("#new_user :input").serializearray(), function(info) { $("#result").html(info); }); clearinput(); }); $("#new_user").submit(function() { return false; }); function clearinput() { $("#new_user :input").each(function() { $(this).val(''); }); } here sub id of html form , result id of span tag in same page form. looking redirect same html page after inserting in database, not happening. insertion happening properly. use method redorect window.location = "http://www.youtube.com"; or use in function want redirect $(this).attr("href","http://www.youtube.com"); give own url

Swap bits (or just access them) in assembly x86 -

i'm going come out disclaimer , homework problem. don't want solve it, want clarification. the exact problem this: write function swap odd , bits in integer few instructions possible (e.g., bit 0 , bit 1 swapped, bit 2 , bit 3 swapped, , on). it hints no conditional statements required. i kind of looked , discovered if somehow separate , odd bits can use shifts accomplish this. don't understand how manipulate individual bits. in python (programming language i'm used to) it's easy index operator can number[0] example , can first bit. how do assembly? edit: @jotik, help. implemented this: mov edi, ebx , edi, 0x5555555555555555 shl edi, 1 mov esi, ebx , esi, 0xaaaaaaaaaaaaaaaa shr esi, 1 or edi, esi mov eax, edi and when saw | operator, thinking or ||. silly mistake. in assembly 1 can use bit masks other bitwise operations archive result. result = ((odd-bit-mask & input) << 1) | ((even-bit-mask & input) >> 1)

Apply bitmap mask to image on html5 canvas -

Image
good morning, have canvas background image, need put image on , apply mask on have transparency. here can find link sample of final result need. can me? imagecontext.drawimage(mask, 0, 0, width, height); imagecontext.globalcompositeoperation = 'source-atop'; imagecontext.drawimage(img, 0, 0); http://codepo8.github.io/canvas-masking/

python - Get period duration in pandas -

how period duration in pandas? example, if have data periodindex value 2017q1 1.156355 2017q2 0.815639 2017q3 0.798100 2017q4 1.027752 how duration of each of indeces? end_time - start_time , gets wrong timedelta('30 days 23:59:59.999999') january , have round somehow. need multiply value amount of days, can resample data days, ffil, resample q sum, doesn't seem efficient. edit: of course in example can multiply timedelta/timedelta('1 day') , in general if duration of period needed, there no built in function?

javascript - Disabling Anchor Buttons -

i need making anchor button not clickable after has been clicked once before. any appreciated in advance html code: <div class="text-center"> <a role="button" class="btn btn-success" id="creategamebutton" onclick="addgame();">create coinflip</a> </div> javascript code: function addgame() { var side = $("#side").val(); var steamid = $("#steamid").val(); var amount = $("#amount").val(); var buttontext = document.getelementbyid('creategamebutton').innerhtml; if(buttontext=='create coinflip') { $.ajax( { url: 'addgame.php', type: 'post', data: 'side=' + side + '&steamid=' + steamid + '&amount=' + amount, datatype: 'text', success: function (data) { document.getelementbyid('game-alert').inne

bootstrapper - How to uninstall the previous version and install latest version with Wix Bundle -

i'm using wix bundle install chain of msi's , when i'm trying upgrade older version not uninstalling please me on doing below of scenarios how can uninstall previous version before install latest version always upgrade latest version, in case can major release or minor release or patch release there's more uninstalling. first of let's take @ versioning. bundle has version , each of msis has own version. hope when there's time upgrade have upgrade entire bundle without checking each of packages separately, might make bit easier. now, each of msis should have product > upgrade attribute set , have upgrade node. values should same. bundle should have attribute upgradecode . should enough uninstall previous version , install new one. now, if want show in ui, can go bootstrapper application , subscribe kinds of detect events. there related upgrade. here's msi support update: <product id="*" name="$(var.productname

jsf - <h:outputstylesheet > doesn't work -

this question has answer here: how reference css / js / image resource in facelets template? 3 answers i working on migration project jsf 1.2 jsf 2.2, followed correctly steps migration when want change old tag import css files new tag ,this later doesn't work , css files imported!! pliz , thx in advance! <h:head><h:outputstylesheet library="css" name="style.css"/></h:hea> the tag <h:outputstylesheet library="css" name="style.css" /> with capital s, typo ;) btw prefer use pure html import css no need use tag library that

php - Laravel Stuck getting last user who posted in forum -

so have basic forum set , have relationships between models completed. stuck trying last user posted in sub category. how laid out. mysql tables forum_category (this used main category , sub category) forum_post (this used posts) here forumcategory.php namespace app\models\forum; use illuminate\database\eloquent\model; class forumcategory extends model { protected $table = 'forum_category'; public static function category() { return forumcategory::with('forumsubcategory')->wherenull('parent_id')->get(); } public function user() { return $this->belongsto('app\user'); } public function forumsubcategory() { return $this->hasmany('app\models\forum\forumsubcategory' , 'parent_id'); } public function forumpost() { return $this->hasmany('app\models\forum\forumpost' , 'parent_id'); } } and here forumsubcategory.php su