Posts

Showing posts from March, 2014

Visual Studio C# datagridview to database -

this question has answer here: what nullreferenceexception, , how fix it? 33 answers i'm trying save data datagridview database . keep on getting nullreferenceexception: object reference not set instance of object try { foreach (datagridviewrow row in datagridview2.rows) { using ( conn = new sqlconnection(constring)) { using (sqlcommand cmd = new sqlcommand("insert tbl_students_marks values(@student, @t1, @t2, @t3, @t4)", conn)) { cmd.parameters.addwithvalue("@student", (row.cells["student number"].value).tostring()); cmd.parameters.addwithvalue("@t1", row.cells["test 1"].value); cmd.parameters.addwithvalue("@t2", row.cells["test 2"].value); cmd.param

language lawyer - C++ name lookup -- -

the standard says (brackets mine) in cases listed in 3.4.1 [unqualified name lookup], scopes searched declaration in order listed in each of respective categories … why names kept in sort of ordered list(s)? after all, except function overloading , name hiding, think names unique within namespace. update address comment: i expect compiler keep names defined in container such unordered_set per scope , scopes linked in chain. i wondering why names classified lists per category (which thought variables, typedefs, structure like, functions, templates, etc.) , lists further sorted. the "order" in case not order of names . order of scopes . in each category scopes listed in order (typically "inside-out": inner scopes outer scopes). order in these scopes searched. typically, first scope contains name in question causes search stop.

How to optimize realm.allobjects(class) in Android -

i want use realm replace sqlite in android store list of classes, code simple below. public class myrealmobject extends realmobject { public string getfield() { return field; } public void setfield(string field) { this.field = field; } private string field; ... } list<myobject> myobjects = new arraylist(); realm realm = realm.getinstance(this); for(myrealmobject realm : realm.allobjects(myrealmobject.class)) { myobjects.add(new myobject(realm)); } realm.close(); return myobjects; however, performance slower simple sqllite table on tested device, using wrong way? there optimization tricks? why want wrap realmobjects in myobject class?. copying entire result set means loose benefit of using realm, namely doesn't copy data unless needed to. realmresults implements list interface should able use 2 interchangeably. list<myrealmobject> myobjects; realm realm = realm.getinstance(this); myobjects = realm.

c# - Register a PKCS#11 library -

i trying install pkcs#11 module firefox browser via msi setup application. after doing search through internet, bumped 'modutil' tool has wide variety of responsibilities in case = installing/uninstalling pkcs#11 module nss security databases. downloaded latest source code , built using mozillabuild. unfortunately, shows me error when try create security databases = (3 .db extension). error says "function failed: certificate/ke= y database in old, unsupported format"!. does know how can overcome issue, , there unseen aspect work utility. also, there solution install/uninstall pkcs#11 module user profiles 1 common process. finally, there better solution task of installation using mysetup. use wix toolset create msi setup. -

Java - Null Pointer Exception while parsing XML file -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i'm trying parse xml file of employees, , data in xml want create array list of of employees, when run program , try parse xml file, gives me null point exception. xml file: <?xml version="1.0"?> <employees> <employee> <name>roberta robertson</name> <manager>false</manager> </employee> <employee> <name>taylor meyers</name> <manager>true</manager> </employee> <employee> <name>john mayer</name> <manager>true</manager> </employee> </employees> this code parsing xml file. call method when press button in gui. public class employeesparser { private documentbuilder builder; pri

android - Pie chart does not have correct size inside a CardView -

Image
i working on android application , using mpandroidchart lib in it. yet application developed using mpandroidchart version 2-0-8. , chart display fine shown below. but today update lib version 2-1-1. haven't done changes code chart looks now. here xml code chart. <com.github.mikephil.charting.charts.piechart android:id="@+id/chart" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="@dimen/top_bottommarginforchart" android:layout_marginleft="@dimen/top_bottommarginforchart" android:layout_marginright="30dp" android:layout_marginbottom="@dimen/top_bottommarginforchart" /> p.s. displaying chart on cardview if matters. is there need update in code? have searched on website didn't find anything. here j

Hibernate: two many one to one relationship -

