Posts

Showing posts from January, 2015

python - AttributeError : 'module' object has no attribute 'index' -

i'm going through official tutorial provided on django's documentation site, , have encountered attributeerror. here's code i'm working : 'polls' name of application. views.py from django.http import httpresponse def index(request): return httpresponse("hello, world. you're @ poll index.") \polls\urls.py from django.conf.urls import patterns, url polls import views urlpatterns = patterns('', url(r'^$', views.index, name='index') ) urls.py from django.conf.urls import patterns, include, url django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: # url(r'^$', 'mysite.views.home', name='home'), url(r'^blog/', include('blog.urls')), url(r'^polls/', include('polls.urls')), url(r'^admin/', include(admin.site.urls)), ) error: attributeerror @ /polls 'module' object has

c# - Cannot use a boolean variable from another script Unity3d -

i have code makes object rotate, , working ok if call within script. scripta public class ship : monobehaviour { private bool torotate=false; public void enemyrotate() { torotate = true; debug.log("er "+ torotate); } void update () { if (torotate) { transform.rotatearound(player.transform.position, vector3.forward, 100 * time.deltatime); } } if call enemyrotate within scripta, sure enough rotation, , debug log shows variable has been set true. if call function this: script b public class projectile : monobehaviour { public ship ship_object; void start(){ ship_object=gameobject.addcomponent<kanaship> (); } void callfunction(){ ship_object.enemyrotate() } } if call callfunction, debug log saying variable has been set true, rotation animation not working @ all. have tried different variants of cannot figure out im doing wrong. have used public boo

ios7 - what does middle guard protection failed %d mean? -

when build app actual iphone debug area shows this: [allocator] middle guard protection failed %d [allocator] allocator invalid, falling malloc it shows 2nd line total of 30 times. have no idea means or how fix it. not show when build simulator. i having issues getting state preservation work using storyboards , restoration id's , have feeling has memory issue it's dumping memory , therefore no app restoration. basically, when go app shows me last screen on second , goes root page. anyway, i'd fix malloc stuff can @ least rule out culprit, plus don't want have issue memory in general... i've been googling couple of weeks , can't find anything! looks it's issue crashlytics framework. have same issue, , commenting api call: [crashlytics startwithapikey:api_key]; removes warning.

javascript - Typescript error runtime error: Cannot read property 'prototype' of undefined when extending -

so i'm getting above error in console. it's caused _super being undefined when it's passed __extends (in generated .js ). here's test code can used reproduce error: //this entirety of file test.ts module test { export class test1 { public name: string; public number: number; constructor() { } } } then in separate file have class inherits one: /// <reference path="test.ts" /> module test { export class test2 extends test1 { constructor() { super(); } } } the <reference path... shouldn't needed (and isn't), added see if helped (it didn't). the files included in correct order ( test.ts test2.ts ) via bundleconfig (running or without optimisations doesn't have effect). i being giant noob, haven't slightest clue i've messed up. other instances of problem i've found online folks using command line compiler combine multiple typescr

Executing a python script -

i biologist trying run particular script ( http://www.ricediversity.org/tools/code/plumage%20script%202%20f2%20populations.zip ) on data-set. have installed python 3.4, panda 0.14.0 , numpy dependecies on windows 7 laptop instructions demand. data set in excel file. how go forth applying script data? have no experience python scripts/ program. thank time. python plumage2_for_f2.py -h should give usage information. (being on windows, invoking plumage2_for_f2.py not work on unixoid system, sure preface commands python , above.) file (as supplied -i option) have csv (comma-separated values), can export excel (i not know current version of excel, should save as, or export).

jquery - During the ajax call url get distrubs -

i have following url var url ="cruuntest/contactgrabber/getdata?code=4/8kxuru8wyruzruypeexo9wom0boi.yvd5wc6y5riwenp6uapfm0h6lj2rjqi" and doing $.ajax({ type: "post", url: url, success: function (obj) { $contactimporter.createcontactgridmodel(obj); }, error: function (xhr, ajaxoptions, thrownerror) { alert('error = ' + xhr.responsetext); } }); but redirects http://localhost:80/cruuntest/contactgrabber/index/cruuntest/contactgrabber/getdata?code=4/8kxuru8wyruzruypeexo9wom0boi.yvd5wc6y5riwenp6uapfm0h6lj2rjqi i not know why? have hosted application on iis 8. when running code wihout hosting in iis works fine. you running ajax call page: /cruuntest/contactgrabber/index and appends query url: /cruuntest/contactgrabber/index (appended here, seeing) you need start '/' start of url, this: /cruuntest/contactgrabb

html - How can I hide with CSS only? -

i have below code in document don't control. have option upload 1 custom css file overrides. how can accomplish this? rid of vendor link on our site. css, have set tricky. <div style="display:block !important;text-align: center !important; padding: 15px; visibility:visible !important; opacity:1 !important; height:auto !important; width:auto !important; op:auto !important; bottom:auto!important; left:auto !important; right:auto !important;"> <a href="http://vendorsite.com" target="_blank" style="display:inline !important; font-size: 11px !important; visibility:visible !important; position:relative !important; opacity:1 !important; height:auto !important; width:auto !important; top:auto !important; bottom:auto!important; left:auto !important; right:auto !important;"> powered vendor site </a> </div> no, not possible pure css, !importants declared in html override css, unless

Insert multiple values in php mysql -

i have here sample code updating multiple value in php mysql. wondering how can insert multiple values? <?php include('connect.php'); $column1=$mysqli->real_escape_string($_post["column1"]); $column2=$mysqli->real_escape_string($_post["column2"]); $counter=$mysqli->real_escape_string($_post["counter"]); $n = count($counter); for($i=0; $i < $n; $i++) { $result = $mysqli->query("update table set column1='$column1[$i]', column2='$column2[$i]' counter='$counter[$i]'"); } ?> use standard mysql insert statement mysqli bind_param , php's call_user_func_array. $n = count($_post['counter']); $query = "insert table (column1, column2) values (?,?)". str_repeat(',(?,?)', $n-1); $st = $mysqli->prepare($query); $placeholders = str_repeat('s', $n*2); $params = array($placeholders); foreach($_post['col

string - Valid printf() statements in C -

given that: char *message = "hello, world"; char *format = "x=%i\n"; int x = 10; why printf (message); invalid (i.e. rejected compiler being potentially insecure) , printf (format, x); isn't? is format treated string literal in case , message format string? if so, why? update know why printf (message); rejected. question is, why printf (format, x); not rejected too. i'm using clang. error message printf (message); format string not string literal (potentially insecure) . it compiles fine under gcc. appear compiler specific , how clang sets warnings. you can warning in both cases enabling -wformat-nonliteral option, not included in either -wall or -wextra (but is in -weverything ). for whatever reason, seems intentional design decision emit security warning when non-literal printf statement takes no additional arguments. source code emits warning can found in lib/sema/semachecking.cpp : // if there no argument

jquery - Django ajax request fails with internal server error -

im trying ajax request django interal server error 500..surprisingly request going server fails when tries return response guess.. here view views.py @csrf_exempt def getproductinfo(request): to_json = {'name':'test'} print "value of = ", to_json try: json_response = simplejson.dumps(to_json) except (typeerror, valueerror) err: print 'error:', err print 'json_response = ', json_response return streaminghttpresponse(json_response,content_type='application/json') ajax call $.ajax({ async:false ,url:'/getproductinfo' ,type: 'post' ,data: {session_id: '{{request.session.sessionid}}'} ,success: function(msg){ alert('success') } ,error: function(msg){ alert("it erroed out") } }) urls.py url(r'^getproductinfo'

pdf - Play framework 1.2.4 using header footer template -

how header footer template used render pdf in play framework? i trying below code - options.header_template = "/header.html". no matter path give html gives me file not found error. please suggest possibly mistaking? it should options.header_template = "controllernamedfolder/header.html". controllernamedfolder under app/views. anyway...

mysql - Need an alternate Solution--instead of calling php code from a trigger -

i having 2 table consider table1 , table2... i need trigger after inserting table1.. trigger has thing like retrieving data 2 other tables using select query(it retrieves more 1 row) calculations data retrieved , need insert table2 single row.. think not possible these in trigger ..so decided call php file trigger things.. persons says calling php trigger not practically , has security risk.. i need suggestion question...please don't down vote or neglect..if question unclear ask me edit... a simple example out. $sql="insert `table1` (firstname, lastname, age) values ('$firstname', '$lastname', '$age')"; $result = mysql_query($sql) ; if($result) { // record inserted , place code needs executed after successful insertion } else { // insertion failed } i assume using mysqli , not mysql becuase mysql_query deprecated of php 5.5.0 example understand logic.

.net - DLL cannot be loaded even though file exists -

i'm debugging .net desktop app in visual studio 2014 ctp on windows 7 in virtualbox vm uses managed dll (probably wrapper) in turn uses unmanaged dll. both in same directory executable. managed dll loaded correctly when execution reaches line calling function it, exception shown unmanaged dll couldn't loaded: system.dllnotfoundexception. however, when rename unmanaged dll , put empty file there name , extension unmanaged dll had, there exception, different one: system.badimageformatexception. why original file ignored when it's supposed loaded , how fix problem?

Does Python's imaplib let you set a timeout? -

i'm looking @ api python's imaplib . from can tell, there no way setup timeout can smtplib . is correct? how handle host that's invalid if don't want block? the imaplib module doesn't provide way set timeout, can set default timeout new socket connections via socket.setdefaulttimeout : import socket import imaplib socket.setdefaulttimeout(10) imap = imaplib.imap4('test.com', 666) or can go overriding imaplib.imap4 class knowledge imaplib source , docs, provides better control: import imaplib import socket class imap(imaplib.imap4): def __init__(self, host='', port=imaplib.imap4_port, timeout=none): self.timeout = timeout # no super(), it's old-style class imaplib.imap4.__init__(self, host, port) def open(self, host='', port=imaplib.imap4_port): self.host = host self.port = port self.sock = socket.create_connection((host, port), timeout=self.timeout)

wordpress - What is the best way to create a Ecommerce website using PHP -

maybe the question have been asked many times, , many may votes down, confused , think best place ask professionals resolve problem. i know can use wordpress, magentto, open cart or others create e-commerce site, want create ecommerce site using codeigniter.. kindly guide me better create ecommerce site using codeigniter or above mentioned tools better. being used in industry? i have never created ecommerce site far, have created ecommerce sites using wordpress themes, haven't created theme yet. i going start learning how create ecommerce site, kindly guide me start, tool need learn first? theme developement? codeigniter ecommerce ? magentto? or other? tool more beneficial me in future, , me in getting better job. many thanks i suggest go magento community edition free. you lot of benefit magento , under magento admin section have lot of configuration manage site easily. you can extension customization magento connect addition functionality enhancements.

c++ - DesktopImageInSystemMemory of DXGI_OUTDUPL_DESC -

i need variable true can use mapdesktopsurface of idxgioutputduplication how set true. previous settings can done. here link http://msdn.microsoft.com/en-us/library/windows/desktop/hh404622(v=vs.85).aspx i faced same problem...so need do: the mapdesktopsurface method of times return dxgi_error_unsupported image not in system memory, in gpu memory. in case, need transfer image gpu memory system memory . so how that? create descriptor id3d11texture2d of type d3d11_texture12d_desc . use getdesc on image( id3d11texture2d ) acquired using idxgioutputduplication::acquirenextframe fill in descriptor. this descriptor has framedescriptor.usage set d3d11_usage_default . you need set descriptor following parameters (let others remain is): framedescriptor.usage = d3d11_usage_staging; framedescriptor.cpuaccessflags = d3d11_cpu_access_read; framedescriptor.bindflags = 0; framedescriptor.miscflags = 0; framedescriptor.miplevels = 1; framedescriptor.arraysize = 1

python - ZipReplaceData.py ReplaceString -

how replace string instead of replacing entire content of hello.txt? is possible? it needs { findstring('hello'); replacestring('hello', 'goodbye'); } # file: zipreplacedata.py import chilkat # open zip, locate file contained within it, replace # contents of file, , save zip. zip = chilkat.ckzip() zip.unlockcomponent("anything 30-day trial") success = zip.openzip("exampledata.zip") if success: # zip in example contains these files , directories: # exampledata\ # exampledata\hamlet.xml # exampledata\123\ # exampledata\aaa\ # exampledata\123\hello.txt # exampledata\aaa\banner.gif # exampledata\aaa\dude.gif # exampledata\aaa\xyz\ # forward , backward slashes equivalent , either can used.. zipentry = zip.firstmatchingentry("*/hello.txt") if (zipentry != none): # replace contents of hello.txt else. newcontent = chilkat.ckstring() newcontent

angularjs - Proper way of testing directives -

let's i've built simple directive: moment = require 'moment' # can see i'm using browserify ### whenever mouse hovered, shows relative time ### app.directive 'simpledirective',-> restrict: 'e' scope: date:'=' template: "<div class='nice-date' date='date' ng-mouseenter='hover = true' ng-mouseleave='hover = false'>{{nicedate}}</div>" controller: ($scope)-> $scope.$watch 'hover',-> $scope.nicedate = if $scope.hover moment($scope.date).fromnow() else '' now, can test if directive compiles, using test this: describe 'simpledirective test', -> $compile = $rootscope = undefined beforeeach module('myapp') beforeeach inject (_$compile_, _$rootscope_) -> $compile = _$compile_ $rootscope = _$rootscope_ 'replaces element appropriat

email - what advantage postfix have over gmail server -

i configured auto mail sender in ruby on rails ,set send use gmail(the gmail account , password there in ruby code) then boss ask me change use postfix... somehow lost in configure postfix send mail. what's advantage of postfix on gmail? avoiding "gmail" (external email provider) provides: better privacy protection avoiding gmail removes unnecessary sending , receiving hop inside nsa.gov(.us) country in gmail case better trouble shouting debugging delivery problems simpler in email server under admins control imho : using own email server choice companies except (very) small ones. running email server pretty cheap medium size companies. "gmail" (external email provider) may better choice when semi competent email postmaster skills unavailable @ acceptable price , privacy expectations moderate or less. it not "one choice fits everyone" situation.

c - What is the behaviour of an mmap()'ed pointer after closing the file descriptor without first calling munmap()? -

consider following code fragment: #include <stdio.h> #include <unistd.h> #include <sys/mman.h> #include <fcntl.h> int fd = open( "/path/to/existing/file/or/device", o_rdonly); int numberofwords = 4096; // chosen smaller file size int* data = mmap( null, nomberofwords * sizeof(int), prot_read, map_shared, fd, 0); if (data != map_failed) { printf( "%d\n", data[0]); // oops, forgot munmap close(fd); printf( "%d\n", data[0]); // <-- why doesn't segfault } background i working custom kernel driver uses ioctl() setup dma, , requires user space use mmap() access particular buffer. while developing unit tests discovered accidentally after closing file descriptor without calling munmap first, still possible access buffer memory in user space mmap'ed pointer. thinking there bug in driver wrote small program similar shown here exercise mmap() "normal" file. what expecting see seg

css - Create separate line for specific use -

i wanted create separate line , and use of hr tag the problem want apply specific line , not line, how can this? hr { border: #333333; height: 2px; background-color: lightgray; } is want: html: <div>abc</div> <hr class="red" /> <div>def</div> <hr /> <div>ghi</div> css: .red{ border:1px solid red; } hr{ border:1px solid black; } fiddle demo

How to display text in html/javascript/jQuery identical in firefox and explorer? -

this question regarding html, javascript and/or jquery. not have experience in latter 2 techniques. the following code pieces show text 'browse' single word on browser. on firefox (30.0) text shown underlined link, while on windows explorer (version 11) underline missing. how must change code text underlined in windows explorer? the main html code here: <head> <title>test</title> <script type="text/javascript" src="jquery-1.4.4.min.js"></script> </head> <body> <link type="text/css" rel="stylesheet" href="jquery.fileinput.css"/> <script type="text/javascript" src="jquery.fileinput.js"></script> <script> $(document).ready(function(){ $('.browse').customfileinput().change(function(){ }); $('.customfile-button').wrap('<a href="#">'); $('.browse').each(

javascript - Set vwashape hyperlink programmatically -

is possible programmatically set hyperlink of vwashape in javascript? know there method links(vwashape.gethyperlinks()) there set method or need upload visio file visio, change links , reupload again? ok after struggling found solution. because didnt found way set hyperlinks on object. used vwacontroll.addhandler onselected bypass problem. vwacontrol.addhandler("shapeselectionchanged", onshapeselectionchanged); ... onshapeselectionchanged = function(source, args) { try { var shape = vwashapes.getitembyid(args); var linkarr = shape.gethyperlinks(); (var = 0; < linkarr.length; i++) { var linkurl = linkarr[i].value; //manipulate link linkurl = linkurl.replace("origintext", "new text"); window.location.href = linkurl; } } catch(ex) { console.log("onselected " + ex); } };

Bootstrap 3 grid system - not showing as grid - what file have I missed? -

i have following in header... <!-- mobile viewport optimized --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <!-- bootstrap css --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link href="includes/css/bootstrap-glyphicons.css" rel="stylesheet"> <!-- custom css --> <link href="includes/css/styles.css" rel="stylesheet"> <!-- include modernizr in head, before other javascript --> <script src="includes/js/modernizr-2.6.2.min.js"></script> ...and following on page... <div class="container"> <div class="row"> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1">.col-md-1</div> <div class="col-md-1&quo

html - Strange behavior while using display inline-block ...why? -

html <div class="menu"> <p>normal</p> </div> <div class="menu"> <p>normal</p> </div> <div class="menu"> <p>normal</p> </div> <div class="menu"> <p>why div stays @ top</p> </div> css .menu{ width:120px; background-color:red; display:inline-block; height:400px; } http://jsfiddle.net/jezvt/ i have 4 divs aligned next each other using inline-block. when enter text inside div using p tag, div 2 lines stays @ top while other 3 divs(has 1 line text) aligned properly. help please.. add code vertical-align:top; demo

ios8 - Get Device Token in iOS 8 -

i need device token implement push notification in app. how can device token since didregisterforremotenotificationswithdevicetoken method not working on ios 8. tried code in app delegate not giving me device token. [[uiapplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings settingsfortypes:(uiusernotificationtypesound | uiusernotificationtypealert | uiusernotificationtypebadge) categories:nil]]; [[uiapplication sharedapplication] registerforremotenotifications]; read code in uiapplication.h. you know how that. first: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions add code this #ifdef __iphone_8_0 //right, point uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:(uiremotenotificationtypebadge |uiremotenotificationtypesound |uiremotenotificationtypealert) categories:nil]; [[uiapplication sharedapplication] registe

javascript - dynamic reloading of a combobx when hetting a refresh button? -

am new ajax , , i'm having trouble implement dynamic reloading of combobox when hetting refresh button. <html> <head> <script type="text/javascript"> $(function() { alert('document ready'); $('#b').on('click', function(){ alert('you clicked button'); $('#s').load(test.php); }); }); </script> </head> <body> <select name="s" id="s"> <?php $server = 'localhost'; //localhost usual name of server if apache/linux. $login = 'root'; $pword = ''; $dbname = 'item'; mysql_connect($server,$login,$pword) or die($connect_error); //or die(mysql_error()); mysql_select_db($dbname) or die($connect_error); ?> <?php $query = "select * ajax_categories"; $results = mysql_query($query); while ($rows = mysql_fetch_assoc(@$results)) {?> <option value="<?php ech

css - Gradient - Cross Browser uniformity -

Image
i testing gradient compatibility across browsers , found gradient had different effects on firefox. allow me demonstrate test. the code <html> <head> <style type="text/css"> body{ background: -moz-linear-gradient(top left , white , black 25%); background: -o-linear-gradient(top left , white , black 25%); background: -webkit-linear-gradient(top left , white , black 25%); background: -khtml-linear-gradient(top left , white , black 25%); background: -ms-linear-gradient(top left , white , black 25%); background: linear-gradient(top left , white , black 25%); } </style> </head> <body> </body> </html> results: google chrome - 35.0 firefox - 30.0 ie11 opera 22.0 safari 5.1.7 as can see gradient takes different shape in case of firefox. how overcome limitation?

php - CodeIgniter - flash session deleting all session -

i using flash data success/error messages. i experiencing issue: after set flashdata - session data deleted in few controlers, in other controlers working properly. cotroller 1: (function whre working ok) public function vymazat($id) { if(!is_numeric($id)) redirect(); $this->admin_model->delete_coupon($id); $this->session->set_flashdata('success', 'kupón bol úspešne vymazaný'); redirect('admin/kupony/zobrazit'); } controller 2: (function not working) public function vymazat($id) { if(!is_numeric($id)) redirect(); $this->admin_model->delete_order($id); $this->session->set_flashdata('success', 'kupón bol pridaný'); redirect('admin/objednavky/zobrazit'); } thanks help from codeigniter documentation: codeigniter supports "flashdata", or session data available next server request, , automatically cleared. your redi

javascript - Highcharts repeating same label value on Y Axis -

i have highcharts line graph y axis labels aren't showing decimal place large numbers. if values on 5 digits decimal places fail show means labels show same value. i know define custom formatter show decimal places chart dynamic , can show lines varying values. series can have integers , need 5 decimal places. don't want have search through series , pass max , min scale axis correctly after loading new series. charts autoscale , show correct labels wrong here? here cut down example of problem: jsfiddle the y axis has prety basic definiition; yaxis: { max: 33999.253, min: 33999.219, title: { text: 'm', style: { color: '#000000', fontweight: 'bold' } }, labels: { style: { color: '#000000' } } }, as can see when shown y axis labels same. yet when update series (using datas

android - Face book application not reviewed successfully -

Image
i developing face book application user fetch wall,tagged,group , pages video. working fine on admin account, not working on other account. submitted application review yesterday, today got message (in picture below).

android Php Mysql connection -

help please i trying make login form using php , android.but problem in making connection between php mysql , android. when use 127.0.0.1 ,php file accessible through browser on android cell says connection refused , when use 10.0.2.2, php file not accessible through browser , on android cell says connection timeout here code httpclient=new defaulthttpclient(); httppost= new httppost("http://10.0.2.2/my_folder_inside_htdocs/check.php"); // make sure url correct. //add data namevaluepairs = new arraylist<namevaluepair>(2); // use same variable name posting i.e android side variable name , php side variable name should similar, namevaluepairs.add(new basicnamevaluepair("name",et.gettext().tostring().trim())); // $edittext_value = $_post['edittext_value']; namevaluepairs.add(new basicnamevaluepair("password",pass.gettext().tostring().trim()));

javascript - what does compass:server mean in grunt? -

i encountered snippet of code, can explain compass:server mean? compass: { files: ['<%= config.src %>/styles/{,*/}*.{scss,sass}'], tasks: ['compass:server', 'autoprefixer'] }, compass name of grunt task (compiling sass css using compass), , server name of subtask. so, example the documentation : compass: { dist: { options: { sassdir: 'sass', cssdir: 'css', environment: 'production' } }, dev: { options: { sassdir: 'sass', cssdir: 'css' } } server: { options: { sassdir: 'sass', cssdir: 'css' } } } using configuration choose run dist , dev or server subtasks (with associated options) compass:dist , compass:dev or compass:server commands. i use grunt time in development. it's worth checking out if want take of complexity out of development workflow. alternative new kid on block, gulp .

IntelliJ code completion: ⇥ key? -

intellij tip of day says: "when using code completion, can accept highlighted selection in popup list ⇥ key. unlike accepting ⏎ key, selected name overwrite rest of name right of caret. can useful replacing 1 method or variable name another." what ⇥ key? represent combination? ⇥ tab key. more tips/tricks can found @ intellij's youtube channel https://www.youtube.com/watch?v=eq3kiah4ibi

java - ECDSA Signature in Javacard -

i'm implementing signing code using ecdsa in javacard. my code outputs 0x0003(no_such_algorithm) in exception part means card not support algorithm. don't understand because vendor told me supports ecc. concluded don't know how sign ecdsa , want know that. here full source code package myecdsa; import javacard.framework.*; import javacard.security.*; import javacardx.crypto.*; public class myecdsa extends applet{ private byte[] plaintext ; private ecprivatekey objecdsaprikey=null; // object ecdsa private key private ecpublickey objecdsapubkey=null; // object ecdsa public key private keypair objecdsakeypair=null; // object ecdsa key pair private signature objecdsasign=null; // object ecdsa signature final static short bas = 0; public static void install(byte[] barray, short boffset, byte blength){ new myecdsa(barray, boffset, blength); } private myecdsa(byte barray[], short boffset, b

javascript get filename from string -

i want first part of filename full filename, example, from: bee_gees_-_stayin_alive.mp3 i want return: bee_gees_-_stayin_alive how can it? var filename = file.name; var name = filename.split('.'); var lastarray = name.length; var names = filename.split('.')[lastarray]; get index of last period in string , part of string before that. example: var fullname = "bee_gees_-_stayin_alive.mp3"; var name = fullname.substr(0, fullname.lastindexof('.')); demo: http://jsfiddle.net/sfb2v/

error in running java file using another java file -

i trying run java file using java file in windows....and code: private static void printlines(string name, inputstream ins) throws exception { string line = null; bufferedreader in = new bufferedreader( new inputstreamreader(ins)); while ((line = in.readline()) != null) { system.out.println(name + " " + line); } } private static void runprocess(string command) throws exception { string s=system.getproperty("user.dir"); s="c:\\users\\hp\\downloads\\apache-tomcat-7.0.54-windows-x64\\apache-tomcat-7.0.54\\webapps\\mazil4.0\\web-inf\\classes"; file workingdir = new file(s); system.out.println(q); //new foo().nonstaticmethod(); process pro = runtime.getruntime().exec(command,null,workingdir); printlines(command + " stdout:", pro.getinputstream()); printlines(command + " stderr:", pro.geterrorstream()); pro.waitfor(); system.out.println(command + " exitvalue() " + pro.exi

c# - Complex Linq-To-Entities query with deferred execution: prevent OrderBy being used as a subquery/projection -

i built dynamic linq-to-entities query support optional search parameters. quite bit of work producing performant sql , nearly there, stumble across big issue orderby gets translated kind of projection / subquery containing actual query, causing extremely inperformant sql. can't find solution right. maybe can me out :) i spare complete query long , complex, translate simple sample better understanding: i'm doing this: // start base query var query = in db.articles a.userid = 1; // apply optional conditions if (tagparam != null) query = query.where(a => a.tag = tagparam); if (authorparam != null) query = query.where(a => a.author = authorparam); // ... , on ... // want 50 recent articles, want apply take , orderby query = query.orderbydescending(a => a.published); query = query.take(50); the resulting sql strangely translates orderby in container query: select top 50 id, published, title, content (select id, published, title co

java - How resize javax.swing.Icon -

i try resize iumanager icon. cant correct. code looks like: // label errordetails = new javax.swing.jlabel(); // icon icon icon = uimanager.geticon("optionpane.informationicon"); bufferedimage bi = new bufferedimage( 205, 250, bufferedimage.scale_default); graphics2d g = bi.creategraphics(); g.scale(205,205); // paint new graphics icon.painticon(null,g,250,250); g.dispose(); // set resized uimanage icon errordetails.seticon(icon); but icon have still same size you attempting paint icon onto bufferedimage. therefore need create new icon using bufferedimage> imageicon scaled = new imageicon(bi); errordetails.seticon(scaled); also follow java naming conventions. variable names should not start upper case character. "errordetails" should "errordetails".

python - Does Celery works properly on old version of django? -

i using django 1.3.3 web app , time being don't want migrate newer version, want schedule periodic tasks shoot e-mails users. i found celery best choice have few concerns. does celery works on old versions of django (1.3.3)? other celery there other django app serves purpose? celery can work fine, may have pin earlier version if there compatibility issues 1.3 , recent versions of celery. back when using 1.3, used this gist note version of celery needed. can't promise that's 100% reliable, did work me @ time. however pinning older versions isn't move: there may security fixes in more recent versions of celery, instance. (there have been few django, , 1.3.x no longer maintained them, upgrading 1.4.13 lts @ least worth it.) let me again, in different way: "for time being don't want migrate newer version" isn't enough reason leave production app on old version of framework, if there known security issues in field (and there

xamarin - Rotate issue on MVVMCross Android app. Command bindings lost when using dialog theme -

i've been using mvvmcross couple of months , have been impressed far. however, have come across issue have of yet been unable resolve. i have broken down simple solution can problem can reproduced. issue centres around having button on activity styled in "dialog" theme. when device rotated button command bindings lost , buttons no longer fire commands in view model. odd thing other bindings still working. to simulate have created solution has 1) simple mvxactivity has 1 button. button opens second activity styled dialog. 2) on second mvxactivity have couple of buttons , edittext , textview control. buttons bound commands on view model , edittext , textview bound properties. i have tried adding following attribute second activity (as suggested elsewhere) not work. configurationchanges = android.content.pm.configchanges.orientation | android.content.pm.configchanges.screensize here second view causing issue. removing theme attribute make work - want

xcode - Send command to launch app in iOS device using command line tool -

i have been through stackoverflow , google search's didn't find out proper answer query. want send command launch app in ios device(connected via usb port) using command line tool (from mac system). please don't copy paste link's in comment or in post been through lot of site's. i'm looking forward proper way along understanding if provide. i have seen ios-deploy, libimobiledevice , explanation not given on how install , use, i.e., test whether it's working or not. if have please provide same bit of explanation. thanks in advance. try instruments command line, replace device_udid, xcode_path, app_path, app_name, trace_dir , starting_point variables: instruments -w device_udid \ -t /applications/xcode_path.app/contents/applications/instruments.app/contents/plugins/automationinstrument.bundle/contents/resources/automation.tracetemplate \ app_path/app_name.app \ -e uiascript starting_point.js \ -e uiaresultspath trace_dir \ -d trace_dir wh

Batch - run same command depending on the output -

i have windows batch knows process 100 files @ time , move them somewhere after processing. (cannot modified) if process unable find more files return "no more files" if process able process return "process ok" i want run process using different batch file continually on folder large amount of files how read , compare value first batch determine if need run same command again? should use goto or while loop in case? do first batch while (first batch output != 'no more files') :do rem first batch /f "delims=" %%a in ('firstbatch.bat') set output=%%a rem while (first batch output != 'no more files') if "%output%" neq "no more files" goto

java - How to load resources in an external self-made library? -

i'm working on java fxml application using netbeans. structuring purpose want reusable code in external selfmade library (just netbeans java project). i want library code load given fxml views dynamically using like: class loader { public static void load(stage stage, string view) { parent root = fxmlloader.load(loader.class.getclass().getresource(view); scene scene = new scene(root); stage.setscene(scene); stage.show(); } } main class in basic fxml application: class main extends application { public static void main(string[] args) { launch(args); } @override public void start(stage stage) throws exception, nullpointerexception { loader.load(stage, "fxmldocument.fxml"); } } but fxml view file located in bacis fxml application project (not external library project code placed). i'm not experienced kind of advanced java stuff, guess it's classpath problem. the error trigg

actionscript 3 - AS3: Add A Text Field To a Movie Clip -

how go adding text field movie clip? add text text field through main actions. how reset nothing example " ". just example ... import flash.display.*; import flash.text.*; var textfield:textfield = new textfield(); var container:movieclip = new movieclip(); addchild(container).addchild(textfield); function text():string { return textfield.text; } function set text(value:string):void { textfield.text = value; } function resettextfield():void { text = ""; } in movieclip, contains script: movieclip.text = "fred";

visual studio 2012 - vstest.console.exe with /EnableCodeCoverage just "hangs"... how debug, and how to fix? -

i'm using vstest.console.exe (vs2012) run tests /enablecodecoverage, , .runsettings defines "code coverage" datacollector (see codecoverage.runsettings in code block below). i'm running powershell build script, invokes: vstest.console.exe /inisolation /logger:trx /enablecodecoverage /settings:codecoverage.runsettings /testcasefilter:"testcategory=customers" bin\release\sdm.test.integtest.dll previously command working, recent new project integrated old legacy code has brought in lot of new dependencies/dlls. what see command "hangs", , never seems run of tests. when use sysinternals process explorer see activity in vstest.executionengine.exe ... best guess is attempting instrument whole bunch of dlls .runsettings file should excluded. that's guess. any in figuring out how diagnose issue appreciated. codecoverage.runsettings below: <?xml version="1.0" encoding="utf-8"?> <runsettings> <!--