Posts

Showing posts from May, 2014

From C# encryption key derivation to Ruby (PBKDF2) -

i'm trying rewrite following key generation method written in c# ruby equivalent: private static byte[] createkey(string password, int length) { var salt = new byte[] { 0x01, 0x02, 0x23, 0x34, 0x37, 0x48, 0x24, 0x63, 0x99, 0x04 }; const int iterations = 1000; using (var rfc2898derivebytes = new rfc2898derivebytes(password, salt, iterations)) return rfc2898derivebytes.getbytes(length); } i'm using pbkdf2 implementation. , here's ruby code: def create_key password, length salt_a = [0x01, 0x02, 0x23, 0x34, 0x37, 0x48, 0x24, 0x63, 0x99, 0x04] salt = salt_a.pack('c*') # think here there change iterations = 1000 derived_b = pbkdf2.new |p| p.password = password p.salt = salt p.iterations = iterations p.key_length = length p.hash_function = openssl::digest::sha1 end derived_b.bin_string # , here end in order work 2 methods should r

Clear or reset the wordpress posts pagination while changing filters -

i think simple, don't it. filter: <form class='post-filters'> <select name="filter"> <?php $filter_options = array( 'houses' => 'houses', 'hotels' => 'hotels', ); foreach( $filter_options $value => $label ) { echo "<option ".selected( $_get['filter'], $value )." value='$value'>$label</option>"; } ?> </select> <input type='submit' value='filter!'> </form> related php apply filter wordpress query: <?php global $destinations; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $destinations = new wp_query([ 'paged' => $paged, 'location' => $location, 'category_name' => urldecode(get_query_var('filter')), '

javascript - AJAX call a function with a parameter -

the following gives me internal server error. var jsonstatedata; $.ajax({ type: "post", url: "functions.aspx/statesalesdatastring", data: '{' + 'al' + '}', datatype: "json", contenttype: "application/json; charset=utf-8", success: function (data) { jsonstatedata = $.parsejson(data.d); } }).done(function () { console.log(jsonstatedata); }) this function calling //returns stores sales datatable [webmethod] public static string statesalesdatastring(string whichstate) { sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings["dashboard_vwconnectionstringtest"].connectionstring); conn.open(); string storesalesquery = "select storesalestbl.storenumb, lat, lng, todaytotalsales, todaytotalorders, todaytotalwebsales, todaytotalcallsales, todaytotalifsales, todaytotalstoresales, todayto

java - Multiple PIDs for one target service with ds annotations -

i'm wondering if possible leverage explaned @ par.104.7.5 ( using multi-locations ) of osgi enterprise specs using declarative services annotations. quoting specs: it possible bundles interested in multiple pids 1 target service, reason can register multiple pids 1 service. [...] a bundle interested in host configuration register managed service following properties: service.pid = [ "com.acme.host", "com.acme.system" ] the bundle called both com.acme.host , com.acme.system pid , must therefore discriminate between these 2 cases. managed service therefore have callback like: volatile url url; public void updated( dictionary d ) { if ( d.get("service.pid").equals("com.acme.host")) this.url = new url( d.get("host")); if ( d.get("service.pid").equals("com.acme.system")) ... } i tried following syntax: @component( immediate = true, configurationpid = "[com.mycompan

html - How to make text of nested item become red when mouse over? -

a:hover, li:hover { color: red; } <ol> <a href="#"><li>main1</li></a> <a href="#"><li>main2</li> <a href="#"><li>main3 <ol> <a href="#"><li>sub1</li></a> <a href="#"><li>sub2</li></a> <a href="#"><li>sub3</li></a> </ol> </li></a> <a href="#"><li>main4</li></a> <a href="#"><li>main5</li></a> <a href="#"><li>main6</li></a> </ol> i have nested order list. when mouse hover on each item , text become red. however, when mouse on sub item, number of main become red. (example, when hover on sub1 number "3" of main3 become red) how fix it? doing wrong? you have few issues

haskell - Why does the Maybe type wrap its value in a list? -

