w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Format file size in Unix in readable format
Using sed: $ ls_output='-rw-r--r-- 1 jboss admin 26644936 Sep 1 21:23 MyBig.war' $ echo $ls_output | sed -e :a -e 's/(.*[0-9])([0-9]{3})/1,2/;ta' -rw-r--r-- 1 jboss admin 26,644,936 Sep 1 21:23 MyBig.war Above sed command repeatedly replace the last 4 digits #### with #,###. -e :a: Make a label named a for t command. ta: Jump to a if substitution was successful.

Categories : File

R: Produce machine-readable output for summary / describe
You could run the table function through apply For instance fruit <- c("Apple", "Apple", "Pear") veg <- c("Carrot", "Potato", "Peas") meat <- c("Steak", "Chicken", "Duck") df <- data.frame(fruit, veg, meat) apply(df, 2, table) $fruit Apple Pear 2 1 $veg Carrot Peas Potato 1 1 1 $meat Chicken Duck Steak 1 1 1

Categories : R

Displaying Dates in Readable Format
strtotime can't parse the date string it gets from MySQL. It unhelpfully returns FALSE, which date type-coerces into 0 and interprets as the unix epoch. Its then displayed as Dec 31 1969. It sounds like your database is storing dates as strings or something. If this is the case, I'd recommend changing the scheme if at all possible.

Categories : PHP

Format unix timestamp to something readable
try to remove to_formatted_s(:long) and use it as argument of I18n.l example: I18n.l Time.new(@data.utma_hash.fetch(:initial_visit_at)).to_datetime Of course you need a specification of datetime formats in your language .yml file, but it should work with the default one you can find in the official guides

Categories : Ruby On Rails

Nonintrusive serializer to human readable format
The JSON format is pretty human readable: JavascriptSerializer is built into the framework and would allow you to serialize any instance to JSON format. Limitations apply of course: if your object graph contains circular references you will not be able to JSON serialize it.

Categories : C#

How do you put the datetime in the guage chart in human readable format
Don't convert that value. Instead use dataLabel formatter: http://jsfiddle.net/AVLeH/ plotOptions: { gauge: { dataLabels: { formatter: function () { return Highcharts.dateFormat('%d/%m/%Y %H:%M', this.y); } }, } },

Categories : Javascript

Sortable, readable and standard time format for logs
@J.F. Sebestian - Thanks for your comment. After some research I chose RFC 3339 / ISO 8601 in UTC, e.g.: date -u "+[%Y-%m-%d %H:%M:%S%z (%Z)]" # Space separated with tz abbreviation [2013-07-31 23:56:34+0000 (UTC)] date -u "+[%Y-%m-%d %H:%M:%S.%N %z (%Z)]" # Space separated with nanoseconds and tz abbreviation [2013-07-31 23:56:34.812572000 +0000 (UTC)] Features: Sortable (Most significant date item is on the left) Readable Unambiguous, time zone clearly stated Delimited by [,], useful for regexing the date away Easily parsable Accurate: uses nanoseconds (might be practically milliseconds on some machines, which is good enough) I've also created a nice github project that helps with date formatting - feel free to take a look and suggest your own formats

Categories : Sorting

Convert Mongo Datestamp to R readable date format.
You need to include %Y for the four-digit year. fmt <- "%a %b %d %H:%M:%S EAT %Y" as.Date("Thu May 08 01:00:00 EAT 2008", fmt) ## [1] "2008-05-08" strptime("Thu May 08 01:00:00 EAT 2008", fmt) ## [1] "2008-05-08 01:00:00" When you come to print the values, use strftime or format, and specify how you would like the dates to look.

Categories : R

how do you convert epoch to readable date format in javascript
You can use the Highcharts.dateFormat function. Note you have to multiply your epoch number with 1000, as Highcharts.dateFormat needs a JavaScript date timestamp (milliseconds since Jan 1st 1970). tooltip: { enabled: true, formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ Highcharts.dateFormat('%d.%m.%Y', this.x*1000) +': '+ this.y; } },