i have 3 tables: user->profile->profiledetails user have 1 row in profile table profile have 1 row in profiledetails table create table if not exists mydb.user ( id int not null auto_increment, name varchar(45) null, primary key (id)) engine = innodb; create table if not exists mydb.profile ( userid int not null, profiledata varchar(45) null) engine = innodb; create table if not exists mydb.profiledetails ( profileid int not null, details varchar(45) null) engine = innodb; how can describe these relationships in hbm.xml files, using one-to-one relationships? i resolve problem. use primary key relations: create table if not exists mydb.user ( id int not null, name varchar(45) null, primary key (id)) engine = innodb; create table if not exists mydb.profile ( user_id int not null, profile_data varchar(45) null, primary key (user_id), constraint fk_profile_user1 foreign key (user_id) references mydb.user (id) on delete

hibernate - HQL returns duplicate objects -

i have 2 questions regarding hql usage i have query below, returns duplicate rows/objects, adding distinct keyword solves problem can explain, why need distinct here, can't without it? select st state st inner join fetch st.cities the hql documentation says a fetch join not need assign alias, because associated objects should not used in clause (or other clause). but why can't use associated objects in clause, if want eagerly fetch want add condition how it? simply because that's how hql , jpql specified: 1 element returned per row of jdbc resultset, unless use distinct. because if allowed add restrictions on fetched entities, break invariants of entities themselves, hibernate, , own code, assume verified: cities returned state.getcities() cities of state. of them. not ones happen obey criteria of random query.

Display Table form with Eloquent Data Laravel -

i have object structure store in eloquent form {"item_id": "2", "item_color": "black", "item_size": "l", "item_quantity": "5",}, {"item_id": "2", "item_color": "black", "item_size": "m", "item_quantity": "5",}, {"item_id": "2", "item_color": "black", "item_size": "s", "item_quantity": "5",}, {"item_id": "2", "item_color": "white", "item_size": "s", "item_quantity": "5",}, what i'm trying achieve combine item_quantity has same item_id , item_color , display in table form this. itemid itemcolor itemsize quantity total 2 black l-m-s 5-5-5 15 2 white s 5 5 in research nearest kind of solution im having trou

Jquery loading locally, but not on the web server -

running files locally works perfectly. i've tried uploading site files both godaddy , github, jquery doesn't load in either case. in both cases html , css work expected. i have alert ('script.js loaded'); @ top of jquery. alert appears when running locally, not via godaddy or github. i have @ top of html: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type='text/javascript' src='jquery.js'></script> after googling, i've tried using textedit (instead of sublime) files instead, no avail. i'm struggling find other ideas. any thoughts? thanks!

How to update node value in xml java -

i working on xml project. far, have link xml java class using dom parser. have code provide below. struggling updating startdate's month 1 2/1/2013, 3/1/2013... change in xml file accordingly. have method call updatedate @ bottom, xml file won't update it's value when call it. appreciated data.xml before <?xml version="1.0" encoding="utf-8"> <data> <username>hello123</username> <startdate>01/01/2011</startdate> <enddate>06/01/2013</enddate> </data> desire data.xml after <?xml version="1.0" encoding="utf-8"> <data> <username>hello123</username> <startdate>02/01/2011</startdate> <--- change <enddate>06/01/2013</enddate> </data> main.java public class main { public static void main(string[] args) { calenda

ReflectionException in RegisterListenersPass.php line 101: Class does not exist Symfony 2 -

this first question, have error reflectionexception in registerlistenerspass.php line 101: class acme\examplebundle\handler\authenticationhandler.php not exist. using fosuserbundle , symfony 2. in services.xml <service id="login_listener" class="%vixur.login_listener.class%"> <tag name="kernel.event_subscriber"/> </service> authenticationhandler.php: <?php namespace acme\examplebundle\handler; use fos\userbundle\fosuserevents; use fos\userbundle\event\formevent; use symfony\component\eventdispatcher\eventsubscriberinterface; use symfony\component\httpfoundation\redirectresponse; /** * listener responsible change redirection @ end of password resetting */ class authenticationhandler implements eventsubscriberinterface { private $container; public function __construct() { } /** * {@inheritdoc} */ public static function getsubscribedevents() { return array

matlab - Random number generation - code not working as it should -

so have generate random number (called 'p' here) between 0 , 90 frequency distribution cosine function (i.e should have more numbers between 0 , 45 numbers between 45 , 90). i working on matlab code follows - flag = 1; while flag == 1 candidate = randi([0,90]); if rand < cosd( candidate ) p = candidate; flag = 2; end end i generating 20 such numbers of numbers towards higher end (45-90). 20 numbers, there hardly 1-2 numbers < 45. is code wrong? edit: okay, got answer. tried running code separately follows- for = 1:20 flag = 1; while flag == 1 candidate = randi([0,90]); if rand < cosd( candidate ) p = candidate; flag = 2; disp(p); end end end and i'm getting of values of p between 0 , 45. original code had external 'if' condition reason accepting higher values of 'p'. used while loop , number of iterations more 20 20 values of 'p'. he

php - Unable to start service with Intent { flg=0x4 (has extras) } -

i want insert php service. i've got error : unable start service skripsi.ubm.studenttracking.altitudesurvey@366d624d intent { flg=0x4 cmp=skripsi.ubm.studenttracking/.altitudesurvey (has extras) }: android.os.networkonmainthreadexception this code : public void insert() { string time; simpledateformat dayformat = new simpledateformat("hh:mm:ss", locale.us); calendar calendars = calendar.getinstance(); time = dayformat.format(calendars.gettime()); try { httpclient = new defaulthttpclient(); httppost = new httppost("http://studentstracking.hol.es/altitudesurvey.php"); namevaluepairs = new arraylist<namevaluepair>(2); namevaluepairs.add(new basicnamevaluepair("baro", value)); namevaluepairs.add(new basicnamevaluepair("jam", time)); httppost.setentity(new urlencodedformentity(namevaluepairs)); response = http

makefile - HDF5 error no file name specified, Crashes in Boost -

i'm trying build source code on osx getting following error when running it. seems related hdf5 i've got no clue how fix since linux , win built of source code works fine. error detected in hdf5 (1.8.15-patch1) thread 5963292672: #000: h5f.c line 435 in h5fis_hdf5(): no file name specified major: invalid arguments routine minor: out of range and crash happens right after here crashed in boost::re_detail::basic_regex_parser<char, signal caught: sigsegv -- invalid memory reference boost::regex_traits<char, boost::cpp_regex_traits<char> > >::parse_extended @ 00:00:00 i built hdf5 (hdf5-1.8.5-patch1) based on page , plus, added following compiler flags mentioned flags on page before building it. there wrong those? env.append "cxxflags", "-std=c++03 -stdlib=libstdc++" env.append "cflags", "-stdlib=libstdc++" env.append "ldflags", "-stdlib=libstdc++ -lstdc++" env["cxx"] = "/

c# - Registry.LocalMachine.OpenSubKey(regPath); returns NULL in .NET 3.5 Environment -

i trying access registry using following command: string regpath = "software\\bentley\\autopipe\\v8i ribbon , reporting"; registrykey ribbonkey = registry.localmachine.opensubkey(regpath); i have tried different methods i.e. this one , this faced same error: object reference not set instance of object. it return me null in ribbonkey key exists in registry. have searched on topic , found many solutions this not me because using .net 3.5 . any highly appreciated. what system running? have tried little solution? opensubkey() returns null registry key can see in regedit.exe

python - Django Serializer Save models with foreign key relationships -

i trying save model object has foreign key referencing table. trying write serializer same, can't wrap head around how , can't seem find right documentation either. model objects: class restaurant(models.model): name = models.charfield(null=false, max_length=255) min_order = models.charfield(null=false, max_length=255) # , on class rmenucategory(models.model): category_name = models.charfield(null=false, max_length=255) restaurant = models.foreignkey('restaurant') my serializer class rmenucategory model: class restaurantmenuserializer(serializers.modelserializer): restaurant = serializers.primarykeyrelatedfield() class meta: model = rmenucategory fields = ('id', 'category_name', 'restaurant') making api call json as: { "category_name" : "italian", "restaurant_id" : 4} this not working when try out following in view: menu_cat = restaurantmenuserialize

Emacs terminal column width (julia / python shell) -

i trying use emacs integrated computing environment julia & python. ess (emacs speaks statistics) plugin use interactively send selected code repl evaluation. c-c c-c selects code , starts julia interpreter first time combination used, in subsequent executions uses existing julia session. the challenge facing terminal window julia (this case python ) reason uses 80 columns output. for example following code if executed inside julia session print dataframe df in 3 groups wrapped @ 80 columns. though window size can handle on 200 characters. using dataframes df=readtable("../../data/titanic/data/train.csv") julia> df[1:2, :] 2x12 dataframe | row | passengerid | survived | pclass | |-----|-------------|----------|--------| | 1 | 1 | 0 | 3 | | 2 | 2 | 1 | 1 | | row | name | sex | |-----|------------------------------------------------------

python - convert output to list(and nested dictionary) -

import boto.ec2 sgs = boto.ec2.connect_to_region('us-east-1').get_all_security_groups() sg in sgs: rule in sg.rules: print sg, sg.id, "inbound:", rule, " source:", rule.grants securitygroup:default sg-e1304484 inbound: ippermissions:tcp(80-80) source: [67.184.225.222/32] securitygroup:default sg-e1304484 inbound: ippermissions:tcp(5500-5500) source: [67.184.225.222/32] securitygroup:pub_hdp_sg sg-e632d982 inbound: ippermissions:tcp(80-80) source: [0.0.0.0/0] securitygroup:sg3-mysecuritygroup-lb0qf9uqaoef sg-4fe73728 inbound: ippermissions:tcp(22-22) source: [0.0.0.0/0] securitygroup:sg3-mysecuritygroup-lb0qf9uqaoef sg-4fe73728 inbound: ippermissions:tcp(80-80) source: [0.0.0.0/0] securitygroup:rdp rule - open sg-42d58d27 inbound: ippermissions:-1(none-none) source: [0.0.0.0/0] securitygroup:us-east-open-all sg-97ffa7f2 inbound: ippermissions:tcp(22-22) source: [10.0.20.100/32] securitygroup:us-east-open-all sg-97ffa7f2 inbound: ipp

object - Using lodash/underscore how can I update the value of the key -

i have convert date timestamp using date.parse().each time find key "date__c". [ { "date__c":"07/30/2015", "end_time__c":"14:00", "start_time__c":"07:00" }, { "date__c":"07/30/2015", "end_time__c":"14:00", "start_time__c":"07:00" }, { "date__c":"07/30/2015", "end_time__c":"14:00", "start_time__c":"07:00" } ] become [ { "date__c":1438185600000, "end_time__c":"14:00", "start_time__c":"07:00" }, { "date__c":1438185600000, "end_time__c":"14:00", "start_time__c":"07:00" }, { "date__c":1438185600000, "end_time__c":"14:00", "s

javascript - How to iterate json data in jquery + ajax -

but respnce in json, i.e alert(html) <script> function addcartaction(id){ var datastring='id='+id; $.ajax({ type: "post", url:"<?php echo yii::app()->request->baseurl; ?>/testurl", data: datastring, success: function(html) { alert(html); $("#cart-item").html(html); } }); } </script> { "1": { "itemname": "product1", "id": "1", "item_image": "http://testurl.com/gallerythumb/test.jpg", "price": "4.99", "quantity": 1 }, "2": { "itemname": "product2", "id": "2", "item_image": "http://testurl.com/gallerythumb/test1.jpg", "price": "7.99", &quo

java - Lucene migration text field difference in 3.0.3 and 5 -

i have problem migration of lucene field version 3.0.3 5.x . prepared 2 junit test programs (one 3.0.3 , other 5.x) compare behavior. lucene 3: analyzer = new standardanalyzer(version.lucene_30); indexwriter = new indexwriter(dir, analyzer, true, maxfieldlength.unlimited); .... document doc = new document(); doc.add(new field("keyword", "another test@foo-bar", field.store.yes, field.index.analyzed)); indexwriter.adddocument(doc); indexwriter.commit(); .... indexreader = indexreader.open(fsdirectory.open(path.tofile()), false); searcher = new indexsearcher(indexreader); queryparser parser = new queryparser(version.lucene_30, "keyword", analyzer); query query = parser.parse("test"); searcher.search(query, searcher.maxdoc()); topdocs topdocs = searcher.search(query, searcher.maxdoc()); scoredoc[] hits = topdocs.scoredocs; doc = indexreader.document(hits[0].doc); // doc null <- expected assertnull(result); the similar test l

c# - PictureBox clearing when dragged out of screen boundries in Visual Studio 2013 -

it's me again, weird problem. created code reads xml file , uses g.drawstring function sorted xml text picturebox1. got advanced , made picturebox scrollable , noticed problem. when text in picturebox off screen (invisible), when scrolled it, wasn't there anymore. same happens if take application , drag off screen, text disappears, text gets deleted, if load program again (browse xml file again) refreshes, doesn't help, becuase need make text there. here part of code, hope helps: private void drawinpicturebox(int index) { picturebox1.refresh(); using (xmlreader reader = xmlreader.create(openfiledialog1.filenames.elementat(index))) { y = 0; while (reader.read()) { if (reader.isstartelement()) { if (reader.name == "something") {

java - Adding a Maven dependency composed by several modules -

Image
i'm having problems add dependency project. it's framework structure, once maven-installed, composed several modules, looking (simplified) this: build-xxx (containing .pom) build-xxx-root (containing .pom) build-xxx-superpom (containing .pom) filters (containing .pom) build-filters (containing .pom) filter1 (containing .jar) filter2 (containing .jar) what want add whole framework dependency, use content of of jars. thought adding superpom, build-xxx-root or build-xxx solve it, adding children modules automatically; didn't work. the remote repository can accessed in link (cloudbees) ; it's open-source project, in case wonders original file structure it can found here (bitbucket) . i have added remote repository pom.xml in following way: <repositories> <repository> <id>okapi-release</id> <name>okapi release</name> <url>http://repository-okapi.forge.cloudbees.com/release/</url>

Chrome Dev tools - Network Tab is Blank -

Image
i not able view network activity in chrome dev tools . when open , displays blank screen. other tabs in dev tools work fine. please see image below. how can make work ?

define interface method with different parameters in C# -

interface parentinterface { public string methoda(/*define parameters name , datatype*/); } and public class childa : parentinterface { public string methoda(string a, int b, string c, long d){} } public class childb : parentinterface { public string methoda(int e, string f, string g){} } i want define interface method's parameters name , data type you have 2 different methods public string methoda(string a, int b, string c, long d){} and public string methoda(int e, string f, string g){} that represent 2 different contracts childa , childb respectively. cannot define interface single methoda fits both definitions. seek not possible. note define both overloads in interface, each class implementing interface have implement both overloads.

debugging - PhpStorm debugger breakpoint at variable use -

is possible set "php exception breakpoint" inside of phpstorm debugger triggers each time specific variable used? for example have $_get['foo'] in request , want debugger pause every time variable $_get['foo'] used in code. exception breakpoints trigger when error has occurred, short answer "no." however, can right-click (or control+click, mac) top folder in source tree in project file browser , choose "find in path" locate instances of $_get['foo'] . once know are, create normal breakpoints in usual way. put them "group," according intentions breakpoints: create breakpoints everywhere $_get['foo'] referenced, using "find in path..." feature of project file browser search them globally (find main folder of project; right-click pc or [control]+[click] mac find option). once breakpoints set everywhere find $_get['foo'] , click run > view breakpoints show them in list

Can not return an array in java? -

this question has answer here: what's simplest way print java array? 24 answers the program below aims return nonzero values in array using array b. i new java, experienced c++. would gladly appreciate feedback ! public class first { static int [] a= { 5, 43, 0, 127, 1, 0 ,0 ,3}; public static int[] nonzeros( int [] ) { int [] b= new int [10]; int k=0; for(int i=0;i<=7;i++) if(a[i]!=0) { b[k]=a[i]; k++; } return b; } public static void main(string[] args) { system.out.println(nonzeros(a)); } } output: [i@659e0bfd use: system.out.println(arrays.tostring(nonzeros(a))); in main method.

linux - accessing *nix file system through django -

i have django project installed in /home/user/project . , have strokes in code, processing files in file system. if make new directory os.makedirs('crowdin_temp') created within django project folder. if make os.system commands file system (like os.system("rm crowdin_temp/" + file_name) ) file within project directory visible. makes me feel django project folder visible. possible process files outside of project folder? (e.g. in /home/user/ directory) why don't specify full path? $ ./manage.py shell >>> import os >>> os.makedirs('/tmp/temp') >>> os.system('touch /tmp/temp/somefile') 0 >>> os.system('rm /tmp/temp/somefile') 0

C++ Eigen initialize static matrix -

is possible initialize static eigen matrix4d in header file? want use global variable. i'd along lines of: static eigen::matrix4d foo = eigen::matrix4d(1, 2 ... 16); or similar vectors: static eigen::matrix4d foo = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; here link eigen matrix docs. can't seem find how there. on lines of dawid's answer (which has small issue, see comments), can do: static eigen::matrix4d foo = [] { eigen::matrix4d tmp; tmp << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16; return tmp; }(); return value optimization takes care of temporary, no worries copy.

android - Why does SetGravity onToast have no effect? -

i have activity tries create custom toast object. toast show in center of screen no matter set gravity be, toast shows @ top. looks settings give toast have no effect on happens. can move toast center. the code create toast: layoutinflater inflater = (layoutinflater) context.getsystemservice (context.layout_inflater_service); relativelayout layout = (relativelayout) inflater.inflate(r.layout.notification_layout,null); ((textview) layout.findviewbyid(r.id.title)).settext(title); ((textview) layout.findviewbyid(r.id.content)).settext(content); toast toast = new toast(this); toast.setduration(toast.length_short); toast.setgravity(gravity.center, 0, 0); toast.setview(layout); toast.show(); the xml layout inflating: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="100dp&

Issue with averaging images in matlab -

when try average folder of jpeg matlab images, blank image. i've gone on code million times, , don't know i'm going wrong. (also know hard coded of numbers because wanted take specific folder , i've double checked million times, they're right.) %takes images in folder , averages values %opens folder function avg_image = average_images() folder_name = uigetdir; folder_directory = dir(folder_name); filename = folder_directory(3).name; len = length(folder_directory); org_image = imread(filename); sum_image = org_image; %adds files = 4:len filename = folder_directory(i).name; org_image = imread(filename); sum_image = sum_image + org_image; end %calculates average avg_image = sum_image/(len-2); %saves average fits file , displays imwrite(avg_image, 'averagefile.jpg'); read_image = imread('averagefile.jpg'); imshow(read_image) end

android - How to send POST request to local server PHP script using Volley? -

i trying post value script running on local server. code given below : final string data = "poet=nazmul"; //toast.maketext(getapplicationcontext(), "ok", toast.length_long).show(); stringrequest request = new stringrequest(request.method.post, "http://192.168.1.112:8080/api/post.php?" + data, new response.listener<string>() { @override public void onresponse(string response) { toast.maketext(getapplicationcontext(), response, toast.length_long).show(); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror volleyerror) { toast.maketext(getapplicationcontext(), volleyerror.tostring(), toast.length_long).show(); } }); appcontroller.getinstance().addtorequestqueue(request); but local server not respond. php code is: <?php $poet = $_post['poet']; echo json_e

c - Any other solution for recursive solution -

i trying find how many numbers of length n there such each number @ least 4 smaller/greater number before , after it. eg: if n = 5, such numbers 39518, 15951, etc. below solution, come with: taking long amount of time input size low 1000.i sure, there better approaches solve problem. appreciate if can give pointers. #include <stdio.h> int out[100000]; int count; void foo(int *out, int pos_to_fil, int size) { if (pos_to_fil == size) { count++; return; } int i; (i=0;i<=9;i++) { if (pos_to_fil == 0 && == 0) continue; if (pos_to_fil >0 && abs(out[pos_to_fil-1] -i) < 4) continue; out[pos_to_fil] = i; foo(out, pos_to_fil + 1, size); } } int main(void) { foo(out, 0, 1000); printf("count %d\n", count); return 0; } short answer: don't use recursion, go bottom , use dynamic programming. longer answer: you're iterating on po

paypal add to cart how to override redirection? -

background: created button paypal , when click it automatically takes me shopping cart. able edit when click continue shopping redirects me followup page created it. question: possible instead make when people click add cart takes them followup page without taking them cart? alternate: if above not possible instead possible make user cannot checkout on first page forced click continue shopping? thanks.

sql - How do I return a jsonb array and array of objects from my data? -

i have following table: create table mytable ( id serial primary key , employee text unique not null , data jsonb ); with following data: insert mytable (employee, data) values ('jim', '{"sales_tv": [{"value": 10, "yr": "2010", "loc": "us"}, {"value": 5, "yr": "2011", "loc": "europe"}, {"value": 40, "yr": "2012", "loc": "asia"}], "sales_radio": [{"value": 11, "yr": "2010", "loc": "us"}, {"value": 8, "yr": "2011", "loc": "china"}, {"value": 76, "yr": "2012", "loc": "us"}], "another_key": "another value"}'), ('rob', '{"sales_radio": [{"value": 7, "yr": "2014", &qu

sqlite - C# System.Type doesn't contains GetProperties() -

this question has answer here: reflection in windows universal apps 1 answer i created universal app uses sqlite. created method uses gettype().getproperties() problem in previous version of app(not universal), used method , worked perfectly, can't use him couse type class doesn't contains it. i checked system.type class , header of working one: #region assembly mscorlib.dll, v2.0.5.0 // c:\program files (x86)\reference assemblies\microsoft\framework\windowsphone\v8.0\mscorlib.dll #endregion using system.globalization; using system.reflection; using system.security; and header of universal app's one: #region assembly system.runtime.dll, v4.0.10.0 // c:\program files (x86)\reference assemblies\microsoft\framework\windowsphoneapp\v8.1\system.runtime.dll #endregion using system.security; the second doesn't contain getmethod , or getprop

gawk - Confusion about conditional expression in AWK -

here input file: $ cat abc 0 1 2 3 4 5 why following give one-column output instead of two-column one? $ cat abc | awk '{ print $1==0?"000":"111" $1==0? "222":"333" }' 000 333 333 shouldn't output following? 000 222 111 333 111 333 i think awk going parse as: awk '{ print ($1==0) ? "000" : (("111" $1==0) ? "222" : "333") }' that is, when prints 3 zeros, doesn't consider rest of operation. , when doesn't print 3 zeros, prints triple threes because "111" concatenated string not going evaluate zero. you want use: awk '{ print ($1==0?"000":"111"), ($1==0? "222":"333") }' where comma puts space (ofs or output field separator, precise) in output between 2 strings. or might prefer: awk '{ print ($1==0?"000":"111") ($1==0? "222":"333") }'

objective c - Is there a way to pass additional data to UserInfo dictionary using NSNotificationCenter with UIKeyboardDidShowNotification -

i have these lines of code: -(void)somemethod:(uiscrollview*)scrollview{ [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwasshown:) name:uikeyboarddidshownotification object:nil]; } -(void)keyboardwasshown:(nsnotification *)anotification{ // want scrollview on here } is there way make possible? i've tried perform staff according how pass nsdictionary postnotificationname:object: but anotification.userinfo doesn't contain data [[nsnotificationcenter defaultcenter] postnotificationname:uikeyboarddidshownotification object:self userinfo:@{@"scrollview":scrollview}]; you listening uikeyboarddidshownotification , post uikeyboardwillhidenotification won't work. first maybe create own notification name i.e xyzkeyboarddidshownotification , register , post using name additional data want. , can do: -(void)keyboardwasshown:(nsnotification *)anotification{ uiscrollview *scrollview = an

MVVM light support in VS 2015 -

can tell me if there's way full code snippet support mvvm light in vs 2015 rtm? i'm trying install gallery via instructions @ http://www.mvvmlight.net/installing/ that works fine vs 2013 there's no matches when search "mvvm light" in online "extensions , updates" in vs 2015 this link suggests though it's not officially supported yet, there vsix installer can downloaded there worked me on vs 2015 rtm. the project templates vsix support 4.5.1 assume official ones take advantage of relevant 4.5.2 features.

twitter oauth - Azure Logic App - Authorization Issue -

Image
in azure logic app, added twitter connector, after authorizing same, authorize button doesn't go away , not able proceed. sajad, currently default application associated logic apps twitter broken -- looking fix it. in meantime, if associate twitter api app own twitter app information (you can set 1 free), logic app run , authorize successfully. here's details on how can that. let me know if have questions or issues, , apologies inconvenience http://aka.ms/oauth_connectors

javascript - Creating an iframe from JQuery - properties are not working, why not? -

hello im creating iframe in javascript. style , loaded event doesnt seem work. doing wrong? var iframe = $("<iframe src='/player/showpage/"+data.pageid+"'/>", { style: "position:absolute; left:-100%", load: function () { var = this; $(this).animate({ left: 0 }, 500); $('iframe').not(this).animate({ left: '-100%' }, 500, function () { $('iframe').not(that).remove(); }); } }); $('body').append(iframe); i must missing something, cant figure out is. iframe sitting there - mocking me

php - Laravel print error if bad query -

i'm laravel newbie, have written simple code: route::get('users/{uname}/{uid}', function($uname, $uid) { $u = db::table('users')->where('login', $uname)->first(); return view::make('users', array( 'username' => $u->login, 'userid' => $u->uid ) ); }); i have 2 questions regarding code, first: code valid? second: how can show 404 error when query not found? example if write site.com/users/badusername/badid show 404 error, not blank page. thanks in advance ! p.s how can make $u query 2 wheres? example login = ? , uid = ? first: code looks ok. make use of little un-documented feature of dynamic methods, , call that: db::table('users')->wherelogin($uname)->first(); second: in order throw 404 error, can call app::abort(404); third: can chain where() methods, e.g.: $u = db::table('users')->where('l

Deleting item from Sharepoint calendar -

i want delete item sharepoint calendar. here part of code: microsoft.sharepoint.client.camlquery query = new microsoft.sharepoint.client.camlquery(); query.viewxml = "<view><query><where><and><eq><fieldref name='title'/><value type='text'>" + requesttitle + "</value></eq><eq><fieldref name='eventdate'/><value type='text'>" + lfrom + "</value></eq></and><and><eq><fieldref name='enddate'/><value type='text'>" + lto + "</value></eq><eq><fieldref name='falldayevent'/><value type='text'>" + boolean.truestring + "</value></eq></and&g

objective c - How to Stop NSOutlineView background transparent -

i have nsoutlineview @ top , below custom view in 1 window. want change color of custom view have same color nsoutlineview. however, can't seem since nsoutlineview's background color seems gray transparent make color different if there other app window beneath it. how should have nsoutlineview , custom view same color?

Track Social Shares from Youtube Iframe Player with JavaScript -

youtube has social sharing options in embedded iframe player. here screenshot: https://flic.kr/p/vneef7 in youtube developer api documentation, there information various events javascript can listen such video play/pause/skip/milestone etc. necessary non-youtube analytics software (such adobe analytics) track interactions. however api docs of july 21, 2015 nothing social share feature or how listen events when used. can describe how track these events or point documentation? currently, events api can track are: onready , onstatechange , onplaybackqualitychange , onplaybackratechange , onerror , , onapichange , don't think you're asking supported. maybe use onhover , onclick listener iframe , see if new window opened, check website (e.g. facebook, pinterest, etc.). alternatively, submit feature request here .

python - Why is my parser not working -

i'm trying scrape directory info website. 'http://www.virginiaequestrian.com/main.cfm?action=greenpages&sub=view&id=10478' but don't know how select different lines of text because tags line break elements( ). there way can search text rather tag? r=requests.get('http://www.virginiaequestrian.com/main.cfm?action=greenpages&sub=view&id=10478') soup=beautifulsoup(r.content,'lxml') tbl=soup.findall('table')[2] print tbl.br the text looking in 2nd tr inside table. so, print tbl.findall('tr')[2] there isn't structure inside text, however, you're on own getting contact name, etc.

Server side rendering with Riot.js: Passing opts.foo to this.foo in tag -

i having problems server side rending using riot. in handler, pass foo object bar tag similar this: reply(riot.render(bar, { foo: foo })); this copy of simple bar tag: <bar> <h1>test</h1> <h1>{ foo }</h1> this.foo = opts.foo console.log(this.foo) </bar> when point browser relevant path, 'test' visible foo not. console.log(foo) works fine. this worked me on similar setup <bar> <h1>test</h1> <h1>{ opts.foo }</h1> console.log(opts.foo) </bar> i believe works best bind directly data object instead of setting local variable

node.js - Grunt task to change some information in the existing files -

i want create startkit projects, 1 of task modify existing files grunt.js. example have file this: 1. $variable-one: 1 !default; 2. $variable-two: 2 !default; 3. $variable-three: 3 !default; and want copy part of file files. example, line 1 in beginning of file1.scss , line 2 in end of file2.scss , line 3 in middle of file3.scss. find grunt-string-replace , don't shure can me.

SASS mixin - hot to limit to a certain type of tag? -

this question has answer here: is possible test current element type within sass mixin? 3 answers @mixin foobar(){ outline: 1px solid red; td#{&}{ outline: 1px solid blue; } } .foo{ @include foobar; } outputs : .foo { outline: 1px solid red; } .foo td.foo { outline: 1px solid blue; } i output : .foo { outline: 1px solid red; } td.foo { outline: 1px solid blue; } how can achieved ? played "@at-root" doesn't seem meant that. i can see 2 ways here. complex one: @mixin foobar($class, $tags...) { @each $tag in $tags { $selector: $tag + $class; @at-root #{$selector} { outline: 1px solid blue; } } } .bar { @include foobar(&, 'tr', 'td'); } output: tr.bar { outline: 1px solid blue; } td.bar { outline: 1px solid blue; } and easy one: %abs_foo { outline: 1px sol