How to Send a File Path to mysql table - java

I tired to send this file path
"C:\\Users\\Tesh\\Desktop\\Image - Copy.jpg";
but its show like this on mysql database
C:UsersTeshDesktopImage - Copy.jpg"
How Can i Fix this

Can you show us more of your File code so that we can help you? The double backslash (like you've shown) in Java should work, so it's probably something else.
Also, could you try:
"C:\\\\Users\\\\Tesh\\\\Desktop\\\\Image - Copy.jpg";
or preferably as per #Azad's suggestion:
"C:/Users/Tesh/Desktop/Image - Copy.jpg";

Related

Forge modding (can't get a texture on item) Minecraft 1.9.4

Hi can somebody help me fix this.
My texture on item is not loading.
I'm modding in eclipse on minecraft 1.9.4
Here is a github page with source code :
Github page
Here is a gist with a console log :
Console log
I hope somebody knows more than me :)
You have a few problems with your code:
Your file is named ItemSlome, it would only search for itemslome, because (Model)ResourceLocations will be turned to lower-case.
The ModelResourceLocation you created is for slome not itemslome.
Your file is in the "ktm" domain, but you did not provide this to the ModelResourceLocation causing it to search in the "minecraft" domain.
Solutions:
Make the model file's name all lower-case
Make the model file's name match your code
Prepend the model name by your domain "ktm:" the ":" is the seperator for the domain part and the resource part or use a ResourceLocation instead of the String.
Additional Hints:
You may want to use ModelLoader.setCustomModelResourceLocation(...) to register your ModelResourceLocation.
Examples for a correct ModelResourceLocation:
new ModelResourceLocation("ktm:slome", "inventory"))
new ModelResourceLocation(new ResourceLocation("ktm","slome"),"inventory")
Both of the above examples will lead to the model being searched at resource_root/ktm/models/item/slome.json
This is how you set the texture of a block you have to put a colon after The Mod Name instead of comma
YourItemName = new Item().setUnlocalizedName("YourItemName")
.setTextureName("ModName:PutTextureNameHere")
.setCreativeTab(TheTabYouWantItToBeIn);

Testing HLS using JMeter

