Posts

Showing posts from September, 2011

Css Color menu Wordpress -

Image
i have issue background on menu each category through css example in picture below. wordpress. background 1 category: background 2 category: if have name on menu sport make sport background colors love through css in wordpress. you can use javascript code in case insert header.php or similar <script type="text/javascript"> $( document ).ready(function() { var test = document.getelementbyid("menu-item-26"); var check_exist = test.classlist.contains("current-menu-item"); if(check_exist){ var x = document.getelementsbyclassname("header"); x[0].style.backgroundcolor="#333"; } }); </script> change menu-item-26 id_of_your_menu keep current-menu-item because when menu selected class added in menu change header class class want change background. set color. that's all. my result original

go - Can httptest be used to test HTTP/2? -

i'm wondering if this (httptest) package can used test http/2 specific features. can point me examples maybe? i'm aware of tool h2i , it's interactive tool. i'm looking programmable. edit : i'm looking tool, example can initiate server push , test on client side. so, using package, how have access underlying http/2 stuff uses default? edit 2: found examples in nghttp2 source: https://github.com/tatsuhiro-t/nghttp2/tree/master/integration-tests edit 3: me looks package net/http2 isn't meant used directly anyone. i'll experiment this one. https://github.com/summerwind/h2spec go program tests whether server implementation conforms rfc 7540. allows craft individual http/2 frames such as: settings := http2.setting{http2.settinginitialwindowsize, 0} http2conn.fr.writesettings(settings) or var hp http2.headersframeparam hp.streamid = 1 hp.endstream = false hp.endheaders = true hp.blockfragment = http2c

arrays - Java use 1 billion digits of pi -