i'm going through learnyouahaskell , great book, , i'm @ chapter on typeclasses. here's question. in ghci when enter fmap (++ "string appended to") ("i basic string, not type constructor") i error couldn't match type ‘char’ ‘[char]’ expected type: [[char]] actual type: [char] in second argument of ‘fmap’, namely ‘("i basic string, not type constructor")’ i understand why i'm getting error (because functor requires type constructor value just "i value being passed maybe type constructor" don't understand why error reads expected type [[char]] maybe type wrapping value in list? what's deal? list [] functor too. ghc unifies fmap on lists, , deduces first argument type fmap :: (string -> string) -> [string] -> string : λ prelude > :t (fmap :: (string -> string) -> [string] -> [string]) (++ "string appended to") ("i basic string, not type constructor")

c++ - CRC32 not calculated right -

i use simple algorithm calculate crc32 gives wrong values. i compare output values calculator ones looks different unsigned int crc32_tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, .........,..............,.............,.........,........... }; function use lookup table unsigned int myclass::crc32(unsigned int crc, const void *buf, unsigned int size) { const unsigned int *p; p = (const quint8 *)buf; crc = crc ^~ 0xffffffff; while(size--) { crc = this->crc32_tab[(crc ^ *p++) & 0xff] ^ (crc >> 8); } return crc ^~ 0xffffffff; } i call way qstring test= qstring::number(mclass.crc32(0, crcval, 6)) solution drawn chat dicussion the crc-32 algorithm b

bash - How to get environment value from variable? -

if have var value home, path or my_var etc, how can $home, $path var? some thing below: var="home" echo ${$var} # not work as simple that: var="home" echo ${!var} more on indirect references

ios - XML Parsing goes to EXC_BAD_ACCESS code 1 address 0x10 -

so here thing. trying build no-arc/no-storyboard project without previous experience in manual memory-management. full source code available here . i've got here class, helps me create products object custom initialiser products.h @interface products : nsobject @property (nonatomic,retain)nsstring *productname; @property (nonatomic,retain)nsstring *productdescription; @property (nonatomic,retain)nsstring *productimage; -(id) initwithname: (nsstring *) name description: (nsstring *) description image: (nsstring *) image; @end products.m @implementation products -(id) initwithname:(nsstring *)name description:(nsstring *)description image:(nsstring *)image { self = [super init]; if (self) { self.productname = name; self.productdescription = description; self.productimage = image; } return self; @end there can see productparser class, 1 contains of magic productsparser.h @interface productsparser : nsobject <nsxmlparserdele

c# - ADO.NET example that has no logic, dataGrid fill from uknown data -

ok guys, here code have logic , it's simple, result brings datagrid has no logic @ all. here sql query making table , fill table create table students ( id int primary key identity, firstname nvarchar(50), lastname nvarchar(50), gender nvarchar(50) ) go insert students values ('mark', 'hastings', 'male') insert students values ('steve', 'pound', 'male') insert students values ('ben', 'hoskins', 'male') insert students values ('philip', 'hastings', 'male') insert students values ('mary', 'lambeth', 'female') go here code behind, simple u see string cs=configurationmanager.connectionstrings["sampleconnectionstring"].connectionstring; sqlconnection con = new sqlconnection(cs); sqlcommand cmd = new sqlcommand ("select * students", con); con.open(); sqldatareader rdr = cmd.executeread

How to replace string after extraction from WebHarvest? -

i wanted insert records had extracted website db, extraction text contained symbol apostrophe, , had caused me syntax error during sql insertion. may know how replace apostrophe "’" instead in webharvest? thanks in advance! i use script element work on strings, , output new webharvest variable. example: <var-def name="r_output"> long string lots of funny characters new lines , & , ' single , " double quotes </var-def> <var-def name="r_output2"> <script return="r_output2"> <![cdata[ string r_output2 = "\n" + r_output.tostring().replaceall("&", "&amp;").replaceall("\\t","").replaceall("\\n","").replaceall("\\r",""); ]]> </script> </var-def> <var name="r_output2"/> as side note, instead

