Posts

Showing posts from February, 2011

opencl - Copying an Image using PyOpenCL -

Image
i've been having trouble making copy of image using pyopencl. wanted try copying want other processing, im not able understand basic task of accessing every pixel. please me catch error make sure works. here program import pyopencl cl import numpy import image import sys img = image.open(sys.argv[1]) img_arr = numpy.asarray(img).astype(numpy.uint8) dim = img_arr.shape host_arr = img_arr.reshape(-1) ctx = cl.create_some_context() queue = cl.commandqueue(ctx) mf = cl.mem_flags a_buf = cl.buffer(ctx, mf.read_only | mf.copy_host_ptr, hostbuf=host_arr) dest_buf = cl.buffer(ctx, mf.write_only, host_arr.nbytes) kernel_code = """ __kernel void copyimage(__global const uint8 *a, __global uint8 *c) { int rowid = get_global_id(0); int colid = get_global_id(1); int ncols = %d; int npix = %d; //number of pixels, 3 rgb 4 rgba int index = rowid * ncols * npix + colid * npix; c[index + 0] = a[index + 0]; c

How to setup Continuous Integration in Visual Studio Online with Git and Nunit -

i've setup visual studio online account , chose git source control. i'm using nunit , moq unit tests , have solution in visual studio 2013. when ci kicks in tests never run, instead following warning "no test found. make sure installed test discoverers & executors, platform & framework version settings appropriate , try again." i'm bit lost here, have no idea how setup "test discoverers & executors" etc. what did try add nunit , moq custom assemblies described here . did not work. as suggested @klings, installing nunit test adapter vs2012 , vs2013 nuget package solved problem. nunit test adapter vs2012 , vs2013

c# - Is there any way to write system independent MVC applications? -

for last 2 days, tried running mvc4 sample internet application (the application created when inside visualstudio 2010 go to: file->new->mvc4 webapllication->internet application (with razor)) on mono, in order check whether can use linux host real mvc app. at first - tried running xamarian studio , .net - no problems there: shows, startup page, can register, , login -> great. then switched .net mono, , hell broke loose. first complains log4net not found -> installing newest log4net fixed problem, why complaining in first place?? then, there error entityframework -> updating ef fixed but, again - why wasn't working? then saw start-up page attempt register thrown: system.missingmemberexception type being lazily initialized not have public, parameterless constructor. when refreshed page, above error gone got when try register: system.invalidoperationexception call method, "membership.provider" property must instance of "extende

linux - How to tar the n most recent files -

i trying create script foreach directoy in folder folder, n recent files compressed. however, having trouble multiple word files. need way wrap them in quote marks tar command knows wich each file. here script far: #!/bin/bash if [ ! -d ~/backup ]; mkdir ~/backup fi cd ~/folder in *; if [ -d "$i" ]; original=`pwd` cd $i echo tar zcf ~/backup/"$i".tar.gz "`ls -t | head -10`" cd $original fi done echo "backup copied in $home/backup/" exit 0 if [ ! -d ~/backup ]; mkdir ~/backup fi you can simplify : [[ ! -d ~/backup ]] && mkdir ~/backup now answer question : $ ls -t|head -10 file spaces file test.txt test test.sh $ lstfiles=""; while read; lstfiles="$lstfiles \"$reply\""; done <<< "$(ls -t|head -10)" $ echo $lstfiles "file spaces" "file" "test.txt" "test" "test.sh"

Errors running builder 'Maven Project Builder' on project in eclipse -

i want create liferay plugin portlet using liferay-maven-plugin in eclipse every time try got error : errors occurred during build. errors running builder 'maven project builder' on project 'sample-portlet'. not calculate build plan: plugin com.liferay.maven.plugins:liferay-maven-plugin:6.2.1 or 1 of dependencies not resolved: failure find com.liferay.maven.plugins:liferay-maven-plugin:jar:6.2.1 in http://repo.maven.apache.org/maven2 cached in local repository, resolution not reattempted until update interval of central has elapsed or updates forced plugin com.liferay.maven.plugins:liferay-maven-plugin:6.2.1 or 1 of dependencies not resolved: failure find com.liferay.maven.plugins:liferay-maven-plugin:jar:6.2.1 in http://repo.maven.apache.org/maven2 cached in local repository, resolution not reattempted until update interval of central has elapsed or updates forced not calculate build plan: plugin com.liferay.maven.plugins:liferay-maven-plugin:6.2.1 or 1 of depend

c# - ComboBox - Set selected item by enum name -

