Posts

Showing posts from 2012

css - Animated cube-like (only two faces) effect with CSS3 -

i reproduce jsfiddle prepared based on this awesome tutorial (please check the demo ). don't want keys functionality, on hover. http://jsfiddle.net/b5rmw/5/ but uses 2 faces (front , back). i tried, this: #cube { position: relative; margin: 100px auto 0; height: 300px; width: 300px; -webkit-transition: -webkit-transform .5s linear; -webkit-transform-style: preserve-3d; -moz-transition: -moz-transform .5s linear; -moz-transform-style: preserve-3d; } .face { position: absolute; height: 300px; width: 300px; padding: 0px; background-color: rgba(50, 50, 50, 1); font-size: 27px; line-height: 1em; color: #fff; border: 1px solid #555; border-radius: 3px; } #cube .one { -webkit-transform: rotatex(90deg) translatez(150px); -moz-transform: rotatex(90deg) translatez(150px); background:red; } #cube .two { -webkit-transf

java - Android Manifest- intent filter and activity -

could explain following lines in manifest - <activity android:name=".aboutus" android:label="@string/app_name"> <intent-filter > <action android:name="com.example.app1.about" /> <category android:name="android.intent.category.default"/> </intent-filter> </activity> how fields in activity , intent filter important , when used/referred ? sorry, tried read documentation still couldnt figure out. thank you android:name=".aboutus" this name of activity class, dot @ front shorthand notation package. stands com.your.package.name.aboutus means java file represents activity called aboutus.java android:label="@string/app_name" label string gets shown in launcher(if activity listed in launcher) , @ top of window when activity open. <intent-filter > ... </intent-filter> intent filter defines in

android - How to ensure all events have been fired before moving forwarded -

how ensure ontouch, onclick, etc listeners have been fired in ui thread before moving forward test code? in other words, have spinner on have registered both ontouchlistener , onitemselectedlistener. want ensure both these functions called activity before move on testing. there way can achieved in roboelectric?

asp.net mvc - how to set default value HTML.TextBoxFor() -

i have view consisting of form , textboxes. how can set default value in each box strings , int values? i want page load each box's value don't need type values. i'm not able change in model. @model mydb.production.productionmaterial @{ viewbag.title = "creatematerial"; } @using (html.beginform()) { @html.validationsummary(true) <fieldset> <legend>productionordermaterial</legend> <div class="editor-label"> @html.labelfor(model => model.position) </div> <div class="editor-field"> //something @html.textboxfor(model => model.position, or 5 ) @html.validationmessagefor(model => model.position) </div> <div class="editor-label"> @html.labelfor(model => model.articleid) </div> <div class="editor-field"> //something @html.textboxfor(mo

Android java JSON parsing 'null' as output -

we have been using this code in our application fetch data online database, whatever tried, keeps saying "null" output album , duration. small detail, since beginning developers, don't know lot json. has got suggestions? package com.example.androidhive; import java.util.arraylist; import java.util.list; import org.apache.http.namevaluepair; import org.apache.http.message.basicnamevaluepair; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.app.activity; import android.app.progressdialog; import android.content.intent; import android.os.asynctask; import android.os.bundle; import android.text.html; import android.util.log; import android.widget.textview; import com.example.androidhive.helper.alertdialogmanager; import com.example.androidhive.helper.connectiondetector; import com.example.androidhive.helper.jsonparser; public class singletrackactivity extends activity { // connection detector connectionde

python - Possible to use caret and lookahead in set? -

i've read docs , looked on other questions haven't found answer. is possible use lookahead within set, or have lookahead complement within set? i want create set matches every character except dash preceded space. however, if there space not followed dash should match. i thinking work, has not: r'[^\s(?=\-)]' do lookaheads not work inside of set? if not, how go solving problem? edited provide examples: i have been trying find more accurate alternative to r'([^\-]*)\-(.*)' which intended read line , separate artists titles. applying re.match(r'([^\-]*)\-(.*)', "artist - title") should yield: group(1) = "artist" group(2) = "title" however if artist name includes dash wrong parts of string captured. example: re.match(r'([^\-]*)\-(.*)', "jay-z - title") would yield: group(1) = "jay" group(2) = "z - title" i want capture group capture spaces , dashes, no

html - GET request to same page- jQuery form -

i building small search engine, using form like form action="" method="get" id="searchform"> <input type="search" name="search" id="searchquery" value="<?php echo $_get['search']; ?>" /> </form> i passing search query same page. want prevent submitting form if text box value null. so, added event handler form $('#searchform').submit(function() { alert('handler .submit() called.'); if($('#searchquery').val()==null) { return false; } }); but doesnt seem work, when try using form action ="#" works fine. can suggest workaround? instead of checking against null, trim value , check against empty string. $('#searchform').submit(function(event) { if($('#searchquery').val().trim()=="") { return false; } }); note: using trim() ensures form doesn't submit if whitespace in input text box.