Categories : Javascript

How do I format CouchDB design documents in a human readable way?
In addition to mentioned Futon, there are several tools that allow you to write your map and view functions with your favorite editors and save them on your local file system. Those tools than take care of "pushing" your code to CouchDB. You can find more about those tools here

Categories : Javascript

Gensim: How to save LDA model's produced topics to a readable format (csv,txt,etc)?
You may use pickle module. import pickle # your code pickle.dump(lda,open(filename,'w')) # you may load it back again lda_copy = pickle.load(file(filename))

Categories : Python

Programmatically Correct Serial Port Data to Readable Format
I don't think there is a way to restore the data: The UART on the server will probably have detected a lot of 'frame errors' and as a result has discarded at least some of the data at the hardware level already. However, you may want to have a look at the frame format on the serial line (e.g. here). It is not complicated in any way, but w.r.t. your problem the challenge I see is: Each frame consists of one start-bit, then the n data-bits, optionally a parity bit, and then one or more stop-bits. So, when the UART expects 8-bit frames and there's only a single stop-bit sent after each frame it will get out of sync: The start-bit is detected by the UART irrespective of the frame length, then the UART reads as many data bits as it is configured to, 8 in your case, while the sender only se

Categories : C#

show forms data in human readable format django
I think you want that: class PersonActionsForm(forms.ModelForm): class Meta: model = Actions fields = ('action',) widgets = { 'action': forms.CheckboxSelectMultiple(), } See here

Categories : Django

How to extract SQL Server image column data into readable format and store into another column?
You can do it converting the field first to varbinary and than to varchar. declare @t table (i image) insert into @t values('some text') select i, CAST(cast(i as varbinary(max)) as varchar(max)) from @t

Categories : Sql Server

Post image from local machine to user wall of Facebook
Try to use this one and you know you are getting path from NSBundle not image so you need to get first image from picture path and then do it. NSString *picture=[[NSBundle mainBundle]pathForResource:@"4" ofType:@"jpg"]; UIImage *image = [UIImage imageWithContentsOfFile:picture]; NSMutableDictionary* params = [[NSMutableDictionary alloc] initWithObjectsAndKeys:message, @"message",image, @"picture",nil];

Categories : Iphone

Machine level difference in format specifiers %s %d and %c for null byte
First of all: This has nothing to do with "machine level". Everything here happens in the runtime or more specifically in the implementation of printf(). Moreover all "conversions" happening by using the wrong format specifier is potentially looking for trouble, as you won't have any guarantee these are actually passed/read/interpreted correctly (e.g. due to different lengths), if you're not casting the parameters to the correct types for the format specifiers. First the calculation: bugs is set to 100. nul_byte is set to 0 (the actual value of ). care_percentage essentially resolves to doing 100 * 0, which will be 0 again. So, what happens? First case: This is a special case and I wouldn't necessarily rely on it doing that. You're essentially accessing the string stored at 0x0000000

Categories : C

C# Input string was not in a correct format. Conversion issue on server not in local machine
Your problem lies in the culture used to convert the decimal. Some cultures use 0,01 and some use 0.01. therein lies the problem. You could use the invariant culture (always 0.01 as input) for example: int www = Convert.ToInt32(Math.Round(Convert.ToDecimal(W.Value, System.Globalization.CultureInfo.InvariantCulture))); int hhh = Convert.ToInt32(Math.Round(Convert.ToDecimal(H.Value, System.Globalization.CultureInfo.InvariantCulture))); int xxx = Convert.ToInt32(Math.Round(Convert.ToDecimal(X.Value, System.Globalization.CultureInfo.InvariantCulture))); int yyy = Convert.ToInt32(Math.Round(Convert.ToDecimal(Y.Value, System.Globalization.CultureInfo.InvariantCulture))); Or you could use your culture, just replace System.Globalization.CultureInfo.InvariantCulture with CultureInfo.CreateSpec