i initialize cb enum values so: private void initprioritys() { m_prioritycombobox.datasource = enum.getnames(typeof(mpriority)).toarray(); } after want update selected item: m_prioritycombobox.selecteditem = (mpriority)i_data.priority; this enum: public enum mpriority { critical, high, important, medium } the problem no matter value i_data.priority has slected item stays first index. you should change m_prioritycombobox.selecteditem = enum.getname(typeof(mpriority), (mpriority)i_data.priority); since data source array of strings -- because of enum.getnames(typeof(mpriority)).toarray(); -- not enums, need reference each item string.

cordova - app(.ipa file) to apple store via application loader -

Image
i developed html 5 application , convert .ipa phonegap(using distribution certificates) ( builded app ) created app in https://itunesconnect.apple.com , status: waiting upload try upload app (.ipa file) using application loader give errors note:this config.xml: my configuration please check bundle id provisional profile not match bundle id have created in itunes connect. please change bundle id make same on itunes connect. attaching image see application bundle id in xcode

cmd - check the file extension with long file name -

i check extension of file (.iso or .img): set extension=%~x1 set typefile=0 %%a in (.iso .img) ( if %%a==%extension% set /a typefile=!typefile!+1 ) if %typefile%==0 ( goto nomount ) else ( goto mount ) its works, problem when file have filename example: 9600.16384.130821-1623_x64fre_client_it-it-irm_ccsa_dv5.iso in case %typefile% set=0 if file iso. change if %%a if /i %%a makes string-match case-insensitive. btw, set /a typefile=!typefile!+1 set /a typefile+=1

mysql - SQL select current week/last week -

i'm looking way of selecting rows based on: current week (s-s) previous week (s-s) the problem i'm having selecting sunday-sunday . at moment i'm using: select sum(time) `time` `projectid` = '$pid' && created > date_sub(now(), interval 1 week) any great, thanks! mysql have week function can use: select sum(time) `time` `projectid` = '$pid' , created > now() - interval 2 week , week(created) in (week(now()), week(now() - interval 1 week)) notes the first condition ( created > now() - interval 2 week ) needed data of current , previous weeks first , restrict 2 weeks interested in. otherwise, if had enough data, aggregation of data of corresponding weeks of every year in table . has added benefit of allowing query use index on field. you need use " week(now() - interval 1 week) " due first week of year. otherwise, week(now()) - 1 have sufficed

ios - iOS7 image added programmatically is blurred -

this how add image: uiimageview *imageholder = [[uiimageview alloc] initwithframe: cgrectmake((self.view.frame.size.width/2) - (290/2),(self.view.frame.size.height) - (140 * 1.8), 290, 140)]; uiimage *image = [uiimage imagenamed:@"no-pins.png"]; imageholder.image = image; imageholder.contentmode = uiviewcontentmodescaleaspectfit; // optional: // [imageholder sizetofit]; [self.view addsubview:imageholder]; the size of image (retina version) same size in cgrectmake above. image little blurred. can reduce blur when edit image , give higher resolution in photoshop. but images add through storyboard fine in quality. ideas might wrong? for retina graphics, image size should twice size of frame of image view. allows image use scale of 2 take advantage of retina screen capability. so, should have 1 image of size 290x140 (if supporting non-retina devices) , 1 image of size 580x280 (this @2x image). the frame of view description of position , size of view w

substr - How to get a certain sub_string in a sting using jquery -

i have routine produces id attributes on tag -- anywhere [1] [??] i want able evaluate string , extract id ordinal using jquery. here sample markup: <div id="abc[1]"></div> <div id="abc[15]"></div> i know can this: var n1=???.indexof("["); var n2=???.indexof("]"); var theid = $('#???').substr(n1,n2); but wondering how make work possible. i want theid retrieve 1 or 15 , etc. try string.replace() var n = $(el).attr('id'); var theid = n.replace('abc[', '').replace(']', '');

objective c - Synthesized Methods for Class Extension Unavailable -

ok, i'm confused. have class employee, declare several properties for, of course, synthesize , work fine. in implementation class, extend class so: @interface employee () @property (nonatomic) unsigned int employeeid; @end which think allow me following in main.m: employee emp = [[employee alloc] init]; //use other property accessor methods... [emp setemployeeid:123456]; //do other stuff... but compiler chokes on use of setemployeeid following error "no visible interface 'employee' declares selector 'setemployeeid.' can tell me why shouldn't able use extension same way i'd use other properties? help!!! because employeeid property 'private' if have declared using continuation category in .m file of class. means compiler won't 'see' definition during compilation - hence array. technically, still access @ runtime using kvc, should decide if property should public or private. if you're testing / mess

python - Difficulty with writing a merge function with conditions -