python - Why does my original list change? -

i wrote function swapcities able swap entries 3 , 4 in list. so f.e. [0,1,2,3,4] should become [0,1,2,4,3]. function works perfectly, strangely original list changes not want. this code: def swapcities(solution): n = 3##randint(0,numberofcities-1) m = 4##randint(0,numberofcities-1) result = solution temp1 = solution[n] temp2 = solution[m] result[n] = temp2 result[m] = temp1 return result print "start" incumbentsolution = list(x x in range(0,numberofcities)) print incumbentsolution print "after swap" newsolution = swapcities(incumbentsolution) print newsolution print "original solution" print incumbentsolution i following result: how many cities? 8 start [0, 1, 2, 3, 4, 5, 6, 7] after swap [0, 1, 2, 4, 3, 5, 6, 7] original solution [0, 1, 2, 4, 3, 5, 6, 7] (why did change?!) as can see original solution changed should not do. i have no clue why happens. when change code such changes applied copy of o

Scala not found: value x when unpacking returned tuple -

i've seen kind of code on countless websites yet doesn't seem compile: def foo(): (int, int) = { (1, 2) } def main(args: array[string]): unit = { val (i, o) = foo() } it fails on marked line, reporting: not found: value i not found: value o what might cause of this? the problem use of upper case letters i , o in pattern match. should try replace lowercase letters val (i, o) = foo() . scala language specification states value definition can expanded pattern match. example definition val x :: xs = mylist expands following (cf. p. 39): val x$ = mylist match { case x :: xs => {x, xs} } val x = x$._1 val xs = x$._2 in case, value definition val (i, o) = foo() expanded in similar way. however, language specification states, pattern match contains lower case letters (cf. p. 114): a variable pattern x simple identifier starts lower case letter.

C# How do I shorten my double when I converted bytes to megabytes? -

hello made updater downloads update files used bytes indication now found way convert megabytes, works 1 little problem returns huge numbers example, file 20mb displayed : 20.26496724167345 mb how make number bit shorter 20.26mb this code converts mb : static double b2mb(long bytes) { return (bytes / 1024f) / 1024f; } you can use math.round round specified number of digits. if want two, in case, use so: math.round(inputvalue, 2); . code this: static double b2mb(long bytes) { return math.round((bytes / 1024f) / 1024f, 2); } note: because floating point numbers don't have infinite precision, may result in 24.24999999999999999 instead of 24.25. method worth knowing, if you're outputting string, should @ using formatting strings, other answers do.

gps - android publishing: app not compatible with many devices -

i publishing gps based app api 11+.i tested , developed on asus tf201(the notorious prime) , htc , samsung phones. in publish page-> device compatibility shows app not compatible tf201, while being compatible tf300, tf700 , tf201. experience, these devices have pretty same hardware , software, why tf201, tf300tg , tf101g excluded? because tf201 had gps removed specs list shortly after launch?(alum. body->no gps) can still used bluetooth antena, why exclude? also, tf300tg have functioning gps why incompatibility? writing google this, meanwhile want know if else encountered it google determines if application compatible devices based on android manifest . gps requires permission. android manifest doesn't specify need either bluetooth or gps , google server assumes need both application work. server makes sure conditions in manifest file satisfied. hence tf201 included in incompatible list.

c++ - Creating parallel threads using Win 32 API -

here problem: have 2 sparse matrices described vector of triplets. task write multiplication function them using parallel processing win 32 api. need know how i: 1) create thread in win 32 api 2) pass input parameters it 3) return value. thanks in advance! edit: "process" changed "thread" well, answer question createprocess , getexitcodeprocess . but solution problem isn't process @ all, it's more threads. , openmp more suitable mechanism creating own threads. if have use win32 api directly threads, process like: build work item descriptor allocating memory, storing pointers real data, indexes thread going work on, etc. use structure keep organized. call createthread , pass address of work item descriptor. in thread procedure, cast pointer structure pointer, access work item descriptor, , process data. in main thread, call waitformultipleobjects join worker threads. for greater efficiency, can use windows thread pool

Counting records separated by CR/LF (carriage return and newline) in Perl -

i'm trying create simple script read text file contains records of book titles. each record separated plain old double space ( \r\n\r\n ). need count how many records in file. for example here input file: record 1 text record 2 text ... i'm using regex check carriage return , newline, fails match. doing wrong? i'm @ wits' end. sub readinputfile { $inputfile = $_[0]; #read first argument commandline filename open inputfile, "+<", $inputfile or die $!; #open file $singleline; @singlerecord; $recordcounter = 0; while (<inputfile>) { # loop through input file line-by-line $singleline = $_; push(@singlerecord, $singleline); # start adding each line record array if ($singleline =~ m/\r\n/) { # check carriage return , new line $recordcounter += 1; createhashtable(@singlerecord); # send record make hash table @singlerecord =

Android Bluetooth Discovery Only Devices using my App -

is possible limit results of startdiscovery() ? giving results clients using app ? in app users can servers or clients.. not asking code, want know if possible , maybe aim me right method. ;) no may not possible limit bluetooth search yes possible connect device using android application possible through making connection through secure socket using uuid. more refer link !