Categories : C#

facebook javascript sdk birthday format
Use the Date object and its functions var date = new Date(response.birthday); var d = date.getDate() var m = date.getMonth() + 1; var y = date.getFullYear(); var format_date = '' + y + '-' + (m<=9 ? '0' + m : m) + '-' + (d <= 9 ? '0' + d : d);

Categories : Javascript

Communication protocol: human readable vs non-human readable
I'm a web developer and I have a strong preference for using human-readable protocols at the outset. For example, json. They have the advantage of being easy to debug and easy to prototype. Furthermore, they allow you to reach for all the low hanging fruit, such as rough system architecture and major bottlenecks without having to do mental translation at each step. If later on you discover that the human readable version is a major bottle neck, you can address it then. I suspect you'll very often have other things you can optimize first.

Categories : Sockets

How to post to Facebook timeline using format like pinterest?
Feed dialog will not get you this customization you will need to use Open Graph actions. https://developers.facebook.com/showcase/pinterest/ Also for full width photos from applications, the user must have generated the photo from the app so that you can utilize "User Generated Photos" For example the following is from the Tumblr application https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/

Categories : Facebook

How to get a facebook page's picture in this 168 pixels squared format?
If you have the page name or page id, you can make a request to picture endpoint and specify the type parameter. For example, here is a request for the cocacola picture: https://graph.facebook.com/cocalcola/picture?type=large

Categories : Facebook

Export to Excel button from web page gives an error after the file is downloaded to the users machine: "File format or file extension is not valid"
The method I've used in the past utilizes the EPPlus library: http://epplus.codeplex.com/ So include that in your project, then you can call this method, just pass in your DataTable: public static void DumpExcel(DataTable dataTable) { using (ExcelPackage package = new ExcelPackage()) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("DataTable"); worksheet.Cells["A1"].LoadFromDataTable(dataTable, true); for (int i = 1; i <= dataTable.Columns.Count; i++) { worksheet.Column(i).AutoFit(); if (dataTable.Columns[i - 1].DataType == System.Type.GetType("System.DateTime")) { worksheet.Column(i).Style.Numberformat.Format = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;

Categories : C#

How to copy only file permissions and user:group from one machine and apply them on another machine in linux?
How about this? #!/bin/bash user="user" host="remote_host" while read file do permission=$(stat -c %a $file) # retrieve permission owner=$(stat -c %U $file) # retrieve owner group=$(stat -c %G $file) # retrieve group # just for debugging echo "$file@local: p = $permission, o = $owner, g = $group" # copy the permission ssh $user@$host "chmod $permission $file" < /dev/null # copy both owner and group ssh $user@$host "chown $owner:$group $file" < /dev/null done < list.txt I am assuming that the list of the files is saved in "list.txt". Moreover you should set the variables "user" and "host" accordingly to your setup. I would suggest to configure ssh to have "automatic login". Otherwise you should insert the password twice per loop. Here

Categories : Shell

ModelState.isValid = false on production machine, true on development machine
As I mentioned in the edit, I found the cause of and solution to my problem. It was caused by an error being thrown by the automatic binding of parameters, and the reason it was having issues with dates on my production machine was due to the locale settings (dd/mm/yy vs mm/dd/yy) on that machine. To fix, I set the computers region settings (in the control panel), and also added a line into my Web.config.

Categories : Jquery

Is it possible to remotely debug a 64 bit machine from 32 bit Host Machine(which has visual studio)
According to MSDN, the answer in the other article is incorrect, and you can debug x64 from an x86 host: http://msdn.microsoft.com/en-us/library/vstudio/ms184681%28v=vs.100%29.aspx If you are debugging remotely, Visual Studio can run under WOW64 or on a 32-bit computer. You can debug both IA64 and x64 applications, in addition to 32-bit applications that are running under x64 WOW mode or on 32-bit operating systems.