im trying write function cant right. supposed merge function merges follows: function recieves input list of lists(m lists, ints). function creates list contains indexes of minimun values in each list of input(each list of list of lists, overall m indexes). example: lst_of_lsts= [[3,4,5],[2,0,7]] min_lst= [0,1] at each stage, function chooses minimum value list , adds new list called merged. then, erases list of indexes(min_lst) , adds next index new minimum. @ end returns merged organized list small ints big ints. example: merged= [0,2,3,4,5,7] another thing im not allowed change original input. def min_index(lst): return min(range(len(lst)), key=lambda n: lst[n]) def min_lists(lstlst): return [min_index(lst) lst in lstlst] then min_lists([[3,4,5],[2,0,7]]) # => [0, 1] edit: this site doesn't exist solve homework you. if work @ , solution doesn't expect, show you've done , we'll try point out mistake. i figure solution ok bec

java - Memory overhead in JSF render response- ajax request -

i'm using jsf 2.0 ,primefaces 3.3 , javax.faces-2.1.4.jar. facing performance issues specially memory overhead in renderresponse phase. signle ajax request consumes lot of memory. i'm maintening around 3000 components(panels , tabs, tables... etc) in view tree , i'm trying process , render 1 panel has 1 text field. consumes more memory( around 20mb ) rendering. why starge behaviour happening ? can 1 suggest overcome this. thanks in advance !!! you use partial submits , partial updates if not using them anyway ;) process need processed in ajax request , update u need updated ajax response.

file - Save in Sublime Text with Another Extension -

Image
in sublime text 2 & 3, whenever save file 1 extension, or without extension, save extension later, syntax colors seem stay first extension. example, when save mean javascript or php file without extension accident, save as correct extension, text stays black. is supposed happen? because file isn't saved 2nd extension next time? importantly, there way save file correct extension without creating new file & copying text over? you can set syntax manually follows. click html , see syntaxes, may choose whatever want, or can in command palette type ctrl+shify+p , type syntax , can same thing.

android - intellij + gradle + robolectric + espresso -

i trying setup project using frameworks listed above. i'm using demonstration project deckard-gradle , cannot sync gradle. says org.robolectric.gradle:gradle-android-test-plugin:0.9.4-snapshot not found. how fix this? has made work? here build.gradle file buildscript { repositories { mavenlocal() mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.2' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.9.4-snapshot' } } allprojects { repositories { mavencentral() } } apply plugin: 'android' apply plugin: 'android-test' android { packagingoptions { exclude 'license.txt' exclude 'meta-inf/license' exclude 'meta-inf/license.txt' exclude 'meta-inf/notice' } compilesdkversion 19 buildtoolsversion "19.0.3" defaultconfig { minsdkversion 18

python - ModelForm has no model class specified -

please solve problem . i tried create user profile page , user reaches after registration , login. after loading address / userprofile / loaded view user_profile (request). startup page displays following error message : request method: request url: http://127.0.0.1:8000/userprofile/ django version: 1.6.2 exception type: valueerror exception value: modelform has no model class specified. exception location: c: \ python33 \ lib \ site-packages \ django \ forms \ models.py in __ init__, line 308 models.py: from django.db import models django.contrib.auth.models import user class userprofile (models.model): user = models.onetoonefield (user) likes_cheese = models.booleanfield (default = true) favorite_hamster_name = models.charfield (max_length = 50) user.profile = property (lambda u: userprofile.objects.get_or_create (user = u) [ 0]) forms.py: from django import forms userprofile.models import userprofile class userprofileform (forms.modelform): class meta: user

c++ - Why use preprocessor #if statements instead of if() else? -

i see being done time example in linux kernel. purpose of using preprocessor commands vs normal c++ if else block? there speed advantage or something? a preprocessor changes c/c++ code before gets compiled (hence pre processor). preprocessor ifs evaluated @ compile-time . c/c++ ifs evaluated @ run-time . you can things can't done @ run-time. adjust code different platforms or different compilers: #ifdef __unix__ /* __unix__ defined compilers targeting unix systems */ #include <unistd.h> #elif defined _win32 /* _win32 defined compilers targeting 32 or 64 bit windows systems */ #include <windows.h> #endif ensure header file definitions included once (equivalent of #pragma once , more portable): #ifndef example_h #define example_h class example { ... }; #endif you can make things faster @ run-time. void some_debug_function() { #ifdef debug printf("debug!\n"); #endif } now, when compiling debug not defined (likely comm

create a directory with normal permission in go -

