|
By hand.
- Find + replace helps to simplify the variable names so you can see what you're doing;
- Variables have to be declared first, and can't change type part-way through. The only one which seemed to change type was related to the regexp match on the current file contents, which I simply removed;
- You can't write to a string as if it's an array, so I had to replace one of the variables with a
List<char> ; - You can't poke characters into a
List<T> outside of the current range, so I had to add some code to populate the list with spaces when that happened; - Some of the code tries to read characters from out-of-bounds indexes, so I had to add some code to return a space when than happened;
base64_decode(x) ⇒ System.Text.Encoding.Default.GetString(Convert.FromBase64String(x)) ;ord(x) ⇒ Microsoft.VisualBasic.Strings.Asc(x) ;- String concatenation uses
+ instead of . ;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks a lot Richard. Your replies was very helpful.
Mahdi 82161021
modified 21-Mar-14 12:00pm.
|
|
|
|
|
 It's not the cleanest code, but it works:
static void Main()
{
const string input = @"...";
Console.WriteLine(Decode(input));
}
static string Decode(string input)
{
input = base64_decode(input);
int a = 0;
int b = 0;
int c = 0;
int d = (ord(input[1]) << 8) + ord(input[2]);
int e = 3;
int f = 0;
int g = 16;
int length = input.Length;
var result = new List<char>(length << 2);
for (; e < length; )
{
if (g == 0)
{
d = (ord(input[e++]) << 8);
d += ord(input[e++]);
g = 16;
}
if ((d & 0x8000) != 0)
{
a = (ord(input[e++]) << 4);
a += (ord(input[e]) >> 4);
if (a != 0)
{
b = (ord(input[e++]) & 0x0F) + 3;
for (c = 0; c < b; c++)
Set(result, f+c, Get(result, f-a+c));
f += b;
}
else
{
b = (ord(input[e++]) << 8);
b += ord(input[e++]) + 16;
for (c = 0; c < b; Set(result, f+c++, input[e]));
e++;
f += b;
}
}
else
Set(result, f++, input[e++]);
d <<= 1;
g--;
if (e == length)
{
return new string(result.ToArray());
}
}
return null;
}
static string base64_decode(string value)
{
return System.Text.Encoding.Default.GetString(Convert.FromBase64String(value));
}
static int ord(char c)
{
return Microsoft.VisualBasic.Strings.Asc(c);
}
static T Get<T>(IList<T> list, int index)
{
if (index < 0 || index >= list.Count) return default(T);
return list[index];
}
static void Set<T>(IList<T> list, int index, T value)
{
while (list.Count <= index) list.Add(default(T));
list[index] = value;
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
My company is planning to make a new kind of messaging application and I'm trying to decide what technology to use on the back-end. We're thinking of the client-server model. Where client can be a web-app, native mobile or even a desktop application. As a developer, to me this means that the back-end server better be darn good and stable.
The current proposal is to use PHP. Is this really a good idea? Sure, wordpress proves that you can build really complicated things with PHP, but I'm not working with veterans. The programmers would have at best 1 or 2 years of experience. My concern is on extending the backend when requirements change as well as debugging errors.
For a new team, what technology would be easier to use? Can Java be used for this purpose? Will it be easy to debug? What about .NET ?
-chronodekar
|
|
|
|
|
Stability of your base technologies isn't really a factor. If you're building on top of another framework or library, then you can consider stability and performance. For example a good PHP framework will probably do just as well as out of the box ASP.Net.
I would just pick some technologies that me and my team were familiar with.
If you've got mainly .Net developers, use .Net. Same for if you have mainly Java, PHP, Python, Ruby, JavaScript, etc. developers.
You could pick your target based on things like licensing costs, but unless you've got someone with some server administration know-how you'll probably be better off paying a little bit extra for hosting where your stack is set up for you; in which case your licensing is probably part of your monthly fee.
|
|
|
|
|
Thank you for the reply.
In the end, we decided to go with a hybrid approach. Have the core backend done in Java, while administration and stuff would be in PHP.
-chronodekar
|
|
|
|
|
You can use Socket Tech n Node.js
Node.js is now known as an advance programming for such things
Installing and Beginning Node
Freelance makes perfect | http://codetrash.com
|
|
|
|
|
I have implemented facebook share button functionality in my application using below code. But that is not working in my application. can u provide some suggestion to solve this prob.
Snippet:
http://www.facebook.com/sharer.php?s=100&p[url]" + DomainName + "&p[images][0]=" + ImgUrlValue + "&p[title]=" + ProductDesc + "&p[summary]=" + product summary.
|
|
|
|
|
Shouldn't the link be
https://www.facebook.com/sharer/sharer.php?..........
|
|
|
|
|
smth like this ?
<div class="fb-share-button" data-href="http://codetrash.com/tutorial/nodejs/17/tutorial-install-nodejs-npm-and-express-in-ubuntu-1204" data-type="button_count"></div>
You can attach the required API from facebook. Demo my shared button[^]
Freelance makes perfect | http://codetrash.com
|
|
|
|
|
I used some examples but doesn't work on the computer or movil device.
when i run the proyect (f5) in the proyect this code works but when i go to chrome or explorer directly doesn't work. How can i do.....
This is the code.
one:
Dim player As New System.Media.SoundPlayer
player.SoundLocation = ("c:\sonidos\error.wav")
player.Play()
two:
Dim sp As SoundPlayer
sp = New SoundPlayer(My.Resources._error)
sp.Play()
Thanks a lot.
|
|
|
|
|
You have already posted this question[^] in the ASP.NET forum.
DO NOT post the same question to multiple forums on the same site. It will only annoy the people who would otherwise be trying to help you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hello... can I render to "js" (Javascript) files as supposed to "cshtml"?
For example,
function GetCategories()
{
var sCategories;
var i;
i = 0;
@foreach (var Category in Categories)
{
if(i>0)
{
sCategories.concat(',');
}
sCategories.concat(Category);
i++;
}
return sCategories;
}
Thanks
|
|
|
|
|
|
It seems to me that they used ideas from parallax web design, however was unable to identify any common library for the implementation. It's maybe some home made...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I had found a template at bootstraptor.com and it uses a library from HERE.
vbmike
|
|
|
|
|
|
I'm fairly new to Web API's, so this might be nothing....
I have a controller called "JobAssignmentHeaderController" and it has this method:
[HttpGet]
public List<JobAssignmentHeaderEntity> GetJobAssignmentHeaders(GetJobAssignmentHeadersArgs args)
{
return BO.GetJobAssignmentHeaders(args);
}
GetJobAssignmentHeadersArgs is
[DataContract]
[Serializable]
public class GetJobAssignmentHeadersArgs : BindableBase
{
private int _SupervisorId;
[DataMember]
public int SupervisorId
{
get { return _SupervisorId; }
set
{
if (_SupervisorId != value)
{
_SupervisorId = value;
RaisePropertyChanged("SupervisorId");
}
}
}
private DateTime _StartDate;
[DataMember]
public DateTime StartDate
{
get { return _StartDate; }
set
{
if (_StartDate != value)
{
_StartDate = value;
RaisePropertyChanged("StartDate");
}
}
}
private DateTime _EndDate;
[DataMember]
public DateTime EndDate
{
get { return _EndDate; }
set
{
if (_EndDate != value)
{
_EndDate = value;
RaisePropertyChanged("EndDate");
}
}
}
}
My proxy code this:
public List<JobAssignmentHeaderEntity> GetJobAssignmentHeaders(GetJobAssignmentHeadersArgs args)
{
WebAPIExecutor webAPIExecutor = new WebAPIExecutor("/JobAssignmentHeader/GetJobAssignmentHeaders/", Method.GET);
webAPIExecutor.AddParameter(args);
List<JobAssignmentHeaderEntity> results = webAPIExecutor.Execute<List<JobAssignmentHeaderEntity>>();
return results;
}
I'm calling it like this:
GetJobAssignmentHeadersArgs args = new GetJobAssignmentHeadersArgs
{
SupervisorId = SelectedJobSupervisor.Id,
StartDate = StartDateTime,
EndDate = EndDateTime
};
jobAssignmentsMasterList = Engine.APIProxy.GetJobAssignmentHeaders(args);
When I get into the controller, the parameter is null.
I don't really know how to debug this. I could use some help.
Thanks!
If it's not broken, fix it until it is
|
|
|
|
|
how to upload an image and store its path in my sql using php?
|
|
|
|
|
Hereafter use this forum[^] to post php & mysql related questions.
And did you search Google to get answer?
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
yes i am trying .i followed w3schools.but I observed most people save image name in database not the image can you guide me if we will save a image name in database than how will we retrieve those images?
|
|
|
|
|
Two ways.
0) File system - Store image location in database, image in server. Later, load image from server using the path stored in database.
1) Database - Store image as blob in database. Later, load blob as image in page.
Check the advantages & disadvantages of these two ways here. Clickety[^]
Here tons of resources for you
https://www.google.com/search?q=php+save+retrieve+image+database[^]
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
I didn't understood it.
Are you expecting someone to come forward and teach you over this forum (or over the proper forum) about PHP, MySQL and what in-between?
It's unlikely to happen - you are in a site for those who code, not for those who not...Until know you are not!
If you have a task, first learn, than make an attempt, than come to us here - with! your attempt...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
How to control the menus using jscript or jquery ?
Am new to this web development domain.
this is my index.html file which contains menu contents
<html>
<head>
<link rel="stylesheet" type="text/css" href="menus.css" />
</head>
<body>
<div class="example">
<div class="menuholder">
<ul class="menu slide">
<li><a href="" class="pattern">Kitchen</a>
<div class="subs">
<dl class="even">
<dt>STORAGE</dt>
<dd><a href="">Airtight Storage</a></dd>
<dd><a href="">Lock Storage</a></dd>
<dd><a href="">Microwavable Storage</a></dd>
<dd><a href="">Canisters & Jars</a></dd>
<dt>COOKWARE</dt>
<dd><a href="">Cookware Sets</a></dd>
<dd><a href="">Pressure Cookers</a></dd>
<dd><a href="">Frying Pans & Woks</a></dd>
<dd><a href="">Pots & Sauce Pans</a></dd>
</dl>
<dl class="odd">
<dt>SERVEWARE</dt>
<dd><a href="">Dishes & Bowls</a></dd>
<dd><a href="">Casseroles</a></dd>
<dd><a href="">Cutlery</a></dd>
<dd><a href="">Plates, Trays & Platters</a></dd>
</dl>
<dl class="even">
<dt>GLASS SETS</dt>
<dd><a href="">Everyday Glasses</a></dd>
<dd><a href="">Bar Glasses</a></dd>
<dd><a href="">Tumblers</a></dd>
<dd><a href="">Bone China</a></dd>
<dd><a href="">Melamine</a></dd>
<dd><a href="">Stainless Steel</a></dd>
</dl>
<dl class="odd">
</dl>
<dl class="even">
</dl>
<dl class="odd">
</dl>
<dl class="even-last">
<dt>GLASS SETS</dt>
</dl>
</div>
</li>
<li><a href="" class="pattern">Office Furniture</a>
<div class="subs">
<dl class="even">
<dt>CHAIRS</dt>
<dd><a href="">Ergonomic Chairs</a></dd>
<dd><a href="">Executive Chairs</a></dd>
<dd><a href="">Folding Chairs</a></dd>
</dl>
<dl class="odd">
<dt>DESKS</dt>
<dd><a href="">Workstations</a></dd>
<dd><a href="">Executive Tables</a></dd>
<dd><a href="">Computer Tables</a></dd>
<dd><a href="">Study & Laptop Tables</a></dd>
<dd><a href="">Conference Tables</a></dd>
</dl>
<dl class="even">
<dt> RECEPTION SEATING</dt>
<dd><a href="">Sofas</a></dd>
<dd><a href="">Ottomans</a></dd>
<dd><a href="">Visitor Chairs</a></dd>
</dl>
<dl class="odd">
</dl>
<dl class="even">
</dl>
<dl class="odd">
</dl>
<dl class="even-last">
<dt></dt>
</dl>
</div>
</li>
<li><a href="" class="pattern">Furnishings</a>
<div class="subs">
<dl class="even">
<dt>BED SHEETS</dt>
<dd><a href="">Double Bed</a></dd>
<dd><a href="">Single Bed</a></dd>
<dd><a href="">Combo Offers</a></dd>
<dd><a href="">Kids Bed Sheets</a></dd>
</dl>
<dl class="odd">
<dt>CURTAINS</dt>
<dd><a href="">Door Curtains</a></dd>
<dd><a href="">Window Curtains</a></dd>
<dd><a href="">Shower Curtains</a></dd>
<dd><a href="">Kids Curtains</a></dd>
</dl>
<dl class="even">
<dt>RUGS & CARPETS</dt>
<dd><a href="">Area Rugs</a></dd>
<dd><a href="">Carpets</a></dd>
<dd><a href="">Dhurries & Runners</a></dd>
</dl>
<dl class="odd">
<dt><a href=""><img src="images/decor_hover_image.jpg" height="100" width="130" /></a> </dt>
</dl>
<dl class="even">
</dl>
<dl class="odd">
</dl>
<dl class="even-last">
<dt></dt>
</dl>
</div>
</li>
<li><a href="" class="pattern">Home Furniture</a>
<div class="subs">
<dl class="even">
<dt>BED SHEETS</dt>
<dd><a href="">Double Bed</a></dd>
<dd><a href="">Single Bed</a></dd>
<dd><a href="">Combo Offers</a></dd>
<dd><a href="">Kids Bed Sheets</a></dd>
</dl>
<dl class="odd">
<dt>CURTAINS</dt>
<dd><a href="">Door Curtains</a></dd>
<dd><a href="">Window Curtains</a></dd>
<dd><a href="">Shower Curtains</a></dd>
<dd><a href="">Kids Curtains</a></dd>
</dl>
<dl class="even">
<dt>RUGS & CARPETS</dt>
<dd><a href="">Area Rugs</a></dd>
<dd><a href="">Carpets</a></dd>
<dd><a href="">Dhurries & Runners</a></dd>
</dl>
<dl class="odd">
<dt><a href=""><img src="images/decor_hover_image.jpg" height="100" width="130" /></a> </dt>
</dl>
<dl class="even">
</dl>
<dl class="odd menuadvertise-twocol">
<dt><a href=""><img src="images/menu-advertise/1.jpg" height="200" width="253" /></a> </dt>
</dl>
</div>
</li>
<li><a href="" class="pattern">Decor</a>
<div class="subs">
<dl class="even">
</dl>
<dl class="odd menuadvertise-twocol">
<dt><a href=""><img src="images/menu-advertise/1.jpg" height="200" width="253" /></a> </dt>
</dl>
<dl class="even">
<dt>RUGS & CARPETS</dt>
<dd><a href="">Area Rugs</a></dd>
<dd><a href="">Carpets</a></dd>
<dd><a href="">Dhurries & Runners</a></dd>
</dl>
<dl class="odd">
<dt><a href=""><img src="images/decor_hover_image.jpg" height="100" width="130" /></a> </dt>
</dl>
<dl class="even">
<dt>BED SHEETS</dt>
<dd><a href="">Double Bed</a></dd>
<dd><a href="">Single Bed</a></dd>
<dd><a href="">Combo Offers</a></dd>
<dd><a href="">Kids Bed Sheets</a></dd>
</dl>
<dl class="odd">
<dt>CURTAINS</dt>
<dd><a href="">Door Curtains</a></dd>
<dd><a href="">Window Curtains</a></dd>
<dd><a href="">Shower Curtains</a></dd>
<dd><a href="">Kids Curtains</a></dd>
</dl>
</div>
</li>
<li><a href="" class="pattern">Appliances</a></li>
<li><a href="" class="pattern">Pets</a></li>
<li><a href="" class="pattern">Housekeeping</a></li>
<li><a href="" class="pattern">Gourmet</a></li>
<li><a href="" class="pattern">Bath</a></li>
<li><a href="" class="pattern">Personal Care</a></li>
</ul>
<div class="hr-line" style="margin-top:30px;"></div>
<div class="back"></div>
<div class="shadow"></div>
</div>
<div style="clear:both"></div>
</div>
</body>
</html>
this is my menus.css file
@charset "utf-8";
.example {
position:absolute;
width:960px;;
margin:0 auto;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
}
.menuholder {
float:left;
overflow:hidden;
position:relative;
width:100%;
font-family: Arial;
font-size:12px;
}
.menuholder .shadow {
-moz-box-shadow:0 0 20px rgba(0, 0, 0, 1);
-o-box-shadow:0 0 20px rgba(0, 0, 0, 1);
-webkit-box-shadow:0 0 20px rgba(0, 0, 0, 1);
background:#888;
box-shadow:0 0 20px rgba(0, 0, 0, 1);
height:7px;
position:absolute;
top:-9px;
width:960px;
z-index:100;
}
.menuholder .back {
-moz-transition-duration:.4s;
-o-transition-duration:.4s;
-webkit-transition-duration:.4s;
background-color:#ffffff;
}
.menuholder:hover div.back
{
height:220px;
margin-top: -8px;
border: 1px solid #E3E3E3;
border-top: none;
-moz-box-shadow: 0 2px 4px #252525;
-webkit-box-shadow: 0 2px 4px #252525;
box-shadow: 0 3px 2px 0 #252525;
padding-left:5px;
}
ul.menu {
display: block;
float: left;
list-style: none;
margin: 0% 0% 0% -3%;
width: 100%;
}
ul.menu li {
float:left;
margin:7px 27.2px 0 0;
}
ul.menu li > a {
-webkit-border-bottom-left-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
-webkit-transition: all 0.2s ease-in-out;
border-radius: 0 0 10px 10px;
;
display: table-row;
padding: 0 10px;
text-decoration: none;
transition: all 0.2s ease-in-out;
color: #1D4D7D;
font-family: Arial;
font-size: 12px;
font-weight: bold;
}
ul.menu li a.pattern {
}
ul.menu li a.red {
background:#a00;
}
ul.menu li a.orange {
background:#da0;
}
ul.menu li a.yellow {
background:#aa0;
}
ul.menu li a.green {
background:#060;
}
ul.menu li a.blue {
background:#00a;
}
ul.menu li a.violet {
background:#682bc2;
}
.menu li div.subs {
left: 0;
overflow: hidden;
position: absolute;
width: 0;
margin-top: -1px;
}
.menu li div.subs dl {
-moz-transition-duration:.2s;
-o-transition-duration:.2s;
-webkit-transition-duration:.2s;
float:left;
margin:0 130px 0 0;
overflow:hidden;
padding:10px 0 0% 0%;
width:0;
}
.menu dt {
color: #000;
font-family: arial, sans-serif;
line-height: 15px;
margin: 0;
padding: 7px 0 0px 5px;
white-space: nowrap;
}
.menu dd {
margin:0;
padding:0;
text-align:left;
font-family:Verdana, Geneva, sans-serif;
line-height:5px;
width: 135px;
margin-left: 6px;
}
.menu dd a {
background:transparent;
color:#9DA1AB;
font-size:12px;
line-height:18px;
padding: 0 0 0 4px;
text-align:left;
white-space:nowrap;
width:80px;
text-decoration: none;
font-family: Arial;
font-weight: normal;
}
.menu dd a:hover {
color:#090A0A;
}
.menu li:hover div.subs dl {
-moz-transition-delay:0.2s;
-o-transition-delay:0.2s;
-webkit-transition-delay:0.2s;
margin:11px 0px 1px 3px;
padding:0px 0px 0px 0px;
width:133.7px;
height:215px;
}
.menu li:hover div.subs dl.menuadvertise-twocol
{
-moz-transition-delay:0.2s;
-o-transition-delay:0.2s;
-webkit-transition-delay:0.2s;
margin:17px 0px 1px 3px;
padding:0px 0px 0px 0px;
height:215px;
width:265px;
}
.even
{
background-color:#FAFBFC;
}
.even-last
{
background-color:#FAFBFC;
width:148px;
}
.odd
{
background-color:white;
}
ul.menu li:hover > a,ul.menu li > a:hover {
}
ul.menu li a.red:hover,ul.menu li:hover a.red {
background:#c00;
}
ul.menu li a.orange:hover,ul.menu li:hover a.orange {
background:#fc0;
}
ul.menu li a.yellow:hover,ul.menu li:hover a.yellow {
background:#cc0;
}
ul.menu li a.green:hover,ul.menu li:hover a.green {
background:#080;
}
ul.menu li a.blue:hover,ul.menu li:hover a.blue {
background:#00c;
}
ul.menu li a.violet:hover,ul.menu li:hover a.violet {
background:#8a2be2;
}
ul.menu li a.pattern:hover,ul.menu li:hover a.pattern {
text-decoration:underline;
}
.menu li:hover div.subs,.menu li a:hover div.subs {
width: 957px;
}
In above menus style, i have to control number of sub-categories adding in category.The height of the sub menus is fixed, so that if sub categories is more it sholud move to next column.
For above problem i need jscript. please any one can hepl me
Harish
|
|
|
|
|
I have a normal HTML/CSS w/some JScript thrown-in webpage, with > 50 individual blog pages that are indexed from the main index.html file.
On my wishlist are two things:
-would like to add a Search Box. Not one that depends on an external search engine. I want to roll my own, so to speak. I want to have all my pages accessible - so that I can search through the pages and then display the results to a user after a search. I'm thinking that the pages need to be put into a database for this(?)
-Would like to add a 'prev' and a 'next' function to the bottom of each sub-webpage. The user should not always have to navigate back to the index to see another page. Would like one function that takes an argument - prev or next. Or two separate functions are ok. What I want to avoid is having to hardcode "num of next page", and "num of prev page" on every subpage. Can be very error-prone.
What language(s), DBs would be best for this? I worked as a professional programmer in the past, so complexity of code is not a problem.
A language that works good with a DB (if needed), and one where the functions work in Windows and in Linux is important. Also, a great debugger is paramount, as I anticipate using it a lot when first starting out.
Take Care
God Bless... Feedscrn
+--------------------------------+
| The screen is hungry, Feed It! |
+--------------------------------+
|
|
|
|