python - How to call super method? -

i working code has 3 levels of class inheritance. lowest level derived class, syntax calling method 2 levels hierarchy, e.g. super.super call? "middle" class not implement method need call. well, 1 way of doing it: class grandparent(object): def my_method(self): print "grandparent" class parent(grandparent): def my_method(self): print "parent" class child(parent): def my_method(self): print "hello grandparent" grandparent.my_method(self) maybe not want, it's best python has unless i'm mistaken. you're asking sounds anti-pythonic , you'd have explain why you're doing give happy python way of doing things. another example, maybe want (from comments): class grandparent(object): def my_method(self): print "grandparent" class parent(grandparent): def some_other_method(self): print "parent" class child(parent): def

stm32 usb usb_init HardFault -

i'm trying run virtual_com_port stm32_usb-fs-device_lib_v4.0.0. i'm using iar 7.3. buld ok, not run usb. started use debugger. in function void usb_init(void) { pinformation = &device_info; pinformation->controlstate = 2; pproperty = &device_property; puser_standard_requests = &user_standard_requests; /* initialize devices 1 one */ pproperty->init(); } on line pproperty = &device_property; debugger jumps exception handler hardfault_handler. problem? problem whith iar or settings? you accesing memmory shouldn't. hardfault_handler default catches exceptions, configurable fault exceptions disabled. try turning on memmanage_fault: scb->chcsr |= scb_shcsr_memfaultena_msk; //set priority of memmanage fault (using cmsis): nvic_setpriority(memorymanagement_irqn, *priority*); //default name memmanage fault function is: void memmanage_handler(void); after hardfault turn memmanage_fault. not much, gives better idea of dealin

ember.js - How should I import Bower dependencies from an Ember-cli addon into the consuming application? -

i importing jquery plugin via bower used in component in ember-cli addon. however, works because defined bower dependency on plugin in both addon , consuming application. this seems i'm doing wrong. why should consuming application have declare dependency on resource should provided addon? the crux of matter seems app context when building. can omit bower dependency in consuming application if use following import statement in addon's index.js file: app.import('node_modules/my-ember-cli-addon/bower_components/jquery.stickyhooters/dist/jquery.stickyhooters.min.js'); ... breaks when build addon stand-alone application. in case, path required: app.import('bower_components/jquery.stickyhooters/dist/jquery.stickyhooters.min.js'); how intended work? declaring bower dependency in 2 places seems counter-intuitive i don't know how detect app context in index.js of addon checkout ember-cli homepage on default blueprints. describes

android - Add ObjectAnimator to AnimatedVectorDrawable at runtime -

i'm able change fillcolor of animatedvectordrawable using xml files. <?xml version="1.0" encoding="utf-8"?> <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/my_svg"> <target android:animation="@animator/myanimator" android:name="color" /> </animated-vector> <?xml version="1.0" encoding="utf-8"?> <set> <objectanimator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="3000" android:propertyname="fillcolor" android:valuetype="inttype" android:interpolator="@android:interpolator/decelerate_cubic" android:valuefrom="@color/blue" android:valueto="@color/green" /> </set> mimageview = (imageview)findviewbyid(r.id.imageview); drawable drawable = mimagevi

asp.net - Passing a model through a view to another action without editing -

i've got form takes in lot of data. data stored in model object. when form submitted, if passes validation, model passed confirmation view, displays of information submitted in form. [httppost] public actionresult clientprofile(clientprofileformmodel model) { if (modelstate.isvalid) { return view("clientprofileconfirmation",model); } return view(model); } when user clicks submit button @ bottom, need model come action can send email. [httppost] public actionresult clientprofileconfirmationsubmit(clientprofileformmodel model) { string emailtoadminbody = generatefirmprofileadminemail(model); emaillogic.instance.sendemail("test@test.com", "test@test.com", "firm profile " + model.firmaddress.name, emailtoadminbody); return view(model); } my problem is: need simple way of getting model httppost action of form (which sends confirmation p