how can create directory normal permissions (say 0700 in octal notation) os.mkdir method. did not manage find how set perm value correctly. you can use octal notation directly: os.mkdir("dirname", 0700) from documentation filemode : the 9 least-significant bits standard unix rwxrwxrwx permissions the mode bits defined may use normal octal notation chmod. however, must prefix 0 tell go octal literal. also, remember 4th number doesn't exist in chmod. chmod, 1700 set sticky bit. in go, need set bit defined in os lib doing like: 0700 | os.modesticky

php - How to Modify the Font Size of the Contents in a Table -

in table trying change font size. have tried adding font size in tag, adding in css code myposts class, nothing prevailed. how can change font size? <table width="100%" border="0" class = "myposts"; align="center" cellpadding="3" cellspacing="1" bgcolor="#686868 " > <tr> <td width="6%" align="center" bgcolor="#505050 " ><strong>#</strong></td> <td width="53%" align="center" bgcolor="#505050 "><strong>job description</strong></td> <td width="15%" align="center" bgcolor="#505050 "><strong>views</strong></td> <td width="13%" align="center" bgcolor="#505050 "><strong>replies</strong></td> <td width="13%" align="center" bgcolor="#505050 "&g

java - I am getting an array out of bound exception for this piece of code -

public compressimage(){ } // compress image method public static short[] compress(short image[][]){ // image dimensions int imagelength = image.length; // row length int imagewidth = image[0].length; // column length // convert vertical horizontal // store transposed image short[][] transposeimage = new short[imagewidth][imagelength]; // rotate +90 (int = 0; < imagewidth; i++) { (int j = 0; j < imagelength; j++) { short temp = image[i][j]; transposeimage[i][j] = image[j][i]; transposeimage[j][i] = temp; } } short temp = image[i][j]; transposeimage[i][j] = image[j][i]; transposeimage[j][i] = temp; why swapping here? doesn't make sense - transposeimage new matrix, don't have inplace editing. guaranteed break if imagewidth != imagelength - see if can figure out why. and, actually, you're not swapping. 3 lines above equivalent t

How to cascade child and parent in SQL Server 2008 R2 -

i set relationship b/w 2 column (primary key , foreign key on unique id) i able 2 change id in parent form , effect on child table problems can change primary key not column never change , cause problem user , report functions. created relation sql server 2008 r2's diagram , use dataset. i tried use delete cascade , works fine , deletes whole child in forms on update have problem. is there way update child columns parent table? thanks.

Get UUID of local low energy bluetooth device in Android -