Categories : Dotnet

PyDev: Running Code in local machine to remote machine
One solution would be: Install python on the remote machine Package your code into a python package using distutils (see http://wiki.python.org/moin/Distutils/Tutorial). Basically the process ends when you run the command python setup sdist in the root dir of your project, and get a tar.gz file in the dist/ subfolder. Copy your package to the remote server using scp, for example, if it is an amazon machine: scp -i myPemFile.pem local-python-package.tar.gz remote_user_name@remote_ip:remote_folder Run sudo pip install local-python-package.tar.gz on the remote server Now you can either SSH to the remote machine and run your code or use some remote enabler such as fabric to start commands on the remote server (works for any shell command, specifically python scripts) Alternatively, you c

Categories : Python

MySQL statement failing on local machine but not deployment machine?
The failure is referring to the d.id in the nested subquery: ON dol.id=( SELECT MIN(dol2.id) FROM DOLineEJB dol2 WHERE d.id=dol2.DeliveryOrderEJB_lines ) You can fix the query: SELECT d.id, ..., dol.weight, d.status FROM DeliveryOrderEJB d join InbondEJB_DeliveryOrderEJB_link lnk on d.id=lnk.DeliveryOrderEJB_id left join DOLineEJB dol ON dol.id=( SELECT MIN(dol2.id) FROM DOLineEJB dol2 WHERE d.id=dol2.DeliveryOrderEJB_lines ) WHERE lnk.InbondEJB_itNo='...' ORDER BY d.id I believe the problem is because you have different versions of MySQL on the machines. MySQL changed the semantics of the , around version 5.0.

Categories : Mysql

Use NLP / Machine Learning to teach a machine how to detect if a string is mathematical?
Parsing is a better tool than machine learning for this problem. What you have described is a relatively simple grammar for arithmetic, with some aliases for numbers, and a touch of syntax for those aliases. A tokenizer and some basic syntactic analysis, which you could code directly, will produce better more reliable results with significantly less computational effort than machine learning and optimization will. One reason why parsing is sufficient is that you don't need to worry about misspellings as often as you do, say, with people's names. If you want to get fancy about that, then use your Jaro-Winkler-based things for lexical analysis and then use syntatic analysis on what you think are your tokens. That is still much cheaper and less complex than machine learning. I don't know mu

Categories : PHP

Installation of MSI File on remote machine from local machine
You're running a remote MSI on the local host. To install the remote executable on a remote host, you could use WMI: host = "<IP ADDR>" setup = "msiexec /a ""C:MySetup<FILENAME>"" /quiet ..." Set wmi = GetObject("winmgmts://" & host & "/root/cimv2") rc = wmi.Get("Win32_Process").Create(setup, , , pid) If rc = 0 Then WScript.Echo "Setup started with PID " & pid & "." Else WScript.Echo "Starting setup failed. (" & rc & ")" End If The above will start the process asynchronously (i.e. Create returns immediately). If you need to wait for the remote process to complete, you'll have to monitor it like this: Do WScript.Sleep 100 Set p = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessID=" & pid) Loop Until p.Count = 0 There may be s

Categories : Vbscript

Connecting Clients machine to MySQL Server machine
You can use other tool with good looking GUI. For example: HeidiSQL. Then, you need to enable remote access. If you use windows, there is nice wizard for you to enable remote access with a few clicks. The wizard is located it at MySQL Server 5.5inMySQLInstanceConfig.exe. Then Reconfigure Instance -> Next -> Standard Configuration -> Next -> Next. You will see this screen. Tick on "Enable root access from remote machines". Or you can manually configure it to allow remote access from my.ini file. See this link for how to do it. If having done above still does not allow you to connect to your MySQL. Please make sure that Firewall does not block MySQL port.

Categories : Mysql

How to calculate the offset of machine instructions using machine code itself?
In general, a machine instruction set uses three types of storage addresses: Absolute addresses which refer to the exact storage location of interest. Base-relative addresses which, when added to the contents of a "base register", refer to the storage location of interest. Instruction-relative addresses which, when added to the address of the instruction containing them, refer to the storage location of interest. Usually the 3rd type does not need to be "relocated", since the location being referred to will generally be in the same code segment as the referring instruction, so they move together. The second type may or may not require change upon binding/loading, depending on details of the compiled code binding scheme. The first type will almost always require changing, but it's u

Categories : Assembly

Powershell tasks from local machine to remote machine
Reading from docs on MSDN: To run a single command on a remote computer, use the ComputerName parameter. To run a series of related commands that share data, use the New-PSSession cmdlet to create a PSSession (a persistent connection) on the remote computer, and then use the Session parameter of Invoke-Command to run the command in the PSSession. To run a command in a disconnected session, use the InDisconnectedSession parameter. To run a command in a background job, use the AsJob parameter. So basically you should do something like: $session = New-PSSession Invoke-Command -Session $session -FilePath <PathToScript>

Categories : Powershell

host webapp in my machine trough virtual machine
Yes to both questions, if your browser machine can hit the port the server machine is serving the app on. On WAN, you would need to make sure your router didn't block requests to the server's port, and the same for any modem/firewall that connects you to the internet at large. Also, if your public ip is not static, it may change.

Categories : Iis

If an application is built on a 32-bit machine, when run on a 64-bit machine, how does it look for DLLs?
First of all, you can cross-compile in either direction so being built on a 32-bit machine doesn't necessarily mean anything. It is really an issue of running 32-bit code on a 64-bit machine. In this case, there is a 32-bit emulation layer on 64-bit installations called Wow64. Part of this is file system redirection, which redirects file system requests from 32-bit programs. In this case, trying to access "C:Program Files" from 32-bit code will transparently redirect to "C:Program Files (x86)".

Categories : Windows

How to SSH from Perl script from windows machine to EC2 machine
Use Net::SSH::Perl to avoid tricky (on Windows!) dependencies to ssh-binaries. This module is written completely in Perl, so it should work on any platform. Net::SSH::Perl

Categories : Windows

porting opencv project from 32 bit machine to 64 bit machine
As I tried, It will be enough to copy your files to new system and do not forget to add your x:WindowsSysWOW64 some needed dll files for example you might needed opencv_core245.dll file and you might get it from OpenCV directory Or just another way if you were builded with MS VS to download and install your new system redistributable package from following link http://www.microsoft.com/en-us/download/details.aspx?id=14632 Edit: I have just found one more solution which is copying all needed dll files to same directory with .exe Hope it helps

Categories : Opencv

Auto Generate Machine Key VS. Custom Machine Key
If you have a WebFarm you have to use custom machine key, other way it won't work. The only secure problem is that there are people, who knows these machine key. If they "sell it" outside your company somebody can for example decrypt your cookies.

Categories : Asp Net

Purpose of "Target machine" field in Visual studio -> Linker-> Advanced Options->Target Machine
This option relates to the linker option /MACHINE and is a hint for the linker for what target architecture to link the object code if he (the linker) cannot determine this from the object file. As MSDN states you usually have not to specify this. So no you don't need to explicitly specify this flag when porting your code.

Categories : Visual C++

How to install all the packages that are on machine A onto machine B?
This should be a start sudo dpkg --set-selections < (ssh othermachine dpkg --get-selections) Also consider puppet Ubuntu landscape

Categories : Ubuntu

migration c++ code 32 bit machine to 64 bit machine
reverse() reverses the byte-order, depending on platform. Shown here seems to be only the non-SPARC version of reverse() See endianness. Reason for reversing the byte-order (i.e. calling reverse()) before writing to file is to make the file format platform (i.e. endianness) independent.

Categories : C++



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.