Posts

Showing posts from April, 2012

c++ - Why does MPI_Send accept void * source? -

i wondering why signature of mpi_send below: int mpi_send(void *buf, int count, mpi_datatype datatype, int dest, int tag, mpi_comm comm) the first parameter of type void * . why first parameter of type void * rather const void * . mpi_send modify source? i ask such kind of question because use mpi c++ , pass message.c_str() mpi_send function message of type std::string . in way, compiler complains. will mpi_send modify source? no, won't. my question why first parameter of type void * rather const void *. bad design. the first versions of mpi released after c has been standardized in 1989 , const available standard. a proposal add missing const mpi_send , other mpi functions submitted , accepted future mpi-3. https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/140

windows - Issue with starting as network service -

i have app trying start network service.. this how it: sc create "app" binpath= "app path" obj= .\networkservice password= "" but keep getting error - "the account name invalid or not exist, or password invalid account name specified." any pointers on wrong... the problem network service account must specified "nt authority\networkservice" , no password needed. is, use command: sc create "app" binpath= "app path" obj= "nt authority\networkservice"

Sphinx: Make classes appear on TOC -

i'm starting document few python classes using ext.autodoc. have several *.rst files content such as ======== mymodule ======== .. automodule:: mymodule .. autoclass:: myclassa :members: .. autoclass:: myclassb :members: plus index.rst: .. toctree:: :maxdepth: 2 mymodule 'mymodule' shown in table of contents, i'd see classes in toc too: mymodule myclassa myclassb how can make sphinx create section each class? or there reason not so? thanks sphinx cannot create sections. you'll have add them in .rst file. this: myclassa -------- .. autoclass:: myclassa :members: myclassb -------- .. autoclass:: myclassb :members: for alternative suggestions might interesting, see these questions (and answers): sphinx customizing autoclass output sorting display class using sphinx 'autodoc'?

java - Generate report with specific date -

i'm generate report using ireport 4.7.0 i want generate report searching between 2 day,example : when when. and code: java.util.date utilstartdate = date1.getdate(); java.sql.date start = new java.sql.date(utilstartdate.gettime()); java.util.date utilstartdate2 = date2.getdate(); java.sql.date end = new java.sql.date(utilstartdate2.gettime()); try { jasperdesign jd = jrxmlloader.load("c:\\users\\admin\\desktop\\sales report.jrxml"); string sql = "select * order1 order_date between "+start+" , "+end+""; jrdesignquery newquery = new jrdesignquery(); newquery.settext(sql); jd.setquery(newquery); jasperreport jr = jaspercompilemanager.compilereport(jd); jasperprint jp = jasperfillmanager.fillreport(jr,null,conn); jasperviewer.viewreport(jp,false); } catch(exception e) { joptionpane.showmessagedialog(null,e.getmessage()); i have error document have no pages. this first time doing because generat

perl - How to programmatically know if a module is a Core module? -

i've got list of modules used in application. test if these modules part of perl core (if need installed during application deployment on fresh server environment). is module::corelist module appropriate tool test , if not, how should deal this? the following tell if module core module version of perl being used. use module::corelist qw( ); if (exists $module::corelist::version{ $] }{'cgi'}) { print "yes\n"; } else { print "no\n"; } note work "main" module of distribution.

Java 7 method not found in Android environment - BitSet -

this question has answer here: does adt support java 7 api [closed] 2 answers i developer new android en eclipse (not java), using latest adt , java se 7u25. using bitset while working in android environment. in java 7 there tobytearray method ( tobytearray - java 7 doc ). method not found (build error). referring android reference ( bitset - android doc ), can note method not included. seems same other methods of bitset new in java 7. the question: possible use new method in android environment? thank in advance android runs class library (largely) compatible java 6. classes , methods introduced in java 7 not available @ present time.

debugging - J2EE Java server side error debug interview -

in recent job interview asked j2ee debugging question. question follows: "you not getting same data expected server how debug it?" what or how should answered question make interviewer happy?? please suggest.... on top of head, would check request , compare api - request being done correctly check logs problems on server confirm version of server application matches 1 expected check database data status if else fails, try reproduce problem locally or in lower environment or step through server app execution path debugger. increasing log level or hooking debug interface might relevant well.

c - K&R Exercise Squeeze function -