I am using JMeter to test HLS playback from a Streaming Server. So, the first HTTP request is for a master manifest file(m3u8). Say,
http://myserver/application1/subpath1/file1.m3u8
The reply to this will result in a playlist something like,
subsubFolder/360p/file1.m3u8
subsubFolder/480p/file1.m3u8
subsubFolder/720p/file1.m3u8
So, next set of URLs become
http://myserver/application1/subpath1/subsubFolder/360p/file1.m3u8
http://myserver/application1/subpath1/subsubFolder/480p/file1.m3u8
http://myserver/application1/subpath1/subsubFolder/720p/file1.m3u8
Now, individual reply to these further will be an index of chunks, like
0/file1.ts
1/file1.ts
2/file2.ts
3/file3.ts
Again, we have next set of URLs as
http://myserver/application1/subpath1/subsubFolder/360p/0/file1.ts
http://myserver/application1/subpath1/subsubFolder/360p/1/file1.ts
http://myserver/application1/subpath1/subsubFolder/360p/2/file1.ts
http://myserver/application1/subpath1/subsubFolder/360p/3/file1.ts
This is just the case of one set(360p). There will be 2 more sets like these(for 480p, 720p).
I hope the requirement statement is clear uptill this.
Now, the problem statement.
Using http://myserver/application1 as static part, regex(.+?).m3u8 is applied at 1st reply which gives subpath1/subsubFolder/360p/file1. This, is then added to the static part again, to get http://myserver/application1/subpath1/subsubFolder/360p/file1 + .m3u8
The problem comes at the next stage. As, you can see, with parts extracted previously, all I'm getting is
http://myserver/application1/subpath1/subsubFolder/360p/file1/0/file1.ts
The problem is obvious, an extra file1, 360p/file1 in place of 360p/0.
Any suggestions, inputs or alternate approaches appreciated.
If I understood the problem correctly, all you need is the file name as the other URLs can be constructed with it. Rather than using http://myserver/application1 as static part of your regex, I would try to get the filename directly:
([^\/.]+)\.m3u8$
# match one or more characters that are not a forward slash or a period
# followed by a period
# followed by the file extension (m3u8)
# anchor the whole match to the end
Now consider your urls, e.g. http://myserver/application1/subpath1/subsubFolder/360p/file1.m3u8, the above regex will capture file1, see a working demo here. Now you can construct the other URLs, e.g. (pseudo code):
http://myserver/application1/subpath1/subsubFolder/360p/ + filename + .m3u8
http://myserver/application1/subpath1/subsubFolder/360p/ + filename + /0/ + filename + .ts
Is this what you were after?
Make sure you use:
(.*?) - as Regular Expression (change plus to asterisk in your regex)
-1 - as Match No.
$1$- as template
See How to Load Test HTTP Live Media Streaming (HLS) with JMeter article for detailed instructions.
If you are ready to pay for a commercial plugin, then there is an easy and much more realistic solution which is a plugin for Apache JMeter provided by UbikLoadPack:
Besides doing this job for you, it will simulate the way a player would read the file. It will also scale much better than any custom script or player solution.
It supports VOD and Live which are quite difficult to script.
See:
http://www.ubik-ingenierie.com/blog/easy-and-realistic-load-testing-of-http-live-streaming-hls-with-apache-jmeter/
http://www.ubik-ingenierie.com/blog/ubikloadpack-http-live-streaming-plugin-jmeter-videostreaming-mpegdash/
Disclaimer, we are the providers of this solution

CRF++: Yet Another CRF Tool Kit

When I use CRF++ toolkit for the first time. I have installed it and when I run the crflearn command I'am getting this message :
CRF++: Yet Another CRF Tool Kit Copyright (C) 2005-2013 Taku Kudo, All rights reserved. encoder.cpp(340) [feature_index.open(templfile, trainfile)] feature_index.cpp(135) [ifs] open failed: template_file
Can anyone help me?
The package is pretty well documented here
Can you give the full command you tried to use?
The pattern is crf_learn -t [template_file] [data_file_in_the_right_format]
The package comes with an example template file, here's the head of mine:
U00:%x[-5,0]
U01:%x[-4,0]
U02:%x[-3,0]
U03:%x[-2,0]
U04:%x[-1,0]
U05:%x[0,0]
The data needs to be in a tab delimited format with each data point represented by a row, each column is the feature value for that row and the final column is your gold standard label.
Does that help?
You put wrong file path for template featurefile and model. So, put these files inside CRF-PP folder and fire the crf_learn command. Hope this will solve your issue.

can't insert utf-8 characters in mysql database using crontab to automate the program

