Posts

Showing posts from May, 2011

Chef IIS Cookbook thirty_two_bit option not working -

i have resource block create app pool, make thirty_two_bit option true , assign username , password. iis_pool 'cpool' runtime_version "2.0" pipeline_mode :"classic" recycle_after_time "0" thirty_two_bit true pool_username "testuser" pool_password "testpd" action :add it creates app pool following options didn't work. recycle_after_time "0" thirty_two_bit true pool_username "testuser" pool_password "testpd" i wondering if bug. notes on appreciated - eben you mixing 2 different actions together. viewing chef source here can tell want call both :add create pool , :config rest. break as: iis_pool 'cpool' runtime_version "2.0" pipeline_mode :"classic" action :add iis_pool 'cpool' recycle_after_time "0" thirty_two_bit true pool_username "testuser" pool_password "testpd" action :config

java - How to preserve date modified when retrieving fil using Apache FTPClient? -

i using org.apache.commons.net.ftp.ftpclient retrieving files ftp server. crucial preserve last modified timestamp on file when saved on machine. have suggestion how solve this? you can modify timestamp after downloading file. the timestamp can retrieved through list command, or (non standard) mdtm command. you can see here how modify time stamp: that: http://www.mkyong.com/java/how-to-change-the-file-last-modified-date-in-java/

php - How to select a multiple column primary key of an inserted row? -

