Posts

Showing posts from August, 2012

javascript - Which is correct approach & or & in Wordpress urls -

as figured out, gives me problems on landing page ($tab get's variables stack ['amp;tab'] instead of ['tab'] ): wp_redirect("admin.php?page=booking-manager&amp;tab=customers"); if debug with: $tab = isset($_get['tab']) ? $_get['tab'] : ""; echo nl2br(print_r($_request, true)); die("tab:$tab"); i get: array ( [page] => booking-manager [amp;tab] => customers ) tab: so had use without ampersanding make if work: wp_redirect("admin.php?page=booking-manager&tab=customers"); while onclick , form action attributes, & ampersanding working: onclick: onclick="window.location.href='<?php print(admin_url('admin.php?page=add-discount&amp;discount_type=1&amp;discount_id=0')); ?>'" form action: <form action="<?php echo admin_url('admin.php?page=add-customer&noheader=true'); ?>" method="post" id="f

OS X: Sorting NSTableView binding to NSArrayController -

Image
i have nstableview bind nsarraycontroller. i'm sorting nstableview , works fine when click on row of nstableview different value nsarraycontroller not been sorted. here how i'm sorting nstableview: nssortdescriptor *sd = [nssortdescriptor sortdescriptorwithkey:@"names" ascending:yes]; [self.names setsortdescriptors:[nsarray arraywithobject:sd]]; for example when click on name1 value of name2. need match values of nstableview nsarraycontroller. of knows i'm doing wrong? or how can sort both nstableview , nsarraycontroller ? i'll appreciate help when click on name1 value of name2 how value? i suspect you're looking in wrong place. first, should bind table view's selectionindexes binding array controller's selectionindexes property. likewise, should bind table view's sortdescriptors binding array controller's sortdescriptors property. it's not clear self.names refers in code. table view or array con

google maps - Cannot resolve symbol 'mapView' on android studio -

after tons of tries couldn't found how solve this. android won't resolve symbol 'mapview' on: mmapview = (mapview) v.findviewbyid(r.id.mapview); what i'm trying google maps work on emulator. know code working on pc, guess here there's else.. (a system issue or google maps api problem) here's code. can help? thank you.. package com.example.matant.gpsportclient.controllers; import android.app.fragment; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import com.example.matant.gpsportclient.asyncresponse; import com.example.matant.gpsportclient.r; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapview; import com.google.android.gms.maps.mapsinitializer; import com.google.android.gms.maps.model.bitmapdescriptorfactory; import com.google.android.gms.maps.model.ca

Python 2.7: Remove subdomains from list -

i have list 1,300,000 items. example, ['.a', '.b.a', '.c.b', '.f.c.b']. i'd remove subdomains (e.g. '.b.a' , '.f.c.b' in list above). i'm newbie. trying learn speed. following attempts, seem slow. suggestions: # create separate lists, perhaps faster a1 = [] b2 = [] c3 = [] d4 = [] e5 = [] f6 = [] in dupesgone: j = i.count('.') if j == 1: a1.append(i) elif j == 2: b2.append(i) elif j == 3: c3.append(i) elif j == 4: d4.append(i) elif j == 5: e5.append(i) else: f6.append(i) in a1: la = -len(a) b in b2: if == b[la:]: b2.remove(b) c in c3: if == c[la:]: c3.remove(c) d in d4: if == d[la:]: d4.remove(d) --snip-- # how this, faster [b2.remove(b) b in b2 in a1 if == b[-len(a):]] [c3.remove(c) c in c3 in a1 if == c[-len(a):]] [d4.remove(d) d in d4 in a1 if == d[-

c# - WPF InkCanvas: how to disable antialiasing -

i'm using inkcanvas in project , noticed whenever draw something, stroke sharp, , once release mouse button becomes blurry. is there way can keep stroke identical looks i'm drawing it? right i'm going through array image , remove pixel doesn't match color.red (i.e., argb: 255,255,0,0)... , i'm sure there's smarter way this! thanks in advance. ok. found answer! sources: https://social.msdn.microsoft.com/forums/vstudio/en-us/d95c6b91-2a68-455b-b9d4-021bd5c96029/how-to-disable-smoothing-for-stroke-?forum=wpf rendering sharp lines in wpf i tried add renderoptions.edgemode="aliased" directly xaml (the property doesn't show in properties window, when selecting inkcanvas) , works. this: <inkcanvas x:name="myinkcanvas" moveenabled="false" ...> to: <inkcanvas x:name="myinkcanvas" moveenabled="false" renderoptions.edgemode = "aliased" ...> on mouseup, stroke st

c# - How do I fix my platformer collision detection? -

i'm working on game allows 2d sprite jump on platform when lands on platform, 2d sprite not on top of platform, exceeding or same position of platform. //here code: texture2d jumper; texture2d tile; vector2 position, velocity; rectangle top; rectangle tile_rectangle; rectangle jumper_rectangle; keyboardstate ks; bool jump; //here load content: protected override void loadcontent() { jump = true; position.x = 10; position.y = 10; jumper = content.load<texture2d>("character"); tile = content.load<texture2d>("tile"); tile_rectangle = new rectangle(300, 350, tile.width, tile.height); top = new rectangle(tile_rectangle.x, tile_rectangle.y - 16, tile_rectangle.width, 10); } //here update: protected override void update(gametime gametime) { ks = keyboard.getstate(); position += velocity; float = 1; if (ks.iskeydown(keys.up) && jump == false) { position.y -= 10f; velocity

html - Aligning divs underneath each other -

Image
i have html: <div id="container" class="container"> <div id="menu-top"> <div class="top-menu"> <div class="top-menu-buttons"> <button class="button button-icon ion-minus-circled"></button> <span>{{amount}}</span> <button class="button button-icon ion-plus-circled"></button> </div> </div> </div> <div id="classic" class="classic"> <div id="classic-img" class="classic-img"> <img ng-src="{{image.filtered}}" /> </div> </div> <div id="menu-bottom"> <div class="bottom-menu"> <div class="bottom-menu-buttons"> <button class="button butto

authentication - Identity Server 3 Access Token Validation endpoint fails with Audience Validation Failed -

i have identityserver3 instance set , requesting token using authorize endpoint (/core/connect/authorize). my application requesting token ios application. i pass following parameters; client_id=<clientid> response_type=id_token scope=openid redirect_uri=<redirecturi> state=<state> nonce=<nonce> this opens web view me, enter credentials , returns redirect_uri #id_token appended url. to validate token pass access token validation endpoint (/core/connect/accesstokenvalidation) of identityserver. append ?token=<access token received login> . i response { "message": "invalid_token" } when check log system.identitymodel.tokens.securitytokeninvalidaudienceexception: idx10214: audience validation failed. audience: '<clientid>'. did not match: validationparamters.validaudience: '<identity_server_host>/resources' or validationparameters.validaudiences: 'null' what doing wrong here? su

login - yii2 inner join identityinterface -

i'm learning yii2, wanna use identity interface after login, show personal information of worker, have 3 tables: users, workers , persons, after login need person data (name, lastname,genre,etc), i'm using it: public static function findidentity($id) { $user = users::find() ->select("id,login,name") ->innerjoinwith(["workers","workers.person"]) ->where("activate=:activate", [":activate" => true]) ->andwhere("id=:id", ["id" => $id]) ->one(); return isset($user) ? new static($user) : null; } but, when i'm trying "name" in view can't see anything, i'm using : <?= yii::$app->user->identity->name?> and value null, doing wrong?? happens after successfull login. thanks. i'm not sure because can't testing in moment try way public static function findidentity($id) { $user = users::fin

java - vServer Linux - Start jar: Invalid or corrupt jarfile -

Image
i'm running linux vserver debian 8.0 64 bit 512 mb ram , 150gb space. its planned use game , let server.jar run nonstop. server working kryonet, library simple client/server communication. on server installed java 1.8 , working fine, testing downloaded minecraft server jar, works perfectly. packed server executable jar eclipse (compile version 1.8), worked fine when starting cmd on computer (java 8 installed) when trying start on server: error: invalid or corrupt jarfile server.jar i thought problem librarys used, tried clean helloworld jar, not work. here screenshot showing installed java version , trying run helloworld jar. i solved problem! the jar corrupted: transfered jar on server using mediafire hoster , using direct download link download jar on server via wget <url> . seemingly mediafire damaging jars ( maybe compressing them ), used dropbox hoster , worked fine! i hope can having same problem.

sql server - how to stop coldfusion from adding single quotes in string -

this question has answer here: coldfusion adding quotes when constructing database queries in strings 4 answers i have dynamic sql statement want fire off sql server. base of query in variable called query: <cfset query ="select parcelid, ltrim(iif(addnum not null, ' ' + addnum, '') + iif(adddir not null, ' ' + adddir, '') + ' ' + addstreet + iif(addunitnum not null, ' ' + addunitnum, '') + ' ' + addcity + ', ' + addstate + ' ' + addzip + iif(addzip4 not null, '-'+ addzip4, '')) address propertyparameters addzip = '#url.zip#'"> my problem areas see quote-space-quote plus field (ie. ' ' + addnum), single quote adds more single quotes, , sends following sql server: select parcelid, ltrim(iif(ad

Finding matches from an array rails -

patient have array of clinician id's shared stored in shared_with . list of patients current user, clinician, has id stored in patient's shared_with what have tried doesn't work: @shared = patient.find_by(shared_with: current_user.clinician.id).order("first_name asc") for example, our current_user associated clinician.id 1 , there patients shared_with values of 1, 4 patient 10 , 1, 7 patient 15. want @shared list patient 10 , 15. patient model: patient: clinician_id: integer first_name: string last_name: string user_id: integer shared_with: string serialize :shared_with, array patient.rb: class patient < activerecord::base belongs_to :clinician belongs_to :user accepts_nested_attributes_for :user, :allow_destroy => true end as far can tell, patient model doesn't need belongs_to clinicians, , doesn't need clinician_id -- unless these related in fashion...in case,

html - Pass RadioButton selected value to different form -

i have 3 radio buttons, when select 1 want pass value different form can use when submit posted. however, cannot seem figure out how. my ultimate goal take selected value of radio button , pass form can use it. don't want put radio buttons inside of form well. wont let me use environmentname unless use in form upon submission. view <div class="btn-group-vertical pull-right" data-toggle="buttons"> <label class="btn btn-primary" style="@displayoak"> @html.radiobuttonfor(model => model.environmentname, "oak") oak </label> <label class="btn btn-primary" style="@displayqa"> @html.radiobuttonfor(model => model.environmentname, "qa") qa </label> <label class="btn btn-primary" style="@displa

html - Google ad cannot find a responsive size in non-fixed width div -

i having issues getting adsense ad appear in non-fixed width div. basically, have 2 divs sitting side side, have google ad appear in second one, doesn't have fixed width set. see sample code: <div style="width:1000px"> <div style="float:left; width:200px"> test </div> <div style="float:right; overflow:hidden"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1234" data-ad-slot="5678" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> google refuses serve ad, however, instead following error: "cannot find responsive size container of width=0px" any ideas how can solved? thanks! i ended using solution: cannot find respon

javascript - d3: Color Range with an array with more than 2 colors -

i'm trying shade layer in map (using mapbox ) depending on value of properties in .json file. code works 2 color values passed through. snippet of color coding below. var color = d3.scale.linear() .domain(range) .range([#f0f0d0', '#228b22]); it fail if this var color = d3.scale.linear() .domain(range) .range(['930f16', '#f0f0d0', '#228b22]); the map display range of first 2 colors. how extend if wanted range of colors beyond two? instance, if wanted lower end red , middle quantiles white , , top quantiles green ? something this? var color = d3.scale.linear() .domain([-1, 0, 1]) .range(['#930f16', '#f0f0d0', '#228b22']); this interpolate between '#f0f0d0' , '#930f16' negative values, , '#f0f0d0' , '#228b22' positive values. hope helps!

javascript - Getting SyntaxError: Unexpected token < but not in incognito mode -

Image
i've searching html , javascript loose "<" , couldn't find it. told me try incognito mode, conflict ext or plugin. sure enough, worked. still have not found out caused or how can fix it. advice appreciated!

javascript - hashchange event not being fired on mobile chrome (Wordpress site) -

in wordpress site, i've created modal shortcode, opens modal when modal's "name" in hash part of location. instance /#contact-us open "contact us" modal. to have hashchange event listener on window, using jquery, so: $(document).ready(function () { $(window).on('hashchange', function () { openmodal(); }); }); on laptop, works pretty fine. the problem when try on mobile phone (nexus 5 - chrome & firefox), , when use chrome's devtools emulator, when clicking on anchor href="#contact-us" , won't work - hash in url changes event handler not being called. the weird thing if manually add hash url, event handler called. i thought there might handler stoping propagation or that, tried using jquery's _data function (as mentioned here ) see if there handlers, couldn't find any. so guess question is, why isn't working? , else can find out event "getting lost"? t

c++ - Effects of sched_yield() from a thread running with SCHED_RR scheduling policy -

i have process under linux consisting of 2 threads, 1 producer , 1 consumer. simplicity, assume process running in system on single-core, single-cpu architecture. the producer created first , manually assigned sched_rr scheduling policy sched_setscheduler(0, sched_rr, &params) . after time, consuming thread created too. it's created after sched_setscheduler has been called producer, not have same sched_rr scheduling policy set. under situation, trying understand effects of sched_yield() producer (once 1 element produced). there 2 possibilities, not sure 1 true: the consumer may scheduled execution before producer runs again the consumer cannot scheduled execution because not being run sched_rr scheduling policy and producer did not complete assigned quantum time or did not sleep . in case yield() might have negative effects, it's called nothing. while i'm not sure happens in practice, formally sched_yield not allow lower-priority threa

Should a warning go to stdout or stderr? -

should warning message go stdout or stderr? is somewhere defined (e.g. in posix)? this question doesn't related specific programming language or machine architecture. it depends. example, suppose you're implementing sort program. program reads input stdin , writes stdout. suppose add option "numeric" sort instead of lexicographic sort (the details aren't important). suppose want write warning message if there aren't numbers found in input. sort still work, might not user intended. in case, want write warning message stderr, because stdout reserved actual sorted data. on other hand, if you're writing program contact web service api, read json, extract info, , write info database, perhaps writing warning message stdout acceptable. so, depends on application , how uses stdout. there no "standard".

oop - Container Class in Javascript -

total oop beginner , doing in javascript, forgive blatant dumbness on part: i want keep track of dynamically created objects. believe solution problem use container class. is container class want? if yes, implementation correct? branch objects dynamically generated. branches objects contain branch objects array. function branches() { function branch() { var _id; _id = math.round(math.random()*10); this.getid = function() { return _id; } } this.createbranch = function() { var branch = new branch; _branches.push(branch); } this.getbranches = function() { return _branches; } this.getbranchids = function() { var branch_list = this.getbranches(); var branch_ids = []; (var = 0; < branch_list.length; i++) { var branch_id = branch_list[i].getid(); branch_ids.push(branch_id); } return branch_ids; }

autocomplete - Emacs 21 C/C++ auto-complete mode -

i working on server uses old emacs. way install plugins downloading .el files , adding them ~/.emacs/ folder , sourcing main .emacs file. know of c/c++ autocomplete plugin works emacs 21? tried auto-complete-mode error. an error has occurred while loading `/home/sbhalla/.emacs': symbol's function definition void: defvaralias the same auto-complete-mode works fine on emacs 22. you might able run emacs 24 without root access: download , untar emacs 24: http://gnu.mirror.iweb.com/emacs/emacs-24.5.tar.gz ./configure && make . may tell disable options, e.g. had compile ./configure --without-jpg --without-png you should able run ./src/emacs i've done latest version of emacs on university machines without sudo access, work too.

Project using another project in java throws an exception -

Image
i still trying hard project internship , have problem time, , since pressed time (i haven't finished work no time left) can't ask here, again. thank you. so, have 2 projects, 1 make electronic certification of file , other web project uploads file. in 1 (the web project) 1 upload jsp page, 1 servlet , 1 message page. want use classes of first project in servlet, have added proper imports , added project 1 in "project references" of web project , 2 projects worked separately (i made simple tests of uploading , certificating , both worked fine). it's after uploading file want sign using 1st project exception: exception javax.servlet.servletexception: l''exécution de la servlet lancé une exception cause mère java.lang.noclassdeffounderror: tn/ance/signature/chargement_fichierp12 servlets.uploadservlet.dopost(uploadservlet.java:197) javax.servlet.http.httpservlet.service(httpservlet.java:641) javax.servlet.http.httpservlet.service(httpse

raspberry pi - Accessing multiple hosts via SSH on the same public IP -

i have issue in want connect different host computer exists on same public ip (say, 82.90.233.234 ). both forwarded same port? example, connect raspberry pi using pi@82.90.233.234 , can easily. have desktop want access via ssh @ different desktop@82.90.233.234 . there way can accomplished? disclaimer: not actual ips. for example, connect raspberry pi using pi@82.90.233.234, can easily. have desktop want access via ssh @ different desktop@82.90.233.234. there way can accomplished? if using different usernames in example, have 1 computer listening ssh connections @ 82.90.233.234, , user pi spawn shell session , user desktop automatically spawn ssh session desktop host. you set port forwarding default port 22 raspberry pi, connecting port 2200 forward ssh server on desktop. set aliases in local .ssh/config file: host pi hostname 82.90.233.234 user pi host desktop hostname 82.90.233.234 user desktop port 2200 with in place, ssh pi or ssh desktop , ssh pic

windows - python code is restarting -

as i'm proceeding project euler started learning python. although great , simple language got bit stuck. every code wrote , tried run automatically restarting. think because of very long loop (for example, finding 10001 prime number), cant find out how fix issue. can me, give me guide line or tip? oh, if matters im using python 2.7 thank you! the code example: count = 0 num = 0 = 1 def prime(num): if num <= 1: return false if num == 2: return true else: in range(3, num): if (num % i) == 0: return false break else: return true while (count < 10001): if prime(i) == true: num == count == count + 1 = + 1 print num you need change == = (twice) in while loop: while (count < 10001): if prime(i) == true: num = count = count + 1 = + 1 then code runs fine, , prints num 104729

python - How to use Efficient indexing (numpy) in cython in both .pxd and .pyx file -

suppose have .pxd , .pyx file, use function argument : np.ndarray[dtype_double_t, ndim=1] weight , ctypedef in both file(pyx , pxd) occur: ' dtype_int_t ' redeclared my code following in both file start part: import numpy np cimport numpy np cimport cython dtype_double = np.float64 dtype_int = np.int32 ctypedef np.float64_t dtype_double_t ctypedef np.int32_t dtype_int_t from cython documentation on pxd files when accompanying equally named pyx file, provide cython interface cython module other cython modules can communicate using more efficient protocol python one. this means copying declarations .pxd file .pyx file error included automatically. compile code, must remove duplication. you have not stated why wish duplicate code, if important purpose please explain why or others can resolve issue.

python - count() on filter chains in Django -

when chaining filters in django, efficient way of counting resulting records individual filter? without running filter twice is. i.e. results = my_model.objects.all() filter in my_filters: results = results.filter(filter.get_filter_string()) individual_num_records_affected = my_model.objects.filter(filter.get_filter_string()) since need number of results @ each step, more efficient use .count() on querysets. from querysets documentation : note: if need determine number of records in set (and don’t need actual objects), it’s much more efficient handle count @ database level using sql’s select count(*) . django provides count() method precisely reason. you should not use .len() load of record python objects , calls len() on result don't need. need number of records , .count() better option. also, remember querysets evaluated lazy . internally, queryset can constructed, filtered, sliced, , passed around without hitting da

sublimetext - How to paste rendered html as markdown in sublime text? -

i used use app called ulysses. beautiful way write in markdown. has it's limitations managed install few packages in sublime text , give same features ulysses has. can not find package following. i'll give short scenario, can't explain otherwise: i reading blog post. selected , hit copy. in ulysses, i'd press cmd+alt+v ask me content coming from, i'd select from html . end result same content web, formatted in markdown. example, if blog post has subtitle h2 ulysses paste ## title i tried searching similar plugin in sublime text, installed clipboardcommands , super-awesome-paste . can't recall did, neither did needed. such plugin exist? to search sublime text plugins, use package control's search . quick search convert html markdown yields 2 relevant results: html2text , pandoc . both convert html markdown. pandoc plugin requires pandoc on system.

clojure - Failed to find a usable hardware address from the network interfaces -

i'm getting following warning when running aleph (which uses netty) websever inside docker container: warning: failed find usable hardware address network interfaces; using random bytes: 75:62:7f:9b:c6:52:63:4b i'm starting server using: (defn -main [& args] (http/start-server app {:port 3000})) and i've tried: (defn -main [& args] (http/start-server app {:socket-address (java.net.inetsocketaddress. "0.0.0.0" 3000)})) but still same warning. the warning only happens inside docker container. can run server in host without warning. won't warning if when run container use docker run --net host webserver . the weird thing is, despite warning looks running fine. correct ports bound , server running correctly. have idea why warning?

ruby on rails - How to associate "missed_days" with a date? -

Image
a user has many habits. if 1 day misses doing habit suppose click here: habits/_habit.html.erb <%= link_to new_habit_level_days_missed_path({ habit_id: habit, level_id: habit.current_habit_level.id }), id: 'remove_check' %> <span class="glyphicon glyphicon-remove"></span> <% end %> he redirected to: views/days_missed/new.html.erb <%= simple_form_for(@habit) |f| %> <%= f.date_field :missed_days_date %> <%= link_to 'submit'.html_safe, habit_level_days_missed_index_path({ habit_id: @habit, level_id: @habit.current_habit_level.id }), remote: true, method: 'post', data: { modal: true }, class: 'remove-check', id: 'remove_check' %> <% end %> where upon clicking submit post request made daysmissedcontroller 's create action, increment missed_days +1. class daysmissedcontroller < applicationcontroller def new end def create habit = habit.find(params[:

sql - Unable to convert between java.lang.Integer and BINARY.- Spring -

i have following dto use persist new records database @entity(name = "user") public class user { @id @column(name = "user_id") private long userid; @column(name = "user_name") private string usernm; @column(name = "years_active") private long years; @manytoone(cascade = cascadetype.all) @joincolumn(name = "manager_id", insertable = false, updatable = false) private manager manager; @column(name = "projects",insertable = false, updatable = false) private linkedhashmap<long, string> projects; @column(name = "projects") private long projectid; @column(name = "address") private address address; //getters & setters } ddl: create table [dbo].[user] ( [user_id] int not null, [user_name] varchar(255) not null, [years_active] int not null, [manager_id] int not null, //fk manager table [projects] int not null, //fk project table [address] int null, //fk address table [modifiedby]

php - Using libcurl in c++, writing into file -

i started using curl. far have managed program response , save file/string. using response apis , process them. i'd using market interpretation test various trading systems. purpose plan save responses tempfile, process file , save a-ready-to-use data one. however, no matter string or file, output one-line type. i wondering if there way make curl directly write in file, 'sorted' in lines. mean if there response like: 4stmay2017 - gold - open price: 1150, close price:1200 3stmay2017 - gold - open price: 1060, close price:1170 2stmay2017 - gold - open price: 1100, close price:1050 1stmay2017 - gold - open price: 1000, close price:1100 that's way i'd file like, can sort new data (because market dynamic, , requests i'd make every minute or so), , not on 1 line. way have write write separate algorithm slow me down. what code looks like: #include <iostream> #include <stdlib.h> #include <stdio.h> #include <curl/curl.h> #includ

javascript - Is there anyway to hover over a link, and make that change an image or background image? -

this question has answer here: how affect other elements when div hovered 5 answers i think best way css or javascript. im not sure possible. all css have html { background: url(http://i.imgur.com/6oqxuwz.jpg) no-repeat center center fixed; background-size: cover; } /* unvisited link */ a:link { } /* visited link */ a:visited { } /* mouse on link */ a:hover { } /* selected link */ a:active { } <script> jquery('#link').hover(function() { jquery('body').css("background-image", "url('foo/bar.png')"); }); </script> you try above, # being id can change . use class. can use change elements of div changing body again #foo or .foo depending on whether you're using class or id. hope helps.

erlang - mochiweb: disable headers ordering -

i checked mochiweb response headers, , ordered (descending): < server: mochiweb/1.0 (any of quaids got smint?) < last-modified: sun, 30 aug 2015 23:13:04 gmt < date: sun, 30 aug 2015 23:15:15 gmt < content-type: text/html < content-length: 89 this looks because of mochiweb headers being handled erlang gb_tree , later converted list comes ordered. is there way change this? resolve in problems (sometimes) here , here my problem trying create service replicates requests , using mochiweb this, headers being ordered isn't replicating response correctly. fixed here: mochiweb commit 952087e it problem formatting headers in response, , not in mochiweb_headers .

c# - "A quotation mark delimiter is missing from the end of the query." error in WinCE PDA application -

in wince pda application, doing comparing barcode value scanned 1 in database generate table. i build query this: for (int = 0; < listbox2.items.count; i++) { if (i == 0) { sb.append("select * toolsbar barcodevalue in ("); } sb.append("'" + listbox2.items[i] + "',"); } sb.length = sb.length - 1; sb.append(")"); and use here: cmd.commandtext = sb.tostring(); cmd.commandtype = commandtype.text; cmd.connection = con; con.open(); reader = cmd.executereader(); // error came out "a quotation mark delimiter missing end of query." reader.close(); sqlcedataadapter ad = new sqlcedataadapter(sb.tostring(), con); dataset ds = new dataset(); ad.fill(ds); datagrid2.datasource = ds.tables[0]; con.close(); sb.length = 0; alternate loop build query removes need alter string length: for (int = 0; < listbox2.items.count; i++) { if (i == 0) { sb.append("select * tools

In Go, Given an interface{} in which I know what interface it implements, how can I convert to it -

my current problem implementing data-structures , have written iterators them. have visible interfaces data-structures, iterators, , other required objects. in have concrete implementations wish hide end user. this requires many of functions return interface{} objects can store type of object (and leave validation end-user). one problem have iterate on graph. iterator{} graph implementation returns concrete vertex type iterator interface returns interface{}. since end-users can base vertex interface have try convert vertex interface can use it. here smallest example think of @ point illustrates issue: package main import ( "fmt" "strconv" ) type base interface { required() string } type concrete struct { _data int } func (con *concrete) required() string { return strconv.itoa(con._data) } func convert(val interface{}) *base { if con,ok := val.(*base); ok { return con } return nil } func main() { conc :

javascript - add < and > sign in ng-repeat and filter accordingly -

i have data on bikes on html page, have filter on page 'brand', 'year' , price. although brand , year filter working fine have issue price filter. so have less , greater sign conditionally. have show < sign price 50000 , > price 500000. , apply filter accordingly http://jsfiddle.net/zl4x971f/ <div ng-app='app' class="filters_ct" ng-controller="mainctrl mainctrl"> <ul class="nav"> <li ng-repeat="filter in filters" ng-class="{sel: $index == selected}"> <span class="filters_ct_status"></span> {{filter.name}} <ul> <li ng-repeat="filtervalue in filter.lists"> <input ng-checked="activefilters.brand[filtervalue] !== undefined" ng-click="togglefilter(filter.name, filtervalue)" type="checkbox"> {{filtervalue}}

submenu - Wordpress login logout menu with sub menus -

i try make word press site self. need add login main nav-menu. sub menu "register" (link http://www.vcanade.ca/register/ ) after user logged in, menu has change username sub menus "profile" (link http://www.vcanade.ca/your-profile/ ) , "logout" does can me? put of buttons on nav menu ('register','profile','logout'). give each button unique id , use css rules hide inappropriate buttons: body.logged-in #my-register-button { display: none; } body:not(.logged-in) #my-register-button { display: inline-block; } this works because native wordpress gives body tag class "logged-in" whenever user logged in.

ios - Sending removeFromSuperview to self didn't release itself in my scenario -

i have parent uiview , uitextview 1 of subviews. , created button dismiss parent uiview this: -(void)cancelbuttonpressed:(uibutton *)sender { [uiview animatewithduration:0.2 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{ self.frame = cgrectzero; } completion:^(bool finished) { if (finished) { [self removefromsuperview]; } }]; } i can tell parent uiview didn't released because if typed text uitextview , dismissed it, when opened uiview again, instead of blank uitextview , same text in again. i checked leaks tool didn't see leaking. i'm guessing if have kind of retain cycle or what. update:i have object (which appdelegate ) holding uiview 's instance: _myview global variable this: _myview = [[myview alloc] init]; _myview.namelabel.text = _user.screen_name; [_window addsubview:_myview]; [uiview animatewithduration:0.2 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{

Removing multiple elements from a bash array based on different patterns -

so have this: interfaces=($(ip -o link show | awk -f': ' '{print $2}')) giving me array of interfaces, want remove loopback , tun adapters array. interfaces=(${interfaces[@]/lo/}) interfaces=(${interfaces[@]/tun*/}) works, there way in single line? probably super easy , derp, i'd understand how expression works (google gave me 47239432 examples of above not 1 explained how worked or gave example of using more 1 expression @ time). i know can done awk command, both solution awk , 1 array filter appreciated :) my apologies if stupid question. there many ways this. 1 example: # arr=(lo tun0 net1 net2) # echo ${arr[@]} lo tun0 net1 net2 # arr=( $( printf '%s\n' ${arr[@]} | egrep -v '^(lo|tun)' ) ) # echo ${arr[@]} net1 net2 # and can exclude these interfaces @ beginning: interfaces=( $(ip -o link show | awk -f': ' '$2 !~ /^(lo|tun)/ {print $2}') )

javascript - Threejs crashing when rendering a huge mesh with different materials -

so have mehs has around 59k cubes in it. wanted assign different color each cube, did using meshfacematerial. but when went webpage, instantly crashed in chrome. tried firefox instead, since has better dev tools, , rendered part of cubes, froze , crashed horribly. is meshfacematerial not made handle around 59k materials? or rendering many materials issue?

iOS: dynamic height UIScrollview autolayout -

i making article detail view facebook. view have content(profile image, writer, date, content text) , comment write view. top view uiscrollview , bottom view uiview. uiscrollview have uiimageview , uilabel*3 , uiview have uitextview , uibutton . when touch uitextview in uiview , keyboard comes up. uiscrollview smaller , uiview position moved. , user write text, uitextview line added uiview size extended. eventually uiscrollview , uiview height not determinate. how set autolayout view? may try it: below constraint: uiscrollview top, left, right equal self.view top, left, right uiscrollview bottom equal uiview bottom uiview left, right, bottom equal self.view left, right, bottom uiview height equal 200(you set it) ok, when uitextview touched, set uiview height constraint want(maybe 300) i think works!

dns - how to redirect browser to two different site with apache virtualHost? -

i have valid ip, e.g. x.x.x.x, , domain, e.g. site.com point x.x.x.x. first, need redirect request port 80 443 (security issue). second, every request sent ip, want apache show "hello it's working" (/var/www/index.html) , request domain show real site. i tried this, did not work: <virtualhost x.x.x.x:433> servername x.x.x.x serveralias x.x.x.x documentroot /var/www/ directoryindex index.html options -indexes </virtualhost> <virtualhost site.com:443> ... </virtualhost>

php - Is it bad practice to store ordered list html tag inside mysql database -

i have been researching quite time , have found no exact answer question. asking strictly ordered list element <ul><li></li></ul> tag elements stored in mysql db, , if bad practice, way perform ? example of data stored in mysql db: "get latest products here price starts $$$ specs: <ul> <li>specs</li> <li>specs</li> <li>specs</li> </ul>" all kinds of enlightenment welcomed. thx whether it's bad form or not isn't question. it's whether or not efficient, , whether or not price of coding efficiency worth gain. without knowing rest of application there 4 ways handle off top of head. the way handling, cost sql query every time want piece of html. caching in memory using memcache, depending on how many fragments may run out of memory. caching hard disk file, need regenerate file when tree changes. regenerate html every time it's needed. may faster sm

java - HTTPS auth on Android -

i have code http auth android. doesn't work https auth. how can re-factor code under https authorization ? code http auth below: httpurirequest request = new httpget(host); string credentials = login + ":" + mpassword; authstring = "basic " + base64.encodetostring(credentials.getbytes(), base64.no_wrap); sharedpreferences.editor editor = prefs.edit(); editor.putstring("auth", authstring); editor.apply(); request.addheader("authorization", authstring); httpclient httpclient = new defaulthttpclient(); int result = 0; try { httpresponse response = httpclient.execute(request); result = response.getstatusline().getstatuscode(); system.out.println(response.getstatusline()); } catch (exception e) { result = -1; } return result; the default behaviour of httpclient suitable uses, there aspects may want configure. common requirements customizing ssl are: ability accept self-signed or untrusted ssl certi

AngularJS ui-grid: how to select the the set of attributes in a Data to display in tabe -

i'm trying use ui-grid displaying data ajax call. data returning call have many attributes. need display particular attributes in ui-grid. how that. for example ajax call return below attributes var resp = { "status":true, "msg":"", "sendtran":[{ "document_gid":"xxxx", "documentid":"xxx", "documenttype_name": "xxx", "created_date":"xxxx", "verification_status":"xxx" }] }; resp ajax return values. have multiple attributes , need sendtran attributes bind grid. var data = []; $scope.sendtranscripts = { paginationpagesizes: [10, 25, 50, 75], paginationpagesize: 20, showgridfooter: true, showcolumnfooter: true, enablefiltering: true, enablegridmenu: true, enablerowselection: true, enableselectall: false, selectionrowheaderwidth: 35, columndefs: [

c# - overriding ToString() with formating arguments -

this question has answer here: how pass variables overridden tostring() method? 4 answers consider scenario: int mynumber = 10; string formattednumber = mynumber.tostring("0000"); // output "0010" ie., can format integer using tostring() in above code. have class named mynewclass in over-riding tostring() , aim formatted output using overrided tostring() method. public class mynewclass { public int myproperty { get; set; } public mynewclass(dynamic x) { myproperty = x; } public override string tostring() { return myproperty.tostring(); } } now creating object of class as: mynewclass p = new mynewclass(10); when called tostring() formatting wont compile: var m = p.tostring("0000");//giv

inheritance - Java boolean not passing from class -

i have many classes in java. want if click on radiobutton on window (my main gui), boolean value passed other classes. here how "architected". here class window: class window{ oscillo parent; graph graph; boolean b1=true; boolean b2 = false; window(oscillo parent){ this.parent = parent; } }//end class here class graph: class graph extends jpanel(){ window parent; // tried boolean values window nothing worked private class sg{ sg(graphics g, int id){ // tried boolean values window nothing worked ... }//end private class }//end class here class data: class data{ private oscillo parent; // tried boolean values window nothing worked data (oscillo parent){ // tried boolean values window nothing worked } ... }//end class here class oscillo public class oscillo implements messagelistener{

node.js - Error parsing array containing buffers from two sequential Youtube API requests -

i trying playlists on youtube channel. chunks parses no problem when request either 1st https.get (first 50 playlist titles) or 2nd(nested) https.get(next 50 playlist titles) however, if both requests , push 100 titles (5 buffers each request) chunks , parsing problem unexpected token { in json @ position 6508. how can parse chunks contains information of 100 titles both https.get instead of either first 50 or next 50 only? full parsable (first 50 playlist) code below: var util = require('util'); var https = require('https'); var fs = require('fs'); var count = 1; https.get('https://www.googleapis.com/youtube/v3/playlists?maxresults=50&fields=items(snippet/title,contentdetails)&part=snippet%2ccontentdetails&channelid=ucjbpgzawdh1njbqv-d5hqkw&key=aizasydgkgcw_vv8onuonht-dgeww3uryomsfzu',function(response){ console.log("status code is: "+response.statuscode); var chunks = []; //var chunks = new buffer(0)