I had asked the question before but because I didn't receive any guide, I'm asking it again.
Here's the original question:
fail to insert non-english characters to database using crontab to run the program
I wrote a java program that reads from a UTF-8 file and insert its contents to mysql database. I can call jar file in terminal and it works fine. after that I used crontab to automate running the program but this time only english chars and numbers will insert to DB.
My database encoding is "utf8-general-ci" and the server I'm running the program is centOs 6.3.
I should mention that I have another program that its functionality is similar to this and it works fine.
I have tested so many things but none of them fixed the problem. I don't know what's the problem.
I'm looking for a solution or any clue to continue and solve the problem. I'll appreciate any help.
EDIT:
mysql version is :5.1.69
and here is 2 images. one is for the time I run the program with crontab and the other when running the program in terminal
I'm not realy an expert on this but here goes nothing.
I think this is related to what's documented in http://dev.mysql.com/doc/refman/5.6/en/alter-table.html
Is your default character set on latin1 or something like that ? Perhaps you left it default and i think it then uses latin1.
In any case i think you have to do something like this:
ALTER TABLE target_table_name MODIFY latin1_text_col TEXT CHARACTER SET utf8;
ALTER TABLE target_table_name MODIFY latin1_varchar_col VARCHAR(M) CHARACTER SET utf8;
You can find out the default char set of the database by doing:
use db_name;
show variables like "character_set_database";
show variables like "collation_database";
I couldn't find anyway to fix the problem so I wrote a schedular program that runs the application and it works fine!!!
But I'm still confused why crontab makes that problem or what I did that program doesn't work fine!!!
Assume that you have set you db, table, and columns using utf8mb4, don't forget
specify your connection to mysql using utf8 charset:
String url = "jdbc:mysql://ip:port/db?characterEncoding=utf8";
String username = "xxx";
String password = "xxx";
try {
conn = DriverManager.getConnection(url, username, password);
} catch (SQLException e) {
e.printStackTrace();
}
--
I'm curious about the root cause of your problems as well...

Include SVN revision number in source code

My requirement is simple. At the beginning of each file there should be a block comment like this:
/*
* This file was last modified by {username} at {date} and has revision number {revisionnumber}
*/
I want to populate the {username}, {date} and {revisionnumber} with the appropriate content from SVN.
How can I achieve this with NetBeans and Subversion? I have searched a lot but I can't find exactly what I need.
I looked at this question and got some useful information. It is not exactly duplicate because I am working with NetBeans but the idea is the same. This is my header:
/*
* $LastChangedDate$
* $LastChangedRevision$
*/
Then I go to Team > Subversion > Svn properties and add svn:keywords as property name and LastChangedDate LastChangedRevision as property value.
And when I commit from NetBeans it looks like this:
/*
* $LastChangedDate: 2012-02-13 17:38:57 +0200 (Пн, 13 II 2012) $
* $LastChangedRevision: 27 $
*/
Thanks all for the support! I will accept my answer because other answers do not include the NetBeans information. Nevertheless I give +1 to the other answers.
As this data only exists after the file was committed it should be set by SVN itself, not a client program. (And client-side processing tends to get disabled or not configured at all.) This means there is no simple template/substitute like you want, because then after the first replacement the template variables would be lost.
You can find information abut SVN's keyword substitution here. Then things like $Rev$ can be replaced by $Rev: 12 $.
You can do this with The SubWCRev Program.
SubWCRev is Windows console program which can be used to read the
status of a Subversion working copy and optionally perform keyword
substitution in a template file. This is often used as part of the
build process as a means of incorporating working copy information
into the object you are building. Typically it might be used to
include the revision number in an “About” box.
This is typically done during the build process.
If you use Linux, you can find a Linux binary here. If you wish, you could also write your own using the output of svn log.
I followed Petar Minchev's suggestions, only I put the $LastChangedRevision$ tag not in a comment block but embedded it in a string. Now it is available to programmatically display the revision number in a Help -> About dialog.
String build = "$LastChangedRevision$";
I can later display the revision value in the about dialog using a String that has all of the fluff trimmed off.
String version = build.replace("$LastChangedRevision:", "").replace("$", "").trim();
I recommend a slightly different approach.
Put the following header at the top of your source files.
/*
* This file was last modified by {username} at {date} and has revision number {revisionnumber}
*/
Then add a shell script like this
post update, checkout script
USERNAME=# // use svnversion to get username
DATE=# // use svnversion to get revisio nnumber
sed -e "s#{username}#${USERNAME}#" -e "s#{date}#${DATE}#" ${SOURCE_CONTROL_FILE} > ${SOURCE_FILE}
pre commit script
cat standard_header.txt > ${SOURCE_CONTROL_FILE}
tail --lines $((${LENGTH}-4)) ${SOURCE_FILE} >> ${SOURCE_CONTROL_FILE}

Categories

Resources