Posts

Showing posts from August, 2013

haskell - Implicit pattern matching the first 2 items of a list -

is there way in implicit way: (originalpath:extractpath:ignoredargs) <- getargs considering need first 2 args , ignore others anyway. this curiosity/exploring/learning question (just started haskell), ignoredargs not harm if it's left this. i tried (originalpath:extractpath) <- getargs but fails since extractpath of [string] type (instead of string ) use wildcard, _ (originalpath:extractpath:_) <- getargs to ignore after first 2 arguments. you need have there have 2 names bound string s, , wildcard pattern (underscore) way tell compiler , human readers of code not interested in further arguments.

installation - How do I force Inno Setup to make the 'uninsneveruninstall' flag retroactive? -

inno setup keeps "uninstall log" file unins000.dat in application's install directory. file contains list of files uninstalled when application removed. when new version of app installed on old one, inno setup appends new files "uninstall log". an version of application removes user-modified template files when uninstalled, because forgot include uninsneveruninstall flag files. in latest version of software, uninsneveruninstall flag set, , files don't removed....... unless latest version installed on broken version. then, because files in uninstall log without flag, removed upon uninstall! i can't ask users uninstall old software before upgrading, because lose files. can force inno setup regenerate uninstall log scratch? or @ least remove/overwrite entries these files? want uninsneveruninstall flag retroactive. you can't change flag retroactively. once it's been released, that's it. an option though be, during setup

hibernateexception - Unknown Entity using Spring and hibernate -

i struggling wit error hours now.i know simple configuration somehow not work me. here relevant portion of applicationcontext.xml :- <bean id="sessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean"> <property name="datasource"><ref local="datasource"/></property> <property name="configurationclass"> <value>org.hibernate.cfg.annotationconfiguration</value> </property> <property name="packagestoscan" value="com.xxx.pkit.entities"/> <property name="hibernateproperties"> <props> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.dialect"> org.hibernate.dialect.oracle9dialect </prop> <prop key="connection.pool_size">10<

java - Should be localization part of domain in DDD -

while following ddd concept i'm struggling on decision if should make domain localization aware? came 2 two solutions how solve this. both makes domain localization aware in different places. should place localized text domain? share solution problem or pros , cons of 2 examples. thanks. example 1 class persion { string name; // other fields ommited void rename(string newname) { string oldname = this.name; this.name = newname // publish event old name , new name } string name() { return name; } } class persionrepository { void store(persion persion) { locale loc = localecontextholder.get().getlocale(); // store object dao - create/update fields context locale } // other methods ommited } example 2 class persion { map<locale, string> name; // other fields ommited void rename(string newname) { locale locale = localecontextholder.get().getlocale(); string oldname = this.name.put(locale, newna

java - Extracting some values from a multi column text file -

lets have text file this: alaska 30-dec-11 cd station icao iata synop lat long elev m n v u c ak adak nas padk adk 70454 51 53n 176 39w 4 x t 7 ak akhiok pakh akk 56 56n 154 11w 14 x 8 ak ambler pafm afm 67 06n 157 51w 88 x 7 ak anaktuvuk pass pakp akp 68 08n 151 44w 642 x 7 i interested in saving lines start ak. in addition, need save information arrays, station name instance. for first line want store "adak nas" stationarray, "51" array, same "53", "n", "176", "39" , "w". want each line starts ak. i'm quite confused on how go this. current code pertaining follows: //process text file fileinputstream fstream = new fileinputstream("file.txt"); bufferedreader br =

gorm - Grails 2.2.1 groupProperty on Integration tests -

for reason groupproperty not working on integration tests. i'm getting following exception: groovy.lang.missingmethodexception: no signature of method: mypackage.carinttests.groupproperty() applicable argument types: (java.lang.string) values: [car] def names = ['honda', 'toyota', 'nissan'] 3.times { garage.build(name: names[it]) } def results = garage.withcriteria { car { eq('brand', 'honda') } projections { groupproperty('car') } } assert results == names[0..0]

php - Post JSON data to external URL -