java - 3d array An exception occurred processing JSP page -

i'm trying create 3 dimensional array values database, i'm getting error doesn't tell me much. idea can be? db_pstacknr string formed numbers (2,3) db_stackvalue string formed 48 elements (a,b,c,d,empty) org.apache.jasper.jasperexception: exception occurred processing jsp page /license/console.jsp @ line 51 (multi[i][j][n] = stackvalue[k];) int stacknr = 2; string [] ar_pstacknr = db_pstacknr.split(","); string [] stackvalue = db_stackvalue.split(","); string [][][] multi = new string [stacknr][][]; int [] pstacknr = new int[ar_pstacknr.length]; int palet = 16, m=0, n=0; for(int = 0; < stacknr; i++) { pstacknr[i] = integer.parseint(ar_pstacknr[i]); for(int j = 0; j < pstacknr[i]; j++) { if (i > 0) { palet += 16; m +=16; } for(int k = m; k < palet; k++) { multi[i][j][n] = stackvalue[k]; n++; out.println(multi[i][j][n]); } } }

build - Importing a makefile inside Eclipse - symbols could not be resolved -

i'm trying import existing project eclipse. did following steps: - downloaded source repository. - ran ./autogen.sh - ran ./configure - selected makefile project existing code eclipse file menu the class files grouped type (.h , .cpp) , can reach .cpp .h pressing ctrl+tab , vice versa. when press build, building starts , works fine. if put syntax errors inside file make returns error. however eclipse's intellisense reports many error "function snprintf not resolved", , "symbol 'null' not resolved". how can hide/resolve these errors? import procedure incomplete? you should add /usr/include path (see http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/tasks/cdt_t_proj_paths.htm ) or tune discovery options ( http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/reference/cdt_u_newproj_discovery_options.htm?cp=11_4_6_8_2_2 )

ssh - Public key authentication issues on cygwin -

i've been trying "ssh localhost" on cygwin (i use windows 7), keeps asking password. when did "ssh -vvv localhost", found out public key authentications not happening (or failing). hence, asking password. debug1: authentications can continue: publickey,password,keyboard-interactive debug3: start over, passed different list publickey,password,keyboard-interactive debug3: preferred publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: next authentication method: publickey debug1: offering rsa public key: /home/xxxxxxxx/.ssh/id_rsa debug3: send_pubkey_test debug2: sent publickey packet, wait reply debug1: authentications can continue: publickey,password,keyboard-interactive i'm not sure if unable read authorized_keys file, or if there timeout issue this, or did authentication fail? there way more details? i have done follo

cuda - A mix of c++ and cublas code isn't compiling -

so have code that's suppose compute dot product of matrix in different ways (one of use blas in c++), when try use nvcc compile code, doesn't work , says have undefined reference ddot. weird because i'm pretty sure i'm using calling notation referenced here cublas: http://www.sdsc.edu/us/training/assets/docs/nvidia-03-toolkit.pdf can me? here's snip of code i'm having trouble with: #include <cublas.h> //just included files here. no problems these #include <fstream> #include <string> #include <sstream> using namespace std; extern "c" //this mention cublas functions external. //i think necessary since have cuda pieces of code { double cublasddot_(int *n, double *a, int *inca, double *b, int *incb); void cublasdaxpy_(int *n, double *a, double *a, int *inca, double *b, int *incb); } //stuff happens here c[i][t]=cublasddot_(&n, parta, &inca, partb, &incb); //this piece of function , compiler chokes t

Android Studio won't start a new project -

this question has answer here: android studio - sdk out of date or missing templates 9 answers i installed android studio ide... after click "new project" error saying sdk version out of date or i'm missing templates, please make sure have version 22! updated android sdk tools version when had adt bundle. should do?? in android studio, go configure -> project defaults -> project structure -> platform settings (sdk) choose android sdk, set build target , click on apply.

php - Are Three internal style sheets and no script tag right way for my webpage? -

i having 3 internal style sheets , 1 external style sheet in web page. simplified output looks this: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>some title</title> <!--this normal external stlesheet--> <link rel="stylesheet" type="text/css" media="all" href="http://localhost/wp-content/themes/my_theme/css/style.css" /> <!--will display single column instead 2 columns if no js enabled--> <noscript> <style type="text/css"> .col1{ width:100%; margin:0px; display:block; position:relative; } </style> </noscript> <!--this dynamic stylesheet generated php--> <style type="text/css"> #blogwrapper{ width: 530px; margin-left:6px; } </style> <!--this dynamic st