problem: i have following table in mysql. example lets there (and be) 1 person in world called "tom" "bell". (name, surname) primary key in table. every person has salary, unsigned integer. create table if not exists `user` ( `name` varchar(64) not null default 'default_name', `surname` varchar(64) not null default 'default_surname', `salary` int(10) unsigned not null default '0', unique key `id` (`name`,`surname`) ) engine=myisam default charset=utf8; whenever insert row using php script want function return primary key of inserted row (an array key=>value). from php context not know primary key of table 'user' consists of , not need set primary key values (example 2, stupid, possible). i can add argument insert function (for example pass table name, in case "user"). if matters, using pdo (php data objects) connect mysql database. example 1: $db->insert('insert `user` (`name`,`surname`

Being able to all abilities of Kendo UI Model -

i newbie in kendo ui world. have read book named "learning kendo ui web development". have opinion , little skills use it. still wonder points tools. example, want use abilities of kendo model tojson or etc. also,i think kendogrid() , data() function serves many easinesses. need documentation usage of these 2 useful methods. want learn these abilities tool. documentation of product not enough; cannot reach points in it; , forum commercial asking question.

javascript - Listview containing checkbox and text is getting reset on scrolling -

Image
i have drawn customized navigation drawer listview , header when scroll list checkbox in list getting unchecked. secondly when click on reset button in header part want checkbox in listview should get unchecked. have been trying working unable find solution.. the snippets are public class navigationdrawer extends fragment{ @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.filter_navigation_drawer, container,false); drawerlistview= ( listview ) view.findviewbyid( r.id.listdrawer ); drawerlistview.setonitemclicklistener(new filterdraweritemclicklistener()); datalist.add(new filterdraweritem("sample1",true)); datalist.add(new filterdraweritem("sample2",true)); datalist.add(new filterdraweritem("sample3",true)); datalist.add(new filterdraweritem("sample4&qu

jquery - Pull Content From One Page Into Another (Same Domain) -

i trying pull content 1 page on same domain. i have ecommerce site many product listings pages. creating brand page each brand. @ bottom of page show products available brand in stock. easiest , maintainable way show ul listings page brand if product goes out of stock not shown on listings page theory wont show on new page. so question how page b show page a's ul content? (the has class, ul class=list-products) or alternatively there html allow me display products predefined search term? if cms .net , search solr we have xml feed google if there way can use that! jquery's .load() function rescue: $( "#elementfromnewpage" ).load( "oldpage.html #elementfromoldpage" ); this grab oldpage.html, perform innerhtml on #elementfromoldpage , place within #elementfromnewpage . for more documentation, see: http://api.jquery.com/load/

Using HTML5, CSS3, and Javascript for Windows Phone 8.1 App Development -

i have been working web design , development 3 years , quite familiar html5, css3, robust javascript jquery. now want delve windows phone application development since heard requires html5, css3, , javascript far can understand development process same develop website separate individual files index.html (for html) .css (for css) .js (for javascript) in folder. do need other skills , languages or on right path? i'd suggest looking on official microsoft site. http://msdn.microsoft.com/en-us/library/bb677133.aspx it depends on want include in app. in opinion worth looking @ c , c++ develop more features , have native mobile feel. if want on safe side, can still use html5, css3 , js. should take @ client-side jscript.

jquery - Deferred object not containing exact values in json object -

Image
i creating 1 javascript library. in using deferred methods asynchronous call. thing is, if log output json object not showing items. if expand object showing actual values. below screenshot. in console.log showing subfolders object contains 0 elements, if expand object subfolders containing 2 elements. output object coming multiple asynchronous calls. following code restqueries.getfilesfromfolders = function(){ var execute = function(libraryname){ var libraryitems={rootfolder:[],subfolders:[]}; var deferred = $.deferred(); var _url = makeproperurl(); var itemsinrootfolder = getitemsfromfolder(libraryname,'files'); itemsinrootfolder.then(function(data){ var temparray = []; if(typeof(data.d.results)!='undefined' && data.d.results.length>0) { for(var =0;i<data.d.results.length;i++) { temparray.push({"name":da

javascript - Backbone running a method based on a collection listener -

in application have following code, initialize: function() { pops.collections.teamcollection = this.collection; this.collection.fetch(); this.collection.on('sync', this.render, this); }, render: function() { this.addall(); return this; }, its pretty self explanatory, fetch collection, once synced server run render collection. @ time of writing sequence of code seemed a idea looks when save model of collection runs sync listener , runs render again. not behaviour want. there listener can use listen initial fetch being complete? according backbone documentation, backbone.sync function backbone calls every time attempts read or save model server. the event "catch-all" crud operations communicating server, why it's being fired on saving model. looking deeper documentation gives clues how .fetch() works when model data returns server, uses set (intelligently) merge fetched models, unless pass {reset: true}, in case c

mysql - Several foreign keys in a table -

to design database, have big table contains devices specifications (table : "devices" ), there 60 columns. the value of several features in predefined list (of 3 or 4 values). they said should not have big tables lot of columns, , necessary separate data small tables. did following: for feature takes value predefined list, created small table (2 columns : id & specification) lines not update (3 or 4 lines)). small tables have relationship 1 .... n "devices" table. there several specifications of kind. finally, there several small tables 1 ....n "devices" table. question: said should not have big tables lot of columns, , necessary separate data smaller tables (as did), have same number of columns, because small tables migrate foreign keys big table ( "devices" ) ! i need help, want understand. thank much. some reasons: it easier manage data; when specific value changes, have change in 1 place: 'the small tab

javascript - Calling webservice method through ajax -

Image
i have wcf service method: [webinvoke(method = "post", uritemplate = "validatelogin", responseformat = webmessageformat.json,requestformat=webmessageformat.json,bodystyle=webmessagebodystyle.bare)] [operationcontract] bool validatelogin(login objlogin); i calling method through phonegap code ajax as: var parameters = { "emailid": emailid, "password": password }; $.ajax({ url: "http://localhost:95/mobileecomm/service1.svc/validatelogin", data: json.stringify(parameters), contenttype: "text/xml;charset=utf-8", datatype: "json", headers: { soapaction: '' }, type: 'post', processdata: false, cache: false, success: function (data) { alert("asdsad"); }, error: function (response) { var value = json.stringify(response); alert("error in saving.please try later."+value); } }); but

sql server - how to cast or convert numeric/varchar to date data type field in sql and use in update statement? -

good day! i have 2 questions how update date data type column field using varchar , numeric column field 1.) mydate varchar(8)--> varchar column field select mydate mytable result: 20141120 my question how can update date column field using varchar column field using cast or convert update table2 set date = (select mydate mytable) which error!!! , i'm stuck. 2.) mydate numeric(8) --> numeric column field select mydate mytable result: 20101015 20140910 etc....... update table2 set date = (select mydate mytable a, mytable2 b a.id=b.id) my question how can update date column field using numeric column field using cast or convert i used different cast , convert still i'm getting error! what correct syntax this? thank your help! to convert string date field need use convert function: convert(datetime, mydate, 101) this expecting string field, if mydate field numeric field need cast string, convert command

C# Java issue with String to Array to String -

i trying convert string array string again. trying achieve in c# have not done c# in while having issues. created following code in java , works fine: string shtml = "test1\r\ntest2\r\ntest3\r\ntest4\r\ntes5t\r\ntest6\r\ntest7\r\ntest8\r\ntest9\r\ntest10\r\ntest11\r\ntest12\r\ntest13\r\ntes14t\r\n"; int temp = 0; list<string> emailtext = new arraylist<string>(); for(int x = 0; x<shtml.length();x++){ if(shtml.charat(x)=='\n'){ emailtext.add(shtml.substring(temp, x)); temp = x; } } string testingstring=""; for(string words:emailtext){ //system.out.println(words); testingstring+=words; } system.out.println(testingstring); this works fine in java. following code have c#: int temp = 0; list<string> emailtext = new list<string>(); (int x = 0; x < shtml.length; x++) { if (shtml[x].equals("\\n")) {

class - Inheritance functions in java -

this question has answer here: how hide (remove) base class's methods in c#? [duplicate] 10 answers duplicate of disabling inherited method on derived class this class codes: class parent{ public bool sum(int a){return true;} public int mul(int a){return a*a;} } and 2 classes extends parent class: class derived extend parent{ //here child can see 2 methods of parent class , //i want see sum method in here , don't see mul method } class derivedb extend parent{ //here child can see 2 methods of parent class , //i want here see mul method. } you can making mul private method in parent class. mul method has visibility inside parent class class parent{ public bool sum(int a){return true;} private int mul(int a){return a*a;} }

ios - Restyle whole App UI on event - What is the best approach? -

this pattern/design question following setup: my app has different styling during day/night, includes: background images font sizes , colors ui element positioning button images etc... the uiappearance proxy protocol used as possible, storyboard. nevertheless of styling done in specific views viewdidload methods, has updated well. the problem: when app active during switch day night , vice versa newly created ui elements styled according new setting, expected, elements, present during previous setting remain unstyled. how can trigger restyle on ui elements? ideas: can somehow trigger complete ui redraw? (including calling each views viewdidload?) do have move styling viewdidload methods layoutsubviews , call layoutifneeded? is there more conveniant way? did quick google search , found this: // update uiappearance... nsarray *windows = [uiapplication sharedapplication].windows; (uiwindow *window in windows) { (uiview *view in window.subviews)

scala - Ambiguous Class level and inherited method level ClassTag -

i have trait requires function classtag trait foo[t] { def bar(a: list[t])(implicit ev: classtag[t]): unit } now have class needs extend trait, has uses classtag other methods, e.g. class myclass[t](implicit classtag: classtag[t]) extends foo[t] { override def bar(a: list[t])(implicit ev: classtag[t]): unit = { /* stuff */ } def other(p: map[string, t]) = /* other stuff need classtag */ } when compiled error message along lines of: error:scalac: ambiguous implicit values: both value classtag in class myclass of type scala.reflect.classtag[t] , value ev of type scala.reflect.classtag[t] match expected type scala.reflect.classtag[t] is there way can accommodate both class level classtag , override method parent trait? you can give same name both of them.

How to set infowindow for all markers in google map using JavaScript? -

i created stop point markers truck stopped.but need open infowindow when clicked stop point. my js codes : var imagestop = '/images/stoppoint.gif'; var infowindowtrcukstop = new google.maps.infowindow(); var json = result.d; obj = json.parse(json); (var = 0; < obj.length - 1; i++) { if(parseint(obj[i].speed)==0) { var latlngstop = new google.maps.latlng(obj[i].lat, obj[i].lng); markerstoptruck = new google.maps.marker({ position: latlngstop, draggable: true, animation: google.maps.animation.drop, map: map, title: 'stopped here', icon: imagestop, }); google.maps.event.addlistener(markerstoptruck, 'click', function (e) { infowindowtruckstop.setcontent(this.title); infowindowtruckstop.open(map, markerstoptruck); }); markerstoptruck.setmap(map); } } i solved. (var = 0; < obj

c# - Windows Phone 8.1 - Bluetooth Low Energy and Authentication -

i'm having authentication issue bluetooth low energy devices c#. i can connect ble, read services, when try write function, following error: "the attribute requires authentication before can read or written. (exception hresult: 0x80650005)" i've paired device and, said, can read it. problem when need write. if don't pair device, when write automatically pairs, gives error. public async static task<bool> writebyte(string paramdeviceid, guid paramservice, byte paramvalue) { string debug; var services = await windows.devices.enumeration.deviceinformation.findallasync(gattdeviceservice.getdeviceselectorfromuuid([uuid here]), null); gattdeviceservice service = await gattdeviceservice.fromidasync(paramdeviceid); debug = "using service: " + services[0].name; // service name correct gattcharacteristic gattcharacteristic = service.getcharacteristics(paramservice)[0]; var writer = new windo

c# - Rx with external states -

rx external states? so in example there rx functionality combined external state full behavior. best approach rx achieve this? problematic code places 'updateactive'. public enum source { observable1, observable2, } // type source.observable1 iobservable<source> observable1; // type source.observable2 iobservable<source> observable2; var mergedobservables = observable1.select(x => source.observable1) .merge(observable2.select(x => source.observable2)); var updateactive = false; mergedobservables.subscribe(x => { switch (x.source) { case source.observable1: { if (updateactive) break; updateactive = true; // here code causes observable2 new values. // (this coud on other thread) // if case, new value(s) should ignored. updateactive = false; } break; case source.observable2: {

Cassandra Streaming error - Unknown keyspace system_traces -

in our dev cluster, has been running smooth before, when replace node (which have been doing constantly) following failure occurs , prevents replacement node joining. cassandra version 2.0.7 what can done it? error [stream-in-/10.128.---.---] 2014-11-19 12:35:58,007 streamsession.java (line 420) [stream #9cad81f0-6fe8-11e4-b575-4b49634010a9] streaming error occurred java.lang.assertionerror: unknown keyspace system_traces @ org.apache.cassandra.db.keyspace.<init>(keyspace.java:260) @ org.apache.cassandra.db.keyspace.open(keyspace.java:110) @ org.apache.cassandra.db.keyspace.open(keyspace.java:88) @ org.apache.cassandra.streaming.streamsession.addtransferranges(streamsession.java:239) @ org.apache.cassandra.streaming.streamsession.prepare(streamsession.java:436) @ org.apache.cassandra.streaming.streamsession.messagereceived(streamsession.java:368) @ org.apache.cassandra.streaming.connectionhandler$incomingmessagehandler.run(connectionhandler.j

batch file - Elevated Privilege in XP -

does know how on xp using tha batch command, tested in limited user. have found , works fine in w7 when tried on xp not work. cls @echo off :: batchgotadmin :------------------------------------- rem --> check permissions >nul 2>&1 "%systemroot%\system32\cacls.exe" "%systemroot%\system32\config\system" rem --> if error flag set, not have admin. if '%errorlevel%' neq '0' ( cls echo ... restart console privilege admin ... pause>nul goto uacprompt ) else ( echo ... ok jedi ... goto gotadmin ) :uacprompt echo set uac = createobject^("shell.application"^) > "%temp%\getadmin.vbs" echo uac.shellexecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" exit /b :gotadmin if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "

xsl fo - XPath to only select elements with specific inline elements -

i'm looking expression selects nodes there no text around specific inline element: <list> <item> <!-- want node --> <paragraph> <link> installing driver </link> </paragraph> </item> <item> <paragraph> mixed content example <link> tablet active area </link> more content </paragraph> </item> </list> so, want select items not contain mixed content or paragraphs contain link elements , nothing else. you can select /list/item[not(paragraph[* , text()[normalize-space()]])] select item elements don't contain paragraph mixed contents (i.e. text nodes , element nodes).

wordpress - Penetration testing - It is recommended that access to this portal is prevented via the Internet -

we have done penetration testing on wordpress site , 1 of issues has been returned is: an administration portal accessible via internet it recommended access portal prevented via internet as site web based cms possible fix? not area of expertise , i'm struggling find way fix this. can help? thanks it recommended access portal prevented via internet that's vague of point, , that's fault of people doing pentest , pentest software. but start http://codex.wordpress.org/brute_force_attacks , http://codex.wordpress.org/hardening_wordpress in order restrict access admin area whitelisting ips 12.345.67.891 , 23.456.78.99 admin access, in .htaccess in wp-admin add: options -indexes order deny,allow deny allow 12.345.67.891 allow 23.456.78.99 deny in root .htaccess <files wp-login.php> order deny,allow deny allow 12.345.67.891 allow 23.456.78.99 deny </files> if calculate range, can use, i.e. 12.345.67.0/24 you

java - Spring AOP aspect with annotations is not working for base class -

i have annotation defined below @target({elementtype.type, elementtype.method}) @retention(retentionpolicy.runtime) @inherited public @interface otpflow { } and class defined below public abstract class { @otpflow public modelandview dosomething() { //do , return modelandview } } class b controller defined below @controller @requestmapping(value = {"/someurl"}) public class b extends { @requestmapping(value = {"/get"}, method = {requestmethod.post, requestmethod.get}) public modelandview get(httpservletrequest request, httpservletresponse response) { return dosomething(); } } aspect defined @component @aspect public class otpaspect { private static final logger logger = loggerfactory.getlogger(otpaspect.class); @pointcut("@annotation(otpflow)") public void otpflow() {} @around("otpflow()") public object checkotp(proceedingjoinpoint joinpoint) { try { logger.info("inside aspect");

opengl - What's the purpose of glVertexPointer? -

i looking @ particles examples of cuda , couldn't find make link between array of vertices , variables in shader. i've read , way i've been doing is ... glgenbuffers(1, &vbo); glbindbuffer(gl_array_buffer, vbo); glbufferdata( ... ) glenablevertexattribarray(0); glvertexattribpointer( ... ); ... however found in nvidia's example looks like glbindbufferarb(gl_array_buffer_arb, m_vbo); glvertexpointer(4, gl_float, 0, 0); glenableclientstate(gl_vertex_array); if (m_colorvbo) { glbindbufferarb(gl_array_buffer_arb, m_colorvbo); glcolorpointer(4, gl_float, 0, 0); glenableclientstate(gl_color_array); } gldrawarrays(gl_points, 0, m_numparticles); glbindbufferarb(gl_array_buffer_arb, 0); gldisableclientstate(gl_vertex_array); gldisableclientstate(gl_color_array); which believe similar do. questions are what's difference between 2 ways of passing data shader? should prefer 1 on other? the first way modern, generic way of sending at

ios - Simulate device buttons inside my app? -

i have view containing 4 buttons: home lock volume up volume down all i'm trying make when press 1 of these buttons, app should communication device simulate 1 of these buttons. example: if click home button exists within app , same press home button in device. this kind of thing possible? jailbreak necessary this? to after go against apple review guidelines app rejected under 2.5 - apps use non-public apis rejected you not allowed take functionality of home , lock away these buttons , put within application. though not impossible if app jailbroken devices. such exit app can exit(0); though still wouldn't recommend makes though app has crashed when hasn't. for volume control can use of mpvolumeview recommend having read of apple documentation , question ios: accessing device hardware audio volume control

PHP echo linking -

how can add link following line? if ($image) echo $image->resize('w=272&h=170'); i have tried adding if ($image) echo '<a href="'.get_the_permalink().'">'$image->resize('w=272&h=170')'</a>'; if ($image) { echo '<a href="'.get_the_permalink().'">' . $image->resize('w=272&h=170') . '</a>'; }

redhawksdr - No symbols in libvolk.so -

i have been using volk in of our internal components if volk library detected on system. know gnuhawk packages version of volk in deps folder within sdrroot. created new linux image centos 6.6 , redhawk 1.10.0-10 installed rpms available online. had been building gnuhawk source. when running our custom components symbol lookup errors due symbol table having been stripped libvolk packaged rpm version of gnuhawk. what suggested way around issue? should create softpackage dependency our own version of libvolk in instead of using gnuhawk libvolk? you shouldn't have issues using volk shared objects packaged gnuhawk i'd have more info know sure what's going on. guess may compiling against system install of libvolk , running against gnuhawk version cause symbol look-up issue. make sure compiling , linking against volk files within sdrroot. should able use pc file ($sdrroot/sdr/dom/deps/gnuhawk/lib/pkgconfig/volk.pc) setup cxx & ld flags automatically autoto

java - Refresh JTable after delete and insert in JTabbedPane -

i want jtable auto-update when adding or deleting data table, can't refresh: can me find mistakes here? package gui; public class cek extends jframe implements actionlistener, listselectionlistener { public static connectionmanager conn = new connectionmanager(); private string driver = "com.mysql.jdbc.driver"; private string url = "jdbc:mysql://localhost/db_uas"; private string username = "root"; private string password = "shasa"; defaulttablemodel tablemodel = new defaulttablemodel(); private jtabbedpane tabpane; private jlabel label1; private jpanel panel1,panel2,panel3; private jtable table = new jtable(); private string judulkolom[] = {"mata uang" , "harga"}; private defaulttablemodel tbm; private int nmax = 50; int harga_kamar; listselectionmodel listmod; int row=0; object data[][] = new object[nmax][2]; jlabel lblmatauang = ne

javascript - pass file as parameter using jquery in asp .net mvc -

in order import data file excel , display data in ascx page, want pass file parameter controller via jquery function here code: view: <% using (html.beginform (new {enctype = "multipart / form-data"})) {%> <input type = "file" name = "file" /> <input type = "button" value = "ok" onclick = "import (); return false;" /> <%}%> jquery: import function () { var formdata = new formdata (); formdata = file var dialog = new messagebox (); $ .ajax ({ type: 'post' url: "/ controller / import" data: formdata, cache: false, contenttype: false, processdata: false, success: function (view) { alert ("success"); $ ("# divlist"). empty () $ ("# mainpagemain

javascript - Reusing Nav as dropdown menu on tablet/mobile -

i have created nav hides , displays menu items , displays menu icon when on tablet/mobile view. how can adapted when clicked on, menu items drop down? html: <nav class="site-nav"> <ul> <li><a href="index.html"><span class="icon-home"></span></a></li> <li><a href="#">menu 1</a></li> <li><a href="#">menu 2</a></li> <li><a href="#">menu 3</a></li> <li><a href="#">menu 4</a></li> <li><a href="#">menu 5</a></li> </ul> </nav> <a class="navicon-button x"> <div class="navicon"></div> </a> here's codepen: http://codepen.io/anon/pen/wbbrvk?editors=110 i recommend looking here if scroll bottom shows how dom manipulation event handling

java - How to refresh custom bean in NetBeans? -

Image
i want design relatively complex ui in netbeans ide. believed bring these components in 1 panel can intensify difficulty of maintenance of such panel. for purpose i've broken down structure in multiple custom beans extending jpanel . , in main panel i've included them choose bean button in palette toolbar. every things looks ok when change 1 of child beans, change not take place on imported custom bean in main panel. please point me out how can reload bean? thanks for purpose i've broken down structure in multiple custom beans extending jpanel. , in main panel i've included them choose bean button in palette toolbar. just starter i'd valid apporach , future visitors, following steps described here add panels main panel. same can done via drag & drop bean directly projects explorer design view. every things looks ok when change 1 of child beans, change not take place on imported custom bean in main panel. the short answer

c# - How to pass typed dataset objects using web services -

i have c# winform application (.net 3.5) access mssql server using typed dataset objects. currently, whole application working in 1 layer, , client access directly db using typed dataset objects. i want change application client-server model (which use web-services communication). my question is: how can pass typed dataset objects in web-services? example, have table of persons. , want client side able specific person (using web-service), update age, , save change (again using web service). is possible? thanks you should try out hibernate . intermediate entity-based mapping between classes , database tables. queries performed on business side of application (web service in case) in hql language; similar regular sql. i've used multiple times java , can quite useful. doing brief internet search found "nhibernate" .net specific version hibernate. for specific java application, set such gui not on web-service, while else is. using resource manager,

asp.net mvc - skip ahead in a foreach loop c# -

if have foreach loop takes whole bunch of addresses , loops through them, there way skip first 500 entries, something like: foreach(var row in addresses) { string straddr = row.address + "," + row.city + "," + row.st; system.threading.thread.skip(500) } i know skip doesn't exist there can use same thing? you can use method meaningful name: foreach(var row in addresses.skip(500)) { // ... } you need add using system.linq; since it's linq extension method. if type of addresses doesn't implement generic ienumerable<t> interface use cast<t> . example (presuming type address ): foreach(var row in addresses.cast<address>().skip(500)) { // ... }

html - simple code editor with snippets panel? -

i use webstorm ide , brackets quicker stuff. is there light weight editor similar brackets has snippets panel dreamweaver? or maybe 1 has plug in or extension adds snippets panel? i'm familiar live templates in webstorm don't believe there way have list of them in panel visible. prefer have big panel of commonly used blocks of code , html tags visible can click on. thanks help. windows only: notepad++ has a snippet plug in same thing. after installing notepad++ click plugin menu -> plugin manager. tick snippets , press install. rest done you. alternatives: sublime text has snippet tool it's not same as dreamweavers snippet panel.

PyQt QtWebKit - Return value from a Python method directly to JavaScript -

edit: i've found solution here: how correctly return values pyqt javascript? i'll post code first: python code: class jsbridge(qobject): def __init__(self, parent=none): super(jsbridge, self).__init__(parent) @pyqtslot(bool) def fromjstopython(self, param): print param print param.tobool() @pyqtslot() def returnvalue() return "hello world" class another(): ... view = qwebview() frame = view.page().mainframe() param = "blabla" frame.evaluatejavascript("printit('" + param + "');") parambool = true frame.evaluatejavascript("frompythonwithparameterbool('" + parambool + "');") javascript: function printit(param) { alert(param); } function topython() { jsbridgeinst.fromjstopython(true); } // here functions i've questions about: function frompythonwithparameterbool(param) { alert(param); } functio

python - Return from @tornado.gen.engine function without yield? -

i'd execute or not execute async query based on value of parameter. if parameter true, query shouldn't executed. i have method this: @tornado.gen.engine def retrievesomedata(self, feelinglucky, callback): if feelinglucky: return # <-- doesn't work, function never returns! else: response = yield tornado.gen.task(queryfunction, param1....) callback(response) how can make feelinglucky branch work? the thing can think of raising exception , catching in caller. that's ugly. or, if there such thing null task... (python 2.7, tornado 3.2) better use modern gen.coroutine instead of obsolete gen.engine . makes sort of conditional logic simple , natural: @tornado.gen.coroutine def retrievesomedata(self, feelinglucky): if feelinglucky: return else: response = yield tornado.gen.task(queryfunction, param1....) raise gen.return(response) if convert queryfunction coroutine style too, g

mysql - Query users with no activity for 3 days -

i have system in users can send each other comments. want find users haven't sent comments 3 days. also, run on daily cron , want them receive email once every 3 days after last comment, i'm trying latest comment between 3 , 4 days. here's have: $sql = "select u.firstname, u.email user u left join comment c on u.id=c.sender (date(c.date) between ( curdate() - interval 4 day ) , ( curdate() - interval 3 day )) , u.disabled=0 group u.id"; use date_sub subtracts interval from provided date try this $sql = "select u.firstname, u.email user u left join comment c on u.id=c.sender (date(c.date) between date_sub(now(),interval 4 day) , date_sub(now(),interval 3 day) , u.disabled=0 group u.id"

windows - External program started from Perl stays hidden and is not accesibile -

i've installed adobe media server (does contain apache to) , perl activestate , struggle find solution start local application (server side) through webpage using perl script. the problem program starting incorrectly , not visible or accessible in way. see in task manager. tried start other windows programs notepad.exe, calc.exe, mspaint.exe, etc. the weird part when run command line, same script working perfectly. programs starts , windows visible. my system has windows 7 installed , adobe media server apache 2.2. the script simple: #! "c:\perl64\bin\perl.exe" system('c:\a_tv\tv.exe'); try system(start.exe 'c:\a_tv\tv.exe');

Python Requests: Don't wait for request to finish -

in bash, possible execute command in background appending & . how can in python? while true: data = raw_input('enter something: ') requests.post(url, data=data) # don't wait finish. print('sending post request...') # should appear immediately. i use multiprocessing.dummy.pool . create singleton thread pool @ module level, , use pool.apply_async(requests.get, [params]) launch task. this command gives me future, can add list other futures indefinitely until i'd collect or of results. multiprocessing.dummy.pool is, against logic , reason, thread pool , not process pool. example (works in both python 2 , 3, long requests installed): from multiprocessing.dummy import pool import requests pool = pool(10) # creates pool ten threads; more threads = more concurrency. # "pool" module attribute; can sure there # 1 of them in application # modules cached after initializati

scala - argonaut - separating failures and successes when extracting List[A] -

i have instance of decodejson[a] particular type, a , , have instance of json , call j . i'd j.as[list[a]] . however, json coming me 3rd party, , if of items in array missing fields, i'd log errors items , collect items can parsed (instead of failing entire decoding). it seems me want end (list[(string, cursorhistory)], list[a]) . is, decoded elements end in list on right, , errors items not parsed accumulated on left. looks lot monadplus.separate method in scalaz. i can think of couple ways of getting there. 1 way like: j.as[list[json]].map(_.map(_.as[a].result).separate) this should give me decoderesult[list[(string, cursorhistory)], list[a]] desired. however, throw away cursor information in json array items failed located. use zipwithindex , starts pretty messy. to me seems better solution this: implicit def decoderesultdecodejson[a: decodejson]: decodejson[decoderesult[a]] = decodearr(_.as[a]) // outer decoderesult success j.as[list[decoderesult[a]]].

java - Contract design pattern widely used android -

i have noticed developers of default apps android use contract pattern. used databases, content providers. contract class final , stores constants, , weird thing me inner interfaces. public final class clockcontract protected interface alarmscolumns extends alarmsettingcolumns, basecolumns protected interface instancescolumns extends alarmsettingcolumns, basecolumns protected interface citiescolumns all classes (and interfaces) container constants. approach this. why not define them in each class ? , practice store variables in interfaces. , weir thing me puprose of inner interfaces . please explain idea of this. thanks a contract list of definitions used group of specified purposes. practice because people not misuse classes , interfaces in unrelated domains. public final class databasecontract { /***inner class defines table contents.***/ public static abstract class entry implements basecolumns { public static final string table_name = "al

Python sorting dictionary keys into a list by values -

this question has answer here: how sort dictionary value? 38 answers i have dictionary say: red : 2 blue : 1 yellow : 9 black : 9 white : 5 i need generate list of keys sorted values: [blue, red, white, black, yellow] is there neatish way of doing this? i have had around, , there similar questions, seem sorting values or keys only. you can use sorted function dict.get key : sorted(your_dictionary.keys(), key=your_dictionary.get) or says in comments can use : sorted(your_dictionary, key=your_dictionary.get)

javascript - Zurb foundation equalizer resize after ajax -

i ran problem foundation equalizer, trying dynamically readjust div heights equalizer after change content ajax. searched foundation documentation, stack overflow found no answer problem. i noticed readjusts when resize browser, possible, want find out how trigger it. (i don't want tell visitors resize browser every time click link) edit: seems work, best solution? $("#media").click(function(){ $.ajax({ url: "mediaproduction.html" }) .done(function( html ) { $( "#main-content" ).html( html ); $(document).foundation(); }); }); this use on our site talking about: $(document).foundation('equalizer','reflow');

javascript - How to use a controller outside of ngApp's scope -

due structure of existing project i'm working on, i'm stuck template looks this: <div ng-app="example"> <div ng-controller="mainctrl" id="inner"> {{ inside }} </div> </div> <div ng-controller="mainctrl" id="outer"> {{ outside }} </div> #outer supposed using same controller #inner , it's located outside of ngapp 's scope, {{ outside }} not evaluated. unfortunately can't change template structure, tried compile #outer 's content this: app.run(function($rootscope, $compile){ $rootscope.$apply($compile(document.getelementbyid('outer'))($rootscope)); }); this works, controller function executed twice, not desired. there better way achieve goal? working example on plunker what instead, not define ng-app @ in html, , instead bootstrap angular via javascript. example can angular.bootstrap(document, ['example']); 'example' ang

javascript - How to get result of querySuccess in phonegap -

i need result var in javascript of querysuccess in phonegap code function querydb(tx) { tx.executesql('select * dmomm1', [], querysuccess, errorcb); } function querysuccess(tx, results) { var len = results.rows.length; console.log("demo table: " + len + " rows found."); i need 'message' var message = results.rows.item(0).data; } function errorcb(err) { alert( "error" ); } function successcb() { var db = window.opendatabase("database", "1.0", "cordova demo", 200000); db.transaction(querydb, errorcb); console.log('succescb'); } function ondeviceready() { navigator.geolocation.getcurrentposition(onsuccess, onerror); var db = window.opendatabase("database", "1.0", "cordova demo", 200000); db.transaction(successcb); console.log('odevready'); } function onsuccess(position) { $.get('http://adress.com

arrays - In python is there a range that has arguments that are two coordinates instead of integers? -

i want range go 1 coordinate in-built range function restricted integer arguments. possible? numpy provides range -like function works floats. it's called arange : >>> numpy.arange(0.1,0.5, 0.1) array([ 0.1, 0.2, 0.3, 0.4])

java - Redirecting servlet to another html page -

i have 2 html pages - 1 login , 1 takes in persons details. login page first page , when database checked username , password, user allowed enter details. sql code works perfectly, problem mapping having. using tomcat server way. or spot doing wrong? this java code logging in , entering details public class details extends httpservlet { private connection con; public void doget(httpservletrequest req, httpservletresponse res) throws servletexception, ioexception { res.setcontenttype("text/html"); //return writer printwriter out = res.getwriter(); string username = req.getparameter("username"); string password = request.getparameter("password"); out.close(); try { login(username, password); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } res.sendredirect("/redirect.html"); string name = request.getparameter("name"); string address = request.getpar

caching - Symfony 2 when clearing cache suddenly get Fatal err -

when run 'php app/console cache:clear' following fatal error: class 'doctrine\common\annotations\annotationregistry' not found in autoload.php line 13 i've done 'php composer.phar install --no-dev --optimize-autoloader' my symfony version 2.3

wix - SOURCEMGMT: Failed to resolve source MainEngineThread is returning 1612 -

there user in turkey gets following error double clicking on .msi install program: "the installation source product not available. verify source exists , can access it." he user know of having problem (of hundreds of users). believe may have corrupted environment. don't know of details, know using windows 7 , has tried manually migrate lot of data 1 user user (user d&c migrated user dc); not thing has had errors with. i had him turn on verbose logging , get. still pretty new using wix , appreciate direction on how diagnose problem or approaches try , resolve problem. or @ least, mean "failed resolve source"? === verbose logging started: 11/19/2014 1:42:26 build type: ship unicode 5.00.7601.00 calling process: c:\windows\system32\msiexec.exe === msi (c) (5c:40) [01:42:26:658]: font created. charset: req=0, ret=0, font: req=ms shell dlg, ret=ms shell dlg msi (c) (5c:40) [01:42:26:658]: font created. charset: req=0, ret=0, font: req