i'm trying access uuid of low energy bluetooth devices in android, post string web api. here's code works fine @ toasting local name , mac address: private final broadcastreceiver actionfoundreceiver = new broadcastreceiver(){ @override public void onreceive(context context, intent intent) { string action = intent.getaction(); if(bluetoothdevice.action_found.equals(action)) { bluetoothdevice device = intent.getparcelableextra(bluetoothdevice.extra_device); string smac = device.getaddress(); string sname = device.getname(); string suuid = ""; //help! toast toast = toast.maketext(getapplicationcontext(), "mac: " + smac + " - name: " + sname + " - uuid: " + suuid, toast.length_short); toast.show(); } } }; can this? there can multiple uuids - represent ble characteristics of device. http://develop

android - Can't use get arguments to get bundle's data -

when run app crashes though code seems "legit" , there no syntax errors. have built 2 classes: in first class, preview calling 2 other class made app crashes. helpfragment.java private void updatetab(string tabid, int placeholder) { fragmentmanager fm = getfragmentmanager(); if (fm.findfragmentbytag(tabid) == null) { bundle bundl = new bundle() ; bundl.putstring("tabid", tabid); mylistfragment list_fragment = new mylistfragment(); list_fragment.setarguments(bundl); fm.begintransaction() .replace(placeholder, list_fragment, tabid) .commit(); } } the class calling, (and problematic one): mylistfragment.java import java.util.arraylist; import java.util.list; import android.annotation.suppresslint; import android.content.context; import android.os.bundle; import android.app.listfragment; import android.app.loadermanager.loadercallbacks; import android.content.asynctaskloader

android - I have a method that works in my MainActivity, but the same code does not work in other classes -

i have method calls php page retrieve data mysql. method works fine in mainactivity class, exact same code not work if move code different class. here method: public void setroundnumber() { try{ httpclient = new defaulthttpclient(); httppost = new httppost("http://brad.grublist.net/project/getroundnumber.php"); namevaluepairsroundnumber = new arraylist<namevaluepair>(1); namevaluepairsroundnumber.add(new basicnamevaluepair("eventdate", globalclass.eventdate)); httppost.setentity(new urlencodedformentity(namevaluepairsroundnumber)); //execute http post request responsehandler<string> responsehandler = new basicresponsehandler(); final string json = httpclient.execute(httppost, responsehandler); log.e("response: ", "> " + json); if (json != null) { try { jsonobject jsonobj = new jsonobject(json);

java - Pass parameters to url in jsp -

is right way send parameter along url in jsp page ? <a href="cancelrequest?userid=<%=idperson%>&userrnamee=<%=namee%>" onclick="return confirm('are sure want cancel request?');"> <input type="submit" value="cancel request"></input> </a> i tried not taking namee field .please help sample code: <input type="button" value="adduser" class="button" onclick="location.href='usercontroller?action=insert'"/></p> <input type="button" value="back" class="button" onclick="location.href='employeecategory.jsp'" />

javascript - Server does not receive data from ajax call -

i have problem. i'm trying send content of textarea ajax call, doesn't seem working, , don't know why. there's method called getstatus(string statustext) need receive content. here's javascript code: $("#btnsavestatus").on("click", function () { var statustext = $(".textareaedit").val(); $.ajax({ type: "get", url: "default.aspx/getstatus", data: "{statustext:'" + statustext + "'}", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (result) { // $('#littlbioid').text(result.d); } }); }); please advise. should know i'm new web development.

spring - How to get Response Body when Server responds with 302 in Grails? -

i want request server side image different server request. if requesting server response status code 200 works fine. found 302 redirect status code. in case there no response.body need. this code use retrieve user image facebook. since facebook makes redirect 302 status code , not response.body. def uri = new uri("http://graph.facebook.com/1000345345345/picture?width=200&height=200") def requestfactory = new simpleclienthttprequestfactory() def request = requestfactory.createrequest(uri, httpmethod.get) try { def response = request.execute() def statuscode = response.statuscode if (statuscode == httpstatus.found) { log.debug "302" // how response body? } if (statuscode == httpstatus.ok) { return response.body.bytes } else if(statuscode == httpstatus.forbidden) { throw new illegalaccesserror(response.statuscode.tostring()) } } catch(ex) {

linux - Simple way to Get filesize in x86 Assembly Language -

assuming have opened file in assembly , have file handle file in register eax. how go getting size of file can allocate enough buffer space it? i researched discussion here suggested using sys_fstat(28) system call file stats couldn't implement it... #my attempt @ getting file size _test: movl filehandle, %ebx #move filehandle (file descriptor) ebx movl $28, %eax #fstat syscall int $0x80 # end -14 in here not sure why here how implemented in freshlib. wrapper in order provide portability. can simplify of course (see below). struct stat .st_dev dw ? ; id of device containing file .pad1 dw ? .st_ino dd ? ; inode number .st_mode dw ? ; protection .st_nlink dw ? ; number of hard links .st_uid dw ? ; user id of owner .st_gid dw ? ; group id of owner .st_rdev dw ? ; device id (if special file) .pad2 dw ? .st_si

java - Why is this loop becoming infinite when using String.valueOf or Float.toString? -

i reading in bytes file using fileinputstream . code (in correct form) follows: string s = ""; try { file file = new file(...); fileinputstream file_input = new fileinputstream(file); datainputstream data_in = new datainputstream(file_input ); while (true) { try { (int index = 0; index < 4; index++) { bytearray[index] = data_in.readbyte(); } } catch (eofexception eof) { break; } float f = readfloatlittleendian(bytearray); // transforms 4 bytes float //s += float.tostring(f); <- here's problem } data_in.close(); } catch (ioexception e) { system.err.println(e.tostring()); } } system.out.print(s); if run code is, loop finishes when reading of file , transforming each set of 4 bytes float . however, if uncomment line, file never finishes, , seems loop through

c++ - Linked List Problems -

so created class linked_list struct node seems there errors don't know how fix , here code : #include <iostream> using namespace std; struct node{ int info; node *link; }; class linked_list{ private : int count; node *first; node *last; node *current; public: linked_list() { count=0; first=null; last=null; } void initialize_list(){ cout<<"enter number of nodes"<<endl; cin>>count; first=last=current=new node; for(int =0;i<count;i++){ cin>>current->info; last->link=current; last=current; current=new node;} last->link=null; } bool is_empty(){ if(first==null) { cout<<"the list empty"<<endl; return true; } else{ cout<<"the list not empty"<<endl; return false;} } bool search(int x){ for(current=first;current!=null;current=current->link){ if (current->info==x) return true; else return false;} } void insert_first(int x){ count++; cu

c# - datagridview only searching first row -

i trying search every cell in datagridview value "test". searching first row... (i believe searching columns) ideas on how can fix this? datagridview1.selectionmode = datagridviewselectionmode.cellselect; string searchvalue = "test"; int searching = -1; while (searching < 7) { searching++; try { foreach (datagridviewrow row in datagridview1.rows) { if (row.cells[searching].value.tostring().equals(searchvalue)) { row.cells[searching].selected = true; break; } } } catch (exception exc) { // messagebox.show(exc.message); } } use snippet.. iterate through every row/column , set

mysql - php error with password_verify with ubuntu but works fine on xampp -

i have code validates password: if(password_verify($password, $member['passwd'])){ // set session variables } after verifying password redirects user home page. have verified query successful db , $member['passwd'] exists , correct password. appears php script stops running @ line. echo's added after don't executed. but when run on mac xampp works fine , able log user in. code same. have idea issue may be? working 2 weeks ago , there no major code change have caused this. issue ubuntu/package update. system info: running php version 5.3.10-1ubuntu3.10 on ubuntu 12.04.3 x64 error occurring. locally using xampp mac , it's running php version 5.5.6. password_verify supported on php 5.5+ it throwing error have turned off displaying errors setting display_errors false in php.ini . you can either upgrade or use compatibility library: https://github.com/ircmaxell/password_compat to upgrade can use ppa provides later version of ph

java - How to add id to action in HTML.form -

i have form: <form method="post" action="/user/${id}"> <input type="text" value="${id}" placeholder="input id"> <button>get user</button> </form> i need add input data uri, /user/23, 23 in inputed data. do need have /user/23 uri? if don't, can use "/user/" action. <form method="post" action="/user"> <input type="text" name="user_id" placeholder="input id"> <button>get user</button> </form> then can get/handle proper id. like: <%= request.getparameter("user_id")%>

ruby on rails - Javascript voting acts_as_votable -

i have rails app, in posts model has comments , comments votable. i'm using acts_as_votable. i have voting on comments working. i'm trying implement javascript page not have refresh every time votes on comment, vote goes through. here had before(which working): in comments controller: def upvote_post_comment @post = post.find(params[:post_id]) @comment = @post.comments.find(params[:id]) @comment.liked_by current_user respond_to |format| format.html {redirect_to :back} end end and in view: <% if user_signed_in? && current_user != comment.user && !(current_user.voted_for? comment) %> <%= link_to image_tag(‘vote.png'), like_post_comment_path(@post, comment), method: :put %> <a> <%= "#{comment.votes.size}"%></a> <% elsif user_signed_in? && (current_user = comment.user) %> <%= image_tag(‘voted.png')%><a><%= "#{comment.votes.size}"%></a>

reporting services - SSRS Hide row except for highest version -

this seems should simple couldn't find while googling. on ssrs report have few rows duplicates except few values changes in later versions. can't use expression on row visibility "show or hide base on expression" iif(max(version), true, false)? i can't seem expression right. thanks,

Alter User not working in oracle -

i'm doing follwing question managing locked accounts – utility should able identify each locked account locked because of invalid login attempts. utility should further unlock accounts have been locked more week. ----------------------------------------my code------------------------------------------ procedure managing_locked num int; v_sql varchar(50); begin x in (select username,lock_date,account_status,profile dba_users account_status ='locked(timed)') loop dbms_output.put_line('username: '|| x.username); dbms_output.put_line('lock_date: '|| x.lock_date ); dbms_output.put_line('account_status: '||x.account_status); dbms_output.put_line('profile: ' ||x.profile); dbms_output.put_line('*********************'); select ((sysdate - x.lock_date)) num dual; if(num>7) v_sql := 'alter user'|| x.username ||'account unlock'; dbms_output.put_line(x.userna

javascript - Parse JSON Data into HTML -

i'm using google feeds api display latest posts facebook. the statues coming xml file fbrss.com , code have below works: <script type="text/javascript"> google.load("feeds", "1") $.ajax({ url : document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=3&callback=?&q=' + encodeuricomponent('feedhere.xml'), datatype : 'json', success : function (data) { if (data.responsedata.feed && data.responsedata.feed.entries) { $.each(data.responsedata.feed.entries, function (i, e) { console.log("------------------------"); console.log("postcontent : " + e.title); console.log("link : " + e.link); console.log("date: " + e.publisheddate); }); ;

javascript - How can I use document.write in setTimout without clearing previous text -

i want create delay between 2 document.write s. used settimeout so, once executes, writes on previous text. able display text, wait delay, display other text below without erasing previous text. code appending otherwise empty html file. also, haven't had success using <br> this. var numofdice = prompt("how many dice?"); var numofsides = prompt("how many sides on these dice?"); var rolldice = function(numofdice) { var rollresults = []; (var = 0; < numofdice; i++) { rollresults[i] = math.floor((math.random() * numofsides) + 1); } return rollresults; } var printresults = function() { var = 0; while (i < rollresults.length - 1) { document.write(rollresults[i] + ", "); i++; } document.write(rollresults[i]); } alert("roll dice!"); var rollresults = rolldice(numofdice); printresults(); settimeout(function() {document.write("these numbers...")}, 10

Print lists in alphabetical order(with numbers) in python -

i need print multiple lists need printed in alphabetical order, .sort wont work because there numbers involved. """define function retrive short shelf life items in alphabetical order""" def retrieveshortshelflifeitems(oneitemlist): if shelflife <= 7: shortlifeitemslist.append(oneitemlist) return shortlifeitemslist #initializes short shelf life list shortlifeitemslist = [] shortlifeitems = [['steak', ' 10.00', ' 7', '10.50'], ['canned corn', ' .50', ' 5', '0.53']] #print items short shelf life item in shortlifeitems: print("{:^20s}${:^16s}{:^20s}${:^16s}"\ .format((item[0]),item[1],item[2],item[3])) so prints: steak $ 10.00 7 $ 10.50 canned corn $ .50 5 $ 0.53 when suppose print: canned corn $ .50 5 $ 0.53

.htaccess - How To Redirect Non Existing URL's to the HomePage, When my site is in a Sub-directory....? -

i had .htaccess code worked fine when site , files in home root folder, changed new host had domains on it, site in subdirectory , following code no longer works: rewritecond %{http_host} ^mydomain.com$ [or] rewritecond %{the_request} ^[a-z]{3,9}\ /index\.html rewriterule ^(index\.html)?$ http://www.mydomain.com/ [l,r=301] how modify make work, need include subdirectory name in it? right if typed in non existing url "mydomain.com/blahblah567 ....it shows "page not found" type of thing. thanks how redirect non existing url's homepage this enough: errordocument 404 http://domain.com/ or using mod_rewrite in subdir/.htaccess file: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ / [l,r=301]

virtualbox - Something Broke with Virtual Box -

Image
so messing around virtual box on mac, have windows 7 installed in vm , did command + c , resized (scaled mode) - (it experiement) - didn't did command + c again , broke. had tiny sliver of windows 7. so went , restarted windows 7 via reset on machine (vm machine) , didnt still tiny sliver. tried entering full screen , scaled mode , nothing works. tried quitting vb , starting again , still isn't working. in other words how fix this? seems scaled mode broken , resualt cannot regular size of windows back: how fix this? press 'host' button + resize window.

c# - Setting a NodeView to reflect the changes in the ListStore Model -

using mono , monodevelop , c# , gtk# on linux. i know has been asked before, no matter try, none of examples or answers seem work me. still can't changes in liststore reflected in treeview . i start of so.... liststore ls_nvdevicefiledescription = new liststore (typeof(string), typeof(string), typeof(string)); liststore ls_dev_sensor_codes = new liststore (typeof(string)); liststore ls_dev_sensor_value_types = new liststore (typeof(string)); the first liststore treeview , second , third cellrenderercombo 's on column 1 , 3 of treeview . i add values cellrenderercombo 's user pick values from.... string[] _codes = csql.csql_getdevicesensorcodes (); string[] _types = csql.csql_getdevicesensorvaluetypes (); // codes. if (_codes != null) { (int = 0; < _codes.length; i++) { ls_dev_sensor_codes.appendvalues (_codes [i]); } } //do types if (_types != null) { (int =

svn - disabe password feature in subclipse (eclipse plugin) to get rid "unsupported password" dialog on Ubuntu -

Image
my eclipse prompt "unsupported password" dialog everytime run it. causes eclipse lag, , need force close it. this subclipse : i tried change config file in etc/subversion ( ubuntu ), found in this document : ### valid password stores: ### gnome-keyring (unix-like systems) ### kwallet (unix-like systems) ### keychain (mac os x) ### windows-cryptoapi (windows) //i uncomment , empty value, doc suggested password-stores = however, dialog still there. please me out, help i done it. still unable save password @ least annoying dialog box gone, forever. the documentation wrong, config file edited in etc/subversion has no effect. true path in /home/user/.subversion/config . there 2 same config file in laptop, , 1 work. the step-by-step syntax in terminal : chmod config file because read : sudo chmod -r 777 /home/user/.subversion/config change current directory config's directory : cd /user/tama/.sub

c# - How to Clone a Windows Forms Control -

Image
i have c# form has groupbox. user must input desired number (integer) , when user clicks "add", group box must duplicated , pasted on same form based on number user inputted. how create exact copy of groupbox , paste in same form? please see attached screenshot. any appreciated. thanks i used sriram's code form adds 2 groupbox: private void button1_click(object sender, eventargs e) { int containers = 0; int.tryparse(textbox1.text, out containers); (int = 0; < containers; i++) { flowlayoutpanel1.controls.add(groupbox1); } } i'll suggest create user control has groupbox shown child controls. let's call myusercontrol when create instance of myusercontrol controls groupbox. to show controls without overlapping each other can use flowlayoutpanel arranges controls automatically. in button click code you'd write void addbutton_click(object sender, eventargs e) { in

algorithm - Depth first search (C++) -

i've created class contains vector of linked lists. each linked list represents vertice in graph. nodes connected linked lists considered edges between these vertices. i'm trying create dfs function graph, having trouble setting colors of vertices. realize there lot of problems code, i'm trying solve 1 in particular. dfsit() function ends in infinite loop because color attribute list isn't getting set "gray". idea why be? void graph::dfs() { int = 0; while (i != myvector.size()) { dfsit(myvector[i], myvector[i].val); myvector[i].color = "black"; i++; } } void graph::dfsit(adjlist x, int root) { if (x.color == "white") { cout << "tree edge ( " << root << "," << x.val << ") " << endl; } if (x.color == "gray") { cout << "back edge ( " << root << "," << x.val << &qu

winforms - column count property cannot be set on a databound datagridview control c# -

in form have datagridview. , controls input , output data. while displaying data in gird view. calling bindgrid in 2 occasions. 1 while formload , other after adding new record. public formaccounts() { initializecomponent(); bindgrid(); } private void bindgrid() { oledbconnection conn = new oledbconnection(); conn.connectionstring = @"provider=microsoft.jet.oledb.4.0;data source= g:\sanjeev\testdb\db.mdb;jet oledb:database password=test123; jet oledb:engine type=5"; conn.open(); string constring = @"provider=microsoft.jet.oledb.4.0;data source=g:\sanjeev\testdb\db.mdb;jet oledb:database password=test123; jet oledb:engine type=5"; using (oledbconnection con = new oledbconnection(constring)) { using (oledbcommand cmd = new oledbcommand("select * tblaccounts", con)) { cmd.commandtype = commandtype.text; using

c# - How to use paging with Repeater control in ASP.NET? -

Image
<asp:repeater id="repcourse" runat="server"> <itemtemplate> <div style="width:400px"></div> <div class="course" style="float: left; margin-left: 100px; margin-top: 100px"> <div class="image"> <asp:image id="imgteacher" runat="server" height="150" width="248" imageurl='<%# "showimage.ashx?id="+ databinder.eval(container.dataitem, "courseid") %>'/> </div> <div style="margin-left: 3px; width: 250px"> <div class="name"> <a href="#"><asp:label runat="server" id="lblname" text='<%#eval("coursename") %>'></asp:label></a> </div> <div style="height: 13px"></div> <div id="teacher">

MySQL Workbench Forward Engineer Error 1215: Cannot add foreign key constraint -

when execute script create 2 tables, store column in customer table references id column in users table (both columns int): set @old_unique_checks=@@unique_checks, unique_checks=0; set @old_foreign_key_checks=@@foreign_key_checks, foreign_key_checks=0; set @old_sql_mode=@@sql_mode, sql_mode='traditional,allow_invalid_dates'; create schema if not exists `part_finder` default character set utf8 ; use `part_finder` ; -- ----------------------------------------------------- -- table `part_finder`.`users` -- ----------------------------------------------------- create table if not exists `part_finder`.`users` ( `id` int(10) unsigned not null auto_increment, `account` mediumint(7) unsigned not null comment 'account organisation user belongs to', `name` varchar(32) null default null, `passenc` varchar(32) null default null, `email` varchar(55) null default null, `rank` decimal(1,0) null default '0', `ip_reg` varchar(15) null default null, `ip_vi

jsoncpp - Neo4j and json creating multiple nodes with multiple params -

i tried many things of no use. have raised question on stackoverflow earlier still facing same issue. here link old stackoverflow question creating multiple nodes properties in json in neo4j let me try out explaining small example query want execute { "params" : { "props" : [ { "localasnumber" : 0, "nodedescription" : "10timos-b-4.0.r2 ", "nodeid" : "10.227.28.95", "nodename" : "blr_wao_sarf7" } ] }, "query" : "match (n:router) n.nodeid = {props}.nodeid return n"} for simplicity have added 1 props array otherwise there around 5000 props. want execute query above fails. tried using (props.nodeid}, {props[nodeid]} fails. possbile access individual property in neo4j? my prog in c++ , using jsoncpp , curl fire queries. if {props}.nodeid in query props parameter must map