how post json data url string external url (cross domains) , bypass access control? here jquery .ajax post request won't work sending external url because of access-control-allow-origin: var json = json.stringify(object); $.ajax({ type: 'post', url: externalurl, data: json, datatype: 'json', success: function(data){console.log(data);}, failure: function(errmsg) { console.log(errmsg); }, }); i have received suggestion post data same domain , 'pass on request' external domain, though solution doesn't make sense me. looking secure solution. appreciated. one way bypass same-origin policy use curl actual transmitting. i'll give example using php, on server side language. set script on server, example send.php first point ajax send.php var json = json.stringify(object); $.ajax({ type: 'post', url: send.php, data: json, datatype: 'json', success: function(data){console.log(

bash - How to sequentially execute a command on every file in a directory? -

i have directory i'm polling through cron new uploads , i'm running sequence of scripts on each upload. one part of program retrieves image web using name of uploaded file. the image saved generic name, image.png, gets sent next script more processing. only 1 image made, if there 5 newly uploaded files 1 image still gets made. how structure code/scripts full cycle of program have in 3 different scripts run on 1 file @ time, in other words loop through directory , run program on each file sequentially. i'm trying preserve structure of 1 image file being made uploads being processed. shopt -s nullglob file in /home/yt/box/moremusic/youtube/*; python /home/yt/ytimage.py $file; /home/yt/uploadyt; done; shopt -u nullglob i tried script 3 files in /home/yt/box/moremusic/youtube/ , 1 image retrieved. how can achieve goal or @ least in right path? or how can process of uploaded files

Mysql:one to many and php pagination -

here's table structure create table `cats` ( `cat_id` int(11) not null auto_increment, `cat_name` varchar(50) not null, `cat_status` tinyint(2) not null, primary key (`cat_id`), key `cat_name` (`cat_name`,`cat_status`) ) engine=myisam default charset=utf8 auto_increment=5 ; -- -- dumping data table `cats` -- insert `cats` values (1, 'news', 1); insert `cats` values (2, 'sports', 1); insert `cats` values (3, 'political', 1); insert `cats` values (4, 'computer', 1); -- -------------------------------------------------------- -- -- table structure table `posts` -- create table `posts` ( `post_id` int(11) not null auto_increment, `user_id` int(11) not null, `post_title` varchar(150) not null, `post_desc` text not null, `post_time` int(10) not null, `post_status` tinyint(1) not null, primary key (`post_id`), key `user_id` (`user_id`,`post_time`,`post_status`), fulltext key `description` (`post_desc`) ) engine=

Phrasing a long string to a 2d array PHP -

i have long string "123~456!!!789~012!!!345~678!!!901~234!!!567~890!!!1234~5678". have used types of delimiter in string ~ , !!! . can suggest me efficient way explode(split) string 2d array. example: $txt = "123~456!!!789~012!!!345~678!!!901~234!!!567~890!!!1234~5678". the 2d array after exploding/splitting. array[0][0] = 123 ; array[0][1] = 456 ; array[1][0] = 789 ; array[1][1] = 012 ; array[2][0] = 345 ; array[2][1] = 678 ; array[3][0] = 901 ; array[3][1] = 234; array[4][0] = 567 ; array[4][1] = 890; array[5][0] = 1234 ; array[5][1] = 5678; thanks. :) this takes: foreach(explode("!!!",$txt) $key => $subarray) { $array[$key] = explode("~",$subarray); } print_r($array); quick , efficient, , you'll two-dimensional array. see: http://3v4l.org/2fmdn

playframework 2.1 - Execution Exception with @inputDate when call form.get() method -

i have input of date type. attribute this: @formats.datetime(pattern="dd/mm/yyyy") public date prazo; in *.scala.html file, tried this: @helper.input(pedidoform("prazo"), '_label -> "prazo", '_help -> "") { (id, name, value, args) => <input type="date" name="@name" id="@id" maxlength="14" @tohtmlargs(args)> } and @inputdate(pedidoform("prazo"), '_label -> "prazo", '_help -> "") it compiles , seems work fine, in controller have like: form<pedido> pedidoform = form(pedido.class).bindfromrequest(); ... pedidoform.get(); // throws execution exception does have idea of can happening?? thanks attention. i think have entered wrong format date input. form have tried. if entered 22/03/1989 value of input, there no runtime exception. if entered 22 03 1989 , exception occurred. think because define prazo f

javascript - Set Selection Start and End in a Contentedible -