php - Magento Image upload using import / export does not work. It upload all the information except images -

i have created 1 product , want copy same product , information products title changed picture , other details remains same so have downloaded product have created , using csv file format , have uploaded magento backend , worked , sucessfully uploaded file copied data export file however though have given same image path generated export file , did not copy image , other products online without image! /k/i/test.jpg above path magento gave me when exported original product , wont work when upload again anyone can solve mystery ? for importing images, follow steps 1) images should kept in (your store directory)/media/import , if 'import' directory not exist, create one. 2) suppose images named 'test.jpg', copy image in /media/import, , write path '/test.jpg' in csv used importing, don't forget forward slash. 3) if want can create directory inside 'import', suppose created directory 'catalog', path '/catalog/test

asp.net - Why isn't my code-behind working properly? -

Image
here's code-behind file web form. can't arguments work form. protected void btn_submit_click(object sender, eventargs e) {//enter arguments here... } protected void btn_clear_click(object sender, eventargs e) { response.redirect("~/contentrequest/bmc_pr_event.aspx", true); } protected void showform() { open.visible = true; success.visible = false; failure.visible = false; } protected void showsuccess() { open.visible = false; success.visible = true; failure.visible = false; } protected void showfailure() { open.visible = false; success.visible = false; failure.visible = true; } } here's code i'm trying work with... <asp:button tabindex="12" text="submit request" id="button1" cssclass="submit" onclientclick="return validateform();" runat="server&

Pagination in application which use firebase.com as database -

front end application use firebase.com database. application should work blog: admin add / remove posts. there "home" page show several articles per page "next" , "prev" buttons , page show single article. also need deep linking. i.e. when user enter url http://mysite.com/page/2/ need application show last articles 10 20, when user enter url http://mysite.com/page/20/ application show last articles 200 210. usual pagination. main question - possible achieve if use firebase.com. i read docs @ firebase.com, read posts here. "offset()" , "count()" in future, use priority, in order know count of items , not load of them use additional counter. based on suppose this: add post action: get value of posts counter set priority new post data equals value of posts counter increase value of posts counter delete post action get value of priority post data query posts data have value of priority more priority post data

Add new record to the table by click on the button in Microsoft Access -

in ms access form want implement separate button, adds new record table. in order added button , attached button event: private sub btnaddrec_click() refresh codecontextobject on error resume next docmd.gotorecord , , acnewrec if err.number <> 0 btnaddrec.enabled = false end if end end sub everything ok when open window , click btnaddrec button, problem when first of perform navigation through existed records , after click on button. got runtime error: 2105: «you can't go specified record. may @ end of recordset» . how solve issue, need have ability add new record on click on specific button, no matter, have walked or not walked through records before. thanks. i created simple form field call description (and autonumber) , created button code follows click event. filled number of records , navigated through them, clicked addnewrec button. form navigated new record without issues. able click addnewrec button directly after

javascript - Change div id on click -

i have few 'headlines' which, when clicked, them expand/change colour etc. shtere way of changing div on click of 1 of headlines whichever 1 click have it's properties changed. 1 problem need single instance...when click on 'headline' after clicking 1 previously, 1 clicked before hand need changed back. so...if 'current' 1 have clicked: <script> function clickedheadline() { document.getelementbyid('current').style.width="auto" document.getelementbyid('current').style.backgroundcolor="#999" } </script> maybe can run script before 1 above tell div has id 'current', change , run above script... i don't think i've explained hope can i'm trying do. saves me making function every time make headline along id's, it'll extremely confusing after while. i agree case sensitive , think better add objet want modify : function clickedheadline(o) { o.style.width=&q

ajax - Sending an image as attachment in a php form -

i have php form, i'm trying image attachment, did fixing code 1. i'm not sure if send image (because had problams it).. 2. problam noting shown in page when open in server index.php not button... here code: <?php include_once("functions.php"); // process $action = isset($_post["action"]) ? $_post["action"] : ""; if (empty($action)) { // send contact form html $output = "<form action='#' style='display:none'> <input type='file' id='image' name='image' maxlength=50>"; } require("class.phpmailer.php"); $email_to = "someone@gmail.com"; // 1 recieves email $email_from = "someone@someone.net"; $dir = "uploads/$filename"; chmod("uploads",0777); function uploadimage($image) { if ((($_files["image"]["type"] == "image/gif") || ($_files["image"]["

events - how to invoke a method from an Entry Widget in Ruby Tk -

i'm looking option or way bind event, invokes method entry-widget. like command option button-widgets: command { method } or like binding event combobox-widgets: $combobox.bind("<comboboxselected>") { method } now i'm looking similar entry-widgets. want invoke method every time entry (value) has been edited. that's initial situation: $foo = tkvariable.new $entry = tk::tile::entry.new(parent) { validate 'key'; validatecommand method; textvariable $foo } validatecommand works @ first time. if change content of widget during validation callback , still want have validation callback applied in future, must re-apply validation callback. documented (for core tk version of this, see the end of validation section of entry docs) pretty obscure, fair. use tk::after.idle schedule code reapply validation callback inside validation callback .

Jquery making things happen while side scrolling (scrollto.js) - only works if scrolling slowly -

on horizontal parallax site using jquery scrollto(awesome...) attempting use windowsize values , scrollleft values in making decisions knowing current page width - if resized. that's working. when window widths hit or moved through while scrolling left right, want set value on nav items provide guidepost next mark. using alerts/test codes shown below verify points hitting. , - if scrolling slow. any ideas on catching these numbers cleanly , reliably? seems it's firing fast jquery not getting it. or not viewing correctly? function parallaxscroll(){ var scrolledx = $(window).scrollleft(); var windowsize = $(window).width(); var win0 = 0; var win1 = windowsize; var win2 = windowsize * 2; var win3 = windowsize * 3; if (scrolledx == win1) { $("#test").text("mark1"); } if (scrolledx == win2) { $("#test").text("mark2"); } if (scrolledx == win3) { $("#test

iphone - Safe to use Regex for this? (HTML) -

i'm parsing html, , need html in body tag. target string this: <body><div><img src="" />text etc</div></body> however, need: <div><img src="" />text etc</div> my target string begin , end body tags. however, there repeated warning of not use regex parse html, not have viable solutions available, besides regex @ moment. question: there safe regex(s) use in case? or should forget it? you didn't show regex is, it's not safe using dom parsing if it's simple as: <body>(.*?)</body> ...because it's possible </body> contained in attribute string or comment. if you're willing take risk, you'll fine. there's no reason shouldn't able use dom parsing , text of body, though, except less efficient. you skip regex , find string indices of <body> , </body> , substring between them. should faster. by way, not parsing html; you&#

Creating my first Unix Server/Client but getting a "shmget: Invalid argument" error and possibly more. [C] -

i doing unix, c assignment. creating server , client interact each other. not experienced tcp/ip programming apologize being slow in advance. first, trying create basic layout of set up. compile client , server using makefile , works perfectly. however, when execute server, error: shmget: invalid argument i think problem ipc resources. supposed remove ipc resources using atexit() don't think doing right. here code server.c if helps: #include "server.h" int shmid, semid; struct shared *shm; int main() { key_t shmkey = 0x6060, semkey = 0x6061; char *s, c; unsigned short zeros[2] = {0, 0}; int srvrfd, clntfd, clntadrlen, i; //socket struct sockaddr_in srvraddr, clntaddr; char buf[256]; if(atexit(server_exit) != 0) { perror("failed attach atexit()"); _exit(exit_failure); } /* create array of 2 semaphores key. */ semid = semget(semkey, 2, 0666 | ipc_creat); if (semid < 0) {

actionscript 3 - AS3 setChildIndex -

i'm making book page flipping effect (i have flipping right page until now), , i'm having problem index, because page flip doesnt stay on top of others. i tried writing setchildindex(cont, this.numchildren -1) not working! import fl.transitions.tween; import fl.transitions.easing.*; import fl.transitions.tweenevent; import flash.display.sprite; var cont : displayobject; var imgloader : loader; (var i:int=0; i<=4; i++){ imgloader = new loader(); imgloader.contentloaderinfo.addeventlistener(event.init, onloadjpeg); imgloader.load(new urlrequest(""+i+".png")); } function onloadjpeg (e : event) : void { cont = e.target.loader; cont.x =300; cont.y =65; cont.width = 286/2; cont.height = 406/2; addchild(cont); cont.addeventlistener(mouseevent.mouse_up, flippage); } function flippage(e:mouseevent):void{ setchildindex(cont, this.numchildren -1); var mytween:tween = new tween(e.currenttarget,

DICOM to grayscale in matlab -

how can convert dicom image grayscale image in matlab? thanks. i'm not sure specific dicom image talking not grayscale already. following piece of code demonstrates how read , display dicom image: im = dicomread('sample.dcm'); % im of type uint16, in grayscale imshow(im, []); if want uint8 grayscale image, use: im2 = im2uint8(im); however keep of precision possible, it's best do: im2 = im2double(im); to stretch limits temporarily when displaying image, use: imshow(im2, []); to stretch limits permanently (for visualization not analysis), use: % im3 elements between 0 , 255 (uint8) or 0 , 1 (double) im3 = imadjust(im2, stretchlim(im2, 0), []); imshow(im3); to write grayscale image jpg or png, use: imwrite(im3, 'sample.png'); update if version of matlab not have im2uint8 or im2double , assuming dicom image uin16 quick workaround convert dicom image more manageable format be: % convert uint16 values double values % im =

bash - How to rearrange text file output result -

i write unix script following have ff result: textfile1 contains following text: keyval1,1 keyval1,2 keyval1,3 keyval1,4 keyval2,1 keyval2,2 keyval3,1 keyval4,1 keyval4,3 keyval4,4 expected result: keyval1 (1,2,3,4) keyval2 (1,2) keyval2 (1) keyval4 (1,3,4) thank you. i'm new unix , have done far. it's not working yet though :( #!/bin/ksh f1 = 'cut -d "," -f 1 keyval.txt' f2 = 'cut -d "," -f 2 keyval.txt' while f1 <> f2 echo f1 "("f2")" done > output.txt you can in breeze using awk : #!/usr/bin/awk -f begin { fs = "," closebracket = "" } { if (key != $1) { key = $1 printf "%s%s (%s", closebracket, key, $2 } else { printf ",%s", $2 } closebracket = ")\n" } end { printf "%s", closebracket

Different ways of declaring arrays in VB.NET -

in vb.net, there difference between following ways of declaring arrays? - dim cargoweights(10) double - cargoweights = new double(10) {} ' these 2 independent statements. not supposed execute 1 after other. as far know, first 1 declares array variable holds value 'nothing' until array object assigned it. in other words, not initialized yet. but second statement? "=" sign means variable being initialized , won't hold 'nothing'? going point one-dimensional array of eleven default double values (0.0)? edit: according msdn website: the following example declares array variable not point array. dim twodimstrings( , ) string (...) variable twodimstrings has value nothing. source: http://msdn.microsoft.com/en-us/library/18e9wyy0(v=vs.80).aspx both dim cargoweights(10) double , cargoweights = new double(10) {} initialize array of doubles each items set default type value, in case, 0.0. (or nothing if string data

java - how to have an external Jar or windows .exe made from an external jar download a file from the internet and write to the hard disk? -

i trying make external jar or windows .exe (i know how make both of those) need know how write hard disk commonly known c drive i not sure if got question correct here explanation. jar file contains byte code. if go , open jar find .class files rather .java files. jar file executable file(if not can set executable bit 1). there no .exe file in java. makes java platform independent. if want execute program run jar file java program. $>java -jar [jar file name] now if meant converting jar file contents(.class files) source code(.java files) not possible(similar cant find source code .exe file). common sense dictates why want have source code of application has developed.unless of-course foss in case have source code download separately.to know byte code , how works can refer link .

meteor - Handlebars and MeteorJs for every other or number -

i'm trying create handlebars.registerhelper() wrap {{>template}} in {{each items}} every number enter. so this; {{forevery items 4}} {{> item_row_template}} {{/forevery}} the desired result every 4 items wrap around div. <div class="row"> <div class="item_1">item</div> <div class="item_2">item</div> <div class="item_3">item</div> <div class="item_4">item</div> </div> <div class="row"> <div class="item_1">item</div> <div class="item_2">item</div> <div class="item_3">item</div> <div class="item_4">item</div> </div> etc... what want create helper iterate on list , manually append divs every often. here example: handlebars.registerhelper('forevery', function(context, limit, options) { var

resize - How do I make add_image_size thumbnails percentages in php? -

in theme-functions.php file, have add_image_size('ad-medium', $width = 250, $height = 250, true ); this determines size wordpress creates 'ad-medium' thumbnails. changes code determine shown on website instantly. so if change 250 100, width reduced 100px. unfortunately, has 3 problems: this changes dimensions of future upload resizing ad-medium, that's out of question. the height ignored - can't warp - stays 1:1 aspect ratio no matter what. i can't write 100%. percentage sign not understood. in context, code is: <?php } // activate theme support items if (function_exists('add_theme_support')) { // added in 2.9 // theme uses post thumbnails add_theme_support('post-thumbnails', array('post', 'page')); set_post_thumbnail_size(100, 100); // normal post thumbnails // add default posts , comments rss feed links head add_theme_support( 'automatic-feed-links' ); } // setup di

ios - With YRDropdownView, when I present it after a refresh it gets caught at the top of the screen, and can't be seen -

i'm using yrdropdownview present notifications in app, in case when try manually trigger data refresh notify them there's no internet (if there isn't). this refresh triggered pull refresh gesture (namely native 1 apple introduced in ios 6) fires refresh method have, , in there check if there's internet. if there's not, present notification. but method fires when user pulls screen down, notification appears there, , when scroll see it. how can attach more below navigation bar? i'll include whatever code requested, of right can't think of that's relevant , more of general purpose question. present notification standard method github page, , refresh standard refresh controller ios 6 on table view controller.

sql - how to fetch number of records based on changing column value -

i having leave table following empid leavedt appdt leavetype ------ ------- ------- --------- e1 10-3-13 5-3-13 cl e1 11-3-13 5-3-13 cl e1 12-3-13 5-3-13 cl e1 13-3-13 5-3-13 sl e1 14-3-13 5-3-13 sl e1 15-3-13 5-3-13 pl e1 16-3-13 5-3-13 cl e1 17-3-13 5-3-13 cl e1 18-3-13 5-3-13 pl e1 19-3-13 5-3-13 pl e1 20-3-13 5-3-13 cl now want fetch record in want show how many times , how many days employee e1 has taken each type of leave. above example query result should :--- empid leavetype ----- ----- ------ --------- e1 10-3-13 12-3-13 cl e1 13-3-13 14-3-13 sl e1 15-3-13 15-3-13 pl e1 16-3-13 17-3-13 cl e1 18-3-13 19-3-13 pl e1 20-3-

.htaccess rewrite / to index.html, all other to index.php -

i want use .htaccess rewrite url webite: if url http://mydomain.com or http://mydomain.com/ index.html serve request, other urls go index.php please help! quite simple, in 2 rules. 1 rule root ( ^$ , matches empty string after leading request_uri slash), , rest other routes ( (.+) , matches 1 or more characters): rewriterule ^$ index.html [l] rewriterule (.+) index.php [l] note : leading slash not appear in source pattern. why first rule checks empty string.

why is Hashtable not a part of Java Collection framework? -

i work in non multi threaded environment go hashmap instead of hashtable. know difference between both , know hashtbale introduced way before java collection framework introduced. if go through hashtable source code can find public class hashtable<k,v> extends dictionary<k,v> implements map<k,v>, cloneable, java.io.serializable {... my point hashtable introduced way before java collection framework(so way before map introduced). since hashtable implements map, hashtable implementation has been modified.my questions why hashtable not part of java collection framework when map is? hashtable introduced part of java 1.0 didn't use map. in version 1.2, changed implement map , hence, became part of collections framework. http://docs.oracle.com/javase/7/docs/api/java/util/hashtable.html

jquery - JavaScript - Passing Arguments to Anonymous Functions -

i'm calling anonymous function: closesidebar(function() { alert("function called"); $(this).addclass("current"); settimeout(function(){opensidebar()}, 300); }); but $(this) doesn't work expected , need pass argument function. after bit of research thought work: closesidebar(function(el) { $(el).addclass("current"); settimeout(function(){opensidebar()}, 300); })(this); but doesn't. how add arguments anonymous function? jsfiddle - click button on right, animates in calls function above. when button has class "current" have white bar on left side of button class never changes. you can this: closesidebar(function(el) { $(el).addclass("current"); settimeout(function(){opensidebar()}, 300); }(this)); the arguments need passed anonymous function itself, not ca

android - getCheckedItemIds().length don't return correct value -

i have read topic whats equivilent of getcheckeditemcount() api level < 11? lv.getcheckitemids().length can correct sum of checked items, lv.getcheckeditemids().length can't, why? thanks! private void initlistview(int pos) { list<string> msglist = getsms(pos); arrayadapter<string> adapter2 = new arrayadapter<string>(this, android.r.layout.simple_list_item_multiple_choice, msglist); lv.setadapter(adapter2); lv.setchoicemode(listview.choice_mode_multiple); lv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) { setselectedandtotal(); } }); } private void setselectedandtotal(){ selectedandtotal.settext(lv.getcheckitemids().length + "/"+lv.getcheckeditemids().length+ "/" + lv.getcount()); } public long[] getcheckitemids (

jquery - How to tell Chrome, please use local javascript from the browser for every site or any actions? Similar to Opera -

i using chromium / google chrome browser in ubuntu desktop. testing reason, need run javascript browser not website server javascript code. is there way in chrome can attach source, executed anytime when browser go web page? $("#id").find("div").find("li").find("p").find("b").html(" adult scene deleted "); this not run server scripts, js file want embed in browser. (like believe opera has feature, how such in chrome?) i don't think there possible way that, can create bookmarklet in chrome, or other modern browser (like firefox). here's how it: create local html page anchor tag following in it: <a href='javascript:$("#id").find("div").find("li").find("p").find("b").html(" adult scene deleted ");' target="_blank">the link&#60/a> then, drag link bookmarks bar when open webpage in chrome. now, when click o

dev c++ - Trying to open a file that doesn't exist prevents subsequent opening in dev-C++ -

i trying execute simple piece of code in dev-c++: int fflag, num; char nomefile[40]; fstream str; fflag=0; while (fflag==0) { cout<<"\nfile name? "; cin>>nomefile; str.open(nomefile,ios::in); //checking if file exists if (str) { fflag=1; str>>num; // reading value , sending standard output cout<<num<<"\n"; } else { cout<<"\nfile doesn't exist! "; } } if try open existing file, there no problem. if try open file doesn't exist, receive error message (file doesn't exist) subsequent trial open existing file (i mean in same loop) fail producing same error message. i tried add close instruction after detecting not-existing file, doesn't solve problem. don't understand! seems that, if try open not existing file, subsequent retrial (with str.open) returns null pointe

c# - Copy executing files from a UNC path -

i writing application needs copy files network directory, files executing. i have tried opening file with using (var source = new filestream(filedata.filename, filemode.open, fileaccess.read, fileshare.readwrite)) after open file stream create stream copy into. however, throws exception saying file in use process. not sure how around problem. if use file explorer copy files fine. know possible, not sure on how. edit: have tried simple file.copy(source, destination) , same exception saying file in use process. to copy file being used process, have make use of 2 services in windows, , you'll need verify these services not disabled: volume shadow copy microsoft software shadow copy provider they can left manual startup, don't need running time. for this, can use 3rd party tool. hobocopy 1 of them. start 2 services automatically when needed,

jquery - Parsing Json feed from Solr -

i'm experiencing strange behavior parsing feed solr. dont response using url1. if use url2 instead, in both cases got responses putting url directly browser. please, doing wrong? <script type='text/javascript'> var searchterms = $('#input_box').val(); var searchfield = $('#dropdown').val(); var url1 ="http://localhost:8983/solr/moogle/select?q="+searchfield+"%3a%28"+searchterms+"%29&wt=json&indent=true"; var url2 = 'http://localhost:8983/solr/moogle/select/?wt=json&json.wrf=?&q='+searchfield+':('+searchterms+')' $.getjson(url1, function(result){ alert("hello"+result.response.docs[0].title); }); </script> i found solution. it's browser cross-domain scripting issue associated running solr on different port webpage. fixed issue including json.wrf=? parameter in url: "http://localhost:8983/solr/moogle/select?q="+searchfie

ios - load different xib for iphone5 not working in device -

possible duplicate: how make xib compatible both iphone 5 , iphone 4 devices can use 2 xibs 1 viewcontroller - re: porting iphone 5 i have developed iphone app i'm trying update giving ipad , iphone5 support. there lots of posts talking how handle none of them working me. 3.5'' iphones , ipads load xib need 4'' iphone doesn't (although in simulator works fine), here how handle it: first of create 3 different xib files each viewcontroller (viewcontroller.xib, viewcontroller~ipad.xib , viewcontroller-568.xib). in 4'' xib 1 set size of view "retina 4 full screen". then have used this load appropiate xib. may relevant in appdelegate set didfinishlaunchingwithoptions this: appdelegate.m - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; nsstring *nibname = [uiviewcontrol

java - Add resources to a JAR -

i want include resources fils (images, textfiles...) in jar. added asset folder classpath, program works fine when run in netbeans. but if build project, receive error : not copying library c:\users\flow\desktop\cp , it's directory. is normal error ? so tried add assets manualy : <target name="-post-jar"> <jar destfile="dist/monprojet.jar" update="true"> <fileset dir="c:/users/flow/desktop/cp"> <include name="assets/*"/> </fileset> </jar> </target> but not work. wrong ? sorry english , thank help. don't place files on desktop. go source folder of project , copy in folder. in netbeans, resources place in src tree automatically copied on classes tree when build (or clean , build), except files matching "exclude jar file" skeletons specified in project -> properties -> build -> packaging. if

javascript - Function inside a function is not working -

i working on responsive design , made function menu change when smaller 540px (meant mobile). change cant click button , guess is because of function inside function. this part doesn't work: $('.menuknop').click(function(){ $(".menu").slidetoggle(); }); full code: checkwidth(){ var windowsize = $(window).width(); if (windowsize < 540) { $(".menu").hide(); $(".menuknop").show(); $('.menuknop').click(function(){ $(".menu").slidetoggle(); }); } else { $(".menuknop").hide(); $(".menu").show(); } } //execute function checkwidth(); $(window).resize(checkwidth); is want? working demo $('.menuknop').click(function(){ $(".menu").slidetoggle(); }); function checkwidth(){ var windowsize = $(window).width(); if (windowsize < 540) { $(".menu").hid

python - Sending binary data over a serial connection with pyserial -

i want preface noting lost right now, there may things don't make sense because have no idea i'm talking about. feel free dissect question long helpful. alright, overall project i'm working on write program in python interface custom built temperature control unit (built this chip) , copy data memory buffer data points stored. i not 1 programmed , i'm going off limited experience arduinos (also i'm new python). here of sent regarding commands interface it: #define command_ping 'p' // -> 'p' // <- 'p' uuuu // uuuu - unique number == 0x03645145 #define command_get_record_number 'i' // -> 'i' // <- 'i' nnnn // nnnn - current record number (not written yet) #define command_get_data 'd' //length 32-bit boundary // -> 'd' ssss llll // <- 'd' ddddddd... // ssss - starting address (should, don't need @ 32-byte bounda