Posts

Showing posts from August, 2013

javascript - Accessing JSON parsed object -

so here js code: $(document).ready(function() { $.ajax({ url: "/", type:"post", beforesend: function (xhr) { var token = $('meta[name="csrf_token"]').attr('content'); if (token) { return xhr.setrequestheader('x-csrf-token', token); } }, success:function(data){ console.log(data); },error:function(){ console.log("error!!!!"); } }); }); and in console: object { all_creations: "[{"id":"2","user_id":"2","title":"d…" } but i'd like: console.log(data.user_id) but return nothing.. same for: console.log(data['all_creations'].user_id) console.log(data['all_creations'][0].user_id) console.log(data[0].user_id) ... i using laravel5 btw , json object return tojson() function. (if help)

google maps - Why we need to convert GPS coordinates(latitude, longitude) from degrees and minutes into decimal degrees -

i'm getting nmea data gps. 1 i'm converting decimal degrees using them in google maps. we have gps coordinates conversions degrees minutes , seconds. why need convert coordinates between 2 representations? use conversion(degrees seconds), , how coded. sexagesimal (base 60) numeral system sixty base. originated ancient sumerians in 3rd millennium bc, passed down ancient babylonians, , still used—in modified form—for measuring time, angles, , geographic coordinates. degree minutes , degree seconds not units of time, reference degree in sexagesimal system. for further information: https://en.wikipedia.org/wiki/sexagesimal

bash - Find the 2nd ip address per line on file -

how can find 2nd ip address per line? input hostname1,10.160.226.49,10.160.35.80,10.14.1.80,10.14.5.80,10.160.0.27, 2048 hostname2,10.160.235.89,10.160.35.81,10.14.1.81,10.14.5.81,10.157.233.144, 1024 hostname3,10.160.231.247,10.160.35.82,10.14.1.82,10.14.5.82,10.157.239.26, 512 hostname4,10.160.227.232,10.160.35.84,10.14.1.84,10.14.5.84,10.241.14.2, 2048 hostname5,10.160.224.218,10.160.35.85,10.14.1.85,10.14.5.85,10.157.234.82, 1024 output 10.160.35.80 10.160.35.81 10.160.35.82 10.160.35.83 10.160.35.84 10.160.35.85 try this: cut -d "," -f 3 file or gnu grep: grep -op '^[^,]*,[^,]*,\k[^,]*' file or awk: awk -f "," '{print $3}' file or bash's builtin commands: while ifs="," read -r b c d; echo "$c"; done < file or array: while ifs="," read -ra a; echo "${a[2]}"; done < file output: 10.160.35.80 10.160.35.81 10.160.35.82 10.160.35.84 10.160.35.85

javascript - How to specify wildcards in sonar-project.properties -

i trying use sonarqube scan ui modules, have. ui modules lot in number. have common structure. each module has own js files. i need specify sonar.sources value match js files in project. possible this? sonar.sources=*/*/script sonar.language=js i used these. but, got error 'unable resolve path'. can 1 help? try use wildcard : * match 0 or more characters ** match 0 or more directories ? match single character sonar.sources=**/script

ios - Stream Song to Device with Multipeer Connectivity - Swift -

i'm using multipeer connectivity pair 2 devices , want stream song 1 device other in swift . i've been following this walkthrough in objective-c closely apple's documentation, admittedly don't have obj-c experience. i'm able track output avassetreadertrackoutput, add avassetreader, , start reading. however, once cmsamplebufferref enters equation, start lose sight of what's happening. if can explain process of getting samples track output , drilling down put data stream mc can consume, appreciated.

c++ - Use LLVM debugger inside Emacs on OSX Yosemite -

i want know if possible use llvm debugger emacs, m-x gdb interface standard. in advance. adding llvm debugger support emacs surprisingly (or not, depending on level of cynicism) contentious. in february, 2015, richard stallman wrote : the llvm source repository includes patch adding basic lldb support gud.el. it looks there systematic effort attack gnu packages. gnu project needs respond strategically, means not having each gnu package cooperate each attack. now, please not install change. stefan monnier, 1 of current maintainers, much less hostile change : thanks, andrew. i'd happy incorporate such patch. took quick @ code, , seen afar, there's no problem it, needed clear copyright status of code. as of march, 2015, don't believe llvm debugger patch has been accepted.

Ruby Sinatra table from MySQL -

Image
i working on project have pull data mysql database , display data in table using ruby sinatra. i able connect database , pull data , put inside array. example of table in database city country dallas usa tokyo japan example of array looks like ["dallas, usa", "tokyo, japan"] now, how display array table database. or, there way can copy table database onto webpage? thanks help! your_app/routes.rb: require 'sinatra' require 'slim' '/' raw_data = [ "dallas, usa", "tokyo,japan", "munich, germany", ] @results = {} raw_data.each |item| city, country = item.split(/, \s* /x) @results[city] = country end p results # {"dallas"=>"usa", "tokyo"=>"japan", "munich"=>"germany"} slim :index end your_app/views/layout.slim: doctype html html head meta char

php - sending email from laravel using another "from" header -

blahblahhi know how set part of email. in config email can set there want use noreply@whatever.com e.g. code below doesn't work tho mail::send('emails.auth.activate', array('link' => url::route('account-activate', $code), 'username' => $username), function($message) use ($user) { $message->from('noreply@whatever.com', 'activate account'); $message->to($user->email, $user->username)->subject('activate account'); }); i want able use noreplay@whatever.com instead of using configuration setting in mail.php when use $message->from('noreply@whatever.com', 'activate account'); still shows gmail account instead of noreply@whatever.com <?php return array( /* |-------------------------------------------------------------------------- | mail driver |-------------------------------------------------------------------------- | | laravel supports bot

ajax - Rails authenticity token (CSRF) provided but being refused -

i'm sending ajax request rails site (to go javascript controller). rails refuses allow post unless supply authenticity token, added 1 using <%= csrf_meta_tags %> and var auth_token = "<%=j form_authenticity_token %>" and fine. however, new customer installed plugin accesses site , triggers ajax in first place. 1 customer--the authenticity token denied, despite being supplied (i checked in logs.) i realize i'm not giving lot of clues go off of, cause authenticity token accepted in 1 situation , denied in another? more broadly, how authenticity_token generated anyways--a new 1 every single time page loaded? rails assigns cryptographically random csrf token the user session. the server compares value submitted authenticity_token parameter value associated user’s session. one thing need careful if using fragment caching (which speeds rendering caching chunks of view) need ensure <%= csrf_meta_tags %> not cached since stale c

javascript - Is it possible to insert(not update) a field name as variable in Mongodb? -

im trying insert embedded document in mongodb meteor project. 'submit form' : function(event){ event.preventdefault(); var query=document.getelementsbyclassname("twilioprocessorsms")[0].value; choicelist.insert({ sms: esms, query: { accountsid: accsid, authtoken: token, phonenumber: phno} }); i trying have "query" variable. considers query string.i dont want achieve update. pls ! something should work: 'submit form' : function(event){ event.preventdefault(); var query=document.getelementsbyclassname("twilioprocessorsms")[0].value; var valuetoinsert = { sms: esms }; valuetoinsert[query] = { accountsid: accsid, authtoken: token, phonenumber: phno} }; choicelist.insert(valuetoinsert);

Overwrite a jar while in use - Java -

i have jar client has auto updater built in, when open if there new version download it. made downloads new version same directory user running current 1 it's easy end user. the problem can't overwrite because it's in use obviously. of right downloads new version , have version in name downloads new 1 v1.1 or v1.2 in jar name. this works seems messy in opinion, know of way make can have same file name? ie know of way overwrite file that's in use, or work around close current , replace reopen new one? here downloader class - http://pastebin.com/kjddndhh i think best solution problem not have 1 jar file both manage application , updater. have separate jar updating , current 1 act application alone. this seems similar how many applications auto updating works. league of legends has separate updater runs before main application launches antivirus loads signature files memory , close connection them allowing them overwrite files.

How to get varargout to output text from pushbuttons in Matlab GUI? -

i trying create gui using guide allows user pick 1 of 2 pushbuttons. strings in pushbuttons vary each time (i haven't automated yet), when of pushbuttons pushed, i'd gui put out string output variable. i have code shows output in workspace, handles deleted before outputfn called. suggestions on how fix this? also, i'd use 'next' button. ideally should pull next 2 texts displayed on pushbuttons, in iterative manner, i'd happy move past hurdle of getting output now.here have far: function varargout = select_a_b(varargin) % select_a_b matlab code select_a_b.fig % select_a_b, itself, creates new select_a_b or raises existing % singleton*. % % h = select_a_b returns handle new select_a_b or handle % existing singleton*. % % select_a_b('callback',hobject,eventdata,handles,...) calls local % function named callback in select_a_b.m given input arguments. % % select_a_b('property','value',...) creates n

php - Prevent public access to env file -

i found laravel 5 may output sensitive data , can lead further exploitation of many hosts: https://www.google.com/search?q=intext%3adb_password+ext%3aenv&gws_rd=ssl i want know way secure .env file. can use below code in .htaccess file protect .env file browser view? # protect .env <files .env> order allow,deny deny </files> will above code in .htaccess work , protect .env file? this isn't vulnerability, , isn't remotely issue provided installs laravel correctly - webroot public folder, not repository/project root. the config files , .env file in laravel not contained in webroot, therefore need ensure webroot path/to/project/public . the google query provided literally bunch of people didn't read documentation before installing laravel.

javascript - If todo functionality and chat functionality are in the same page, how to organize the structure? -

in flux architecture, how manage store lifecycle? in flux app there should 1 dispatcher. data flows through central hub. having singleton dispatcher allows manage stores. the chat example made facebook has 3 stores. there dependancies between each other, 'waitfor' others, still on same level. if there todo functionality on page, add todo store same dispatcher, let @ same level chat stores? looks mess me. how handle problem? if there todo functionality on page, add todo store same dispatcher, let @ same level chat stores? yeah, that's main idea. main idea of flux ideology there unidirectional flow going through 1 , single dispatcher. way can guarantee there cascading updates , happens strictly sequentially. why think having dispatch action through different dispatchers make things easier?

Javascript JSON parsing - object to array -

while parsing json object, there better way convert single length objects array, because when want run loop using length works arrays fail if length 1 , object (not included in []). module:{section:{topic:"some topic"}, section:{[{topic:"some topic1"},{topic:"some topic2"},{topic:"some topic3"}]}} my question module.section.length second section undefined first section. there way convert objects inside json arrays?

angularjs - Javascript Object abnormality in Angular application refresh/ deep link from address bar -

i using angular 1.3.15 , ui-router, hosted on iis 7.5. the following code contains setup $statechangestart event. when app has been loaded main link, code invoked correctly; when user accesses state role, there no issue. when try hit link manually via address bar or refresh current page on , application reloads, function runs property on authentication.profile object empty. you'll see doing console.dir(authentication.profile) when $statechangestart first fires off. shows there indeed data there, , methods on object. if try console.dir(authentication.profile.token) , empty. i unsure if related refresh of app different path or totally different. any appreciated. 'use strict'; var serviceid = 'authentication'; angular.module('app').factory(serviceid, ['common', '$localforage', '$injector', authentication]); angular.module('app').run(['$rootscope','$state', '$stateparams', '

api - Using VBA to convert file to application/octet-stream -

i using excel generate quote , vba script upload quote , pdf version our job management software using xmlhttp. i have xmlhttp part working when send file, upload successful (get success message , file on server) file turns corrupt. i meant send file 'application/octet-stream' methods have attempted expect uploading .txt files has corrupted. the code using follows: dim filename string filename = "c:\users\rob\desktop\test365.pdf" dim filecontents() byte, filenumber integer redim filecontents(filelen(filename) - 1) filenumber = freefile open filename binary filenumber filenumber, , filecontents close filenumber dim filecode() string redim filecode(filelen(filename) - 1) x = 0 (filelen(filename) - 1) filecode(x) = bytetobit(filecontents(x)) msgbox (strconv(filecode(x), 256)) next dim pleasework string pleasework = join(filecode, "") however when post pleasework, doesn't work! know doing wrong? is going give me octet-stream?

How would I prompt the user to give them the option to rerun program in C++ -

the option like: "to run program again enter 'y', exit enter 'n'. in program ask user enter package a,b, or c. calculate price based on different factors. have give user option select package rerun entire program? #include <iostream> using namespace std; int main() { bool finished = false; char choice; int choice_a = 995; int choice_b = 1995; int choice_c = 3995; int message_units; int price; bool selected = false; { { //prompt user enter package cout << "which package choose (enter a, b or c)" << endl; cin >> choice; if (choice == 'a') { price = choice_a; selected = true; } else if (choice == 'b') { price = choice_b; selected = true; } else if (choice == 'c') { price = choice_c; selected = true; } cout << endl; } while (selected == false); //prompt user enter message units cout << "how many mes

phpunit - Guzzle php how to set (mock) session variable -

in guzzle can use cookiejar persist session. how create session variable? phpunit guzzle code use guzzle\http\client; use guzzle\plugin\cookie\cookieplugin; use guzzle\plugin\cookie\cookiejar\arraycookiejar; $cookieplugin = new cookieplugin(new arraycookiejar()); $client = new client('http://somewhere.com/'); $client->addsubscriber($cookieplugin); //i want set session variable here // $_session['foo'] = 'bar'; $client->get('http://somewhere.com/test.php')->send(); $request = $client->get('http://somewhere.com/'); $request->send(); and test.php file on server session_start(); error_log(print_r($_session, true)); it essence of session variables not accessible outside world , cannot influenced client (in case: guzzle). way influence session send session cookie or not. so if require tests set session variable, , production code on server not allow client set value directly, you'd have provide test me

python - Issue with Dionysus Build/make on Mac OS X 10.10 yosemite -

i followed instructions make/build dionysus http://www.mrzv.org/software/dionysus/get-build-install.html from brand new computer nothing, used port install python27 , cmake, boost, mercurial , few other packages. in terminal did hg clone http://hg.mrzv.org/dionysus/ cd dionysus hg tip mkdir build cd build cmake .. make when terminal running through make has following error: [ 1%] built target bottleneck-distance [ 3%] building cxx object examples/alphashapes/cmakefiles/alphashapes2d.dir/alphashapes2d.o in file included /users/pavan/desktop/dionysus/examples/alphashapes/alphashapes2d.cpp:3: in file included /users/pavan/desktop/dionysus/examples/alphashapes/alphashapes2d.h:12: in file included /users/pavan/desktop/dionysus/include/topology/simplex.h:221: in file included /users/pavan/desktop/dionysus/include/topology/simplex.hpp:2: in file included /opt/local/include/boost/serialization/set.hpp:26: /opt/local/include/boost/serialization/detail/st

python - How to check change between two values (in percent)? -

i have 2 values (previous , current) , want check change between them (in percent): (current/previous)*100 but if previous value 0 division zero, , if value not change 100%. def get_change(current, previous) if current == previous: return 100.0 try: return (abs(current - previous))/previous)*100.0 except zerodivisionerror: return 0

java - XmlPullParserException during parsing XML with XMLPullParser -

need resolve : trying parse xml - <lungprotocol><configuration name="flus sitting"> <segment order="1" name="left upper anterior"> <segment order="2" name="left lower anterior"> </configuration> <configuration name="flus supine"> <segment order="1" name="left upper anterior"> <segment order="2" name="left lower anterior"> </configuration></lungprotocol> with following function - public list<lungsegment> parse(inputstream is, string configuration) { try { xmlpullparserfactory factory = xmlpullparserfactory.newinstance(); factory.setnamespaceaware(true); xmlpullparser parser = factory.newpullparser(); segment = new lungsegment(); parser.setinput(is, null); parser.require(xmlpullparser.start_tag, null, "configuration"

c# - Detecting valid FTP connection -

i saw thread @ how check ftp connection? , tried of suggestions. here's have: private void isftploginsuccessful(ftpclient ftpclient, string ftpfolder, string ftpusername, string ftppassword) { ftpwebrequest requestdir = (ftpwebrequest)ftpwebrequest.create(ftpfolder); requestdir.credentials = new networkcredential(ftpusername, ftppassword); try { log(loglevel.debug, "just entered try block"); requestdir.method = webrequestmethods.ftp.listdirectorydetails; webresponse response = requestdir.getresponse(); log(loglevel.debug, "good"); } catch (exception ex) { log(loglevel.debug, "bad"); } } if username / password invalid, last thing that's logged "just entered try block". code somehow silently errors-out , never logs "bad". if credentials valid, continues execution , logs "good&quo

c++ - Pass Variable arguments from function to another with variable arguments -

i have following function shouldn't change not break dependencies void trace( __in dbginfo dbginfo, __in_z _printf_format_string_ const wchar* pwszmsgformat, ...) { // code need }; i need call function has ... args: #define trace_line( format, ... ) _trace( loglevelinfo ,format, __va_args__ ) #define _trace( mask, format, ... ) \ ((mask) & g_loglevel) \ ? traceglobal::traceline( mask, l"[" __filew__ l":" _blob_wide(_blob_stringize(__line__)) l"] " l"myservice!" __functionw__ l": " format , __va_args__ ) \ : (void)0 void servicetracing::traceglobal::traceline( _in_ loglevel level, _in_z_ pcwstr format, _in_ ...) /** routine description: trace formatted line level tracing arguments: level: enum level of trace line format: string format ...: variable arguments

jQuery wrap tr and div from ajax response -

the ajax response contains html , has 2 elements tr , div . need append tr table , need move div other place. apparently wrapping tr , div giving me tr (maybe because not valid html). how can split them have tr in 1 variable , div in other (i can use regex replace split tr , div first , wrap them separately, regex dangerous , not 100% accurate specially on html tags). consider this: var ajax_response = "<tr><td>hello</td></tr><div>move me</div>"; var $container = $(ajax_response).wrap("<div />").parent(); alert($container.html()); // has tr not div that invalid html structure. browser move div outside table. since tr being appended div not visible. the option move div inside td var ajax_response = $('<output/>').append('<tr><td>hello<div>move me</div></td></tr>'); var div = ajax_response.find('div').remove(); var tr = ajax_resp

Removing gaps in data frame preserving pairs (R) -

i have basic question in r can't seem sorted. have dataframe looks this: date x y 1 01/01/2003 00:00 17.04783 na 2 02/01/2003 00:00 14.84500 10.117042 3 03/01/2003 00:00 12.23636 na 4 04/01/2003 00:00 12.62381 na 5 05/01/2003 00:00 na 4.516619 6 06/01/2003 00:00 12.93333 na i'm interested in cases there both x value , y value, i.e. in above data im interested in row 2. how create new data frame cases i'm interested in? need preserve date structure too, ideal data this: date x y 1 01/01/2003 00:00 na na 2 02/01/2003 00:00 14.84500 10.117042 3 03/01/2003 00:00 na na

How to save an NxNxN array (or Matrix) into a file in Julia (or Python)? -

i'm working on jupyter notebook , using julia i'm trying save 3x3x3 array textfile when include in notebook, array 3x3x3 array too. any suggestions? in advance. you use jld.jl (julia data) package: pkg.add("jld") using jld r = rand(3, 3, 3) save("data.jld", "data", r) load("data.jld")["data"] the advantage of jld package preserves exact type information of each variable.

Javascript custom function with a check inside for loop -

i'm overcomplicating things...and it's difficult explain i'll show code here: for (var = 0; < x.length; i++) { (function(i) { if (x[i].classname === 'ru') { x[i].style.display = 'none'; if (x[i].previoussibling.tagname === 'br' && x[i].previoussibling.style.display != 'none') { x[i].previoussibling.style.display = 'none'; } } })(i); } that works fine create function inside loop check each x[i].previoussibling if of type 'br'. need declare function loop until reaches element not 'br' tag. tried: for (var = 0; < x.length; i++) { (function(i) { if (x[i].classname === 'ru') { x[i].style.display = 'none'; var check = true; var = ''; function foo() { while (check) { if (x[i].previoussibling.tagname === 

How do I un-namespace a ruby constant? -

i using library doesn't handle namespaced models. have rails engine has activerecord models need use , such reference them namespace of engine, ex: tableengine::posts. is there way in ruby un-namespace posts class? something tableengine::posts.demodulize # => posts at first can add constant need , assign class/module (remember both objects). should duplicate reset name: posts = tableengine::posts.dup afterwards remove source constant name: object.send :remove_const, :tableengine then: posts # => posts tableengine # => nameerror: uninitialized constant tableengine tableengine::posts # => nameerror: uninitialized constant tableengine update . why dup needed: notice, class someclass shortcut creating object of type class , assigning constant: someclass = class.new when create class, name value isn't set: klass = class.new # => #<class:0x00000001545a28> klass.name # => nil when assign constant first time, name ass

How dspace batch metadata edit is safe from producing data inconsistencies? -

i wonder how handled batch metadata edit in dspace, such avoid data inconsistency. more specifically, let have item archived. still in review workflow. let reviewing metadata of item, while batch edit being done else. i wonder happens in case. indeed, person have page metadata value changed in background. what happens when person save item ? erase operation of batch edit ? i need implement functionality similar batch edit, is, operation change record on background time time. has taxonomy management. hence, wonder options update item metadata values in background, such not interfere item being reviewed. many in advance. m i'm not sure there safeguards in place type of scenario. option run background work outside of reviewers' work hours? or option background work curation task hooked review workflow?

How to get rid of "Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties" message? -

i trying suppress message using spark's default log4j profile: org/apache/spark/log4j-defaults.properties when run spark app. i've redirected info messages successfully, message keeps on showing up. ideas appreciated. even simpler cd spark_home/conf mv log4j.properties.template log4j.properties open log4j.properties , change info error . here spark_home root directory of spark installation. some may using hdfs spark storage backend , find logging messages generated hdfs . alter this, go hadoop_home/etc/hadoop/log4j.properties file. change hadoop.root.logger=info,console hadoop.root.logger=error,console . once again hadoop_home root of hadoop installation me /usr/local/hadoop .

performance - Slow upload with .csv files and PHP -

i've created function upload csv files using php , insert contents mongo database. the upload taking time completed , don't have idea how build better code this. bellow function in php: public function importemail($file,$list_name,$header){ $data = $this->readcsv($file, $has_header); global $email; $falhas = 0; array_shift($data); if($data === false) { return false; } else { foreach($data $key => $value) { $email->email = $value[$header["email"]]; $email->first_name = $value[$header["fname"]]; $email->last_name = $value[$header["lname"]]; $email->gender = strtoupper($value[$header["gender"]]); $email->status = $value[$header["status"]] !="" ? $value[$header["status"]] : "1"; $email->list_name = $list_name; $email-&g

C# WPF Partially search DataGridView -

i have window in bind datagrid source datatable tree-like structure. in window, have textbox, , 2 buttons ("contains", , "exact"). , following sample data (in text), along table image: comedy english 21 jump street c tatum j hill 22 jump street c tatum j hill dumb , dumber j carrey j daniels action english mission impossible 5 t cruise j renner hindi singham devgn k agarwal http://oi58.tinypic.com/301mtko.jpg i have few things do: using text entered , depending on button clicked, i'd filter last column (lead actor) of gridview (just update grid view, not saving datatable). example, typing "tum" , clicking 'exact' similar search done datatable using dataview, in case, returning nothing. when 'contains' button clicked, should return (gridview table): comedy english 21 jump street c tatum 22 jump street c tatum and &#

if statement - chained if-else not working (C++) -

i'm beginner , having trouble chained if-else statement. when run program, , enter item select, outputs "invalid entry.". why isn't executing proper function when equal in if-statement? thank you, don #include <iostream> using namespace std; int sum(int int1, int int2 ){ return int1 + int2; } int difference( int int1, int int2 ){ return int1 - int2; } int product( int int1, int int2 ){ return int1 * int2; } int quotient( int int1, int int2 ){ return int1 / int2; } int main(){ cout << "\nwelcome calculator.\n\n"; cout << "please enter 2 numbers.\n\n"; int a; int b; cin >> >> b; cout << "what these numbers?\nhere options: add, subtract, multiply, or divide.\n\n"; string add; string subtract; string multiply; string divide; string choice; cin >> choice; if( choice == add ) cout << sum( a, b ); else if ( choice == subtract ) cout << dif

VBA Word Macro: Save As existing .docx file name with standard prefix -

i trying construct macro takes active document , saves same file name adds non-variable prefix. the document working has hyperlinks, which, according internet, appears reason unable use code: sub saveasdigital() ' ' flatten macro ' ' activedocument.saveas2 filename:=activedocument.path & application.pathseparator & "digital_" & activedocument.name end sub this returns run-time error '4198' relates hyperlinks being present in document (i cannot afford rid of these) any appreciated!thanks!

javascript - Allowing user to rearrange entries in Django admin site and how to store that new custom order to survive page refresh? -

i have html , javascript in place allows user move django database entries (displayed in table) , down. however, there way can store new order user has customized show time user navigates specific page view? think get_queryset causing page (after refreshing) switch basic filtering. but, have no ideas on how override or avoid accomplish task. appreciated! i suggest using ready solutions: django-admin-sortable or django-admin-sortable2 . me, have used second solution , works. 1 important note run ./manage.py reorder my_app.models.mymodel after adding new order field mentioned here .

.net - Edit a excel file while Exporting data from ms access to other excel file using c# without error occur -

i wrote program export data ms access excel. working properly. there error occur while editing or open other excel files. how solve error. " exception hresult: 0x800ac472 " private void writeexcel(system.data.datatable dt, string filename) { microsoft.office.interop.excel.applicationclass excel = new applicationclass(); microsoft.office.interop.excel.workbook wb = excel.workbooks.add(true); microsoft.office.interop.excel.worksheet wsht; int colid = 0; int rowid = 0; wsht = (microsoft.office.interop.excel.worksheet)wb.sheets[1]; range rng = wsht.get_range("a1", "iv" + (dt.rows.count + 1).tostring()); rng.numberformat = "@"; //fill column heading foreach (datacolumn col in dt.columns) { colid++; excel.cells[1, colid] = col.columnname; } } //fill row values foreach (datarow d

Unable to run Java code with Intellij IDEA -

Image
i have downloaded ide, , want edit first java file it, i'm not interested in creating whole project, editing single file. so opened file desktop intellij idea set default program opening .java files. i write code , main run , debug buttons greyed out! can't run code! i have installed java 8 update 45 64-bit (i have 64 bit os) java development kit (j8u45). have set global ide sdk jdk installation, , when prompts me set project sdk, still run , debug buttons unable used! edit: unable run file regardless of if in project or not. edit 2: screenshot of project setup move code inside of src folder. once it's there, it'll compiled on-the-fly every time it's saved. intellij recognizes files in specific locations part of project - namely, inside of blue folder considered source code. also - while can't see all of source code - sure it's proper java syntax, class declared same file , has main method (specifically public static void main(

python - How to have parameters to a button command in tkinter python3 -

this question has answer here: python tkinter: passing arguments button widget 1 answer commands in tkinter when use lambda , callbacks 2 answers i want have ui when press button, stuff pops in console. issue stuff prints console before press button. after testing, have found if don't use parenthesis call function in command argument, works fine. ex: function called hello prints hello world in console, call button=button(master, command=hello) instead of button=button(master, command=hello()) the issue way can't use parameters. here example of code similar mine: index={'food':['apple', 'orange'], 'drink':['juice', 'water', 'soda']} names=['food', 'drink'] def display(list): item in l

unity3d - Unity procedural TileMap generation without creating gameobject per tile -

i've been searching on internet find efficient way create procedural tilemap without creating gameobject per each tile. there none, or couldn't find it, because don't know how make search it. tilemap tutorials found creating tiles creating hunderds of gameobjects. hierarchy in unity expanding uncontrollably. i'm pretty sure not "right" way it. after seeing new unity 2d tools supports tilemaps. unity made so, can create tiles in "one" gameobject, not each tile. how in right way? given sole task of "creating efficient tilemap", best option create tilemap component manages procedural mesh made of collection of independent quads uvs mapped tile atlas. way draw whole map in 1 drawcall. you'd need know thing or 2 how meshes work, , texturing. it's simple, , if don't know curious it, catlikecoding's tutos starting point . in tuto each quad on grid shares vertices, you'd want independent quads, texture them p

asp.net web api - Odata endpoint returning 404 bad request when the "$" in filter is encoded -

i have azure mobile service .net end. in backend data object use proper case. example, membernumber. in azure client view models use pascal case membernumber. i using library creates odata request , get: query specified in uri not valid. not find property named 'membernumber' on type 'arenaapi.dataobjects.members'. that happens get: /tables/members?%24inlinecount=allpages&%24orderby=membernumber if change membernumber works. however, also, if change request to: /tables/members?%24inlinecount=allpages&$orderby=membernumber it works. seems model binding parser working differently if $ encoded or not. is there way can fix server side encoded request won't return 400 without changing membernumber membernumber? all other stuff, posting, patching, etc binding pascal cased json post proper cased c# data objects.

java - JavaFX : Button never sets a graphic -

edit : a mcve version of code has been made debug it. reproduces bug. purpose of code doing memory game. means when turn, "open" card, one. if form pair, don't turned over, stay open. otherwise, turn them on , try find pair on next turn. simply put, bug : when opening second card of turn , both cards don't form pair, second 1 never gets opened! hopefully, version of code find bug, me lot! i have put code on github : https://gist.github.com/anonymous/e866671d80384ae53b53 (and find attached @ end of question) explanation of issue i having fun on doing little memory game in javafx , came across strange behavior card click on (represented custom class extends button class) never changes image displayed. normally, when click on card, "opens" changing graphic displays. strange , annoying thing happens in specific case. the behavior of card correct when "open" first card of turn of player. works when "open" second 1 , bot

css - Overlaying a floating full width sidebar on HTML pages -

i developing feature existing site, floating full height sidebar can pop in left side. is possible develop without changing markup , css of original pages? ideally want plugin can added existing page. i don't need javascript making slide in side, i'm trying establish best solution css ensure it's full height. within sidebar itself, content should scrollable. this sample code should show i'm trying achieve: body { background: #ccc; /* ignore */ } .bspec { z-index: 9999; position: absolute; top: 0; left: 0; width: 400px; } .bspec-content { display: table-cell; padding: 10px; overflow-y: scroll; max-height: 500px; background: #fff; color: #666; } .bspec-toggle { display: table-cell; background: #f00; width: 20px; cursor: pointer; } <html> <body> <div class="content"> <!-- existing page markup, ideally left alone --> </div> <!-- add side

In reStructuredText, how does one do an 'inline' include of an external document fragment? -

i have bullet lists of hyperlinks articles, each article has one-line summary. and, one-line summary appear in bullet list: thing1 : thing. thing2 : thing. because (1) summaries quite involved, (2) have many articles, , (3) more bullets, i'd put summaries own document fragments , 'include' them in both bullet list , article. but, this not fly in restructuredtext: * `thing1`_: .. include:: summary-of-thing1.txt * `thing1`_: .. include:: summary-of-thing2.txt the text .. include:: summary-of-thing1.txt ends in generated html document, , appears because directives (like .. include:: ) must in own 'paragraph' this: * `thing1`_: .. include: summary-of-thing1.txt but, doing puts document fragment own paragraph, makes this: thing1 : this thing. thing2 this thing. when, want summaries appear on same line hyperlinks. ok, see .. replace:: for. 1 can this: * `thing1`_: |summary-of-thing1| * `thing2`_: |summary-of-thing2| .. in