i attempting create javascript editor web page employs syntax-based formatting. replaces innerhtml of <pre> tag using onkeyup . however, results in caret being moved beginning of editor. solution can find offset of selection start , end before changes made, set these @ end. code getting selection start , end modified https://stackoverflow.com/a/4812022/2093695 : var selstart, selend; if (typeof window.getselection != "undefined") { var range = window.getselection().getrangeat(0); var precaretrange = range.clonerange(); precaretrange.selectnodecontents(editor); precaretrange.setend(range.endcontainer, range.endoffset); selstart = precaretrange.tostring().length; selend = selstart + range.tostring().length; } else if (typeof document.selection != "undefined" && document.selection.type != "control") { var textrange = document.selection.createrange(); var precarettextrange = document.body.createtextrange(

C# string format best overloaded method match error -

i unfamiliar c#, bear me. private static string getformattedvalue(string datatype, dynamic cellvalue) { string formattedcellvalue = string.empty; if (cellvalue == null) cellvalue = dbnull.value; if (datatype == "string") { formattedcellvalue = string.format("'{0}',", cellvalue); } else if (datatype == "number") { if (string.isnullorempty(convert.tostring(cellvalue))) cellvalue = 0; formattedcellvalue = string.format("'{0}',", cellvalue.tostring("f17")); } else if (datatype == "date") { formattedcellvalue = string.format("'{0}',", cellvalue); } else { formattedcellvalue = string.format("'{0}',", cellvalue.tostring("f17")); } return formattedcellvalue;

asp.net - Checking if an sql record exists from an aspx.vb web form -

i've been doing project in visual studio 2010 week. i'm using vb , simple sql database. i'm attempting make login page checks whether there record in customer table specified email , password. i've come point i'm out of debugging depth, can see whats causing error? the login.aspx.vb file login web form looks this: imports logintableadapters partial class login inherits system.web.ui.page dim loginadapter logintableadapter protected sub button1_click(sender object, e system.eventargs) handles button1.click dim email string dim pass string loginadapter = new logintableadapter email = textbox1.text pass = textbox2.text if me.loginadapter.querylogin(email, pass) label1.visible = true end if end sub end class the sql querylogin() looks this: select custemail, custpassword customer (custemail = @param1) , (custpassword = @param2) and error happens when entering correct user/pass combi

c - Finding directory in another directory -

i need find specific directory in different directory, reason code finds directory in current directory when start search specific named directory in parent directory, can not find there #include <dirent.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <string.h> void print_dir(char *dir_n, char *file) { dir *dir = opendir(dir_n); struct dirent *dirent; struct stat stats; while(1) { dirent = readdir( dir ); if (dirent == null) { break; } stat( dirent->d_name, &stats ); if ( s_isdir( stats.st_mode )) { if(strcmp(file ,dirent->d_name) == 0 && s_isdir( stats.st_mode ) ) { printf("found\n"); break; } } } closedir(dir); } int main(int argc, const char * argv[]) { print_dir("..", "dirtest"); return 0

button - I'm trying to read in a file on android -