i trying make program search first 1 billion digits of pi , find user specified number, problem facing how use pi... have .txt file contains pi (i broke 96 different files because java couldn't handle such big file) digits in first line.... code (only read , save pi using 96 files): for(int = 1;i <= 96; i++){ string filename = ""; if(i <= 9){ filename = "res//t//output2_00000" + + "(500001).txt"; }else{ filename = "res//t//output2_0000" + + "(500001).txt"; } scanner infile = new scanner(new filereader(filename)); ar.add(infile.nextline()); } list<string> pi = new arraylist<string>(); for(int = 0; i<97;i++){ system.out.println(i); for(string j : ar.get(i).split("")){ pi.add(j); } } this seems work fine point crashes following error (the last print statement 3): exception

asp.net mvc 4 - ViewContext.ParentActionViewContext is null when trying to access parent ContentArea in EPiServer -

i'm trying use approach shown here allow blocks in episerver query index within parent contentarea. in project (project a) , trying again in new project (project b). reason in new project, viewcontext.parentactionviewcontext null. started comparing differences between 2 , notice in project a, ischildaction true , routedata.datatokens contains 1 key = 'parentactiondatacontext', in project b, ischildaction false , routedata.datatokens contains keys main request. ok, given description of parentactionviewcontext property is: an object contains view context information parent action method. it makes sense null in project b if there no child action. problem is, don't know why project executes rendering contentarea child action project b not. comparing call stacks, can see branches off in 2 different directions within episerver assembly (top 2 frames of each stack below): project a episerver.dll!episerver.web.mvc.partialrequest.renderaction(system.web.mv

sql server - Exchangeable fields in SQL index -

i m designing table list of chats. every chat references 2 users , must unique per given user pair. evidently, user pair symmetric permutations: not matter, user in pair comes first , 1 comes second. suppose user table has integer userid pk. chat table have pair of fk fields: userid1, userid2 . want every pair of users have unique record in chats table. can create unique index(userid1, userid2) . however, index not unique in terms of user pair because may include permutations when userid2 comes first: (userid1, userid2) , (userid2, userid1) 2 distinct different pairs, while required logic, should treated 1 distinct record. is there way implement construct in pure sql without external coding, such db triggers or scripting? m using ms sql server prototyping. want have design universal , neutral possible compatible sql compliant databases. mere question on optimal architecture on specific sql implementation code such. possible ideas: make , index on hash of ordered user pa

sql - Select Top 10, but 11 Results -

i have following query select top 10. result show 11 rows, when change select top 20, shows 21? is there wrong query causing this? select top 10 format([dutydate],"ddd"", ""dd-mmm-yy") [shift date], count(shifts.id) shifts shifts group format([dutydate],"ddd"", ""dd-mmm-yy") order count(shifts.id) desc; when ms access processes top , puts ties in last value. in sql server, equivalent top ties . so, if 11th row has same count 10th, included -- , 12th , on, if counts same. to fix this, need include sort of tie-breaker. in group by , date. here easy method: order count(shifts.id) desc, min(dutydate)

excel - Copy from one workbook into another using a file path name -

i trying run macro using existing workbook 1) opens different workbook i'll call other 2) copies values other workbook 3) pastes values other existing workbook , 4) closes other workbook. below code have far. there way better define or set y? code works except not able close other , think if had y better defined use y.close. thanks! dim x worksheet dim y worksheet set x = activeworkbook.sheets("file44") workbooks.open (thisworkbook.path & "\file44.xlsm") workbooks("file44.xlsm").activate set y = activeworkbook.sheets("file44 - detail") lastrow = y.range("a" & rows.count).end(xlup).row y.range("a15:cq" & lastrow).copy x.range("a2").pastespecial xlpastevalues activeworkbook.close savechanges:=false untested sub chris2015() dim other workbook dim fromws worksheet dim tows worksheet dim lastrow long set tows = thisworkbook.sheets("file44") 'pasting worksheet se

c++ - Make a simple makefile generic -

i have simple makefile me compile examples: ex104: ex104.cpp $(cpp) ex104.cpp $(incs) $(linkflags) $(compileflags) -o ex104 clean: rm -f *.o $(executable) now, works fine. problem is: need explicitly write rule each of examples, copying following line many, many times: ex104: ex104.cpp $(cpp) ex104.cpp $(incs) $(linkflags) $(compileflags) -o ex104 is there way generic-ize bit? end command line below build ex252 ex252.cpp built automatically: make ex252 fortunately, it's template-only library, have build 1 cpp file, , not need keep track of object files. make has bunch of default rules , want should works if instead of variables using default 1 flags given. if version of make not have such default, should add 1 (it correspond gnu make default rule intermediary variables inlined , obsolete 1 removed) : .cpp: $(cxx) $(cxxflags) $(cppflags) $(ldflags) $(target_arch) $^ $(ldlibs) -o $@ cxx c++ compiler cxxflag

core data - Xcode bindings: can not add object to NSArrayController -

have entity axis relationship [to many] entity axisvalues . , try add axisvalue object selected object axis . bind 1 nsarraycontroller axes managedobjectcontext, entity axis . second nsarraycontroller selected axis values entity axisvalue bind contentset axes , controllerkey selection , modelkeypath axisvalues . in interface works nice, in nstableview have proper values. cannot add or remove axisvalue objects action add: or remove: connected selected axis values controller. how bind selected axis values have possibility add , remove objects actions add: , remove: ?

java - JMockit match against null -

new expectations() {{ somemethod.getlocalobj().getvalue((someclass)any); returns(1); times=1; request.dosomething().settransaction((null)any); // here****how match ?? times=0; }}; hi. i'm trying match against method sets variable null. how can in jmockit? thanks. you looking method here: withnull() : same withequal(object), checking invocation argument in replay phase null.

android - AlertDialog not showing inside OnClickListener -

i want display alertdialog inside onclicklistener . alertdialog not showing when use following code inside onclicklistener . great. final alertdialog alertdialog = new alertdialog.builder(myclass.this).create(); alertdialog.settitle("info:"); string alert1 = "first name: " + fname; string alert2 = "surname: " + sname; string alert3 = "id: " + tid; string alert4 = "password: " + tpassword; alertdialog.setmessage(alert1 +"\n"+ alert2 +"\n"+ alert3+"\n" + alert4); alertdialog.setbutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { startactivity(intent); } }); alertdialog.show(); }}); add below code in

garbage collection - JMX JConsole not showing CMS LastGCInfo -

Image
i looking @ garbage collection statistics , wondering why lastgcinfo empty concurrentmarksweep . although, see collectioncount , collectiontime info same. could please me understand why.

Drawing circle gradually in android -

