Posts

Showing posts from July, 2012

Custom Authentication for Admin in Django -

i'm writing custom django admin site vendors log into. separate regular django admin site. question: how override admin authentication users vendor's table? when develop own admin views, should take django´s decorators @login_required , @user_passes_test , , permission system. so can handle user able , not. have django docs https://docs.djangoproject.com/en/1.8/topics/auth/default/ hope helps.

javascript - Show scrollbar only by hover -

i have scrollable list , want show scrollbar hover, want have ability scroll first touch on list on mobile browsers (ios, android) — behaviour list has overflow-y: auto . try use code ( http://codepen.io/sergdenisov/pen/rpazyg ): html: <ul class="list js-list"> <li>test test test test test test test test test</li> ... <li>test test test test test test test test test</li> </ul> css: .list { -webkit-overflow-scrolling: touch; padding: 0 30px 0 0; overflow: hidden; height: 300px; width: 300px; background: gray; list-style: none; } .list_scrollable { overflow-y: auto; } javascript: $('.js-list').on({ 'mouseenter touchstart': function() { $(this).addclass('list_scrollable'); }, 'mouseleave touchend': function() { $(this).removeclass('list_scrollable'); } }); but scroll ability on mobile browsers activates ...

multithreading - Exception in thread "main" java.lang.IllegalMonitorStateException -

i working thread in java , following error - don't understand why?! code: import java.util.random; public class test { public static void main(string[] args) throws interruptedexception { vlakno sude = new vlakno("myname"); // vlakno = thread class sude.start(); sude.wait(); // error on line } } class vlakno extends thread { private boolean canirun = true; private final string name; vlakno(string name) { this.name = name; } @override public void run() { while (canirun) { // system.out.println("name: " + name); } } public void mojestop() { system.out.println("thread "+name +" end..."); this.canirun = false; } } in order deal illegalmonitorstateexception must verify invokations of wait method taking place when calling thread owns appropriate monitor. simple solution enclose these calls insid...

javascript - How to set up twitter typeahead from scratch? -

i having trouble setting twitter typeahead. heres have done. i created index.html @ test folder. i saved typeahead typeahead.js inside folder js. but still not working. here code index.html <body> <div> <input id="product_search" type="text" data-provide="typeahead" data-source='["deluxe bicycle", "super deluxe trampoline", "super duper scooter"]'> </div> <script src="js/typeahead.js"></script> </body> and here full code. (typeahead) not supported in bootstrap version (3.3.4) supported in version (2.3.2). try following: <head> <script src="http://code.jquery.com/jquery-1.11.3.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.min.js"></script> <script src="js/typeahead.js"></script> <script src="https:/...

javascript - concatinate text using insert after jquery -

i'm trying add "per person" after price on page , it's not working correctly. so far have: window.onload = function per (){ $( "per person" ).insertafter( ".sqs-money-native" ); } any idea i'm missing? $(document).ready(function(){ $( ".sqs-money-native" ).append( "per person" ); });

sql server - SSIS Dynamic Mapping column -

i'm little new ssis , have need import flat files sql tables in same structure. (assume table exist in same structure , table name , flat file name same) thought create generic package (sql 2014) import file looping through folder. try create data flow task in foreach loop container in data flow task dropped flat file source , ado.net destination . have set file source variable every time loops through new file. ado.net table name set variable each time select different table according file name. since both source column names , destination column names same assume map columns automatically. but simple map didn't let me run package added column on source , selected table , mapped it. when run package assumed automatically re map everything. first file ran second file failed complaining map issues. can 1 let me know whether achievable doing dynamic mapping?? or using other way. any appreciated. thanks ned

delphi - Focus control in a frame -

Image
i hope can explain wich prblem i'm trying solve. i've form 3 papnels: 1 buttons, 1 data, , 1 messages. data panel populated frames (one each database table need use). table detail frame , used display record in grid manipulated interface. here grid frame: unit fraedtlist; interface uses winapi.windows, winapi.messages, system.sysutils, system.variants, system.classes, vcl.graphics, vcl.controls, vcl.forms, vcl.dialogs, vcl.grids, vcl.dbgrids; type tfraedtlst = class(tframe) grdeditori: tdbgrid; private { private declarations } public { public declarations } end; implementation {$r *.dfm} uses database; end. and here detail frame: unit fraedtdetail; interface uses winapi.windows, winapi.messages, system.sysutils, system.variants, system.classes, vcl.graphics, vcl.controls, vcl.forms, vcl.dialogs, vcl.stdctrls, vcl.mask, vcl.dbctrls; type tfraedtdtl = class(tframe) lblideditore: tlabel; edtideditore: tdbedit; lb...

python - Filter out if query returns nothing -

how can filter out results database can store data returns something. i got following code: mergedlist_uniques = [id1,id2,id3,id4,..] #list containing data in range(0, 5): cur = db.cursor() cur.execute("select id `id_activities` `id_activities`.`id` = '" + mergedlist_uniques[i] + "' limit 1") results = cur.fetchall() if results != "": print("empty, result is: ", results) #data.append(results) in if statement check whether results contains nothing not working. i still following result: >>> ('empty, result is: ', ()) what should expect whenever result is: () should not print if contains: >>> ('empty, result is: ', (idx)) then should print out result. what did wrong? as per python documentation , none, 0, "", (), {}, [] treated false , use if results: #do

javascript - How can I scale media queries? -

ahoy... i'm doing ember application, , need able scale layout, needs displayed on large panels, can't pixel ratio. (oh, and way down iphone screens well...) so, here's problem: i've made whole thing totally scalable , dandy, do need use bunch of media queries here , there. now, while can scale application (fonts etc.) , down js skillz, general layout remains same, media queries unchanged. makes distorted. what need able apply scaling factor limits in media queries. i realise workaround change meta tag screen width, that's no-go, need device pixel = actual pixel cleanest rendering (many androids fuzzy pixel ratio e.g. 1.75). i've looked @ using calc(..) in media queries (doesn't work). i'm using ember, have access templates , stuff. i'm thinking along lines of calculating in js , shoving dom in style tag, ~100 media queries, imagine painful... , keep me lager in weekend... here's me drafting... no pun intended... edit: seems ...

operating system - What happens when Binary Semaphore is Signalled twice? ie. s=1;wait(s); signal(s)signal(s); Does s becomes 0 or it remains 1? -

what happens when binary semaphore signalled twice? i.e. suppose s binary semaphore variable s=1 now following-- wait(s),signal(s),signal(s) does s becomes 0 or remains 1? the binary semaphore used protect resource, 1 process may access @ time. this process wait, which, assuming semaphore 1 (resource isn't busy) make semaphore =0. when process finished resource signal, allowing other processes access resource, making semaphore =1. there's no reason why process signal twice, nor there reason why other process signal before doing wait (let me know if you've thought of one), 2 successive signals error. if writing os primitive implementation i'd judge better idea leave signal @ 1 put 0 , lock resource out time. the standard texts on semaphores talk incrementing , decrementing count, that's because it's useful way of thinking counting semaphores. way actual semaphores behave in actual os when they're used in odd way depends on implemen...

cloudfoundry - Invalid Auth Token response to cf command -

i tend leave cf cli (cloud foundry client) logged in , set specific target in bluemix. return , issue commands again after long pause without fail. got unexpected response: invalid auth token what happened , do next? i've learned means there kind of unexpected communication issues between cloud foundry client , server. you need issue cf login , try again. (maybe cf logout first).

php - prestashop: adding a product to cart, with custom fields -

good day all. i'm developing module prestashop, in user choose settings, , possible save these settings , add custom product cart, using them values custom fields. i've added new product, 7 custom text fields. then i've write in php of module, in function add product in cart: $debug.=" aggiungerei"; $fieldval1= "30"; $fieldval2= "30"; $fieldval3= "10"; $fieldval4= "90"; $fieldval5= "10"; $fieldval6= "mytitle"; $fieldval7= "mytext"; // cart id if exists if ($this->context->cookie->id_cart) { $cart = new cart($this->context->cookie->id_cart); $debug.=" 1.nuovo carrello"; } else { if (context::getcontext()->cookie->id_guest) ...

java - List of string with occurrences count and sort -

i'm developing java application reads lot of strings data likes this: 1 cat (first read) 2 dog 3 fish 4 dog 5 fish 6 dog 7 dog 8 cat 9 horse ...(last read) i need way keep couple [string, occurrences] in order last read first read . string   occurrences horse     1 (first print) cat         2 dog        4 fish        2 (last print) actually use 2 list: 1) list<string> input; add data in example: input.add("cat"); input.add("dog"); input.add("fish"); ... 2) list<string> possibilities; insert strings once in way: if(possibilities.contains("cat")){ possibilities.remove("cat"); } possibilities.add("cat"); in way i've got sorted list possibilities. use that: int occurrence; for(string possible:possibilities){ occurrence = collections.frequency(input, possible); system.out.println(possible + " " + occurrence); } that trick works it's slow(i've got m...

java - How do I stop IDEA from reformatting my code when refactoring? -

Image
when refactoring code (e.g.: refactor -> rename ), intellij idea 14.x rewraps (reformats) code fit 80 column limit. example: here's code before refactoring: refactoring in progress: ... , code re-wrapped once press enter : what's annoying that, java classes aren't open in editor (but affected refactoring) reformatted, increasing chance formatting changes propagated vcs unnoticed. what want achieve is: keep original print margin @ 80 columns, still have idea preserve original formatting when renaming variables/classes/methods. how achieve this? if doing actual "refactoring -> rename" , example shift + f6 are editing every file has reference variable name whether or not open in editor irrelevant if change files affected edited , vcs consider them changed . the behavior of reformatting entire file on refactoring been in idea long time , bugs have been filed against behavior have been setting in unassigned state forever. here...

android - How to make recycler view start adding items from center? -

Image
i have recyclerview "horziontal linear layout" layout manager. recycler view in frame layout, layout_gravity = "center", , layout_width="wrap_content" i want recycler view start adding items center. here want: and here getting: you can see in last image items added left. want add items center shown in first 3 images . i had same issue , solved horizontal recyclerview: <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="wrap_content" android:layout_height="68dp" android:layout_centerhorizontal="true" android:orientation="horizontal" app:layoutmanager="android.support.v7.widget.linearlayoutmanager" /> here main part android:layout_centerhorizontal="true" , layout_width="wrap_content"

tomcat - Getting 403 : When access with http:site works fine with https:site -

on landing page have url of web applications. when click on url getting 403 error.while if hit url again works fine me.when access url of webapplication directly https works fine. webserver using tomcat. steps launch http://hostname select https://hostname/site 403 forbidden message directly access https://hostame/site , goes thru can help?

mysql - Add index to table if it does not exists -

i want add index table using alter syntax , want check if index exists in table, , if not exists, add index. alter table tablename add index ix_table_xyz (column1); is there way this? try this: set @x := (select count(*) information_schema.statistics table_name = 'table' , index_name = 'ix_table_xyz' , table_schema = database()); set @sql := if( @x > 0, 'select ''index exists.''', 'alter table tablename add index ix_table_xyz (column1);'); prepare stmt @sql; execute stmt;

lucene - Apache nutch not indexing all documents to apache solr -

i using apache nutch 2.3 (latest version). have crawled 49000 documnts nutch. documents mime analysis, crawled data containes 45000 thouseand text/html documents. when saw indexed documents in solr (4.10.3), 14000 documents indexed. why huge difference between documents (45000-14000=31000). if assume nutch index text/html documents, atleast 45000 documents should indexed. what problem. how solve it? in case problem due missing solr indexer infomration in nutch-site.xml. when update config, problem resolved. please check crawler log @ indexing step. in case informed no solr indexer plugin found. following lines (property) added in nutch-site.xml <property> <name>plugin.includes</name> <value>protocol-httpclient|protocol-http|indexer-solr|urlfilter-regex|parse-(html|tika)|index-(basic|more)|urlnormalizer-(pass|regex|basic)|scoring-opic</value> <description>plugin details here </description> </property>

javascript - How to create popup's for dynamic tables -

html function toggle_visibility(id) { var e = document.getelementbyid(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } //--> </script> <!--to display json data in tables--> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script> $(function() { var dmjson = "data.json"; $.getjson( dmjson, function(data) { $.each(data.records, function(i, f) { var $table="<table class='mystyles' table border=5><tbody><tr>" + "<td>" + f.clue + "</td></tr>" + "<tr><td>" + f.answer + "</td></tr>" + "<tr><td>" + f.status + "</td></tr>" + "<tr...

git - Remove deployment key from Bitbucket -

i having problems add ssh public key bitbucket account. seems accidentally added personal key deployment key bitbucket team. when trying add accounts key, states key in usage. how can delete teams deployment key added accidentally? have delete team? seems cant find option. have several public keys connected git account working. i using tutorial, theoretically seems pretty easy me: https://www.youtube.com/watch?v=dphlldvdw-8 i tried 1 bitbucket.com: https://confluence.atlassian.com/display/bitbucket/set+up+ssh+for+git no, deleting team unnecessary. this page seems have settings team ssh keys (fill in team name) https://bitbucket.org/account/user/your_team_name/ssh-keys/ you should able delete key on page.

c# - WPF multi-thread progress update -

i'm need display form of feedback user, while small process (7-10 seconds) takes place in background. i had no issues in past using separate threads , backgroundworkers in windows forms, proving difficult in wpf. i have read many articles, in respect, , how should using dispatchers in wpf start new thread, etc. however, when try use backgroundworker display form of waiting image feedback, remains static. i don't believe matters, uses mui firstfloor ( https://github.com/firstfloorsoftware/mui ). i'm trying use built-in progressring feature (which works no problems when run within same thread , there no other major tasks running in background. adding backgroundworker, brings exception due cross thread access of objects, though many blogs states backgroundworks in wpf cross thread aware , safe run. the following closest code generates need. private async void mytaskprocess() { await dispatcher.begininvoke(dispatcherpriority.send, new threadst...

How to access a PHP resource -

i using third party php module returns php resource: resource(1, abcresult) while manual describes how use returned object, not sure how access object? code this: $resource = get_new_resource_based_on('this-information'); var_dump($resource) outputs: resource(1, abcresult) the manual states follows: the method checks username , password of account holder. the method returns instance of abcresult class. methods of returned abcresult class instances: success returns true if there user username , password, otherwise – false an error text if there no user username/password pair. it returns id if user found same username , password a resource opaque blob has no inherent meaning. typically represents external resource external library allocated; meaning example if you're editing image gd library, gd library allocates memory somewhere hold image. external resource not "in php", it's not class or object....

python - Borda’s positional ranking -

i have tree lists of elements sorted descending scores. need use borda’s positional ranking combine ranked lists using information of ordinal ranks of elements in each list.given lists t1, t2, t3 ... tk, each candidate c , list ti, score b ti (c) number of candidates ranked below c in ti. total borda score b(c) = ∑ b ti (c) candidates sorted descending borda scores. i tied that, not give output needed: for in list1, list2, list3: borda = (((len(list1)-1) - list1.index(i)) + ((len(list2)-1) - list2.index(i)) + ((len(list3)-1) - list3.index(i))) print borda can me implement above function? calling index(i) takes time proportionate list size, , because have call every element, ends taking o(n^2) time n list size. better iterate 1 list @ time know index , add part of score score accumulator in dict. def borda_sort(lists): scores = {} l in lists: idx, elem in enumerate(reversed(l)): if not elem in scores: scores[elem]...

c# - create nested class in runtime -

i have xml file structure <graph> <id>0</id> <name>john</name> <link>http://test.com</link> </graph> <graph> <id>1</id> <name>roger</name> <link>http://test2.com</link> </graph> i want use reflection.emit class create 2 class first: class { int id; string name; string link } second: class b{ list<a> graphs; } i read paper ( introduction creating dynamic types reflection.emit ) , can create class in runtime problem using (a) in runtime class(b) , have list of a. myclassbuilder mcb=new myclassbuilder("a"); var myclass = mcb.createobject(new string[3] { "id", "name", "link" }, new type[3] { typeof(int), typeof(string), typeof(string) }); type tp = myclass.gettype(); myclassbuilder mcb1=new myclassbuilder("b"); //here confusion typeof(list<tp>) ?????? error ocurred var myc...

javascript - How to create Stop watch -

i have ajax call. this: $(document).on('submit', '#formpropiedades', function(event) { event.preventdefault(); var content = {}, url = "http://www.xxxxyzzz.com/xxx/yyy/web/ajax.php"; $("#dialog1").dialog("open"); var posting = $.post(url, { im_core: 'savealladds', idfeed: <?php echo $_post['idfeed'] ?>, pais: <?php echo $pais1?> }).done(function(data) { if (data == 1) $(".overlay-bg1").html("suces...."); else $(".overlay-bg1").html(data); }); <?php } ?> }); and hhtml looks this: <div id="dialog1" title="attention!!" style="width:60%"> <div class="overlay-bg1">saving adds....</div> </div> the code opening jquery ui dialogue $(function () { $("#dialog1").dialog({ autoopen: false, ...

Not able to use RuleJS (formula support) with handsontable + angularJs -

i not able use rulejs (formula support) setup handsontable + angularjs. in angular data loaded formula support functionality not working @ all.same thing working without angular ( in jquery). i not able use rulejs (formula support) setup handsontable + angularjs. in angular data loaded formula support functionality not working @ all. same thing working without angular ( in jquery). wondering if there specific file need add angular ? code <hot-table settings="{settings }" rowheaders="true" minsparerows="minsparerows" datarows="data1" height="300" width="700"> </hot-table> <script> var app = angular.module("app", ['nghandsontable']); ...

python - Variable that returns complete string inside list -

i have code: topic = "test4" topics = sns.get_all_topics() topicslist = topics['listtopicsresponse']['listtopicsresult']['topics'] topicslistnames = [t['topicarn'] t in topicslist] that returns list: [u'arn:aws:sns:us-east-1:10:test4', u'arn:aws:sns:us-east-1:11:test7'] what im trying create variable returns complete string relative topic variable. i have variable topic = "test4" , , want have variable topicresult returns u'arn:aws:sns:us-east-1:10:test4 . the string relative topic not in list 1st position. do know how this? topicresult = " ".join([t['topicarn'] t in topicslist if t['topicarn'].endswith(topic)]) this check strings in list see if topic variable end of 1 of strings. " ".join() gives string, if want keep list of strings end topic , can rid of it. if topic won't @ end of string, can check if topic is inside string. topicres...

javascript - Bing map container padding -

Image
i've started usage of bing maps recently, , noticed each , every sample has ugly white rectangles @ top , bottom of map (see bellow). does microsoft , use bing maps considering normal? because haven't found solution issue after brief googling. might use self-created patch want ask community first. thanks in advance! what set background color of map #acc7f2 . matches color of ocean on closer zoom levels. usage example: var map = new microsoft.maps.map(mapdiv, { ... backgroundcolor: microsoft.maps.color.fromhex('#acc7f2'), ... });

html - explode the strings from the file in php -

as new php.i trying explode strings file.i want part of strings display in html fields. here complete code:- <?php if(isset($_post["submit"])) { $lhs= array(); $rhs= array(); foreach($_post $key => $value){ if($key == "submit") continue; echo $key ."=". $value ; echo "<br>"; $lhs[]=$key; //first array left hand side $rhs[]=$value; //second array right hand side } file_put_contents("file2.txt", implode(php_eol, array_map(function($v1, $v2) { return "$v1=$v2"; },$lhs, $rhs))); } $file_contents=file_get_contents("file2.txt"); $data=explode("=" ,$file_contents); print_r($data); ?> <form name="form1" method="post" action=""> name: <input type="text" name="name" value="<?php echo "$data[0]";?>"><br> phone no: ...

symfony - Session should logout after 10 min in symfony2 -

i tried far, path corebundle / dependencyinjection / configuration.php namespace funstaff\corebundle\dependencyinjection; use symfony\component\config\definition\builder\treebuilder; use symfony\component\config\definition\configurationinterface; class configuration implements configurationinterface { /** * {@inheritdoc} */ public function getconfigtreebuilder() { $treebuilder = new treebuilder(); $rootnode = $treebuilder->root('funstaff_core'); $rootnode ->children() ->scalarnode('timeout')->defaultvalue(900) ->isrequired()->end() ->end(); return $treebuilder; } } we add code in file funstaffcoreextension.php namespace funstaff\corebundle\dependencyinjection; use symfony\component\dependencyinjection\containerbuilder; use symfony\component\config\filelocator; use symfony\component\httpkernel\dependencyinjection\extensio...

windows - why "dir /B file.eps|del " is wrong? -

there file named "file.eps" in current directory, , want delete file. know can simple use del file.eps but can't understand why dir /b file.eps|del didn't work. dir /b file.eps gives file, , should transferred del through pipe. del can't use inputs list or redirective. for example, file list.txt including filenames deleted, can't processed in way del < list.txt . so, syntax correct, problem del.

Django change local datetime format -

i have django app in use translation system. want django print datetime objects in local format, not in default format in print me. example, english translation, datetime objects in format: may 14, 2015, 1:26 p.m. , want format: mm/dd/yyyy hh:mm i.e 03/14/2015 13:26 for other langauges still month name in output in local language (like 'may 14'), , dont want that. other languages want dd/mm/yyyy hh:mm you can set custom format different languages. in settings: format_module_path = [ 'mysite.formats', 'some_app.formats', ] then create files this: mysite/ formats/ __init__.py en/ __init__.py formats.py see complete ref here: https://docs.djangoproject.com/en/1.8/topics/i18n/formatting/#creating-custom-format-files then in formats.py, set want. english: import datetime datetime_format = 'm/d/y h:i' ref: https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#std...

css - Responsiveness issue with iframe -

i have issue responsive website. i use iframe contact form when uses , there validation errors server side codes responds , reloads in same iframe. everything works fine if iframe width less 300px it's changing mobile view. note: site built on drupal 7. on page have contact form should disable media queries. but should not use iframe should create server side code update on page not via iframe. build using php , ajax similar how tutorial describes. http://ajtroxell.com/build-a-simple-php-jquery-and-ajax-powered-contact-form/

r - strwidth: How to get the correct width for umlauts and other accented/special characters? -

consider following example: txt <- c("abc", "äéß") nchar(txt) # [1] 3 3 strwidth(txt, units = "inches", family = "mono") # [1] 0.4166667 0.8333333 plot(0, type = "n"); text(1, c(0, .3), txt, family = "mono", cex = 5) i'd have expected strwidth return [1] 0.4166667 0.4166667 when using nonproportional font. can expected output without replacing non-ascii characters? help. session info: r version 3.1.3 (2015-03-09), platform: x86_64-w64-mingw32/x64 (64-bit), running under: windows 7 x64 (build 7601) service pack 1, locale: lc_collate=german_germany.1252, lc_ctype=german_germany.1252, lc_monetary=german_germany.1252, lc_numeric=c, lc_time=german_germany.1252 edit: as noted in comments, strwidth problem seems known rstudio issue .

javascript - Self Invoking functions difference -

this question has answer here: what javascript syntax? !function(){} [duplicate] 1 answer what difference between these 2 self invoking functions? function not work if ! (not) symbol added. please clarify if 1 has clear understanding. // first (function( $ ) { // ... })( jquery ); // second !function($){ alert("test1"); }(jquery), function(){ alert("test2"); }(jquery); !function () {} means negative function (similar if (!somevar) {} ), make sure result before making negative, function must executed. ! can replaced + . you have wrong //second , because create 2 anonymous functions , between there , . think getting syntax error in place, next function not work (and not executed, because no 1 calling function)

php - how to get data from other tables in grid view in yii -

i have module named attendance value in comes other tables conditions. how can id of other tables. code below: models are: if($type == 2) { $model = new supplier(); } elseif($type==3) { $model = new truckingcompany(); } elseif($type==4) { $model = new serviceprovider(); } elseif($type==5) { $model = new landowner(); } elseif($type==6) { $model = new refiner(); } elseif($type==8) { $model = new worker(); } elseif($type==9) { $model = new trainer(); } now want update record array( 'header'=>'action', 'class' => 'cbuttoncolumn', 'template'=>'{update}', 'updatebuttonurl'=>'yii::app()->createurl("attendance/update", array("id"=>$data->id))', ); now want id of these diffent table update record , these differen...

asp.net - .NET Session variable is null - for all users -

problem description i have asp.net app in users have different rights, , logged in through facebook. app includes (among other things) filling out forms. users have access forms others don't. forms can require searching in books and/or on internet before being able submit them. as such, we're having problems session time-outs (it seemed), users met "not authorized see page/form" after doing research somewhere else. attempted solutions i've created log function logs state of handful of variables on strategic points in application. i've pinpointed problem fact session variable "userrole" null when problem occurs. relogging the obvious solution is: "have tried relogging?" - should reset session , allow user form want. on logout, use session.clear(); session.removeall(); and create new session relevant variables (including userrole) on login. doesn't help, though. keeping session alive one way increase standard 20-...

version control - Easy way to switch/swap git checkins between 2 branches -

Image
i made implementation feature on develop-branch. worked out came interesting alternative. branched checkin of develop-branch before feature checkin on develop implement alternative. decided alternative better implementation. wouldn't want loose first implementation. branches this: i continue on "develop"-branch , keep 1st implementation on "newoverview" branch. there easier way somehow preserve changes of each branch. undo both branch commits. reapply changes correct branch , checkin again? sounds lot of error prone tasks. can tell git take 1st commit , put on "newoverview" branch , 2nd commit put on "develop" branch? ann: repository has master branch. 1 changes merged when finished , develop branch. other branches not pushed server. locally. checkout develop branch git checkout develop create new branch on top of develop save results. don't checkout! git branch alternative reduce develop common ancestor ne...

How do i send the Hindi text to php server by using HttpUrlConnection in Android -

i'm developing android application in user can register choosing hindi , english language. working fine while sending in english while sending hindi text i'm getting unknown format text %e0%a4%a6%e0%a4%95%e0%a4%97 in table.i have tried put encoding header not working. the code i'm using url url = new url(config.organisation_details_url); // open http connection url conn = (httpurlconnection) url.openconnection(); conn.setdoinput(true); // allow inputs conn.setdooutput(true); // allow outputs conn.setusecaches(false); // don't use cached copy conn.setrequestmethod("post"); conn.setrequestproperty("connection", "keep-alive"); conn.setrequestproperty("accept-charset", "utf-8"); conn.setrequestproperty("enctype", "multipart/form-data"); conn.setrequestproperty("content-type", "multipart/form-data;charset=utf-8;boundary=" + boundary); // conn.setrequestproperty("expec...

c# - json.net map elements to collection -

i json object looks following. { "result": { "status": 1, "teams": [ { "team_id": 1838315, "name": "team secret", "tag": "secret", "time_created": 1408993713, "rating": "inactive", "logo": 543025270456493060, "logo_sponsor": 540768028333677400, "country_code": "", "url": "http://www.teamsecret.gg/", "games_played_with_current_roster": 0, "player_0_account_id": 41231571, "player_1_account_id": 73562326, "player_2_account_id": 82262664, "player_3_account_id": 86745912, "player_4_account_id...

javascript - How to create a pagination and sorting using jquery? -

Image
i need create pagination using jquery displays 5 results per page. must allow user sort results price. i created pagination , works fine. bug in sorting function. when user sorts results sorts results available in specific page , not total results. here demo below function sort price. var ascending = false; $('.sortc').on('click', '.sortp', function (e) { e.preventdefault(); var sorted = $('ul .price_indiv').sort(function (a, b) { return (ascending == (converttonumber($(a).find('.final_price').html()) < converttonumber($(b).find('.final_price').html()))) ? 1 : -1; }); ascending = ascending ? false : true; $('.price').html(sorted); }); var converttonumber = function (value) { return parsefloat(value.replace('$', '')); } can me fix bug? note: without plugin i think have misunderstood how pager works.you may need re-evaluate how script works. displays proper item...

javascript - Adding slide effect by anchor tag -

i want open searchpage.html html page slide effects used anchor tag. <a id="add" href="searchpage.html" class="show_hide">click</a> and js: $(document).ready(function () { $('.show_hide').click(function (e) { e.preventdefault(); //to prevent default action of link tag $(this).toggle('slide','left',100); }); }); but showing error: typeerror: jquery.easing[this.easing] not function try one, may you.. html : <a id="add" href="searchpage.html" class="show_hide">click</a> js: $(document).ready(function () { $('.show_hide').click(function (e) { e.preventdefault(); //to prevent default action of link tag $('#add').slidetoggle(1000); }); }); and here demo .

sql server - SQL OLEDB provider: connection string to Failover partner -

we're trying connect sql database mirroring enabled. have 2 servers: db1 (principal) , db2 (mirror). we're using connection string: provider=sqloledb;data source=db1;failover partner=db2;database=databasename;uid=username;pwd=password; when db1 in principal role, works ok. but, when db1 goes down, , db2 (mirror) becomes principal, receive error: invalid connection string attribute we tried change data source server name ip, ip:1433... without success. tried change parameter "failover partner" "failoverpartner", without success. is possible connect db mirror sqloledb provider @ all? you need use sql native client or ado.net, not sqloledb not support failover partner parameter.

c# - Make WPF MahApps MetroWindow non-draggable -

i've started using mahapps wpf. after converting wpf window metrowindow it's no more locked. standard wpf , following settings windowstyle="none" resizemode="noresize window not movable. however metrowindow movable. don't want users able move window around. how can achieve metrowindow? as @mathew said, can set iswindowdraggable property of metrowindow false . sample code can this: <controls:metrowindow x:class="mynamespace.window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" iswindowdraggable="false" resizemode="noresize" windowstyle="none" s...

Binding multiple pthreads, each to the same member function of a different object from the same class -

i have bound multiple pthreads independent member function of independent objects same class. i had use of static member function helper since not possible bind member function directly pthread in c++; however, application behaves strangely , suspicious use of static function, since static function shared between objects of same class. is type of usage right? there alternative solution? i appreciate hear guidance. class region { public: region(); void init(); void push_tuple(int int_value, float float_value, bool tuple_source); static void *read_tuple_r_process_s_update_helper(void *context) { return ((region *)context)->read_tuple_r_process_s_update(); } void* read_tuple_r_process_s_update(); static void *read_tuple_s_process_r_update_helper(void *context) { return ((region *)context)->read_tuple_s_process_r_update(); } void* read_tuple_s_process_r_update(); }; int main(){ region regions[thread...

c++ - Relation between QTransform scale and boundingRect.size() -

i have little concern relation between qtransform scale , width , height return values in boundingrect() method of qgraphicsitem. want scale qgraphicsitem boundingrect size. i.e. if size of item 100,100 passing in boundingrect() method after increasing size of item mousemove event. if increased width , height 400,300 respectively scale factors 4,3? appreciable. this code this->setpos(minmax().first.x(), minmax().first.y()); qreal w = minmax().second.x() - minmax().first.x(); qreal h = minmax().second.y() - minmax().first.y(); qreal scalefactorw = w / boundingrect().width(); qreal scalefactorh = h / boundingrect().height(); qtransform trans; trans.scale(scalefactorw, scalefactorh); settransform(trans); bottompoints = qpointf(w, h); minmax function is: float xmin = 0, xmax = 0, ymin = 0, ymax = 0; qlist<double> xvalues, yvalues; xvalues << shaper[0]->scenepos().x() << shaper[1]->scenepos().x() << shaper[2]->scenepos().x() << shap...

How to create DDL from output columns in SSIS -

i have dataflow task has been created programmatically, the data source connected dbms via ole db provider, can output columns source , map input columns of destination component. but can't invoke reinitializemetadata() destination component because destination table doesn't exist. therefore, want ddl output columns creating table. maybe, knows functionality provided in ssis purpose? in advance

php - Laravel 5 registering a controller to map all methods -

i new laravel 5 coming codeigniter background. have habit not play routes.php. codeigniter automatically maps methods controllername/methodname . in laravel 5 trying same registering controlller writing @ top of app/http/sroutes.php : route::controllers([ 'admin/user' => 'admin\adminusercontroller', ]); when run php artisan route:list show controller registered. when see url /public/admin/user/addrole show addrole method not exist while have created method in adminusercontroller. admin/adminusercontroller.php <?php namespace app\http\controllers\admin; use app\http\requests; use app\http\controllers\controller; use illuminate\http\request; class adminusercontroller extends controller { public function getaddrole(){ echo "adding roles"; } } routes.php route::controllers([ 'admin/user' => 'admin\adminusercontroller', ]); <?php namespace app\http\controllers\a...

c# - Sql Server Transaction Commit times out -

i have weird issue in application. happens once or may twice in week. here situation: i have method in application queries db multiple times, first there 4 selects, 1 of them uses keyword updlock follows insert other table (not 1 updlock applied) , the update on table updlock -ed. all of queries done in 1 transaction (which @ side of .net) , gets commit -ed. now, problem transaction.commit() throws exception message timeout expired. timeout period elapsed prior completion of operation or server not responding (as guess sqlconnection times out). so have whole procedure wrapped in try-catch block , if exception occurs try rollback transaction when happens code execution goes catch block , transaction.rollback() called , throws exception message this sqltransaction has completed. no longer usable (as guess when commit times out transaction gets commit -ed), after parts of application messes up. thing believed not exist (because of rollback ) exist , cau...

php - Query takes too much time to execute -

i have issue query take time execute. query select u.user_id, c.c_id, u.username, u.email, r.reply users u, conversation c, conversation_reply r case when c.user_one =1 c.user_two = u.user_id when c.user_two =1 c.user_one = u.user_id end , c.c_id = r.c_id_fk , ( c.user_one =1 or c.user_two =1 ) order c.c_id desc i have 250788 total recoderds in conversation_reply table store message details query give 10225 records in result , take 7.291 sec. please give me proper solution. you can tell database forcefully use index. below use index (index1,index2)

Does caching in spark streaming increase performance -

Image
so i'm preforming multiple operations on same rdd in kafka stream. caching rdd going improve performance? when running multiple operations on same dstream, cache substantially improve performance. can observed on spark ui: without use of cache , each iteration on dstream take same time, total time process data in each batch interval linear number of iterations on data: when cache used, first time transformation pipeline on rdd executed, rdd cached , every subsequent iteration on rdd take fraction of time execute. (in screenshot, execution time of same job further reduced 3s 0.4s reducing number of partitions) instead of using dstream.cache recommend use dstream.foreachrdd or dstream.transform gain direct access underlying rdd , apply persist operation. use matching persist , unpersist around iterative code clean memory possible: dstream.foreachrdd{rdd => rdd.cache() col.foreach{id => rdd.filter(elem => elem.id == id).map(...).saveas...}...

java - Trying to add multiple JPanel to JFrame -

i want have 9 jpanel components on jframe , have 4 jbutton components on each panel. after adding 9 panels, 8 of them disappear. anyone can me correct this? jframe uses borderlayout default, may wish consider using different ones, compounding them achieve desired results. see laying out components within container more details.

javascript - ccavenue iframe integration in php -

i need payment within website using iframe. have link source code in image iframe integration included in ccavenue integration payment gateway pdf dont understand source code explain ? explain flow explain image ? below image link indicate path "/transcation/jsp/iframe/iframeencreq.jsp?" in below image. click here image link ccavenue iframe integration. anyone explain how ccavenue iframe integration in php image link how integrate ccavenue iframe in php. you need download php_kit integration section. in php_kit find iframe_kit code needed iframe. you can use link download iframe_kit .