i making app text of button random string, , of random strings stored in .txt file. made method return string , reason whenever run app button blank , there no text on it. know sommething file io because if method return set string "hi" text on button hi. adding oncreate method in case. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_game); string str = "hello there!"; textview text = (textview) findviewbyid(r.id.question); text.settext(execute()); } above oncreate below fileio file public static string execute() { string number[] = new string[100]; double x = math.random()*47; int random = (int) math.round(x); int act = 0; //the try/catch statement encloses code , used handle errors , exceptions might occur try { // read in file bufferedreader in = new bufferedreader(new filereader("activities")); string st

android - Progress indicator resource -

i have been searching android's resources , web unable find resource id spinning progress indicator or it's seperate components. resource(s) exist in android.r ? where? you can find here in android platform resources style , search widget.progressbar

events - Java GUI - Moving a circle with no "footprints" -

when run program , move circle, appears if i'm drawing paintbrush in paint. i'm not quite sure did make this, or can make stop. highly appreciated. here code: import java.awt.graphics; import java.awt.event.actionlistener; import java.awt.event.actionevent; import java.awt.event.keyevent; import javax.swing.jframe; import javax.swing.timer; import javax.swing.jpanel; import java.awt.event.keylistener; public class movingcar extends jpanel implements actionlistener, keylistener { timer tm = new timer(5, this); int x = 0, y = 0, velx = 0, vely = 0; public movingcar() { tm.start(); addkeylistener(this); setfocusable(true); setfocustraversalkeysenabled(false); } protected void paintcomponent (graphics g) { super.paintcomponents(g); g.drawoval(x, y, 50, 50); } public void actionperformed(actionevent e){ x = x + velx; y = y + vely; repaint(); } public void ke

linux - Why my shell script doesn't open the terminal, though it gives output log absolutely fine? -

my script contents are: #!/bin/bash path=/opt/someapp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ant -buildfile /home/kris/desktop/myproject/build.xml run if open terminal , type: bash myscript.sh , runs fine. when set cron job, doesn't open terminal. generates output log fine. want after setting cron, myscript.sh run automatically @ specific time. open terminal , run command ant -buildfile /home/kris/desktop/myproject/build.xml run contents of cron file are: * 9 5 * * /home/kris/desktop/myproject/myscript.sh > /home/kris/desktop/output/output.sh build.xml runs testng.xml , testng.xml runs scripts written in java. working on ubuntu machine.

qt5 - QML text rendering issue with custom OpenGL item active -

i've been working qmlogre qt example make work qt5 final. original example looks fine , behaves intended. code here: https://github.com/advancingu/qmlogre however found there issue when qml text item modified either through changed signals emitted c++ or simple timer in sample qml scene. example, added 10ms qml timer increments counter , assigns text item. corresponding code here: https://github.com/advancingu/qmlogre/tree/issue what happens on each frame, characters (except 1 or two) of text item randomly disappear. of them disappear changes each frame, there lot of flickering. characters show correct ones , @ correct location. my observation has been issue appears on application executions, looks threading issue (qmlengine runs 1 thread dealing qml object bindings, qml painting has own thread in ogre lives / must live). anyone have ideas on why happening or how can resolved? ogre version: 1.8.1 qt version: 5.0.1 (5.1-dev today has same issue) os/distro: ubuntu

c# - How to write data on new sheet of EXCEL -

Image
i have mysql procedure return 5 tables, need set tables single excel files 5 different sheets. using vs 2010, jquery, asp.net. how write table's in excel file on new sheet. $("#btnexcel").click(function (e) { $('#divexcelexporting').html($('#containerone').html()); $('#divexcelexporting').append($('#containertwo').html()); $('#divexcelexporting').append($('#containerthree').html()); $('#divexcelexporting').append($('#containerfour').html()); $('#divexcelexporting').append($('#containerfive').html()); var trcoll = $('#divexcelexporting').find('.border-middle1').find('tr'); $.each(trcoll, function (d, f) { $($(this).find('td')[0]).remove(); }); var trcol2 = $('#divexcelexporting').find('.border-middle2').find('tr'); $.each(trcol2, function (d, f) { $($(this).find('td')[0]).remove(); }); var trcol3 = $('

cordova - Retrieve xml data using phonegap -

i building android app using phonegap. want retrieve xml data host server android app. xml file: http://www.guitarmaddy.com/index.php?option=com_dmxmlexport&catid=8 . want tag content , display in phonegap app. previously used: $(document).ready(function(){ $.ajax({ type: "get", url: "www.guitarmaddy.com/index.php?option=com_dmxmlexport&catid=8", datatype: "xml", success: function(xml) { alert("reading xml"); } }); }); but not working.. alert message not coming.. please suggest me links, want know basics of retrieving xml data. document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { $.ajax({ type: "get", url: "www.guitarmaddy.com/index.php?option=com_dmxmlexport&catid=8", datatype: "xml", success: function(xml) { alert("reading xml"); } }); } does

iphone - Detect UIImageView click in UITableViewCell -

i have make call specific number when imageview clicked in tableviewcell.the number call made displayed in label beside imageview.but couldn't cell clicked.always referring last cell. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { if(cell == nil) { cell =[[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; lblphone = [[uilabel alloc] initwithframe:cgrectzero]; lblphone.tag = 116; lblphone.backgroundcolor = [uicolor clearcolor]; [lblphone setfont:[uifont fontwithname:@"helvetica" size:12]]; [lblphone setlinebreakmode:uilinebreakmodewordwrap]; [lblphone setuserinteractionenabled:yes]; uitapgesturerecognizer *tapgesturerecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(labelbutton:)]; tapgesturerecognizer.cancelstouchesinview=no; [tapgesturerecog

Resize Image and Maintain Aspect Ratio -

Image
given height , width. how can resize image contain maximum holder image maintaining aspect ratio? use mathmatics this help

c# - How to select a value from CSV in an asp.net ajax toolbox autocomplete and pass that value to other textbox? -

i have used ajax toolkit autocomplete working fine using following asp.net , c# code. <asp:updatepanel id="updpnlmedicinename" runat="server" > <contenttemplate> name<br /> <asp:textbox id="txtmedname" runat="server" width="150px" ontextchanged="txtmedname_textchanged"></textbox> <cc1:autocompleteextender id="txtsearchid_autocompleteextender" runat="server" delimitercharacters="" onclientitemselected="itemselected" enabled="true" getmedicine" servicepath="search/namesearch.asmx" targetcontrolid="txtmedname" minimumprefixlength="1"> </cc1:autocompleteextender> my code behind : [webmethod] public string[] getmedicine(string prefixtext) { list<string> liststring = new list<string>(); using (sqlconnection con = new sqlcon

How to reset form body in bootstrap modal box? -

i finding way empty form when opening bootstrap modalbox without refresing page. problem when user enters data submit form , open modalbox again shows previous given data :. how can compeletly refresh form onclose modelbox ???? in bootstrap 3 can reset form after modal window has been closed follows: $('.modal').on('hidden.bs.modal', function(){ $(this).find('form')[0].reset(); });

ios - OSStatus-43 Error -

i keeping recorded audio file reference in sqlite database. when fetching data , trying play find error osstatus-43. if there solution? i ran error -43 when trying play remote mp3 file on http. got around using avplayer instead of avaudioplayer .

Android getLastKnownLocation does not report good precise result compared with Google maps app -

i in trouble using locationmanager in android. locations locationprovider's getlastknownlocation not enough in accuracy. in phone, galaxy s3, 'network' , 'passive' give me locations when use getlastknownlocation method of locationprovider. 'gps' disabled in phone. locations are.. network --> latitude : xx.5511981, longitude : xxx.1284714 passive --> latitude : xx.5511981, longitude : xxx.1284714 both give me same location information. location wrong. 50km wrong location. in time, run google maps app in phone, reports precise location point. how can google maps app obtain higher precise location information app does? ps. registered locationlistners every location provides '0' mintime , '0' mindistance. phone never reports location changes in several 10 minutes. think behavior acceptable because phone stayed in desk duration. condition same google maps app. reports phone's location still. update. tested code in galaxy s2

ajax - Javascript requests -

i have 2 checkboxes on selection of each 1 raise ajax request in order response server. need call method once when there atleast 2 seconds gap after last request made. idea? means not want call methods when checkboxes clicked continously less 2 seconds gap. how can cancel request made if time gap between requests in less 2 seconds. note want method fired once after last request not followed other requests 2 seconds. var timeout; cleartimeout(timeout); timeout = settimeout(function () { // call method }, 2000); note wan excecute method once last request made. you don't show code, assuming have function doajax() ajax request, can ensure isn't called until 2 seconds after last click in 2 second period using settimeout() function this: var timerid; document.getelementbyid("yourcheckboxidhere").onclick = function() { cleartimeout(timerid); timerid = settimeout(doajax, 2000); }; note doajax not have parentheses after when passed par

Communicating with Android TaskManager -

i have non responsive app on android need kill , let user start manually. if use killbackgroundtask in android restarts task. is there way direct builtin task manager kill task (using package name)? try code android.os.process.killprocess(android.os.process.mypid());

Chef's install error -

i got error while debugging chef-solo. i can see same kind of problem ....in 'from_file when install nginx via chef-recipes. have downloaded , installed epel-release-5-4.noarch.rpm , have created /etc/yum.repos.d/epel.repo . what shall this? * package[vim] action install * no version specified, , no candidate version available vim ================================================================================ error executing action `install` on resource 'package[vim]' ================================================================================ chef::exceptions::package ------------------------- no version specified, , no candidate version available vim resource declaration: --------------------- # in /root/development/chef-repo/site-cookbooks/vim/recipes/default.rb 9: package "vim" 10: action :install 11: end 12: compiled resource: ------------------ # declared in /root/development/chef-repo/site-cookbooks/vim/recipes/default.rb:9:in

perl - Retrieving array from array of arrays? -

use strict; @a; @b = (); @a = (3, 4); push @b, [@a]; @c = @b[0]; print @c; how retrieve @c? tells me scalar value @b[0] better written $b[0]. (this isn't real code privacy reasons, in real code have this: my @a = @{$b[$i]}; print @a; this says "use of uninitialized value," still prints it's supposed to. if have array reference stored in $b[0] - situation - retrieve $ref = $b[0] # want reference or @arr = @{$b[0]} # want (new) array or $elt = $b[0][1] # want directly access second element $elt = $b[0]->[1] # alternative syntax, same thing.

sql server 2005 - Change primary key to a nullable column without losing data -

i have table in have data. i have primary key on column, want change column rencently added. added column nullable, updated able make not null. i used alter table mytable modify termdefid int not null but receive error incorrect syntax near 'modify'. after want (after drop current pk, of course) : alter table [dbo].[mytable] add constraint [pk_mytable] primary key clustered ( [termdefid] asc )with (pad_index = off, statistics_norecompute = off, sort_in_tempdb = off, ignore_dup_key = off, online = off, allow_row_locks = on, allow_page_locks = on, fillfactor = 90) on [primary] go i not able make new column not null . problem. how can this? i use sql server 2005, maybe problem! in sql server, primary key column(s) cannot nullable also: alter table command invalid sql server - should be: alter table mytable alter column termdefid int not null but again: if column part of primary key, it cannot nullable . see relevant msdn docum

c# - Gridview remove selected row -

Image
i want remove selected gridview row when updating don't know how it. my update code: //update selected assignment protected void buttonupdateassignmentclick(object sender, eventargs e) { try { using (var db = new knowitcvdbentities()) { spweb thesite = spcontrol.getcontextweb(context); spuser theuser = thesite.currentuser; string strusername = theuser.loginname; var theemplassignment = ( p in db.employees p.username == strusername select p).firstordefault(); _emp = theemplassignment; if (_emp != null) { int assignmentid = convert.toint32(hiddenfield_assignment_id.value);

Apply a property sheet to empty C++ visual studio project -

Image
i have created empty visual c++ project , add single main.cpp like: #include <mylib.h> int main() { abc(); return 0; } where abc() function in mylib say. use mylib following settings need pointing right locations. configaration setting -> vc++ directories -> executable directories configaration setting -> vc++ directories -> include directories configaration setting -> vc++ directories -> library directories configaration setting -> linker -> input -> additional dependencies this tedious multiple projects i'd set property sheet these settings. when add property sheet project following xml stub generated: <?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <importgroup label="propertysheets" /> <propertygroup label="usermacros" /> <propertygroup />

python - Numpy array creation -

first off apologize arbitraryness of question rewriting of scripts use numpy arrays instead of nested python lists (for performance , memory) i'm still struggling declaration. i trying create structure using numpy arrays, starting off 1000 (arbitrary value) elements in array each element should contain float (as [x][0]) , nested array containing coordinates (so 10.0000 x 2 floats per top level element) (as [x][1], each element in nested array accessible [x][1][y][z] y element in nested array , z specified of 2 coordinates). following question nested structured numpy array creates nigh identical structure (as reference question , desired structure). schematic raw data example: time 0 m/z 10 int 10 m/z 20 int 20 m/z 30 int 1000 ... time 1 <repeat> i have read haveto use dtype part define nested array not quite sure on declaration part of dimensions empty array, give me hand? here came far. data=np.zeroes((1000,2 /* add nested array */), dtype=[('tim

sharepoint 2010 - Adjust picture size in picturelibrary webpart (ootb) -

i have picture library webpart when adding picture library webpart home page more attractive size of picture inside webpart small. want display webpart big pictures please give sugessions in ootb .externalclass237f341fae1f4564b3e1b16d76a5e0ca .ms-wpbody td { border-left-width: 0px; height: auto !important; border-right-width: 0px; vertical-align: middle; border-bottom-width: 0px; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px; border-top-width: 0px; width: auto !important } .externalclass237f341fae1f4564b3e1b16d76a5e0ca .ms-wpbody td div { border-left-width: 0px; height: auto !important; border-right-width: 0px; vertical-align: middle; border-bottom-width: 0px; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px; border-top-width: 0px; width: 100% !important } .externalclass237f341fae1f4564b3e1b16d76a5e0ca .ms-wpbody td img { border-left-width: 0px; height: 190px !important; border-right-

Google Chrome can't run in xvfb because extension "RANDR" missing -

i try run google chrome on xvfb display, google show error randr extension. problem added randr xvfb , loaded it. steps are: run xvfb server using command: xvfb :1 -screen 0 1280x1024x24 +extension randr this command give me output loaded rand module initializing built-in extension generic event extension initializing built-in extension shape initializing built-in extension mit-shm initializing built-in extension xinputextension initializing built-in extension xtest initializing built-in extension big-requests initializing built-in extension sync initializing built-in extension xkeyboard initializing built-in extension xc-misc initializing built-in extension security initializing built-in extension xinerama initializing built-in extension xfixes initializing built-in extension render initializing built-in extension randr initializing built-in extension composite initializing built-in extension damage initializing built-in extension mit-screen-saver initiali

css - jQuery custom theme? -

i have 2 jquery themes. custom theme , theme scope sidebar. need mix both themes in sidebar? for example: <div class="sidebar"> <div id="accordionwidget"> <div id="datepicker"> </div> </div> </div> the accordion widget , datepicker both using theme scope sidebar. use custom-theme datepicker. do need copy custom theme , scope datepicker? if do, double css files. or can add class datepicker override scope sidebar? this not practice, in times ok use !important in css. using !important override preexisting styles. example: html: <p class="blue"> </p> css: p.blue{ color: yellow; /* overridden */ } .blue{ color: blue !important; } you can read more on using !important here

hex - Breaking Hexadecimal Value to multiple lines in CoffeeScript -

how break long hexadecimal value in coffeescript spans multiple lines? authkey = 0xe6b86ae8bdf696009c90e0e650a92c63d52a4b3232cca36e0ff2f5911e93bd0067df904dc21ba87d29c32bf17dc88da3cc20ba65c6c63f21eaab5bdb29036b83 to like authkey = 0xe6b86ae8bdf696009c90e0e650a92c63d52a4b323\ 2cca36e0ff2f5911e93bd0067df904dc21ba87d29c3\ 2bf17dc88da3cc20ba65c6c63f21eaab5bdb29036b83 using \ results in unexpected 'number' error, using line break in unexpected 'indent' error there's no point in doing in coffeescript because numbers stored 64-bit ieee 754 values , have many bits of precision value stored number. if write authkey = 0xe6b86ae8bdf696009c90e0e650a92c63d52a4b3232cca36e0ff2f5911e93bd0067df904dc21ba87d29c32bf17dc88da3cc20ba65c6c63f21eaab5bdb29036b83 console.log(authkey) then value logged is 1.2083806867379407e+154 you want store authkey string or byte array, both of trivial write across multiple lines.

android - Disable my-location when user moves the map and re-enable when he press the my-location button -

i'm using setmylocationenabled(true) google maps android api v2 have auto location tracking , display indicator google maps app. need camera position follows my-location indicator visible, except when user pans map. so, i'm using onmylocationchange method move camera new location, when user pans map or use search field app, onmylocationchange continues being called , camera comes my-location coordinates. how can move camera automatically when my-location enabled, disable when map manually manipulated (pan, rotate or search) , enable when user press my-location button? thanks. edit: there googlemap.setonmylocationbuttonclicklistener , can skip point 1 , use that. you can't february version of maps api v2. best thing can to: have own "go location" button know when want start tracking your own location change listener a view on top of supportmapfragment ontouchlistener (returning false !) know when need stop tracking this solut

Too many CSRF tokens generated (PHP), how do I deal with them? -

i run problem. following owasp cheatsheet, implemented one-time-use csrf token system in php (basically copy&paste owasp). each form or link (link generate action) create own csrf token, once it's used, deleted. application website, multiples tabs opened @ same time. the problem each time load page, create new csrf token (even if hit reload , not send form). example, in admin panel, there's list of items, each item deleted link have csrf token (same csrf token links), if reload page, new csrf generated. at end of day, ended more un-used tokens wanted to. problem in servers. tldr; generate token per request. deleted used token (except ajax request tokens, after hour delete then). problem unused tokens, @ end of day, there're many of them. there no (practical) way of knowing if user still use token or not. thus, have automatically delete (and invalidate) them after x hours, example using cronjob. just suggestion: sure need one-time tokens? owasp not a

forms - passing password value from view to snippet in lift framework -

i trying create login page in lift framework. have view (a form) , snippet process that. couldn't pass password value view snippet. following code have. view: <div> <form class="lift:onsubmit?form=post"> user name: <input name="name"><br> password: <input type="password" name="pass"><br> <input type="submit" value="submit"> </form> </div> and snippet is: object onsubmit { def render = { var name = "" var pass:any = "" def process() { //here performing db actions using normal jdbc s.notice("pass: "+pass) //here password value couldn't s.redirectto("/") } "name=name" #> shtml.onsubmit(name = _) & // set name "name=pass" #> shtml.onsubmit(s => asint(s).foreach(pass = _)) & "type=submit"

wordpress plugin - Paypal subscribe button charged on the first day of every month -

i new programming , creating paypal payment buttons in want use subscribe button plan. i have service sell monthly 2,500jpy , want charge on first day of every month. and if customers buy service in middle of month, want charge day. for example, if on april 5th, pay 2,166jpy (2,500 divided 30days, multiplied 26 days) on april 5th. , pay 2,500jpy on first day of every month. any subsequent appreciated. thanks in advance. you have use non hosted clear text paypal button way allow dynamically modify variables. have build in logic code correctly calculate billing terms , amount, , have dynamically populate variables in subscription buttons.

Split string based on Roman Numerals C# -

i want find roman numbers inside string (numbers below 20 enough) , split string based on roman numbers eg:user input : whats name?i)my name c# ii)my name ror iii)my name java i want whats name? i)my name c# ii)my name ror iii)my name java edit:this format optional questions..so options wont go no more 5 or 6.. this code: string input = "i. text. ii. text... v. stupid text. xvii. eshe kakaya-to hernya..."; regex r = new regex(@"\bx{0,3}(i{1,3}|i[vx]|vi{0,3})\b", regexoptions.ignorecase); string result = r.replace(input, new matchevaluator(e => environment.newline + e.value)).trim(); result: i. text. ii. text... v. stupid text. xvii. eshe kakaya-to hernya...

php - I'm creating a module (MOD) for joomla 3.0: how can i put a button in it? -

i'm working on joomba module (actually i'm on 3.0 release question previous version). the module display grid of data, coming mysql database. i want give user chance paginate data, may 10 rows @ time. how can do? joomla launches module php file, , inside not possibile manage buttons or other funcions, work javascript how can do? thank suggetion , teaching me.

javascript - set custom JSON object names in a for loop -

how set custom json object name in loop. var myarray = []; (var = 0; i<= 8; i++){ var x = "name" + i; myarray.push({x:[0,0,0]}); } i want this myarray = [ {name0:[0,0,0]}, {name1:[0,0,0]}, {name2:[0,0,0]}, {name3:[0,0,0]}, {name4:[0,0,0]}, {name5:[0,0,0]}, {name6:[0,0,0]}, {name7:[0,0,0]}, {name8:[0,0,0]}, ]; but returns this myarray = [ {x:[0,0,0]}, {x:[0,0,0]}, {x:[0,0,0]}, {x:[0,0,0]}, {x:[0,0,0]}, {x:[0,0,0]}, {x:[0,0,0]}, {x:[0,0,0]}, {x:[0,0,0]}, ]; bracket notation: for (var = 0; i<= 8; i++){ var obj = {}; obj['name'+ i] = [0,0,0]; myarray.push(obj); }

How to call the object method (not class method) using reflection in scala -

this question has answer here: how call scala object method using reflection? 3 answers i'd call object main method using reflection in scala. did not works, following 2 lines of code through exception not create object using reflection. val clazz = class.forname(job.runnerclass) val runnerclass = clazz.newinstance() first have use $ @ end of class name, because scala objects end $. can find object instance in field called module$ val class = class.forname(name) val objectinstance = class.getfield("module$").get(class).asinstanceof[yourclasstype]

gradient - CSS background-image not working - not showing -

my css: background-image: url(/images/framework/arrow-down-small.png) no-repeat center; /* fallback */ background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ccc)); /* saf4+, chrome */ background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -webkit-linear-gradient(top, #eee, #ccc); /* chrome 10+, saf5.1+ */ background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -moz-linear-gradient(top, #eee, #ccc); /* ff3.6+ */ background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -ms-linear-gradient(top, #eee, #ccc); /* ie10 */ background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -o-linear-gradient(top, #eee, #ccc); /* opera 11.10+ */ background-image: url(/images/framework/arrow-down-small.png) no-re