Image
i want show circle being drawn in android gradually this: how should start? needs done? progressbar p p=(pregressbar)findviewbyid(r.id.p); objectanimator animation = objectanimator.ofint (p, "progress", 0, 100); animation.setduration (3000); animation.setinterpolator (new decelerateinterpolator ()); animation.start ();` then in xml <progressbar android:id="@+id/p" style="?android:attr/progressbarstylehorizontal" android:layout_width="@dimen/progreess_circle" android:layout_height="@dimen/progreess_circle" android:layout_gravity="center" android:rotation="270" android:progress="0" android:drawingcachequality="low" android:progressdrawable="@drawable/circular" /> circular.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerradiusrat

binning - Can anyone help me where I am making mistake in my matlab programming? -

this question binning data using matlab. have 2 data sets. in 1 data sets have x (represent speed) , y(represent power) value binned , calculated mean std,edge , h value(see code) of calculation want identify , pass incoming data(here in code 1 newdata) particular bin in belong(which ready calculated here in given below code), . in code below, newdata contain new data sets matching bin. please me making mistake or modify , getting following error : error using > matrix dimensions must agree. error in binning_online (line 23) newdatabin=find(newdata>binedges,1,'last'); %this bin number new data goes in code: x= load speed; y= load power; newdata= load new_speed; topedge = 20; % upper limit botedge = 5; % lower limit numbins = 40; % define number of bins [n,edges,bins] = histcounts(y_vector,numbins); pow_means = []; speed_means = []; n = 1:numbins; pow_means(n,1) = mean(x_vector(bins==n,1)); % each bins mean value calculation. speed_means(n,1)

cassandra 2.1 - Difference between CQL insert and update? -

i'm new cassandra , come relational world. when playing cql observed didn't find difference. ex: when execute below query update product set price=100, currency=usd productid=12345; then cql creates new row in table. in rdbms won't work since there no product productid = 12345. can provide insight ? what you've discovered cassandra writes (with few exceptions) writes without reads. there number of reasons - 1 performance (reading first slow), consider first insert may have happened on server, , not yet replicated server processing update. what you're saying "set price $100usd product 12345". if no such product exists (yet?), it's still setting price, because it's not going take time find out if product exists. if need check if row exists, cassandra provides paxos implementation lightweight transactions ( http://www.datastax.com/dev/blog/lightweight-transactions-in-cassandra-2-0 ) can provide if [not exists] type logic

javascript - In Meteor, how/where do I write code that triggers when an authorized user has logged in? -

new meteor, i'm using alanning:roles package handle roles. i've managed able publish collection when user logged in, when page first refreshed. meteor.publish('col', function(){ if (roles.userisinrole(this.userid, 'admin')) { console.log('authed'); return sessions.find({}); } else { console.log('not auth'); // user unauthorized this.stop(); return; } }); logging out kills access collection (i'm using mongol see). logging in after logging out, or logging in logged out state when page first loaded, not give me access. the webapp i'm trying build ticketing system. i'm trying secure, no unnecessary publishing if user not authorized. what i'm trying is, ticket information submitted users collection, , display on client screen (as long client authorized first). maybe better way handle force refresh (how do that?) after user change unauthorized users "kicked&

javascript - dstore filter date range -

i have data array has date attribute, need filter data based on date. i using dstorejs store data below this.employeestore = new memory({data:[emplist],idproperty:"emp_num"}); i need make filter based on employee's joining date , joined 1st of jan 2014 till 3rd of march 2015 this.employeestore.filter({joindate:'01/01/2014'}); this gives employees joined on 1st of jan 2014 if need filter in range this.employeestore.filter.gte({joindate:'01/01/2014'}); this not work because not number, string or date object to achieve need write custom store mentioned in tutorial ? is there other way of doing this? or there other framework dstore achieve ? you can achieve using dojo/store query filter , query callback function manage comparing date and using dojo/date compare function compare date of emplist array specific date below : this.employeestore = new memory({data: somedata}); var comparedate = new date(2014,1,1); var

javascript - How to make plotline appear on line chart when data is same highcharts? -

im trying add plot line line chart. when data same e.g [7.0, 7.0, 7.0] plot line doesn't show. when data , down plot line shows e.g [7.0, 8.0, 7.0]. there way make plot line show when data same? jsfiddle my high chart set is: $(function () { $('#container').highcharts({ title: { text: 'monthly average temperature', x: -20 //center }, subtitle: { text: 'source: worldclimate.com', x: -20 }, xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, yaxis: { title: { text: 'temperature (°c)' }, plotlines:[{ value:10, color: '#ff0000', width:2,

php - Inserting Data mysqli not working -

here html form section... cant understand mistake <!doctype html> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="loginstyle.css"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no"> <link href='https://fonts.googleapis.com/css?family=jura:600' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="font awseome glyphicons/css/font-awesome.min.css"> <link href='https://fonts.googleapis.com/css?family=lora:700' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=lato' rel='stylesheet' type='text/css'> <

ios - NSUndoManager errors with "unrecognized selector sent to instance" -

working on implementing nsundomanager within ios9 app. current undo code looks this: func setactivecolordata(colordata: colordata) { if colordata != activecolordata { print(self) undomanager?.registerundowithtarget(self, selector: "setactivecolordata:", object: activecolordata!) undomanager?.setactionname("change color") print("set undo action") activecolordata = colordata } } colordata simple class 3 floats inside of (hue, saturation, brightness) , utility methods. everything works fine, including shake gesture brings undo prompt. once click undo, app crashes , following error: 2016-02-25 16:26:58.225 color[89399:5503615] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[color.pickerviewcontroller setactivecolordata:]: unrecognized selector sent instance 0x7fa080776820' *** first throw call stack: ( 0 corefoundation 0x

python 2.7 - Increment list index in a while loop -

i'm trying print first 12 numbers in fibonacci. idea increment 2 list index numbers. list = [0,1] #sets first 2 numbers in fibonacci sequence added, list append next 10 numbers listint = list[0] #sets list variable want incremented list2int = list[1] #set other list variable incremented while len(list) < 13: #sets loop stop when has 12 numbers in x = listint + list2int #calculates number @ index 2 list.append(x) #appends new number list listint += 1 #here supposed incrementing index list2int +=1 print list my output is: [0, 1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21] i want: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 please note beginner, , i'm trying without using built in functions. (i'm sure there sort of fibonacci sequence generator). thanks in advance help! change first line of while loop: list = [0,1] #sets first 2 numbers in fibonacci sequence added, list append next 10 numbers listint = list[0] #sets

mongodb - Sort subfields with unknown parent -

i have schema this: { "_id" : "555", "connections" : [ { "id" : 111 "time" : 1456439249 }, { "id" : 222 "time" : 1556412345 } ... } "users" : [ "111" : { "id" : 111 "name" : "michael" }, "222" : { "id" : 222 "name" : "jim" } ... } i want sorted connections time , users data. i'm trying this: db.getcollection('mycollecion') .find( {'_id' : '555'}, {'_id' : 0, 'connections' : 1, 'users' : 1} ).sort({'connections.time' : 1}) probably "connections.time" not correct path, because it's array. how can sort connections subf

c++ - Storing a pointer to a template type of the same template class -

let's have following: template<typename a, typename b> class foo { private: m_a; b m_b; foo<a,b>* m_pfoo; public: foo( a, b b, foo<a,b>* pfoo = nullptr ); }; with class can save pfoo m_pfoo long instantiation of types match such: int main() { foo<int, int> foo1( 3, 5 ); foo<int, int> foo2( 2, 4, &foo1 ); // works foo<int, int> foo3( 5, 7, &foo2 ); // still works foo<double, int> foo4( 2.4, 5 ); foo<double, int> foo5( 7.5, 2, &foo4 ); // works foo<double, int> foo6( 9.2, 6, &foo5 ); // still works // compiler error - can not deduce template arguments foo<double, int> foo7( 3.7, 2, &foo1 ); // doesn't work return 0; } in previous question demonstrated similar problem , initial question how pass pointer class template type same class template constructor, 1 of responses received regarding passing in pointer not problem, s

java - Jpa unidirectional @OneToOne where columns should be created in another table -

i have employee , department requirement, want field department in employee entity, want department hold foreign key, rather employee holding dept_id. later can achieved using @joincolumn. mapped not option, unidirectional. do know if there way so? it joincolumn should use , set attributes of annotation correct way. class department { @onetoone @joincolumn(name="id",referencedcolumnname = "here comes foreign key departmentid ") employee employee; }

How to view each and every column in a mysql table in a pop-up-window by clicking view in PHP? -

i have listed table database in web page 'edit,delete,view' option in each , every column. how can view particular column in apop window (for eg - student detail) clicking view ??? you can use bootstrap open popup in modal window. check below url http://getbootstrap.com/javascript/

python - Django Nested Tab Form -

Image
i have created template recursively build nested tab pages of form/s. each tab page can contain form, or tab page, n levels deep. this created via view, ordered dictionary ( form_dict ) passed via context. in file forms/snippets/form_dict.html form_dict iterated over, , either renders form (forms/snippets/form_standalone.html) or calls again, if node contains ordered dictionary, code has been provided below: forms/snippets/form_dict.html {% load sekizai_tags %} {% if form_dict %} {% if not level or not tier %} {% include "forms/snippets/form_dict.html" form_dict=form_dict level='tab' tier='0' %} {% else %} {% tier=tier|add:1 %} <ul class="nav nav-tabs nav-tabs-{{tier}}" {%ifequal tier 0 %}id="mytab"{% endifequal %}> {% key,form in form_dict.items %} {% counter=forloop.counter|stringformat:"s" %} {% newlevel=''|a

form helpers - Prevent CakePHP to create div with input field -

every time create input field using $this->form->input('name'); it creates div element <div class="input name"> <input type="text"> </div> is there way prevent creation of div block around input field. also, there way add custom class div created? like <div class="input name mystyle"> <input> </div> i'm using cakephp 3.2 you need override templates. can creating new config file: config/app_form.php return [ 'inputcontainer' => '{{content}}' ]; then load in view: src/view/appview.php class appview extends view { public function initialize() { parent::initialize(); $this->loadhelper('form', ['templates' => 'app_form']); } } http://book.cakephp.org/3.0/en/views/helpers/form.html#customizing-the-templates-formhelper-uses

Pycharm interpreter error for Flaskr application (official Flask tutorial sample) -

Image
my context i'm educating myself python flask via official tutorial . i'm using pycharm ide (community edition) in ubuntu destkop 16 . the issue i open sample code of tutorial pycharm project got invalid python interpreter error below snapshot my question how can fix it? it's looking functional python installation. if open 2 drop-down you've referenced you'll see selection of python installations on machine. the better option though, create virtualenv current project, click on cog icon right of project interpreter drop-down , click create virtualenv , follow prompts. once created, should pick virtualenv default python interpreter project , error disappear, though remember, because it's new virtualenv, won't yet have flask etc installed on it. can install flask library clicking + icon underneath cog , searching/installing flask. alternatively, create requirements.txt file on project root directory, flask cont

Unable to get Comments from Instagram API -

Image
today have created 1 account , made sandbox users list made request ( https://api.instagram.com/v1/users/self/media/recent/?access_token=access-token ) unable comment data instagram api response. i able number of comments count not able comment data. missing while making authentication or need particular access permissions required?

sql - how to get out value of one procedure into another procedure in mysql -

i have 2 procedure namely "createorder" , "createandress" and in "createorder" procedure have 4 in parameter , 1 out parameter. and in "createandress" procedure have 3 in parameter , 1 out parameter. and calling "createandress" inside "createorder" procedure below call create_address (in_userprofile_id, in_pin, true, in_address_id); but how out value of "createandress" "createorder" procedure ? do inside createorder stored proc -- declare variable receive output value of procedure. declare @outparameterforcreateaddress int; -- execute procedure specifying in_userprofile_id, in_pin, true,in_address_id input parameter -- , saving output value in variable @outparameterforcreateaddress execute create_address in_userprofile_id, in_pin, true, in_address_id, @youroutparameternameincreatedaddress = @outparameterforcreateaddress output; -- display value returned proce

html - jQuery submit does not work but submit button does -

i've simple form want submit when click on tag. created jquery this: jquery(function(){ jquery( "#ci-submit-location-form" ).click(function() { jquery( "#ci-location-search" ).submit(); }); }); for reasons don't see page after submit set in forms action field. seems page "realoading". jquery fired console.log when put in click(). however, simple submit field fires form correctly , desired page. what have overlooked?! here's dom of form: <form action="restaurant-list.php" id="ci-location-search" method="get"> <input type="text" class="ci-location-input" placeholder="straße" /> <a href="" id="ci-submit-location-form" class="ci-submit-location-form" />send</a> <input type="submit" value="submit" /><!-- testing purpose --> <div class="ci-clear"></div>

php - Same URL for multiple routes -

how can same url pointing different controllers depending on user role ? for instance /route1 should poiting on admin\route1controller@index if user has admin role, , otherrole\route1controller@index if user has otherrole role. how can done ? you can achieve using middleware in routes.php file creating roles using roman bican roles package in laravel.

return value - Laravel 5.2 can't read model property type from DB like as 'number' (with PHP7) -

i've weird problem local environment. if return laravel model json, every attributes returned string , not numbers or booleans. $j = jobposition::find($id); return $j; if use php 5.5 return-types correct. on server works fine php7, think it's local php setup. here is, how compiled php 7.0.4: ./buildconf --force env yacc=`brew --prefix bison27`/bin/bison ./configure --prefix="/usr/local/opt/phpng" --with-config-file-path="/usr/local/etc/phpng" --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-gd-jis-conv --enable-mbstring --enable-pcntl --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-zip --enable-json --with-bz2 --with-curl --with-iconv --with-freetype-dir=`brew --prefix freetype` --with-gd --with-gettext=`brew --prefix gettext` --with-gmp --with-jpeg-dir=`brew --prefix gd` --with-mcrypt=`brew --prefix mcrypt` --with-mysqli=`brew --prefix`/bin/mysql_

how to get utf 8 encoded file with php -

this question has answer here: utf-8 way through 14 answers i want .html or .txt file folder php, file utf-8 encoded, , if use $html=file_get_contents('somewhere/somewhat.html'); , after echo $html; won't utf-8 encoded. see many "�" in text. idea? how can prevent this? you need convert utf8 yourselves. use mb_convert_encoding() , mb_detect_encoding() php functions. like this, $html=file_get_contents('somewhere/somewhat.html'); $html=mb_convert_encoding($html, 'utf-8',mb_detect_encoding($html, 'utf-8, iso-8859-1', true)); echo $html; mb_convert_encoding() converts character encoding mb_detect_encoding() detects character encoding

Login to salesforce.com with Phantomjs 2.0 keep asking for verification code -

Image
we doing tests connect salesforce.com phantomjs 2.0. working pretty good, in last couple of weeks salesforce.com kept asking verification code every new session. is experiencing same issue? you can whitelist ip address in order stop salesforce asking verification code. go setup -> security -> network access , add ip whitelist.

android - AndroidRuntime: FATAL EXCEPTION: couldn't find "libgnustl_shared.so" -

i have made research regarding question no answer helped. new android please ask more sources , info publish. have migrated our company app eclipse android studio still fatal: androidruntime: fatal exception: main process: com.streamunlimited.stream700, pid: 6297 java.lang.unsatisfiedlinkerror: dalvik.system.pathclassloader[dexpathlist[[zip file "/data/app/com.streamunlimited.stream700-2/base.apk"],nativelibrarydirectories=[/data/app/com.streamunlimited.stream700-2/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libgnustl_shared.so" @ java.lang.runtime.loadlibrary(runtime.java:367) @ java.lang.system.loadlibrary(system.java:1076) @ com.streamunlimited.stream700.deviceoverviewactivity.<clinit>(deviceoverviewactivity.java:86) @ java.lang.class.newinstance(native method) @ android.app.instrumentation.newactivity(instrumentation.java:1068) @ android.app.activitythread.performlaunchactivity(activitythread.java:2365) @ android.app.activitythread.handle

php - Add to cart $_SESSION has been destroy after logged in -

Image
why $_session["products"] has been destroy after logged in, how keep $_session["products"] after logged in? add product cart before logged in. after logged in cart empty. code login.php <?php ob_start(); session_start(); include 'init.php'; require_once 'config.php'; //initalize user class $user_obj = new cl_user(); if(!empty( $_post )){ try { $user_obj = new cl_user(); $data = $user_obj->login( $_post ); if(isset($_session['logged_in']) && $_session['logged_in']){ header('location: home.php'); } } catch (exception $e) { $error = $e->getmessage(); } } if(isset($_session['logged_in']) && $_session['logged_in']){ header('location: home.php'); } ?> <!doctype html> <html lang="en"> <head> <meta c

can random C++ 2011 standard functions be called from a C routine? -

i need generate random integer range , have found interesting discussed here in answer @walter . however, c++11 standard , need use c , there way of making call c? reproduce answer here: #include <random> std::random_device rd; // used once initialise (seed) engine std::mt19937 rng(rd()); // random-number engine used (mersenne-twister in case) std::uniform_int_distribution<int> uni(min,max); // guaranteed unbiased auto random_integer = uni(rng); you cannot use c++ classes in c, can wrap c++ functionality in functions, can called c, e.g. in getrandom.cxx: #include <random> static std::random_device rd; static std::mt19937 rng(rd()); static std::uniform_int_distribution<int> uni(min,max); extern "c" int get_random() { return uni(rng); } this c++ module exporting get_random function c linkage (that is, callable c. declare in getrandom.h: extern "c" int get_random(); and can call c code.

php - Crack Own Password Database Feasibility -

with plethora of vbulletin hacks going on lately, have modified 3.8.x software line use password_hash() function in php more security. have designed code converts password when user logs in (forced log in on next visit). problem is, have many users don't log in long time , want protect them too. kicking around idea of purchasing/leasing large gpu power , using hashcat crack , convert passwords have. from initial testing, works rather until 7-8 character passwords (using ?a charset in hashcat). after that, process slows down crawl. there real hope in doing success, large length passwords? if so, kind of power should get? together, have close million different salted accounts. is idea feasible?

python - Problems getting JSON with urllib.URLopener -

i have problems getting json urllib.urlopener when can see in navigator. code: import urllib import json json_obj = urllib.urlopener() json_obj.retrieve(json_adress, self.home + "/.cache/program/file.json") error: ('http error', 404, 'not found', <httplib.httpmessage instance @ 0x7fa73d9b3a28>) 5 minutes later can it, address fails. happening? for example, url of json file is: http://webservices.francetelevisions.fr/tools/getinfosoeuvre/v2/?iddiffusion=135842229&catalogue=pluzz&callback=webservicecallback_135842229 the url trying access hosted on cdn , , not servers appear have content requested: $ host webservices.francetelevisions.fr webservices.francetelevisions.fr alias www-es.francetelevisions.fr. www-es.francetelevisions.fr alias francetv.fr.edgesuite.net. francetv.fr.edgesuite.net alias a253.w5.akamai.net. a253.w5.akamai.net has address 23.3.13.170 a253.w5.akamai.net has address 23.3.13.176 the exact address

css - How to change location of HTML element in the table -

Image
i have html code: <table style="cursor: pointer; width: 100%"> <asp:repeater id="pervousresultslist" runat="server" enableviewstate="false"> <itemtemplate> <tr> <td rowspan="3"> <asp:image id="image1" imageurl="~/images/pushpinred.png" runat="server" width="32" height="32" /> </td> <tr> <td>x:</td> <td> <%# eval("lon") %> </td> </tr> <tr> <td>y:</td> <td> <%# eval("lat") %> </td>

javamail - How to send mail from non existing mail mailsender spring? -

how send mail non existing mail? example: no-reply@mydomain.com using spring mail sender configuration. mail doesn't exists reply email address should fail. solution java mail preferred. i tried too. not working spring framework. (unknown sender) when sending email pdf attachment created in itext java application no-reply@mydomain.com if you're not using smtp authentication doesn't matter whether mail exists or not. you can send mail addresses doesn't exist without using smtp authentication but that's bad practice because such email's evaluated spam of spam filters. see answer more details. hence it's best practice send mail using smtp authentication. when sending mail using way should have credentials email, password, outgoing server, port etc... , you'll need mail exists.

python - MySQL #1054 error code for UPDATE query -

i have mysql table looks like: mysql> select * settings; +--------------+-------+ | name | value | +--------------+-------+ | connected | 0 | +--------------+-------+ and i'm trying update value timestamp connected through python code: db1 = mysqldb.connect(host="localhost", user="user", passwd="password", db="database") cursor1 = db1.cursor() cursor1.execute("update settings set value = 'ts' name = connected") db1.commit() cursor1.close() this returns me: cursor1.execute("""update settings set value = 'ts' name = connected""") file "/usr/lib/python2.7/dist-packages/mysqldb/cursors.py", line 174, in execute self.errorhandler(self, exc, value) file "/usr/lib/python2.7/dist-packages/mysqldb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.operationalerror: (1054, "unknow

database - How to handle dynamic images in Django? -

for production django website several applications generate graphs/images based on user input data, how should these images handled? currently each image stored local folders (e.g. app1/static/app1 , app2/static/app2 ) folder upon generation. images copied using manage.py collectstatic central folder (e.g. main_app/static/app1 ) served (i.e. folder static_root). the issue images not found in main static folder when dynamically generated i'm relying on collectstatic move them static_root. questions: should dynamic images served local main_app/static/app1 folder in production (i.e. change static_root)? should dynamic images saved main directory folder (e.g. main_app/static/app1 ) instead of relying on collectstatic ? should dynamic images handled in other way entirely in production? directory structure , image locations clarity: main_app settings.py models.py view.py manage.py /static/app1 (images copied here using `collectstatic`)