javascript - Get data out of JSON array from external URL -

Image
i relatively new json. have read tutorial , trying implement no luck. have external url gives json data/feed. data in form of array. trying write javascript program (on local) data out of url , put in html. here function. includes external link also. not getting result. empty. missing or doing wrong? <!doctype html> <html> <head> <meta charset="utf-8"> <title>index page</title> </head> <body> <div id="id01"></div> <script> var xmlhttp = new xmlhttprequest(); var url = "http://mpatrizio-001-site5.smarterasp.net/categorylist.php?d=b7acef70-4901-41c8-930f-d4d681d82daa"; xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { var myarr = json.parse(xmlhttp.responsetext); myfunction(myarr); } } xmlhttp.open("get", url, true); xmlhttp.send(); function myfunction(arr) { var o

ios - How to prevent temporaryContext run concurrently with migratePersistentStore -

i have code part call migratepersistentstore , want prevent temporarycontext in same time, how? my idea based on semaphore , dispatch_group . code a: dispatch_group_wait(dgloadmain, dispatch_time_forever) dispatch_semaphore_wait(semaloadmain, dispatch_time_forever) mainmoc!.performblockandwait({ mainmoc!.persistentstorecoordinator!.migratepersistentstore(/* ... */) }) dispatch_semaphore_signal(semaloadmain) code b: dispatch_group_enter(dgloadmain) dispatch_semaphore_wait(semaloadmain, dispatch_time_forever) dispatch_semaphore_signal(semaloadmain) let context = nsmanagedobjectcontext(concurrencytype: .privatequeueconcurrencytype) context.parentcontext = mainmoc var context: nsmanagedobjectcontext context.performblockandwait({ // .. code not want run when migrating persistent store context.save(nil) }) mainmoc.performblockandwait({ mainmoc.save(nil) }) dispatch_group_leave(dgloadmain) what think it? bette solution? possible use dispatch_barrier

android - Bootstrap column layout for all devices -

Image
i have question bootstrap column layout. necessary specify column layout each device width? example, have item detail, take half of screen in center. made wrapper div classes col-*-6 , col-*-offset-3 (so take 6 columns , offset 3 columns). then, in element, have children take 3 columns , 1 take 9 fill full width of container. <div class="col-md-6 col-md-offset-3 toppad"> <table> <tr><td class="col-md-3">project id:</td><td class="col-md-9">{$project['name']}</td></tr> </table> </div> is correct? , possible make work devices without coding each of them? luboš suk , hi there. your main question (need classes)... yes is. if want control how want viewed on devices need use col-xx-xx classes... or choose correct single class show in demo here you. if use col-xs-xx rather col-md-xx way can work too. your option of red , grey blocks using 1 col-md-xx

Android - Checkboxes in ListView lose their status when user open/hide soft keyboard -

i implemented custom arrayadapter manage data , show in listview. code of custom adapter: private class viewholder{ user user; checkbox check; } @override public view getview(final int position, view convertview, viewgroup parent) { final viewholder holder=new viewholder(); layoutinflater inflater = (layoutinflater) getcontext() .getsystemservice(context.layout_inflater_service); user c = getitem(position); if(convertview==null) convertview=new usercheckablerow(getcontext(),c.getchecked()); checkbox name = (checkbox)convertview.findviewbyid(r.id.usercheckbox); name.settext(c.getname()); holder.user=c; holder.check=name; name.setchecked(holder.user.getchecked()); convertview.settag(holder); name.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { viewholder holder=(viewholder)((view)v.getparent().getparent()).gettag(); checkbox c

android - I have two attr in appcompat_v7 and FloatingButtonAction -

my project contains these 2 libraries , reason error when want run on device : the error follows: workspace_desarrollo\librerias\floatingactionbutton\res\values\attrs.xml:6: error: attribute "color" has been defined look @ both libraries , found both defined . did rename fab library , reads follows: <attr name="colortem" format="color"/> everything normal, when run app , button shows me white background. there 3 buttons use , puts 3 white background. previously did not have problem, had change pc , when import new workspace projects started dating error. the appcompat_v7 in : target=android-21 the floatingactionbutton in : target=android-19 android.library=true android.library.reference.1=../nineoldandroids my project in : target=android-21 android.library.reference.1=../../librerias/floatingactionbutton android.library.reference.2=../../librerias/appcompat android.library.reference.3=../../librerias/google-play-services_l

laravel - Will Model::updateOrCreate() update a soft-deleted model if the criteria matches? -

let's have model soft-deleted , have following scenario: // existing soft-deleted model's properties $model = [ 'id' => 50, 'app_id' => 132435, 'name' => 'joe original', 'deleted_at' => '2015-01-01 00:00:00' ]; // new properties $properties = [ 'app_id' => 132435, 'name' => 'joe updated', ]; model::updateorcreate( ['app_id' => $properties['app_id']], $properties ); is joe original joe updated ? or there deleted record , new joe updated record? updateorcreate model deleted_at equal null won't find soft-deleted model. however, because won't find try create new 1 resulting in duplicates, not need. btw, have error in code. model::updateorcreate takes array first argument.

java - Error catching with try-catch and while loop -

this question has answer here: how handle infinite loop caused invalid input using scanner 5 answers i'm trying make sure users input integer when use below code infinite loop of print statement. advice of how improve? boolean valid = false; system.out.println("what block gathering? (use minecraft block ids)"); while(valid == false){ try{ block = input.nextint(); valid = true; } catch(inputmismatchexception exception){ system.out.println("what block gathering? (use minecraft block ids)"); valid = false; } } nextint() doesn't consume invalid input try read same invalid value on , on again. solve problem need consume explicitly calling next() or nextline() accept value. btw make code cleaner , avoid expensive operations creating exceptions should use methods hasnextint() . h

sql - If my subquery is returning multiple value then i need to perform normalization? -

select title movie movie_no = (select movie_no customer inner join issues on customer.`cus_id`=issues.`cus_id` name = 'shyam') no. need use in or any : select title movie movie_no in (select movie_no customer inner join issues on customer.cus_id = issues.cus_id name = 'shyam' ); i mean, might need normalize data other reasons, subquery returning more 1 value not such reason. and, data structure seems reasonable, based on 1 query.

javascript - How to make a list item show/hide another DIV? -

i have 2 lists: · source selector; · · content of selected source; i need know how turn each item of source list button, show it's content when clicked, , stay highlighted when selected, itunes smart playlists (for example). someone can make code me? have jquery already, can't make work... #tabs { z-index: 1; top: 60px; height: 576px; width: 244px; font-family: gotham, "helvetica neue", helvetica, arial, sans-serif; font-size: 12px; padding-top: 5px; float: left; overflow: scroll; max-height: 591px; left: -40px; outline: dotted; } #source { height: 656px; width: 244px; background: #eee; font-family: gotham, "helvetica neue", helvetica, arial, sans-serif; font-size: 12px; outline: dotted; } #content { height: 300px; width: 500px; text-align:right; overflow-y: scroll; text-align:center; outline: dotted; } .list { font-family: sans-serif; margin: auto; width:

Awk: splitting a field -

new awk , try that's simple it's taking me while. simplify things, have text file called 'sample' , contains following line: 164516454242451bx%apt 110 225 1784 ohio usa i want following output using awk: apt 110 225 is there way can split $1 "apt" separate field? code i'm trying below. recieve no error, output 2 blank lines. awk ' begin { split($1," ","%") } print $2,$3,$4 end { print "" } ' sample you can % 1 of delimiters: awk -f'[ %]' '{print $2, $3, $4}' file the same can done using split well: awk '{split($1,a,/%/); print a[2], $2, $3}' file

ms access - select data by month sql -

i have table consisting of: product_id (number), product_name (varchar), expired_date (datetime) i need select products expired on next 6 months. created statement, doesn't give me error message, guess it's not working because returns no result. the statement: select prod.product_id, prod.product_name, prod.expired_date (month(prod.expired_date)) - month(date()) = 6 where did go wrong? additional question : i want records expired on sixth month month selected well. example, 6 months january 2016. 1 of record has expired_date in january 16, 2016 , today july 06, 2015. there few days remaining until become whole 6 months, record not selected. should select of records expired in january? note: i'm working ms access. instead, want this: where prod_expired_date < date_add(curdate(), interval 6 month) month() returns month number, 1 12. not want. i should add, if want things expire in future: where prod_expired_date >= curdate() ,

haskell - Where does `stack build` store generated executables? -

i'm using multiple stack.yaml files build against ghc 7.8 , 7.10. how set path include binaries specific stack.yaml file, e.g. stack-7.8.yaml ? the stack path --local-install-root command solves problem. e.g., setup path binaries stack --stack-yaml stack-7.8.yaml , do export path=$(stack --stack-yaml stack-7.8.yaml path --local-install-root):$path note: stack exec command can used here, don't want clutter scripts calls stack --stack-yaml stack-7.8.yaml exec <cmd> instead of plain <cmd> .

ggplot2 - How can I override the ggplot function in R? -

i use theme_bw command in pretty of r plots, thinking of overriding ggplot function so: # override ggplot function use theme_bw default ggplot <- function(...) { ggplot(...) + theme_bw() } however, when this, interpreter complains, saying error: evaluation nested deeply: infinite recursion / options(expressions=)? is there way specify ggplot inside function should original version of ggplot, not 1 wrote? use :: operator specify want call version of function lives in ggplot2 package, not version created in global workspace. i.e. like ggplot <- function(...) { ggplot2::ggplot(...) + theme_bw() } should work (although haven't tested it!) i have strong preference theme_bw() . way use theme_set() right after load package, e.g. library("ggplot2"); theme_set(theme_bw()) which arguably easy , more idiomatic/transparent solution.

php - Highlight searched word -

in symfony2, how highlight word search search box : // search twig: {% block body -%} <h1>results of "{{ find }}"</h1> {% if entities%} {% entity in entities %} <table class="record_properties"> <tbody> <tr> <td>><a href="{{ path('onequestion_show', { 'id': entity.id }) }}">{{ entity.question }}</a></td> </tr> </tbody> </table> {% endfor %} {%else%} <td>no results found</td> {%endif%} {% endblock %} //searchcontroller : public function searchaction() { $request = $this->getrequest(); $data = $request->request->all(); $find = $data['search']; $em = $this->getdoctrine()->getmanager(); $query =

javascript - Get a div to fade out on mouse hover of another div -

i'm trying .image img fade out when description-box hovered. $(".description-box").on({ mouseover: function () { cleartimeout(timer); $(".image img").fadeout(); }, mouseout : function () { timer = settimeout(function () { $(".image img").fadein(); }, 100); } }); edit https://jsfiddle.net/pugu9vyy/ something maybe... fiddle $(".description-box").on({ mouseover: function () { timer = settimeout(function () { $(".image img").fadeout(); }, 100); }, mouseout: function () { cleartimeout(timer); $(".image img").fadein(); } });

amazon web services - why my web application is not working with RDS instance in AWS? -

i have instance of mysql db in rds aws , in java web application changed url new instance of db connection since didn't write in property file, war file working news instance when have deployed on local tomcat when deployed in elastic beanstalk application, not working, know reason?

c# - Argument Exception while converting byte array to image -

i convert image byte[] using code ( form.cs ): private void button1_click(object sender, eventargs e) { form1 fom = new form1(); imageconverter converter = new imageconverter(); byte[] imgarray = (byte[])converter.convertto(fom.panel1.backgroundimage, typeof(byte[])); imagedata img = new imagedata { classname = textbox1.text, password = textbox2.text, image = imgarray, }; using (boarddatabaseentities dc = new boarddatabaseentities()) { dc.imagedatas.add(img); dc.savechanges(); messagebox.show("saved database"); } this.close(); } then, trying convert image :: protected void button1_click(object sender, eventargs e) { using (boarddatabaseentities dc = new boarddatabaseentities()) { var v = dc.imagedatas.where(a => a.classname.equals(textbox3.text) && a.password.equals(textbox4.text)).firstordefault(); if (v != null) {

swift - How to reference a property from exact instance from another class? -

i've found similar questions none of solutions seem work. problem: i have class, generalpostareacontroller: uiviewcontroller it has property, " queryobject " defined " parsequeryer() " (custom class created data objects) essentially " queryobject " stores data create post i have another class (which separate file) , posttableviewcell: uitableviewcell i want reference " queryobject " inside posttableviewcell can actions data inside " queryobject " code below: class generalpostareacontroller: uiviewcontroller { var queryobject = parsequeryer() ...other code here in file: class posttableviewcell: uitableviewcell { //reference queryobject here thank you! btw new programming , swift. quick , dirty solution let queryobject static variable. class generalpostareacontroller: uiviewcontroller { static var queryobject = parsequeryer() } then, can access queryobject anywhere in applicati

java - URL in JSON object as POST request Android -

Image
please me send json object in post http request through httpclient, in android. the problem facing json object having url replaced forward slash ,i.e originally should have following value in json object {"product": {"featured_src":"https:\/\/example.com\/wp-content\/uploads\/2015\/06\/sidney-compressed.jpg, "short_description":"this test","title":"raiders north"} } i tried many options keep in above format. comes {"featured_src": we assume input private final static string json_data = "{" + " \"product\": [" + " {" + " \"featured_src\": \"https:\\/\\/example.com\\/wp-content" + "\\/uploads\\/2015\\/06\\/sidney-compressed.jpg\"," + " \"short_description\": \"this test\"," + " \"title\" : \"raid

html - Center ul without div -

im trying center circles (carousel indicators) on page . tryed all, width 100%, margin auto, nothing work. i dont have more ideas. looking @ page, don't see circles not centered. regards centering ul without div, can via css. example, css: #carousel-indicators li { list-style:none; float:left; text-align:center; height:110px; overflow:hidden; } then @ ul, specify <ul id="carousel-indicators";> this not tested on carousel-indicators work image , text content under ul , li tags.

javascript - How do I read in data from a JSON file using dc.js? -

i want read in data json file using dc.js, new programming , don't know how to. you should put following: d3.json("filename", function(error, data) { //insert code here }

html - css: make inner container height 100% with top and bottom margin -

Image
i have strange case: i try make inner container fill parent (height 100% height), result overflowed content in bottom: but must (100% except margin top , bottom): code: <!doctype html> <html> <head> <link rel="stylesheet" href="style.css"> <script src="script.js"></script> </head> <body> <div class="main-wrapper"> <aside class="full-nav" action-bar> </aside> <section class="wrapper"> <header> </header> <div class="content"> <div class="innner-wrapper"> <div class="main-partial"> <div class="content-wrapper">content</div> </div> </div> </div> </section> </div> </body> </ht

mongodb - Meteor/Mongo DB $gte operator not working on find(); -

i trying make query return 'productos' on current 'categoria', need have 'stock.cantidad' field greater or equal 1 , 'stock.idcedis' equal specific value, , how trying it: return productos.find( { idcategoria: router.current().params._id, "stock.cantidad":{$gte: 1}, "stock.idcedis":idcedis }); i checked , "stock.idcedis":idcedis working fine displaying 'productos' have specific 'idcedis', having problems "stock.cantidad":{$gte: 1}, part because don't know why meteor or mongo db matter ignoring it. the schema stock part of 'productos' using this: stock: { type: [object] }, "stock.$.cantidad": { type: number, label: "cantidad de stock", min: 0 }, "stock.$.idcedis": { type: string, label: "centro de distribución" }, so know if doing wrong or

python - Flask Deploy on Heroku - Error R10 -

i deployed app , ran url shows application error. checked log, states: * running on http://127.0.0.1:5000/ web process failed bind $port within 60 seconds of launch procfile web: python run.py ${port} run.py from app import app app.run(debug=false) i tried os import environ app import app app.run(debug=false, port=environ.get("port", 5000), processes=2) in both case error still persist views.py @app.route('/') @app.route('/login', methods=["get","post"]) def login(): .... that's not how run flask application in production. need actual server, such gunicorn, , point app object: web: gunicorn app:app this explained in heroku tutorial .

oracle sql how to distinct and remove all null values in the fields -

hi how distinct , remove null values in fields. original table. im using sqldeveloper , oracle. empno lastname firstname 05-may-15 06-may-15 07-may-15 08-may-15 09-may-15 ---------- -------------------- -------------------- --------------------------- --------------------------- --------------------------- --------------------------- --------------------------- 00000113 reyesue marie +000000000 08:04:00.000000 00000113 reyesue marie +000000000 08:12:00.000000 00000113 reyesue marie +000000000 08:04

python - why slicing django queryset return a list -

i have queryset derived piece of code, called objs. print both type(objs) , type(objs[0:10]) in same print function follows: print(type(objs), type(objs[0:10])) the results show type(objs) queryset. type(objs[0:10]) list but when lookup django document, second 1 should queryset. possible reasons this? the django docs say : slicing queryset has been evaluated returns list. if slice unevaluated queryset , you'll queryset (as long don't use "step" parameter of slice syntax).

ruby - How to define a method for return array values for wrap_parameters in rails -

i'm new in rails , ruby, , can't figure out way doesn't work. believe more ruby thing rails. if try thing: class clientescontroller < applicationcontroller wrap_parameters include: parametros_aceitos and have parametros_aceitos defined in clientescontroller this: def parametros_aceitos [ :cnpj, :razao_social, :nome_fantasia, :ie, :enderecos_attributes ] end i got error: actioncontroller::routingerror (undefined local variable or method `parametros_aceitos' clientescontroller:class) thanks help

database - How to group a couple of rows in SQL Server? -

i have query: select table1.id, table1.code1, table1.code2, table1.details, table1.ids, table2.name table1 inner join table2 on table1.code1 = table2.code1 table1.ids = 1 order table1.code1, table1.code2 this result query: id code1 code2 details ids name 1 1001 01 d1 1 n1 2 1001 01 d2 1 n1 3 1001 02 d3 1 n1 4 1001 05 d4 1 n1 5 1002 11 d5 1 n2 6 1002 12 d6 1 n2 7 1005 21 d7 1 n3 8 1005 21 d8 1 n3 but want result: id code1 code2 details ids name 1 1001 01 d1 1 n1 2 01 d2 1 3 02 d3 1 4 05 d4 1 5 1002 11 d5 1 n2 6 12 d6 1 7 1005 21 d7 1 n3 8

python - How to combine (Logical OR) two images with pillow? -

i have 2 binary black , white images (mode=1) in pillow. i'd create new image of same size binary addition of both. in other words, i'd logical oring of each pixel. i've been reading docs while , can't figure out seemingly simple task. ideas?

c++ - openCL glGetProgramInfo causing Core Foundation crash -

i writing c++ command line program in xcode (6.4) on osx yosemite (10.10.4). using apple's opencl framework , trying save opencl binaries disk. first create program source , build follows: cl_int err; cl_program result = clcreateprogramwithsource(context, numfiles, (const char **)sourcestrings, null, &err); errormanager::checkerror(err, "failed create compute program"); err = clbuildprogram(result, devicecount, devices, null, null, null); errormanager::checkerror(err, "failed build program"); the above code works fine , can launch kernels without error. then try access binary sizes... size_t *programbinarysizes = new size_t[devicecount]; err = clgetprograminfo(result, cl_program_binary_sizes, sizeof(size_t) * devicecount, programbinarysizes, null); however call clgetprograminfo causes xcode throw exc_breakpoint has following output: corefoundation`__cftypecollectionretain: 0x7fff8e2c2480 <+0>: pushq %rbp 0x7fff8e2c2481 <+1>: