Posts

Showing posts from August, 2015

html - Radio buttons not changing how javascript selects elements my table? -

Image
problem how use radio buttons control selection behavior jquery ui? right now, can select green boxes (success) intended check out. please note when select orange. my problem if choose check in, cannot select of blue boxes. also, need way "refresh" when change radio buttons green boxes not still selected when want change radio buttons. code (view) i using jquery selectable job done. can read more api documentation found here . tried jquery "filter" based on whether or not radio box checked. clearly, approach failing. edit think approach failing because loading javascript once? when change radio buttons, filter definition not changing. <html> <head> <meta name="viewport" content="width=device-width" /> <title>details</title> <link rel="stylesheet" href="~/css/table.css" /> <script> $(document).ready(function(){ //have condition

php - Migrating routes from old format to new one, where is the docs for this? Missing? -

as perhaps may notice previous post i'm working on sf2.0.x app new sf2.7. right i'm having lot of notice , don't affect app functionality , want prevent this. have read routing chapter @ sf book, the routing component , @ route , @method annotations can't find helpful fix issue. need people here. right now, routes, looks 1 below (in xml format): <route id="pdonebundle_repproject_process" path="/project/{page}/{action}"> <default key="_controller">pdonebundle:projectdetail:process</default> <requirement key="page">\w+</requirement> <requirement key="action">add|update|delete</requirement> <requirement key="_format">html</requirement> <requirement key="_method">post|get</requirement> </route> and message below notice getting: deprecated - "_method" requirement deprecated since version

ios - Can i install ipa signed by release(appstore) profile on my iphone -

can install ipa signed release(appstore) profile on iphone, befor submitting app store. if yes, how? if ipa generated using distribution certificate , provisioning profile seems in case no can not install on device.

php - Encrypting URL in Objective-C -

i using objective-c communicate php script, works api. although not wish script accessed else, actual ios app on users device. functions require admin permission, , essential app. is there way encrypt link, people won't able sniff link? or somehow limit access of script. regards mads use https (ssl/tls) , pin certificate, secure can get. query string encrypted. note entire url including query string saved in server log file. this require ca signed certificate , can purchased $50/year if shop around. there several cas offer free certificates: free ssl certificates free ca

html - Rails simple-form with multiple instances of the same object -

i trying create rails form using simple form uses nested resources. however, want able submit multiple instances of associated resource. example below explain better. <div class="tab-pane active" id="reminder"> <%= simple_form_for @collection, html: {multipart: true}, url: collection_index_path |m| %> <%= render partial: "collection/tabs/reminder", locals: { :m => m } %> </div> -inside partial <% 9.times |j|%> <div class="tab-pane" id="<%= j %>"> <%= m.simple_fields_for :reminder |p| %> <%= p.input :heading %> <%= p.input :message %> <% end %> </div> there tabbed pane in user can click through 9 tabs set 9 reminders, should associated collection (collection model accepts nested attributes reminder). however, way have setup now, controller gets set in last reminder in params

python - How to filter Django objects to accept matches and NULLs? -

i have model has foreignkey field, null=true . the field-semantics null entry permissive, while non-null entry binds single row in foreign table. i want build orm filter corresponds to: select * foo foo.fk_field = ? or foo.fk_field null (where question mark represents single value in foreign table.) is possible in django orm, need resort raw query? use q objects : from django.db.models import q foo.objects.filter(q(fk_field=fk_value) | q(fk_field=none))

python - Get the index of a QTableWidget row knowing its elements -

[i'm using pyqt4, think qt4 issue not python specific.] i have qtablewidget . in each row, first column holds button. when clicked, row removed. to remove row, use removerow(int row) method, takes argument index of row. when connecting signal, can't know index of row because might change in meantime (for instance if first row removed, row indexes changed). the accepted answer here suggests pass callback instance of qtablewidgetitem in line, row number item @ deletion time. this nice, except none of elements of row qtablewidgetitem . elements button , few comboboxes. i can't figure out way around this. can somehow fit 1 of elements qtablewidgetitem? should add qtablewidgetitem in sort of hidden column? our current implementation uses indexat(qtgui.qapp.focuswidget()) (see other answer question mentioned above), looks sorry workaround me. if replace button checkable qtablewidgetitem this rm_item = qtgui.qtablewidgetitem() rm_item.setflags(qtcore.qt.it

c++ - User Defined Reduction on vector of varying size -

i'm trying define own reduction vectors of complex<float>, following this answer question reducing on array in openmp . but size of vectors aren't fixed @ compile time, i'm not sure how define initializer vector in declare reduction pragma. is, can't have initializer( omp_priv=tcomplexvector(10,0) ) but initializer needed vectors. how can pass initializer clause size of vector need @ run time? have far below: typedef std::vector<complex<float>> tcmplxvec; void complexadd(tcmplxvec & x,tcmplxvec & y){ (int i=0;i<x.size();i++) { x.real()+= y.real(); //... same imaginary part , other operations } } #pragma omp declare reduction(addcmplx: tcmplxvec: \ complexadd(&omp_out, &omp_in)) initializer( \ omp_priv={tcmplxvec(**here want variable length**,0} ) void dosomeoperation () { //tcmplxvec vec empty , anothervec not //so each thread runs inner loop serially #pragma omp parallel reduction(

Mapreduce MultipleOutputs error -

i want store output of mapreduce job in 2 different directories. eventhough code designed store same output in different directories. my driver class code below public class wordcountmain { public static void main(string[] args) throws exception { configuration conf = new configuration(); job myhadoopjob = new job(conf); myhadoopjob.setjarbyclass(wordcountmain.class); myhadoopjob.setjobname("word count job"); fileinputformat.addinputpath(myhadoopjob, new path(args[0])); myhadoopjob.setmapperclass(wordcountmapper.class); myhadoopjob.setreducerclass(wordcountreducer.class); myhadoopjob.setinputformatclass(textinputformat.class); myhadoopjob.setoutputformatclass(textoutputformat.class); myhadoopjob.setmapoutputkeyclass(text.class); myhadoopjob.setmapoutputvalueclass(intwritable.class); myhadoopjob.setoutputkeyclass(text.class); myhadoopjob.setoutputvalueclass(intwritable.class); multipleoutputs.addnamedoutput(myhadoopjob, "output1", textoutputforma

c# - how to authenticate user with rest service-wcf WebHttpBindig? -

i have server-client project written in c#. want change client side web client can open browser. decided make wcf rest service replace server side. binding using service webhttpbinding. problem behavior of service. service data (vars etc..) initialize after every call. if add [servicebehavior(instancecontextmode = instancecontextmode.persession)] doesn't change anything. if use [servicebehavior(instancecontextmode = instancecontextmode.single)] , works guess service instance same every client. i have simple html web page username , password client , post service. service check login info user database , response. problem can't save user status logged in or not because after every post/get method service reset. what should do? this pretty standard issue have deal when trying maintain session on http, webhttpbinding using. if try force have session, won't. restful services don't work way. a high level overview of have have service create token give

java - Why is doAction() getting to done() early? -

i have of strange problem. have doaction() swingworker for loop remove rows jtable , data base. if for loop large done() method fire off before loop completed, stopping execution midway. my code: public void doaction() throws exception { int selectedrows[]; int modelrows[]; java.util.arraylist<customrecord> condemned; customtablemodel datasource; boolean databasedelete = false; object uniqueid; int rowcount = 0; datasource = (customtablemodel)table.getmodel(); selectedrows = table.getselectedrows(); condemned = new java.util.arraylist<customrecord>(); modelrows = new int[selectedrows.length]; for(int i=0;i<selectedrows.length;i++) modelrows[i] = table.convertrowindextomodel(selectedrows[i]); selectedrows = null; for(int i= 0; < modelrows.length; i++){ uniqueid = datasource.getuniqueid(modelrows[i]); system.out.println("debug: spot 1, rowcount = " + rowcount +

html - How to make input placeholder text not opaque when the text field background is opaque -

i have input text field @ { opacity: 0.2; } , has background color of white (#ffffff) on top of black , white image. text field @ correct opacity , looks great. want placeholder text white , not effected opacity of input field. have tried looking how style placeholder text, still seems effected elements opacity. how go doing this? css reference... html, body { padding:0; margin: 0; background-color:#222222; } .notifyemail input[type="text"] { display:block; margin: 0 auto; margin-bottom: 10px; background-color:#ffffff; color: white; padding-right:30px; font-family:inherit; text-transform:uppercase; font-size:14px; height:50px; width:540px; opacity:0.2; } thanks much! try changing second class this. specifies background-color in rgba format , removes opacity attribute: .notifyemail input[type="text"] { display:block; margin: 0 auto 10px 0; padding-right: 30px; background-color: rgba(255,255,255,0.2); font-family:i

javascript - what the method this.method.bind(this) does? -

this question has answer here: use of javascript 'bind' method 11 answers met code first time: var controller = function($scope){ this._scope = $scope; } controller.$inject = ['$scope']; controller.prototype.augmentscope = function() { this._scope.a = { methoda: this.methoda.bind(this) } } i don't understand point. explanations? it assumes in closure scope (if none in global scope such window ) there method called methoda. again, because enclosing scope mentioned), remind , assign ti used through object well. can execute by: methoda() or a.methoda() edit explain closure : although javascript similar java/c++ in syntax it's quite different both of them in sense when function instantiated object, remembers scope instantiated in. highly recommend doing more casual js(if there such thing), this article . this

Syntax for switch-case in Java -

i'm using switch case in java first time , i'm bit unsure syntax. assuming setteamname function works, does, following function make of teams in array have placeholder string it's name or should case 0: since starts @ 0? public static team[] maketeams(){ team[] teams = new team[10]; for(int = 0; < teams.length; i++){ switch(i){ case 1: teams[0].setteamname("arsenal"); case 2: teams[1].setteamname("arsenal"); case 3: teams[2].setteamname("arsenal"); case 4: teams[3].setteamname("arsenal"); case 5: teams[4].setteamname("arsenal"); case 6: teams[5].setteamname("arsenal"); case 7: teams[6].setteamname("arsenal"); case 8: teams[7].setteamname("arsenal"); case 9: teams[8].setteamname("arsenal"); case 10: teams[9].setteamname("arsenal");

Chrome Dev Tool: Length of Tab Indent When Copying -

Image
something changed on chrome dev tool, i'm not sure was. generally, after debugging in chrome, copy updated code , paste notepad++. indention changed 4 spaces 2. @ first thought, "i'll change indention length in notepad++", makes html harder read. i messed tab indent options in dev tool settings, didn't fix issue. tried both "detect indention" on & off , different spacings "default indention". please help!

java - How to do Multiple URL Mapping (aliases) in Spring Boot -

in specific i want multiple url mapping (in other words aliases) in spring boot in detail in spring boot application customer controller class has mapped /customer url below want create changeable aliases @controller @requestmapping(value = "/customer") public class customercontroller{ in normal spring application mapping in xml, can url mapping below. <bean class="org.springframework.web.servlet.handler.simpleurlhandlermapping"> <property name="mappings"> <props> <prop key="/customer.htm">customercontroller</prop> <prop key="/tester.htm">customercontroller</prop> </props> </property> </bean> <bean id="customercontroller" class="com. ... .controller.customercontroller" /> spring boot, property file configurations helpful in of time autoconfig working under roof. is there way can same using pro

php - Content of url A available on url B in Wordpress -

how make content of url: http://www.test.com/category/kariera/ available on url: http://www.test.com/kariera/ in wordpress mod_rewrite? i think refer apache mod_rewrite (wordpress running on apache server),with apache mod_rewrite configure vhost.conf this: rewriteengine on rewriterule ^category/kariera/(.*) http://www.test.com/kariera/$1 [p,r,l] i think not forget anything. the p means proxy (the request redirected without showing it. the r means redirect (the request redirected) the l means last (this 1 last processed rule request ) check apache.org docs explain this. hope you!! edit just forgot tell .htaccess in original directory rewrite code, same (sorry server has multiple vhosts , config there)

C++ Binary search algorithm to work like lower_bound -

i have question following previous - i creating version of lower_bound binary search. binarysearch function find place insert new item , cycle move rest of array , insert right item can insert right position. but following binarysearch function not work properly. can see why? bool creg::addcar ( const char *name){ carr * tmp = new carr(name); // item going insert int pos = binarysearch(name,0,len); //len = number of items in array checklen(); // whether have enough space move array right if (length!=0) (int = m_len; i>=pos; i-- ) arr[i+1] = spzarr[i]; arr[pos] = tmp; length++; checklen(); return true; } int binarysearch(const char * name, int firstindex, int lastindex) { if (lenght == 0) return 0; //number of items in array if (firstindex == lastindex) return lastindex; int tmp = lastindex - firstindex; int pos = firstindex + tmp / 2; //position new item should go if (tmp % 2)++pos; if (lasti

c# - Shunting-Yard Validate Expression -

we use shunting-yard algorithm evaluate expressions. can validate expression applying algorithm. fails if there missing operands, miss-matched parenthesis, , other things. shunting-yard algorithm has larger supported syntax human readable infix. example, 1 + 2 + 1 2 1 2 + are acceptable ways provide '1+2' input shunting-yard algorithm. '+ 1 2' , '1 2 +' not valid infix, standard shunting-yard algorithm can handle them. algorithm not care order, applies operators order of precedence grabbing 'nearest' operands. we restrict our input valid human readable infix. looking way either modify shunting-yard algorithm fail non-valid infix or provide infix validation prior using shunting-yard. is aware of published techniques this? must support both basic operator, custom operators, brackets, , functions (with multiple arguments). haven't seen works more basic operators online. thanks a nice discussion on shunting yard algorithms

c# - How does one make a transparent portion of a button clickable in WPF? -

Image
i have bunch of toolstrip buttons transparent backgrounds in wpf. when user mouses on outside of button, nothing happens, because part of button transparent. once user mouses on 1 of non-transparent areas of button, "hover" behavior changes border , background color. background no longer transparent, hover behavior continues larger area before. transparent areas of button behave if button non-transparent there. that is, have behavior button unselected despite mouse being inside button area: and i'm trying button selected if user has not moused on foreground "white" part of button: i tried setting ishittestvisible on button itself, didn't seem make difference. is there way ask wpf consider transparent areas of button significant? xaml looks this: <button style="{staticresource maintoolstripbuttonstyle}" margin="5,0,0,0" tooltip="{staticresource openbuttontext}" automationproperties.name="{staticresour

c - malloc nulling other variables -

i using following function int parse_headers(char *str, struct net_header *header) { char *pch; struct net_header *h, *temp; pch = strtok(str, "\n"); header->name = pch; h = malloc(sizeof(struct net_header)); header->next = h; while ((pch = strtok(null, "\n")) != null) { h->name = pch; temp = malloc(sizeof(struct net_header)); h->next = temp; h = temp; } return n_success; } up until line header->next = h , works planned. however, after line h = malloc(sizeof(struct net_header)); , variables pch , str reason turn null (i set breakpoints find this). after line temp = malloc(sizeof(struct net_header)); , header turns null . clearly, have kind of memory management issue, can't seem find is. header argument initialized before call function header = malloc(sizeof(struct net_header)); struct net_header declared as struct net_header { char *name; char *c

c++ - Write output to new files at every nth iteration -

a fragment of code : for (int iter = 0; iter < flags.total_iterations_; ++iter) { if (iter%20==0) { std::ofstream mf(flags.model_file_.c_str()); accum_model.appendasstring(word_index_map, mf); } else { std::cout << "model not created "; } std::cout << "iteration " << iter << " ...\n"; so, trying generate outputs method accum_model @ every 20th iteration. but, problem have write output in new file everytime 20th iteration reached. now, output being overwritten. i execute code of executible, as: ./lda --num_topics 15 --alpha 0.1 --beta 0.01 --training_data_file testdata/test_data.txt --model_file mf/lda_model.txt --burn_in_iterations 120 --total_iterations 150 the mf/lda_model.txt output file given. not understanding how link file contains code , executible command need 5 different new files (for 100 iterations - data written new file every 20th iteration). i new coding , far, coding in python. tried

c# - Transferring all data from dataGridView to a textbox -

here question. have restaurant program in customer chooses wishes eat , data displayed in datagridview. example 6 different dishes = 6 different rows each containing name, amount , price. after need print bill, want information datagridview textbox. rows. how can that? p.s. i've searched lot there information on how transfer currentrow data textbox i've found. private void form4_load(object sender, eventargs e) { form1 f1 = new form1(); string billinfo = string.empty; foreach (datagridviewrow row in f1.datagridview1.rows) { billinfo = string.format("{0}{1} {2} {3}{4}", billinfo, row.cells["name"].value, row.cells["amount"].value, row.cells["price"].value, environment.newline); } textbox1.text = billinfo; } just loop through each row , format column values string, adding system.environment.newline seperating entries in textbox . string billinfo = strin

osx - Missing Kernel.framework/Headers -

i'm attempting build internal project requires libkern/osatomic.h , make (using clang) complaining not found. i'm using latest version of xcode (6.2). coworker has following folder on system: /system/library/frameworks/kernel.framework/headers i not have folder. need make sure system headers available? so sorry, i'm idiot. had not installed clt (command line tools) xcode yet.

CURL and PHP - keep cookies values for next request -

i have following problem - after send post request page, let's example.com/search.php i'm getting first page of results , links pages looks this: example.com/search.php?start=15 but query search stored in cookies this: phpbb2mysql_sid 5e9f95bceb61e9634ce3df03123d9446 which save in cookie jar, when trying access next page results looks curl doesn't use cookies first query, replace them new ones, page i'm trying open search empty. here's code: public function getpage($url) { $cookie_file_path = 'public/userfiles/cookie.txt'; $ch = curl_init(); curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_nobody, false); curl_setopt($ch, curlopt_url, $this->parent_url); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_cookiejar, $cookie_file_path); curl_setopt($ch, curlopt_cookie, $cookie_file_path); curl_setopt($ch, curlopt_useragent, "mozilla/5.0 (windows; u; windows nt 5.0;

twitter bootstrap 3 - How can one enlarge the search control in a FuelUX 3.x repeater? -

Image
this simple customization issue not covered tutorial: search control small—any reasonable query not fit. how can 1 make longer (possibly occupying remaining free space)? add css rule overrides: .fuelux .repeater-search { float: left; width: 200px }; such .myapp .fuelux .repeater-search { float: none; width: auto; }; then this as long using .repeater-search class should able edit markup bootstrap columns, etc.

android - My app option in 'share with' from contextual action bar of any app -

i have built dictionary app says find meaning of words. i have noticed 'share with' option (if present) in contextual action bar of app gives list of apps, selected data can shared. for ex. in browser on long pressing of text , selecting share in contextual action bar can share 'keep' app create note. want enlist app here user can directly find meaning of selected text. i understand have implement sort of listener , maybe android autolist app, unable find exact steps. have seen apps other system apps in share option, believe can done app. could give me directions same. also there way can recognize unique trigger, example triple click on word in app , fragment of dictionary pops shall contain meaning. know last part not possible achieve still? add androidmanifest.xml <activity android:name=".ui.myactivity" > <intent-filter> <action android:name="android.intent.action.send" /> <category

r - Getting an element from an array using a vector as an index -

given k_matrix matrix > k=4; > k_matrix = array(runif(k*k) , dim = rep(2,k), dimnames = null) > k_matrix , , 1, 1 [,1] [,2] [1,] 0.3919999 0.2033387 [2,] 0.7053074 0.6531753 , , 2, 1 [,1] [,2] [1,] 0.9474465 0.6097955 [2,] 0.7115899 0.8040770 , , 1, 2 [,1] [,2] [1,] 0.01687723 0.6536963 [2,] 0.91289535 0.5464496 , , 2, 2 [,1] [,2] [1,] 0.3858341 0.7031602 [2,] 0.7991189 0.1577894 if execute, > k_matrix[2,1,1,1] [1] 0.7053074 i "second" element. however, if try same result using vector (vec) contains coordinates of second element, this: > vec = c(2,1,1,1) > k_matrix[vec] [1] 0.7053074 0.3919999 0.3919999 0.3919999 ,which not expected result. how can can solve issue?

PHP Function call with AJAX - Update cookie -

Image
i'm trying update cookie in online-store. when amount of specific product in store updated, cookie has updated , reload page. i'm trying onchange event jquery . coded follows: $.ajax({ type: 'post', url: "./dao/winkelwagendao.php", data: {function: "updateaantal", productid: productid, aantal: aantal}, success: function (data) { console.log("succeeded!", data); //location.reload(); //to reload page }, error: function (err) { console.log("something went wrong in ajax-request: ", err); } }); }); this works , logging correct things. now php-file catch event: if (isset($_post['function'])) { $action = $_post['function']; switch ($action) { case 'updateaantal' : echo "\namount change productid: " . $_post[

java - I couldn't make this programm run as I wanted -

public class phone { public static void main(string args[]) { string numbers[][] = { { "tom", "555-3322" }, { "mary", " 555-8976" }, { "jon", "555-1037" }, { "rachel", "555-1400" } }; int i; if (args.length != 1) system.out.println("usage: java phone <name>"); else { (i = 0; < numbers.length; i++) { if (numbers[i][0].equals(args[0])) { system.out.println(numbers[i][0] + ": " + numbers[i][1]); break; } if (i == numbers.length) ; system.out.println("name not found."); } } } } so after trie run theses line of code,i didn't other result, apart first sysout statement. your code has few errors. usage: java phone it looks expe

java - How come when I cast down I cannot access the subclass properties? -

class casting { main() { //instantiate subclass motox cellphone myphone = new motox("motorola", "white", true, 5); motox phone = (motox) myphone; //i tried call motox methods using myphone //however netbeans showed properties within cellphone class } } i know down cast serves convert, if will, super class more specific subtype, when don't gain access motox class' properties. myphone defined cellphone . if want use motox methods, should either define motox : motox myphone = new motox("motorola", "white", true, 5); or explicitly cast when use it: cellphone myphone = new motox("motorola", "white", true, 5); ((motox) myphone).somemotoxmethod();

encoding - Perl - IMAP search unicode string with X-GM-RAW -

i'm using perl , mail::imapclient module search emails , fetch them gmail server, stuck on problem unicode strings in x-gm-raw. when send command: search charset utf-8 x-gm-raw "Новости" it doesn't work :( but search charset utf-8 x-gm-raw "news" works no problems , returns list of message ids my perl-script looks follows: #!/usr/bin/env perl use utf8::all; use strict; use warnings; use feature 'say'; use mail::imapclient; $imap = mail::imapclient->new( server => 'imap.gmail.com', user => 'username@gmail.com', password => 'secr3t', ssl => 1, uid => 0, debug => 1 ); $imap->select('[gmail]/all mail'); $news = $imap->search('charset utf-8 x-gm-raw "Новости"'); print "@$news"; # print message ids debug messages: started @ wed apr 15 00:25:43 2015 using mail::imapclient version 3.35 on perl

apache - IP of Web server stays in URL instead of showing Domain Name -

so lets have domain name "www.example.com" , have "http-redirect" server "1.1.1.1" apache2 running on ubuntu 14.04 server amd64. have web files on server , working perfect. not working right url. instead of "www.example.com/sites.php" if have "1.1.1.1/sites.php". how can fix this? did far: disabled default virtual host , created new one: <virtualhost *:80> serveradmin bla servername example.com serveralias www.example.com documentroot /var/www errorlog ... customlog ... </virtualhost> (it's typed, since can't copy console..) i tried enter in /etc/hosts 1.1.1.1 www.example.com thanks help as discussed in comments, reason see ip address in browser http-redirect pointing directly to ip address, there's no domain name display. redirect tells browser go elsewhere , browser fetches website supplied url, same if you'd click on link. if redirect ur

objective c - (CarbonCore.framework) FSEventStreamFlushSync(): failed assertion '(SInt64)last_id > 0LL' -

i'm use library cdevents monitor file system. when calling method flash synchronously - (void)flushsynchronously { fseventstreamflushsync(_eventstream); } get message (carboncore.framework) fseventstreamflushsync(): failed assertion '(sint64)last_id > 0ll' here method signature fseventstreamflushsync() fsevents.h /* * fseventstreamflushsync() * * discussion: * asks fs events service flush out events have * occurred have not yet been delivered, due latency * parameter supplied when stream created. * flushing occurs synchronously -- time call returns, * callback have been invoked every event had * occurred @ time made call. * fseventstreamflushsync() can called after stream has * been started, via fseventstreamstart(). * * parameters: * * streamref: * valid stream. * * availability: * mac os x: in version 10.5 , later in coreservices.framework * carbonlib: not avail

html - Why can't I center my navigation? -

okay, centered navigation in 1 of themes, reason cannot replicate same effect when copied , pasted code. this website http://goo.gl/wsfozw i have tried various combinations of using display: inline-block , margin: 0 auto , , text-align: center nothing seems work @ moment. is there missing? the reason it's not working because setting width of ul 100% if change auto work. .main-navigation ul { display: inline-block; list-style: outside none none; margin: 0px auto; padding-left: 0px; text-align: center; width: auto; /* change line */ }

java - How to make a random 2D jagged array of varying length? -

i have create 2d jagged array random number of rows (5-10) each row having random length (5-10). filled jagged array random numbers. should this: 2 4 1 5 3 8 6 3 2 5 8 9 7 4 3 5 6 6 7 9 3 5 2 6 7 8 4 5 3 6 7 1 4 2 2 1 this current createarray method public static int [][] createarray(){ int row = (int)(math.random()*5)+5; int column = (int)(math.random()*5)+5; int[][]array = new int[row][]; for(int = 0; < array.length; i++){ for(int j = 0; j < array[i].length; j++){ //fill matrix random numbers array[i][j] = (int)(math.random()*10); }} return array; }//end createarray method however, randomizes rows , columns , doesn't create jagged array. can lead me in right direction? lot! as @doubledouble stated, code throws nullpointerexception . it looks want this: public static int [][] createarray(){ int row = (int)(math.random()*5)+5; //int column = (int)(math.random()*5)+5; //not need

javascript - my JS work on second click -

this js. dont know why "x" created append last child doesn't work on first click, work on second click. "x" url in cloned div. causing problem? or there wrong in html? $(document).ready(function () { $(".add").click(function () { var aaa = $(this).parent("div").attr('id') $(this).parent().children(".add").siblings(".name,.detail,.price").clone().appendto(".cart").wrapall('<div class="dump ' + aaa + '"></div>') $(this).removeclass("add").addclass("added"); $(".dump:last-child").append('<a class="delc" href="javascript:delc()">x</a>'); $(".dump").removeclass("dump") }); }) //////////////// function delc() { $(document).on('click', '.delc', function () { var xx = $(this).parent(&quo

android studio - App unfortunately closing -

i receiving "app has unfortunately stopped" error. using parse assuming issue lies somewhere within that. this java file causes error when loading public class newtipactivity extends activity { private tip tip; @override protected void oncreate(bundle savedinstancestate) { tip = new tip(); requestwindowfeature(window.feature_no_title); getwindow().addflags(windowmanager.layoutparams.flag_fullscreen); super.oncreate(savedinstancestate); //new tip fragment setcontentview(r.layout.activity_new_tip); fragmentmanager manager = getfragmentmanager(); fragment fragment = manager.findfragmentbyid(r.id.fragmentcontainer); if (fragment == null) { fragment = new newtipfragment(); manager.begintransaction().add(r.id.fragmentcontainer, fragment) .commit(); } } public tip getcurrenttip() { return tip; } } java.lang.runtimeexception: unable start activity componentinfo{com.holyapp.danshinn.wingman

php - AJAX how to grab returning value AND database connections -

i quite new jquery , ajax. sending request via ajax check file 'test' every 5 seconds works fine. 'test' stands test.php file. <script> $(document).ready(function () { function load() { var test = "<?php echo $test; ?>/"; $.ajax({ //create ajax request load_page.php type: "get", url: test, datatype: "html", //expect html returned contenttype: "text/html", success: function (response) { $("#responsecontainer").html(response); settimeout(load, 5000) } }); } load(); //if don't want click // $("#display").click(load); //if want start display on click }); </script> <div id="responsecontainer"></div> test.php $id = $this->session->userdata('userid'); $get_friends_notifica

dll - How can I use matlab source code in labview without matlab? -

i found mathscript can this,but seem slow. want use matlab create dll file used labview,but information can find how dll used in c++,but c++ must use .lib file ,i concerned labview not use lib. file. so can use .dll in labvew,and how?is there anyother way use matlab source code in labview without matlab? you need purchase matlab compiler quite expensive unless student. you can call matlab application (if it's installed) using matlab script node (which different mathscript) - see here another alternative python's numpy picked coming matlab background. if want go down route can give further advice on how integrate labview.

ember.js - container.lookup('store:main') returning undefined -

i'm using emberjs , have initializer loading current user in store. have no idea why not working. current initializer is: export function initialize(container, application) { var store = container.lookup('store:main'); console.log(store); } export default { name: 'current-user', after: 'preload', initialize: initialize }; when log container , convert global variable in console, , run temp1.lookup('store:main') object. i'm pretty confused right why initializer isn't able load store. it's because initializer running before 1 sets store. ember data initializer can found here . described in initializer api , need this: export default { name: 'current-user', after: ['preload', 'ember-data'], initialize: initialize };

C# Weird Bug when trying to remove Controls from Group Box -

i facing weird issue. want remove controls group box, not remove controls. seems bug on microsoft's end right now. tried many different techniques of removing these controls, none of them worked. have 2 other methods removing 1 control @ time (and no, cannot call in loop controls) , there works fine. have no idea issue be. knows way around this. foreach (control c in fieldbox.controls) // not work, removes labels (i have 1 txt , 1 lbl) fieldbox.controls.remove(c); (int = 0; < fieldbox.controls.count; i++) // not work either fieldbox.controls.remove(fieldbox.controls[i]); (int = 0; < fieldbox.controls.count; i++) // still no success fieldbox.controls.removeat(i); (int = 0; < fieldbox.controls.count; i++) // nope fieldbox.controls.removebykey(fieldbox.controls[i].name); foreach (control c in fieldbox.controls) // final answer, outcome did not change

python - Huge time difference when making a set inside a list comprehension compared to outside -

i have test case below, find elements present in 2 strings , return them in order of first string. why second case, set(string2) done inside list comprehension on order of magnitude slower? import timeit timeit.timeit( """ import random, string string1 = ''.join(random.choice(string.ascii_uppercase) _ in range(100000)) string2 = ''.join(random.choice(string.ascii_uppercase) _ in range(100000)) v=set(string2) [x x in string1 if x in v] """, number=10, ) # 2.005337953567505 timeit.timeit( """ import random, string string1 = ''.join(random.choice(string.ascii_uppercase) _ in range(100000)) string2 = ''.join(random.choice(string.ascii_uppercase) _ in range(100000)) [x x in string1 if x in set(string2)] """, number=10, ) # 22.1062970161438 python building set(string2) set every iteration of 'loop' in list comprehens

c++ - JPEG Compression using OpenCV -

Image
i'm trying perform basic jpeg compression (dct + quantization + idct) using opencv not using entropy-encoding/huffman-coding. problem after decompress compressed image, not close in appearance original one. i'm following these tutorials: basic jpeg compressing/decompressing simulation basic jpeg compression using opencv following 3 images (original, compressed , decompressed images): i'm using following matrix luminance , chrominance: double dataluminance[8][8] = { {16, 11, 10, 16, 24, 40, 51, 61}, {12, 12, 14, 19, 26, 58, 60, 55}, {14, 13, 16, 24, 40, 57, 69, 56}, {14, 17, 22, 29, 51, 87, 80, 62}, {18, 22, 37, 56, 68, 109, 103, 77}, {24, 35, 55, 64, 81, 104, 113, 92}, {49, 64, 78, 87, 103, 121, 120, 101}, {72, 92, 95, 98, 112, 100, 103, 99} }; double datachrominance[8][8] = { {17, 18, 24, 27, 99, 99, 99, 99}, {18, 21, 26, 66, 99, 99, 99, 99}, {24, 26, 56, 99, 99, 99, 99, 99}, {47, 66, 99, 99, 99, 99, 99,