Posts

Showing posts from August, 2010

scala - tasks and dependencies in Play! framework 2.3 -

i'm trying task in play! that: in build.sbt lazy val hellotask = taskkey[unit]("hello", "description bla bla") hellotask := { mypakage.myclass.update println("well done") } (compile in compile) <<= (compile in compile) dependson hellotask but when execute $ activator tasks it doesn't show "hello" task runs $ activator hello the problem when add references classes (mypakage.myclass.update in example isn't found) thanks lot despite documentation says, can't seem list taskkey , either. works inputkey instead of taskkey . lazy val hellotask = inputkey[unit]("hello", "description bla bla") hellotask := { println("well done") } the other problem dependencies in build.sbt need resolved via sbt plugins. mypakage.myclass must split separate project in order used in build.

Save a file with app state in othe nPause() method in android -

i want write incomplete app state file if user leaves app without saving state. believe have use onpause(). recommended practice? (in onpause() going encrypt string , create file , store it, bit time consuming). if onpause() not place how save state? yes save data onresume() state @override protected void onpause() { // todo auto-generated method stub super.onpause(); // stuff here }

c# - Why is using tolist() not a good approach here? -

this not approach here...! can why? var dbc= new schoolcontext(); var a=dbc.menus.tolist().select(x=> new { x.type.name, listofchildmenus = x.childmenu.select(cm=>cm.name), listofsettings = x.settings.selectmany(set=>set.role) }); because when call .tolist() or .firstordefault() , on (when enumerate), query executed. so when dbc.menus.tolist() bring in memory database menus, , didn't want that. you want bring in memory select ( list of child menus , list of settings ). relevant furter reading : http://www.codeproject.com/articles/652556/can-you-explain-lazy-loading - using lazy loading and if want add filter iqueryable may read difference between ienumerable, iqueryable http://blog.micic.ch/net/iqueryable-vs-ienumerable-vs-ihaveheadache and dinamic filtering https://codereview.stackexchange.com/questions/3560/is-there-

c# - Castle Windsor Interceptors and Registering by Convention -

i'm using castle windsor manage dependencies application. i'm using classes.fromassemblycontaining register components of given type ifoo<> , register interceptor of these classes. i can interceptor work when register individual components this: public void setupcontainer(iwindsorcontainer container) { container.register(component.for<ifoo>() .implementedby<foo>() .lifestylesingleton().interceptors<myintercepter>()); } however keep registering convention using classes.fromassembly. registration code looks this: public void setupcontainer(iwindsorcontainer container) { container.register(classes.fromassemblycontaining<foo>() .basedon(typeof(ifoo<>)) .withservice.base()); } how add interceptor ifoo<> 's registered? you use configure method add interceptor: public void setu

vb.net - VB 2010 - Changing the Color of a word in a Textbox (every copy of the word) -

hello , in advance, i have textbox in text being generated. while it's being generated want color word "successfully" green , word "failed" red. i'm using : formtxtbox.find()("successfully") formtxtbox.selectioncolor = color.yellowgreen formtxtbox.selectionfont = new font(formtxtbox.font.fontfamily, formtxtbox.font.size, fontstyle.bold) formtxtbox.deselectall() formtxtbox.find("failed") formtxtbox.selectioncolor = color.red formtxtbox.selectionfont = new font(formtxtbox.font.fontfamily, formtxtbox.font.size, fontstyle.bold) formtxtbox.deselectall() it's working problem have colours first "successfully" or "failed" string, whereas textbox has many copies of word in it. how can make color every copy of these words ? yep, guil said, .find finds first occurrance. https://msdn.microsoft.com/en-us/library/hfcsf75k(v=vs.110).aspx i did find article ,

sharepoint - Convert "float;#22.0000000000000" into just "22.0" in C# -

i'm doing tostring() on object , output getting float;#22.0000000000000 . need 22.0 . how achieve in c#? additional info: object value number column in sharepoint list. value being retried in code caml query. i'm sure it's use of caml query that's causing me issue. if retrieve item iterating through items in list don't have issue, approach not efficient caml query. update: seems not tostring() that's causing output. object i'm calling tostring() on seems set float;#22.0000000000000 , what's coming straight out of caml query. use given code 22.0 string value = "float;#22.0000000000000"; var number = value.split('#')[1]; double num = double.parse(number); console.writeline(num.tostring("0.0")); result: 22.0 mentioned code should work. item.getformattedvalue("columnname") or try post https://social.msdn.microsoft.com/forums/office/en-us/fdef03db-9678-46cf-8ff7-03551f4b8466/how-to-c

python - How to display pre-colored string with curses? -

i'm writing curses program in python. i'm beginner of curses i've used terminal control sequences colored output. now there's code snippets print inside window, i'd them syntax highlighted, , it's better done libraries pygments, outputs highlighted code control sequences. initially feed pygments output directly window.addstr() , turned out control sequences escaped , whole highlighted string printed on screen (just this: https://too-young.me/web/repos/curses-highlight.png ). how can display directly curses, cat ? this has been asked several times, same answer: write parser this. related discussion: how use ansi escape codes inside mvwprintw in ncurses? comment on parsing ansi color escape sequences handle escape sequences ncurses? printf handle escape sequences? it not suitable extension ncurses example because: curses produces escape sequences, wide variety of devices (which may not "ansi color escapes"). ncurses (see fa

.htaccess - htaccess two rewrite rules -

i have code in htaccess not passing page variable post.php other working fine.i don't know happening.i new htaccess please help rewriteengine on rewritebase /blog/ rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([0-9]+)/?$ post.php?page=$1 [l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([0-9]+)/([^/]+)/?$ post.php?id=$1&name=$2 [l] now thinking if can learn htaccess please can tell me , free resource advance! i restarted apache server , code works don't know happened satisfied.my code , accurate i using xampp.it not mine xampp problem

In magento, is it possible to update or delete the order items from the order without creating the new order? -

in case, order should modified after review. order items can removed or quantity can modified. i knew re order purpose manually deleting old order once re order completed. not want change order id. in default magento , cannot edit , delete order items. there 1 paid extension ( edit , delete order item in magento ) give facility of:- editing order deleting order order quick view backup orders view product images

php - PDO MYSQL Why not working? -

i don't have idea why not working ? :) this returns 0; $stmt3=$db->query('select count(*) "ilosc" plat_user `imie`="'.$_post['imie'].'" , `nazwisko`="'.$_post['nazwisko'].'" , `nip`="'.$_post['nip'].'" , `email`="'.$_post['email'].'" , `grupa`=1'); $stmt3->execute(); $row3 = $stmt3->fetch(); echo $row3['ilosc']; this code works , (return 1): $rowy = mysql_num_rows(mysql_query('select count(*) "ilosc" plat_user `imie`="'.$_post['imie'].'" , `nazwisko`="'.$_post['nazwisko'].'" , `nip`="'.$_post['nip'].'" , `email`="'.$_post['email'].'" , `grupa`=1')); generated query in phpmyadmin return 1 dont know why pdo return 0 just try it: $stmt3=$db->query('select count(*) "ilosc" plat_user `imi

javascript - famous: can't draw image to CanvasSurface with own size property -

i new famo.us , cloned start example. trying do, create canvassurface , create image , load imagedata it, draw() image onto canvas' context. the strange thing is, works once, when not defining custom size. when refreshing firefox image loaded, not seen. however, want have canvas behave if had css style: width:100%; therefore scaling drawn image, it's width corresponds window size. if point me obvious mistake, why image not rendered onto canvas, i'd happy. http://codefamo.us/g/#gist=caeb0ba013ed3f955f33 /*global famous*/ // import dependencies var engine = famous.core.engine; var modifier = famous.core.modifier; var transform = famous.core.transform; //var imagesurface = famous.surfaces.imagesurface; var canvassurface = famous.surfaces.canvassurface; var surface = famous.core.surface; // create main context var maincontext = engine.createcontext(); var backgroundcanvas = new canvassurface({ size: [undefined, false] }); var backgroundcontext = bac

ios - Get Screen size in Swift as Integer -

for positioning element random in screen within boundarys need resolution/screen size in swift. fount out how cggraphics. unfortunately have calculate bit , need type uint32 , not cgfloat . cannot use casting way. ideas? let screensize: cgrect = uiscreen.mainscreen().bounds let screenwidth = screensize.width //what want let screenheight = screensize.height-arc4random_uniform(screensize.height) if want random x , y positions element can this: let screensize = uiscreen.mainscreen().bounds let randomxpos = cgfloat(arc4random_uniform(uint32(screensize.width))) let randomypos = cgfloat(arc4random_uniform(uint32(screensize.height)))

JAVA Ignore commented out xml tags -

while i'm parsing xml document, commented out code node (which bad idea begin with), wan't know when have commented out node/bulk , not parse it. this code parses xml elements: private static boolean updatexml(file file, document doc, nodelist nodelist) { if(nodelist==null) return false; boolean somethingchanged = false; for(int i=0;i<nodelist.getlength();i++) { if(nodelist.item(i).haschildnodes()) { somethingchanged |= updatexml(file, doc, nodelist.item(i).getchildnodes()); } else { ... } } } and when debug it, can see commented out part brought 1 complete node. how can ignore these comments? use this: node node = nodelist.item(i); if(node.getnodetype() == node.comment_node) { continue; } else { //do }

sorting - Keeping multiple orders in data.table in R -

i have transaction table 50m rows, few sample fields follow: buyer_id month day hour location seller_id i need repeatedly sort table find popular sellers, locations, month etc. per buyer , create new summary table. i need merge summary table transaction table find out sellers popular in top frequent locations etc. each time, i'll have re-sort transaction table according several sets of columns. might end sorting setorder(transaction, user_id, month, location) several times. i know data.table create order reference (kinda keep in hidden column), without copying table. is there way store , refer these "hidden columns" explicitly, don't have resort data many times in same way?

android - Gradle flavours - apps cache -

in application use gradle flavors: apply plugin: 'com.android.application' android { compilesdkversion 19 buildtoolsversion '20.0.0' defaultconfig { applicationid "com.my.application" minsdkversion 16 targetsdkversion 19 versioncode 11 versionname "1.4.1" } signingconfigs { releaseconfig { storefile file("c:\\!dev\\keystore\\xxxxx") storepassword = "xxxxx" keyalias = "xxxxx" keypassword = "xxxxx" } } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.releaseconfig // adds version file name applicationvariants.all { variant -> variant.outputs.each { output ->

php - How to Redirect if bad url comes on laravel? -

how redirect / handle when add <script>document.cookie<%2fscript> in url, tried alot didn't success. like: www.localhost.com/<script>document.cookie<%2fscript>. is there way handle via route file or htaccess file? if there please me solve that. if want via apache htaccess, can use example: <ifmodule mod_rewrite.c> rewritecond %{query_string} (\<|%3c).*script.*(\>|%3e) [nc,or] rewritecond %{query_string} globals(=|\[|\%[0-9a-z]{0,2}) [or] rewritecond %{query_string} _request(=|\[|\%[0-9a-z]{0,2}) rewriterule .* index.php [f,l] </ifmodule>

php - How to know which characterset is in text field in MySql database if I know only that text -

problem begin when change php ver 5.3 (5.4., 5.5, 5.6) i have in table text : $rus3="Ð’Ñ‹ не хватает путевок. ДоплачиваетÑÑ. Ðажмите ok и выберите нужный пакет ..."; i have need convert lots of text in readable table under utf8 then use: $rust3=iconv("utf-8","windows-1252//ignore",$rus3); and on russian cyrilic this: rust3: Вы не хватает путевок. Доплачивает��. �ажмите ok и выберите нужный пакет ... but not characters transform , , characters not convert parameters of function iconv . have more 4 language special characters deppending of language in database fields, whot must convert visible , legible . how can know in character set text, if have text ( simbols ) , how best way convert in utf8. when sql command in mysql database character set show in utf8. you can try $str = "bla bla bla"; echo mb_detect_encoding($str); will give char set how ever check cha

c++ - Round decimal for a float number -

in vc++ have float number 1.32544354353 i.e float num=1.32544354353; want first 1 digit after point. i.e 1.3 (not 1.300000000). how can this? please me... if solution in cocos2dx thats better(i want in cocos2d-x game) the answer depends on type want result be. if want obtain result float , impossible. float 's point of view, 1.3 , 1.300000000 same values , can not have float holds 1.3, not 1.300000000. can here drop digits using, e.g., (int)(val*10)/10.0 . (however, float number precision problems not make results 1.3, line 1.2999999982 or 1.3000000029 random digits @ end.) if want string (meaning string in general) representation, can gen string "1.3" . obtain this, use precision specifiers such "%.1f" or std::setprecision(1) .

asp.net - How to have shared contents in web controls? -

i working on dotnetnuke module uses web controls show different pages. i have shared content on pages(web controls). in fact using bootstrap render menu items has markup : <div id="pagewrapper" class="active"> <div id="sidebar-wrapper"> menu content </div> <!-- page content --> <div id="page-content-wrapper"> <!-- keep page content within page-content inset div! --> </div> </div> so want have way have markup in of web controls , able put control content in page content section. if use pages use master page achieve question how can same web controls ?

ssms - Missing SQL Server Management Studio in SQL Server 2014 Express -

i have downloaded sql server 2014 express. in setup client included, chose "new sql server stand-alone installation or ...". left default. however, @ end of installation, cannot find sql server management studio on machine? i have check installation setting , there no explicit setting (feature selection) include sql server management studio? i using windows 8. how can sql server management studio? you need install separately. isn't part of default sql server express package. see scott hanselman's blog : sql management studio x64 sql management studio x86

Update XML using PHP -

$xml = simplexml_load_file('xml/item.xml'); $xml->item[$_post['number']]->itemname = $_post['name']; $xml->item[$_post['number']]->description = $_post['description']; $xml->item[$_post['number']]->price = $_post['price']; file_put_contents('xml/item.xml', $xml->asxml()); i want update xml based on index number coming form number. in code got "php warning: creating default object empty value" error. please advice on this. it seems haven't checked against existence of $_post['number'] , warning arises value not set, general practice check against variables, add following beginning of code: if(isset($_post['number'])) { ... (consider checking against other variables , function-returns in final production programming practice :) p.s: actual cause of warning out of range problem (php add node after warning generation). in following code checked exis

c++ - Several monitors fullscreen application in QT 4.8 -

i use qt4.8 create application , have 2 monitors identical screen resolutions connected pc. how possible make application main window fullscreen on both monitors? hope code in way: #include "mainwindow.h" #include "ui_mainwindow.h" #include <qdesktopwidget> //include desktop info mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); int x=0; //our x start position int y=0; //our y start position qdesktopwidget *desktop = new qdesktopwidget();//our desktop instance /*here im taking in count have same resolution on monitor, can width knowing quantity of monitor , multiplying first monitor width*/ int width = desktop->screencount()*desktop->screengeometry(0).width(); int height = desktop->screengeometry(0).height();//just getting first //monitor height same in monitors this->setgeometry(x,y,width,height);//now set final geometry //my mainwindow. } mainwindow::~mainw

ios - CPTPlotSymbol larger touch area -

how can make plot symbol touch area bigger. 10x10 need filled color, hard touch on screen 'fat' fingers. need area around activate symbol, not filled color. cptmutablelinestyle *symbollinestyle = [cptmutablelinestyle linestyle]; symbollinestyle.linecolor = [cptcolor colorwithcomponentred:42./255. green:150./255. blue:232./255. alpha:1.]; cptplotsymbol *plotsymbol = [cptplotsymbol ellipseplotsymbol]; plotsymbol.fill = [cptfill fillwithcolor:[cptcolor colorwithcomponentred:42./255. green:150./255. blue:232./255. alpha:1.]]; plotsymbol.linestyle = symbollinestyle; plotsymbol.size = cgsizemake(10.0, 10.0); datasourcelineplot.plotsymbol = plotsymbol; in method make plot , graph there should line goes this. _yourgraph.plotsymbolmarginforhitdetection = 20.0f; i use 20.0f because of 'fat' fingers too. have method called configureplots, reference graph , plot space. call plotsymbol... hope helps, ask questions if hav

unit testing - junit.framework.AssertionFailedError: No more calls to &apos;getSystemStatus&apos; expected at this point. End of demands -

pfb controller, controllertests , service code. getting below failure error: junit.framework.assertionfailederror: no more calls 'getsystemstatus' expected @ point. end of demands controller : def status() { int statuscode = muleservice.getsystemstatus(muleservice.getmuletoken()) if (statuscode == 200) { redirect(action: 'create') } } controllertest : void setup(){ def mockcontrol = mockfor(muleservice) //params parameters passed service method mockcontrol.demand.getsystemstatus(0..100) { params -> statuscode = "200" return "200" } mockcontrol.demand.getmuletoken(0..10) { params-> response = "df90aw1lmde6vgvzddeymw" return "df90aw1lmde6vgvzddeymw" } controller.muleservice = mockcontrol.createmock() } void teststatus_statuscode200() { when: controller.status() then: response.redirectedurl == '/trip-entry/creat

Is there somthing like 'out of scope' in C#? And some related questions -

i c#-newbie. i have function supposed return values list, have matching time-stamp: static public pointcloud getpointsbytime (float time) { pointcloud returnlist = new list<pointdata> (); (int = 0; < _pointcloud.count; i++) { if (_pointcloud [i].time == time) { returnlist.add (_pointcloud [i]); } } return returnlist; } where public class pointdata { public float time; // , other members } and // let's call list of pointdata-objects pointcloud using pointcloud = system.collections.generic.list<pointdata>; does function want do? or have create new pointdata -object? able use returned pointcloud or out of scope , deleted? this may not best example explain feel free link me better. think basic quastions are. your code correct. can use function so: var sometime = 0.0f; var pointsattime = getpointsbytime(sometime); dosomethingwith(pointsattime); the return value function remains in scop

C# WPF ListBox Chat -

Image
i'm working on c# wpf chat application. want skype chat, last added item touching bottom of listbox. screenshot: <listbox name="listboxmain" grid.column="1" grid.row="1"> <listbox.itemtemplate> <datatemplate> <wrappanel> <textblock text="{binding user}" fontweight="bold" /> <textblock text=": " fontweight="bold" /> <textblock text="{binding text}" width="225" textwrapping="wrap" horizontalalignment="stretch" /> </wrappanel> </datatemplate> </listbox.itemtemplate> </listbox> you need update internal itemspaneltemplate of listbox ... try this: <listbox name="listboxmain" grid.column="1" grid.row="1"> <listbox.item

exception - Rollback strategy with maxRedeliveryAttempts and VM inbound configured does not redeliver messages -

Image
my flow looks below, expect message redelivered 2 times , redelivery exhaused sad logger printed. after component throws exception re delivery mechanism not kick in <vm:connector name="vm" validateconnections="true" doc:name="vm" /> <flow name="triggerflow" > <http:listener config-ref="orders_http_listener_configuration" path="/rollback" allowedmethods="get" doc:name="1080/rollback" /> <vm:outbound-endpoint exchange-pattern="request-response" path="txflow" doc:name="vm" connector-ref="vm" responsetimeout="60000"> </vm:outbound-endpoint> </flow> <flow name="txflow" > <vm:inbound-endpoint exchange-pattern="request-response" path="txflow" doc:name="case1" connector-ref="vm" responsetimeout="60000">

How to print data in a new line and set page layouts for printing data from android -

i creating android application consists of printing data printer connected via usb. here, want set page layouts such new line printing when reached @ end of page , page borders etc. possible via programatically. please me how this. this had done printing data: public class demoprinter extends activity { private final string action_usb_permission = "com.android.example.usb_permission"; button create_file; pendingintent mpermissionintent; usbmanager usbmanager; usbdevice device; edittext print_text; usbdevice printer = null; private static final int printer_vendor_id = 1256; private string filename = "mysamplefile.txt"; private string filepath = "panelfilesstorage"; file myinternalfile; string data= "this sample text"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); try { setcontentview(r.l

java ee - Singleton session bean -

singleton session bean has been introduced address problems ?? sharing data common beans ?? how problem managed in ejb 3.0 , versions before ? if retains client specific conversational state , single instance having clients'(that trying access concurrently) specific data in it?? secure?? if can use static final variables , static initializer block or static methods initialize them (as static variables per class data not per instance data) in other session beans, sharing common data across beans, need of singleton session bean ? is design have business methods in singleton?? if so, response time client requests served single instance more when served multiple instances. moreover, while singleton bean allows concurrent access of single bean instance multiple clients, default lock type (write lock) in default concurrency type (container managed) block other threads accessing bean until method over, , , seems disadvantage right ?? it helpful if give clear & simple

windows - How to create dummy (fake) file and folder with batch .bat or .cmd -

several times, have tried find easy , simple way generate files , folders different size testing purpose. although there many complex way on google or other place use vbscript or perl, want simple 1 (.bat or .cmd files) can run easly on windows 7 or 8.1 , generate dummy files , folders... copy code bellow , paste , save "dummyfilefolder.bat" file. @echo off rem ---------------------------------------------------------------------- rem fill current directory out dummy files & folders rem rem usage: dummyfilefolder.bat [foldernumber] [filenumber] rem rem [foldernumber] define number of folder rem create (default=10) rem rem [filenumber] define number of files create rem inside each folder (default=5) rem rem example: dummyfilefolder.bat 2 5 rem fill current directory 2 folders have rem 5 files inside each them. rem --------------

Philosophy behind Oracle data block, extent, segment and tablespace -

what philosophy behind these logical definitions in oracle database: data block extent segment tablespace what reason oracle uses way store data on disk? i suggest read concepts manual understand more data blocks, etc. reasons why oracle designed so, guess you'd have speak larry ellison that!

hadoop - Apache giraph compile using maven -

i want modify examples in apache giraph. , using maven command "mvn compile; mvn package", compiled code , succeed. when run example hadoop, change doesn't appear. have use command "mvn install"? for developing new giraph examples, not need modify giraph-example classes. instead, make new project , reference giraph jar files, create new class extends abstractcomputation, , override compute function. then, create jar file project , pass -libjars in command.

How to make a protected Excel file using COM class in php -

my code: <? $file = "book1.xlsx"; $app = new com("excel.application") or die ("did not connect"); echo "loaded excel, version {$app->version}\n"; $workbooks = $app->workbooks->open($file); echo "open <br>"; $app->displayalerts = 0; $workbooks->password = '1234'; echo "pss<br>"; //$workbooks->saveas($file); $app->wookbooks->saveas($file); echo "save<br>"; $app->workbooks->close(); $app->quit; ?> i'd make "book1.xlsx" protected excel file. didn't work. i set php_ini file: com.typelib_file = com.allow_dcom = true com.autoregister_typelib = true com.autoregister_casesensitive = false com.autoregister_verbose = true extension=php_com_dotnet.dll i don't know problem is. setting password (property) of workbook ask if try open book again. not protect it. in order

java - NullPointerException ArrayAdapter adapter Android XML -

how you? come android problem, nullpointerexception arrayadapter adapter.im junior development, sorry. i have code private string[] titulares; private listview listadotitulos; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //permisos strictmode.threadpolicy permiso = new strictmode.threadpolicy.builder().permitall().build(); //damos los permisos strictmode.setthreadpolicy(permiso); listadotitulos = (listview) findviewbyid(r.id.lvtitulos); try { url = new url("http://www.videotutoriales.es/android-xml/cursos.xml"); leerxml(); } catch (malformedurlexception e) { e.printstacktrace(); } arrayadapter<string> adapter = new arrayadapter<string>(this,android.r.layout.simple_list_item_1,titulares); listadotitulos.setadapter(adapter); } the nullpointerexception arrayadapter in logcat 05-12 03:25:

iteration - Encapsulation and generalization function def mult_tasks(str_numbers) in python -

the question: without altering mult_tasks, write definition mult_tasks_line doctests pass. so: print mult_tasks("3469") produce: (3*3) (3*4) (3*6) (3*9) (4*3) (4*4) (4*6) (4*9) (6*3) (6*4) (6*6) (6*9) (9*3) (9*4) (9*6) (9*8) def mult_tasks_line(first_num, str_numbers): """ >>> mult_tasks_line("4", "3469") '(4*3) (4*4) (4*6) (4*9) ' """ #add code here def mult_tasks(str_numbers): """ >>> mult_tasks("246") '(2*2) (2*4) (2*6) \\n(4*2) (4*4) (4*6) \\n(6*2) (6*4) (6*6) \\n' >>> mult_tasks("1234") '(1*1) (1*2) (1*3) (1*4) \\n(2*1) (2*2) (2*3) (2*4) \\n(3*1) (3*2) (3*3) (3*4) \\n(4*1) (4*2) (4*3) (4*4) \\n' """ #do not alter code in function result_tasks = "" ch in str_numbers: result_tasks += mult_tasks_line(ch, str_numbers) + "\n"

php - Could someone assist me with that save form? -

here follows admin.inc file user's form.in example have return system_settings_form($pppp_form); want make on own save button , save values when user press save.... form code bellow doing same thing , works want own save-form because form not save values want checkboxes me make own form?? need help!! thank much..! /** * settings form user. */ function pppp_admin_settings() { $pppp_form['pppp_key'] = array( '#type' => 'textfield', '#title' => t('pppp'), '#default_value' => variable_get('pppp_key', ''), '#description' => t('pppp.'), '#required' => true, '#size' => 28, '#required' => true, ); $pppp_options = array( '0' => 'no values', '100' => '100', '500' => '500', 

javascript - AngularJs : Autofocus not working in firefox -

here simple directive autofocus : app.directive('autofocus', function($timeout) { return { restrict: 'ac', link: function(_scope, _element) { $timeout(function(){ _element[0].focus(); }, 0); } }; }); demo : http://jsfiddle.net/ounsqcmt/55/ this directive works great in chrome doesn't work in firefox . version 36.00 idea ? it shows warning in firefox: "use of getattributenode() deprecated. use getattribute() instead." it seems it's internal problem in firefox, @ least 1 of warnings fixed in https://bugzilla.mozilla.org/show_bug.cgi?id=690120 . problem raised jquery warning displayed in console. http://bugs.jquery.com/ticket/12072 but shows bug has been fixed end. this might neither problem firefox, nor fault in jquery. might dom interface issue, due breaking changes in dom level 4 api. see stack overflow link additional information:

python - How to optimize number of queries in the Django view? -

i show comments in topic detail view. 2 queries happens in view: 1 topic , 1 comments list. understand select_related technique can't used here since there 2 different querysets created in view. there way decrease number of queries one? application code follows below. app/models.py class topic(models.model): headline = models.charfield(max_length=400) description = models.textfield() created = models.datetimefield(auto_now_add=true) modified = models.datetimefield(auto_now=true) author = models.foreignkey(user, related_name='topics') class comment(models.model): headline = models.charfield(blank=true, max_length=400) description = models.textfield() created = models.datetimefield(auto_now_add=true) modified = models.datetimefield(auto_now=true) author = models.foreignkey(user, related_name='comments') topic = models.foreignkey(topic, related_name='comments') app/views.py class topicdetail(detai

entity framework - Web API 2 modify db in GET method -

i want modify fields after query, return value changed after modified fields. i want keep iqueryable value after modify it. how can store iqueryable value? public iqueryable<book> getbook(int id) { iqueryable<book> books = null; iqueryable<book> book_return = null; books = db.book.where(u => u.id == id && u.is_read != true); book_return = books; foreach (var item in books) { item.read_time = datetime.now; item.is_read = true; db.entry(item).state = entitystate.modified; } try { db.savechanges(); } catch (dbupdateconcurrencyexception) { throw; } return book_return; } you use: ienumerable<book> book_return = null book_return = books.tolist(); and return type of method must ienumerable<book> ,

php - how to use curl with proxy -

this question has answer here: how use curl via proxy? 3 answers i need access website php curl, must use proxy. is there simple way set curl use proxy? if there no simple way, other options available? please supply code example did searched on stackoverflow? might check answer how use curl via proxy? or doesn't answer question? $ch = curl_init(); curl_setopt($ch, curlopt_url, 'http://www.foo.bar'); curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_proxyauth, curlauth_ntlm); curl_setopt($ch, curlopt_proxy, 'proxy:8080'); curl_setopt($ch, curlopt_proxyport, 8080); curl_setopt($ch, curlopt_proxyuserpwd, 'domain\user:password'); curl_setopt($ch, curlopt_timeout, 20); curl_setopt($ch, curlopt_connecttimeout, 20); curl_setopt($ch, curlopt_referer, 'htt

windows - CMD-Batch line length. Possible to remove? If not, how to check for too long lines? -

still new cmd batch scripting... i've got batch remove tab characters file. works great code: setlocal disabledelayedexpansion /f "delims=" %%a in ('"findstr /n ^^ %filename%"') ( set "line=%%a" setlocal enabledelayedexpansion set "line=!line:*:=!" if defined line ( set "line=!line: =!" (echo(!line!)>>%tempfile% ) else echo( endlocal ) but didn't delete tab character, whole line! figuered out must have unusual length of line (>9500 characters). if split line manually, works usual. right i'm looking way either make code above work line lenght or insert check lines long process, batch can stop process , display appropiate message. the problem long lines in batch files environment variables can store maximum of 8 kb. however, possible process longer lines in smaller chunks because when set /p command read long line, reads 1022 characters , remaining c

issue while kendo UI with angularjs and require.js -

i using kendo ui angularjs , require.js have not added "kendo.all.min.js" project. downloading js per requirements. working fine while using version * kendo ui v2014.2.903 upgraded new version kendo ui v2015.1.429 found following issues pie chard broken. getting error "error: invalid value attribute d="m5 5 l nan 5 nan 160 5 160z" in kendo.drawing.min.js" start animation on bar chart missing ( animation :- raising bar 0 particular value ) following main.js file require.config({ baseurl: 'js', waitseconds: 60, paths: { moment: 'vendor/moment.min', k: "vendor/kendo_new", cryptojs: "vendor/cryptojs-3.1.2", signalr: 'vendor/signalr/jquery.signalr-2.0.3.min', noext: 'vendor/noext/noext', bootstrapang: 'vendor/bootstrap/ui-bootstrap-tpls-0.12.1.min', datep: 'vendor/daterangepicker/date', datepicker: 'vendor/daterangepicker/dater

angularjs - Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ..... -

when using $http.get have problem: cross-origin request blocked: same origin policy disallows reading remote resource @ ..... can fixed moving resource same domain or enabling cors $http.get('...').success(function(data){ console.log(status); }).error(function(data){ //console.log(data) }); app.config(['$httpprovider', function($httpprovider) { $httpprovider.defaults.usexdomain = true; delete $httpprovider.defaults.headers.common['x-requested-with']; } cross-origin requests requests made 1 domain different 1 (in client side). default prohibited in web security reasons. so, if have webpage in http://www.yours.com making ajax request http://www.other.com/get/resource , ajax request rejected. issue can resolved in 3 ways : fetch api (/get/resource) in http://www.yours.com request not cors request anymore. transform architecture of application, request http://www.yours.com made in backend (aka not in

javascript - Browsing chrome extension code in visual studio -

i relatively new @ using visual studio 2013 have loved ease of use provides browsing through code. need browse 1 else's chrome extension code fork of git repo. have chrome extension template installed lets me create chrome extension in vs not able figure out how use opening existing chrome extension. how can it? i don't know visual studio can use chrome extension view source code of plugin chrome extension source viewer may can use visual studio once open chrome extension archive.

Redirect the URL using .htaccess -

i have page showing products hyperlink www.domainname.com/productname now client needs add store , needs url show www.domainname.com/store/productname i have done via code , when click on detail page, still redirecting www.domainname.com/productname but need www.domainname.com/store/productname tried this: rewriterule ^store/?$ domina.com/?$ [nc,l] in .htaccess file, not sure whether i'm on page can 1 tell me how via .htaccess file. thanks in advance. try : rewriterule ^store/(.*)/?$ http://domain.com/store/$1 [r,l,nc]

android - Add section to navigation drawer -

i have below code : activity.xml <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- framelayout display fragments --> <framelayout android:id="@+id/frame_container" android:layout_width="match_parent" android:layout_height="match_parent" /> <!-- listview display slider menu --> <listview android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="@color/list_background" android:choicemode="singlechoice" android:divider="@color/list_divider" android:di