this question has answer here: how complete k&r exercise 2-4? 5 answers so exercise here design program takes string , removes characters in string appear in second string. strings i've chosen below first string abc , second string cde want output of ab rather abc . i've seen neat way squeeze function requires 2 simple loops wondering why long winded way doesn't work. #include<stdio.h> void squeeze(char s1[], char s2[]); void copy(char to[], char from[]); int k=0; main() { char array1[4]="abc"; char array2[4]="cde"; squeeze(array1, array2); printf("%s", array1); } void squeeze(char s1[], char s2[]) { int j,i,m; m=j=i=0; char s3[1000]; while(s1[i]!='\0') //what i'm doing here taking character in string { //and comparing characters in seco

algorithm - How do I get a 3D cross section of a 4D mesh? -

i have polychoron represented four-dimensional mesh, stored face-vertex method. faces triangles. how can three-dimensional cross-section of figure? the closest thing i've found this question , it's 1 dimension short. working 4 dimensions bit difficult. the way solve problem finding dimensional analogies. let's start 2d a convex 2d polygon has convex 1d sides: line segments. the cross-section of filled convex polygon line segment. calculate intersection points of poligons edges intersecting line, you'll 2 intersections convex polygon, , cross section line segment. to transform coordinates cross section on y axis of coordinate system. 2 points of edge , b. coordinates a1, a2 , b1, b2. if signs of a1 , b1 same, (aka a1*b1 > 0) edge won't intersect y axis. otherwise calculate k = a1/(a1-b1). then coordinate of intersection point be: (0; (1-k)*a2+k*b2) as said convex polygons you'll 2 intersection points, connect 2 point 1d cros

r - How do I calculate a percent change of a zoo object using sapply? -

i have list of zoo objects. core data adjusted close of several stock symbols, monthly data. each list object separate time series each ticker. i'd calculate monthly change each month, in each object. if helps, here's gets me desired calculation: path = 'c:/sectorrotationsymblist072013.csv' symbs = read.csv(path, header = false, stringsasfactors = false) symbs = symbs[, 1] importdata = vector('list', length(symbs)) #get monthly pricing data. (sidx in 1:length(symbs)){ #import data each symbol list. importdata[[sidx]] = get.hist.quote(instrument= symbs[sidx], start="2000-01-01", end="2013-07-15", quote="adjclose", provider="yahoo", origin="1970-01-01", compression="m", retclass="zoo") } names(importdata) = symbs i can month on month change each object using sapply follows: monthlygainslosses = sapply(importdata, diff) i want relative change, though

php form on the fly calculated field -

wondering if can help? i working on script allows introducing 3 fields quantity, price, discount (%), , display , store automatic calculated field (total) executing operation: quantity * price - discount(%) = total may me code operations in order display (not store) total? thank in advance, pere this code: ---dbase connect [php]if($_post["do"]=="store") { $prod_nombreproducto=$_post["prod_nombreproducto"]; $prod_cantidad=$_post["prod_cantidad"]; $prod_preciounitario=$_post["prod_preciounitario"]; $prod_descuento=$_post["prod_descuento"]; $prod_totalproducto=$_post["prod_totalproducto"];[/php] [php]$query="insert pm_productos value('$prod_nombreproducto','$prod_cantidad', '$prod_preciounitario','$prod_descuento','$prod_totalproducto')";[/php] quantity: <input type="text" name="prod_cantidad" size="20"> price: &l

javascript - Three.js - Wrong Bounding Box importing Blender JSON model -

Image
i having problems manipulating objects load blender. think pivot point set 0,0,0 instead of current object's position. correctly position , import objects in blender scene, have problems rotating them. i have used boundingboxhelper see happening, bounding box not appearing surrounding object centered in world , 1-unit size (i guess default) this code use load alien: texture6 = three.imageutils.loadtexture('images/alien1.png', {}, function() { renderer.render(scene, camera); }); loader = new three.jsonloader(); loader.load( "models/alien1.js", function( geometry ) { geometry.computefacenormals(); geometry.computecentroids(); geometry.computeboundingbox(); var mat = new three.meshbasicmaterial({map: texture6,transparent: true, color:0x00ff00} ); var mesh = new three.mesh( geometry, mat ); scene.add(mesh); bbhelper = new three.boundingboxhelper( mesh, 0xff0000 ); scene.ad

regex - Regular expressions for getting all kinds of tokens including hyphens -

i want split sentence words , special characters. using regular expression below: @"((\b[^\s]+\b)((?<=\.\w).)?) but returns words , not special characters such space-separated hyphens or colons. ideally, sentence: "right now!" shouted, , hands fluttered in air - amid few cheers - 2 minutes. i should get: right shouted , hands fluttered in air - amid few cheers - 2 minutes sounds this regex you're looking for: @"\b\s?([a-za-z-]+)\s?\b" seems bit simple regex you've been trying though! there more perhaps?

how to use spring data mongodb repository query annotation for updating -

i using mongodb java application , trying use spring data repository update document. use @query annotation this: @query("{ 'username' : ?0 }, { $set : { 'age' : ?1}}") void updateagebyusername(string username, int age); but doesn't work. know save update whole thing want update age field using update query. how can this? appreciate help. spring-data framework general purpose provides basic support crud operations. if need complex operations, update using $operator , you'll need implement custom repository it.

rest - Open protobuf service -

do know of robust, free, ideally open source, web service uses protobuf. i maintain android library networking , write samples every module. instance, json modules use github apis data network , illustrate client library usage. do know equivalent protobuf ? thanks in advance. your protobuf module use api access android market place: https://code.google.com/p/android-market-api/

GWT: celltable column header's tooltip not appearing correctly -

Image
i using tool tip gwt celltable column headers . the problem can see first work of tooltip , not second word after space, example if in tool tip write "hello world" it appears "hello" the word after space not appearing .. thats code using celltable.addcolumn(mycolumn, safehtmlutils.fromsafeconstant("<span title="+"heloo world"+">"+constants.xvd+"</span>")); so in case tool tip says"heloo" instead of "hello world" as can see in attached image maybe like: "<span title=\"heloo world\">"+constants.xvd+"</span>" will work ? (escaping ")

sql - MySQL merge results into table from count of 2 other tables, matching ids -

i've got 3 tables: model, model_views, , model_views2. in effort have 1 column per row hold aggregated views, i've done migration make model this, new column views: +---------------+---------------+------+-----+---------+----------------+ | field | type | null | key | default | | +---------------+---------------+------+-----+---------+----------------+ | id | int(11) | no | pri | null | auto_increment | | user_id | int(11) | no | | null | | | [...] | | | | | | | views | int(20) | yes | | 0 | | +---------------+---------------+------+-----+---------+----------------+ this columns model_views , model_views2 like: +------------+------------------+------+-----+---------+----------------+ | field | type | null | key | default | | +------------+------------------+------+---

time series - R growth rate calculation week over week on daily timeseries data -

i'm trying calculate w/w growth rates entirely in r. use excel, or preprocess ruby, that's not point. data.frame example date gpv type 1 2013-04-01 12900 office 2 2013-04-02 16232 office 3 2013-04-03 10035 office i want factored 'type' , need wrap date type column weeks. , calculate week on week growth. i think need ddply group week - custom function determines if date in given week or not? then, after that, use diff , find growth b/w weeks divided previous week. then i'll plot week/week growths, or use data.frame export it. this closed had same useful ideas. update: answer ggplot: all same below, use instead of plot ggplot(data.frame(week=seq(length(gr)), gr), aes(x=week,y=gr*100)) + geom_point() + geom_smooth(method='loess') + coord_cartesian(xlim = c(.95, 10.05)) + scale_x_discrete() + ggtitle('week on week growth rate, apr 1') + ylab('growth rate %') (old, correct answer using plot) w

login - Amazon in-app purchasing on iOS -

i'm building small app users can browse cheap accessories lipstick, nail polish, etc. have login amazon ( http://login.amazon.com/ ) implemented because thought allow users buy accessories directly app. but realized apple has restricted functionality. purchase ability available on android , web developers, unfortunately not yet ios. is there hacky way can allow users make purchase app (or web view in app)? have little bit of experience python i'm guessing there might way write script presses different buttons on amazon web page in web view in app. user logged in amazon. you can use shopelia sdk enables in-app purchase of physical goods using 1 click payment. available amazon kind of retailers. it works using combinaison of automation , monetics inject order , process payment. right (october 2013), product in beta stage , can demonstrated on shopelia website http://www.shopelia.com integration available through sdk android , ios. disclaimer : i'm co-

python - How to generate the Present Continuous Tense - The ING Form Of The Verbs? -

i wan to 'ing' form of verb. currently using method depends on nodebox english linguistics library . , code fails in cases. from libs.en import * def get_contineous_tense(i_verb): i_verb = verb.infinitive(i_verb) #make sure verb in infinfinitive form temp = i_verb + 'ing' if verb.infinitive(temp) == i_verb: return temp temp = i_verb + i_verb[-1:] + 'ing' if verb.infinitive(temp) == i_verb: return temp #......... continues print get_contineous_tense('played') verb.present_participle(word) this functionality comes nodebox english linguistics, documented right in link gave.

perl - How to print all lines except the line before a pattern in file using awk -

how can awk? input file line 1 line 2 ####pattern####### (line 3) line 4 line 5 line 6 ####pattern####### (line 7) line 8 ####pattern####### (line 9) etc.. output file line 1 line 3 line 4 line 5 line 7 line 9 here 1 way awk : awk '/pattern/{for(;i<nr-2;)print lines[++i];i=nr;delete lines;print $0}{lines[nr]=$0}' file output: $ cat file line 1 line 2 ####pattern####### (line 3) line 4 line 5 line 6 ####pattern####### (line 7) line 8 ####pattern####### (line 9) $ awk '/pattern/{for(;i<nr-2;)print lines[++i];i=nr;delete lines;print $0}{lines[nr]=$0}' file line 1 ####pattern####### (line 3) line 4 line 5 ####pattern####### (line 7) ####pattern####### (line 9)

c# - Get Gridview RowIndex outside of the gridview -

my button1 inside panel, want access rowindex hide imagebutton. when enter debug mode, gridview1.selectedindex has null value. pleaase help! protected void button1_click1(object sender, eventargs e) { foreach (gridviewrow row in gridview1.rows) { if (row.rowtype == datacontrolrowtype.datarow) { if (row.rowindex == convert.toint32(gridview1.selectedindex)) { imagebutton stopbutton = (imagebutton)row.findcontrol("stopimagebutton"); imagebutton startbutton = (imagebutton)row.findcontrol("startimagebutton"); stopbutton.visible = true; startbutton.visible = false; } } } this.stoptimenotespanel_modalpopupextender.hide(); } you said button inside panel. able handle gridview events effectively, use button inside gridview itself. or if still wa

mongodb - Is there a way to get a GUI representation of Mini Mongo? -

i'm learning meteor @ moment. impressed vision of framework. meteor retains data on client side "mini mongo" ( http://www.quora.com/meteor-web-framework/how-does-meteors-minimongo-work ) - in browser version of mongo db. i've connected robomongo server side db surf gui, , wondering if there way gui representation of mini mongo. chrome dev tools hack perhaps? there meteorite package developed in 1 of summer hackathons . https://atmosphere.meteor.com/package/z-mongo-admin https://github.com/gterrono/meteor-admin-ui it in raw state, should enough if using learning.

sql - Form-driven query in MS Access using comma separated values as input? Is it possible? -

i have queried data data in access based on value passed single text box on form, there way pass comma-delimited list in query, or effect? the goal search on more single-value criteria. you need dynamically create sql in code, feed resultant query row source parameter.

algorithm - Java Programming : Dynamic Programming on stairs example -

a man running staircase n steps, , can go either 1 steps, 2 steps, or 3 steps @ time. write program count how many possible ways child can run stairs. the code given below public static int countdp(int n, int[] map) { if (n<0) return 0; else if (n==0) return 1; else if (map[n]>-1) return map[n]; else { map[n] = countdp(n-1, map) + countdp(n-2, map) + countdp(n-3, map); return map[n]; } } i know c , c++, not java. cracking coding interview book. can explain why , how employs function map here? map here array right? i not see line save input map array how return something? anybody has idea of c++ or c version of code? hard understand code. maybe not because of java grammar, implicit structure of dynamic programming. what time complexity of algorithm? should smaller o(3^n) ? i appreciate it. thanks, guys okay, here code does. `if (n<0)` `return 0;` if there aren't enough steps remaining, don't count it. instance

Finding Acronyms Using Regex In Python -

i'm trying use regex in python match acronyms separated periods. have following code: import re test_string = "u.s.a." pattern = r'([a-z]\.)+' print re.findall(pattern, test_string) the result of is: ['a.'] i'm confused why result. know + greedy, why first occurrences of [a-z]\. ignored? the (...) in regex creates group. suggest changing to: pattern = r'(?:[a-z]\.)+'

javascript - Bootstrap carousel: changing jquery slides to bootstrap caroulsel and binding a slide function -

i started applying bootstrap on site. need change following script work on bootstrap carousel $(function(){ // set starting slide 1 var startslide = 1; // slide number if exists if (window.location.hash) { alert('hash'+window.location.hash); startslide = window.location.hash.replace('#',''); alert('startslide'+startslide); } // initialize slides $('#slides2').slides({ preload: true, preloadimage: 'img/loading.gif', generatepagination: true, play: 0, pause: 2500, hoverpause: true, currentclass: 'current', // starting slide start: {$startnumb}, animationcomplete: function(current){ // set slide number hash

hibernate - Spring + ehcache + bigmemory go integration -

i integrating spring3.2 + ehcache + bigmemory go. firstly, not undertand term "save bigmemory go license-key file bigmemory go home directory." bigmemory go home directory in java web application deployed on glassfish. request help. secondly, error: nested exception net.sf.ehcache.cacheexception: cannot instantiate enterprise features manager following files; <bean id="ehcachemanager" class="org.springframework.cache.ehcache.ehcachemanagerfactorybean"> <property name="configlocation" value="/web-inf/ehcache.xml" /> <property name="shared" value="true" /> </bean> code: <ehcache xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="http://ehcache.org/ehcache.xsd" name="mybigmemorygoconfig"> <diskstore path="c:/bigmemorygo"/> <cache name="cache_gen" m

Azure site to use as technical repository -

do have azure based site share technical knowledge team. interact colleagues. or have ready made site can customize? i'm going make big assumption understand question is. assuming looking type of collaborative website engine can deployed within windows azure, purpose of collaboration amongst peers: if create new windows azure web site , @ gallery, you'll see several ready-made options such mediawiki, phpbb, dotnetnuke, joomla, kentico, lemoon, mojoportal, orchard, umbraco, , wordpress. i'm guessing @ least 1 of these build collaborative knowledge site team. per comment (which makes me think assumed correctly): here's starter info on web sites, azure portal. should download training kit , linked azure portal.

java - Fibonacci Series generation using Matrices -

there's 1 question posted fibonacci series , familiar it. there multiple answers , linked questions it. digging through interest, there's solution linked here this algorithm solves problem o(log(n)) quite impressive. couldn't understand logic , called matrix exponentiation [looked wiki, unable relate it]. so kindly can explain how achieved more details , better explanation [if can explain code, prefer in java, helpful]. thanks :) what need understand algorithm, not implementation. the first thing need understand algorithm not give fibonacci numbers, with n power of 2. the second thing multiplication of sized matrices of course takes constant ( o(1) ) time. the trick correctly note n'th fibonacci number can formed n-times multiplication of matrix described in link, call m . you log complexity "reordering" matrix operations from, example m*(m*(m*m)) (m*m)*(m*m). each matrix squaring, go m ^2n instead of m ^n+1.

css3 - drop-down ul only expands to first child li -

this simple straight forward css drop-down nav menu. unfortunately drop-down ul background gradient expand height of first list item. i've written same css other sites , reason it's not working on one. can't figure out life of me. if has idea might going on i'd grateful! here's link: http://madzecreations.com/_test_site/ thanks! your li element contains 4 <a> elements - yet have rule max-height: 30px; change max-height: 180px; , should work. #main_nav li:hover > ul li { max-height: 180px; opacity: 1; visibility: visible; position: relative; z-index: 4; }

c# - Change backcolor or hide border in Telerik radPageView -

Image
i want change color or remove green border of tab. how can this? use telerik pageview in strip mode. thanks try using followimg css , markup .multipage { border:none !important;//to remove green border background:green !important;/to change background color } aspx: <telerik:radmultipage runat="server" id="radmultipage1" cssclass="multipage"> .................. </telerik:radmultipage>

SharePoint 2010/2013 restful webservices for native iOS mobile development -

i'm planning develop sharepoint 2010 native ios solution basic features login , fetch content. there restful web services exposed sharepoint work on, lists restful web services can use? there initial steps need follow start up, provided restful web services available? thanks sudheer

c# - Linq query JObject -

i using json.net serializing , making jobject looks this: "registrationlist": [ { "casenumber": "120654-1330", "priority": 5, "personid": 7, "person": { "firstname": "", "lastname": "", }, "userid": 7, "user": { "id": 7, "createdtime": "2013-07-05t13:09:57.87", "comment": "", }, how query new object or list, put html table/view. want display casenumber, firstname , comment. i want display casenumber, firstname , comment. as in asp.net mvc start writing view model matches requirements: public class myviewmodel { public string casenumber { get; set; } public string firstname { get; set; } public string comment { get; set; } } then in controller action build view model jobject instance have:

utf 8 - Incorrect string value: '\xF0\X9F... and I use utf8mb4 got ? in mysql -

the source character "💰in check" 1 of our app users added, , can't figure out actually. i used way of link ( "incorrect string value" when trying insert utf-8 mysql via jdbc? ) solve problem when insert special characters mysql via jdbc. but when sql exception ws gone, find characters inserted mysql "? in check" can me slove problem? thanks

android - matching font size in ListView and TextView -

i have implemented "endless" scrolling in app. use these layouts (they pretty standard) <listview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/frag_list" android:layout_width="wrap_content" android:layout_height="wrap_content" /> footer layout shown when downloading more content: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/loading_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:orientation="vertical" android:gravity="center"> <progressbar android:layout_w

Scala/ AKKA actor migration between machines -

can running actors migrated different node during life cycle? according akka road map here automatic actor migration upon failure available release "rollins". wondering whether actor migration can somehow done manually, via special message or anything? furthermore, there similar in scala? depending on use case, akka-cluster cluster sharding may fit. module capable of reallocating shards other cluster nodes.

android event for current network traffic? -

i want write android app polls server. assume starting network transmittion (when there no nework traffic) costs battery. might more energy efficient polling when there network traffic. my questions: is assumtion "saving battery wait until there network traffic" correct? is there way find out in android right moment has come polling? what know far: i can register connectivity_change-broadcastreceiver informs me network status change (enabled/disabled wlan/gprs) intentfilter filterc = new intentfilter("android.net.conn.connectivity_change"); registerreceiver(connectivitycheckreceiver, filterc); here broadcast receiver public final broadcastreceiver connectivitycheckreceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { string action = intent.getaction(); string type; connectivitymanager connectivitymanager = (connectivitymanager) context.getsystemse

ckeditor replace textarea using class name with different toolbar confogurations -

i using following code add ckeditor pages. <textarea class="ckeditor" name="editor1"></textarea> i define few toolbar configurations not of textareas in application need full toolbar. have customized default toolbar configuration needs, break down further more basic toolbar of textareas. is there way if using class attribute set ckeditor? it's not possible have different configurations editors created class name. in such case, global ckeditor.config considered. still there's easy workaround problem. first, put script in top of document: <script> ckeditor.replaceclass = null; // disable replacing class </script> now define data-custom-config property (as config.customconfig ) each <textarea> want replace this: <textarea class="ckeditor" data-custom-config="mycustomconfig.js"> moo </textarea> finally use following code manually replace editors class name (assu

php - Password encryption in joomla -

i creating user web service in joomla. password encryption code $password= $_get["password"]; $salt = juserhelper::genrandompassword(32); $crypt = juserhelper::getcryptedpassword($password); $password = $crypt . ':' . $salt; but if trying login in website password. password not match database. using joomla version 1.5 please give suggestion in joomla 2.5 user table passwords saved md5 hashed strings. if created new user, have generated md5 hashed password user assign user particular group saved in user group table. read more how can create new joomla user account within script? http://forum.joomla.org/viewtopic.php?p=2114878 advise $password= $_get["password"]; <--- not idea. never

entity framework - LINQ to Entities does not recognize the method 'Int32 Min(Int32, Int32)'? -

im getting error when execute following code, ideas how fix it? linq entities not recognize method 'int32 min(int32, int32)' method, , method cannot translated store expression. result = items.tolist() .select(b => new batchtoworkonmodel() { batchid = b.batch.id, summarynotes = b.batch.notes, rowversion = b.batch.rowversion, items = items .select(i => new itemtoworkonmodel() { suppliertitle = i.title, itemid = i.id, batchid = i.batchid ?? 0, itemdate = i.pubdate, // kb - issue 276 - return correct outlet name each item outlet = i.items_supplierfields != null ? i.items_supplierfields.

wpf - Hide breadcrumb items when longer than container -

i've created breadcrumb in xaml using listbox control. works nicely. however, when try show add many items, naturally shows of them. want somehow hide left-hand items until right element visible. ideally should leave free space (on right) too. how can this? <listbox height="80" horizontalalignment="stretch" x:name="breadcrumb" minwidth="300" background="transparent" borderthickness="0" scrollviewer.horizontalscrollbarvisibility="hidden" scrollviewer.verticalscrollbarvisibility="hidden"> <listbox.itemspanel> <itemspaneltemplate> <stackpanel margin="8,0,0,0" orientation="horizontal" horizontalalignment="stretch" background="transparent"> </stackpanel> </itemspanelte

ruby on rails - rspec request with devise not working to get current_user and response body nothing -

i new in ruby on rails. use rails 4 , devise application . use devse cancan authorization , authentification. tried try rsepc request. after visit user_session_path aplication don't response, , cannot current_user devise. my code : */support/devise_support.rb module validuserrequesthelper def sign_in_as_a_valid_user @user ||= factorygirl.create :user visit user_session_path fill_in "email", :with => @user.email fill_in "password", :with => @user.password click_button "sign in" end end rspec.configure |config| config.include validuserrequesthelper, :type => :controller config.include validuserrequesthelper, :type => :request end in spec_helper.rb env["rails_env"] ||= 'test' require file.expand_path("../../config/environment", __file__) require 'rspec/rails' require 'rspec/autorun' require 'capybara/rspec' capybara.javascript_driv

asp.net - Convert varbinary(max) to image,resize and save it in a folder using c# or vb.net? -

public static binarytoimage(system.data.linq.binary binarydata) { if (binarydata == null) { return null; } byte[] buffer = binarydata.toarray(); system.drawing.image newimage = default(system.drawing.image); memorystream memstream = new memorystream(); memstream.write(buffer, 0, buffer.length); using (memorystream strefgham = new memorystream(buffer)) { newimage = system.drawing.image.fromstream(strefgham); return newimage; } } public static double getpercent(double width,double height,int originalwidth,int originalheight) { if (width <= originalwidth && height <= originalheight) { return 1.0; } else { double wid = (originalwidth / width); double hei = (originalheight / height); return (wid < hei) ? wid : hei; } } system.drawing.image newimage = default(system.drawing.image); newimage = binarytoimage(varbinaryname.toarray()); double perc = getpercent(newimage.width, ne

symfony - How to get previous url before Symfony2 redirects to login page -

i configured authentication below: pattern: ^/secured/* form_login: check_path: _login_check login_path: _login #/login that is, when enter http://www.example.com/secured/user , redirect http://www.example.com/login without information /secured/user uri. i need know using later. so, how can uri? after user logged in correctly can rederected him referer url using $this->getrequest()->headers->get('referer')

Calculate average of columns data in a matrix in R -

there 63x14 matrix data. want take average of 3 column each last col first col. wrote script below. shows errors follows. not save in given matrix format. since i'm beginner r, got site always. please me solve problem. mydata <- read.table ("sat.txt", header =t) sat<- matrix(nrow=63, ncol=12) (i in 3:ncol(mydata)){ sat [i] <- print(cbind(rowmeans(mydata[, c(i-2, i-1, i)], na.rm=true))) } got results follows : means 12 columns separately following eeror. [,1] [1,] 25.35300 [2,] 25.88500 [3,] 25.52600 [4,] 25.84233 [5,] 25.59233 [6,] 26.97967 [7,] 26.83733 [8,] 26.77567 [9,] 27.06967 [10,] 27.16967 [11,] 27.08500 [12,] 27.26400 [13,] 26.92500 [14,] 26.31033 [15,] 26.11833 [16,] 27.30233 [17,] 26.89600 [18,] 27.80567 [19,] 27.17367 [20,] 27.12767 [21,] 27.79767 [22,] 27.65067 [23,] 26.87933 [24,] 26.96333 [25,] 27.80600 [26,] 26.93933 [27,] 27.37767 [28,] 27.00033 [29,] 26.99933 [30,] 27.63000 [31,] 27.73900 [32,] 27.6

objective c - Decrypting s/mime messages in p7m format with OpenSSL -

i'm trying decrypt p7m openssl cannot go through error in following part of code: pkcs7 *p7 = null; in = bio_new_file(convertedresourcepath, "r"); if (in) { nslog(@"opening p7m file"); } else nslog(@"cannot found p7m file"); out = bio_new_file(converteddecrfilepath, "w"); if (out) { nslog(@"file decription has been created"); } else nslog(@"failed create decription file"); p7 = smime_read_pkcs7(in, null); if (p7) { nslog(@"start reading p7m file"); } else { nslog(@"cannot read p7m file"); err_print_errors_fp(stderr); } if (pkcs7_decrypt(p7, pkey, cert, out, 0)) { nslog(@"file decrypted sucessfully!"); } else nslog(@"cannot decrypt file"); i got following in output: opening p7m file 2013-07-22 12:45:22.951 smimeprototype[10827:c07] file d

sql server - Sql foreign key constraint -

Image
i have table 2 fk same table. have following query: i attaching image: please let me know error. you have put , char after 8th line below references teams(teamid),

c++ - how to calculating D3DVERTEXELEMENT9 stream and offset -

i'm trying learn how use d3dvertexelement9 simple directx 9 app. i've been looking @ tutorials this, don't explain how fill in stream , offset. i've seen examples this: d3dvertexelement9 simple_decl[] = { {0, 0, d3ddecltype_float3, d3ddeclmethod_default, d3ddeclusage_position, 0}, {0, 12, d3ddecltype_float3, d3ddeclmethod_default, d3ddeclusage_normal, 0}, {0, 24, d3ddecltype_float2, d3ddeclmethod_default, d3ddeclusage_texcoord, 0}, d3ddecl_end() }; but how know number put in offset(in case it's 12 , 24 normal , texcoord). also, stream set 0? please help. thanks

bash - Converting string of ASCII characters to string of corresponding decimals -

may introduce problem destroyed weekend. have biological data in 4 columns @id:::12345/1 acgactacga text !"#$%vwxyz @id:::12345/2 tatgacgacta text :;<=>?vwxyz i use awk edit first column replace characters : , / - convert string in last column comma-separated string of decimals correspond each individual ascii character (any character ranging ascii 33 - 126). @id---12345-1 acgactacga text 33,34,35,36,37,118,119,120,121,122 @id---12345-2 tatgacgacta text 58,59,60,61,62,63,86,87,88,89,90 the first part easy, i'm stuck second. i've tried using awk ordinal functions , sprintf; can former work on first char in string , can latter convert hexidecimal decimal , not spaces. tried bash function $ od -t d1 test3 | awk 'begin{ofs=","}{i = $1; $1 = ""; print $0}' but don't know how call function within awk. prefer use awk have downstream manipulations can done in awk. many in advance perl soltuion: perl -lnae &#

Gerrit workflow - push single commit to topic branch -

i want push single commit gerrit without affecting other commits in same topic branch. unfortunately don't have test instance of gerrit experiment with. scenario: have contributed topic branch project, in review, , other developers have updated parts of it. wish make changes on top of updates. to pull changes other developer in commit wish edit, interactive rebase locally make own changes, push gerrit, making sure change-id still same. adds new version of file patchset review. problem: when tried push single commit gerrit, other commits in topic-branch pushed, overwriting changes other developers. here syntax used: git push gerrit 3089c9f56542461dce738a9aa17bb743ed36e038:refs/publish/master/my-topic-branch i presume other commits in topic-branch pushed because of dependencies created gerrit. would approach work instead, leaving out topic branch title?: git push gerrit 3089c9f56542461dce738a9aa17bb743ed36e038:refs/publish/master i tried approach previously, p

php - strtotime and DateTime giving wrong year when parsing a year -

$year = date('y', strtotime("2012")); var_dump($year);//returns 2013 this happening old server php 5.2 , new 1 php 5.4 the server uses strtotime year string 2012-01-01 or 2012-01 or 2012 i tried using $dt = new datetime('2012') , gettimestamp returns "1374516720" "mon, 22 jul 2013 18:12:00 gmt" what causing bug? in documentation says strtotime accepts year i don't know do... edit: $year = date('y', strtotime("2012")); gets treated military time, 20:12 current year using complete date string yyyy-mm-dd , 01.01 day did trick me: $year = date('y', strtotime("2012-01-01")); var_dump($year);//returns 2012 normally suggest use datetime::createfromformat() @rufinus suggested, method not available in php5.2 (what using on 1 of servers). maybe reason fro upgrading old one? ;) reasons why happens: while manual says @ 1 point yyyy (and yyyy) formats ok, tells rest

.net - WiX - install windows service to run in x64 mode -

i'm installing windows service using wix 3.5 , serviceinstall tag: <directoryref id="windowsservicecontentdir"> <component id="windowsserviceexecutablecomponent" guid="*" win64="yes"> <file source="$(var.windowsservicetargetdir)$(var.windowsservicetargetname).exe" keypath="yes" /> <serviceinstall id="windowsserviceinstall" type="ownprocess" start="auto" errorcontrol="normal" vital="yes" name="[win_service_name]" displayname="name" description="name" account="[dentity_domain]\[identity_name]" password="[identity_pwd]"> </serviceinstall> <servicecontrol id="windowsservicestop" name="[win_service_name]"

Telerik Sitefinity - Sorting data selected -

i has code below retrieve data type dtype = typeresolutionservice.resolvetype("telerik.sitefinity.dynamictypes.model.schedule.schedulemanagement"); // how collection of event items var mycollection = dynamicmodulemanager.getdataitems(dtype).where(i => i.status == contentlifecyclestatus.live && i.visible && i.getvalue<string>("title").tostring() == channel + " schedule").firstordefault(); // @ point mycollection contains items the type return mycollection; any idea how can sorting data been selected? please help. firstly need remove .firstordefault() returns single item (or null) not collection. to sorting in linq need use .orderby() eg, order title. type dtype = typeresolutionservice.resolvetype("telerik.sitefinity.dynamictypes.model.schedule.schedulemanagement"); // how collection of event items var mycollection = dynamicmodulemanager.getdataitems(dtype)

linux - Can we get elapsed time from netstat command -

first let me explain scenario. have application using tcp gets hanged due close_wait connections. netstat can trace remote host close_wait happens. want know elapsed time (time of occurrence of close_wait on particular port). if know exact time close_wait happens, can analyze logs corresponding time stamp find possible reason same. i know can run netstat @ regular intervals. way also, can exact time window of close_wait connections. is there simpler way need using netstat or other commands ? you watch traffic directly tcpdump. if know remote ip and/or port can narrow down traffic. tcpdump -i eth0 src 192.168.1.1 , port 80

html - Make a div fixed at particular height -

in web layout using left side bar , content div.both of them want scroll @ point when left side bar content has finished left side bar div div has come fixed , content alone want scroll you need use javascript or in example jquery. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(window).scroll(function(e) { var divtop = $("#div-name").offset().top, stoppoint = 400; if ($(this).scrolltop() >= (divtop + stoppoint) && $('.scroller').css('position') != 'fixed') { $('#div-name').css({ 'position': 'fixed', 'top': '0px', 'height': '300px', 'overflow-y': 'scroll' }); } }); </script> <style> #div-name { margin-top:45px; padding:15px; width:250px; height:

php - How to make a MYSQL query to include rows once of a column based on another? -

Image
seems simple question knows sql, not me. anyhow, here sample table: primary (and only) key on id . scenario fallows. user may add images. newly added images inserted comune_number value 0 avoiding duplicates (on file name = image via php). images inserted can assigned category table. same image can assigned many categories, each inserted new row category id (comune_number). relation between 2 tables on comune_number . i show images, checkbox checked assigned already. question simple. how include all images once , same image assigned, include comune_number instead of 0. don't care order. result achieve this: i'm aware of group by , if try mysql_query("select * banner `comune_number` = 0"); or mysql_query("select * banner group `image`"); i end same (not wanted) result. most have combine 2 queries in one, can't figure out , how. note1 : have tried many combinations in phpmyadmin, based on (little) knowledge , on foun

How to list the stored procedures that contains more than seven join operations in SQL Server database? -

i have database contains more thousand stored procedures. need list stored procedures contain more 7 join operations optimization purpose. is there way this? just examine routine_definition field in information_schema.routines table select routine_name information_schema.routines (len(routine_definition) - len(replace(routine_definition, 'join', ''))) / len('join')>=7

android - ActionMode custom background -

how can change layout or background of actionmode ? there method actionmode.getcustomview(); but returns null . there suggestion? you can change through styles.xml attribute <item name="android:actionmodebackground">@drawable/actionbar_background</item> <item name="actionmodebackground">@drawable/actionbar_background</item> asaik changing programmatically not yet supported

clojure cycles returning nil in map-indexed -

i trying write cycle based fizz buzz in clojure. seems work values not fizz or buzz, values fizz , buzz returns nil. code: (ns fizz-buzz.core (:gen-class)) (defn fizz-buzz [value] (let [fizz (cycle ["" "" "fizz"]) buzz (cycle ["" "" "" "" "buzz"]) fb (map str fizz buzz)] (nth (map-indexed (fn [i v] (if (clojure.string/blank? v) (str (+ 1) v))) fb) (- value 1))) tests: (ns fizz-buzz.core-test (:require [clojure.test :refer :all] [fizz-buzz.core :refer :all])) (deftest value-2-will-return-2 (testing "2 return string 2" (is (= "2" (fizz-buzz 2))))) (deftest value-4-will-return-4 (testing "4 return string 4" (is (= "4" (fizz-buzz 4))))) (deftest value-3-will-return-fizz (testing "3 return string fizz" (is (= "

c - raw socket send two packets on a virtual Network -

i've problem sendto function in code, when try send raw ethernet packet. i use ubuntu 12.04.01 lts, 2 tap devices connected on 2 vde_switches , dpipe example: my send programm create packet below, programm binded socket tap0 , send packet tap1. on tap1 1 receiver wait packets on socket. my raw ethernet packet looks so: destination addr __ _ _ source addr __ _ __ _ ___ type/length __ _ data 00:00:01:00:00:00 _ __ 00:00:01:00:00:01 _ ___ length in byte _ _ some data example packet send: 00:00:01:00:00:00 00:00:01:00:00:01 (length in byte) (message)test but programm generate 2 packets, when in wireshark: first packet ipx packet , [malformed packet] , looks in hex (data = test) 00 04 00 01 00 06 00 00 01 00 00 01 00 00 00 01 74 65 73 74 00 linux cooked capture packet type: sent (4) link-layer address type: 1 link-layer address length: 6 source: 00:00:01:00:00:01 protocol: raw 802.3 (0x0001) [malformed packet: ipx] second packet unknown protocol 0