Posts

Showing posts from August, 2013

ios - two UITableViews inside one UIViewController -

i have 2 uitableviews (tableview , tableviewevent) on same controller. unfortunately, xcode not allowing me this. want below: - (nsinteger)tableview:(uitableview *)table numberofrowsinsection:(nsinteger)section { if (uitableview == self.tablevie) { xcode keeps wanting change code below, problem crashes on other tableview (tableviewevent). how this? - (nsinteger)tableview:(uitableview *)table numberofrowsinsection:(nsinteger)section { if (tablevie == self.tablevie) { lastly, tables not return cells (even though nslog shows data there). i'm using cellsatrowforindex: - (uitableviewcell *)tableview:(uitableview *)tv cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *myidentifier = @"cell"; if ([uitableview isequal:self.tablevie]) { it should be: if (table == self.tablevie) { to compare parameter instance variable. might want consider using container view controller approach , having separate controllers each of tables

virtual machine - Understanding availability set in Windows Azure -

i reading explanation of availability sets on microsoft' website can't 100% understand concept. http://www.windowsazure.com/en-us/documentation/articles/manage-availability-virtual-machines/ there many questions people ask in comments, there no technical support microsoft there answer them. as understand availability sets can duplicate vm iis application , vm sql, means have use 4 vm(pay 4) instead of 2. means whenever iis1 virtual machine down, website still online of iis2 virtual machine , vice versa? same goes sql1 , sql2 virtual machines? am going right direction? if case, how keep data synchronized in sql1 , sql2, iis1 , iis2 virtual machines @ same time, website still latest data , code if 1 vm down updates? an availability set combines 2 concepts windows azure paas world - upgrade domains , fault domains - make service more robust. when several vms deployed availability set windows azure fabric controller distribute them among several upgrade domains

mysql - "if not exists" SQL Statement Giving Error -

this question has answer here: mysql: insert record if not exists in table 15 answers i have following sql query running , giving me error 1064, syntax error. if not exists (select * locations street_address = 'test') begin insert locations (street_address) values ('test') end; can please me out? seems simple yet not run. thanks. also, i'm running mysql version 5.6.11 also can try this insert locations (street_address) select 'test' dual not exists ( select * locations street_address = 'test' ) limit 1;

R - How to select dominant b1-value and count(b2) and make b2 values column headings -

sample data: a <- as.data.frame(matrix(list(1,1,3,4,1,1,3,4,1,1,3,4,1,1,3,4,1,1,3,4),4,5)) b1 <-c(30,40,20,15) b2<-c("a","a","b","c") b <-as.data.frame(cbind(b1,b2)) a.b<-cbind(a,b) inital value: a.b row v1 v2 v3 v4 v5 b1 b2 1 1 1 1 1 1 30 2 1 1 1 1 1 40 3 3 3 3 3 3 20 b 4 4 4 4 4 4 15 c what see v1, v2, v3, v4, v5, b1 max(b1), a, b, c there should 3 rows: row v1 v2 v3 v4 v5 b1 b c 1 1 1 1 1 1 40 2 0 0 3 3 3 3 3 3 20 0 1 0 4 4 4 4 4 4 15 0 0 1 how go getting that. have thought of aggregate, cast, , reshape, have run difficulty. thks. this looks lapply(split(...)) problem. untested , assumes not use as.data.frame(cbind(...)) lapply(split(df, df[2:6]), function (d){ cbind( max( d[7]), table(d[8]) )}) the reason not use character comparison "4" > "15" returns true.

java - Replacing the values in the original array to the new one -

i have got interface - //interface - public interface intsequence { int length(); int get(int index); void set(int index, int value); /** * returns contiguous subsequence of size "size" starts * index "index" , backed sequence; * is, changing through {@link intsequence#set(int, int)} * affects original sequence well. * @param index starting position of subsequence * @param size subsequence size * @return sequence of ints */ intsequence subsequence(int index, int size); } and class implements - public class intarray implements intsequence { int[] a; static int test; static int[] b; static int[] c; int[] d; int use; int j; int[] mama; int[] mama2; int indexgeter; public intarray(int size) { j = size; = new int[size]; b = new int[size]; = b; } public intarray(int index, int size, int[] array) { this.a = arr

javascript - POST array with jQuery and Ajax -

i have form multiple fields, whereby fields can added. the form follows: <form id="myform" action="myfile.php" > <input . . > <select>. . . </select> </form> myfile.php has following code: foreach ($_post $key => $value) { echo $key." takes <b>".$value."</b> value"; } this simple code processes entries of form regardless how many. now, want is: when click on submit button, instead of sending form's content script, array , pass ajax without having write every single key , value manually. i hope makes sense i think looking serialize() jquery(function ($) { //submit handler $('#myform').submit(function (e) { //prevent default submit e.preventdefault(); $.ajax({ url: $(this).attr('action'), type: 'post', data: $(this).serialize(), .... }) }); })

Python - Write a for loop to display a given number in reverse -

this question has answer here: using python, reverse integer, , tell if palindrome 8 answers how have user input number , have computer spit number out in reverse? num = int(input("insert number of choice ")) in that have far... using 3.3.4 you don't need make int , again make str! make straight this: num = input("insert number of choice ") print (num[::-1]) or, try using loop: >>> rev = '' >>> in range(len(num), 0, -1): ... rev += num[i-1] >>> print(int(rev)) best way loop on python string backwards says efficient/recommended way be: >>> c in reversed(num): ... print(c, end='')

winapi - Can I download the Visual C++ Command Line Compiler without Visual Studio? -

as per title. don't want download entire visual c++ installer, "cl.exe" , other programs required compiling , linking c++ programs on windows. in 2014 not download visual c++ compiler alone microsoft. it used could. used in platform sdk. installing visual studio. happily, @ time, compiler bundled visual studio express desktop (the free version of visual studio @ time) was, , is, same professional or universal editions. in november 2015 microsoft again started providing compiler tools in free-standing package called visual c++ build tools . microsoft writes: ” c++ build tools installer not run on machine visual studio 2015 installed on it. reverse (i.e. upgrade visual studio) supported. the long term situation is, always, unclear. and, disclaimer: have not used build tools myself – have uninstall visual studio first.

Why horn formulas algorithm is greedy? -

Image
i understand horn formula , follow: but cant understand why taught in section related greedy algorithms, can not see greedy part of horn formula. can help? the algorithm greedy in tries build satisfying assignment unsatisfying assignment incrementally flipping variables true. can viewed "greedy" because algorithm makes local decisions (make true in order satisfying specific clause without regards happens later) rather global decisions, , never backtracks decisions (unlike many other sat solving algorithms). hope helps!

docker - Start container in existing cgroup -

i'm looking write custom mesos executor allow doing things requesting 1cpu(1024 shares) rails application, , "plugging in" nginx in front. in process, i'd start rails , nginx containers using same shared 1024 cpu shares. i understand cgroups hierarchical, , should able like base(1024 shares) / \ nginx(no limit) rails(no limit) or rails(1024 shares) | nginx(no limit) so still use 1 cpu, containers share resources , linked. looking through cgroups , lxc docs, couldn't find obvious pass docker's -lxc-conf=[] option allow me tell nginx started start under pre-existing cgroup created started rails container. another thing need consider while want rails , nginx share 1024 cpu shares, don't want either know other or have access each other's data unless have deliberately shared /public volume rails or something. any advice here appreciated! docker doesn't support (yet). here possible workarou

ruby on rails - Activeadmin render 'new' gives Couldn't find User without an id when trying to override the create controller method -

i'm trying create page in activeadmin user can go in , create new user accounts. i'm overriding default create method user model code below. i'm getting error couldn't find user without id when try render new page. why getting error when trying re-render new action? activeadmin.register user permit_params permitted = [:email, :encrypted_password] permitted << :admin if current_user.is_admin? permitted end # we're overriding new , edit controller methods create users devise. otherwise passwords don't encrypted controller def create user = user.new user.name = params[:user][:name] user.email = params[:user][:email] user.admin = params[:user][:admin] user.password = params[:user][:encrypted_password] user.password_confirmation = params[:user][:encrypted_password] if user.save redirect_to admin_user_path(user) else flash.now[:error]

Constants in Android xml file -

i have code in android settings xml file (res/xml/settings.xml): <edittextpreference android:title="@string/settings_date_format" android:summary="@string/settings_date_format_summary" android:key="settingsdateformat" android:defaultvalue="@string/config_settings_date_format_default_value" /> and string this: <string name="config_settings_date_format_default_value">dd mmm yyyy, hh:mm</string> as can see, i'm setting default value string. however, i'd have these default values stored somewhere else doesn't make sense put them in res/values/strings.xml is possible me put them in new file called "config.xml" example? you can add xml file in values folder , name want. on compilation time, compiler scan resources folders, regardless of files , names, , create lookup table resources.

Copy the contents of a 1D array to another by value in C -

i'm trying copy value contents of dynamically-allocated array stillplaying tmpintarray long value isn't -1 , ie tmpintarray should hold values in stillplaying , sans -1 . i error message subscripted value neither array nor pointer nor vector when attempting compile. tmpintarray = (int*) malloc(nparticipantsleft*sizeof(int)); for(i = 0; < nparticipantsleft; i++) { if (stillplaying[k] == -1) k++; tmpintarray[i] = stillplaying[k]; } thanks helping me out easy question. declaration @ top of file: int * stillplaying, //points array of ids players not out tmpintarray; //holds intermediate version of stillplaying besides wrong declaration of tmpintarray should int *tmpintarray , think code should this: int j = 0; for(i = 0; < nparticipantsleft; i++) { if (stillplaying[i] != -1) { tmpintarray[j++] = stillplaying[i]; } } // j contains number of players in tmpintarray

postgresql - installing postgres via puppet with customer data_directory -

i'm trying install postgres 9.1 on ubuntu 12.04 machine using puppet v3.4.3 , puppetlabs/postgresql module v3.3.0. want data_directory point large disk i've mounted. if change datadir property of postgresql::globals doesn't seem anything. postgres.conf file still has data_directory pointing /var/lib/postgresql/9.1/main tried using postgresql::server::config_entry change data_directory param in postgres.config gives following error: debug: executing 'service postgresql reload' notice: /stage[main]/postgresql::server::reload/exec[postgresql_reload]/returns: * reloading postgresql 9.1 database server notice: /stage[main]/postgresql::server::reload/exec[postgresql_reload]/returns: * pg_ctl: pid file "/data/pgdata/postmaster.pid" not exist notice: /stage[main]/postgresql::server::reload/exec[postgresql_reload]/returns: server running? notice: /stage[main]/postgresql::server::reload/exec[postgresql_reload]/returns: ...fail! error: /stage[main]/postg

mysql - Formula Query on PostgreSQL -

my input data this wavelength reflectance 341.6 1.15 343.1 1.14 344.7 1.13 346.3 1.14 347.9 1.14 349.5 1.12 351.1 1.12 352.6 1.13 354.2 1.13 i using formula query with cte as( select row_number() over( partition cast(wavelength int) -cast(wavelength int)%5 order wavelength) row_id, wavelength, avg( reflectance ) over( partition cast(wavelength int) -cast(wavelength int)%5 order wavelength rows between 1 following , unbounded following) reflectance test ) select trunc(wavelength/5)*5 wavelengthwavelength, reflectance cte row_id = 1 in query povides output this wavelength reflectance 340 2.6400000000000000 340 2.5200000000000000 345 2.5200000000000000 355 2.5500000000000000 360 2.4250000000000000 365 2.46500

How to run a SQL Server 2008 R2 Database Script using sqlcmd in C#? -

i new run sql scripts using sqlcmd in c#. saw code in internet not understanding how works. string path = string.empty; openfiledialog opd = new openfiledialog(); opd.filter = "sql files|*.sql"; if (opd.showdialog() == dialogresult.ok) { path = opd.filename;//here taking database sqlscript } string tmpfile = path.gettempfilename(); sqlconnectionstringbuilder connection=new sqlconnectionstringbuilder(@"data source=lptp2\lptp2;initial catalog=database;integrated security=true"); string argument = string.format(@" -s {0} -d {1} -i ""{2}"" -o ""{3}""", @".\sqlexpress", "database", path, tmpfile); // append user/password if not use integrated security if (!connection.integratedsecurity) argument += string.format(" -u {0} -p {1}", "sa"

python - Why is "django.core.context_processors.request" not enabled by default? -

i troubleshooting problem obtaining request obj new project , realized "django.core.context_processors.request" commented in vanilla installs of django. like title suggests, why seemingly helpful context processor turned off default? is issue performance? is issue security? is somehow redundant? some mild searching has not turned me, thought i'd ask here. this question. docs note processor not enabled default; you’ll have activate it. no explanation. my take on due django's intense desire separate view logic template. the request object gateway data view logic built (given browser sent us, x, y, z) - therefore allowing in templates akin giving template huge amounts of control should placed in view under normal circumstances. idea populate template context specifics, not everything . removing them more encouragement "most things should done in view". common django.contrib apps don't rely on it, if it's not required defau

php - CodeIgniter select dropdown box with for loop -

i try create loop select box select time start 8.00 , increasing continusly matter found solution creating loop time incremented 15 minutes put code under array shows 1 time use var_dump($timeinoption) shows correctly as array (size=1) '8 . 0' => string '8 . 0' (length=5) array (size=1) '8 . 15' => string '8 . 15' (length=6) array (size=1) '8 . 30' => string '8 . 30' (length=6) array (size=1) '8 . 45' => string '8 . 45' (length=6) array (size=1) '9 . 0' => string '9 . 0' (length=5 but codeignaiter select box not work; form_dropdown('timein',$timeinoption,'8.30'); it shows 1 time on select box echo form_label('time start','timestart'); ($i = 8; $i <= 17; $i++) { ($j = 0; $j <= 45; $j+=15) { //inside inner loop $opti= $i.' . '. $j; $timeinoption=array($opti=>$opti) ; } //inside outer loop

mysql - Get Multiple COUNTS Multiple JOINS from Schedule table -

i have 3 tables: test_member , test_member_addon & test_schedule . a member can have 1 test_member.type (test_schedule.prod_type = 1) a member can have multiple test_member_addon.type (test_schedule.prod_type = 2) i trying return distinct counts each distinct test_schedule.mem_id, test_schedule.prod_code in schedule future dated , schedule . status = 1. schedules should have correct amount of payments eg. 52 'weekly'. if correct & actual not match, can fix. my query: not return correct values amount , period , correct or actual . select distinct s.mem_id, case when s.prod_type = 1 round(m.next_amount,2) else round(ma.next_amount,2) end amount, case when s.prod_type = 1 m.period else ma.period end period, case when s.prod_type = 1 ( case when m.period = 'weekly' 52 when m.period = 'fortnightly' 27 end ) else ( case when ma.period = 'weekly' 52 when ma.period = 'fortnightly' 27 end ) end correct, count(*) actual

twig - Passing variable value inside setcontent in bolt.cm -

i'm using framework called bolt.cm. simple framework based on silex. there twig function records of specific contenttype : {% setcontent products = 'products' %} to record , order them specific field : {% setcontent products = 'products' orderby 'datepublish' %} above fetch records ordered datepublish field. now, wanted pass orderby field parameter. store parameter in global twig variable passed controller, defined sort_by variable. {{ sort_by }} above print sort_by value html. in page : /products?sort_by=datepublish set sort_by value datepublish i'm going combine variable setcontent function described below : {% setcontent products = 'products' orderby sort_by %} now i'm getting error : an exception has been thrown during compilation of template ("attribute "value" not exist node "twig_node_expression_name".") in "products.twig". my question simply, how make sort_by recogni

python - Flask app won't load in browser -

i'm getting started flask , i'm trying build tutorial micro-blog using redis. here app: from flask import flask, render_template, request, url_for, redirect import redis datetime import datetime app = flask(__name__) app.config.from_object(__name__) app.config.update(dict( debug = true, )) pool = redis.connectionpool(host='localhost', port=6379, db=0) @app.route("/") def index(): r = redis.strictredis(connection_pool = pool) print r pipe = r.pipeline() print pipe last_ten = pipe.zrange('post:created_on', 0, 9) print last_ten posts = [] post in last_ten: posts.append(pipe.hgetall('{}{}'.format('post:', post))) print posts pipe.execute() return render_template('index.html', posts) @app.route('/new', methods = ['post']) def addpost(): r = redis.strictredis(connection_pool = pool) title = request.form['title'] author = re

java - Netbeans code prediction -

i using netbeans couple of days learn java. have used visual studio before c# , @ predicting can not find netbeans. found ctrl , space code completion annoying use them everytime. rather expect visual studio. let me know if there plugin or built in option code prediction in netbeans. thanks netbeans ide java prefer intellij idea there community version free of charge try it, link below. http://www.jetbrains.com/idea/

ios - What`s the compression ratio of NSData from AVCaptureStillImageOutput? -

use jpegstillimagensdatarepresentation : method can nsdata avcapurestillimageoutput , can write data file. nsdata * imagedata = [avcapturestillimageoutput jpegstillimagensdatarepresentation:imagesamplebuffer]; just imagesamplebuffer turn nsdata . can compression radio in method, or there index measure this? just uiimagejpegrepresentation(uiimage* image, 1.0) this, has 1.0 measure compression radio image. you can control compression (0-1) used avcapturestillimageoutput. [stillimageoutput setoutputsettings:@{avvideocodeckey : avvideocodecjpeg, avvideoqualitykey:@1.0}]; see avcaptureoutput.h , avvideosettings.h: avvideoqualitykey supported on ios 6.0 , later , may used when avvideocodeckey set avvideocodecjpeg. avvideoqualitykey nsnumber (0.0-1.0, jpeg only) you can verify key works looking @ size of data different values. default value don't think it's 1.0 because when set 1.0 size bumps bit , didn't setup tripod attempt take same pic....

php - Wordpress Custom Fields -

i'm new php, confusing me little. i'm using woocommerce plugin wordpress , i'm trying add custom field display rental prices products. however, not products have rental option, want display on products give rental price. here's code i'm using, works fine. problem displays rental price of $0 on products haven't specified rental price. instead of display $0, want not display @ all. //add rental field add_action( 'woocommerce_product_options_pricing', 'wc_rent_product_field' ); function wc_rent_product_field() { woocommerce_wp_text_input( array( 'id' => 'rent_price', 'class' => 'wc_input_price short', 'label' => __( 'rent', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')' ) ); } //save rental field add_action( 'save_post', 'wc_rent_save_product' ); function wc_rent_save_product( $product_id ) { // if auto save nothing, sa

Split string in java giving some issues -

this question has answer here: how compare strings in java? 23 answers public class llearning1 { public static void main(string[] args) { string text = "is"; string x = "what good"; string y[] = x.split(" "); (string temp: y) { if (temp == text) { system.out.println("found"); } else { system.out.println("nothing"); } } } } output: expected : code should display "found" but displaying "nothing" compare string equals() method not == operator == operator used compares reference of object. change i f (temp == text) if (temp.equals(text))

excel - How to export specific modified data from .xlsm to an existing .c file using VBA -

i'm new in vba, please excuse me if sounds not smart question. so, have .xlsm file, select , modify data based on search criteria. have been able successfully, , displaying on sheet. however, problem arises now- required take data, , put in particular format in existing .c file (whose path given input) for example: .xlsm sample data part numbers aaaa1 bbbb2 cccc3 dddd4 .c sample data ... ... { 0, ..., {'a','a','a','a','1'}, //part number in format ...., } { 1, ..., {'b','b','b','b','2'}, ...., } { 2, ..., {'c','c','c','c','3'}, ...., } { 3, ..., {'d','d','d','d','4'}, ...., } how go this?

primary key - Assign same column value on a row repitition in mysql -

how achieve in mysql? id column primary key if same occurances of value1 , value2 occurs,assign same id value repeating row,as highlighted below id | value1 | value2 1 | | b 2 | c | d 1 | | b 2 | c | d 3 | e | f this not possible. primary key dictates that value (or values in case of composite key) must unique within table. there couple of options available: remove primary key (and perhaps instead create index) if rows must saved way in duplicate do query within application logic determine whether to-be-inserted row data exists, , in such case don't perform insert create query same (2), perhaps insert .. not exists clause

android - How to extract data from mysql for listview in tab? -

i had created activity class , fragments each of listview. each tab display list of items according category in tab. activity class: public class displaypostitem extends fragmentactivity implements actionbar.tablistener { private static final string state_selected_navigation_item = "selected_navigation_item"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_display_post_item); // set action bar. final actionbar actionbar = getactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); // each of sections in app, add tab action bar. actionbar.addtab(actionbar.newtab().settext("books").settablistener(this)); actionbar.addtab(actionbar.newtab().settext("lab coat").settablistener(this)); actionbar.addtab(actionbar.newtab().settext("tools").settablistener(this)); actionbar.addtab(actionbar.newtab().settext(&

python - Invalid Syntax - Logic Error -

can check on bit of code? i'm getting invalid syntax without explanation. needs know when input between 8-40 go through overtime_hours = 0, , when input 41-86 needs go through overtime_hours = original_hours - 40. while original_hours < 8 or original_hours > 40: overtime_hours = 0 elif original_hours > 41 or original_hours < 86: overtime_hours = original_hours - 40 this homework assignment, , part of larger payroll program. if want use elif , must have if first. also, conditions seems bad, try this: if 8 <= original_hours <= 40: overtime_hours = 0 elif 41 <= original_hours <= 86: overtime_hours = original_hours - 40 or this: if original_hours in range(8, 41): overtime_hours = 0 elif original_hours in range(41, 87): overtime_hours = original_hours - 40 note range(a, b) includes a doesn't include b . that's why should use range(8, 40+1)

sql - To find total number of rows -

i have table this table1 ======= b 8 5 2 9 null 4 2 5 how find total number of rows table1,note if column value null in row row should considered 2 rows? i have tried count(*)*2 , nvl function doesn't work try this select sum(case when null or b null 2 else 1 end) countval table1 fiddle demo o/p: countval -------- 5

javascript - How to display location on markers of google maps when clicked? -

i have extracted latitude , logitude database tables , have shown on google maps markers.now want location displayed on markers when clicked.i tried lot couldn't find way.can please suggest how shall proceeed?i giving sample code may you.kindly me out. <?php $dbname='140dev'; $dbuser='root'; $dbpass='root'; $dbserver='localhost'; $dbcnx = mysql_connect ("$dbserver", "$dbuser", "$dbpass"); mysql_select_db("$dbname") or die(mysql_error()); $sql = mysql_query("select * tweets1"); $res = mysql_fetch_array($sql); $lat_d = $res['geo_lat']; $long_d = $res['geo_long']; // mimic result array mysql $result = array(array('geo_lat'=>$lat_d,'geo_long'=>$long_d)); ?> <!doctype html> <html> <head> <script type="text/javascript" src="http://maps.googleapis.com/ma

java - hashCode method called for System.out.println() method in HashSet -

import java.util.hashset; import java.util.set; class employee { @override public int hashcode() { system.out.println("hash"); return super.hashcode(); } } public class test2 { public static void main(string[] args) { set<employee>set= new hashset<>(); employee employee = new employee(); set.add(employee); system.out.println(set);// if comment "hash" printed once } } above code calls hashcode method 2 times if print set. why hashcode method called on system.out.println()? see this . in short, default tostring() function calls hashcode() , uses hexadecimal representation of hash part of string.

javascript - jQuery is(":first") takes no effect -

i use jquery is(":first") judge whether element first in siblings, return false. there wrong? or bug of jquery? thx. $(".page:first").is(":first"); //always return false. to test whether first found .page element first sibling can use .index() : if ($('.page:first').index() == 0) { // it's first child } or simply: if ($('.page').index() == 0) { // it's first child } the .is() function works matching current result set against given selector, first element of document, i.e. <html> . $('html').is(':first') true .

java - javax.swing.JOptionPane cancel button loop -

i trying write while loop allow app keep running until user pushes cancel on joptionspane . how do this? i'm using javax.swing.joptionpane cancel button loop. this code far cancel button not work. import java.io.*; import javax.swing.joptionpane; public class mytype2 { public static void main(string[] args) { string strchoice, strtrystrig, strtryint, strtrydouble; int choice, tryint; double trydouble; boolean done = false; while(!done) { try { strchoice = joptionpane.showinputdialog(null,"whats type?" + "\n\n1) string\n2) interger\n3) double\n4) quit program\n "); choice = integer.parseint(strchoice); switch(choice) { case 1: if (choice == 1) joptionpane.showmessagedialog(null,"correct , input can saved string.", "result",joptionpane.informat

javascript - dataTable header with rowspan resizes and mess UI -

Image
i had been developing screen has lots of data . scrolling datatable.(horizontal scroll). there drpdown should filter values , should show eligible tds in scroll part. below screenshots. hiding , showing data based on selection of dropdown. have added class tds , rowspan th can toggled based on selction of dropdown. shows perfect while fetching records. when hide columns , columns work perfect header resizes headings. here happens on hiding th , td .td remains same , th resizes i tried lot cud not fix it. can plz help so got solution . u need table object again , redraw it. after reading many places error seemed datatable still find fix hiding columns in scroll part rowspan added it. did adding class th, td of table needs hidden based on condition , here based on selection. when selecting partical type added class hide required th , tds. th reset sizes ,might because of scrolls added. resets width of entire header leaving td . looks ugly. otable.fndraw(); jus

c# - How do you cast an object to an interface it implements but doesn't extend? -

i have class script , has several properties no methods. classes created extending script . ideally script might have method update() wouldn't extend interface iupdateable (which has method 'update' specified). when script added object object realize that, while object doesn't extend iupdateable , still implementation of it. add script list of scripts update methods, updated. my question centres around 2 things, how can tell if class implements interface (without extending it), and, armed knowledge, how cast object update() method can called. are there other options should consider instead? thanks you can use reflection this. to check if class implements interface, try below - typeof(imyinterface).isassignablefrom(typeof(mytype)) typeof(mytype).getinterfaces().contains(typeof(imyinterface))

python - How to store django objects as session variables ( object is not JSON serializable)? -

i have simple view def foo(request): card = card.objects.latest(datetime) request.session['card']=card for above code error "<card: card object> not json serializable" django version 1.6.2. doing wrong ? in cookie, i'd store object primary key: request.session['card'] = card.id and when loading card session, obtain card again with: try: card = card.objects.get(id=request.session['card']) except (keyerror, card.doesnotexist): card = none which set card none if there isn't card entry in session or specific card doesn't exist.

java - Connecting to SSL WebService -

i want connect web service in ssl connection. connect , service , port when send requests, returns null . i searched web not understand problem. may because ssl, need connect different http connection, true? i used auto code generators, return null too, wireshark says ssl packages transmitted correctly cannot read soap these packages because ssl. i test web service applications , tools , got correct answers them. question: is possible null value because ssl connection? what mistakes make null returning? how can see soap messeges send , get? here java code: public class ws_theserveice { private static qname qname; private static url url; private static service service; private static implementationserviceporttype sender; static { qname = new qname("http://wservice.com/", "implementationservice"); try { url = new url("https://to-service?wsdl"); } catch (mal

xml - how to get Android Custom Preference TextView OnClick? -

i can't custom preference textview action. may know how it. here preference xml file user_setting.xml , <preferencecategory android:title="@string/security_settings" android:key="security"> <preference android:title="@string/change_pin" android:summary="@string/change_pin_summary" android:key="change_pin" android:layout="@layout/test"/> </preferencecategory> here custom xml layout preference test.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minheight="?android:attr/listpreferreditemheight" android:gravity="center_vertical"

Cannot set Python path in Aquamacs OSX 10.8 -

i using these lines in preferences.el (add-to-list 'load-path "~/library/enthought/canopy_64bit/user/bin") (require 'python-mode) (setenv "pythonpath" "~/library/enthought/canopy_64bit/user/bin") but when c-c c-c, still picking default apple python(2.7.2 instead of 2.7.3 epd). epd running in terminal default. thanks, use package . , add these lines preferences.el (require 'exec-path-from-shell) (exec-path-from-shell-initialize)

javascript - How to check if css3 is not supported by browser? -

this question has answer here: if browser css3 7 answers how can test browser css3 supported or not? if(!css3){ //if @ least 1 css3 feature isn't supported //do stuff here } try assign css3 property (that's relevant you're doing - no sense testing transition if you're doing transform ), andthen check see if value "stuck". if browser supports gave it, stick. otherwise, change empty string.

c# - Kinect constantly increasing joint position value -

i have application in c# skeleton tracking. showing (visualizing) skeleton properly, when want show actual value of chosen joint, not working right. example: in app have button should actual y position of hip center , textbox value should displayed. standing still in front of kinect , everytime click button, value changes (even though not moving). click : -56,236589 click : -89,214563 click : -100,254789 and on. below full source code of app: using system; using system.collections.generic; using system.linq; using system.windows; using system.windows.media; using microsoft.kinect; using system.io; using encog.neural.networks; using encog.neural.networks.layers; using encog.engine.network.activation; using encog.ml.data; using encog.neural.networks.training.propagation.resilient; using encog.ml.train; using encog.ml.data.basic; using encog.ml.svm; using encog.ml.svm.training; namespace wpfapplication1 { /// <summary> /// interaction logic mainwindow.xaml ///